EDU.utwente.CoCompose.xml
Class ModelReader

java.lang.Object
  |
  +--org.xml.sax.helpers.DefaultHandler
        |
        +--EDU.utwente.CoCompose.xml.ModelReader
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler
Direct Known Subclasses:
CompositeTypeReader

public class ModelReader
extends org.xml.sax.helpers.DefaultHandler

XML reader for reading a CoCompose Model XML document and create the corresponding objects. Based on the SAX2 DefaultHandler class.

Version:
0.1.13, 9 October 2003
Author:
Dennis Wagelaar

Field Summary
static int CREATING_COMPOSITE
           
static int CREATING_CONCEPT
           
static int CREATING_LINK
           
static int CREATING_NONE
           
static int CREATING_PUBLISHED
           
static int CREATING_ROLE
           
static int CREATING_SOLROLE
           
protected  java.lang.String implConstrConceptID_
          New implementation constraint concept ID.
protected  java.util.Collection implConstrForms_
          New implementation constraint concept forms collection.
protected  int mode_
          Mode flag for checking what element was started.
protected  Model model
          The model that is being read.
protected  Composite newComposite_
          New Composite.
protected  Concept newConcept_
          New Concept.
protected  Implementation newImpl_
          New concept implementation.
protected  Link newLink_
          New Link.
protected  PublishedConcept newPublished_
          New PublishedConcept.
protected  CompositeRole newRole_
          New CompositeRole.
protected  SolutionRole newSolutionRole_
          New SolutionRole.
static int PCDATA_COMMENTS
           
static int PCDATA_GML
           
static int PCDATA_NONE
           
static int PCDATA_SPEC
           
protected  int pcdataMode_
          Mode flag for checking what type of character data is coming in.
protected  java.lang.String transPrior_
          New translation priority.
static java.lang.String XMLNAME_COMMENTS
           
static java.lang.String XMLNAME_COMPOSITE
           
static java.lang.String XMLNAME_CONCEPT
           
static java.lang.String XMLNAME_FORM
           
static java.lang.String XMLNAME_GML
           
static java.lang.String XMLNAME_ICONSTR
           
static java.lang.String XMLNAME_ICONT
           
static java.lang.String XMLNAME_IMPL
           
static java.lang.String XMLNAME_IMPLGEN
           
static java.lang.String XMLNAME_LINK
           
static java.lang.String XMLNAME_MODEL
           
static java.lang.String XMLNAME_MULT
           
static java.lang.String XMLNAME_PRI_ITEM
           
static java.lang.String XMLNAME_PRIORITY
           
static java.lang.String XMLNAME_PUBLISHED
           
static java.lang.String XMLNAME_ROLE
           
static java.lang.String XMLNAME_SOLPATT
           
static java.lang.String XMLNAME_SOLROLE
           
static java.lang.String XMLNAME_SPEC
           
 
Constructor Summary
ModelReader(Model model_in)
          Constructs a ModelReader.
 
Method Summary
 void characters(char[] ch, int start, int length)
          Characters.
protected  void conceptChar(AbstractConcept concept)
          Parse character data into the given concept.
protected  void edgeChar()
          Parse character data into the given edge.
 void endElement(java.lang.String uri, java.lang.String local, java.lang.String raw)
          End element.
protected  void endImplementation()
          Finish Implementation element.
protected  void endImplementationConstraint()
          End ImplementationConstraint element.
protected  void endImplementationContent()
          Finish ImplementationContent element.
protected  void endModel()
          Finish Model element - handles extra operations after parsing.
protected  void parseGML(AbstractConcept concept, java.lang.String gml)
          Parses the GML data into the concept.
protected  void parseGML(java.lang.String gml)
          Parses the GML data into a new link.
protected  void startAbstractConcept(AbstractConcept concept, org.xml.sax.Attributes attrs)
          Start AbstractConcept element.
protected  void startComments(org.xml.sax.Attributes attrs)
          Start Comments element.
protected  void startComposite(org.xml.sax.Attributes attrs)
          Start Composite element.
protected  void startCompositePartConcept(CompositePartConcept concept, org.xml.sax.Attributes attrs)
          Start CompositePartConcept element.
protected  void startConcept(org.xml.sax.Attributes attrs)
          Start Concept element.
protected  void startConceptForm(org.xml.sax.Attributes attrs)
          Start ConceptForm element.
