Refine search
/** * {@inheritDoc} */ @Override public void setProperty(String name, String value) { if (value != null) { getLogger().debug("Setting property [" + name + "] = [" + value + "]", this.getClass().getName()); this.properties.put(name, value); } else { getLogger().debug("Removing property [" + name + "]", this.getClass().getName()); this.properties.remove(name); } }
/** * {@inheritDoc} */ @Override protected void activateLogging(LocalContainer container) { getLogger().info("Jetty8x log configuration not implemented", this.getClass().getName()); }
/** * Creates the extra classpath XML token. * @param deployable Deployable to create extra classpath XML token for. * @return Extra classpath XML token. */ protected String getExtraClasspathToken(WAR deployable) { getLogger().warn("Tomcat 5.x doesn't support extra classpath on WARs", this.getClass().getName()); return ""; }
@Override public void run() { try { if (container != null && (org.codehaus.cargo.container.State.STARTED == container.getState() || org.codehaus.cargo.container.State.STARTING == container.getState())) { log.info("Stopping container...",""); container.stop(); } } catch (Exception e) { log.warn("Failed stopping the container", ""); } } });
getLogger().info("Deploying [" + deployable.getFile() + "] to [" + deployableDir + "]...", this.getClass().getName()); if (!getFileHandler().isDirectory(deployableDir)) String target = getFileHandler().append(deployableDir, getDeployableName(deployable)); if (deployable.isExpanded()) if (getFileHandler().exists(target) && !getFileHandler().isDirectory(target))
getLogger().debug("Sending WLST script: " + newLine + buffer.toString(), this.getClass().getName()); getFileHandler().writeTextFile(tempFile.getAbsolutePath(), buffer.toString(), null);
/** * {@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(); }
/** * Delete old profile. * @throws Exception if any error is raised during deleting of profile */ private void deleteOldProfile() throws Exception { getLogger().info("Deleting old profile.", this.getClass().getName()); // Delete profile in WebSphere wsContainer.runManageProfileCommand( "-delete", "-profileName", getPropertyValue(WebSpherePropertySet.PROFILE)); // Profile directory has to be deleted too. getLogger().debug("Deleting profile folder " + getHome(), this.getClass().getName()); getFileHandler().delete(getHome()); if (getFileHandler().isDirectory(getHome())) { throw new CargoException("Directory " + getHome() + " cannot be deleted"); } // Update profile informations in WebSphere wsContainer.runManageProfileCommand("-validateAndUpdateRegistry"); }
/** * Undeploy the file in specified directory with the specified file name. * * @param directory The directory name * @param file The file name */ private void undeployFile(String directory, String file) { String fileName = getFileHandler().append(directory, file); if (fileExists(fileName)) { getLogger().info("Undeploying [" + fileName + "]...", this.getClass().getName()); getFileHandler().delete(fileName); } else { getLogger().info( "Couldn't not find file to undeploy [" + fileName + "]", this.getClass().getName()); } }
/** * Extract the context name from the WAR file name (without the file extension). For example if * the WAR is named <code>test.war</code> then the context name is <code>test</code>. */ private void parseContext() { if (this.context == null) { String ctx = getFileHandler().getName(getFile()); int warIndex = ctx.toLowerCase().lastIndexOf(".war"); if (warIndex >= 0) { ctx = ctx.substring(0, warIndex); } getLogger().debug("Parsed web context = [" + ctx + "]", this.getClass().getName()); setContext(ctx); } }
/** * Construct the shared classpath XML based on the container. * * @param container the JBoss container instance from which we'll find the JBoss installed files * to reference * @return Shared classpath XML based on the container. * @throws MalformedURLException If URL building fails. */ protected String getSharedClasspathXml(JBossInstalledLocalContainer container) throws MalformedURLException { String[] sharedClassPath = container.getSharedClasspath(); StringBuilder tmp = new StringBuilder(); if (sharedClassPath != null) { for (String element : sharedClassPath) { String fileName = getFileHandler().getName(element); String directoryName = getFileHandler().getParent(element); URL directoryUrl = new File(directoryName).toURI().toURL(); tmp.append("<classpath codebase=\"" + directoryUrl + "\" archives=\"" + fileName + "\"/>"); tmp.append("\n"); } } String sharedClassPathString = tmp.toString(); getLogger().debug("Shared loader classpath is " + sharedClassPathString, getClass().getName()); return sharedClassPathString; }
/** * Removes previously deployed artifact. * * @param deployable artifact to undeploy */ @Override public void undeploy(Deployable deployable) { if (deployable.getType() != DeployableType.WAR) { super.undeploy(deployable); return; } WAR war = (WAR) deployable; String fileName = getFileHandler().append(getDeployableDir(deployable), war.getContext() + ".war"); if (getFileHandler().exists(fileName)) { getLogger().info("Undeploying [" + fileName + "]...", this.getClass().getName()); getFileHandler().delete(fileName); } }
/** * {@inheritDoc}. For JBoss container the target is the <code>deployments</code> directory. */ @Override public String getDeployableDir(Deployable deployable) { String altDeployDir = getContainer().getConfiguration(). getPropertyValue(JBossPropertySet.ALTERNATIVE_DEPLOYMENT_DIR); if (altDeployDir != null && !"".equals(altDeployDir)) { getContainer().getLogger().info("Using non-default deployment target directory " + altDeployDir, this.getClass().getName()); return getFileHandler().append(getContainer().getConfiguration().getHome(), altDeployDir); } else { return getFileHandler().append(getContainer(). getConfiguration().getHome(), "deployments"); } }
/** * {@inheritDoc} */ @Override public void start(Deployable deployable) { String file = deployable.getFile(); getLogger().info("Starting [" + file + "]", this.getClass().getName()); try { TomcatDeployableStatus status = getTomcatManager().getStatus(getPath(deployable)); if (status.equals(TomcatDeployableStatus.STOPPED)) { getTomcatManager().start(getPath(deployable)); } else { getLogger().debug("Deployable [" + getPath(deployable) + "] already started or doesn't exist", this.getClass().getName()); } } catch (IOException|TomcatManagerException exception) { throw new ContainerException("Failed to start [" + file + "]", exception); } }
/** * {@inheritDoc} */ @Override protected void doStart(JvmLauncher java) throws Exception { final File swarmExecutable = new File(getHome()); swarmJvmLauncher.setJarFile(swarmExecutable); swarmJvmLauncher.setWorkingDirectory(new File(getFileHandler().getAbsolutePath( getConfiguration().getHome()))); final Configuration configuration = getConfiguration(); String jvmArgs = configuration.getPropertyValue(GeneralPropertySet.JVMARGS); if (jvmArgs == null || !jvmArgs.contains("-Dswarm.http.port=")) { swarmJvmLauncher.addJvmArguments("-Dswarm.http.port=" + getConfiguration().getPropertyValue(ServletPropertySet.PORT)); } WildFlySwarmStandaloneLocalConfiguration wildFlySwarmConfiguration = (WildFlySwarmStandaloneLocalConfiguration) configuration; File swarmProjectDescriptor = wildFlySwarmConfiguration.getSwarmProjectDescriptor(); if (swarmProjectDescriptor != null && swarmProjectDescriptor.exists()) { swarmJvmLauncher.addAppArgumentLine("-s " + swarmProjectDescriptor.getAbsolutePath()); } addDeployables(); getLogger().info("Swarm arg line: " + swarmJvmLauncher.getCommandLine(), getClass().getCanonicalName()); swarmJvmLauncher.start(); }
/** * Create the Cargo logger that will be used for logging all messages. If the user has specified * a log file we create a File logger. If no file has been specified we use an Ant logger by * default to log to the Ant logging subsystem. */ private void createCargoLogger() { if (getLog() != null) { this.logger = new FileLogger(getLog(), true); } else { // Use an Ant logger adapter to log to Ant this.logger = new AntLogger(getProject()); } if (getLogLevel() != null) { this.logger.setLevel(getLogLevel()); } else { this.logger.setLevel(LogLevel.INFO); } }
getLogger().debug("Sending WLST script: " + newLine + buffer.toString(), this.getClass().getName()); getFileHandler().writeTextFile(tempFile.getAbsolutePath(), buffer.toString(), null);