/** * @return if exists the DeploymentDescriptorFile responsible for * handling the configuration deployment descriptors */ private ConfigurationDeploymentDescriptorFile getConfigurationDDFile(ReadableArchive archive) throws IOException { if (confDD == null) { getSortedConfigurationDDFiles(archive); if (sortedConfDDFiles != null && !sortedConfDDFiles.isEmpty()) { confDD = sortedConfDDFiles.get(0); } } return confDD; }
/** * 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); }
/** * writes the runtime deployment descriptors to an abstract archive * * @param in the input archive * @param out output archive */ public void writeRuntimeDeploymentDescriptors(ReadableArchive in, WritableArchive out) throws IOException { T desc = getDescriptor(); // when source archive contains runtime deployment descriptor // files, write those out // otherwise write all possible runtime deployment descriptor // files out (revisit this to see what is the desired behavior // here, write out all, or write out the highest precedence one, // or not write out) List<ConfigurationDeploymentDescriptorFile> confDDFilesToWrite = getSortedConfigurationDDFiles(in); if (confDDFilesToWrite.isEmpty()) { confDDFilesToWrite = getConfigurationDDFiles(); } for (ConfigurationDeploymentDescriptorFile ddFile : confDDFilesToWrite) { ddFile.setArchiveType(getModuleType()); OutputStream os = out.putNextEntry( ddFile.getDeploymentDescriptorPath()); ddFile.write(desc, os); out.closeEntry(); } }