Package org.apache.openjpa.lib.conf
Class Configurations
java.lang.Object
org.apache.openjpa.lib.conf.Configurations
Utility methods dealing with configuration.
- Author:
- Abe White
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcombinePlugins(String orig, String override) Return a plugin string that combines the properties of the given plugin strings, where properties ofoverridewill override the same properties oforig.static voidconfigureInstance(Object obj, Configuration conf, String properties) Configures the given object with the given properties by matching the properties string to the object's setter methods.static voidconfigureInstance(Object obj, Configuration conf, String properties, String configurationName) Configures the given object with the given properties by matching the properties string to the object's setter methods.static voidconfigureInstance(Object obj, Configuration conf, Properties properties) Configures the given object with the given properties by matching the properties string to the object's setter methods.static voidconfigureInstance(Object obj, Configuration conf, Properties properties, String configurationName) Configures the given object with the given properties by matching the properties string to the object's setter methods.static booleancontainsProperty(String partialKey, Map props) Test whether the map contains the given partial key, prefixed with any possible configuration prefix.static booleancontainsProperty(Value value, Map props) Test whether the map contains the given partial key, prefixed with any possible configuration prefix.static StringgetClassName(String plugin) Return the class name from the given plugin string, or null if none.Return a Listof all the fully-qualified anchors specified in the properties location listed in opts.static StringCombine the given class name and properties into a plugin string.static StringgetProperties(String plugin) Return the properties part of the given plugin string, or null if none.static ObjectgetProperty(String partialKey, Map m) Get the property under the given partial key, prefixed with any possible configuration prefix.static ObjectLooks up the given name in JNDI.static ObjectnewInstance(String clsName, ClassLoader loader) Create the instance with the given class name, using the given class loader.static ObjectnewInstance(String clsName, Configuration conf, String props, ClassLoader loader) Create and configure an instance with the given class name and properties as a String.static ObjectnewInstance(String clsName, Configuration conf, Properties props, ClassLoader loader) Create and configure an instance with the given class name and properties.parseConfigResource(String props) static OptionsparseProperties(String properties) Parse a set of properties from a comma-separated string.static voidpopulateConfiguration(Configuration conf, Options opts) Set the givenConfigurationinstance from the command line options provided.static ObjectremoveProperty(String partialKey, Map props) Remove the property under the given partial key, prefixed with any possible configuration prefix.static voidremoveProperty(String partialKey, Map<?, ?> remaining, Map<?, ?> props) static booleanrunAgainstAllAnchors(Options opts, Configurations.Runnable runnable) Runsrunnableagainst all the anchors in the configuration pointed to byopts.static StringserializeProperties(Map map) Turn a set of properties into a comma-separated string.
-
Field Details
-
CONFIG_RESOURCE_PATH
- See Also:
-
CONFIG_RESOURCE_ANCHOR
- See Also:
-
-
Constructor Details
-
Configurations
public Configurations()
-
-
Method Details
-
getClassName
Return the class name from the given plugin string, or null if none. -
getProperties
Return the properties part of the given plugin string, or null if none. -
getPlugin
Combine the given class name and properties into a plugin string. -
combinePlugins
Return a plugin string that combines the properties of the given plugin strings, where properties ofoverridewill override the same properties oforig. -
newInstance
Create the instance with the given class name, using the given class loader. No configuration of the instance is performed by this method. -
newInstance
public static Object newInstance(String clsName, Configuration conf, String props, ClassLoader loader) Create and configure an instance with the given class name and properties as a String. -
newInstance
public static Object newInstance(String clsName, Configuration conf, Properties props, ClassLoader loader) Create and configure an instance with the given class name and properties. -
getFullyQualifiedAnchorsInPropertiesLocation
Return a Listof all the fully-qualified anchors specified in the properties location listed in opts. If no properties location is listed inopts, this returns whatever the product derivations can find in their default configurations. If the properties location specified inoptsalready contains an anchor spec, this returns that anchor. Note that in this fully-qualified-input case, the logic involving product derivations and resource parsing is short-circuited, so this method should not be used as a means to test that a particular anchor is defined in a given location by invoking with a fully-qualified anchor. This does not mutateopts.- Since:
- 1.1.0
-
populateConfiguration
Set the givenConfigurationinstance from the command line options provided. All property names of the given configuration are recognized; additionally, if apropertiesorpargument exists, the resource it points to will be loaded and set into the given configuration instance. It can point to either a file or a resource name. -
parseConfigResource
-
configureInstance
Configures the given object with the given properties by matching the properties string to the object's setter methods. The properties string should be in the form "prop1=val1, prop2=val2 ...". Does not validate that setter methods exist for the properties.- Throws:
RuntimeException- on configuration error
-
configureInstance
public static void configureInstance(Object obj, Configuration conf, String properties, String configurationName) Configures the given object with the given properties by matching the properties string to the object's setter methods. The properties string should be in the form "prop1=val1, prop2=val2 ...". Validates that setter methods exist for the properties.- Throws:
RuntimeException- on configuration error
-
configureInstance
Configures the given object with the given properties by matching the properties string to the object's setter methods. Does not validate that setter methods exist for the properties.- Throws:
RuntimeException- on configuration error
-
configureInstance
public static void configureInstance(Object obj, Configuration conf, Properties properties, String configurationName) Configures the given object with the given properties by matching the properties string to the object's setter methods. IfconfigurationNameis non-null, validates that setter methods exist for the properties.- Throws:
RuntimeException- on configuration error
-
serializeProperties
Turn a set of properties into a comma-separated string. -
parseProperties
Parse a set of properties from a comma-separated string. -
lookup
Looks up the given name in JNDI. If the name is null, null is returned. -
containsProperty
Test whether the map contains the given partial key, prefixed with any possible configuration prefix. -
containsProperty
Test whether the map contains the given partial key, prefixed with any possible configuration prefix. -
getProperty
Get the property under the given partial key, prefixed with any possible configuration prefix. -
removeProperty
Remove the property under the given partial key, prefixed with any possible configuration prefix. -
removeProperty
-
runAgainstAllAnchors
Runsrunnableagainst all the anchors in the configuration pointed to byopts. Each invocation gets a fresh clone ofoptswith thepropertiesoption set appropriately.- Since:
- 1.1.0
-