edu.utah.further.mdr.impl.service.uml
Class XmiParser21Impl

java.lang.Object
  extended by edu.utah.further.mdr.impl.service.uml.XmiParser21Impl
All Implemented Interfaces:
XmiParser

@Implementation
@Service(value="xmiParser21")
@Scope(value="prototype")
public class XmiParser21Impl
extends Object

XMI 2.1 parser implementation. Right now this is not a singleton service and requires an instance per model loading. In the future, we might make it a singleton class.

-----------------------------------------------------------------------------------
(c) 2008-2011 FURTHeR Project, AVP Health Sciences IT Office, University of Utah
Contact: Dr. Scott Narus <scott.narus@hsc.utah.edu>
Biomedical Informatics, 26 South 2000 East
Room 5775 HSEB, Salt Lake City, UT 84112
Day Phone: 1-801-213-3288
-----------------------------------------------------------------------------------

Version:
Dec 5, 2008
Author:
Oren E. Livne <oren.livne@utah.edu>
See Also:
http://www.ibm.com/developerworks/library/x-javaxpathapi.html#changed

Nested Class Summary
protected static interface AbstractXmiParser.LineTransformer
          A function pointer for transforming lines in the xquery file.
 
Field Summary
protected  XmiParserOptions options
          XMI Parser options.
protected  XQueryDataSource xqueryDataSource
          Instantiates prototype XQuery data sources.
 
Constructor Summary
XmiParser21Impl()
          Create an XMI 1.1 parser.
 
Method Summary
protected  boolean addLineTransformer(AbstractXmiParser.LineTransformer lineTransformer)
          Add a line transformer at the end of the transformer list.
protected  void addMessage(Severity severity, String text)
           
protected  void addMessages(SeverityMessageContainer container)
           
protected  javax.xml.xquery.XQExpression createExpression(javax.xml.xquery.XQConnection connection)
          Create an XQuery expression.
protected  InputStream fixXmiFile(InputStream originalXmi)
          Fix XMI file.
 SeverityMessageContainer getMessages()
          Return the message container.
 XmiParserOptions getOptions()
          Return the options property.
protected  InputStream getQueryFileResource(String fileName)
           
protected  UmlModel loadModel()
          Extract DTS information from the XMI resource #resourceName.
 UmlModel parse(String queryResourceName, InputStream xmiInputStream)
          Parse UML model from an XMI input stream.
 UmlModel parse(String queryResourceName, String xmiResourceName)
          Parse UML model from XMI file.
protected  UmlModel parseResults(javax.xml.xquery.XQSequence results)
          Parse the XML results.
 void setOptions(XmiParserOptions options)
          Set a new value for the options property.
protected  void setupXQuery(String queryResourceName)
           
protected  void tearDown()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

options

protected XmiParserOptions options
XMI Parser options.


xqueryDataSource

protected XQueryDataSource xqueryDataSource
Instantiates prototype XQuery data sources.

Constructor Detail

XmiParser21Impl

public XmiParser21Impl()
Create an XMI 1.1 parser.

Method Detail

createExpression

protected javax.xml.xquery.XQExpression createExpression(javax.xml.xquery.XQConnection connection)
                                                  throws javax.xml.xquery.XQException
Create an XQuery expression.

Parameters:
connection - XQuery engine connection
Returns:
XQuery expression
Throws:
javax.xml.xquery.XQException

parseResults

protected UmlModel parseResults(javax.xml.xquery.XQSequence results)
                         throws javax.xml.xquery.XQException
Parse the XML results.

Parameters:
results -
Returns:
Throws:
javax.xml.xquery.XQException

parse

@DtsTransactional
public UmlModel parse(String queryResourceName,
                                       String xmiResourceName)
Parse UML model from XMI file.

Specified by:
parse in interface XmiParser
Parameters:
queryResourceName - XQuery file resource name
xmiResourceName - XMI file resource name
Returns:
the output UML model
See Also:
uml.XmiParser

parse

@DtsTransactional
public UmlModel parse(String queryResourceName,
                                       InputStream xmiInputStream)
Parse UML model from an XMI input stream.

Specified by:
parse in interface XmiParser
Parameters:
queryResourceName - XQuery file resource name
xmiInputStream - XMI file resource input stream
Returns:
the output UML model
See Also:
uml.XmiParser

getMessages

public SeverityMessageContainer getMessages()
Return the message container.

Specified by:
getMessages in interface XmiParser
Returns:
the message container

getOptions

public XmiParserOptions getOptions()
Return the options property.

Specified by:
getOptions in interface XmiParser
Returns:
the options

setOptions

public void setOptions(XmiParserOptions options)
Set a new value for the options property.

Specified by:
setOptions in interface XmiParser
Parameters:
options - the options to set

fixXmiFile

protected final InputStream fixXmiFile(InputStream originalXmi)
                                throws IOException
Fix XMI file. Also, re-encode an input stream in UTF-8 encoding. A hook.

Parameters:
originalXmi - original XMI input source
Returns:
fixed XMI input source
Throws:
IOException

setupXQuery

protected final void setupXQuery(String queryResourceName)
                          throws javax.xml.xquery.XQException
Throws:
javax.xml.xquery.XQException

tearDown

protected final void tearDown()
                       throws javax.xml.xquery.XQException,
                              IOException
Throws:
javax.xml.xquery.XQException
IOException

addLineTransformer

protected final boolean addLineTransformer(AbstractXmiParser.LineTransformer lineTransformer)
Add a line transformer at the end of the transformer list.

Parameters:
lineTransformer - transformer to add
See Also:
List.add(java.lang.Object)

loadModel

protected final UmlModel loadModel()
                            throws javax.xml.xquery.XQException
Extract DTS information from the XMI resource #resourceName. A template method.

Returns:
the output UML model
Throws:
javax.xml.xquery.XQException

addMessage

protected final void addMessage(Severity severity,
                                String text)
Parameters:
severity -
text -
See Also:
List.add(java.lang.Object)

addMessages

protected final void addMessages(SeverityMessageContainer container)
Parameters:
container -

getQueryFileResource

protected final InputStream getQueryFileResource(String fileName)
Returns:


Copyright © 2011 Office of the AVP for Health Sci. IT. All Rights Reserved.