/** * @return true if the jarName corresponds to component jar (like a war or ejb.jar) in an .ear false otherwise */ public static boolean isComponentJar(String jarName, Set<ModuleDescriptor<BundleDescriptor>> moduleDescriptors) { boolean isComponentJar = false; for (ModuleDescriptor md : moduleDescriptors) { String archiveUri = md.getArchiveUri(); if (jarName.equals(archiveUri)) { isComponentJar = true; break; } } return isComponentJar; }
public String getAppJndiName() { String modName = enclosingBundle.getModuleDescriptor().getModuleName(); StringBuffer javaAppPrefix = new StringBuffer("java:app/"); javaAppPrefix.append(modName); javaAppPrefix.append("/"); // If the managed bean is named, use the name for the final component // of the managed bean global name. Otherwise, use a derived internal // name since we'll still need a way to register and lookup the bean // from within the container. String componentName = isNamed() ? name : "___internal_managed_bean_" + beanClassName; javaAppPrefix.append(componentName); return javaAppPrefix.toString(); }
public void addModule(ModuleDescriptor<BundleDescriptor> descriptor) { modules.add(descriptor); if (descriptor.getDescriptor() != null) { descriptor.getDescriptor().setApplication(this); } }
private String getModuleName(BundleDescriptor bundleDesc, Application app) { Set<ModuleDescriptor<BundleDescriptor>> moduleDescriptors = app.getModules(); if(moduleDescriptors != null){ for(ModuleDescriptor moduleDesc : moduleDescriptors){ if(bundleDesc.equals(moduleDesc.getDescriptor())){ return moduleDesc.getModuleName(); } } } return null; }
private String getModuleLocation(ModuleDescriptor module) throws IOException { String moduleLocation = (new File(rootLocation_.getURI())).getAbsolutePath(); if( !module.isStandalone() ) { // If this is an ear, get module jar by adding the module path // to the root directory. String archiveUri = module.getArchiveUri(); archiveUri = archiveUri.replace('.', '_'); moduleLocation = moduleLocation + File.separator + archiveUri; } return moduleLocation; }
/** * Archivists can be associated with a module descriptor once the * XML deployment descriptors have been read and the DOL tree * is initialized. */ public void setModuleDescriptor(ModuleDescriptor<T> module) { setDescriptor(module.getDescriptor()); setManifest(module.getManifest()); }
Archivist newArchivist = archivistFactory.get().getPrivateArchivistFor(aModule.getModuleType()); newArchivist.initializeContext(this); newArchivist.setRuntimeXMLValidation(this.getRuntimeXMLValidation()); ReadableArchive embeddedArchive = appArchive.getSubArchive(aModule.getArchiveUri()); if (embeddedArchive!=null) { embeddedArchive.setParentArchive(appArchive); if (aModule.getAlternateDescriptor()!=null) { InputStream is = appArchive.getEntry(aModule.getAlternateDescriptor()); DeploymentDescriptorFile ddFile = newArchivist.getStandardDDFile(); ddFile.setXMLValidation(newArchivist.getXMLValidation()); if (extension.supportsModuleType(aModule.getModuleType())) { Object rdd = extension.open(newArchivist, embeddedArchive, descriptor); if (rdd instanceof RootDeploymentDescriptor) { is = appArchive.getEntry("sun-" + aModule.getAlternateDescriptor()); if (is!=null) { DeploymentDescriptorFile confDD = "enterprise.deployment.cannotfindmodule", "Cannot find module {0} in application bundle", new Object[] {aModule.getArchiveUri()})); nonexistentModules.add(aModule); continue; descriptor.getModuleDescriptor().setArchiveUri(
if (application.isVirtual()) { ModuleDescriptor aModule = (ModuleDescriptor) application.getModules().iterator().next(); Archivist moduleArchivist = archivistFactory.getArchivist(aModule.getModuleType()); write((BundleDescriptor)aModule.getDescriptor(), moduleArchivist, in, out); } else { Archivist moduleArchivist = archivistFactory.getArchivist(aModule.getModuleType()); if (aModule.getAlternateDescriptor()!=null) { String ddPath = aModule.getAlternateDescriptor(); DeploymentDescriptorFile ddFile = moduleArchivist.getStandardDDFile(); (BundleDescriptor)aModule.getDescriptor(); if (!bundle.isFullFlag()) { if (ddFile != null) { if (aModule.getModuleType().equals(XModuleType.WAR)) { WebBundleDescriptor webBundle = (WebBundleDescriptor) aModule.getDescriptor(); if (webBundle.hasWebServices()) { if (ddFile != null) { if (confDDFile!=null) { OutputStream os = out.putNextEntry(runtimeDDPath); confDDFile.write(aModule.getDescriptor(), os); out.closeEntry(); WritableArchive moduleArchive = out.createSubArchive(aModule.getArchiveUri());
/** * Obtain a set of all bundle descriptors, regardless of type * * @return the set of bundle descriptors */ public Set<BundleDescriptor> getBundleDescriptors() { Set<BundleDescriptor> bundleSet = new OrderedSet<BundleDescriptor>(); for (ModuleDescriptor<BundleDescriptor> aModule : getModules()) { if (aModule.getDescriptor() != null) { bundleSet.add(aModule.getDescriptor()); } else { DOLUtils.getDefaultLogger().fine("Null descriptor for module " + aModule.getArchiveUri()); } } return bundleSet; }
Archivist subArchivist = archivistFactory.get().getPrivateArchivistFor(moduleDesc.getModuleType()); String archiveUri = moduleDesc.getArchiveUri(); String runtimeDDPath = subArchivist.getRuntimeDeploymentDescriptorPath(); mangledName, planArchive, moduleDesc.getDescriptor());
/** * 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 (XModuleType.WAR.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 (XModuleType.CAR.equals(descriptor.getModuleType())) { type = ApplicationTagNames.APPLICATION_CLIENT; } else if (XModuleType.RAR.equals(descriptor.getModuleType())) { type = ApplicationTagNames.CONNECTOR; } appendTextChild(module, type, descriptor.getArchiveUri()); } appendTextChild(module,ApplicationTagNames.ALTERNATIVE_DD, descriptor.getAlternateDescriptor()); return module; } }
EjbBundleDescriptor bundleDesc = (EjbBundleDescriptor) eddf.read(is); ModuleDescriptor moduleDesc = bundleDesc.getModuleDescriptor(); moduleDesc.setArchiveUri(fileName); moduleName = moduleDesc.getModuleName(); } else { GenericAnnotationDetector detector =
Archivist subArchivist = archivistFactory.get().getPrivateArchivistFor(aModule.getModuleType()); subArchivist.initializeContext(this); subArchivist.setModuleDescriptor(aModule); if(DOLUtils.getDefaultLogger().isLoggable(Level.FINE)) { DOLUtils.getDefaultLogger().info("Write " + aModule.getArchiveUri() + " with " + subArchivist); if (aModule.getAlternateDescriptor()!=null) { OutputStream os = out.putNextEntry(aModule.getAlternateDescriptor()); subArchivist.writeStandardDeploymentDescriptors(os); out.closeEntry(); os = out.putNextEntry("sun-" + aModule.getAlternateDescriptor()); subArchivist.writeRuntimeDeploymentDescriptors(os); out.closeEntry(); WritableArchive internalJar = out.createSubArchive(aModule.getArchiveUri()); InputStream is = in.getEntry(aModule.getArchiveUri()); File tmpFile=null; try { filesToSkip.add(aModule.getArchiveUri());
Vector entriesAdded = new Vector(); for (ModuleDescriptor aModule : a.getModules()) { entriesAdded.add(aModule.getArchiveUri()); ReadableArchive subSource = source.getSubArchive(aModule.getArchiveUri()); WritableArchive subTarget = target.createSubArchive(aModule.getArchiveUri()); Archivist newArchivist = archivistFactory.get().getPrivateArchivistFor(aModule.getModuleType()); newArchivist.copyInto(subSource, subTarget, overwriteManifest); target.closeEntry(subTarget);
module.getModuleName().equals(module2.getModuleName())) { conflicted.add(module2); foundConflictedModule = true; cModule.setModuleName(cModule.getModuleName() + cModule.getModuleType().toString());
if (module.getModuleType().equals(XModuleType.WAR)) { Node web = appendChild(appNode, RuntimeTagNames.WEB); appendTextChild(web, RuntimeTagNames.WEB_URI, module.getArchiveUri()); appendTextChild(web, RuntimeTagNames.CONTEXT_ROOT, module.getContextRoot());
/** * Creates a new application to hold a standalone module * * @param name the application name * @param newModule the standalone module descriptor * @return the application */ public static Application createApplication(Habitat habitat, String name, ModuleDescriptor<BundleDescriptor> newModule) { // create a new empty application Application application = new Application(habitat); application.setVirtual(true); if (name == null && newModule.getDescriptor() != null) { name = newModule.getDescriptor().getDisplayName(); } String untaggedName = VersioningUtils.getUntaggedName(name); if (name != null) { application.setDisplayName(untaggedName); application.setName(untaggedName); application.setAppName(untaggedName); } // add the module to it newModule.setStandalone(true); newModule.setArchiveUri(untaggedName); if (newModule.getDescriptor() != null) { newModule.getDescriptor().setApplication(application); } application.addModule(newModule); return application; }
String webUri = wbd.getModuleDescriptor().getArchiveUri(); String contextRoot = wbd.getModuleDescriptor().getContextRoot(); if (moduleID.equals(webUri)) { StringBuilder dir = new StringBuilder(location);
public void setElementValue(XMLElement element, String value) { if (TagNames.MODULE_NAME.equals(element.getQName())) { EjbBundleDescriptor bundleDesc = getDescriptor(); // ejb-jar.xml <module-name> only applies if this is an ejb-jar if( bundleDesc.getModuleDescriptor().getDescriptor() instanceof EjbBundleDescriptor ) { bundleDesc.getModuleDescriptor().setModuleName(value); } } else { super.setElementValue(element, value); } }
(name.endsWith("_war") || name.endsWith(".war")))) { ModuleDescriptor<BundleDescriptor> md = new ModuleDescriptor<BundleDescriptor>(); md.setArchiveUri(uri); md.setModuleType(XModuleType.WAR); (name.endsWith("_rar") || name.endsWith(".rar")))) { ModuleDescriptor<BundleDescriptor> md = new ModuleDescriptor<BundleDescriptor>(); md.setArchiveUri(uri); md.setModuleType(XModuleType.RAR); app.addModule(md); } else if ((!directory && name.endsWith(".jar")) ModuleDescriptor<BundleDescriptor> md = new ModuleDescriptor<BundleDescriptor>(); md.setArchiveUri(uri); md.setModuleType(XModuleType.CAR); md.setManifest(subArchive.getManifest()); app.addModule(md); continue; ModuleDescriptor<BundleDescriptor> md = new ModuleDescriptor<BundleDescriptor>(); md.setArchiveUri(uri); md.setModuleType(XModuleType.EJB); app.addModule(md); continue; ModuleDescriptor<BundleDescriptor> md = new ModuleDescriptor<BundleDescriptor>(); md.setArchiveUri(uri);