protected  void startConstrainedConcept(ConstrainedConcept concept, org.xml.sax.Attributes attrs)
          Start ConstrainedConcept element.
 void startElement(java.lang.String uri, java.lang.String local, java.lang.String raw, org.xml.sax.Attributes attrs)
          Start element.
protected  void startGML(org.xml.sax.Attributes attrs)
          Start GML element.
protected  void startImplementation(org.xml.sax.Attributes attrs)
          Start Implementation element.
protected  void startImplementationConstraint(org.xml.sax.Attributes attrs)
          Start ImplementationConstraint element.
protected  void startImplementationContent(org.xml.sax.Attributes attrs)
          Start ImplementationContent element.
protected  void startImplementationGenerator(org.xml.sax.Attributes attrs)
          Start ImplementationGenerator element.
protected  void startLink(org.xml.sax.Attributes attrs)
          Start ConceptLink element.
protected  void startModel(org.xml.sax.Attributes attrs)
          Start DesignModel element.
protected  void startMult(org.xml.sax.Attributes attrs)
          Start Multiplicity element.
protected  void startPriority(org.xml.sax.Attributes attrs)
          Start TranslationPriority element.
protected  void startPriorityItem(org.xml.sax.Attributes attrs)
          Start PriorityItem element.
protected  void startPublished(org.xml.sax.Attributes attrs)
          Start PublishedConcept element.
protected  void startRole(org.xml.sax.Attributes attrs)
          Start CompositeRole element.
protected  void startSolutionPattern(org.xml.sax.Attributes attrs)
          Start SolutionPattern element.
protected  void startSolutionRole(org.xml.sax.Attributes attrs)
          Start SolutionRole element.
protected  void startSpec(org.xml.sax.Attributes attrs)
          Start Specification element.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XMLNAME_MODEL

public static final java.lang.String XMLNAME_MODEL

XMLNAME_SOLROLE

public static final java.lang.String XMLNAME_SOLROLE

XMLNAME_CONCEPT

public static final java.lang.String XMLNAME_CONCEPT

XMLNAME_COMPOSITE

public static final java.lang.String XMLNAME_COMPOSITE

XMLNAME_ROLE

public static final java.lang.String XMLNAME_ROLE

XMLNAME_PUBLISHED

public static final java.lang.String XMLNAME_PUBLISHED

XMLNAME_LINK

public static final java.lang.String XMLNAME_LINK

XMLNAME_GML

public static final java.lang.String XMLNAME_GML

XMLNAME_COMMENTS

public static final java.lang.String XMLNAME_COMMENTS

XMLNAME_SPEC

public static final java.lang.String XMLNAME_SPEC

XMLNAME_MULT

public static final java.lang.String XMLNAME_MULT

XMLNAME_SOLPATT

public static final java.lang.String XMLNAME_SOLPATT

XMLNAME_IMPLGEN

public static final java.lang.String XMLNAME_IMPLGEN

XMLNAME_IMPL

public static final java.lang.String XMLNAME_IMPL

XMLNAME_ICONT

public static final java.lang.String XMLNAME_ICONT

XMLNAME_ICONSTR

public static final java.lang.String XMLNAME_ICONSTR

XMLNAME_FORM

public static final java.lang.String XMLNAME_FORM

XMLNAME_PRIORITY

public static final java.lang.String XMLNAME_PRIORITY

XMLNAME_PRI_ITEM

public static final java.lang.String XMLNAME_PRI_ITEM

CREATING_NONE

public static final int CREATING_NONE

CREATING_SOLROLE

public static final int CREATING_SOLROLE

CREATING_CONCEPT

public static final int CREATING_CONCEPT

CREATING_COMPOSITE

public static final int CREATING_COMPOSITE

CREATING_ROLE

public static final int CREATING_ROLE

CREATING_PUBLISHED

public static final int CREATING_PUBLISHED

CREATING_LINK

public static final int CREATING_LINK

PCDATA_NONE

public static final int PCDATA_NONE

PCDATA_GML

public static final int PCDATA_GML

PCDATA_COMMENTS

public static final int PCDATA_COMMENTS

PCDATA_SPEC

public static final int PCDATA_SPEC

mode_

protected int mode_
Mode flag for checking what element was started.

pcdataMode_

protected int pcdataMode_
Mode flag for checking what type of character data is coming in.

model

protected Model model
The model that is being read.

