org.codehaus.cargo.container.property
Class ResourceConverter

java.lang.Object
  extended by 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.

Version:
$Id: $

Constructor Summary
ResourceConverter()
           
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceConverter

public ResourceConverter()
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
See Also:
PropertyUtils#joinPropertiesOnPipe(java.util.Properties)

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


Copyright © 2004-2012 Codehaus. All Rights Reserved.