org.datanucleus.metadata
Class PersistenceUnitMetaData

java.lang.Object
  extended by org.datanucleus.metadata.MetaData
      extended by org.datanucleus.metadata.PersistenceUnitMetaData
All Implemented Interfaces:
java.io.Serializable

public class PersistenceUnitMetaData
extends MetaData

MetaData representation of a "persistence.xml" persistence unit. Corresponds to the JPA spec section 6.2.1

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.datanucleus.metadata.MetaData
extensions, LOCALISER, METADATA_CREATED_STATE, METADATA_INITIALISED_STATE, METADATA_POPULATED_STATE, METADATA_USED_STATE, metaDataState, parent, VENDOR_NAME, VENDOR_NAME_OLD
 
Constructor Summary
PersistenceUnitMetaData(java.lang.String name, java.lang.String transactionType, java.net.URI rootURI)
          Constructor.
 
Method Summary
 void addClassName(java.lang.String className)
          Method to add a class name to the persistence unit.
 void addJarFile(java.lang.String jarName)
          Method to add a jar file to the persistence unit.
 void addJarFile(java.net.URL jarURL)
          Method to add a jar file to the persistence unit.
 void addMappingFile(java.lang.String mappingFile)
          Method to add a mapping file to the persistence unit.
 void addProperty(java.lang.String key, java.lang.String value)
          Method to add a vendor property to the persistence unit.
 void clearJarFiles()
          Convenience method to clear out all jar files.
 java.lang.String getCaching()
          Accessor for the persistence unit caching policy.
 java.util.HashSet getClassNames()
          Accessor for the class names for this persistence unit.
 java.lang.String getDescription()
          Accessor for the persistence unit description.
 boolean getExcludeUnlistedClasses()
          Whether we should exclude any unlisted classes from this persistence-unit.
 java.util.HashSet getJarFiles()
          Accessor for the jar files for this persistence unit.
 java.lang.String getJtaDataSource()
          Accessor for the persistence unit JTA data source.
 java.util.HashSet getMappingFiles()
          Accessor for the class names for this persistence unit.
 java.lang.String getName()
          Accessor for the persistence unit name.
 java.lang.String getNonJtaDataSource()
          Accessor for the persistence unit non-JTA data source.
 java.util.Properties getProperties()
          Accessor for the properties for this persistence unit.
 java.lang.String getProvider()
          Accessor for the persistence unit provider.
 java.net.URI getRootURI()
          Accessor for the persistence unit root.
 TransactionType getTransactionType()
          Accessor for the persistence unit transaction type
 java.lang.String getValidationMode()
          Accessor to the Validation Mode
 void setCaching(java.lang.String cache)
          Mutator for the unit caching policy
 void setDescription(java.lang.String desc)
          Mutator for the unit description
 void setExcludeUnlistedClasses()
          Method to exclude unlisted classes
 void setJtaDataSource(java.lang.String data)
          Mutator for the unit JTA data source
 void setNonJtaDataSource(java.lang.String data)
          Mutator for the unit non-JTA data source
 void setProvider(java.lang.String provider)
          Mutator for the unit provider
 void setValidationMode(java.lang.String validationMode)
          Mutator for the validation mode
 java.lang.String toString(java.lang.String prefix, java.lang.String indent)
          Returns a string representation of the object using a prefix This can be used as part of a facility to output a MetaData file.
 
Methods inherited from class org.datanucleus.metadata.MetaData
addExtension, addExtension, assertIfInitialised, getExtensions, getNoOfExtensions, getParent, getValueForExtension, getValuesForExtension, hasExtension, initialise, isInitialised, isPopulated, isUsed, newExtensionMetaData, removeExtension, setParent, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PersistenceUnitMetaData

public PersistenceUnitMetaData(java.lang.String name,
                               java.lang.String transactionType,
                               java.net.URI rootURI)
Constructor.

Parameters:
name - Name of the persistence unit
transactionType - Transaction type for this unit
rootURI - Root of the persistence-unit
Method Detail

getName

public java.lang.String getName()
Accessor for the persistence unit name.

Returns:
Name of the persistence unit

getRootURI

public java.net.URI getRootURI()
Accessor for the persistence unit root.

