public boolean supportsModuleType(XModuleType moduleType) { return getModuleType().equals(moduleType); }
/** * @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; }
private List<ConfigurationDeploymentDescriptorFile> getSortedConfigurationDDFiles(ReadableArchive archive) throws IOException { if (sortedConfDDFiles == null) { sortedConfDDFiles = DOLUtils.processConfigurationDDFiles(getConfigurationDDFiles(), archive, getModuleType()); } return sortedConfDDFiles; }
/** * Returns the scanner for this archivist, usually it is the scanner regitered * with the same module type as this archivist, but subclasses can return a * different version * */ public ModuleScanner getScanner() { Scanner scanner = null; try { scanner = habitat.getService(Scanner.class, getModuleType().toString()); if (scanner==null || !(scanner instanceof ModuleScanner)) { logger.log(Level.SEVERE, "Cannot find module scanner for " + this.getManifest()); } } catch (MultiException e) { // XXX To do logger.log(Level.SEVERE, "Cannot find scanner for " + this.getModuleType(), e); } return (ModuleScanner)scanner; }
/** * Returns the scanner for this archivist, usually it is the scanner regitered * with the same module type as this archivist, but subclasses can return a * different version * */ public ModuleScanner getScanner() { Scanner scanner = null; try { scanner = habitat.getComponent(Scanner.class, getModuleType().toString()); if (scanner==null || !(scanner instanceof ModuleScanner)) { logger.log(Level.SEVERE, "Cannot find module scanner for " + this.getManifest()); } } catch (ComponentException e) { // XXX To do logger.log(Level.SEVERE, "Cannot find scanner for " + this.getModuleType(), e); } return (ModuleScanner)scanner; }
/** * Only archivists should have access to this API. we'll see how it works, * @param moduleType * @return * @throws IOException */ Archivist getPrivateArchivistFor(XModuleType moduleType) throws IOException { for (Archivist pa : archivists) { Archivist a = Archivist.class.cast(pa); if (a.getModuleType().equals(moduleType)) { return copyOf(a); } } return null; }
public static void setExtensionArchivistForSubArchivist(ServiceLocator habitat, ReadableArchive archive, ModuleDescriptor md, Application app, Archivist subArchivist) { try { Collection<Sniffer> sniffers = getSniffersForModule(habitat, archive, md, app); ArchivistFactory archivistFactory = habitat.getService(ArchivistFactory.class); subArchivist.setExtensionArchivists(archivistFactory.getExtensionsArchivists(sniffers, subArchivist.getModuleType())); } catch (Exception e) { deplLogger.log(Level.WARNING, EXCEPTION_CAUGHT, new Object[] { e.getMessage(), e }); } }
/** * 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(); } }
if (extensionsArchivists!=null) { for (ExtensionsArchivist extension : extensionsArchivists) { if (extension.supportsModuleType(getModuleType())) { Object o = extension.open(this, descriptorArchive, descriptor); if (o instanceof RootDeploymentDescriptor) {
/** * Write extension descriptors * @param in the input archive * @param out the output archive */ public void writeExtensionDeploymentDescriptors(ReadableArchive in, WritableArchive out) throws IOException { // we need to re-initialize extension archivists, but we don't have // applicable sniffers information here, so we will get all extension // archivists with matched type. This is ok as it's just for writing // out deployment descriptors which will not be invoked in normal // code path Collection<ExtensionsArchivist> extArchivists = habitat.getAllServices(ExtensionsArchivist.class); for (ExtensionsArchivist extension : extArchivists) { if (extension.supportsModuleType(getModuleType())) { extension.writeDeploymentDescriptors(this, getDescriptor(), in, out); } } }
/** * writes the standard deployment descriptors to an abstract archive * * @param out archive to write to */ public void writeStandardDeploymentDescriptors(Archivist main, BundleDescriptor descriptor, WritableArchive out) throws IOException { getStandardDDFile(descriptor).setArchiveType(main.getModuleType()); OutputStream os = out.putNextEntry(standardDD.getDeploymentDescriptorPath()); standardDD.write(descriptor, os); out.closeEntry(); }
/** * writes the standard deployment descriptors to an abstract archive * * @param out archive to write to */ public void writeStandardDeploymentDescriptors(WritableArchive out) throws IOException { getStandardDDFile().setArchiveType(getModuleType()); OutputStream os = out.putNextEntry(getDeploymentDescriptorPath()); standardDD.write(getDescriptor(), os); out.closeEntry(); }
/** * 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(); } }
getStandardDDFile().setArchiveType(getModuleType()); File altDDFile = archive.getArchiveMetaData( DeploymentProperties.ALT_DD, File.class);
getStandardDDFile(descriptor).setArchiveType(main.getModuleType()); if (archive.getURI() != null) { standardDD.setErrorReportingString(archive.getURI().getSchemeSpecificPart());
@SuppressWarnings("unchecked") List<ConfigurationDeploymentDescriptorFile> archivistConfDDFiles = archivist.getConfigurationDDFiles(); for (ConfigurationDeploymentDescriptorFile ddFile : sortConfigurationDDFiles(archivistConfDDFiles, archivist.getModuleType(), embeddedArchive)) { String ddPath = ddFile.getDeploymentDescriptorPath(); if (ddPath.indexOf(DescriptorConstants.WLS) != -1 &&
archivist.setExtensionArchivists(archivistFactory.getExtensionsArchivists(sniffers, archivist.getModuleType()));