Class PropertiesHandler
- java.lang.Object
-
- org.eclipse.persistence.internal.sessions.PropertiesHandler
-
public class PropertiesHandler extends java.lang.ObjectThe class processes some of EclipseLink properties. The class may be used for any properties, but it only makes sense to use it in the following two cases: 1. There is a set of legal values defined either requiring translation (like CacheTypeProp); or not (like LoggingLevelProp). 2. Property is really a prefix from which the property obtained by appending entity or class name (like DescriptorCustomizerProp - it corresponds to "eclipselink.descriptor.customizer." prefix that allows to define properties like "eclipselink.descriptor.customizer.myPackage.MyClass"). EclipseLink properties and their values defined in org.eclipse.persistence.config package. To add a new property: Define a new property in PersistenceUnitProperties; Add a class containing property's values if required to config package (like CacheType); Alternatively values may be already defined elsewhere (like in LoggingLevelProp). Add an inner class to this class extending Prop corresponding to the new property (like CacheTypeProp); The first constructor parameter is property name; the second is default value; In constructor provide 2-dimensional value array in case the values should be translated (like CacheTypeProp); in case translation is not required provide a single-dimension array (like LoggingLevelProp). In inner class Prop static initializer addProp an instance of the new prop class (like addProp(new CacheTypeProp())).- See Also:
PersistenceUnitProperties,CacheType,TargetDatabase,05/28/2008-1.0M8 Andrei Ilitchev. - 224964: Provide support for Proxy Authentication through JPA. Added support for CONNECTION_EXCLUSIVE. Also added BooleanProp to allow simpler way of creating boolean-valued properties: instead of defining a new class for each new Boolean property just add a new instance of BooleanProp with property name and default: addProp(new BooleanProp(PersistenceUnitProperties.CONNECTION_EXCLUSIVE, "false")); Changed the existing boolean-valued properties to use this approach, also applied the same approach to LOGGING_LEVEL and CATEGORY_LOGGING_LEVEL_ Also introduced a new version of getSessionPropertyValue that takes properties: public static String getSessionPropertyValue(String name, Map m, AbstractSession session) { it's convenient for use in EntityManagerImpl: first searches the passed properties then (recursively) properties of the session, then System properties.
-
-
Nested Class Summary
-
Constructor Summary
Constructors Constructor Description PropertiesHandler()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringgetDefaultPropertyValue(java.lang.String name)INTERNAL: Returns the default property value that should be applied.static java.lang.StringgetDefaultPropertyValueLogDebug(java.lang.String name, AbstractSession session)static java.lang.StringgetPrefixedPropertyValue(java.lang.String prefix, java.lang.String suffix, java.util.Map m)INTERNAL: Gets property value from the map, if none found looks in System properties.static java.util.MapgetPrefixValues(java.lang.String prefix, java.util.Map m)INTERNAL: Gets properties' values from the map, if none found looks in System properties.static java.util.MapgetPrefixValuesLogDebug(java.lang.String prefix, java.util.Map m, AbstractSession session)static java.lang.StringgetPropertyValue(java.lang.String name, java.lang.String value)INTERNAL: Given property name and value verifies and translates the value.static java.lang.StringgetPropertyValue(java.lang.String name, java.util.Map m)INTERNAL: Gets property value from the map, if none found looks in System properties.static java.lang.StringgetPropertyValue(java.lang.String name, java.util.Map m, boolean useSystemAsDefault)static java.lang.StringgetPropertyValueLogDebug(java.lang.String name, java.lang.String value, AbstractSession session)static java.lang.StringgetPropertyValueLogDebug(java.lang.String name, java.util.Map m, AbstractSession session)static java.lang.StringgetPropertyValueLogDebug(java.lang.String name, java.util.Map m, AbstractSession session, boolean useSystemAsDefault)protected static booleanshouldUseDefault(java.lang.String value)INTERNAL: Empty String value indicates that the default property value should be used.
-
-
-
Method Detail
-
getPropertyValue
public static java.lang.String getPropertyValue(java.lang.String name, java.util.Map m)INTERNAL: Gets property value from the map, if none found looks in System properties. Use this to get a value for a non-prefixed property. Could be used on prefixes (like "org.eclipse.persistence.cache-type.") too, but will always return null Throws IllegalArgumentException in case the property value is illegal.
-
getPropertyValueLogDebug
public static java.lang.String getPropertyValueLogDebug(java.lang.String name, java.util.Map m, AbstractSession session)
-
getPropertyValue
public static java.lang.String getPropertyValue(java.lang.String name, java.util.Map m, boolean useSystemAsDefault)
-
getPropertyValueLogDebug
public static java.lang.String getPropertyValueLogDebug(java.lang.String name, java.util.Map m, AbstractSession session, boolean useSystemAsDefault)
-
getPropertyValue
public static java.lang.String getPropertyValue(java.lang.String name, java.lang.String value)INTERNAL: Given property name and value verifies and translates the value. Throws IllegalArgumentException in case the property value is illegal.
-
getPropertyValueLogDebug
public static java.lang.String getPropertyValueLogDebug(java.lang.String name, java.lang.String value, AbstractSession session)
-
getPrefixedPropertyValue
public static java.lang.String getPrefixedPropertyValue(java.lang.String prefix, java.lang.String suffix, java.util.Map m)INTERNAL: Gets property value from the map, if none found looks in System properties. Use this to get a value for a prefixed property: for "org.eclipse.persistence.cache-type.Employee" pass "org.eclipse.persistence.cache-type.", "Employee". Throws IllegalArgumentException in case the property value is illegal.
-
getPrefixValues
public static java.util.Map getPrefixValues(java.lang.String prefix, java.util.Map m)INTERNAL: Gets properties' values from the map, if none found looks in System properties. In the returned map values keyed by suffixes. Use it with prefixes (like "org.eclipse.persistence.cache-type."). Could be used on simple properties (not prefixes, too), but will always return either an empty map or a map containing a single value keyed by an empty String. Throws IllegalArgumentException in case the property value is illegal.
-
getPrefixValuesLogDebug
public static java.util.Map getPrefixValuesLogDebug(java.lang.String prefix, java.util.Map m, AbstractSession session)
-
getDefaultPropertyValue
public static java.lang.String getDefaultPropertyValue(java.lang.String name)
INTERNAL: Returns the default property value that should be applied. Throws IllegalArgumentException in case the name doesn't correspond to any property.
-
getDefaultPropertyValueLogDebug
public static java.lang.String getDefaultPropertyValueLogDebug(java.lang.String name, AbstractSession session)
-
shouldUseDefault
protected static boolean shouldUseDefault(java.lang.String value)
INTERNAL: Empty String value indicates that the default property value should be used.
-
-