org.glassfish.admin.amx.impl.config
Class AttributeResolverHelper

java.lang.Object
  extended by org.jvnet.hk2.config.VariableResolver
      extended by org.glassfish.admin.amx.impl.config.AttributeResolverHelper
All Implemented Interfaces:
org.jvnet.hk2.config.Translator

@Taxonomy(stability=UNCOMMITTED)
public class AttributeResolverHelper
extends org.jvnet.hk2.config.VariableResolver

Helper to resolve attribute configuration values eg ${com.sun.aas.installRoot} once they have already been obtained in "raw" form. If the goal is to fetch the attribute values in already-resolved form, do so directly via @{link AttributeResolver#resolveAttribute}.

Values can be resolved into String, boolean or int.

Example usage:

    HTTPListenerConfig l = ...; // or any AMXConfigProxy sub-interface
    AttributeResolverHelper h = new AttributeResolverHelper( l );
    int port = h.resolveInt( l.getPort() );
    
Alternately, the static method form can be used:
    HTTPListenerConfig l = ...; // or any AMXConfigProxy sub-interface
    int port = AttributeResolverHelper.resolveInt( l, value );
    
The value can also be pre-resolved by calling AttributeResolver

See Also:
AttributeResolver

Field Summary
 
Fields inherited from interface org.jvnet.hk2.config.Translator
NOOP, SYS_PROP_TR
 
Constructor Summary
AttributeResolverHelper(AMXConfigProxy amx)
           
 
Method Summary
protected  java.lang.String getVariableValue(java.lang.String varName)
           
static boolean needsResolving(java.lang.String value)
          Return true if the string is a template string of the for ${...}
 java.lang.String resolve(java.lang.String in)
          Resolve the String using the target resolver (MBean).
 
Methods inherited from class org.jvnet.hk2.config.VariableResolver
translate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttributeResolverHelper

public AttributeResolverHelper(AMXConfigProxy amx)
Method Detail

getVariableValue

protected java.lang.String getVariableValue(java.lang.String varName)
                                     throws org.jvnet.hk2.config.TranslationException
Specified by:
getVariableValue in class org.jvnet.hk2.config.VariableResolver
Throws:
org.jvnet.hk2.config.TranslationException

needsResolving

public static boolean needsResolving(java.lang.String value)
Return true if the string is a template string of the for ${...}


resolve

public java.lang.String resolve(java.lang.String in)
                         throws org.jvnet.hk2.config.TranslationException
Resolve the String using the target resolver (MBean).

Throws:
org.jvnet.hk2.config.TranslationException


Copyright © 2012 GlassFish Community. All Rights Reserved.