/** * Lookup module by uri. * * @return a bundle descriptor in this application identified by uri * or null if not found. */ public Collection<ModuleDescriptor<BundleDescriptor>> getModuleDescriptorsByType(ArchiveType type) { if (type==null) { throw new IllegalArgumentException("type cannot be null"); } LinkedList<ModuleDescriptor<BundleDescriptor>> results = new LinkedList<ModuleDescriptor<BundleDescriptor>>(); for (ModuleDescriptor<BundleDescriptor> aModule : getModules()) { if (type.equals(aModule.getModuleType())) { results.add(aModule); } } return results; }
private String getModuleType(ModuleDescriptor modDesc) { String type = null; if (modDesc.getModuleType().equals(DOLUtils.ejbType())) { type = "EJBModule"; } else if (modDesc.getModuleType().equals(DOLUtils.warType())) { type = "WebModule"; } else if (modDesc.getModuleType().equals(DOLUtils.carType())) { type = "AppClientModule"; } else if (modDesc.getModuleType().equals(DOLUtils.rarType())) { type = "ConnectorModule"; } return type; } }
private List<String> getSubModulesForEar(com.sun.enterprise.deployment.Application application, String type) { List<String> moduleInfoList = new ArrayList<String>(); Collection<ModuleDescriptor<BundleDescriptor>> modules = getSubModuleListForEar(application, type); for (ModuleDescriptor moduleDesc : modules) { String moduleInfo = moduleDesc.getArchiveUri() + ":" + moduleDesc.getModuleType(); if (moduleDesc.getModuleType().equals(DOLUtils.warType())) { moduleInfo = moduleInfo + ":" + moduleDesc.getContextRoot(); } moduleInfoList.add(moduleInfo); } return moduleInfoList; }
cModule.getModuleType().toString());
try final Archivist moduleArchivist = archivistFactory.getArchivist(bundleDesc.getModuleDescriptor().getModuleType()); final DeploymentDescriptorFile ddFile = moduleArchivist.getStandardDDFile();
/** * Perform Optional packages dependencies checking on an archive */ @Override public boolean performOptionalPkgDependenciesCheck(ReadableArchive archive) throws IOException { if (!super.performOptionalPkgDependenciesCheck(archive)) return false; // now check sub modules if (descriptor==null) { throw new IOException("Application object not set on archivist"); } boolean returnValue = true; for (ModuleDescriptor md : descriptor.getModules()) { ReadableArchive sub = archive.getSubArchive(md.getArchiveUri()); if (sub!=null) { Archivist subArchivist = archivistFactory.get().getArchivist(md.getModuleType()); if (!subArchivist.performOptionalPkgDependenciesCheck(sub)) returnValue = false; } } return returnValue; }
ReadableArchive subSource = source.getSubArchive(aModule.getArchiveUri()); WritableArchive subTarget = target.createSubArchive(aModule.getArchiveUri()); Archivist newArchivist = archivistFactory.get().getArchivist(aModule.getModuleType()); ReadableArchive subArchive = archiveFactory.openArchive(subTarget.getURI()); subSource.setParentArchive(subArchive);
if (md.getModuleType().equals(DOLUtils.warType())) { md.setContextRoot(value); } else {
Archivist subArchivist = archivistFactory.get().getArchivist(aModule.getModuleType()); subArchivist.initializeContext(this); subArchivist.setModuleDescriptor(aModule);
/** * writes an application deployment descriptors * @param the application object * @param the abstract archive */ public void write(Application application, ReadableArchive in, WritableArchive out) throws IOException { if (application.isVirtual()) { ModuleDescriptor aModule = (ModuleDescriptor) application.getModules().iterator().next(); Archivist moduleArchivist = archivistFactory.getArchivist(aModule.getModuleType()); write((BundleDescriptor)aModule.getDescriptor(), moduleArchivist, in, out); } else { // this is a real application. // let's start by writing out all submodules deployment descriptors for (ModuleDescriptor aModule : application.getModules()) { Archivist moduleArchivist = archivistFactory.getArchivist(aModule.getModuleType()); WritableArchive moduleArchive = out.createSubArchive(aModule.getArchiveUri()); ReadableArchive moduleArchive2 = in.getSubArchive(aModule.getArchiveUri()); write((BundleDescriptor)aModule.getDescriptor(), moduleArchivist, moduleArchive2, moduleArchive); } // now let's write the application descriptor ApplicationArchivist archivist = archivistProvider.get(); archivist.setDescriptor(application); archivist.writeDeploymentDescriptors(in, out); } }
/** * write the descriptor class to a DOM tree and return it * * @param parent node in the DOM tree * @param node name for the root element of this xml fragment * @param the descriptor to write * @return the DOM tree top node */ public Node writeDescriptor(Node parent, String nodeName, ModuleDescriptor descriptor) { Node module = appendChild(parent, nodeName); if (DOLUtils.warType().equals(descriptor.getModuleType())) { Node modType = appendChild(module, ApplicationTagNames.WEB); appendTextChild(modType, ApplicationTagNames.WEB_URI, descriptor.getArchiveUri()); forceAppendTextChild(modType, ApplicationTagNames.CONTEXT_ROOT, descriptor.getContextRoot()); } else { // default initialization if ejb... String type = ApplicationTagNames.EJB; if (DOLUtils.carType().equals(descriptor.getModuleType())) { type = ApplicationTagNames.APPLICATION_CLIENT; } else if (DOLUtils.rarType().equals(descriptor.getModuleType())) { type = ApplicationTagNames.CONNECTOR; } appendTextChild(module, type, descriptor.getArchiveUri()); } appendTextChild(module,ApplicationTagNames.ALTERNATIVE_DD, descriptor.getAlternateDescriptor()); return module; } }
private static Collection<Sniffer> getSniffersForModule(ServiceLocator habitat, ReadableArchive archive, ModuleDescriptor md, Application app) throws Exception { ArchiveHandler handler = habitat.getService(ArchiveHandler.class, md.getModuleType().toString()); SnifferManager snifferManager = habitat.getService(SnifferManager.class); List<URI> classPathURIs = handler.getClassPathURIs(archive); Collection<Sniffer> sniffers = snifferManager.getSniffers(context, classPathURIs, types); context.postDeployClean(true); String type = getTypeFromModuleType(md.getModuleType()); Sniffer mainSniffer = null; for (Sniffer sniffer : sniffers) {
context.getModuleArchiveHandlers().get(moduleUri); if (handler == null) { handler = getArchiveHandlerFromModuleType(md.getModuleType()); if (handler == null) { handler = deployment.getArchiveHandler(sub); if (md.getModuleType().equals(DOLUtils.ejbType())) { } else if (md.getModuleType().equals(DOLUtils.rarType())) { embeddedConnCl.addDelegate( (DelegatingClassLoader.ClassFinder)subCl);
ArchiveHandler subHandler = getArchiveHandlerFromModuleType(md.getModuleType()); if (subHandler == null) { subHandler = deployment.getArchiveHandler(subArchive);
if (module.getModuleType().equals(DOLUtils.warType())) { Node web = appendChild(appNode, RuntimeTagNames.WEB); appendTextChild(web, RuntimeTagNames.WEB_URI, module.getArchiveUri());
Archivist newArchivist = archivistFactory.get().getArchivist(aModule.getModuleType()); newArchivist.initializeContext(this); newArchivist.setRuntimeXMLValidation(this.getRuntimeXMLValidation()); if (aModule.getModuleType().equals(DOLUtils.warType())) { WebBundleDescriptor wbd = (WebBundleDescriptor) descriptor; if (wbd.getContextRoot() != null && !wbd.getContextRoot().equals(""))
Archivist archivist = archivistFactory.get().getArchivist(md.getModuleType()); archivist.initializeContext(this); archivist.setRuntimeXMLValidation(