org.apache.openjpa.persistence
Class PersistenceUnitInfoImpl

java.lang.Object
  extended by org.apache.openjpa.persistence.PersistenceUnitInfoImpl
All Implemented Interfaces:
PersistenceUnitInfo, SourceTracker

public class PersistenceUnitInfoImpl
extends Object
implements PersistenceUnitInfo, SourceTracker

Implementation of the PersistenceUnitInfo interface used by OpenJPA when parsing persistence configuration information.


Nested Class Summary
static class PersistenceUnitInfoImpl.ClassResolverImpl
          Simple class resolver built around the persistence unit loader.
 
Field Summary
static String PERSISTENCE_VERSION
           
 
Fields inherited from interface org.apache.openjpa.lib.meta.SourceTracker
SRC_ANNOTATIONS, SRC_OTHER, SRC_XML
 
Constructor Summary
PersistenceUnitInfoImpl()
           
 
Method Summary
 void addJarFile(URL jar)
           
 void addJarFileName(String name)
           
 void addManagedClassName(String name)
           
 void addMappingFileName(String name)
           
 void addTransformer(ClassTransformer transformer)
           
 boolean excludeUnlistedClasses()
           
 void fromUserProperties(Map map)
          Load the given user-supplied map of properties into this persistence unit.
 ClassLoader getClassLoader()
           
 int getColNumber()
          Return the column number in the line of the file at which this instance was parsed.
 List<URL> getJarFileUrls()
           
 DataSource getJtaDataSource()
           
 String getJtaDataSourceName()
           
 int getLineNumber()
          Return the line number of the file at which this instance was parsed.
 List<String> getManagedClassNames()
           
 List<String> getMappingFileNames()
           
 ClassLoader getNewTempClassLoader()
           
 DataSource getNonJtaDataSource()
           
 String getNonJtaDataSourceName()
           
 String getPersistenceProviderClassName()
           
 String getPersistenceUnitName()
           
 URL getPersistenceUnitRootUrl()
           
 URL getPersistenceXmlFileUrl()
          The location of the persistence.xml resource.
 String getPersistenceXMLSchemaVersion()
           
 Properties getProperties()
           
 String getResourceName()
          Return the domain-meaningful name of the resource that was loaded from this source.
 SharedCacheMode getSharedCacheMode()
           
 File getSourceFile()
          Return the file from which this instance was parsed.
 Object getSourceScope()
          Return the domain-dependent scope of this instance within its file.
 int getSourceType()
          Return the type of source.
 PersistenceUnitTransactionType getTransactionType()
           
 ValidationMode getValidationMode()
           
 void setExcludeUnlistedClasses(boolean excludeUnlisted)
           
 void setJtaDataSource(DataSource ds)
           
 void setJtaDataSourceName(String jta)
           
 void setNonJtaDataSource(DataSource ds)
           
 void setNonJtaDataSourceName(String nonJta)
           
 void setPersistenceProviderClassName(String providerClassName)
           
 void setPersistenceUnitName(String emName)
           
 void setPersistenceUnitRootUrl(URL root)
           
 void setPersistenceXmlFileUrl(URL url)
          The location of the persistence.xml resource.
 void setPersistenceXMLSchemaVersion(String version)
           
 void setProperty(String key, String value)
           
 void setSharedCacheMode(SharedCacheMode mode)
           
 void setTransactionType(PersistenceUnitTransactionType transType)
           
 void setValidationMode(ValidationMode mode)
           
 Map toOpenJPAProperties()
          Return a Map containing the properties necessary to create a Configuration that reflects the information in this persistence unit info.
static Map toOpenJPAProperties(PersistenceUnitInfo info)
          Return a Map containing the properties necessary to create a Configuration that reflects the information in the given persistence unit info.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PERSISTENCE_VERSION

public static final String PERSISTENCE_VERSION
See Also:
Constant Field Values
Constructor Detail

PersistenceUnitInfoImpl

public PersistenceUnitInfoImpl()
Method Detail

getClassLoader

public ClassLoader getClassLoader()
Specified by:
getClassLoader in interface PersistenceUnitInfo

getNewTempClassLoader

public ClassLoader getNewTempClassLoader()
Specified by:
getNewTempClassLoader in interface PersistenceUnitInfo

getPersistenceUnitName

public String getPersistenceUnitName()
Specified by:
getPersistenceUnitName in interface PersistenceUnitInfo

setPersistenceUnitName

public void setPersistenceUnitName(String emName)

getPersistenceProviderClassName

public String getPersistenceProviderClassName()
Specified by:
getPersistenceProviderClassName in interface PersistenceUnitInfo

setPersistenceProviderClassName

public void setPersistenceProviderClassName(String providerClassName)

getTransactionType

public PersistenceUnitTransactionType getTransactionType()
Specified by:
getTransactionType in interface PersistenceUnitInfo

setTransactionType

