be.ac.vub.cocompose.io.xmi
Class XMIElementWriter

java.lang.Object
  extended bybe.ac.vub.cocompose.lang.DefaultModelVisitor
      extended bybe.ac.vub.cocompose.lang.DefaultSuperModelVisitor
          extended bybe.ac.vub.cocompose.io.xmi.XMIElementWriter
All Implemented Interfaces:
ModelVisitor

public class XMIElementWriter
extends DefaultSuperModelVisitor

Writes a CoCompose model to an XMI file.

Since:
0.2.0
Version:
0.2.10, 11/05/2004
Author:
Dennis Wagelaar

Field Summary
 
Fields inherited from class be.ac.vub.cocompose.lang.DefaultModelVisitor
current
 
Constructor Summary
XMIElementWriter()
           
 
Method Summary
 Attributes getRootAttributes()
          Gets the root attributes to add to the first element.
 ContentHandler getXmlHandler()
          Gets the XML handler.
protected  void insertReference(String refName, ModelElement from, ModelElement to)
          Inserts an XMI tag that refers to the given model element.
 void setRootAttributes(Attributes rootAttributes)
          Sets the root attributes to add to the first element.
 void setStacked(ModelVisitor stacked)
          Sets a stacked visitor for this and the contained visitors.
 void setXmlHandler(ContentHandler xmlHandler)
          Sets the XML handler.
 void visitCompositeConstraint(CompositeConstraint compositeConstraint)
          Visits a CompositeConstraint.
 void visitConcept(Concept concept)
          Visits a concept.
 void visitElementConstraint(ElementConstraint elementConstraint)
          Visits an ElementConstraint.
 void visitImplementationGenerator(ImplementationGenerator implementationGenerator)
          Visits an ImplementationGenerator.
 void visitImplementationPattern(ImplementationPattern implementationPattern)
          Visits an ImplementationPattern.
 void visitModel(Model model)
          Visits a Model.
 void visitModelProperty(ModelProperty modelProperty)
          Visits a ModelProperty.
 void visitNamespace(Namespace namespace)
          Visits a Namespace.
 void visitRefinedElement(RefinedElement refinedElement)
          Visits a RefinedElement.
 void visitRelationElement(RelationElement relationElement)
          Visits a RelationElement.
 void visitRelationship(Relationship relationship)
          Visits a Relationship.
 void visitRole(Role role)
          Visits a Role.
 void visitSolutionPattern(SolutionPattern solutionPattern)
          Visits a SolutionPattern.
 
Methods inherited from class be.ac.vub.cocompose.lang.DefaultSuperModelVisitor
visitAndConstraint, visitConstraint, visitImplementationRolePart, visitModelTransformation, visitMultiplicity, visitOrConstraint, visitProperty, visitRefinement, visitSimpleProperty
 
Methods inherited from class be.ac.vub.cocompose.lang.DefaultModelVisitor
getStacked, visit, visitModelElement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMIElementWriter

public XMIElementWriter()
Method Detail

setXmlHandler

public void setXmlHandler(ContentHandler xmlHandler)
Sets the XML handler.

Parameters:
xmlHandler - - the XML handler.

getXmlHandler

public ContentHandler getXmlHandler()
Gets the XML handler.

Returns:
the XML handler.

visitNamespace

public void visitNamespace(Namespace namespace)
                    throws ModelElementException
Visits a Namespace.

Specified by:
visitNamespace in interface ModelVisitor
Overrides:
visitNamespace in class DefaultSuperModelVisitor
Parameters:
namespace - - the element to visit.
Throws:
ModelElementException

visitModel

public void visitModel(Model model)
                throws ModelElementException
Visits a Model.

Specified by:
visitModel in interface ModelVisitor
Overrides:
visitModel in class DefaultSuperModelVisitor
Parameters:
model - - the element to visit.
Throws:
ModelElementException

visitRelationship

public void visitRelationship(Relationship relationship)
                       throws ModelElementException
Visits a Relationship.

Specified by:
visitRelationship in interface ModelVisitor
Overrides:
visitRelationship in class DefaultSuperModelVisitor
Parameters:
relationship - - the element to visit.
Throws:
ModelElementException

visitRelationElement

public void visitRelationElement(RelationElement relationElement)
                          throws ModelElementException
Visits a RelationElement.

