All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sap.cloud.sdk.s4hana.UsageAnalyticsMojo Maven / Gradle / Ivy

/*
 * Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved.
 */

package com.sap.cloud.sdk.s4hana;

import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;

import com.sap.cloud.sdk.s4hana.usageanalytics.UsageAnalytics;

/**
 * Mojo sending obfuscated usage data for the SAP S/4HANA Cloud SDK to the SAP analytics service.
 * 

* Note: This Mojo only delegates to the {@link UsageAnalytics} class that is referenced via a separate dependency. This * enables a self-updating mechanism for this plugin without the need for users to update the plugin manually. */ @Mojo( name = "usage-analytics", defaultPhase = LifecyclePhase.COMPILE, threadSafe = true ) public class UsageAnalyticsMojo extends AbstractMojo { @Parameter( defaultValue = "${session}", readonly = true ) private MavenSession mavenSession; @Parameter( defaultValue = "${mojoExecution}", readonly = true ) private MojoExecution mojoExecution; /** * Used to specify whether to skip usage analytics. *

* Note that this parameter is deprecated since its behavior may change in the future. Use * {@link #skipUsageAnalytics} instead. If both parameters are specified and any of them is {@code true}, this goal * will be skipped. * * @deprecated The skip parameter is deprecated. Use {@link #skipUsageAnalytics} instead. */ @Deprecated @Parameter private Boolean skip; /** * Specifies whether to skip usage analytics. */ @Parameter private Boolean skipUsageAnalytics; /** * Specifies whether the salt that can be used when hashing the usage data will be securely auto-generated, if the * salt is omitted or empty. */ @Parameter( defaultValue = UsageAnalytics.DEFAULT_GENERATE_SALT ) private Boolean generateSalt; /** * Specifies the salt to be used when hashing the usage data. If this value is omitted or empty, the behavior is * defined by the generateSalt parameter: *

    *
  • If salt generation is disabled (default), no salt is added to the hashed value.
  • *
  • If salt generation is enabled, a salt will be securely auto-generated and written to the POM file.
  • *
*/ @Parameter private String salt; @SuppressWarnings( "deprecation" ) @Override public void execute() { if( skip != null ) { getLog().warn("The skip parameter is deprecated. Use skipUsageAnalytics instead."); } final boolean skipGoal; if( skip == null && skipUsageAnalytics == null ) { skipGoal = Boolean.valueOf(UsageAnalytics.DEFAULT_SKIP); } else { skipGoal = Boolean.TRUE.equals(skip) || Boolean.TRUE.equals(skipUsageAnalytics); } new UsageAnalytics(mavenSession, mojoExecution, skipGoal, generateSalt, salt).execute(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy