/** * Create the LibertyInstall for this local container * * @param container the container to create it for */ public LibertyInstall(InstalledLocalContainer container) { installDir = new File(container.getHome()); usrDir = new File(container.getConfiguration().getHome()); }
/** * Creates the VM args token for the jvm.config file. * @return the VM args token for the jvm.config file. */ private Token createVmArgsToken() { StringBuilder jvmArgs = new StringBuilder(); File hotFixJar = new File(jrunContainer.getHome() + "/servers/lib/54101.jar"); if (hotFixJar.exists()) { jvmArgs.append("-Djava.rmi.server.RMIClassLoaderSpi=jrunx.util.JRunRMIClassLoaderSpi "); } jvmArgs.append("-Dsun.io.useCanonCaches=false "); jvmArgs.append("-Djmx.invoke.getters=true "); jvmArgs.append("-Xms32m "); jvmArgs.append("-Xmx128m "); ReplaceTokens.Token tokenVmArgs = new ReplaceTokens.Token(); tokenVmArgs.setKey("jrun.jvm.args"); tokenVmArgs.setValue(jvmArgs.toString()); return tokenVmArgs; }
/** * Creates the VM args token for the jvm.config file. * @return the VM args token for the jvm.config file. */ private Token createVmArgsToken() { StringBuilder jvmArgs = new StringBuilder(); File hotFixJar = new File(jrunContainer.getHome() + "/servers/lib/54101.jar"); if (hotFixJar.exists()) { jvmArgs.append("-Djava.rmi.server.RMIClassLoaderSpi=jrunx.util.JRunRMIClassLoaderSpi "); } jvmArgs.append("-Dsun.io.useCanonCaches=false "); jvmArgs.append("-Djmx.invoke.getters=true "); jvmArgs.append("-Xms32m "); jvmArgs.append("-Xmx128m "); ReplaceTokens.Token tokenVmArgs = new ReplaceTokens.Token(); tokenVmArgs.setKey("jrun.jvm.args"); tokenVmArgs.setValue(jvmArgs.toString()); return tokenVmArgs; }
/** * Creates the classpath token for the jvm.config file. * @return the classpath token for the jvm.config file. */ private Token createClassPathToken() { StringBuilder sb = new StringBuilder(); sb.append(jrunContainer.getHome() + "/servers/lib,"); sb.append(jrunContainer.getHome() + "/lib/macromedia_drivers.jar,"); sb.append(jrunContainer.getHome() + "/lib/webservices.jar"); if (jrunContainer.getExtraClasspath().length > 0) { sb.append(","); String[] extraPaths = jrunContainer.getExtraClasspath(); for (int i = 0; i < extraPaths.length; i++) { sb.append(extraPaths[i].replace('\\', '/')); if (i < extraPaths.length - 1) { sb.append(","); } } } ReplaceTokens.Token tokenClasspath = new ReplaceTokens.Token(); tokenClasspath.setKey(JRun4xPropertySet.JRUN_CLASSPATH); tokenClasspath.setValue(sb.toString()); return tokenClasspath; }
/** * Check if resource is deployed as module. * @param container WildFly installed local container. * @param jarFile JAR resource representing module. * @return true if module representing this dependency is already deployed */ public static boolean isModuleDeployed(InstalledLocalContainer container, String jarFile) { FileHandler fileHandler = container.getFileHandler(); String moduleArtifactName = getModuleArtifactName(jarFile, fileHandler); String folder = container.getHome() + "/modules/org/codehaus/cargo/classpath/" + moduleArtifactName + "/main"; if (fileHandler.exists(folder)) { return true; } return false; }
/** * Check if resource is deployed as module. * @param container WildFly installed local container. * @param jarFile JAR resource representing module. * @return true if module representing this dependency is already deployed */ public static boolean isModuleDeployed(InstalledLocalContainer container, String jarFile) { FileHandler fileHandler = container.getFileHandler(); String moduleArtifactName = getModuleArtifactName(jarFile, fileHandler); String folder = container.getHome() + "/modules/org/codehaus/cargo/classpath/" + moduleArtifactName + "/main"; if (fileHandler.exists(folder)) { return true; } return false; }
/** * {@inheritDoc} */ @Override public void doExecute() throws MojoExecutionException { // Creating the container not only instantiate the container and its configuration but it // also installs it if required. Container container = createContainer(); if (container.getType() == ContainerType.INSTALLED) { getLog().info("Container is installed at [" + ((InstalledLocalContainer) container).getHome()); } else { getLog().warn("Only installed containers types can be installed. You have specified a " + "[" + container.getType().getType() + "] one."); } } }
/** * {@inheritDoc} */ @Override protected void setupManager(LocalContainer container) { String from = ((InstalledLocalContainer) container).getHome(); String to = getHome(); getFileHandler().copyDirectory(from + "/server/webapps/manager", to + "/server/webapps/manager"); getFileHandler().copyFile(from + "/webapps/manager.xml", to + "/webapps/manager.xml"); }
/** * {@inheritDoc} */ @Override protected void setupManager(LocalContainer container) { String from = ((InstalledLocalContainer) container).getHome(); String to = getHome(); getFileHandler().copyDirectory(from + "/server/webapps/manager", to + "/server/webapps/manager"); getFileHandler().copyFile(from + "/webapps/manager.xml", to + "/webapps/manager.xml"); }
/** * {@inheritDoc} this does not deploy the manager, if the application is embedded. */ @Override protected void setupManager(LocalContainer container) { if (container instanceof EmbeddedLocalContainer) { // when running in the embedded mode, there's no need of any manager application. } else { String from = ((InstalledLocalContainer) container).getHome(); String to = getHome(); getFileHandler().copyDirectory(from + "/server/webapps/manager", to + "/server/webapps/manager"); getFileHandler().copyFile(from + "/conf/Catalina/localhost/manager.xml", to + "/conf/Catalina/localhost/manager.xml"); } }
/** * {@inheritDoc} this does not deploy the manager, if the application is embedded. */ @Override protected void setupManager(LocalContainer container) { if (container instanceof EmbeddedLocalContainer) { // when running in the embedded mode, there's no need of any manager application. } else { String from = ((InstalledLocalContainer) container).getHome(); String to = getHome(); getFileHandler().copyDirectory(from + "/server/webapps/manager", to + "/server/webapps/manager"); getFileHandler().copyFile(from + "/conf/Catalina/localhost/manager.xml", to + "/conf/Catalina/localhost/manager.xml"); } }
/** * {@inheritDoc} * * the path to find the manager application is different between v5 and v6. */ @Override protected void setupManager(LocalContainer container) { if (container instanceof EmbeddedLocalContainer) { // when running in the embedded mode, there's no need // of any manager application. } else { String from = ((InstalledLocalContainer) container).getHome(); String to = getHome(); getFileHandler().copyDirectory(from + "/webapps/manager", to + "/webapps/manager"); getFileHandler().copyDirectory(from + "/webapps/host-manager", to + "/webapps/host-manager"); } }
/** * {@inheritDoc} * * the path to find the manager application is different between v5 and v6. */ @Override protected void setupManager(LocalContainer container) { if (container instanceof EmbeddedLocalContainer) { // when running in the embedded mode, there's no need // of any manager application. } else { String from = ((InstalledLocalContainer) container).getHome(); String to = getHome(); getFileHandler().copyDirectory(from + "/webapps/manager", to + "/webapps/manager"); getFileHandler().copyDirectory(from + "/webapps/host-manager", to + "/webapps/host-manager"); } }
/** * Create an instance of the JVM launcher preinitialized to invoke the deploy tool jar with the * specified command. * * @param action the deployer action to take * @return The created task instance */ private JvmLauncher createDeployerJava(String action) { JvmLauncher java = createJava(); if (getContainer() instanceof Geronimo3xInstalledLocalContainer) { ((Geronimo3xInstalledLocalContainer) getContainer()).prepareJvmLauncher(java); java.setMainClass("org.apache.geronimo.cli.deployer.DeployerCLI"); } else { java.setJarFile(new File(getInstalledContainer().getHome(), "bin/deployer.jar")); } java.addAppArguments(action); return java; }
/** * Create an instance of the JVM launcher preinitialized to invoke the deploy tool jar with the * specified command. * * @param action the deployer action to take * @return The created task instance */ private JvmLauncher createDeployerJava(String action) { JvmLauncher java = createJava(); if (getContainer() instanceof Geronimo3xInstalledLocalContainer) { ((Geronimo3xInstalledLocalContainer) getContainer()).prepareJvmLauncher(java); java.setMainClass("org.apache.geronimo.cli.deployer.DeployerCLI"); } else { java.setJarFile(new File(getInstalledContainer().getHome(), "bin/deployer.jar")); } java.addAppArguments(action); return java; }
/** * {@inheritDoc} */ @Override public void packageContainer(InstalledLocalContainer container) { getFileHandler().copyDirectory(container.getHome(), getTargetDirectory(), getDistributionExclusions()); List<String> configurationExclusions = getDefaultConfigurationExclusions(); configurationExclusions.addAll(getConfigurationExclusions()); getFileHandler().copyDirectory(container.getConfiguration().getHome(), getTargetDirectory(), configurationExclusions); }
/** * {@inheritDoc} */ @Override protected void doConfigure(LocalContainer c) throws Exception { InstalledLocalContainer container = (InstalledLocalContainer) c; setupConfigurationDir(); // Copy initial configuration String initialConfiguration = getFileHandler().append(container.getHome(), "standalone"); getFileHandler().copyDirectory(initialConfiguration, getHome()); String configurationXmlFile = "configuration/" + getPropertyValue(JBossPropertySet.CONFIGURATION) + ".xml"; String configurationXML = getFileHandler().append(getHome(), configurationXmlFile); if (!getFileHandler().exists(configurationXML)) { throw new CargoException("Missing configuration XML file: " + configurationXML); } getLogger().info("Configuring JBoss using the [" + getPropertyValue(JBossPropertySet.CONFIGURATION) + "] server configuration", this.getClass().getName()); // Set user properties. createMgmtUsersProperties(); createApplicationUsersProperties(); createApplicationRolesProperties(); }
/** * {@inheritDoc} */ @Override protected void doConfigure(LocalContainer c) throws Exception { InstalledLocalContainer container = (InstalledLocalContainer) c; setupConfigurationDir(); // Copy initial configuration String initialConfiguration = getFileHandler().append(container.getHome(), "standalone"); getFileHandler().copyDirectory(initialConfiguration, getHome()); String configurationXmlFile = "configuration/" + getPropertyValue(JBossPropertySet.CONFIGURATION) + ".xml"; String configurationXML = getFileHandler().append(getHome(), configurationXmlFile); if (!getFileHandler().exists(configurationXML)) { throw new CargoException("Missing configuration XML file: " + configurationXML); } getLogger().info("Configuring JBoss using the [" + getPropertyValue(JBossPropertySet.CONFIGURATION) + "] server configuration", this.getClass().getName()); // Set user properties. createMgmtUsersProperties(); createApplicationUsersProperties(); createApplicationRolesProperties(); }
final String originalVarDirectory = ((InstalledLocalContainer) container).getHome() + "/var"; getFileHandler().copyDirectory(originalVarDirectory, varDirectory);
final String containerHome = ((InstalledLocalContainer) container).getHome();