/** * This method returns the file path of an embedded module. * For example, if the module is expanded/located at * $domain_dir/applications/j2ee-apps/foo/fooEJB_jar, * this method will return * $domain_dir/applications/j2ee-apps/foo/fooEJB_jar * *@param appRootPath The path of the application root which * contains the module * e.g. $domain_dir/applications/j2ee-apps/foo *@param moduleUri The module uri * e.g. fooEJB.jar *@return The file path of the module */ public static String getEmbeddedModulePath(String appRootPath, String moduleUri) { return appRootPath + File.separator + getRelativeEmbeddedModulePath(appRootPath, moduleUri) ; }
getRelativeEmbeddedModulePath(parentPath. getAbsolutePath(), nameComponent));
String moduleDir = DeploymentUtils.getRelativeEmbeddedModulePath( location, 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 '/' } } }