FileDocCategorySizeDatePackage
SEPersistenceUnitInfo.javaAPI DocGlassfish v2 API11436Tue May 22 16:54:18 BST 2007oracle.toplink.essentials.ejb.cmp3.persistence

SEPersistenceUnitInfo

public class SEPersistenceUnitInfo extends Object implements PersistenceUnitInfo
Internal implementation of the PersistenceUnitInfo detailed in the EJB 3.0 specification Used by our Java SE implementation so common method calls can be used in setting of Container and non-Container EntityManagerFactories.

Fields Summary
protected String
persistenceUnitName
protected String
persistenceProviderClassName
protected DataSource
jtaDataSource
protected DataSource
nonJtaDataSource
protected PersistenceUnitTransactionType
persistenceUnitTransactionType
protected List
mappingFiles
private Collection
jarFiles
protected List
jarFileUrls
protected List
managedClassNames
protected URL
persistenceUnitRootUrl
protected boolean
excludeUnlistedClasses
protected Properties
properties
protected ClassLoader
tempClassLoader
protected ClassLoader
realClassLoader
Constructors Summary
public SEPersistenceUnitInfo()


     
        mappingFiles = new ArrayList<String>();
        managedClassNames = new ArrayList<String>();
        properties = new Properties();
        persistenceUnitTransactionType = PersistenceUnitTransactionType.RESOURCE_LOCAL;
        // don't initialize jarFileUrls as it is lazily initialized
    
Methods Summary
public voidaddTransformer(javax.persistence.spi.ClassTransformer transformer)
Add a transformer supplied by the provider that will be called for every new class definition or class redefinition that gets loaded by the loader returned by the PersistenceUnitInfo.getClassLoader method. The transformer has no effect on the result returned by the PersistenceUnitInfo.getNewTempClassLoader method. Classes are only transformed once within the same classloading scope, regardless of how many persistence units they may be a part of.

param
transformer A provider-supplied transformer that the Container invokes at class-(re)definition time

        // not required for our Java SE implementation
    
public booleanexcludeUnlistedClasses()

return
Whether classes in the root of the persistence unit that have not been explicitly listed are to be included in the set of managed classes. This value corresponds to the element in the persistence.xml file.

        return excludeUnlistedClasses; 
    
public java.lang.ClassLoadergetClassLoader()

return
ClassLoader that the provider may use to load any classes, resources, or open URLs.

        return realClassLoader;
    
public java.util.ListgetJarFileUrls()

return
The list of JAR file URLs that the persistence provider must examine for managed classes of the persistence unit. Each jar file URL corresponds to a named element in the persistence.xml file.

        if (jarFileUrls == null) { // lazy initialization
            List<URL> jarFileUrls = new ArrayList<URL>(jarFiles.size());
            for (String jarFile : jarFiles) {
                try {
                    // build a URL relative to the PU Root
                    URL jarFileURL = new URL(persistenceUnitRootUrl, jarFile);
                    jarFileUrls.add(jarFileURL);
                } catch (MalformedURLException e) {
                    throw new RuntimeException(e);
                }
            }
            synchronized(this) {
                this.jarFileUrls = jarFileUrls;
            }
        }
        return Collections.unmodifiableList(jarFileUrls);
    
public java.util.CollectiongetJarFiles()

        return jarFiles;
    
public javax.sql.DataSourcegetJtaDataSource()

return
the JTA-enabled data source to be used by the persistence provider. The data source corresponds to the element in the persistence.xml file or is provided at deployment or by the container.

        return jtaDataSource;
    
public java.util.ListgetManagedClassNames()

return
The list of the names of the classes that the persistence provider must add it to its set of managed classes. Each name corresponds to a named element in the persistence.xml file.

        return managedClassNames;
    
public java.util.ListgetMappingFileNames()

return
The list of mapping file names that the persistence provider must load to determine the mappings for the entity classes. The mapping files must be in the standard XML mapping format, be uniquely named and be resource-loadable from the application classpath. This list will not include the orm.xml file if one was specified. Each mapping file name corresponds to a element in the persistence.xml file.

        return mappingFiles;
    
public java.lang.ClassLoadergetNewTempClassLoader()
Return a ClassLoader that the provider may use to temporarily load any classes, resources, or open URLs. The scope and classpath of this loader is exactly the same as that of the loader returned by PersistenceUnitInfo.getClassLoader. None of the classes loaded by this class loader will be visible to application components.

return
Temporary ClassLoader with same visibility as current loader

        return tempClassLoader;
    
public javax.sql.DataSourcegetNonJtaDataSource()

return
The non-JTA-enabled data source to be used by the persistence provider for accessing data outside a JTA transaction. The data source corresponds to the named element in the persistence.xml file or provided at deployment or by the container.

        return nonJtaDataSource;
    
public java.lang.StringgetPersistenceProviderClassName()

return
The fully qualified name of the persistence provider implementation class. Corresponds to the element in the persistence.xml file.

        return persistenceProviderClassName;
    
public java.lang.StringgetPersistenceUnitName()

return
The name of the persistence unit. Corresponds to the element in the persistence.xml file.

        return persistenceUnitName;
    
public java.net.URLgetPersistenceUnitRootUrl()

return
The URL for the jar file that is the root of the persistence unit. If the persistence unit is rooted in the WEB-INF/classes directory, this will be the URL of that directory.

        return persistenceUnitRootUrl;
    
public java.util.PropertiesgetProperties()

return
Properties object. Each property corresponds to a element in the persistence.xml file

        return properties;
    
public javax.persistence.spi.PersistenceUnitTransactionTypegetTransactionType()

return
The transaction type of the entity managers created by the EntityManagerFactory. The transaction type corresponds to the transaction-type attribute in the persistence.xml file.

        return persistenceUnitTransactionType;
    
public voidsetClassLoader(java.lang.ClassLoader loader)

        this.realClassLoader = loader;
    
public voidsetExcludeUnlistedClasses(boolean excludeUnlistedClasses)

        this.excludeUnlistedClasses = excludeUnlistedClasses;
    
public voidsetJarFileUrls(java.util.List jarFileUrls)

        this.jarFileUrls = jarFileUrls;
    
public voidsetJtaDataSource(javax.sql.DataSource jtaDataSource)

        this.jtaDataSource = jtaDataSource;
    
public voidsetManagedClassNames(java.util.List managedClassNames)

        this.managedClassNames = managedClassNames;
    
public voidsetMappingFileNames(java.util.List mappingFiles)

        this.mappingFiles = mappingFiles;
    
public voidsetNewTempClassLoader(java.lang.ClassLoader loader)

        this.tempClassLoader = loader;
    
public voidsetNonJtaDataSource(javax.sql.DataSource nonJtaDataSource)

        this.nonJtaDataSource = nonJtaDataSource;
    
public voidsetPersistenceProviderClassName(java.lang.String persistenceProviderClassName)

        this.persistenceProviderClassName = persistenceProviderClassName;
    
public voidsetPersistenceUnitName(java.lang.String persistenceUnitName)

        this.persistenceUnitName = persistenceUnitName;
    
public voidsetPersistenceUnitRootUrl(java.net.URL persistenceUnitRootUrl)

        this.persistenceUnitRootUrl = persistenceUnitRootUrl;
    
public voidsetProperties(java.util.Properties properties)

        this.properties = properties;
    
public voidsetTransactionType(javax.persistence.spi.PersistenceUnitTransactionType persistenceUnitTransactionType)

        this.persistenceUnitTransactionType = persistenceUnitTransactionType;