|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ConfigContext
ConfigContext is a helper interface for using Config objects. It stores a 'context' or 'cursor' in the tree hierarchy from which a search for values commences - essentially traversing the tree, but hiding the underlying XML data structure from the user. The user can use a context object in 3 ways: (1) request a new context, via 'getContext', or 'getFeature' If the requested context is not found, an 'empty' context is returned. (2) request values from a context, which are either: (a) enabled status, via 'getEnabled' or 'isFeatureEnabled' If the status is not found, false is returned (b) a set of properties, via 'getProperties' or 'getPropertiesDefault' If there are no properties, an empty 'Properties' is returned (c) a named property value, via 'getProperty' If the property does not exist, null is returned (d) the set of feature names( just enabled or all ), via 'getFeatures' If there are no features, an empty String array is returned. (3) reset the context, via 'setContext' If the requested context cannot be constructed, the context goes empty The reset context is returned. The logic of these operations presupposes a specific structure of the XML document which obeys these rules. (1) at the document root, there are only 'containers' (2) a container's children may only be (a) 'features' or (b) containers (3) a feature must have a name attribute and its children must only be (a) 'properties' or (b) containers (4) a property must have 'type' and 'desc' attributes.
Method Summary | |
---|---|
java.lang.String |
getAttribute(java.lang.String attrName)
Obtains a context attribute value |
boolean |
getBooleanAttr(java.lang.String attrName)
Returns boolean value of context attribute |
ConfigContext |
getContext(java.lang.String contextPath)
Returns arbitrary (container or feature) context from arbitrary context |
ConfigContext |
getFeature(java.lang.String feature)
Returns feature context from a container context |
java.lang.String[] |
getFeatures(boolean enabledOnly)
Returns list of features in this context |
Specifier[] |
getInputs(boolean isTemplate)
Obtains a list of inputs |
java.util.Properties |
getNamedProperties()
Obtains named context properties |
java.lang.String |
getNamedProperty(java.lang.String propName)
Return the value of a named context property |
java.util.Properties |
getNamedPropertyAttributes(java.lang.String attribute)
Returns named properties with given attribute |
java.util.Properties |
getProperties()
Obtains context properties |
java.util.Properties |
getPropertiesDefault(java.lang.String feature)
Returns deafault properties for a context feature |
java.lang.String |
getProperty(java.lang.String name)
Obtains a context property value |
java.lang.String |
getPropertyAttr(java.lang.String propName,
java.lang.String attrName)
Obtains the value of a property attribute |
Specifier[] |
getSpecifiers(boolean isTemplate)
Obtains a list of context specifiers |
boolean |
isEmpty()
Returns whether context contains any values |
boolean |
isEnabled()
Returns enabled status of this context |
boolean |
isFeatureEnabled(java.lang.String featureName)
Returns enabled status of this context feature |
ConfigContext |
setContext(java.lang.String contextPath)
Resets arbitrary context from arbitrary context |
ConfigContext |
setFeature(java.lang.String feature)
Resets to feature context from a container context |
Method Detail |
---|
boolean isEmpty()
ConfigContext getContext(java.lang.String contextPath)
contextPath
- path to context
ConfigContext getFeature(java.lang.String feature)
feature
- the feature name
ConfigContext setContext(java.lang.String contextPath)
contextPath
- path to context
ConfigContext setFeature(java.lang.String feature)
feature
- the feature name
java.lang.String[] getFeatures(boolean enabledOnly)
enabledOnly
- if true, skip non-enable features
boolean isFeatureEnabled(java.lang.String featureName)
featureName
- the feature name
boolean isEnabled()
boolean getBooleanAttr(java.lang.String attrName)
attrName
- the attribute name
java.lang.String getAttribute(java.lang.String attrName)
attrName
- the attribute name
java.lang.String getProperty(java.lang.String name)
name
- the property name
java.lang.String getPropertyAttr(java.lang.String propName, java.lang.String attrName)
propName
- the property nameattrName
- the attribute name
Specifier[] getSpecifiers(boolean isTemplate)
isTemplate
- if true, look only for template specifiers
Specifier[] getInputs(boolean isTemplate)
isTemplate
- if true, look only for template inputs
java.util.Properties getProperties()
java.util.Properties getNamedProperties()
java.util.Properties getNamedPropertyAttributes(java.lang.String attribute)
attribute
- attribute name
java.lang.String getNamedProperty(java.lang.String propName)
propName
- the property name
java.util.Properties getPropertiesDefault(java.lang.String feature)
feature
- the feature name
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |