Class 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 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)
      • 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