ModeShape Distribution 3.0.0.Beta4

org.modeshape.sequencer.teiid.model
Class ModelObjectHandler

java.lang.Object
  extended by org.modeshape.sequencer.teiid.model.ModelObjectHandler
Direct Known Subclasses:
CoreModelObjectHandler, DiagramModelObjectHandler, JdbcModelObjectHandler, RelationalModelObjectHandler, TransformationModelObjectHandler

public abstract class ModelObjectHandler
extends Object

Base implementation of a model object handler.


Field Summary
protected static boolean DEBUG
           
protected  Logger logger
           
 
Constructor Summary
ModelObjectHandler()
           
 
Method Summary
protected  Node addNode(Node parentNode, XmiElement element, String nameAttributeUri, String primaryNodeType)
           
protected  void addPropertyValue(Node node, String propertyName, String newValue)
           
protected  void addPropertyValue(Node node, String propertyName, Value newValue)
           
protected  void debug(String message)
           
protected  Sequencer.Context getContext()
           
protected  String getQName(XmiPart xmiPart)
           
protected  org.modeshape.sequencer.teiid.model.ModelReader getReader()
           
protected  ReferenceResolver getResolver()
           
protected  VdbModel getVdbModel()
           
protected abstract  void process(XmiElement element, Node parentNode)
           
protected  void setBooleanProperty(Node node, String jcrPropertyName, String value)
          If the value is null or empty the property is not set.
protected  void setContext(Sequencer.Context context)
          This method should only be called by the framework loading model object handlers.
protected  void setProperty(Node node, String propertyName, String propertyValue)
          Sets the specified, single-valued, property only if the value is not null and not empty.
protected  void setReader(org.modeshape.sequencer.teiid.model.ModelReader reader)
          This method should only be called by the framework loading model object handlers.
protected  void setResolver(ReferenceResolver resolver)
          This method should only be called by the framework loading model object handlers.
protected  void setVdbModel(VdbModel vdbModel)
          This method should only be called by the framework loading model object handlers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected Logger logger

DEBUG

protected static final boolean DEBUG
See Also:
Constant Field Values
Constructor Detail

ModelObjectHandler

public ModelObjectHandler()
Method Detail

debug

protected void debug(String message)

addNode

protected Node addNode(Node parentNode,
                       XmiElement element,
                       String nameAttributeUri,
                       String primaryNodeType)
                throws Exception
Parameters:
parentNode - the parent node where the child node is being added (cannot be null)
element - the XMI element to use to create the child node (cannot be null)
nameAttributeUri - the URI of the name property (cannot be null or empty)
primaryNodeType - the primary node type to use when creating the new node (cannot be null or empty)
Returns:
the new node (never null)
Throws:
Exception - if there is a problem creating the node

addPropertyValue

protected void addPropertyValue(Node node,
                                String propertyName,
                                String newValue)
                         throws Exception
Parameters:
node - the node whose multi-valued property a value is being added to (cannot be null)
propertyName - the multi-valued property name (cannot be null or empty)
newValue - the value being added (cannot be null or empty)
Throws:
Exception - if there is a problem adding the property value

addPropertyValue

protected void addPropertyValue(Node node,
                                String propertyName,
                                Value newValue)
                         throws Exception
Parameters:
node - the node whose multi-valued property a value is being added to (cannot be null)
propertyName - the multi-valued property name (cannot be null or empty)
newValue - the value being added (cannot be null or empty)
Throws:
Exception - if there is a problem adding the property value

getContext

protected Sequencer.Context getContext()
Returns:
context the sequencer context (never null)

getQName

protected String getQName(XmiPart xmiPart)
Parameters:
xmiPart - the XMI part whose qualified name is being requested (cannot be null)
Returns:
the qualified name obtained from the part (never null or empty)

getReader

protected org.modeshape.sequencer.teiid.model.ModelReader getReader()
Returns:
reader the model reader (never null)

getResolver

protected ReferenceResolver getResolver()
Returns:
the reference resolver (never null)

getVdbModel

protected VdbModel getVdbModel()
Returns:
vdbModel the VDB model (can be null if model did not come from a VDB)

process

protected abstract void process(XmiElement element,
                                Node parentNode)
                         throws Exception
Parameters:
element - the element being processed (cannot be null)
parentNode - the parent node to use if a node is created for the element (cannot be null)
Throws:
Exception - if there is a problem processing the XMI element

setBooleanProperty

protected void setBooleanProperty(Node node,
                                  String jcrPropertyName,
                                  String value)
                           throws Exception
If the value is null or empty the property is not set.

Parameters:
node - the node whose boolean property is being set (cannot be null)
value - the property value (can be null or empty)
jcrPropertyName - the JCR property name (cannot be null or empty)
Throws:
Exception - if there is a problem setting the property

setContext

protected void setContext(Sequencer.Context context)
This method should only be called by the framework loading model object handlers.

Parameters:
context - the sequencer context being set (never null)

setProperty

protected void setProperty(Node node,
                           String propertyName,
                           String propertyValue)
                    throws Exception
Sets the specified, single-valued, property only if the value is not null and not empty.

Parameters:
node - the node whose property is being set (cannot be null)
propertyName - the name of the property being set (cannot be null)
propertyValue - the proposed property value (can be null or empty)
Throws:
Exception - if there is a problem setting the property

setReader

protected void setReader(org.modeshape.sequencer.teiid.model.ModelReader reader)
This method should only be called by the framework loading model object handlers.

Parameters:
reader - the model reader being set (never null)

setResolver

protected void setResolver(ReferenceResolver resolver)
This method should only be called by the framework loading model object handlers.

Parameters:
resolver - the reference resolver used during sequencing (cannot be null)

setVdbModel

protected void setVdbModel(VdbModel vdbModel)
This method should only be called by the framework loading model object handlers.

Parameters:
vdbModel - the VDB model being sequenced (can be null if model is not from a VDB)

ModeShape Distribution 3.0.0.Beta4

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.