Returns:
Root of the persistence unit

getTransactionType

public TransactionType getTransactionType()
Accessor for the persistence unit transaction type

Returns:
Transaction type for the persistence unit

getCaching

public java.lang.String getCaching()
Accessor for the persistence unit caching policy.

Returns:
Caching policy: ALL, NONE, ENABLE_SELECTIVE, DISABLE_SELECTIVE, UNSPECIFIED.

setCaching

public void setCaching(java.lang.String cache)
Mutator for the unit caching policy

Parameters:
cache - The caching policy: ALL, NONE, ENABLE_SELECTIVE, DISABLE_SELECTIVE, UNSPECIFIED.

getDescription

public java.lang.String getDescription()
Accessor for the persistence unit description.

Returns:
Description of the persistence unit

setDescription

public void setDescription(java.lang.String desc)
Mutator for the unit description

Parameters:
desc - The description

getProvider

public java.lang.String getProvider()
Accessor for the persistence unit provider.

Returns:
Provider for the persistence unit

setProvider

public void setProvider(java.lang.String provider)
Mutator for the unit provider

Parameters:
provider - The provider

getJtaDataSource

public java.lang.String getJtaDataSource()
Accessor for the persistence unit JTA data source.

Returns:
JTA data source for the persistence unit

setJtaDataSource

public void setJtaDataSource(java.lang.String data)
Mutator for the unit JTA data source

Parameters:
data - The JTA data source

getNonJtaDataSource

public java.lang.String getNonJtaDataSource()
Accessor for the persistence unit non-JTA data source.

Returns:
non-JTA data source for the persistence unit

setNonJtaDataSource

public void setNonJtaDataSource(java.lang.String data)
Mutator for the unit non-JTA data source

Parameters:
data - The non-JTA data source

setValidationMode

public void setValidationMode(java.lang.String validationMode)
Mutator for the validation mode

Parameters:
validationMode - AUTO, CALLBACK or NONE

getValidationMode

public java.lang.String getValidationMode()
Accessor to the Validation Mode

Returns:
AUTO, CALLBACK or NONE

setExcludeUnlistedClasses

public void setExcludeUnlistedClasses()
Method to exclude unlisted classes


getExcludeUnlistedClasses

public boolean getExcludeUnlistedClasses()
Whether we should exclude any unlisted classes from this persistence-unit. If not then the implementation should scan below the root URL for any classes.

Returns:
Whether to exclude unlisted classes.

addClassName

public void addClassName(java.lang.String className)
Method to add a class name to the persistence unit.

Parameters:
className - Name of the class

addJarFile

public void addJarFile(java.lang.String jarName)
Method to add a jar file to the persistence unit.

Parameters:
jarName - Jar file name

addJarFile

public void addJarFile(java.net.URL jarURL)
Method to add a jar file to the persistence unit.

Parameters:
jarURL - Jar file URL

clearJarFiles

public void clearJarFiles()
Convenience method to clear out all jar files.


addMappingFile

public void addMappingFile(java.lang.String mappingFile)
Method to add a mapping file to the persistence unit.

Parameters:
mappingFile - Mapping file name

addProperty

public void addProperty(java.lang.String key,
                        java.lang.String value)
Method to add a vendor property to the persistence unit.

Parameters:
key - Property name
value - Property value

getClassNames

public java.util.HashSet getClassNames()
Accessor for the class names for this persistence unit.

Returns:
The class names

getMappingFiles

public java.util.HashSet getMappingFiles()
Accessor for the class names for this persistence unit.

Returns:
The mapping files

getJarFiles

public java.util.HashSet getJarFiles()
Accessor for the jar files for this persistence unit. The contents of the Set may be Strings (the names) or URLs

Returns:
The jar names

getProperties

public java.util.Properties getProperties()
Accessor for the properties for this persistence unit.

Returns:
The properties

toString

public java.lang.String toString(java.lang.String prefix,
                                 java.lang.String indent)
Returns a string representation of the object using a prefix This can be used as part of a facility to output a MetaData file.

Overrides:
toString in class MetaData
Parameters:
prefix - prefix string
indent - indent string
Returns:
a string representation of the object.


Copyright © 2011. All Rights Reserved.