org.argouml.model
Interface XmiReader


public interface XmiReader

XMI file reader to deserialize a model into the model repository.


Method Summary
 void addSearchPath(java.lang.String path)
          Add a path to the list of paths to be searched when looking for XMI files to resolve external references with.
 java.lang.String getHeader()
          Get the header comment from the XMI file, if any.
 int getIgnoredElementCount()
          Return the count of elements read during the last XMI read which were on the ignore list.
 java.lang.String[] getIgnoredElements()
          Returns list of element names which will be ignored during XMI import if they cause an error.
 java.util.List<java.lang.String> getSearchPath()
          Get the list of paths to be searched when looking for XMI files to resolve external references with.
 java.lang.String getTagName()
          Return the name of the outermost tag in the XMI file.
 java.util.Map<java.lang.String,java.lang.Object> getXMIUUIDToObjectMap()
          Get the map of external IDs to UML elements.
 java.util.Collection parse(org.xml.sax.InputSource pIs)
          Deprecated. for 0.25.4 by tfmorris. Use parse(InputSource, boolean).
 java.util.Collection parse(org.xml.sax.InputSource pIs, boolean profile)
          Parse a given inputsource to a collection of top level model elements.
 void removeSearchPath(java.lang.String path)
          Remove a path from the list of paths to be searched when looking for XMI files to resolve external references with.
 boolean setIgnoredElements(java.lang.String[] elementNames)
          Set the list of element names for which errors should be ignored when reading the XMI file.
 

Method Detail

parse

@Deprecated
java.util.Collection parse(org.xml.sax.InputSource pIs)
                           throws UmlException
Deprecated. for 0.25.4 by tfmorris. Use parse(InputSource, boolean).

Parse a given inputsource to a collection of top level model elements.

Parameters:
pIs - the input source for parsing
Returns:
a collection of top level elements
Throws:
UmlException - on any error

parse

java.util.Collection parse(org.xml.sax.InputSource pIs,
                           boolean profile)
                           throws UmlException
Parse a given inputsource to a collection of top level model elements.

Parameters:
pIs - the input source for parsing
profile - true if the resulting model will be used as a profile. Profiles are read-only and will not be written back out when the model data is written.
Returns:
a collection of top level elements
Throws:
UmlException - on any error
Since:
0.22

getXMIUUIDToObjectMap

java.util.Map<java.lang.String,java.lang.Object> getXMIUUIDToObjectMap()
Get the map of external IDs to UML elements. For earlier versions of ArgoUML, the id was the xmi.uuid, but currently it is the xmi.id. These are unique within a given XMI file, but no attempt is made to make them globally unique. They are, however, guaranteed to remain stable across load/save cycles, so they can be used for external cross-references (e.g. from the PGML diagram files).

Returns:
the map

setIgnoredElements

boolean setIgnoredElements(java.lang.String[] elementNames)
Set the list of element names for which errors should be ignored when reading the XMI file. The common one is "UML:Diagram" but it can be any element which is not in the metamodel.

This may not be supported by all implementations. The method will return false if unsupported.

Parameters:
elementNames - array of element names which reader should ignore
Returns:
returns false if the operation is unsupported

getIgnoredElements

java.lang.String[] getIgnoredElements()
Returns list of element names which will be ignored during XMI import if they cause an error.

Returns:
array of names (Strings)

getIgnoredElementCount

int getIgnoredElementCount()
Return the count of elements read during the last XMI read which were on the ignore list.

Returns:
the count

getTagName

java.lang.String getTagName()
Return the name of the outermost tag in the XMI file.

Returns:
the tag name

getSearchPath

java.util.List<java.lang.String> getSearchPath()
Get the list of paths to be searched when looking for XMI files to resolve external references with. The list is maintained in a static structure shared by all instances.

Returns:
a List of directory paths

addSearchPath

void addSearchPath(java.lang.String path)
Add a path to the list of paths to be searched when looking for XMI files to resolve external references with. The list is maintained in a static structure shared by all instances.

TODO: It's desirable to have separate search paths for separate files, but more work is required in ArgoUML so that it knows how to maintain separate contexts for the profiles and user models.

Parameters:
path - a directory path to add to the search path

removeSearchPath

void removeSearchPath(java.lang.String path)
Remove a path from the list of paths to be searched when looking for XMI files to resolve external references with. The list is maintained in a static structure shared by all instances.

Parameters:
path - directory path to remove from search

getHeader

java.lang.String getHeader()
Get the header comment from the XMI file, if any. The comment is contained in the element. The contents are optional and may vary from one UML tool to the other. ArgoUML writes a string similar to the following:
 <XMI.documentation>
   <XMI.exporter>
     ArgoUML (using Netbeans XMI Writer version 1.0)
   </XMI.exporter>
   <XMI.exporterVersion>
     1.4 revised on $Date: 2008-05-22 17:25:35 -0700 (Thu, 22 May 2008) $
   </XMI.exporterVersion>
 </XMI.documentation>
 <XMI.metamodel xmi.name = 'UML' xmi.version = '1.4'/>
 

Returns:
A String containing the XML fragment


ArgoUML © 1996-2006ArgoUML HomepageArgoUML Cookbook