newSolutionRole_

protected SolutionRole newSolutionRole_
New SolutionRole.

newConcept_

protected Concept newConcept_
New Concept.

newComposite_

protected Composite newComposite_
New Composite.

newRole_

protected CompositeRole newRole_
New CompositeRole.

newPublished_

protected PublishedConcept newPublished_
New PublishedConcept.

newLink_

protected Link newLink_
New Link.

newImpl_

protected Implementation newImpl_
New concept implementation.

transPrior_

protected java.lang.String transPrior_
New translation priority.

implConstrConceptID_

protected java.lang.String implConstrConceptID_
New implementation constraint concept ID.

implConstrForms_

protected java.util.Collection implConstrForms_
New implementation constraint concept forms collection.
Constructor Detail

ModelReader

public ModelReader(Model model_in)
            throws org.xml.sax.SAXException
Constructs a ModelReader.
Parameters:
model_in - The model object to build from the XML file.
Throws:
org.xml.sax.SAXException - if the model is null.
Method Detail

startModel

protected void startModel(org.xml.sax.Attributes attrs)
                   throws java.lang.Exception
Start DesignModel element.
Parameters:
attrs - Element attributes.
Throws:
java.lang.Exception - if the attributes could not be read.

startAbstractConcept

protected void startAbstractConcept(AbstractConcept concept,
                                    org.xml.sax.Attributes attrs)
                             throws java.lang.Exception
Start AbstractConcept element.
Parameters:
concept - The new AbstractConcept to build.
attrs - Element attributes.
Throws:
java.lang.Exception - if the attributes could not be read.

startConstrainedConcept

protected void startConstrainedConcept(ConstrainedConcept concept,
                                       org.xml.sax.Attributes attrs)
                                throws java.lang.Exception
Start ConstrainedConcept element.
Parameters:
concept - The new ConstrainedConcept to build.
attrs - Element attributes.
Throws:
java.lang.Exception - if the attributes could not be read.

startSolutionRole

protected void startSolutionRole(org.xml.sax.Attributes attrs)
                          throws java.lang.Exception
Start SolutionRole element.
Parameters:
attrs - Element attributes.
Throws:
java.lang.Exception - if the attributes could not be read.

startConcept

protected void startConcept(org.xml.sax.Attributes attrs)
                     throws java.lang.Exception
Start Concept element.
Parameters:
attrs - Element attributes.
Throws:
java.lang.Exception - if the attributes could not be read.

startComposite

protected void startComposite(org.xml.sax.Attributes attrs)
                       throws java.lang.Exception
Start Composite element.
Parameters:
attrs - Element attributes.
Throws:
java.lang.Exception - if the attributes could not be read.

startCompositePartConcept

protected void startCompositePartConcept(CompositePartConcept concept,
                                         org.xml.sax.Attributes attrs)
                                  throws java.lang.Exception
Start CompositePartConcept element.
Parameters:
concept - The composite part concept.
attrs - Element attributes.
Throws:
java.lang.Exception - if the attributes could not be read.

startRole

protected void startRole(org.xml.sax.Attributes attrs)
                  throws java.lang.Exception
Start CompositeRole element.
Parameters:
attrs - Element attributes.
Throws:
java.lang.Exception - if the attributes could not be read.

startPublished

protected void startPublished(org.xml.sax.Attributes attrs)
                       throws java.lang.Exception
Start PublishedConcept element.
Parameters:
attrs - Element attributes.
Throws:
java.lang.Exception - if the attributes could not be read.

startMult

protected void startMult(org.xml.sax.Attributes attrs)
                  throws java.lang.Exception
Start Multiplicity element.
Parameters:
attrs - Element attributes.
Throws:
java.lang.Exception - if the attributes could not be read.

startSolutionPattern

protected void startSolutionPattern(org.xml.sax.Attributes attrs)
                             throws java.lang.Exception
Start SolutionPattern element.
Parameters:
attrs - Element attributes.
Throws:
java.lang.Exception - if the attributes could not be read.

startImplementationGenerator

protected void startImplementationGenerator(org.xml.sax.Attributes attrs)
                                     throws java.lang.Exception
Start ImplementationGenerator element.
Parameters:
attrs - Element attributes.
Throws:
java.lang.Exception - if the attributes could not be read.

startImplementation

protected void startImplementation(org.xml.sax.Attributes attrs)
                            throws java.lang.Exception
