Class ResourceConverter
- java.lang.Object
-
- org.codehaus.cargo.container.property.ResourceConverter
-
public class ResourceConverter extends Object
A Resource is a representation of an object bound to JNDI. This converter will take a property and convert it to a Resource and visa versa.
-
-
Constructor Summary
Constructors Constructor Description ResourceConverter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static String
createIdFromJndiLocation(String jndiLocation)
Get a string name for the configuration of this resource.Resource
fromProperties(Properties properties)
Construct a Resource from a list of properties.Resource
fromPropertyString(String resourceInformation)
Construct a Resource from a single String.String
getParametersAsASemicolonDelimitedString(Resource data)
tests to see if the value is null before attempting to join the database properties on a semicolon.Properties
toProperties(Resource data)
Get a properties object containing all of the members of this Resource object.String
toPropertyString(Resource data)
Get a string representation of this Resource.
-
-
-
Method Detail
-
fromPropertyString
public Resource fromPropertyString(String resourceInformation)
Construct a Resource from a single String. Note that parameters can be nested as long as they are semicolon delimited Example:CreateDatabase=create;DatabaseName=TEST
.- Parameters:
resourceInformation
- A string, really a list of properties, representing a Resource- Returns:
- Resource representing the string.
- See Also:
PropertyUtils.splitPropertiesOnPipe(String)
-
fromProperties
public Resource fromProperties(Properties properties)
Construct a Resource from a list of properties.- Parameters:
properties
- A list of properties representing this Resource- Returns:
- Resource representing the properties.
- See Also:
PropertyUtils.splitPropertiesOnPipe(String)
-
toPropertyString
public String toPropertyString(Resource data)
Get a string representation of this Resource.- Parameters:
data
- the Resource we are serializing- Returns:
- a string representation
-
toProperties
public Properties toProperties(Resource data)
Get a properties object containing all of the members of this Resource object. Note that driver properties will be nested and delimited by a semicolon.- Parameters:
data
- the Resource we are serializing- Returns:
- a properties object corresponding to this Resource
-
getParametersAsASemicolonDelimitedString
public String getParametersAsASemicolonDelimitedString(Resource data)
tests to see if the value is null before attempting to join the database properties on a semicolon.- Parameters:
data
- the Resource we are serializing- Returns:
- property string delimited by semicolon, or null, if they cannot be parsed because the input properties weren't set or empty
-
createIdFromJndiLocation
protected static String createIdFromJndiLocation(String jndiLocation)
Get a string name for the configuration of this resource. This should be XML and filesystem friendly. For example, the String returned will have no slashes or punctuation, and be as short as possible.- Parameters:
jndiLocation
- used to construct the id- Returns:
- a string that can be used to name this configuration
-
-