Refine search
/** * {@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} In Tomcat 5.5+, we use context.xml to avoid configuration problems. */ @Override protected String getOrCreateResourceConfigurationFile(Resource rs, LocalContainer container) { String confDir = getFileHandler().createDirectory(getHome(), "conf"); return getFileHandler().append(confDir, "context.xml"); }
/** * @param assembleDir directory to copy JAR files to */ private void copyJars(String assembleDir) { FileHandler fileHandler = new DefaultFileHandler(); File f = new File(assembleDir); File webInfLib = new File(f, "WEB-INF/lib"); fileHandler.mkdirs(webInfLib.getAbsolutePath()); for (File sourceFile : this.jarFiles) { fileHandler.copyFile(sourceFile.getAbsolutePath(), new File(webInfLib, sourceFile .getName()).getAbsolutePath()); } }
/** * adds the location to the list, if the file exists. * * @param location path to add to the list * @param list where to append this path */ public void ifPresentAddPathToList(String location, List<String> list) { if (location == null || !this.getFileHandler().exists(location) || this.getFileHandler().isDirectory(location)) { throw new IllegalArgumentException("Invalid file path: " + location); } list.add(location); } }
/** * {@inheritDoc} */ @Override protected void configureDatasource(LocalContainer container, String etcDir) throws IOException { StringBuilder sb = new StringBuilder(); createDatasourceDefinitions(sb, container); Map<String, String> jettyXmlReplacements = new HashMap<String, String>(); jettyXmlReplacements.put("</Configure>", sb.toString() + "</Configure>"); getFileHandler().replaceInFile( getFileHandler().append(etcDir, "jetty-plus.xml"), jettyXmlReplacements, "UTF-8"); }
getFileHandler().createDirectory(getHome(), "lib"); getFileHandler().createDirectory(getHome(), "lib/ext"); getFileHandler().createDirectory(getHome(), "resources"); String startD = getFileHandler().append(installedContainer.getHome(), "start.d"); if (getFileHandler().isDirectory(startD)) getFileHandler().copyDirectory(startD, getHome() + "/start.d"); httpIni = getFileHandler().append(getHome(), "start.d/http.ini"); getFileHandler().copyFile( installedContainer.getHome() + "/start.ini", getHome() + "/start.ini"); httpIni = getFileHandler().append(getHome(), "start.ini"); if (getFileHandler().exists(httpIni)) getFileHandler().replaceInFile(httpIni, httpIniReplacements, "UTF-8", false); for (String extraClasspath : installedContainer.getExtraClasspath()) String destinationFile = libExt + "/" + getFileHandler().getName(extraClasspath); getFileHandler().copyFile(extraClasspath, destinationFile);
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)) getFileHandler().delete(target); getFileHandler().copyDirectory(deployable.getFile(), target); if (getFileHandler().exists(target) && getFileHandler().isDirectory(target)) getFileHandler().delete(target); getFileHandler().copyFile(deployable.getFile(), target, true);
/** * {@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"); } }
@Override protected void addConfigurationScriptProperties(Map<String, String> propertiesMap) { LocalConfiguration configuration = (LocalConfiguration) getConfiguration(); String domainName = configuration.getFileHandler().getName(configuration.getHome()); propertiesMap.put("cargo.weblogic.domain.name", domainName); }
/** * {@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}. For Tomcat this is the <code>webapps</code> directory. */ @Override public String getDeployableDir(Deployable deployable) { return getFileHandler().append(getContainer().getConfiguration().getHome(), getContainer().getConfiguration().getPropertyValue( TomcatPropertySet.WEBAPPS_DIRECTORY)); }
String outFile = getFileHandler().append(path, entryName); getFileHandler().mkdirs(outFile); if (!getFileHandler().exists(getFileHandler().getParent(outFile))) getFileHandler().mkdirs(getFileHandler().getParent(outFile)); if (!getFileHandler().exists(outFile)) getFileHandler().createFile(outFile); OutputStream out = getFileHandler().getOutputStream(outFile); int read; while ((read = inputStream.read(buffer)) > 0)
/** * @return true if the container has already been extracted, false otherwise */ public boolean isAlreadyExtracted() { boolean isExtracted = false; String timestampFile = getFileHandler().append(getExtractDir(), ".cargo"); if (getFileHandler().exists(timestampFile)) { isExtracted = true; } return isExtracted; }
/** * 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"); }
String timestampFile = getFileHandler().append(getHome(), ".cargo"); if (getFileHandler().exists(timestampFile) || getFileHandler().exists(getHome()) && getFileHandler().isDirectoryEmpty(getHome()) || !getFileHandler().exists(getHome())) getFileHandler().delete(getHome()); getFileHandler().mkdirs(getHome()); getFileHandler().createFile(timestampFile);
/** * 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()); } }
protected void doDeploy(String deployableDir, Deployable deployable) String createContextXml = getContainer().getConfiguration().getPropertyValue( JettyPropertySet.CREATE_CONTEXT_XML); getFileHandler().createFile(contextFile); getLogger().info("Deploying WAR by creating Jetty context XML file in [" + contextFile + "]...", getClass().getName()); try (OutputStream out = getFileHandler().getOutputStream(contextFile))
/** * 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); } }
+ getPropertyValue(JBossPropertySet.CONFIGURATION) + ".xml"; String defaultConfigurationXmlFile = "standalone/" + configurationXmlFile; String customConfigurationXML = getFileHandler().append(getHome(), configurationXmlFile); String defaultConfigurationXML = getFileHandler().append(container.getHome(), defaultConfigurationXmlFile); String tempFile = getFileHandler().append(getHome(), configurationXmlFile + ".temp"); getFileHandler().copyFile(customConfigurationXML, tempFile); getFileHandler().copyFile(defaultConfigurationXML, customConfigurationXML); getFileHandler().copyFile(tempFile, defaultConfigurationXML); getFileHandler().delete(tempFile);