/** * @return the list of files that should not be copied from the old archive * when a save is performed. */ public Vector getListOfFilesToSkip(ReadableArchive archive) throws IOException { Vector filesToSkip = new Vector(); filesToSkip.add(getDeploymentDescriptorPath()); if (manifest != null) { filesToSkip.add(JarFile.MANIFEST_NAME); } if (getRuntimeDeploymentDescriptorPath(archive) != null) { filesToSkip.add(getRuntimeDeploymentDescriptorPath(archive)); } // Can't depend on having a descriptor, so skip all possible // web service deployment descriptor paths. filesToSkip.addAll( getAllWebservicesDeploymentDescriptorPaths()); return filesToSkip; }
/** * @return the list of files that should not be copied from the old archive * when a save is performed. */ public Vector getListOfFilesToSkip() { Vector filesToSkip = new Vector(); filesToSkip.add(getDeploymentDescriptorPath()); if (manifest != null) { filesToSkip.add(JarFile.MANIFEST_NAME); } if (getRuntimeDeploymentDescriptorPath() != null) { filesToSkip.add(getRuntimeDeploymentDescriptorPath()); } // Can't depend on having a descriptor, so skip all possible // web service deployment descriptor paths. filesToSkip.addAll(WebServicesDeploymentDescriptorFile. getAllDescriptorPaths()); return filesToSkip; }
/** * @return true if the passed Archive contains runtime * deployment descriptors information */ public boolean containsRuntimeDeploymentDescriptors(Archive in) { String ddFileName = getRuntimeDeploymentDescriptorPath(); if (ddFileName == null) { return false; } for (Enumeration e = in.entries(); e.hasMoreElements();) { String entryName = (String) e.nextElement(); if (entryName.equals(ddFileName)) { return true; } } // we iterated all archive elements, could not find our // runtime DD file, it's a pure j2ee archive return false; }
/** * Read the runtime deployment descriptors (can contained in one or * many file) from a deployment plan archive, set the corresponding * information in the passed descriptor. */ public void readRuntimeDDFromDeploymentPlan( ReadableArchive planArchive, T descriptor) throws IOException, SAXParseException { // if we are not supposed to handle runtime info, just pass String runtimeDDPath = getRuntimeDeploymentDescriptorPath(); if (runtimeDDPath == null || planArchive == null) { return; } // list of entries in the deployment plan Vector dpEntries = new Vector(); for (Enumeration e = planArchive.entries(); e.hasMoreElements();) { dpEntries.add(e.nextElement()); } String entry = runtimeDDPath.substring(runtimeDDPath.lastIndexOf('/') + 1); if (dpEntries.contains(entry)) { readRuntimeDDFromDeploymentPlan(entry, planArchive, descriptor); } }
/** * Read the runtime deployment descriptors (can contained in one or * many file) set the corresponding information in the passed descriptor. * By default, the runtime deployment descriptors are all contained in * the xml file characterized with the path returned by * * @param archive the archive * @param descriptor the initialized deployment descriptor * @param warnIfMultipleDDs whether to log warnings if both the GlassFish and the legacy Sun descriptors are present * @link getRuntimeDeploymentDescriptorPath */ public void readRuntimeDeploymentDescriptor(ReadableArchive archive, T descriptor, final boolean warnIfMultipleDDs) throws IOException, SAXException { String ddFileEntryName = getRuntimeDeploymentDescriptorPath(archive); // if we are not supposed to handle runtime info, just pass if (!isHandlingRuntimeInfo() || ddFileEntryName == null) { return; } DOLUtils.readRuntimeDeploymentDescriptor(getSortedConfigurationDDFiles(archive), archive, descriptor, this, warnIfMultipleDDs); }
Archivist subArchivist = archivistFactory.get().getPrivateArchivistFor(moduleDesc.getModuleType()); String archiveUri = moduleDesc.getArchiveUri(); String runtimeDDPath = subArchivist.getRuntimeDeploymentDescriptorPath();
public void saveRuntimeInfo(File output) throws IOException { // if output file is null, we overwrite the current archive... File outputFile = output; if (outputFile == null) { outputFile = getTempFile(path); } // copy all entries from source to target except the // runtime descriptor file WritableArchive out = archiveFactory.createArchive(outputFile); ReadableArchive in = archiveFactory.openArchive(new File(path)); Vector skipFiles = new Vector(); skipFiles.add(getRuntimeDeploymentDescriptorPath()); copyInto(in, out, skipFiles); in.close(); // now save the runtime deployment descriptor... OutputStream os = out.putNextEntry(getRuntimeDeploymentDescriptorPath()); writeRuntimeDeploymentDescriptors(os); out.closeEntry(); out.close(); // if we overwrote the old archive, need to rename the tmp now if (output == null) { ReadableArchive finalArchive = archiveFactory.openArchive(new File(path)); finalArchive.delete(); ReadableArchive tmpArchive = archiveFactory.openArchive(outputFile); tmpArchive.renameTo(path); } }
String ddFileEntryName = getRuntimeDeploymentDescriptorPath();
/** * writes the runtime deployment descriptors to an abstract archive * * @param out output archive */ public void writeRuntimeDeploymentDescriptors(WritableArchive out) throws IOException { T desc = getDescriptor(); // Runtime DDs if (isHandlingRuntimeInfo()) { DeploymentDescriptorFile confDD = getConfigurationDDFile(); if (confDD != null) { OutputStream os = out.putNextEntry(getRuntimeDeploymentDescriptorPath()); confDD.write(desc, os); out.closeEntry(); } // Legacy Sun Runtime DDs DeploymentDescriptorFile sunConfDD = getSunConfigurationDDFile(); if (sunConfDD != null) { OutputStream os = out.putNextEntry( sunConfDD.getDeploymentDescriptorPath()); sunConfDD.write(desc, os); out.closeEntry(); } } }