FileDocCategorySizeDatePackage
PersistenceUnitsDescriptor.javaAPI DocGlassfish v2 API5493Thu Jul 19 11:27:46 BST 2007com.sun.enterprise.deployment

PersistenceUnitsDescriptor

public class PersistenceUnitsDescriptor extends RootDeploymentDescriptor
This descriptor represents contents for one persistence.xml file.
author
Sanjeeb.Sahoo@Sun.COM

Fields Summary
private RootDeploymentDescriptor
parent
the parent descriptor that contains this descriptor
private String
puRoot
The relative path from the parent {@link RootDeploymentDescriptor} to the root of this persistence unit. e.g. WEB-INF/classes -- if persistence.xml is in WEB-INF/classes/META-INF, WEB-INF/lib/foo.jar -- if persistence.xml is in WEB-INF/lib/foo.jar/META-INF, "" -- if persistence.xml is in some ejb.jar, or util/bar.jar -- if persistence.xml is in a.ear/util/bar.jar
List
persistenceUnitDescriptors
private static final String
JPA_1_0
Constructors Summary
public PersistenceUnitsDescriptor()


      
    
Methods Summary
public voidaddPersistenceUnitDescriptor(PersistenceUnitDescriptor pud)
This method does not do any validation like checking for unique names of PersistenceUnits.

param
pud the PersistenceUnitDescriptor to be added.

        persistenceUnitDescriptors.add(pud);
        pud.setParent(this);
    
public java.lang.StringgetAbsolutePuRoot()
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()

        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 java.lang.ClassLoadergetClassLoader()

        return parent.getClassLoader();
    
public java.lang.StringgetDefaultSpecVersion()

        return JPA_1_0;
    
public java.lang.StringgetModuleID()

        throw new RuntimeException();
    
public javax.enterprise.deploy.shared.ModuleTypegetModuleType()

        throw new RuntimeException();
    
public RootDeploymentDescriptorgetParent()

        return parent;
    
public java.util.ListgetPersistenceUnitDescriptors()

return
an unmodifiable list.

        return Collections.unmodifiableList(persistenceUnitDescriptors);
    
public java.lang.StringgetPuRoot()

        return puRoot;
    
public booleanisApplication()

        return false;
    
public voidsetParent(RootDeploymentDescriptor parent)

        this.parent = parent;
    
public voidsetPuRoot(java.lang.String puRoot)

        this.puRoot = puRoot;