/** * @return if exists the DeploymentDescriptorFile responsible for * handling the configuration deployment descriptors */ public ConfigurationDeploymentDescriptorFile getConfigurationDDFile(Archivist main, RootDeploymentDescriptor descriptor, ReadableArchive archive) throws IOException { if (confDD == null) { getSortedConfigurationDDFiles(descriptor, archive, main.getModuleType()); if (sortedConfDDFiles != null && !sortedConfDDFiles.isEmpty()) { confDD = sortedConfDDFiles.get(0); } } return confDD; }
/** * Read the runtime deployment descriptors of the extension * * @param archivist the primary archivist for this archive * @param archive the archive * @param descriptor the extension deployment descriptor * @return the extension descriptor object with additional runtime information */ public Object readRuntimeDeploymentDescriptor(Archivist main, ReadableArchive archive, RootDeploymentDescriptor descriptor) throws IOException, SAXException { ConfigurationDeploymentDescriptorFile ddFile = getConfigurationDDFile(main, descriptor, archive); // if this extension archivist has no runtime DD, just return the // original descriptor if (ddFile == null) { return descriptor; } DOLUtils.readRuntimeDeploymentDescriptor(getSortedConfigurationDDFiles(descriptor, archive, main.getModuleType()), archive, descriptor, main,true); return descriptor; }
/** * writes the runtime deployment descriptors to an abstract archive * * @param in the input archive * @param out output archive */ public void writeRuntimeDeploymentDescriptors(Archivist main, BundleDescriptor descriptor, ReadableArchive in, WritableArchive out) throws IOException { // when source archive contains runtime deployment descriptor // files, write those out // otherwise write all possible runtime deployment descriptor // files out List<ConfigurationDeploymentDescriptorFile> confDDFilesToWrite = getSortedConfigurationDDFiles(descriptor, in, main.getModuleType()); if (confDDFilesToWrite.isEmpty()) { confDDFilesToWrite = getConfigurationDDFiles(descriptor); } for (ConfigurationDeploymentDescriptorFile ddFile : confDDFilesToWrite) { ddFile.setArchiveType(main.getModuleType()); OutputStream os = out.putNextEntry( ddFile.getDeploymentDescriptorPath()); ddFile.write(descriptor, os); out.closeEntry(); } }