Author: lcorneliussen
Date: Tue Dec 27 16:46:49 2011
New Revision: 1224944
URL: http://svn.apache.org/viewvc?rev=1224944&view=rev
Log:
[NPANDAY-480] Support Windows Azure Cloud Service Project and Packaging (CCPack)
o Attach separate 'Package' cloud configuration file
Added:
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/AbstractNPandaySettingsAwareMojo.java
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/CreateCloudServicePackageMojo.java
(contents, props changed)
- copied, changed from r1224892,
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/PackageAzureCloudServiceMojo.java
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/ProcessCloudServiceConfigurationMojo.java
Removed:
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/PackageAzureCloudServiceMojo.java
Modified:
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/AbstractCSPackDeployMojo.java
Modified:
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/AbstractCSPackDeployMojo.java
URL:
http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/AbstractCSPackDeployMojo.java?rev=1224944&r1=1224943&r2=1224944&view=diff
==============================================================================
---
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/AbstractCSPackDeployMojo.java
(original)
+++
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/AbstractCSPackDeployMojo.java
Tue Dec 27 16:46:49 2011
@@ -1,5 +1,3 @@
-package npanday.plugin.azure;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,16 +17,14 @@ package npanday.plugin.azure;
* under the License.
*/
+package npanday.plugin.azure;
+
import npanday.PlatformUnsupportedException;
import npanday.executable.ExecutableRequirement;
import npanday.executable.ExecutionException;
import npanday.executable.NetExecutable;
-import npanday.registry.RepositoryRegistry;
-import npanday.vendor.SettingsUtil;
-import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.MavenProjectHelper;
+import org.apache.maven.plugin.MojoFailureException;
import java.util.List;
@@ -39,33 +35,8 @@ import java.util.List;
* @author <a href="mailto:[email protected]">Lars Corneliussen</a>
*/
public abstract class AbstractCSPackDeployMojo
- extends AbstractMojo
+ extends AbstractNPandaySettingsAwareMojo
{
- /**
- * @parameter expression="${npanday.settings}"
default-value="${user.home}/.m2"
- */
- private String settingsPath;
-
- /**
- * The vendor of the framework, the executable is provided by or
compatible with.
- *
- * @parameter expression="${vendor}"
- */
- private String vendor;
-
- /**
- * The version of the framework vendor, the executable is provided by or
compatible with.
- *
- * @parameter expression="${vendor}"
- */
- private String vendorVersion;
-
- /**
- * The framework version, the executable is compatible with.
- *
- * @parameter expression = "${frameworkVersion}"
- */
- private String frameworkVersion;
/**
* The executable identifier used to locate the right configurations from
executable-plugins.xml. Can't be changed.
@@ -87,35 +58,8 @@ public abstract class AbstractCSPackDepl
*/
private String executableProfile;
- /**
- * @component
- */
- private RepositoryRegistry repositoryRegistry;
-
- /**
- * @component
- */
- private npanday.executable.NetExecutableFactory netExecutableFactory;
-
- /**
- * The maven project.
- *
- * @parameter expression="${project}"
- * @required
- */
- protected MavenProject project;
-
- /**
- * The maven project helper.
- *
- * @component
- */
- protected MavenProjectHelper projectHelper;
-
- public void execute() throws MojoExecutionException
+ public void innerExecute() throws MojoExecutionException,
MojoFailureException
{
- SettingsUtil.applyCustomSettings( getLog(), repositoryRegistry,
settingsPath );
-
beforeCommandExecution();
try
Added:
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/AbstractNPandaySettingsAwareMojo.java
URL:
http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/AbstractNPandaySettingsAwareMojo.java?rev=1224944&view=auto
==============================================================================
---
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/AbstractNPandaySettingsAwareMojo.java
(added)
+++
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/AbstractNPandaySettingsAwareMojo.java
Tue Dec 27 16:46:49 2011
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package npanday.plugin.azure;
+
+import npanday.registry.RepositoryRegistry;
+import npanday.vendor.SettingsUtil;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.MavenProjectHelper;
+
+/**
+ * @author <a href="mailto:[email protected]">Lars Corneliussen</a>
+ */
+public abstract class AbstractNPandaySettingsAwareMojo
+ extends AbstractMojo
+{
+ /**
+ * If the execution of this goal is to be skipped.
+ *
+ * @parameter
+ */
+ protected boolean skip;
+
+ /**
+ * @parameter expression="${npanday.settings}"
default-value="${user.home}/.m2"
+ */
+ protected String settingsPath;
+
+ /**
+ * The vendor of the framework, the executable is provided by or
compatible with.
+ *
+ * @parameter expression="${vendor}"
+ */
+ protected String vendor;
+
+ /**
+ * The version of the framework vendor, the executable is provided by or
compatible with.
+ *
+ * @parameter expression="${vendor}"
+ */
+ protected String vendorVersion;
+
+ /**
+ * The framework version, the executable is compatible with.
+ *
+ * @parameter expression = "${frameworkVersion}"
+ */
+ protected String frameworkVersion;
+
+ /**
+ * @component
+ */
+ protected RepositoryRegistry repositoryRegistry;
+
+ /**
+ * @component
+ */
+ protected npanday.executable.NetExecutableFactory netExecutableFactory;
+
+ /**
+ * The maven project.
+ *
+ * @parameter expression="${project}"
+ * @required
+ */
+ protected MavenProject project;
+
+ /**
+ * The maven project helper.
+ *
+ * @component
+ */
+ protected MavenProjectHelper projectHelper;
+
+ public final void execute() throws MojoExecutionException,
MojoFailureException
+ {
+ if ( skip )
+ {
+ getLog().info(
+ "NPANDAY-126-000: Execution of " + getClass().getSimpleName()
+ " was skipped by configuration."
+ );
+ return;
+ }
+
+ SettingsUtil.applyCustomSettings( getLog(), repositoryRegistry,
settingsPath );
+
+ innerExecute();
+ }
+
+ protected abstract void innerExecute() throws MojoExecutionException,
MojoFailureException;
+}
Copied:
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/CreateCloudServicePackageMojo.java
(from r1224892,
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/PackageAzureCloudServiceMojo.java)
URL:
http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/CreateCloudServicePackageMojo.java?p2=incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/CreateCloudServicePackageMojo.java&p1=incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/PackageAzureCloudServiceMojo.java&r1=1224892&r2=1224944&rev=1224944&view=diff
==============================================================================
---
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/PackageAzureCloudServiceMojo.java
(original)
+++
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/CreateCloudServicePackageMojo.java
Tue Dec 27 16:46:49 2011
@@ -22,7 +22,6 @@ package npanday.plugin.azure;
import com.google.common.collect.Lists;
import npanday.ArtifactType;
import npanday.PathUtil;
-import npanday.plugin.azure.AbstractCSPackDeployMojo;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.MojoExecutionException;
@@ -38,18 +37,22 @@ import java.util.Set;
* @goal create-cloud-service-package
* @requiresDependencyResolution runtime
*/
-public class PackageAzureCloudServiceMojo
+public class CreateCloudServicePackageMojo
extends AbstractCSPackDeployMojo
{
private File packageFile, templateConfigurationFile;
/**
- * @parameter expression="${cspack.serviceDefinition}"
default-value="${basedir}/ServiceDefinition.csdef"
+ * The service definition file that get passed along to cspack.
+ *
+ * @parameter expression="${azure.serviceDefinition}"
default-value="${basedir}/ServiceDefinition.csdef"
*/
private File serviceDefinitionFile;
/**
- * @parameter expression="${cspack.generateConfigurationFile}"
default-value="true"
+ * If a vanilla cloud service configuration file should be generated and
attached along with the package.
+ *
+ * @parameter expression="${azure.generateConfigurationFile}"
default-value="true"
*/
private boolean generateConfigurationFile;
@@ -88,7 +91,7 @@ public class PackageAzureCloudServiceMoj
}
projectHelper.attachArtifact(
- project,
ArtifactType.AZURE_CLOUD_SERVICE_CONFIGURATION.getPackagingType(),
"configtemplate",
+ project,
ArtifactType.AZURE_CLOUD_SERVICE_CONFIGURATION.getPackagingType(), "generated",
templateConfigurationFile
);
}
Propchange:
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/CreateCloudServicePackageMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/ProcessCloudServiceConfigurationMojo.java
URL:
http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/ProcessCloudServiceConfigurationMojo.java?rev=1224944&view=auto
==============================================================================
---
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/ProcessCloudServiceConfigurationMojo.java
(added)
+++
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/ProcessCloudServiceConfigurationMojo.java
Tue Dec 27 16:46:49 2011
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package npanday.plugin.azure;
+
+import npanday.ArtifactType;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+import java.io.File;
+
+/**
+ * @author <a href="mailto:[email protected]">Lars Corneliussen</a>
+ * @goal process-cloud-service-configuration
+ */
+public class ProcessCloudServiceConfigurationMojo
+ extends AbstractNPandaySettingsAwareMojo
+{
+ /**
+ * The cloud service configuration file to attach.
+ *
+ * @parameter
+ * expression="${azure.serviceConfigurationFile}"
+ * default-value="${basedir}/ServiceConfiguration.Package.cscfg"
+ */
+ private File serviceConfigurationFile;
+
+ /**
+ * @parameter expression="${azure.serviceConfigurationClassifier}"
+ * default-value="package"
+ */
+ private String serviceConfigurationClassifier;
+
+ public void innerExecute() throws MojoExecutionException,
MojoFailureException
+ {
+ if ( !serviceConfigurationFile.exists() )
+ {
+ throw new MojoExecutionException(
+ "NPANDAY-125-001: Couldn't find the cloud configuration file
to attach along with the package "
+ + serviceConfigurationFile.getAbsolutePath()
+ );
+ }
+
+ projectHelper.attachArtifact(
+ project,
ArtifactType.AZURE_CLOUD_SERVICE_CONFIGURATION.getPackagingType(),
serviceConfigurationClassifier,
+ serviceConfigurationFile
+ );
+ }
+}