/** * 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 '/' } } }
public RootXMLNode getRootXMLNode(Descriptor descriptor) { // This method is called from SaxParserHandler.startElement() method // as well as DeploymentDescriptorFile.getDefaultSchemaSource(). // When it is called from former method, descriptor is non-null, // but when it is called later method, descriptor is null. if(descriptor==null || descriptor instanceof Application || descriptor instanceof ApplicationClientDescriptor || descriptor instanceof EjbBundleDescriptor || descriptor instanceof WebBundleDescriptor) { return new PersistenceNode(new PersistenceUnitsDescriptor()); } else { throw new IllegalArgumentException(descriptor.getClass().getName()+ "is not allowed to contain persistence.xml file"); } }
@Override public void addDescriptor(Object descriptor) { final PersistenceUnitDescriptor pud = PersistenceUnitDescriptor.class.cast(descriptor); getDescriptor().addPersistenceUnitDescriptor(pud); }
if (pus != null) { for (PersistenceUnitDescriptor pu : pus.getPersistenceUnitDescriptors()) { if (pu.getName().equals(unqualifiedUnitName)) { return pu;
protected PersistenceUnitsDescriptor readPersistenceDeploymentDescriptor(Archivist main, ReadableArchive subArchive, String puRoot, RootDeploymentDescriptor descriptor) throws IOException, SAXParseException { final String subArchiveURI = subArchive.getURI().getSchemeSpecificPart(); if (logger.isLoggable(Level.FINE)) { logger.logp(Level.FINE, "Archivist", "readPersistenceDeploymentDescriptor", "PURoot = [{0}] subArchive = {1}", new Object[]{puRoot, subArchiveURI}); } if (descriptor.getExtensionsDescriptors(PersistenceUnitsDescriptor.class, puRoot) != null) { if (logger.isLoggable(Level.FINE)) { logger.logp(Level.FINE, "Archivist", "readPersistenceDeploymentDescriptor", "PU has been already read for = {0}", subArchiveURI); } return null; } PersistenceUnitsDescriptor persistenceUnitsDescriptor = PersistenceUnitsDescriptor.class.cast(super.open(main, subArchive, descriptor)); if (persistenceUnitsDescriptor!=null) { persistenceUnitsDescriptor.setParent(descriptor); persistenceUnitsDescriptor.setPuRoot(puRoot); descriptor.addExtensionDescriptor(PersistenceUnitsDescriptor.class,persistenceUnitsDescriptor, puRoot); } return persistenceUnitsDescriptor; }
RootDeploymentDescriptor containingBundle = parent.getParent(); providerContainerContractInfo.registerEMF(pInfo.getPersistenceUnitName(), pud.getPuRoot(), containingBundle, emf);
/** * @return the absolute path of the root of this persistence unit * @see #getPuRoot() * @see PersistenceUnitsDescriptor#getAbsolutePuRoot() */ public String getAbsolutePuRoot() { return getParent().getAbsolutePuRoot(); }
public String getPuRoot() { return parent.getPuRoot(); }
public String getPersistenceXMLSchemaVersion() { return persistenceUnitDescriptor.getParent().getSpecVersion(); }
/** * Iterate through all the PersistenceUnitDescriptors for the given context (and hence corresponding bundle) and call visitPUD for each of them * @param context */ void iteratePUDs(DeploymentContext context) { RootDeploymentDescriptor currentBundle = DOLUtils.getCurrentBundleForContext(context); if (currentBundle != null) { // it can be null for non-JavaEE type of application deployment. e.g., issue 15869 Collection<PersistenceUnitsDescriptor> pusDescriptorForThisBundle = currentBundle.getExtensionsDescriptors(PersistenceUnitsDescriptor.class); for (PersistenceUnitsDescriptor persistenceUnitsDescriptor : pusDescriptorForThisBundle) { for (PersistenceUnitDescriptor pud : persistenceUnitsDescriptor.getPersistenceUnitDescriptors()) { visitPUD(pud, context); } } } }
protected PersistenceUnitsDescriptor readPersistenceDeploymentDescriptor(Archivist main, ReadableArchive subArchive, String puRoot, RootDeploymentDescriptor descriptor) throws IOException, SAXException { final String subArchiveURI = subArchive.getURI().getSchemeSpecificPart(); if (deplLogger.isLoggable(Level.FINE)) { deplLogger.logp(Level.FINE, "Archivist", "readPersistenceDeploymentDescriptor", "PURoot = [{0}] subArchive = {1}", new Object[]{puRoot, subArchiveURI}); } if (descriptor.getExtensionsDescriptors(PersistenceUnitsDescriptor.class, puRoot) != null) { if (deplLogger.isLoggable(Level.FINE)) { deplLogger.logp(Level.FINE, "Archivist", "readPersistenceDeploymentDescriptor", "PU has been already read for = {0}", subArchiveURI); } return null; } PersistenceUnitsDescriptor persistenceUnitsDescriptor = PersistenceUnitsDescriptor.class.cast(super.open(main, subArchive, descriptor)); if (persistenceUnitsDescriptor!=null) { persistenceUnitsDescriptor.setParent(descriptor); persistenceUnitsDescriptor.setPuRoot(puRoot); descriptor.addExtensionDescriptor(PersistenceUnitsDescriptor.class,persistenceUnitsDescriptor, puRoot); } return persistenceUnitsDescriptor; }
/** * 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 '/' } } }
/** * @return the absolute path of the root of this persistence unit * @see #getPuRoot() * @see PersistenceUnitsDescriptor#getAbsolutePuRoot() */ public String getAbsolutePuRoot() { return getParent().getAbsolutePuRoot(); }
public String getPuRoot() { return parent.getPuRoot(); }
if (pus != null) { for (PersistenceUnitDescriptor pu : pus.getPersistenceUnitDescriptors()) { if (pu.getName().equals(unqualifiedUnitName)) { return pu;
/** * 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 '/' } } }
Java2DBProcessorHelper.getDDLNamePrefix(parBundle.getParent().getParent());
@Override public void addDescriptor(Object descriptor) { final PersistenceUnitDescriptor pud = PersistenceUnitDescriptor.class.cast(descriptor); getDescriptor().addPersistenceUnitDescriptor(pud); }
public RootXMLNode getRootXMLNode(Descriptor descriptor) { // This method is called from SaxParserHandler.startElement() method // as well as DeploymentDescriptorFile.getDefaultSchemaSource(). // When it is called from former method, descriptor is non-null, // but when it is called later method, descriptor is null. if(descriptor==null || descriptor instanceof Application || descriptor instanceof ApplicationClientDescriptor || descriptor instanceof EjbBundleDescriptor || descriptor instanceof WebBundleDescriptor) { return new PersistenceNode(new PersistenceUnitsDescriptor()); } else { throw new IllegalArgumentException(descriptor.getClass().getName()+ "is not allowed to contain persistence.xml file"); } }
getModuleDescriptor().getDescriptor().getExtensionsDescriptors(PersistenceUnitsDescriptor.class)) { for (PersistenceUnitDescriptor nextPU : nextPUs.getPersistenceUnitDescriptors()) { pu = nextPU; totalNumberOfPUInBundle++; getApplication().getExtensionsDescriptors(PersistenceUnitsDescriptor.class)) { for (PersistenceUnitDescriptor nextPU : nextPUs.getPersistenceUnitDescriptors()) { pu = nextPU; totalNumberOfPUInEar++;