org.opencms.configuration
Class CmsPersistenceUnitConfiguration

java.lang.Object
  extended by org.opencms.configuration.CmsPersistenceUnitConfiguration

public class CmsPersistenceUnitConfiguration
extends java.lang.Object

Persistence configuration class.

This class allow to be managed (reading and writing) JPA persistence.xml configuration file.

Since:
8.0.0

Field Summary
static java.lang.String ATTR_CONNECTION_PROPERTIES
          Attribute name for connection settings for Apache OpenJPA & DBCP.
static java.lang.String ATTR_GENERATE_SCHEMA
          Attribute name for connection settings.
static java.lang.String ATTR_GENERATE_SCHEMA_VALUE
          Attribute name for connection settings.
static java.lang.String ATTR_NAME
          Attribute name for attribute "name" of property.
static java.lang.String ATTR_VALUE
          Attribute name for attribute "value" of property.
static java.lang.String TAG_PERSISTENCE_UNIT
          Tag constant.
static java.lang.String TAG_PROPERTIES
          Tag constant.
static java.lang.String TAG_PROPERTY
          Tag constant.
 
Constructor Summary
CmsPersistenceUnitConfiguration(java.lang.String unitName, java.lang.String fileName)
          Public constructor which initialize the object.
 
Method Summary
 java.lang.String getPropertyValue(java.lang.String name, java.lang.String defaultValue)
          Returns a property value for the given property name.
 void removeProperty(java.lang.String name)
          Removes property with given name.
 void save()
          Saves the original configuration file.
 void setPropertyValue(java.lang.String name, java.lang.String value)
          Sets property value with given name and value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATTR_CONNECTION_PROPERTIES

public static final java.lang.String ATTR_CONNECTION_PROPERTIES
Attribute name for connection settings for Apache OpenJPA & DBCP.

See Also:
Constant Field Values

ATTR_GENERATE_SCHEMA

public static final java.lang.String ATTR_GENERATE_SCHEMA
Attribute name for connection settings.

See Also:
Constant Field Values

ATTR_GENERATE_SCHEMA_VALUE

public static final java.lang.String ATTR_GENERATE_SCHEMA_VALUE
Attribute name for connection settings.

See Also:
Constant Field Values

ATTR_NAME

public static final java.lang.String ATTR_NAME
Attribute name for attribute "name" of property.

See Also:
Constant Field Values

ATTR_VALUE

public static final java.lang.String ATTR_VALUE
Attribute name for attribute "value" of property.

See Also:
Constant Field Values

TAG_PERSISTENCE_UNIT

public static final java.lang.String TAG_PERSISTENCE_UNIT
Tag constant.

See Also:
Constant Field Values

TAG_PROPERTIES

public static final java.lang.String TAG_PROPERTIES
Tag constant.

See Also:
Constant Field Values

TAG_PROPERTY

public static final java.lang.String TAG_PROPERTY
Tag constant.

See Also:
Constant Field Values
Constructor Detail

CmsPersistenceUnitConfiguration

public CmsPersistenceUnitConfiguration(java.lang.String unitName,
                                       java.lang.String fileName)
Public constructor which initialize the object.

Parameters:
unitName - persistence unit name to be managed
fileName - configuration file name
Method Detail

getPropertyValue

public java.lang.String getPropertyValue(java.lang.String name,
                                         java.lang.String defaultValue)
Returns a property value for the given property name.

Parameters:
name - the name of the property
defaultValue - the default value if there was no property configured with the given name
Returns:
a property value for the given property name

removeProperty

public void removeProperty(java.lang.String name)
Removes property with given name.

Parameters:
name - value of the name attribute

save

public void save()
Saves the original configuration file.


setPropertyValue

public void setPropertyValue(java.lang.String name,
                             java.lang.String value)
Sets property value with given name and value.

Parameters:
name - value of the name attribute
value - value of the value attribute