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

Since:
1.1
Version:
$Revision: 1.8 $
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(MetaData parent, java.lang.String name, java.lang.String transactionType)
          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.util.HashSet getClassNames()
          Accessor for the class names for this persistence unit.
 java.lang.String getDescription()
          Accessor for the persistence unit description.
 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.
 TransactionType getTransactionType()
          Accessor for the persistence unit transaction type
 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
 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, getExtensions, getNoOfExtensions, getParent, getValueForExtension, getValuesForExtension, hasExtension, initialise, isInitialised, isPopulated, isUsed, removeExtension, setInitialised, setParent, setPopulated, setUsed, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PersistenceUnitMetaData

public PersistenceUnitMetaData(MetaData parent,
                               java.lang.String name,
                               java.lang.String transactionType)
Constructor.

Parameters:
parent - MetaData of parent element
name - Name of the persistence unit
transactionType - Transaction type for this unit
Method Detail

getName

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

Returns:
Name of the persistence unit

getTransactionType

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

Returns:
Transaction type for the persistence unit

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

setExcludeUnlistedClasses

public void setExcludeUnlistedClasses()
Method 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 © 2009. All Rights Reserved.