net.dpml.util
Class SimpleResolver

java.lang.Object
  extended bynet.dpml.util.SimpleResolver
All Implemented Interfaces:
Resolver

public class SimpleResolver
extends Object
implements Resolver

Build-time value resolver.


Constructor Summary
SimpleResolver()
           
 
Method Summary
 String getProperty(String key)
          Return a property value.
 String getProperty(String key, String value)
          Return a property value.
 String resolve(String value)
          Symbolic expansion of a supplied value.
 URI toURI(String ref)
          Utility function supporting resolution of uris containing 'resource' or 'alias' schemes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleResolver

public SimpleResolver()
Method Detail

toURI

public URI toURI(String ref)
          throws URISyntaxException
Utility function supporting resolution of uris containing 'resource' or 'alias' schemes. If the supplied uri scheme is 'resource' or 'alias' the reference is resolved to a artifact type, group and name from which a resource is resolved and the uri returned. If the scheme is resource the usi of the resource is returned. If the scheme is 'alias' a link alias is returned. If the scheme is not 'resource' or 'alias' the argument will be evaluated as a normal transit artifact uri specification.

Specified by:
toURI in interface Resolver
Parameters:
ref - the uri argument
Returns:
the uri value
Throws:
URISyntaxException - if an error occurs during uri creation

getProperty

public String getProperty(String key)
Return a property value.

Specified by:
getProperty in interface Resolver
Parameters:
key - the property key
Returns:
the property value

getProperty

public String getProperty(String key,
                          String value)
Return a property value.

Specified by:
getProperty in interface Resolver
Parameters:
key - the property key
value - the default value
Returns:
the property value

resolve

public String resolve(String value)
Symbolic expansion of a supplied value. Replace any occurances of ${[key]} with the value of the property assigned to the [key] in system properties.

Specified by:
resolve in interface Resolver
Parameters:
value - a string containing possibly multiple ${[value]} sequences
Returns:
the expanded string