ModeShape Distribution 3.0.0.Beta4

org.modeshape.sequencer.teiid.xmi
Class XmiReader

java.lang.Object
  extended by org.modeshape.sequencer.teiid.xmi.XmiReader

public class XmiReader
extends Object

A XMI file reader.


Field Summary
protected static boolean DEBUG
           
protected  Logger logger
           
 
Constructor Summary
protected XmiReader(String path)
           
 
Method Summary
protected  void addAttribute(XmiElement element, XmiAttribute attribute)
           
protected  void addChild(XmiElement parent, XmiElement newChild)
           
protected  void addElement(XmiElement newElement)
           
protected  void createAttributes(XMLStreamReader streamReader, XmiElement element)
           
protected  void debug(String message)
           
 List<XmiElement> getElements()
           
protected  List<XmiElement> getElements(String namespaceUri)
           
protected  Map<String,String> getNamespaces()
          Map has keys of namespaces prefixes and values of namespace URIs.
 String getPath()
           
 String getResourceName()
           
protected  int getStackSize()
           
protected  void handleCharacters(XMLStreamReader streamReader)
          Handles a stream XMLStreamConstants.CHARACTERS event.
protected  XmiElement handleEndElement(XMLStreamReader streamReader)
          Handles a stream XMLStreamConstants.END_ELEMENT event.
protected  void handleOtherEvents(XMLStreamReader streamReader)
          Handles a stream events not covered by other methods.
protected  XmiElement handleStartElement(XMLStreamReader streamReader)
          Handles a stream XMLStreamConstants.START_ELEMENT event.
protected  XmiElement pop(XMLStreamReader streamReader)
           
protected  void push(XmiElement element)
           
protected  List<XmiElement> read(InputStream stream)
           
protected  void stop()
           
 
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

XmiReader

protected XmiReader(String path)
Parameters:
path - the path to the XMI file being read (cannot be null or empty)
Method Detail

debug

protected void debug(String message)

addAttribute

protected void addAttribute(XmiElement element,
                            XmiAttribute attribute)
Parameters:
element - the element the attribute is being added to (cannot be null)
attribute - the attribute being added (cannot be null)

addChild

protected void addChild(XmiElement parent,
                        XmiElement newChild)
Parameters:
parent - the element the child element is being added to (cannot be null)
newChild - the element being added as a child (cannot be null)

addElement

protected void addElement(XmiElement newElement)
Parameters:
newElement - the root level element being added (cannot be null)

createAttributes

protected void createAttributes(XMLStreamReader streamReader,
                                XmiElement element)
Parameters:
streamReader - the stream reader (cannot be null)
element - the element whose attributes are being created from the stream (cannot be null)

getElements

public List<XmiElement> getElements()
Returns:
the root-level child elements found in the model (never null)

getElements

protected List<XmiElement> getElements(String namespaceUri)
Parameters:
namespaceUri - the namespace URI of the elements being requested (cannot be null or empty)
Returns:
the child elements with the specified namespace URI (never null)

getNamespaces

protected Map<String,String> getNamespaces()
Map has keys of namespaces prefixes and values of namespace URIs.

Returns:
the namespaces declared in the file (never null)

getPath

public String getPath()
Returns:
the path to the resource (can be null or empty)

getResourceName

public String getResourceName()
Returns:
the resource name (never null)

getStackSize

protected int getStackSize()
Returns:
the number of elements currently in the stack

handleCharacters

protected void handleCharacters(XMLStreamReader streamReader)
Handles a stream XMLStreamConstants.CHARACTERS event.

Parameters:
streamReader - the stream reader (cannot be null)

handleEndElement

protected XmiElement handleEndElement(XMLStreamReader streamReader)
Handles a stream XMLStreamConstants.END_ELEMENT event.

Parameters:
streamReader - the stream reader (cannot be null)
Returns:
the XMI element popped off the stack (never null)

handleOtherEvents

protected void handleOtherEvents(XMLStreamReader streamReader)
Handles a stream events not covered by other methods.

Parameters:
streamReader - the stream reader (cannot be null)

handleStartElement

protected XmiElement handleStartElement(XMLStreamReader streamReader)
                                 throws Exception
Handles a stream XMLStreamConstants.START_ELEMENT event.

Parameters:
streamReader - the stream reader (cannot be null)
Returns:
the new XMI element pushed onto the stack (never null)
Throws:
Exception - if there is a problem reading from the stream

pop

protected XmiElement pop(XMLStreamReader streamReader)
Parameters:
streamReader - the stream reader (cannot be null)
Returns:
the XMI element poppoed off the stack (never null)

push

protected void push(XmiElement element)
Parameters:
element - the XMI element being pushed onto the stack (cannot be null)

read

protected final List<XmiElement> read(InputStream stream)
                               throws Exception
Parameters:
stream - the input stream (cannot be null)
Returns:
the root elements found (never null)
Throws:
Exception - if there is a problem reading the stream

stop

protected void stop()

ModeShape Distribution 3.0.0.Beta4

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