public void setTransactionType(PersistenceUnitTransactionType transType)

getJtaDataSourceName

public String getJtaDataSourceName()

setJtaDataSourceName

public void setJtaDataSourceName(String jta)

getJtaDataSource

public DataSource getJtaDataSource()
Specified by:
getJtaDataSource in interface PersistenceUnitInfo

setJtaDataSource

public void setJtaDataSource(DataSource ds)

getNonJtaDataSourceName

public String getNonJtaDataSourceName()

setNonJtaDataSourceName

public void setNonJtaDataSourceName(String nonJta)

getNonJtaDataSource

public DataSource getNonJtaDataSource()
Specified by:
getNonJtaDataSource in interface PersistenceUnitInfo

setNonJtaDataSource

public void setNonJtaDataSource(DataSource ds)

getPersistenceUnitRootUrl

public URL getPersistenceUnitRootUrl()
Specified by:
getPersistenceUnitRootUrl in interface PersistenceUnitInfo

setPersistenceUnitRootUrl

public void setPersistenceUnitRootUrl(URL root)

excludeUnlistedClasses

public boolean excludeUnlistedClasses()
Specified by:
excludeUnlistedClasses in interface PersistenceUnitInfo

setExcludeUnlistedClasses

public void setExcludeUnlistedClasses(boolean excludeUnlisted)

getMappingFileNames

public List<String> getMappingFileNames()
Specified by:
getMappingFileNames in interface PersistenceUnitInfo

addMappingFileName

public void addMappingFileName(String name)

getJarFileUrls

public List<URL> getJarFileUrls()
Specified by:
getJarFileUrls in interface PersistenceUnitInfo

addJarFile

public void addJarFile(URL jar)

addJarFileName

public void addJarFileName(String name)

getManagedClassNames

public List<String> getManagedClassNames()
Specified by:
getManagedClassNames in interface PersistenceUnitInfo

addManagedClassName

public void addManagedClassName(String name)

getProperties

public Properties getProperties()
Specified by:
getProperties in interface PersistenceUnitInfo

setProperty

public void setProperty(String key,
                        String value)

addTransformer

public void addTransformer(ClassTransformer transformer)
Specified by:
addTransformer in interface PersistenceUnitInfo

getPersistenceXmlFileUrl

public URL getPersistenceXmlFileUrl()
The location of the persistence.xml resource. May be null.


setPersistenceXmlFileUrl

public void setPersistenceXmlFileUrl(URL url)
The location of the persistence.xml resource. May be null.


fromUserProperties

public void fromUserProperties(Map map)
Load the given user-supplied map of properties into this persistence unit.


toOpenJPAProperties

public Map toOpenJPAProperties()
Return a Map containing the properties necessary to create a Configuration that reflects the information in this persistence unit info.


toOpenJPAProperties

public static Map toOpenJPAProperties(PersistenceUnitInfo info)
Return a Map containing the properties necessary to create a Configuration that reflects the information in the given persistence unit info.


getSourceFile

public File getSourceFile()
Description copied from interface: SourceTracker
Return the file from which this instance was parsed.

Specified by:
getSourceFile in interface SourceTracker

getSourceScope

public Object getSourceScope()
Description copied from interface: SourceTracker
Return the domain-dependent scope of this instance within its file.

Specified by:
getSourceScope in interface SourceTracker

getSourceType

public int getSourceType()
Description copied from interface: SourceTracker
Return the type of source.

Specified by:
getSourceType in interface SourceTracker

getLineNumber

public int getLineNumber()
Description copied from interface: SourceTracker
Return the line number of the file at which this instance was parsed.

Specified by:
getLineNumber in interface SourceTracker

getColNumber

public int getColNumber()
Description copied from interface: SourceTracker
Return the column number in the line of the file at which this instance was parsed.

Specified by:
getColNumber in interface SourceTracker

getResourceName

public String getResourceName()
Description copied from interface: SourceTracker
Return the domain-meaningful name of the resource that was loaded from this source. I.e., if we had loaded the source for a Java class, this would return the name of the class.

Specified by:
getResourceName in interface SourceTracker

getPersistenceXMLSchemaVersion

public String getPersistenceXMLSchemaVersion()
Specified by:
getPersistenceXMLSchemaVersion in interface PersistenceUnitInfo

setPersistenceXMLSchemaVersion

public void setPersistenceXMLSchemaVersion(String version)

getValidationMode

public ValidationMode getValidationMode()
Specified by:
getValidationMode in interface PersistenceUnitInfo

setValidationMode

public void setValidationMode(ValidationMode mode)

getSharedCacheMode

public SharedCacheMode getSharedCacheMode()
Specified by:
getSharedCacheMode in interface PersistenceUnitInfo

setSharedCacheMode

public void setSharedCacheMode(SharedCacheMode mode)


Copyright © 2006-2010 Apache Software Foundation. All Rights Reserved.