Repository: tomee Updated Branches: refs/heads/master e7efcb6c8 -> 0cc1119b6
Add some JavaDoc to maven plugin Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/5a0f5d79 Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/5a0f5d79 Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/5a0f5d79 Branch: refs/heads/master Commit: 5a0f5d79db4bd190ae59d0c5d49fd40c8fd4f6b8 Parents: e7efcb6 Author: dalexandrov <mitiaalexand...@gmail.com> Authored: Tue Dec 11 13:26:22 2018 +0200 Committer: Roberto Cortez <radcor...@yahoo.com> Committed: Mon Dec 17 22:31:07 2018 +0000 ---------------------------------------------------------------------- .../maven/plugin/AbstractAddressMojo.java | 21 ++ .../maven/plugin/AbstractCommandMojo.java | 9 + .../maven/plugin/AbstractDeployMojo.java | 6 + .../maven/plugin/AbstractSynchronizable.java | 63 +++++ .../openejb/maven/plugin/AbstractTomEEMojo.java | 281 +++++++++++++++++++ .../openejb/maven/plugin/BuildTomEEMojo.java | 20 ++ .../maven/plugin/ConfigTestTomEEMojo.java | 2 + .../openejb/maven/plugin/DebugTomEEMojo.java | 1 + .../apache/openejb/maven/plugin/DeployMojo.java | 11 + .../apache/openejb/maven/plugin/ExecMojo.java | 11 + .../openejb/maven/plugin/ListEjbMojo.java | 13 + .../openejb/maven/plugin/RunTomEEMojo.java | 2 + .../openejb/maven/plugin/StartTomEEMojo.java | 1 + .../openejb/maven/plugin/StopTomEEMojo.java | 1 + .../org/apache/openejb/maven/plugin/Synch.java | 24 ++ .../openejb/maven/plugin/Synchronization.java | 43 +++ .../openejb/maven/plugin/TomEEException.java | 14 + .../openejb/maven/plugin/UnDeployMojo.java | 1 + .../maven/plugin/UpdatableTomEEMojo.java | 41 +++ .../apache/openejb/maven/plugin/cli/Args.java | 9 + .../maven/plugin/customizer/monkey/Monkey.java | 12 +- .../monkey/classloader/ClassLoaderFactory.java | 15 + .../monkey/file/PatchFolderFinder.java | 10 + .../customizer/monkey/index/FileIndexer.java | 30 ++ .../plugin/customizer/monkey/index/Item.java | 38 ++- .../customizer/monkey/jar/JarPatcher.java | 11 + .../openejb/maven/plugin/runner/ExecRunner.java | 9 + 27 files changed, 696 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tomee/blob/5a0f5d79/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractAddressMojo.java ---------------------------------------------------------------------- diff --git a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractAddressMojo.java b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractAddressMojo.java index 4e91fb6..f97114c 100644 --- a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractAddressMojo.java +++ b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractAddressMojo.java @@ -20,22 +20,43 @@ package org.apache.openejb.maven.plugin; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugins.annotations.Parameter; +/** + * The type AbstractAddressMojo. + */ public abstract class AbstractAddressMojo extends AbstractMojo { + /** + * The TomEE http port. + */ @Parameter(property = "tomee-plugin.http") protected String tomeeHttpPort; + /** + * The TomEE https port. + */ @Parameter(property = "tomee-plugin.https") protected String tomeeHttpsPort; + /** + * The TomEE host. + */ @Parameter(property = "tomee-plugin.host") protected String tomeeHost; + /** + * The User. + */ @Parameter(property = "tomee-plugin.user") protected String user; + /** + * The Password. + */ @Parameter(property = "tomee-plugin.pwd") protected String password; + /** + * The Realm. + */ @Parameter(property = "tomee-plugin.realm") protected String realm; } http://git-wip-us.apache.org/repos/asf/tomee/blob/5a0f5d79/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractCommandMojo.java ---------------------------------------------------------------------- diff --git a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractCommandMojo.java b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractCommandMojo.java index 83c03d7..13f0600 100644 --- a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractCommandMojo.java +++ b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractCommandMojo.java @@ -24,6 +24,9 @@ import javax.naming.InitialContext; import java.util.Map; import java.util.Properties; +/** + * The type AbstractCommandMojo. + */ public abstract class AbstractCommandMojo extends AbstractAddressMojo { /** * Where is deployed ejbd endpoint relatively to root (/tomee/ejb typically). @@ -43,6 +46,12 @@ public abstract class AbstractCommandMojo extends AbstractAddressMojo { @Parameter protected Map<String, String> lookupVariables; + /** + * Lookup object. + * + * @param name the name + * @return the object + */ protected Object lookup(final String name) { if (tomeeHttpPort == null && tomeeHttpsPort == null) { tomeeHttpPort = "8080"; http://git-wip-us.apache.org/repos/asf/tomee/blob/5a0f5d79/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractDeployMojo.java ---------------------------------------------------------------------- diff --git a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractDeployMojo.java b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractDeployMojo.java index 05fe5a8..720c83e 100644 --- a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractDeployMojo.java +++ b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractDeployMojo.java @@ -19,7 +19,13 @@ package org.apache.openejb.maven.plugin; import org.apache.maven.plugins.annotations.Parameter; +/** + * The type AbstractDeployMojo. + */ public abstract class AbstractDeployMojo extends AbstractCommandMojo { + /** + * The Path. + */ @Parameter(property = "tomee-plugin.archive", required = true) protected String path; } http://git-wip-us.apache.org/repos/asf/tomee/blob/5a0f5d79/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractSynchronizable.java ---------------------------------------------------------------------- diff --git a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractSynchronizable.java b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractSynchronizable.java index 1244882..30234e2 100644 --- a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractSynchronizable.java +++ b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractSynchronizable.java @@ -22,23 +22,61 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +/** + * The type Abstract synchronizable. + */ public abstract class AbstractSynchronizable { + /** + * The Update interval. + */ protected int updateInterval; + /** + * The Extensions. + */ protected List<String> extensions; + /** + * The Update only extensions. + */ protected List<String> updateOnlyExtensions; + /** + * The Regex. + */ protected String regex; + /** + * The Updates. + */ protected Map<File, File> updates; + /** + * Updates map. + * + * @return the map + */ public abstract Map<File, File> updates(); + /** + * Gets update interval. + * + * @return the update interval + */ public int getUpdateInterval() { return updateInterval; } + /** + * Sets update interval. + * + * @param updateInterval the update interval + */ public void setUpdateInterval(final int updateInterval) { this.updateInterval = updateInterval; } + /** + * Gets extensions. + * + * @return the extensions + */ public List<String> getExtensions() { if (extensions == null) { extensions = new ArrayList<String>(); @@ -46,18 +84,38 @@ public abstract class AbstractSynchronizable { return extensions; } + /** + * Sets extensions. + * + * @param extensions the extensions + */ public void setExtensions(final List<String> extensions) { this.extensions = extensions; } + /** + * Gets regex. + * + * @return the regex + */ public String getRegex() { return regex; } + /** + * Sets regex. + * + * @param regex the regex + */ public void setRegex(final String regex) { this.regex = regex; } + /** + * Gets update only extenions. + * + * @return the update only extenions + */ public List<String> getUpdateOnlyExtenions() { if (updateOnlyExtensions == null) { updateOnlyExtensions = new ArrayList<String>(); @@ -65,6 +123,11 @@ public abstract class AbstractSynchronizable { return updateOnlyExtensions; } + /** + * Sets update only extensions. + * + * @param updateOnlyExtensions the update only extensions + */ public void setUpdateOnlyExtensions(final List<String> updateOnlyExtensions) { this.updateOnlyExtensions = updateOnlyExtensions; } http://git-wip-us.apache.org/repos/asf/tomee/blob/5a0f5d79/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractTomEEMojo.java ---------------------------------------------------------------------- diff --git a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractTomEEMojo.java b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractTomEEMojo.java index 86a8633..11c99fa 100644 --- a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractTomEEMojo.java +++ b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractTomEEMojo.java @@ -99,37 +99,73 @@ import static org.codehaus.plexus.util.FileUtils.deleteDirectory; import static org.codehaus.plexus.util.IOUtil.close; import static org.codehaus.plexus.util.IOUtil.copy; +/** + * The type AbstractTomEEMojo is the base class to all the maven actions privided by the plugin. + */ public abstract class AbstractTomEEMojo extends AbstractAddressMojo { // if we get let say > 5 patterns like it we should create a LocationAnalyzer // for < 5 patterns it should be fine private static final String NAME_STR = "?name="; private static final String UNZIP_PREFIX = "unzip:"; private static final String REMOVE_PREFIX = "remove:"; + /** + * The constant QUIT_CMD. + */ public static final String QUIT_CMD = "quit"; + /** + * The constant EXIT_CMD. + */ public static final String EXIT_CMD = "exit"; + /** + * The constant TOM_EE. + */ public static final String TOM_EE = "TomEE"; + /** + * The Factory. + */ @Component protected ArtifactFactory factory; + /** + * The Resolver. + */ @Component protected ArtifactResolver resolver; + /** + * The Local. + */ @Parameter(defaultValue = "${localRepository}", readonly = true) protected ArtifactRepository local; + /** + * The Remote repos. + */ @Parameter(defaultValue = "${project.remoteArtifactRepositories}", readonly = true) protected List<ArtifactRepository> remoteRepos; + /** + * The Skip current project. + */ @Parameter(property = "tomee-plugin.skipCurrentProject", defaultValue = "false") protected boolean skipCurrentProject; + /** + * The TomEE version. + */ @Parameter(property = "tomee-plugin.version", defaultValue = "-1") protected String tomeeVersion; + /** + * The TomEE group id. + */ @Parameter(property = "tomee-plugin.groupId", defaultValue = "org.apache.tomee") protected String tomeeGroupId; + /** + * The TomEE artifact id. + */ @Parameter(property = "tomee-plugin.artifactId", defaultValue = "apache-tomee") protected String tomeeArtifactId; @@ -139,6 +175,9 @@ public abstract class AbstractTomEEMojo extends AbstractAddressMojo { @Parameter(property = "tomee-plugin.type", defaultValue = "zip", readonly = true) protected String tomeeType; + /** + * The Apache repos. + */ @Parameter(property = "tomee-plugin.apache-repos", defaultValue = "snapshots") protected String apacheRepos; @@ -148,45 +187,87 @@ public abstract class AbstractTomEEMojo extends AbstractAddressMojo { @Parameter(property = "tomee-plugin.classifier", defaultValue = "webprofile") protected String tomeeClassifier; + /** + * The TomEE shutdown port. + */ @Parameter(property = "tomee-plugin.shutdown") protected String tomeeShutdownPort; + /** + * The TomEE shutdown attempts. + */ @Parameter(property = "tomee-plugin.shutdown.attempts", defaultValue = "60") protected int tomeeShutdownAttempts; + /** + * The TomEE shutdown command. + */ @Parameter(property = "tomee-plugin.shutdown-command", defaultValue = "SHUTDOWN") protected String tomeeShutdownCommand; + /** + * The TomEE ajp port. + */ @Parameter(property = "tomee-plugin.ajp") protected String tomeeAjpPort; + /** + * The Args. + */ @Parameter(property = "tomee-plugin.args") protected String args; + /** + * The Debug. + */ @Parameter(property = "tomee-plugin.debug", defaultValue = "false") protected boolean debug; + /** + * The Simple log. + */ @Parameter(property = "tomee-plugin.simple-log", defaultValue = "false") protected boolean simpleLog; + /** + * The Extract wars. + */ @Parameter(property = "tomee-plugin.extractWars", defaultValue = "false") protected boolean extractWars; + /** + * The Strip war version. + */ @Parameter(property = "tomee-plugin.stripWarVersion", defaultValue = "true") protected boolean stripWarVersion; + /** + * The Strip version. + */ @Parameter(property = "tomee-plugin.stripVersion", defaultValue = "false") protected boolean stripVersion; + /** + * The Debug port. + */ @Parameter(property = "tomee-plugin.debugPort", defaultValue = "5005") protected int debugPort; + /** + * The Webapp resources. + */ @Parameter(defaultValue = "${project.basedir}/src/main/webapp", property = "tomee-plugin.webappResources") protected File webappResources; + /** + * The Webapp classes. + */ @Parameter(defaultValue = "${project.build.outputDirectory}", property = "tomee-plugin.webappClasses") protected File webappClasses; + /** + * The Catalina base. + */ @Parameter(defaultValue = "${project.build.directory}/apache-tomee", property = "tomee-plugin.catalina-base") protected File catalinaBase; @@ -214,39 +295,75 @@ public abstract class AbstractTomEEMojo extends AbstractAddressMojo { @Parameter(defaultValue = "lib") protected String libDir; + /** + * The Main dir. + */ @Parameter(defaultValue = "${project.basedir}/src/main") protected File mainDir; + /** + * The Target. + */ @Parameter(defaultValue = "${project.build.directory}") protected File target; + /** + * The Config. + */ @Parameter(property = "tomee-plugin.conf", defaultValue = "${project.basedir}/src/main/tomee/conf") protected File config; + /** + * The Bin. + */ @Parameter(property = "tomee-plugin.bin", defaultValue = "${project.basedir}/src/main/tomee/bin") protected File bin; + /** + * The Lib. + */ @Parameter(property = "tomee-plugin.lib", defaultValue = "${project.basedir}/src/main/tomee/lib") protected File lib; + /** + * The System variables. + */ @Parameter protected Map<String, String> systemVariables; + /** + * The Classpaths. + */ @Parameter protected List<String> classpaths; + /** + * The Classpath separator. + */ @Parameter(property = "tomee-plugin.classpathSeparator") protected String classpathSeparator; + /** + * The Customizers. + */ @Parameter protected List<String> customizers; + /** + * The Js customizers. + */ @Parameter protected List<String> jsCustomizers; + /** + * The Groovy customizers. + */ @Parameter protected List<String> groovyCustomizers; + /** + * The Project. + */ @Parameter(defaultValue = "${project}", readonly = true, required = true) protected MavenProject project; @@ -283,57 +400,111 @@ public abstract class AbstractTomEEMojo extends AbstractAddressMojo { @Parameter protected List<String> libs; + /** + * The Endorsed libs. + */ @Parameter protected List<String> endorsedLibs; + /** + * The Javaagents. + */ @Parameter protected List<String> javaagents; + /** + * The Persist javaagents. + */ @Parameter(property = "tomee-plugin.persist-javaagents", defaultValue = "false") protected boolean persistJavaagents; + /** + * The Webapps. + */ @Parameter protected List<String> webapps; + /** + * The Apps. + */ @Parameter protected List<String> apps; + /** + * The Classes. + */ @Parameter(property = "tomee-plugin.classes", defaultValue = "${project.build.outputDirectory}", readonly = true) protected File classes; + /** + * The War file. + */ @Parameter(defaultValue = "${project.build.directory}/${project.build.finalName}.${project.packaging}") protected File warFile; + /** + * The Work war file. + */ @Parameter(defaultValue = "${project.build.directory}/${project.build.finalName}", readonly = true) protected File workWarFile; + /** + * The Final name. + */ @Parameter(defaultValue = "${project.build.finalName}", readonly = true) protected String finalName; + /** + * The Artifact id. + */ @Parameter(defaultValue = "${project.artifactId}", readonly = true) protected String artifactId; + /** + * The Remove default webapps. + */ @Parameter(property = "tomee-plugin.remove-default-webapps", defaultValue = "true") protected boolean removeDefaultWebapps; + /** + * The Deploy open ejb application. + */ @Parameter(property = "tomee-plugin.deploy-openejb-internal-application", defaultValue = "false") protected boolean deployOpenEjbApplication; + /** + * The Remove tomee webapp. + */ @Parameter(property = "tomee-plugin.remove-tomee-webapps", defaultValue = "true") protected boolean removeTomeeWebapp; + /** + * The Ejb remote. + */ @Parameter(property = "tomee-plugin.ejb-remote", defaultValue = "true") protected boolean ejbRemote; + /** + * The Packaging. + */ @Parameter(defaultValue = "${project.packaging}", readonly = true) protected String packaging; + /** + * The Check started. + */ @Parameter(property = "tomee-plugin.check-started", defaultValue = "false") protected boolean checkStarted; + /** + * The Use console. + */ @Parameter(property = "tomee-plugin.use-console", defaultValue = "true") protected boolean useConsole; + /** + * The TomEE already installed. + */ @Parameter(property = "tomee-plugin.exiting", defaultValue = "false") protected boolean tomeeAlreadyInstalled; @@ -394,8 +565,17 @@ public abstract class AbstractTomEEMojo extends AbstractAddressMojo { @Parameter(property = "tomee-plugin.keystore") protected String keystore; + /** + * The Deployed file. + */ protected File deployedFile = null; + /** + * The Server. + */ protected RemoteServer server = null; + /** + * The Container. + */ protected String container = TOM_EE; @Override @@ -613,6 +793,9 @@ public abstract class AbstractTomEEMojo extends AbstractAddressMojo { return new URLClassLoader(urls.toArray(new URL[urls.size()]), parent); } + /** + * Fix config. + */ protected void fixConfig() { if (useOpenEJB) { tomeeGroupId = "org.apache.tomee"; @@ -641,6 +824,11 @@ public abstract class AbstractTomEEMojo extends AbstractAddressMojo { } } + /** + * Gets additional classpath. + * + * @return the additional classpath + */ protected String getAdditionalClasspath() { if (!classpaths.isEmpty()) { final StringBuilder cpBuilder = new StringBuilder(); @@ -930,6 +1118,11 @@ public abstract class AbstractTomEEMojo extends AbstractAddressMojo { deployedFile = out; } + /** + * Destination name string. + * + * @return the string + */ protected String destinationName() { if (context != null) { if (!context.contains(".") && !warFile.isDirectory()) { @@ -1078,6 +1271,9 @@ public abstract class AbstractTomEEMojo extends AbstractAddressMojo { return Collections.emptyList(); } + /** + * Run. + */ protected void run() { if (classpaths == null) { // NPE protection when execute is skipped and mojo delegates to run directly classpaths = new ArrayList<>(); @@ -1186,6 +1382,11 @@ public abstract class AbstractTomEEMojo extends AbstractAddressMojo { } } + /** + * Generate jvm args list. + * + * @return the list + */ protected List<String> generateJVMArgs() { final String deployOpenEjbAppKey = "openejb.system.apps"; final String servletCompliance = "org.apache.catalina.STRICT_SERVLET_COMPLIANCE"; @@ -1390,10 +1591,20 @@ public abstract class AbstractTomEEMojo extends AbstractAddressMojo { return Join.join(",", paths); } + /** + * Available commands collection. + * + * @return the collection + */ protected Collection<String> availableCommands() { return Arrays.asList(QUIT_CMD, EXIT_CMD); } + /** + * Stop server. + * + * @param stopCondition the stop condition + */ protected synchronized void stopServer(final CountDownLatch stopCondition) { if (server == null) { return; @@ -1426,10 +1637,22 @@ public abstract class AbstractTomEEMojo extends AbstractAddressMojo { return QUIT_CMD.equalsIgnoreCase(line) || EXIT_CMD.equalsIgnoreCase(line); } + /** + * Handle line boolean. + * + * @param line the line + * @return the boolean + */ protected boolean handleLine(final String line) { return false; } + /** + * Server cmd. + * + * @param server the server + * @param strings the strings + */ protected void serverCmd(final RemoteServer server, final List<String> strings) { try { server.start(strings, getCmd(), checkStarted); @@ -1439,14 +1662,29 @@ public abstract class AbstractTomEEMojo extends AbstractAddressMojo { } } + /** + * Add shutdown hooks. + * + * @param server the server + */ protected void addShutdownHooks(final RemoteServer server) { // no-op } + /** + * Gets connect attempts. + * + * @return the connect attempts + */ protected int getConnectAttempts() { return (tomeeShutdownAttempts == 0 ? 60 : tomeeShutdownAttempts); } + /** + * Gets wait TomEE. + * + * @return the wait TomEE + */ protected boolean getWaitTomEE() { return true; } @@ -1626,11 +1864,48 @@ public abstract class AbstractTomEEMojo extends AbstractAddressMojo { } } + /** + * Gets cmd. + * + * @return the cmd + */ public abstract String getCmd(); + /** + * The interface Resolver. + */ public interface Resolver { + /** + * Resolve file. + * + * @param group the group + * @param artifact the artifact + * @param version the version + * @param classifier the classifier + * @param type the type + * @return the file + */ File resolve(String group, String artifact, String version, String classifier, String type); + + /** + * Resolve file. + * + * @param group the group + * @param artifact the artifact + * @param version the version + * @param type the type + * @return the file + */ File resolve(String group, String artifact, String version, String type); + + /** + * Resolve file. + * + * @param group the group + * @param artifact the artifact + * @param version the version + * @return the file + */ File resolve(String group, String artifact, String version); } @@ -1652,6 +1927,12 @@ public abstract class AbstractTomEEMojo extends AbstractAddressMojo { this.resolved = resolved; } + /** + * Strip version string. + * + * @param keepExtension the keep extension + * @return the string + */ String stripVersion(final boolean keepExtension) { return artifact + (classifier != null && !classifier.isEmpty() ? "-" + classifier : "") + (keepExtension ? "." + type : ""); } http://git-wip-us.apache.org/repos/asf/tomee/blob/5a0f5d79/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/BuildTomEEMojo.java ---------------------------------------------------------------------- diff --git a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/BuildTomEEMojo.java b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/BuildTomEEMojo.java index bb5c6a6..858b18c 100644 --- a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/BuildTomEEMojo.java +++ b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/BuildTomEEMojo.java @@ -39,27 +39,47 @@ import java.util.Map; import java.util.zip.GZIPOutputStream; /** + * The type BuildTomEEMojo. + * * Create but not run a TomEE. */ @Mojo(name = "build", requiresDependencyResolution = ResolutionScope.RUNTIME_PLUS_SYSTEM) public class BuildTomEEMojo extends AbstractTomEEMojo { + /** + * The Zip. + */ @Deprecated @Parameter(property = "tomee-plugin.zip", defaultValue = "true") protected boolean zip; + /** + * The Attach. + */ @Parameter(property = "tomee-plugin.attach", defaultValue = "true") protected boolean attach; + /** + * The Zip file. + */ @Deprecated @Parameter(property = "tomee-plugin.zip-file", defaultValue = "${project.build.directory}/${project.build.finalName}.zip") protected File zipFile; + /** + * The Base. + */ @Parameter(property = "tomee-plugin.output-base", defaultValue = "${project.build.directory}/${project.build.finalName}") protected File base; + /** + * The Project helper. + */ @Component protected MavenProjectHelper projectHelper; + /** + * The Classifier. + */ @Parameter(property = "tomee-plugin.classifier") protected String classifier = null; http://git-wip-us.apache.org/repos/asf/tomee/blob/5a0f5d79/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/ConfigTestTomEEMojo.java ---------------------------------------------------------------------- diff --git a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/ConfigTestTomEEMojo.java b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/ConfigTestTomEEMojo.java index f27eab0..484c527 100644 --- a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/ConfigTestTomEEMojo.java +++ b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/ConfigTestTomEEMojo.java @@ -20,7 +20,9 @@ package org.apache.openejb.maven.plugin; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.ResolutionScope; + /** + * The type ConfigTestTomEEMojo. * Run configtest Tomcat command. */ @Mojo(name = "configtest", requiresDependencyResolution = ResolutionScope.RUNTIME_PLUS_SYSTEM) http://git-wip-us.apache.org/repos/asf/tomee/blob/5a0f5d79/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/DebugTomEEMojo.java ---------------------------------------------------------------------- diff --git a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/DebugTomEEMojo.java b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/DebugTomEEMojo.java index 3eded4a..7e3327a 100644 --- a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/DebugTomEEMojo.java +++ b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/DebugTomEEMojo.java @@ -21,6 +21,7 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.ResolutionScope; /** + * The type DebugTomEEMojo. * As run but with debug activated. */ @Mojo(name = "debug", requiresDependencyResolution = ResolutionScope.RUNTIME_PLUS_SYSTEM) http://git-wip-us.apache.org/repos/asf/tomee/blob/5a0f5d79/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/DeployMojo.java ---------------------------------------------------------------------- diff --git a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/DeployMojo.java b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/DeployMojo.java index b3668e5..962283b 100644 --- a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/DeployMojo.java +++ b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/DeployMojo.java @@ -33,17 +33,28 @@ import java.util.HashMap; import java.util.Map; import java.util.Properties; + /** + * The type DeployMojo. * Simply deploy an application in a running TomEE */ @Mojo(name = "deploy") public class DeployMojo extends AbstractDeployMojo { + /** + * The System variables. + */ @Parameter protected Map<String, String> systemVariables = new HashMap<String, String>(); @Parameter(property = "tomee-plugin.binary", defaultValue = "false") private boolean useBinaries; + /** + * Perform the deploy + * + * @throws MojoExecutionException + * @throws MojoFailureException + */ @Override public void execute() throws MojoExecutionException, MojoFailureException { final Deployer deployer = (Deployer) lookup("openejb/DeployerBusinessRemote"); http://git-wip-us.apache.org/repos/asf/tomee/blob/5a0f5d79/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/ExecMojo.java ---------------------------------------------------------------------- diff --git a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/ExecMojo.java b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/ExecMojo.java index 6c78d74..982e3c0 100644 --- a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/ExecMojo.java +++ b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/ExecMojo.java @@ -54,13 +54,18 @@ import java.util.Properties; import static java.util.Arrays.asList; import static org.apache.openejb.loader.Files.mkdirs; + /** + * The type ExecMojo. * Creates an executable jar of the application. */ @Mojo(name = "exec", requiresDependencyResolution = ResolutionScope.RUNTIME_PLUS_SYSTEM) public class ExecMojo extends BuildTomEEMojo { private static final String DEFAULT_SCRIPT = "bin/catalina[.sh|.bat]"; + /** + * The Exec file. + */ @Parameter(property = "tomee-plugin.exec-file", defaultValue = "${project.build.directory}/${project.build.finalName}-exec.jar") protected File execFile; @@ -88,6 +93,12 @@ public class ExecMojo extends BuildTomEEMojo { @Parameter private List<String> postTasks; + /** + * Perform the Execution + * + * @throws MojoExecutionException + * @throws MojoFailureException + */ @Override public void execute() throws MojoExecutionException, MojoFailureException { final boolean realAttach = attach; http://git-wip-us.apache.org/repos/asf/tomee/blob/5a0f5d79/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/ListEjbMojo.java ---------------------------------------------------------------------- diff --git a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/ListEjbMojo.java b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/ListEjbMojo.java index d0bedef..ddb567a 100644 --- a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/ListEjbMojo.java +++ b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/ListEjbMojo.java @@ -34,12 +34,20 @@ import java.io.PrintStream; import java.util.Arrays; import java.util.Collection; + /** + * The type ListEjbMojo. * Highly inspired from openejb command helper but with some different data. * List deployed EJB in a running TomEE. */ @Mojo(name = "list") public class ListEjbMojo extends AbstractCommandMojo { + /** + * List the EJBs + * + * @throws MojoExecutionException + * @throws MojoFailureException + */ @Override public void execute() throws MojoExecutionException, MojoFailureException { final Deployer deployer = (Deployer) lookup("openejb/DeployerBusinessRemote"); @@ -86,6 +94,11 @@ public class ListEjbMojo extends AbstractCommandMojo { private static class LogPrinterStream extends PrintStream { private Log logger; + /** + * Instantiates a new Log printer stream. + * + * @param log the log + */ public LogPrinterStream(final Log log) { super(new NullOuputStream()); logger = log; http://git-wip-us.apache.org/repos/asf/tomee/blob/5a0f5d79/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/RunTomEEMojo.java ---------------------------------------------------------------------- diff --git a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/RunTomEEMojo.java b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/RunTomEEMojo.java index 0cce74d..6b81900 100644 --- a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/RunTomEEMojo.java +++ b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/RunTomEEMojo.java @@ -20,7 +20,9 @@ package org.apache.openejb.maven.plugin; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.ResolutionScope; + /** + * The type RunTomEEMojo. * Start and Wait TomEE. */ @Mojo(name = "run", requiresDependencyResolution = ResolutionScope.RUNTIME_PLUS_SYSTEM) http://git-wip-us.apache.org/repos/asf/tomee/blob/5a0f5d79/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/StartTomEEMojo.java ---------------------------------------------------------------------- diff --git a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/StartTomEEMojo.java b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/StartTomEEMojo.java index 70aeaa1..78f4b92 100644 --- a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/StartTomEEMojo.java +++ b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/StartTomEEMojo.java @@ -21,6 +21,7 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.ResolutionScope; /** + * The type StartTomEEMojo. * Start and forget TomEE. */ @Mojo(name = "start", requiresDependencyResolution = ResolutionScope.RUNTIME_PLUS_SYSTEM) http://git-wip-us.apache.org/repos/asf/tomee/blob/5a0f5d79/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/StopTomEEMojo.java ---------------------------------------------------------------------- diff --git a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/StopTomEEMojo.java b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/StopTomEEMojo.java index 96ab467..af85ccf 100644 --- a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/StopTomEEMojo.java +++ b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/StopTomEEMojo.java @@ -26,6 +26,7 @@ import org.apache.openejb.config.RemoteServer; import java.util.List; /** + * The type StopTomEEMojo. * Stop a TomEE started with start command. */ @Mojo(name = "stop", requiresDependencyResolution = ResolutionScope.RUNTIME_PLUS_SYSTEM) http://git-wip-us.apache.org/repos/asf/tomee/blob/5a0f5d79/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/Synch.java ---------------------------------------------------------------------- diff --git a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/Synch.java b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/Synch.java index 2b27da0..c2f3041 100644 --- a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/Synch.java +++ b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/Synch.java @@ -20,22 +20,46 @@ import java.io.File; import java.util.HashMap; import java.util.Map; +/** + * The type Synch for setting up the sources. + */ public class Synch extends AbstractSynchronizable { + private File source; private File target; + /** + * Gets source. + * + * @return the source + */ public File getSource() { return source; } + /** + * Sets source. + * + * @param source the source + */ public void setSource(final File source) { this.source = source; } + /** + * Gets target. + * + * @return the target + */ public File getTarget() { return target; } + /** + * Sets target. + * + * @param target the target + */ public void setTarget(final File target) { this.target = target; } http://git-wip-us.apache.org/repos/asf/tomee/blob/5a0f5d79/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/Synchronization.java ---------------------------------------------------------------------- diff --git a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/Synchronization.java b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/Synchronization.java index 66d6b2e..828d14e 100644 --- a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/Synchronization.java +++ b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/Synchronization.java @@ -22,40 +22,83 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +/** + * The type Synchronization to sunc the files and directories. + */ public class Synchronization extends AbstractSynchronizable { private File resourcesDir; private File binariesDir; private File targetBinariesDir; private File targetResourcesDir; + /** + * Gets resources dir. + * + * @return the resources dir + */ public File getResourcesDir() { return resourcesDir; } + /** + * Sets resources dir. + * + * @param resourcesDir the resources dir + */ public void setResourcesDir(final File resourcesDir) { this.resourcesDir = resourcesDir; } + /** + * Gets binaries dir. + * + * @return the binaries dir + */ public File getBinariesDir() { return binariesDir; } + /** + * Sets binaries dir. + * + * @param binariesDir the binaries dir + */ public void setBinariesDir(final File binariesDir) { this.binariesDir = binariesDir; } + /** + * Gets target binaries dir. + * + * @return the target binaries dir + */ public File getTargetBinariesDir() { return targetBinariesDir; } + /** + * Sets target binaries dir. + * + * @param targetBinariesDir the target binaries dir + */ public void setTargetBinariesDir(final File targetBinariesDir) { this.targetBinariesDir = targetBinariesDir; } + /** + * Gets target resources dir. + * + * @return the target resources dir + */ public File getTargetResourcesDir() { return targetResourcesDir; } + /** + * Sets target resources dir. + * + * @param targetResourcesDir the target resources dir + */ public void setTargetResourcesDir(final File targetResourcesDir) { this.targetResourcesDir = targetResourcesDir; } http://git-wip-us.apache.org/repos/asf/tomee/blob/5a0f5d79/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/TomEEException.java ---------------------------------------------------------------------- diff --git a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/TomEEException.java b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/TomEEException.java index 679b120..cff40e1 100644 --- a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/TomEEException.java +++ b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/TomEEException.java @@ -17,11 +17,25 @@ package org.apache.openejb.maven.plugin; +/** + * The type TomEEException to be use in the plugin. + */ public class TomEEException extends RuntimeException { + /** + * Instantiates a new TomEE exception. + * + * @param s the s + */ public TomEEException(final String s) { super(s); } + /** + * Instantiates a new TomEE exception. + * + * @param message the message + * @param e the e + */ public TomEEException(final String message, final Exception e) { super(message, e); } http://git-wip-us.apache.org/repos/asf/tomee/blob/5a0f5d79/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/UnDeployMojo.java ---------------------------------------------------------------------- diff --git a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/UnDeployMojo.java b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/UnDeployMojo.java index e65e379..2b7533b 100644 --- a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/UnDeployMojo.java +++ b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/UnDeployMojo.java @@ -28,6 +28,7 @@ import java.util.ArrayList; import java.util.Collection; /** + * The type UnDeployMojo. * Simply undeploy an application in a running TomEE */ @Mojo(name = "undeploy") http://git-wip-us.apache.org/repos/asf/tomee/blob/5a0f5d79/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/UpdatableTomEEMojo.java ---------------------------------------------------------------------- diff --git a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/UpdatableTomEEMojo.java b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/UpdatableTomEEMojo.java index 63147cc..8423c78 100644 --- a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/UpdatableTomEEMojo.java +++ b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/UpdatableTomEEMojo.java @@ -44,8 +44,17 @@ import java.util.concurrent.Callable; import java.util.concurrent.TimeUnit; import java.util.regex.Pattern; +/** + * The type UpdatableTomEEMojo. + */ public abstract class UpdatableTomEEMojo extends AbstractTomEEMojo { + /** + * The constant INITIAL_DELAY. + */ public static final int INITIAL_DELAY = 5000; + /** + * The constant RELOAD_CMD. + */ public static final String RELOAD_CMD = "reload"; @Parameter @@ -63,6 +72,9 @@ public abstract class UpdatableTomEEMojo extends AbstractTomEEMojo { private Timer timer; private SynchronizerRedeployer task; + /** + * Update the TomEE + */ @Override protected void run() { if (synchronization != null) { @@ -153,6 +165,11 @@ public abstract class UpdatableTomEEMojo extends AbstractTomEEMojo { super.addShutdownHooks(server); } + /** + * Start synchronizers boolean. + * + * @return the boolean + */ protected boolean startSynchronizers() { timer = new Timer("tomee-maven-plugin-synchronizer"); @@ -217,6 +234,9 @@ public abstract class UpdatableTomEEMojo extends AbstractTomEEMojo { return RELOAD_CMD.equalsIgnoreCase(line); } + /** + * Reload. + */ public synchronized void reload() { if (deployOpenEjbApplication) { String path = deployedFile.getAbsolutePath(); @@ -234,6 +254,11 @@ public abstract class UpdatableTomEEMojo extends AbstractTomEEMojo { private class SynchronizerRedeployer extends TimerTask { private final Collection<Synchronizer> delegates; + /** + * Instantiates a new Synchronizer redeployer. + * + * @param synchronizers the synchronizers + */ public SynchronizerRedeployer(final Collection<Synchronizer> synchronizers) { delegates = synchronizers; } @@ -263,6 +288,11 @@ public abstract class UpdatableTomEEMojo extends AbstractTomEEMojo { private final AbstractSynchronizable synchronization; private long lastUpdate = System.currentTimeMillis(); + /** + * Instantiates a new Synchronizer. + * + * @param synch the synch + */ public Synchronizer(final AbstractSynchronizable synch) { synchronization = synch; updateOnlyFilter = new SuffixesFileFilter(synchronization.getUpdateOnlyExtenions()); @@ -372,6 +402,11 @@ public abstract class UpdatableTomEEMojo extends AbstractTomEEMojo { private static class SuffixesFileFilter implements FileFilter { private final String[] suffixes; + /** + * Instantiates a new Suffixes file filter. + * + * @param extensions the extensions + */ public SuffixesFileFilter(final List<String> extensions) { if (extensions == null) { suffixes = new String[0]; @@ -399,6 +434,12 @@ public abstract class UpdatableTomEEMojo extends AbstractTomEEMojo { private class SuffixesAndRegexFileFilter extends SuffixesFileFilter { private final Pattern pattern; + /** + * Instantiates a new Suffixes and regex file filter. + * + * @param extensions the extensions + * @param pattern the pattern + */ public SuffixesAndRegexFileFilter(final List<String> extensions, final Pattern pattern) { super(extensions); this.pattern = pattern; http://git-wip-us.apache.org/repos/asf/tomee/blob/5a0f5d79/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/cli/Args.java ---------------------------------------------------------------------- diff --git a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/cli/Args.java b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/cli/Args.java index d96335f..faf9daa 100644 --- a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/cli/Args.java +++ b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/cli/Args.java @@ -19,7 +19,16 @@ package org.apache.openejb.maven.plugin.cli; import java.util.Collection; import java.util.LinkedList; +/** + * The class Args is used to parse the supplied attributes. + */ public final class Args { + /** + * Parse collection. + * + * @param raw the raw + * @return the collection + */ public static Collection<String> parse(final String raw) { final Collection<String> result = new LinkedList<>(); http://git-wip-us.apache.org/repos/asf/tomee/blob/5a0f5d79/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/customizer/monkey/Monkey.java ---------------------------------------------------------------------- diff --git a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/customizer/monkey/Monkey.java b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/customizer/monkey/Monkey.java index 01ed871..bb820c1 100644 --- a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/customizer/monkey/Monkey.java +++ b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/customizer/monkey/Monkey.java @@ -35,18 +35,26 @@ import java.util.Properties; /** * A customizer (see tomee-maven-plugin) allowing to take current project binaries (target/classes) * and merge them in tomee for patch cases. - * + * <p> * Note: for now it needs to overlap with [tomee]/lib/*.jar. - * + * <p> * Jar will get patched and renamed with tomee-monkey-[date] suffix. */ public class Monkey implements Runnable { + /** + * The constant MONKEY_CONFIGURATION_FILE. + */ public static final String MONKEY_CONFIGURATION_FILE = "tomee-monkey.properties"; private final File base; private final File classes; private final File tempFolder; private final Properties configuration; + /** + * Instantiates a new Monkey. + * + * @param base the base + */ public Monkey(final File base) { this.base = base; final File target = new PatchFolderFinder().findTarget(base); http://git-wip-us.apache.org/repos/asf/tomee/blob/5a0f5d79/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/customizer/monkey/classloader/ClassLoaderFactory.java ---------------------------------------------------------------------- diff --git a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/customizer/monkey/classloader/ClassLoaderFactory.java b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/customizer/monkey/classloader/ClassLoaderFactory.java index b461714..328d02b 100644 --- a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/customizer/monkey/classloader/ClassLoaderFactory.java +++ b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/customizer/monkey/classloader/ClassLoaderFactory.java @@ -26,7 +26,17 @@ import java.net.URLClassLoader; import java.util.ArrayList; import java.util.Collection; +/** + * The type Class loader factory is used to load classes drom the supplied *.jar and *.zip + */ public class ClassLoaderFactory { + + /** + * Create class loader. + * + * @param libFolder the lib folder + * @return the class loader + */ public ClassLoader create(final File libFolder) { final Collection<URL> urls = new ArrayList<URL>(); final File[] children = libFolder.listFiles(new FilenameFilter() { @@ -63,6 +73,11 @@ public class ClassLoaderFactory { }); } + /** + * Release. + * + * @param loader the loader + */ public void release(final ClassLoader loader) { if (Closeable.class.isInstance(loader)) { // release files to be able to delete them later try { http://git-wip-us.apache.org/repos/asf/tomee/blob/5a0f5d79/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/customizer/monkey/file/PatchFolderFinder.java ---------------------------------------------------------------------- diff --git a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/customizer/monkey/file/PatchFolderFinder.java b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/customizer/monkey/file/PatchFolderFinder.java index 44232aa..6c5aeb9 100644 --- a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/customizer/monkey/file/PatchFolderFinder.java +++ b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/customizer/monkey/file/PatchFolderFinder.java @@ -18,7 +18,16 @@ package org.apache.openejb.maven.plugin.customizer.monkey.file; import java.io.File; +/** + * The type Patch folder finder. + */ public class PatchFolderFinder { + /** + * Find the target file. + * + * @param base the base + * @return the file + */ public File findTarget(final File base) { File current = base; while (current != null && !isTarget(current)) { @@ -30,6 +39,7 @@ public class PatchFolderFinder { throw new IllegalArgumentException("target not found from " + base); } + private boolean isTarget(final File current) { return "target".equals(current.getName()); } http://git-wip-us.apache.org/repos/asf/tomee/blob/5a0f5d79/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/customizer/monkey/index/FileIndexer.java ---------------------------------------------------------------------- diff --git a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/customizer/monkey/index/FileIndexer.java b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/customizer/monkey/index/FileIndexer.java index f036b52..d9cfd38 100644 --- a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/customizer/monkey/index/FileIndexer.java +++ b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/customizer/monkey/index/FileIndexer.java @@ -31,6 +31,9 @@ import java.util.TreeMap; import static java.util.Arrays.asList; +/** + * The type File indexer. + */ public class FileIndexer { private final ClassLoader loader; private final File binaries; @@ -41,6 +44,14 @@ public class FileIndexer { private final Map<File, List<Item>> index = new TreeMap<File, List<Item>>(); private final List<String> filesToRemove; + /** + * Instantiates a new File indexer. + * + * @param base the base + * @param patchedFilesFolder the patched files folder + * @param configuration the configuration + * @param ignore the ignore + */ public FileIndexer(final File base, final File patchedFilesFolder, final Properties configuration, final String ignore) { this.binaries = patchedFilesFolder; try { @@ -62,10 +73,20 @@ public class FileIndexer { this.ignore = ignore; } + /** + * Gets index. + * + * @return the index + */ public Map<File, List<Item>> getIndex() { return index; } + /** + * Index file indexer. + * + * @return the file indexer + */ public FileIndexer index() { if (!index.isEmpty()) { return this; @@ -86,6 +107,12 @@ public class FileIndexer { return this; } + /** + * Dump file indexer. + * + * @param out the out + * @return the file indexer + */ public FileIndexer dump(final PrintStream out) { out.println("Index:"); for (final Map.Entry<File, List<Item>> items : index.entrySet()) { @@ -99,6 +126,7 @@ public class FileIndexer { return this; } + private void doIndex(final File binaries) { if (binaries.isFile()) { if (!ignore.equals(binaries.getName())) { @@ -115,6 +143,7 @@ public class FileIndexer { } } + private void doIndexLeaf(final File file) { try { final String relative = file.getCanonicalFile().getAbsolutePath().substring(binaryRoot.length()); @@ -125,6 +154,7 @@ public class FileIndexer { } } + private void addItem(final File file, final Item.Action action, final String resource) throws IOException { final File jar = JarLocation.jarFromResource(loader, resource).getCanonicalFile(); List<Item> list = index.get(jar); http://git-wip-us.apache.org/repos/asf/tomee/blob/5a0f5d79/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/customizer/monkey/index/Item.java ---------------------------------------------------------------------- diff --git a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/customizer/monkey/index/Item.java b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/customizer/monkey/index/Item.java index d59ce7e..b0f317d 100644 --- a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/customizer/monkey/index/Item.java +++ b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/customizer/monkey/index/Item.java @@ -18,33 +18,69 @@ package org.apache.openejb.maven.plugin.customizer.monkey.index; import java.io.File; +/** + * The type Item. + */ public class Item implements Comparable<Item> { + /** + * The enum Action. + */ public enum Action { - ADD_OR_UPDATE, REMOVE; + /** + * Add or update action. + */ + ADD_OR_UPDATE, + /** + * Remove action. + */ + REMOVE; } private final String path; private final File file; private final Action action; + /** + * Instantiates a new Item. + * + * @param path the path + * @param file the file + * @param action the action + */ Item(final String path, final File file, final Action action) { this.path = path; this.file = file; this.action = action; } + /** + * Gets action. + * + * @return the action + */ public Action getAction() { return action; } + /** + * Gets path. + * + * @return the path + */ public String getPath() { return path; } + /** + * Gets file. + * + * @return the file + */ public File getFile() { return file; } + @Override public int compareTo(final Item o) { return file.compareTo(o.file); http://git-wip-us.apache.org/repos/asf/tomee/blob/5a0f5d79/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/customizer/monkey/jar/JarPatcher.java ---------------------------------------------------------------------- diff --git a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/customizer/monkey/jar/JarPatcher.java b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/customizer/monkey/jar/JarPatcher.java index 9a6fb42..b9b6d83 100644 --- a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/customizer/monkey/jar/JarPatcher.java +++ b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/customizer/monkey/jar/JarPatcher.java @@ -36,7 +36,18 @@ import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; +/** + * The Jar patcher. + */ public class JarPatcher { + /** + * Patch. + * + * @param stream the stream + * @param tmp the tmp + * @param key the key + * @param value the value + */ public void patch(final PrintStream stream, final File tmp, final File key, final List<Item> value) { stream.println(" " + key); if (key.isDirectory()) { http://git-wip-us.apache.org/repos/asf/tomee/blob/5a0f5d79/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/runner/ExecRunner.java ---------------------------------------------------------------------- diff --git a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/runner/ExecRunner.java b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/runner/ExecRunner.java index 6585f65..465ee81 100644 --- a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/runner/ExecRunner.java +++ b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/runner/ExecRunner.java @@ -38,9 +38,18 @@ import java.util.Properties; import static java.util.Arrays.asList; +/** + * The type Exec runner with the main function to run the plugin. + */ public class ExecRunner { private static final String SH_BAT_AUTO = "[.sh|.bat]"; + /** + * Main function to run the plugin. + * + * @param rawArgs the raw args + * @throws Exception the exception + */ public static void main(final String[] rawArgs) throws Exception { final String[] args; if (rawArgs == null || rawArgs.length == 0) {