This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to annotated tag slingstart-maven-plugin-1.0.0 in repository https://gitbox.apache.org/repos/asf/sling-slingstart-maven-plugin.git
commit 95448263a59d41e59ffb143b44f90f555adf968b Author: Carsten Ziegeler <[email protected]> AuthorDate: Mon Sep 22 11:56:51 2014 +0000 Update javadocs and rename subsystem to deliverable and run mode to feature git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/tooling/maven/slingstart-maven-plugin@1626745 13f79535-47bb-0310-9956-ffa450edef68 --- .../maven/slingstart/AbstractSubsystemMojo.java | 10 +-- .../maven/slingstart/AttachSlingSubsystem.java | 4 +- .../sling/maven/slingstart/BuildConstants.java | 6 +- .../slingstart/DependencyLifecycleParticipant.java | 16 ++--- .../sling/maven/slingstart/PreparePackageMojo.java | 74 +++++++++++----------- .../sling/maven/slingstart/SubsystemUtils.java | 26 ++++---- 6 files changed, 68 insertions(+), 68 deletions(-) diff --git a/src/main/java/org/apache/sling/maven/slingstart/AbstractSubsystemMojo.java b/src/main/java/org/apache/sling/maven/slingstart/AbstractSubsystemMojo.java index 121ef2c..1bdd46b 100644 --- a/src/main/java/org/apache/sling/maven/slingstart/AbstractSubsystemMojo.java +++ b/src/main/java/org/apache/sling/maven/slingstart/AbstractSubsystemMojo.java @@ -27,7 +27,7 @@ import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; import org.apache.maven.project.MavenProjectHelper; -import org.apache.sling.slingstart.model.SSMSubsystem; +import org.apache.sling.slingstart.model.SSMDeliverable; import org.apache.sling.slingstart.model.xml.XMLSSMModelReader; public abstract class AbstractSubsystemMojo extends AbstractMojo { @@ -50,15 +50,15 @@ public abstract class AbstractSubsystemMojo extends AbstractMojo { /** * Read the model prepared by the lifecycle plugin */ - protected SSMSubsystem readModel() + protected SSMDeliverable readModel() throws MojoExecutionException { - SSMSubsystem result = (SSMSubsystem)this.project.getContextValue(SSMSubsystem.class.getName()); + SSMDeliverable result = (SSMDeliverable)this.project.getContextValue(SSMDeliverable.class.getName()); if ( result == null ) { try { - final String contents = (String)this.project.getContextValue(SSMSubsystem.class.getName() + "/text"); + final String contents = (String)this.project.getContextValue(SSMDeliverable.class.getName() + "/text"); result = XMLSSMModelReader.read(new StringReader(contents)); - this.project.setContextValue(SSMSubsystem.class.getName(), result); + this.project.setContextValue(SSMDeliverable.class.getName(), result); } catch ( final IOException ioe) { throw new MojoExecutionException("Unable to cache model", ioe); } diff --git a/src/main/java/org/apache/sling/maven/slingstart/AttachSlingSubsystem.java b/src/main/java/org/apache/sling/maven/slingstart/AttachSlingSubsystem.java index 72a9687..fec0fc4 100644 --- a/src/main/java/org/apache/sling/maven/slingstart/AttachSlingSubsystem.java +++ b/src/main/java/org/apache/sling/maven/slingstart/AttachSlingSubsystem.java @@ -27,7 +27,7 @@ import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.ResolutionScope; -import org.apache.sling.slingstart.model.SSMSubsystem; +import org.apache.sling.slingstart.model.SSMDeliverable; import org.apache.sling.slingstart.model.xml.XMLSSMModelWriter; /** @@ -44,7 +44,7 @@ public class AttachSlingSubsystem extends AbstractSubsystemMojo { @Override public void execute() throws MojoExecutionException, MojoFailureException { - final SSMSubsystem model = this.readModel(); + final SSMDeliverable model = this.readModel(); final File outputFile = new File(this.project.getBuild().getDirectory() + File.separatorChar + "slingstart.xml"); outputFile.getParentFile().mkdirs(); diff --git a/src/main/java/org/apache/sling/maven/slingstart/BuildConstants.java b/src/main/java/org/apache/sling/maven/slingstart/BuildConstants.java index 169bcdc..01f2238 100644 --- a/src/main/java/org/apache/sling/maven/slingstart/BuildConstants.java +++ b/src/main/java/org/apache/sling/maven/slingstart/BuildConstants.java @@ -19,14 +19,14 @@ package org.apache.sling.maven.slingstart; import java.util.ArrayList; import java.util.List; -import org.apache.sling.slingstart.model.SSMRunMode; +import org.apache.sling.slingstart.model.SSMFeature; public abstract class BuildConstants { // CONTEXTS public static final String CONTEXT_GLOBAL = "slingstart:global"; - public static final String CONTEXT_STANDALONE = "slingstart" + SSMRunMode.RUN_MODE_STANDALONE; - public static final String CONTEXT_WEBAPP = "slingstart" + SSMRunMode.RUN_MODE_WEBAPP; + public static final String CONTEXT_STANDALONE = "slingstart" + SSMFeature.RUN_MODE_STANDALONE; + public static final String CONTEXT_WEBAPP = "slingstart" + SSMFeature.RUN_MODE_WEBAPP; // Types diff --git a/src/main/java/org/apache/sling/maven/slingstart/DependencyLifecycleParticipant.java b/src/main/java/org/apache/sling/maven/slingstart/DependencyLifecycleParticipant.java index 797d867..bbb8478 100644 --- a/src/main/java/org/apache/sling/maven/slingstart/DependencyLifecycleParticipant.java +++ b/src/main/java/org/apache/sling/maven/slingstart/DependencyLifecycleParticipant.java @@ -37,9 +37,9 @@ import org.apache.maven.model.Dependency; import org.apache.maven.model.Plugin; import org.apache.maven.project.MavenProject; import org.apache.sling.slingstart.model.SSMArtifact; -import org.apache.sling.slingstart.model.SSMRunMode; +import org.apache.sling.slingstart.model.SSMDeliverable; +import org.apache.sling.slingstart.model.SSMFeature; import org.apache.sling.slingstart.model.SSMStartLevel; -import org.apache.sling.slingstart.model.SSMSubsystem; import org.apache.sling.slingstart.model.xml.XMLSSMModelWriter; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Requirement; @@ -109,11 +109,11 @@ public class DependencyLifecycleParticipant extends AbstractMavenLifecyclePartic final String directory = nodeValue((Xpp3Dom) plugin.getConfiguration(), "systemsDirectory", new File(project.getBasedir(), "src/main/systems").getAbsolutePath()); - final SSMSubsystem model = SubsystemUtils.readFullModel(new File(directory), dependencies, project, session, log); + final SSMDeliverable model = SubsystemUtils.readFullModel(new File(directory), dependencies, project, session, log); final StringWriter w = new StringWriter(); XMLSSMModelWriter.write(w, model); - project.setContextValue(SSMSubsystem.class.getName() + "/text", w.toString()); + project.setContextValue(SSMDeliverable.class.getName() + "/text", w.toString()); // start with base artifact final SSMArtifact base = SubsystemUtils.getBaseArtifact(model); @@ -137,13 +137,13 @@ public class DependencyLifecycleParticipant extends AbstractMavenLifecyclePartic addDependencies(model, log, project); } - private static void addDependencies(final SSMSubsystem model, final Logger log, final MavenProject project) { - for(final SSMRunMode runMode : model.runModes) { + private static void addDependencies(final SSMDeliverable model, final Logger log, final MavenProject project) { + for(final SSMFeature feature : model.features) { // skip base - if ( runMode.isRunMode(SSMRunMode.RUN_MODE_BASE) ) { + if ( feature.isRunMode(SSMFeature.RUN_MODE_BASE) ) { continue; } - for(final SSMStartLevel sl : runMode.startLevels) { + for(final SSMStartLevel sl : feature.startLevels) { for(final SSMArtifact a : sl.artifacts) { final Dependency dep = new Dependency(); dep.setGroupId(a.groupId); diff --git a/src/main/java/org/apache/sling/maven/slingstart/PreparePackageMojo.java b/src/main/java/org/apache/sling/maven/slingstart/PreparePackageMojo.java index d595251..10ccab8 100644 --- a/src/main/java/org/apache/sling/maven/slingstart/PreparePackageMojo.java +++ b/src/main/java/org/apache/sling/maven/slingstart/PreparePackageMojo.java @@ -33,9 +33,9 @@ import org.apache.maven.plugins.annotations.ResolutionScope; import org.apache.sling.slingstart.model.SSMArtifact; import org.apache.sling.slingstart.model.SSMConfiguration; import org.apache.sling.slingstart.model.SSMConstants; -import org.apache.sling.slingstart.model.SSMRunMode; +import org.apache.sling.slingstart.model.SSMDeliverable; +import org.apache.sling.slingstart.model.SSMFeature; import org.apache.sling.slingstart.model.SSMStartLevel; -import org.apache.sling.slingstart.model.SSMSubsystem; import org.codehaus.plexus.archiver.ArchiverException; import org.codehaus.plexus.archiver.UnArchiver; import org.codehaus.plexus.archiver.manager.ArchiverManager; @@ -73,7 +73,7 @@ public class PreparePackageMojo extends AbstractSubsystemMojo { @Override public void execute() throws MojoExecutionException, MojoFailureException { - final SSMSubsystem model = this.readModel(); + final SSMDeliverable model = this.readModel(); this.prepareGlobal(model); this.prepareStandaloneApp(model); @@ -83,7 +83,7 @@ public class PreparePackageMojo extends AbstractSubsystemMojo { /** * Prepare the global map for the artifacts. */ - private void prepareGlobal(final SSMSubsystem model) throws MojoExecutionException { + private void prepareGlobal(final SSMDeliverable model) throws MojoExecutionException { final Map<String, File> globalContentsMap = new HashMap<String, File>(); this.buildContentsMap(model, (String)null, globalContentsMap); @@ -93,23 +93,23 @@ public class PreparePackageMojo extends AbstractSubsystemMojo { /** * Prepare the standalone application. */ - private void prepareStandaloneApp(final SSMSubsystem model) throws MojoExecutionException { + private void prepareStandaloneApp(final SSMDeliverable model) throws MojoExecutionException { final Map<String, File> contentsMap = new HashMap<String, File>(); this.project.setContextValue(BuildConstants.CONTEXT_STANDALONE, contentsMap); // unpack base artifact and create settings final File outputDir = new File(this.project.getBuild().getOutputDirectory()); - unpackBaseArtifact(model, outputDir, SSMRunMode.RUN_MODE_STANDALONE); - this.buildSettings(model, SSMRunMode.RUN_MODE_STANDALONE, outputDir); - this.buildBootstrapFile(model, SSMRunMode.RUN_MODE_STANDALONE, outputDir); + unpackBaseArtifact(model, outputDir, SSMFeature.RUN_MODE_STANDALONE); + this.buildSettings(model, SSMFeature.RUN_MODE_STANDALONE, outputDir); + this.buildBootstrapFile(model, SSMFeature.RUN_MODE_STANDALONE, outputDir); - this.buildContentsMap(model, SSMRunMode.RUN_MODE_STANDALONE, contentsMap); + this.buildContentsMap(model, SSMFeature.RUN_MODE_STANDALONE, contentsMap); } /** * Prepare the web application. */ - private void prepareWebapp(final SSMSubsystem model) throws MojoExecutionException { + private void prepareWebapp(final SSMDeliverable model) throws MojoExecutionException { if ( this.createWebapp ) { final Map<String, File> contentsMap = new HashMap<String, File>(); this.project.setContextValue(BuildConstants.CONTEXT_WEBAPP, contentsMap); @@ -117,10 +117,10 @@ public class PreparePackageMojo extends AbstractSubsystemMojo { // unpack base artifact and create settings final File outputDir = new File(this.project.getBuild().getDirectory(), BuildConstants.WEBAPP_OUTDIR); final File webappDir = new File(outputDir, "WEB-INF"); - unpackBaseArtifact(model, outputDir, SSMRunMode.RUN_MODE_WEBAPP); + unpackBaseArtifact(model, outputDir, SSMFeature.RUN_MODE_WEBAPP); // check for web.xml - final SSMRunMode webappRM = model.getRunMode(SSMRunMode.RUN_MODE_WEBAPP); + final SSMFeature webappRM = model.getRunMode(SSMFeature.RUN_MODE_WEBAPP); if ( webappRM != null ) { final SSMConfiguration webConfig = webappRM.getConfiguration(SSMConstants.CFG_WEB_XML); if ( webConfig != null ) { @@ -132,33 +132,33 @@ public class PreparePackageMojo extends AbstractSubsystemMojo { } } } - this.buildSettings(model, SSMRunMode.RUN_MODE_WEBAPP, webappDir); - this.buildBootstrapFile(model, SSMRunMode.RUN_MODE_WEBAPP, outputDir); + this.buildSettings(model, SSMFeature.RUN_MODE_WEBAPP, webappDir); + this.buildBootstrapFile(model, SSMFeature.RUN_MODE_WEBAPP, outputDir); - this.buildContentsMap(model, SSMRunMode.RUN_MODE_WEBAPP, contentsMap); + this.buildContentsMap(model, SSMFeature.RUN_MODE_WEBAPP, contentsMap); } } /** * Build a list of all artifacts. */ - private void buildContentsMap(final SSMSubsystem model, final String packageRunMode, final Map<String, File> contentsMap) + private void buildContentsMap(final SSMDeliverable model, final String packageRunMode, final Map<String, File> contentsMap) throws MojoExecutionException { if ( packageRunMode == null ) { // add base jar final Artifact artifact = getBaseArtifact(model, null, BuildConstants.TYPE_JAR); contentsMap.put(BASE_DESTINATION + "/"+ artifact.getArtifactId() + "." + artifact.getArtifactHandler().getExtension(), artifact.getFile()); } - for(final SSMRunMode runMode : model.runModes) { + for(final SSMFeature feature : model.features) { if ( packageRunMode == null ) { - if ( runMode.isSpecial() - && !runMode.isRunMode(SSMRunMode.RUN_MODE_BOOT)) { + if ( feature.isSpecial() + && !feature.isRunMode(SSMFeature.RUN_MODE_BOOT)) { continue; } - this.buildContentsMap(model, runMode, contentsMap); + this.buildContentsMap(model, feature, contentsMap); } else { - if ( runMode.isRunMode(packageRunMode) ) { - this.buildContentsMap(model, runMode, contentsMap); + if ( feature.isRunMode(packageRunMode) ) { + this.buildContentsMap(model, feature, contentsMap); } } } @@ -167,7 +167,7 @@ public class PreparePackageMojo extends AbstractSubsystemMojo { /** * Build a list of all artifacts from this run mode */ - private void buildContentsMap(final SSMSubsystem model, final SSMRunMode runMode, final Map<String, File> contentsMap) + private void buildContentsMap(final SSMDeliverable model, final SSMFeature runMode, final Map<String, File> contentsMap) throws MojoExecutionException{ for(final SSMStartLevel sl : runMode.startLevels) { for(final SSMArtifact a : sl.artifacts) { @@ -203,20 +203,20 @@ public class PreparePackageMojo extends AbstractSubsystemMojo { /** * Build the settings for the given packaging run mode */ - private void buildSettings(final SSMSubsystem model, final String packageRunMode, final File outputDir) + private void buildSettings(final SSMDeliverable model, final String packageRunMode, final File outputDir) throws MojoExecutionException { String settings = null; - final SSMRunMode baseRM = model.getRunMode(SSMRunMode.RUN_MODE_BASE); + final SSMFeature baseRM = model.getRunMode(SSMFeature.RUN_MODE_BASE); if ( baseRM != null && baseRM.settings != null ) { settings = baseRM.settings.properties + "\n"; } else { settings = ""; } - final SSMRunMode bootRM = model.getRunMode(SSMRunMode.RUN_MODE_BOOT); + final SSMFeature bootRM = model.getRunMode(SSMFeature.RUN_MODE_BOOT); if ( bootRM != null && bootRM.settings != null ) { settings = settings + bootRM.settings.properties + "\n"; } - final SSMRunMode packageRM = model.getRunMode(packageRunMode); + final SSMFeature packageRM = model.getRunMode(packageRunMode); if ( packageRM != null && packageRM.settings != null ) { settings = settings + packageRM.settings.properties; } @@ -235,24 +235,24 @@ public class PreparePackageMojo extends AbstractSubsystemMojo { /** * Build the bootstrap file for the given packaging run mode */ - private void buildBootstrapFile(final SSMSubsystem model, final String packageRunMode, final File outputDir) + private void buildBootstrapFile(final SSMDeliverable model, final String packageRunMode, final File outputDir) throws MojoExecutionException { String bootstrapTxt = ""; - final SSMRunMode baseRM = model.getRunMode(SSMRunMode.RUN_MODE_BASE); + final SSMFeature baseRM = model.getRunMode(SSMFeature.RUN_MODE_BASE); if ( baseRM != null ) { final SSMConfiguration c = baseRM.getConfiguration(SSMConstants.CFG_BOOTSTRAP); if ( c != null ) { bootstrapTxt = c.properties + "\n"; } } - final SSMRunMode bootRM = model.getRunMode(SSMRunMode.RUN_MODE_BOOT); + final SSMFeature bootRM = model.getRunMode(SSMFeature.RUN_MODE_BOOT); if ( bootRM != null ) { final SSMConfiguration c = bootRM.getConfiguration(SSMConstants.CFG_BOOTSTRAP); if ( c != null ) { bootstrapTxt = bootstrapTxt + c.properties; } } - final SSMRunMode packageRM = model.getRunMode(packageRunMode); + final SSMFeature packageRM = model.getRunMode(packageRunMode); if ( packageRM != null ) { final SSMConfiguration c = packageRM.getConfiguration(SSMConstants.CFG_BOOTSTRAP); if ( c != null ) { @@ -274,7 +274,7 @@ public class PreparePackageMojo extends AbstractSubsystemMojo { /** * Return the base artifact */ - private Artifact getBaseArtifact(final SSMSubsystem model, final String classifier, final String type) throws MojoExecutionException { + private Artifact getBaseArtifact(final SSMDeliverable model, final String classifier, final String type) throws MojoExecutionException { final SSMArtifact baseArtifact = SubsystemUtils.getBaseArtifact(model); final Artifact a = SubsystemUtils.getArtifact(this.project, baseArtifact.groupId, @@ -293,11 +293,11 @@ public class PreparePackageMojo extends AbstractSubsystemMojo { /** * Unpack the base artifact */ - private void unpackBaseArtifact(final SSMSubsystem model, final File outputDirectory, final String packageRunMode) + private void unpackBaseArtifact(final SSMDeliverable model, final File outputDirectory, final String packageRunMode) throws MojoExecutionException { final String classifier; final String type; - if ( SSMRunMode.RUN_MODE_STANDALONE.equals(packageRunMode) ) { + if ( SSMFeature.RUN_MODE_STANDALONE.equals(packageRunMode) ) { classifier = BuildConstants.CLASSIFIER_APP; type = BuildConstants.TYPE_JAR; } else { @@ -333,7 +333,7 @@ public class PreparePackageMojo extends AbstractSubsystemMojo { /** * Get the relative path for an artifact. */ - private String getPathForArtifact(final int startLevel, final String artifactName, final SSMRunMode rm) { + private String getPathForArtifact(final int startLevel, final String artifactName, final SSMFeature rm) { final Set<String> runModesList = new TreeSet<String>(); if (rm.runModes != null ) { for(final String mode : rm.runModes) { @@ -352,7 +352,7 @@ public class PreparePackageMojo extends AbstractSubsystemMojo { runModeExt = sb.toString(); } - if ( rm.isRunMode(SSMRunMode.RUN_MODE_BOOT) ) { + if ( rm.isRunMode(SSMFeature.RUN_MODE_BOOT) ) { return String.format("%s/%s/1/%s", BASE_DESTINATION, BOOT_DIRECTORY, artifactName); } @@ -365,7 +365,7 @@ public class PreparePackageMojo extends AbstractSubsystemMojo { /** * Get the relative path for a configuration */ - private String getPathForConfiguration(final SSMConfiguration config, final SSMRunMode rm) { + private String getPathForConfiguration(final SSMConfiguration config, final SSMFeature rm) { final Set<String> runModesList = new TreeSet<String>(); if (rm.runModes != null ) { for(final String mode : rm.runModes) { diff --git a/src/main/java/org/apache/sling/maven/slingstart/SubsystemUtils.java b/src/main/java/org/apache/sling/maven/slingstart/SubsystemUtils.java index d0c36ac..5ff6b8a 100644 --- a/src/main/java/org/apache/sling/maven/slingstart/SubsystemUtils.java +++ b/src/main/java/org/apache/sling/maven/slingstart/SubsystemUtils.java @@ -30,8 +30,8 @@ import org.apache.maven.execution.MavenSession; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.project.MavenProject; import org.apache.sling.slingstart.model.SSMArtifact; -import org.apache.sling.slingstart.model.SSMRunMode; -import org.apache.sling.slingstart.model.SSMSubsystem; +import org.apache.sling.slingstart.model.SSMFeature; +import org.apache.sling.slingstart.model.SSMDeliverable; import org.apache.sling.slingstart.model.xml.XMLSSMModelReader; import org.codehaus.plexus.logging.Logger; @@ -41,9 +41,9 @@ public abstract class SubsystemUtils { * Read all model files from the directory in alphabetical order * @param logger */ - private static SSMSubsystem readLocalModel(final File systemsDirectory, final MavenProject project, final MavenSession session, final Logger logger) + private static SSMDeliverable readLocalModel(final File systemsDirectory, final MavenProject project, final MavenSession session, final Logger logger) throws MojoExecutionException { - final SSMSubsystem result = new SSMSubsystem(); + final SSMDeliverable result = new SSMDeliverable(); final List<String> candidates = new ArrayList<String>(); if ( systemsDirectory != null && systemsDirectory.exists() ) { for(final File f : systemsDirectory.listFiles() ) { @@ -61,7 +61,7 @@ public abstract class SubsystemUtils { try { final FileReader reader = new FileReader(new File(systemsDirectory, name)); try { - final SSMSubsystem current = XMLSSMModelReader.read(reader); + final SSMDeliverable current = XMLSSMModelReader.read(reader); try { current.validate(); } catch ( final IllegalStateException ise) { @@ -88,25 +88,25 @@ public abstract class SubsystemUtils { /** * Read the full model */ - public static SSMSubsystem readFullModel(final File systemsDirectory, + public static SSMDeliverable readFullModel(final File systemsDirectory, final List<File> dependentModels, final MavenProject project, final MavenSession session, final Logger logger) throws MojoExecutionException { try { - final SSMSubsystem localModel = readLocalModel(systemsDirectory, project, session, logger); + final SSMDeliverable localModel = readLocalModel(systemsDirectory, project, session, logger); // check dependent models - SSMSubsystem depModel = null; + SSMDeliverable depModel = null; for(final File file : dependentModels) { FileReader r = null; try { r = new FileReader(file); if ( depModel == null ) { - depModel = new SSMSubsystem(); + depModel = new SSMDeliverable(); } - final SSMSubsystem readModel = XMLSSMModelReader.read(r); + final SSMDeliverable readModel = XMLSSMModelReader.read(r); try { readModel.validate(); } catch ( final IllegalStateException ise) { @@ -117,7 +117,7 @@ public abstract class SubsystemUtils { IOUtils.closeQuietly(r); } } - final SSMSubsystem result; + final SSMDeliverable result; if ( depModel != null ) { try { depModel.validate(); @@ -136,9 +136,9 @@ public abstract class SubsystemUtils { } } - public static SSMArtifact getBaseArtifact(final SSMSubsystem model) throws MojoExecutionException { + public static SSMArtifact getBaseArtifact(final SSMDeliverable model) throws MojoExecutionException { // get base run mode - final SSMRunMode base = model.getRunMode(SSMRunMode.RUN_MODE_BASE); + final SSMFeature base = model.getRunMode(SSMFeature.RUN_MODE_BASE); if ( base == null ) { throw new MojoExecutionException("No base run mode found."); } -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