Specified by:
visitRelationElement in interface ModelVisitor
Overrides:
visitRelationElement in class DefaultSuperModelVisitor
Parameters:
relationElement - - the element to visit.
Throws:
ModelElementException

visitSolutionPattern

public void visitSolutionPattern(SolutionPattern solutionPattern)
                          throws ModelElementException
Visits a SolutionPattern.

Specified by:
visitSolutionPattern in interface ModelVisitor
Overrides:
visitSolutionPattern in class DefaultSuperModelVisitor
Parameters:
solutionPattern - - the element to visit.
Throws:
ModelElementException

visitImplementationGenerator

public void visitImplementationGenerator(ImplementationGenerator implementationGenerator)
                                  throws ModelElementException
Visits an ImplementationGenerator.

Specified by:
visitImplementationGenerator in interface ModelVisitor
Overrides:
visitImplementationGenerator in class DefaultSuperModelVisitor
Parameters:
implementationGenerator - - the element to visit.
Throws:
ModelElementException

visitImplementationPattern

public void visitImplementationPattern(ImplementationPattern implementationPattern)
                                throws ModelElementException
Visits an ImplementationPattern.

Specified by:
visitImplementationPattern in interface ModelVisitor
Overrides:
visitImplementationPattern in class DefaultSuperModelVisitor
Parameters:
implementationPattern - - the element to visit.
Throws:
ModelElementException

visitRefinedElement

public void visitRefinedElement(RefinedElement refinedElement)
                         throws ModelElementException
Visits a RefinedElement.

Specified by:
visitRefinedElement in interface ModelVisitor
Overrides:
visitRefinedElement in class DefaultSuperModelVisitor
Parameters:
refinedElement - - the element to visit.
Throws:
ModelElementException

visitConcept

public void visitConcept(Concept concept)
                  throws ModelElementException
Visits a concept.

Specified by:
visitConcept in interface ModelVisitor
Overrides:
visitConcept in class DefaultSuperModelVisitor
Parameters:
concept - - the element to visit.
Throws:
ModelElementException

visitRole

public void visitRole(Role role)
               throws ModelElementException
Visits a Role.

Specified by:
visitRole in interface ModelVisitor
Overrides:
visitRole in class DefaultSuperModelVisitor
Parameters:
role - - the element to visit.
Throws:
ModelElementException

visitElementConstraint

public void visitElementConstraint(ElementConstraint elementConstraint)
                            throws ModelElementException
Visits an ElementConstraint.

Specified by:
visitElementConstraint in interface ModelVisitor
Overrides:
visitElementConstraint in class DefaultSuperModelVisitor
Parameters:
elementConstraint - - the element to visit.
Throws:
ModelElementException

visitCompositeConstraint

public void visitCompositeConstraint(CompositeConstraint compositeConstraint)
                              throws ModelElementException
Visits a CompositeConstraint.

Specified by:
visitCompositeConstraint in interface ModelVisitor
Overrides:
visitCompositeConstraint in class DefaultSuperModelVisitor
Parameters:
compositeConstraint - - the element to visit.
Throws:
ModelElementException

visitModelProperty

public void visitModelProperty(ModelProperty modelProperty)
                        throws ModelElementException
Visits a ModelProperty.

Specified by:
visitModelProperty in interface ModelVisitor
Overrides:
visitModelProperty in class DefaultSuperModelVisitor
Parameters:
modelProperty - - the element to visit.
Throws:
ModelElementException

getRootAttributes

public Attributes getRootAttributes()
Gets the root attributes to add to the first element.

Returns:
the root attributes.

setRootAttributes

public void setRootAttributes(Attributes rootAttributes)
Sets the root attributes to add to the first element.

Parameters:
rootAttributes - - the root attributes.

setStacked

public void setStacked(ModelVisitor stacked)
Sets a stacked visitor for this and the contained visitors.

Specified by:
setStacked in interface ModelVisitor
Overrides:
setStacked in class DefaultModelVisitor
Parameters:
stacked - - the stacked visitor.

insertReference

protected void insertReference(String refName,
                               ModelElement from,
                               ModelElement to)
                        throws ModelElementException,
                               SAXException
Inserts an XMI tag that refers to the given model element. This can be an idref tag or an href tag.

Parameters:
refName - the name of the reference.
from - the origin of the reference.
to - the target of the reference.
Throws:
ModelElementException - if the reference could not be made.
SAXException - if xml could not be created.