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; }
/** * Set the DOL descriptor for this Archivist, used by super classes */ public void setDescriptor(Application descriptor) { // this is acceptable if the application actually represents // a standalone module Set<EjbBundleDescriptorImpl> ejbBundles = descriptor.getBundleDescriptors(EjbBundleDescriptorImpl.class); if (ejbBundles.size()>0) { this.descriptor = ejbBundles.iterator().next(); if (this.descriptor.getModuleDescriptor().isStandalone()) return; else this.descriptor=null; } }
public void setDescriptor(Application application) { // this is acceptable if the application actually represents // a standalone module java.util.Set appClientBundles = application.getBundleDescriptors(ApplicationClientDescriptor.class); if (appClientBundles.size() > 0) { this.descriptor = (ApplicationClientDescriptor) appClientBundles.iterator().next(); if (this.descriptor.getModuleDescriptor().isStandalone()) return; else this.descriptor = null; } DOLUtils.getDefaultLogger().log(Level.SEVERE, "enterprise.deployment.backend.descriptorFailure", new Object[]{this}); throw new RuntimeException("Error setting descriptor " + descriptor + " in " + this); }
public String getGeneratedWsdlFilePath() { if (hasWsdlFile()) { String xmlDir = getBundleDescriptor().getApplication().getGeneratedXMLDirectory(); if(!getBundleDescriptor().getModuleDescriptor().isStandalone()) { String uri = getBundleDescriptor().getModuleDescriptor().getArchiveUri(); xmlDir = xmlDir + File.separator + uri.replaceAll("\\.", "_"); } if(xmlDir == null) { return null; } return xmlDir + File.separator + wsdlFileUri; } else { return getWsdlFileUrl().getPath(); } }
/** * This is a utility method which calculates the absolute path of the * root of a PU. Absolute path is not the path with regards to * root of file system. It is the path from the root of the Java EE * application this persistence unit belongs to. * Like {@link #getPuRoot()} returned path always uses '/' as path separator. * @return the absolute path of the root of this persistence unit * @see #getPuRoot() */ public String getAbsolutePuRoot() { RootDeploymentDescriptor rootDD = getParent(); if(rootDD.isApplication()){ return getPuRoot(); } else { ModuleDescriptor module = BundleDescriptor.class.cast(rootDD). getModuleDescriptor(); if(module.isStandalone()) { return getPuRoot(); } else { final String moduleLocation = module.getArchiveUri(); return moduleLocation + '/' + getPuRoot(); // see we always '/' } } }
/** * @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; } }
/** * This method calculates the absolute path of the root of a PU. * Absolute path is not the path with regards to root of file system. * It is the path from the root of the Java EE application this * persistence unit belongs to. * Returned path always uses '/' as path separator. * @return the absolute path of the root of this persistence unit */ private String getAbsolutePuRootWithinApplication() { // TODO shift this into PersistenceUnitDescriptor to better encapsulate RootDeploymentDescriptor rootDD = persistenceUnitDescriptor.getParent(). getParent(); String puRoot = persistenceUnitDescriptor.getPuRoot(); if(rootDD.isApplication()){ return puRoot; } else { ModuleDescriptor module = BundleDescriptor.class.cast(rootDD). getModuleDescriptor(); if(module.isStandalone()) { return puRoot; } else { // The module is embedded in an ear (an ejb jar or war) final String moduleLocation = // Would point to the directory where module is expanded. For example myejb_jar DeploymentUtils.getRelativeEmbeddedModulePath( providerContainerContractInfo.getApplicationLocation(), module.getArchiveUri()); return moduleLocation + '/' + puRoot; // see we always '/' } } }