public String getModuleName() { String moduleName = null; // for standalone jars, return its registration name // for applications, return the module uri if (getApplication().isVirtual()) { moduleName = getApplication().getRegistrationName(); } else { moduleName = getModuleDescriptor().getArchiveUri(); } return moduleName; }
/** * 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); } }
public String getGlobalJndiName() { String appName = null; if (enclosingBundle == null) return null; Application app = enclosingBundle.getApplication(); if ( !app.isVirtual() ) { appName = enclosingBundle.getApplication().getAppName(); } String modName = enclosingBundle.getModuleDescriptor().getModuleName(); StringBuffer javaGlobalPrefix = new StringBuffer("java:global/"); if (appName != null) { javaGlobalPrefix.append(appName); javaGlobalPrefix.append("/"); } javaGlobalPrefix.append(modName); javaGlobalPrefix.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; javaGlobalPrefix.append(componentName); return javaGlobalPrefix.toString(); }
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; }
/** * @return the module ID for this module descriptor */ public String getModuleID() { if (moduleID == null) { moduleID = getModuleDescriptor().getArchiveUri(); } if (getModuleDescriptor().isStandalone()) { return moduleID; } if (application != null && !application.isVirtual()) { return application.getRegistrationName() + "#" + getModuleDescriptor().getArchiveUri(); } else { return moduleID; } }
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; }
if (aModule.getArchiveUri().indexOf(" ") != -1) { throw new IllegalArgumentException(localStrings.getLocalString("enterprise.deployment.unsupporturi", "Unsupported module URI {0}, it contains space(s)", new Object[]{aModule.getArchiveUri()})); Archivist newArchivist = archivistFactory.get().getArchivist(aModule.getModuleType()); newArchivist.initializeContext(this); newArchivist.setRuntimeXMLValidation(this.getRuntimeXMLValidation()); ReadableArchive embeddedArchive = appArchive.getSubArchive(aModule.getArchiveUri()); if (embeddedArchive == null) { throw new IllegalArgumentException(localStrings.getLocalString("enterprise.deployment.nosuchmodule", "Could not find sub module [{0}] as defined in application.xml", new Object[]{aModule.getArchiveUri()})); if (aModule.getAlternateDescriptor()!=null) { InputStream is = appArchive.getEntry(aModule.getAlternateDescriptor()); DeploymentDescriptorFile ddFile = newArchivist.getStandardDDFile(); ddFile.setXMLValidation(newArchivist.getXMLValidation()); DOLUtils.readAlternativeRuntimeDescriptor(appArchive, embeddedArchive, newArchivist, descriptor, aModule.getAlternateDescriptor()); descriptor.getModuleDescriptor().setArchiveUri( aModule.getArchiveUri()); aModule.setModuleName( descriptor.getModuleDescriptor().getModuleName()); aModule.setDescriptor(descriptor); descriptor.setApplication(app); aModule.setManifest(newArchivist.getManifest()); if (aModule.getModuleType().equals(DOLUtils.warType())) { WebBundleDescriptor wbd = (WebBundleDescriptor) descriptor;
throws IOException { 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().getArchivist(aModule.getModuleType()); ReadableArchive subArchive = archiveFactory.openArchive(subTarget.getURI()); subSource.setParentArchive(subArchive); newArchivist.copyInto(subSource, subTarget, overwriteManifest); target.closeEntry(subTarget); String subModulePath = subSource.getURI().getSchemeSpecificPart(); String parentPath = source.getURI().getSchemeSpecificPart(); if (subModulePath.startsWith(parentPath)) {
@Override protected void accept(EjbReference ejbRef) { if (DOLUtils.getDefaultLogger().isLoggable(Level.FINE)) { DOLUtils.getDefaultLogger().fine("Visiting Ref" + ejbRef); referringJar = getBundleDescriptor(); ClassLoader classLoader = referringJar.getClassLoader(); if (DOLUtils.getDefaultLogger().isLoggable(Level.FINE)) { DOLUtils.getDefaultLogger().fine("Ref " + ejbRef.getName() + " is bound to Ejb with JNDI Name " + ejbRef.getJndiName()); ejbRef.getReferringBundleDescriptor(); Application app = targetModule.getApplication(); if (!sourceModule.isPackagedAsSingleModule(targetModule)) { String relativeUri = null; if( sourceModule == app ) { relativeUri = targetModule.getModuleDescriptor().getArchiveUri(); } else { relativeUri = getApplication().getRelativeUri(sourceModule, targetModule); ((EjbBundleDescriptor)refereeJar).getEjbByName(ejbName);
for (ModuleDescriptor md : holder.app.getModules()) { String moduleUri = md.getArchiveUri(); ReadableArchive subArchive = null; WritableArchive subTarget = null; ReadableArchive subArchiveToExpand = null; try { subArchive = source2.getSubArchive(moduleUri); if (subArchive == null) { _logger.log(Level.WARNING, ArchiveHandler subHandler = getArchiveHandlerFromModuleType(md.getModuleType()); if (subHandler == null) { subHandler = deployment.getArchiveHandler(subArchive); final String msg = MessageFormat.format( _logger.getResourceBundle().getString("enterprise.deployment.backend.badSubModPackaging"), subArchive.getURI().toASCIIString(), subArchive.getClass().getName()); throw new RuntimeException(msg); try { if (subArchive != null) { subArchive.close();
/** Calculate module name from a bundle. * @return module name. */ public static String getModuleName(EjbBundleDescriptor bundle) { String moduleName = null; Application application = bundle.getApplication(); if (application.isVirtual()) { // Stand-alone module is deployed. moduleName = application.getRegistrationName(); } else { // Module is deployed as a part of an Application. String jarName = bundle.getModuleDescriptor().getArchiveUri(); int l = jarName.length(); // Remove ".jar" from the bundle's jar name. moduleName = jarName.substring(0, l - 4); } return moduleName; }
private Application processDOL(DeploymentContext dc) throws IOException { ReadableArchive sourceArchive = dc.getSource(); sourceArchive.setExtraData(Types.class, dc.getTransientAppMetaData(Types.class.getName(), Types.class)); sourceArchive.setExtraData(Parser.class, dc.getTransientAppMetaData(Parser.class.getName(), Parser.class)); sourceArchive.addArchiveMetaData(DeploymentProperties.APP_PROPS, dc.getAppProps()); sourceArchive.addArchiveMetaData(DeploymentProperties.COMMAND_PARAMS, return Application.createApplication(); application = holder.app; application.setAppName(name); application.setClassLoader(cl); if (application.isVirtual()) { ModuleDescriptor md = application.getStandaloneBundleDescriptor().getModuleDescriptor(); md.setModuleName(name); application.setAppName(name); ModuleDescriptor md = application.getStandaloneBundleDescriptor().getModuleDescriptor(); md.setModuleName(name); } catch(SAXException e) { throw new IOException(e);
CallFlowInfoImpl(BaseContainer container, EjbDescriptor descriptor, ComponentType compType) { this.container = container; this.ejbDescriptor = descriptor; this.appName = (ejbDescriptor.getApplication().isVirtual()) ? null : ejbDescriptor.getApplication().getRegistrationName(); String archiveuri = ejbDescriptor.getEjbBundleDescriptor() .getModuleDescriptor().getArchiveUri(); this.modName = com.sun.enterprise.util.io.FileUtils .makeFriendlyFilename(archiveuri); this.ejbName = ejbDescriptor.getName(); this.componentType = compType; }
for (ModuleDescriptor module : application.getModules()) { if (module.getModuleType().equals(DOLUtils.warType())) { Node web = appendChild(appNode, RuntimeTagNames.WEB); appendTextChild(web, RuntimeTagNames.WEB_URI, module.getArchiveUri()); appendTextChild(web, RuntimeTagNames.CONTEXT_ROOT, module.getContextRoot()); if (application.isPassByReferenceDefined()) { appendTextChild(appNode, RuntimeTagNames.PASS_BY_REFERENCE, String.valueOf(application.getPassByReference()));
Descriptor d = ejbBundle.getModuleDescriptor().getDescriptor(); id = webEnv.getApplication().getName() + ID_SEPARATOR + webEnv.getContextRoot(); if (deplLogger.isLoggable(Level.FINER)) { id = ejbEnv.getApplication().getName() + ID_SEPARATOR + ejbBundle.getModuleDescriptor().getArchiveUri() + ID_SEPARATOR + ejbEnv.getName() + ID_SEPARATOR + flattedJndiName + ejbEnv.getUniqueId(); id = webEnv.getApplication().getName() + ID_SEPARATOR + webEnv.getContextRoot(); } else if (env instanceof ApplicationClientDescriptor) { EjbBundleDescriptor ejbBundle = (EjbBundleDescriptor) env; id = "__ejbBundle__" + ID_SEPARATOR + ejbBundle.getApplication().getName() + ID_SEPARATOR + ejbBundle.getModuleName();
application.getRegistrationName()); final ClassLoader jcl = application.getClassLoader(); String archiveUri = ctx.getSource().getURI().getSchemeSpecificPart(); _logger.fine("Java2DB processing: " + (end - start) + " msec"); _logger.fine( "cmpc.done_processing_cmp", application.getRegistrationName()); "cmpc.cmp_app_error", eType, appName, exMsg); } else { String bundleName = bundle.getModuleDescriptor().getArchiveUri(); if (beanName == null) {
private String getJavaGlobalJndiNamePrefix(EjbDescriptor ejbDescriptor) { String appName = null; Application app = ejbDescriptor.getApplication(); if ( ! app.isVirtual() ) { appName = ejbDescriptor.getApplication().getAppName(); } EjbBundleDescriptor ejbBundle = ejbDescriptor.getEjbBundleDescriptor(); String modName = ejbBundle.getModuleDescriptor().getModuleName(); String ejbName = ejbDescriptor.getName(); StringBuilder javaGlobalPrefix = new StringBuilder("java:global/"); if (appName != null) { javaGlobalPrefix.append(appName); javaGlobalPrefix.append("/"); } javaGlobalPrefix.append(modName); javaGlobalPrefix.append("/"); javaGlobalPrefix.append(ejbName); return javaGlobalPrefix.toString(); }
public void accept(Application application) { this.application = application; if (application.getBundleDescriptors().size() == 0) { throw new IllegalArgumentException("Application [" + application.getRegistrationName() + "] contains no valid components"); application.getModules(); for (ModuleDescriptor module : modules) { module.getModuleName().equals(module2.getModuleName())) { conflicted.add(module2); foundConflictedModule = true; cModule.setModuleName(cModule.getModuleName() + cModule.getModuleType().toString());
final URL[] earLibURLs = ASClassLoaderUtil.getAppLibDirLibraries(context.getSourceDir(), holder.app.getLibraryDirectory(), compatProp); final EarLibClassLoader earLibCl = AccessController.doPrivileged(new PrivilegedAction<EarLibClassLoader>() { @Override for (ModuleDescriptor md : holder.app.getModules()) { ReadableArchive sub = null; String moduleUri = md.getArchiveUri(); try { sub = archive.getSubArchive(moduleUri); if (sub instanceof InputJarArchive) { throw new IllegalArgumentException(strings.get("wrongArchType", moduleUri)); context.getModuleArchiveHandlers().get(moduleUri); if (handler == null) { handler = getArchiveHandlerFromModuleType(md.getModuleType()); if (handler == null) { handler = deployment.getArchiveHandler(sub); sub.setParentArchive(context.getSource()); if (md.getModuleType().equals(DOLUtils.ejbType())) { } else if (md.getModuleType().equals(DOLUtils.rarType())) { embeddedConnCl.addDelegate( (DelegatingClassLoader.ClassFinder)subCl);
public static String getContextID(EjbBundleDescriptor ejbBundleDesc) { String cid = null; if (ejbBundleDesc != null) { /* detect special case of EJBs embedded in a war, * and make sure psuedo policy context id is unique within app */ Object root = ejbBundleDesc.getModuleDescriptor().getDescriptor(); if( (root != ejbBundleDesc) && (root instanceof WebBundleDescriptor ) ) { cid = createUniquePseudoModuleID(ejbBundleDesc); } else { cid = VersioningUtils.getRepositoryName(ejbBundleDesc.getApplication().getRegistrationName()) + '/' + ejbBundleDesc.getUniqueFriendlyId(); } } return cid; } public static String getContextID(WebBundleDescriptor wbd) {