org.progeeks.meta.xml
Class PreferencesMetaObjectHandler

java.lang.Object
  extended by org.progeeks.util.xml.AbstractObjectHandler
      extended by org.progeeks.meta.xml.MetaObjectHandler
          extended by org.progeeks.meta.xml.PreferencesMetaObjectHandler
All Implemented Interfaces:
ObjectHandler

public class PreferencesMetaObjectHandler
extends MetaObjectHandler

Object handler implementation to deal with converting XML to PreferencesMetaObjects. This is different than regular meta-objects because the preference node must be specified to wrap. To distinguish these meta-objects from regular meta-objects the handler uses the prefs- prefix. Some of this could probably be more general but I want to wait for more use-cases and also for some epiphany on how XML rendering would keep track of this stuff.

Version:
$Revision: 1.5 $
Author:
Paul Speed

Field Summary
static java.lang.String PREFERENCES_PREFIX
           
static java.lang.String ROOT_NODE_KEY
           
static java.lang.String SYSTEM_NODE_ATTR
           
static java.lang.String USER_NODE_ATTR
           
 
Fields inherited from class org.progeeks.meta.xml.MetaObjectHandler
CONFIG_IMPORT_PACKAGE
 
Constructor Summary
PreferencesMetaObjectHandler()
          Creates a new meta-object handler that will use the default PreferencesMetaKit to create new objects and the context class registry to resolve meta-classes.
PreferencesMetaObjectHandler(MetaClassRegistry classRegistry, FormatRegistry formats, PreferencesMetaKit metaKit)
          Creates a new meta-object handler that will use the specified preferences meta-kit to create new objects and the specified class registry to resolve meta-classes
PreferencesMetaObjectHandler(PreferencesMetaKit metaKit)
          Creates a new meta-object handler that will use the specified preferences meta-kit to create new objects and the context class registry to resolve meta-classes.
 
Method Summary
 boolean canHandle(java.lang.String tag)
          Returns true if this handler applies to the specified object tag.
 java.lang.Object createObject(java.lang.String tag, org.xml.sax.Attributes atts, ObjectXmlReader reader)
          Creates and returns an object based on the specified parameters.
 java.lang.String getRootNodeId()
          Returns the root preference ID to prepend to any relative node paths or null if the real preferences root should be used.
protected  java.lang.String getStrippedTag(java.lang.String tag)
          Returns the tag name with the PREFERENCES_PREFIX stripped off or null if it does not start with PREFERENCES_PREFIX.
protected  boolean ignoreAttribute(java.lang.String name, ObjectXmlReader reader)
          Returns true if the specified attribute should be ignored within the context of the specified reader.
 void setRootNodeId(java.lang.String id)
          Sets the root preference ID to prepend to any relative node paths.
 
Methods inherited from class org.progeeks.meta.xml.MetaObjectHandler
addClassPrefix, getClassPrefixes, getFormatRegistry, getMetaClassRegistry, getProperty, getPropertyClass, getPropertyCollection, importPackage, importPackages, resolveTagClass, setClassPrefixes, setConfigurationProperty, setFormatRegistry, setMetaClassRegistry, setObjectProperties, setProperty, setTextProperty
 
Methods inherited from class org.progeeks.util.xml.AbstractObjectHandler
resolveObject, setContainedText
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PREFERENCES_PREFIX

public static final java.lang.String PREFERENCES_PREFIX
See Also:
Constant Field Values

USER_NODE_ATTR

public static final java.lang.String USER_NODE_ATTR
See Also:
Constant Field Values

SYSTEM_NODE_ATTR

public static final java.lang.String SYSTEM_NODE_ATTR
See Also:
Constant Field Values

ROOT_NODE_KEY

public static final java.lang.String ROOT_NODE_KEY
See Also:
Constant Field Values
Constructor Detail

PreferencesMetaObjectHandler

public PreferencesMetaObjectHandler()
Creates a new meta-object handler that will use the default PreferencesMetaKit to create new objects and the context class registry to resolve meta-classes.


PreferencesMetaObjectHandler

public PreferencesMetaObjectHandler(PreferencesMetaKit metaKit)
Creates a new meta-object handler that will use the specified preferences meta-kit to create new objects and the context class registry to resolve meta-classes.


PreferencesMetaObjectHandler

public PreferencesMetaObjectHandler(MetaClassRegistry classRegistry,
                                    FormatRegistry formats,
                                    PreferencesMetaKit metaKit)
Creates a new meta-object handler that will use the specified preferences meta-kit to create new objects and the specified class registry to resolve meta-classes

Method Detail

setRootNodeId

public void setRootNodeId(java.lang.String id)
Sets the root preference ID to prepend to any relative node paths.


getRootNodeId

public java.lang.String getRootNodeId()
Returns the root preference ID to prepend to any relative node paths or null if the real preferences root should be used.


getStrippedTag

protected java.lang.String getStrippedTag(java.lang.String tag)
Returns the tag name with the PREFERENCES_PREFIX stripped off or null if it does not start with PREFERENCES_PREFIX.


canHandle

public boolean canHandle(java.lang.String tag)
Returns true if this handler applies to the specified object tag.

Specified by:
canHandle in interface ObjectHandler
Overrides:
canHandle in class MetaObjectHandler

ignoreAttribute

protected boolean ignoreAttribute(java.lang.String name,
                                  ObjectXmlReader reader)
Description copied from class: MetaObjectHandler
Returns true if the specified attribute should be ignored within the context of the specified reader. Default implementation simply defers to the reader's ignoreAttribute() method.

Overrides:
ignoreAttribute in class MetaObjectHandler

createObject

public java.lang.Object createObject(java.lang.String tag,
                                     org.xml.sax.Attributes atts,
                                     ObjectXmlReader reader)
Creates and returns an object based on the specified parameters.

Specified by:
createObject in interface ObjectHandler
Overrides:
createObject in class MetaObjectHandler


Copyright © 2002-2003 Paul Speed. All Rights Reserved.