Start Implementation element.
Parameters:
attrs - Element attributes.
Throws:
java.lang.Exception - if the attributes could not be read.

startImplementationContent

protected void startImplementationContent(org.xml.sax.Attributes attrs)
Start ImplementationContent element.
Parameters:
attrs - Element attributes.

startImplementationConstraint

protected void startImplementationConstraint(org.xml.sax.Attributes attrs)
                                      throws java.lang.Exception
Start ImplementationConstraint element.
Parameters:
attrs - Element attributes.
Throws:
java.lang.Exception - if the attributes could not be read.

startConceptForm

protected void startConceptForm(org.xml.sax.Attributes attrs)
                         throws java.lang.Exception
Start ConceptForm element.
Parameters:
attrs - Element attributes.
Throws:
java.lang.Exception - if the attributes could not be read.

endImplementationConstraint

protected void endImplementationConstraint()
End ImplementationConstraint element.

startLink

protected void startLink(org.xml.sax.Attributes attrs)
                  throws java.lang.Exception
Start ConceptLink element.
Parameters:
attrs - Element attributes.
Throws:
java.lang.Exception - if the attributes could not be read.

startPriority

protected void startPriority(org.xml.sax.Attributes attrs)
                      throws java.lang.Exception
Start TranslationPriority element.
Parameters:
attrs - Element attributes.
Throws:
java.lang.Exception - if the attributes could not be read.

startPriorityItem

protected void startPriorityItem(org.xml.sax.Attributes attrs)
                          throws java.lang.Exception
Start PriorityItem element.
Parameters:
attrs - Element attributes.
Throws:
java.lang.Exception - if the attributes could not be read.

startGML

protected void startGML(org.xml.sax.Attributes attrs)
Start GML element.
Parameters:
attrs - Element attributes.

startComments

protected void startComments(org.xml.sax.Attributes attrs)
Start Comments element.
Parameters:
attrs - Element attributes.

startSpec

protected void startSpec(org.xml.sax.Attributes attrs)
Start Specification element.
Parameters:
attrs - Element attributes.

endImplementationContent

protected void endImplementationContent()
Finish ImplementationContent element.

endImplementation

protected void endImplementation()
Finish Implementation element.

endModel

protected void endModel()
                 throws org.xml.sax.SAXException
Finish Model element - handles extra operations after parsing.
Throws:
org.xml.sax.SAXException - if an error occurs in post processing.

parseGML

protected void parseGML(AbstractConcept concept,
                        java.lang.String gml)
                 throws org.xml.sax.SAXException
Parses the GML data into the concept.
Parameters:
concept - The Concept to parse the GML data into.
gml - The GML data.
Throws:
org.xml.sax.SAXException - if the GML data could not be parsed.

parseGML

protected void parseGML(java.lang.String gml)
                 throws org.xml.sax.SAXException
Parses the GML data into a new link.
Parameters:
gml - The GML data.
Throws:
org.xml.sax.SAXException - if the GML data could not be parsed.

conceptChar

protected void conceptChar(AbstractConcept concept)
                    throws org.xml.sax.SAXException
Parse character data into the given concept.
Parameters:
concept - The Concept to parse character data for.
data - The character data.
Throws:
org.xml.sax.SAXException - if the character data could not be parsed.

edgeChar

protected void edgeChar()
                 throws org.xml.sax.SAXException
Parse character data into the given edge.
Parameters:
data - The character data.
Throws:
org.xml.sax.SAXException - if the character data could not be parsed.

startElement

public void startElement(java.lang.String uri,
                         java.lang.String local,
                         java.lang.String raw,
                         org.xml.sax.Attributes attrs)
                  throws org.xml.sax.SAXException
Start element.
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
uri - Ignored.
local - Ignored.
raw - Element name.
attrs - Element attributes.
Throws:
org.xml.sax.SAXException - if the new element could not be parsed.

characters

public void characters(char[] ch,
                       int start,
                       int length)
Characters.
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
Parameters:
ch[] - Character input.
start - Starting index of characters.
length - Length of characters.

endElement

public void endElement(java.lang.String uri,
                       java.lang.String local,
                       java.lang.String raw)
                throws org.xml.sax.SAXException
End element.
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
uri - Ignored.
local - Ignored.
raw - Element name.
Throws:
org.xml.sax.SAXException - if the new element could not be parsed.