UML Modeling Layer

com.ibm.xtools.uml.msl.internal.resources.parsers
Class FragmentParser

java.lang.Object
  extended by com.ibm.xtools.uml.msl.internal.resources.parsers.ContainerParser
      extended by com.ibm.xtools.uml.msl.internal.resources.parsers.FragmentParser

public class FragmentParser
extends ContainerParser

Parser specialized for fast extracting of the fragment data for the specified resource. If the resource is loaded the parser uses EMF to extract the data. If the resource is not loaded the parser does not cause it to be loaded; rather it uses SAX parser with fast break out algorithm to extract the data.


Field Summary
protected  Resource parentResource
          UML Unit that is the parent of the resource we're parsing.
 
Fields inherited from class com.ibm.xtools.uml.msl.internal.resources.parsers.ContainerParser
containerResource, containerUri, resource, resourceHealth
 
Constructor Summary
FragmentParser(Resource resource)
          Constructor
FragmentParser(Resource resource, Resource parent)
          Constructor
 
Method Summary
protected  void checkClosedParentReference(URI uri, String rootId, URI fragmentUri)
          Checks the validity of the parent reference in a closed resource
protected  void checkLoadedParentReference(EModelElement resourceRoot, EObject eObj, URI uri)
          Checks the validity of the parent reference in a loaded resource
protected  void closedFragmentsParse(FragmentHandler fh, ResourceSet resSet, URI fragmentUri)
          Stub implementation of fragment parsing for subclasses
 List<Resource> getFragments()
           
 Resource getParentResource()
           
protected  void loadedFragmentsParse(EModelElement resourceRoot, ResourceSet resSet)
          Stub implementation of fragment parsing for subclasses
 
Methods inherited from class com.ibm.xtools.uml.msl.internal.resources.parsers.ContainerParser
buildFragmentHandler, closedContainerParse, closedResourceParse, getContainerResource, getContainerUri, getResourceHealth, loadedContainerParse, loadedResourceParse, parse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parentResource

protected Resource parentResource
UML Unit that is the parent of the resource we're parsing. May be null for the root.

Constructor Detail

FragmentParser

public FragmentParser(Resource resource)
Constructor

Parameters:
resource - The resource whose fragment data are collected. The resource does not have to be loaded.

FragmentParser

public FragmentParser(Resource resource,
                      Resource parent)
Constructor

Parameters:
resource - The resource whose fragment data are collected. The resource does not have to be loaded.
Method Detail

loadedFragmentsParse

protected void loadedFragmentsParse(EModelElement resourceRoot,
                                    ResourceSet resSet)
Description copied from class: ContainerParser
Stub implementation of fragment parsing for subclasses

Overrides:
loadedFragmentsParse in class ContainerParser
Parameters:
resourceRoot - root element of the current resource
resSet - active resource set

closedFragmentsParse

protected void closedFragmentsParse(FragmentHandler fh,
                                    ResourceSet resSet,
                                    URI fragmentUri)
Description copied from class: ContainerParser
Stub implementation of fragment parsing for subclasses

Overrides:
closedFragmentsParse in class ContainerParser
Parameters:
fh - XML sax element handler for fragmented resources
resSet - active resource set
fragmentUri - uri of the current resource

checkClosedParentReference

protected void checkClosedParentReference(URI uri,
                                          String rootId,
                                          URI fragmentUri)
Description copied from class: ContainerParser
Checks the validity of the parent reference in a closed resource

Overrides:
checkClosedParentReference in class ContainerParser
Parameters:
uri - container resource uri
rootId - id of the root element of the current resource
fragmentUri - uri of the current resource

checkLoadedParentReference

protected void checkLoadedParentReference(EModelElement resourceRoot,
                                          EObject eObj,
                                          URI uri)
Description copied from class: ContainerParser
Checks the validity of the parent reference in a loaded resource

Overrides:
checkLoadedParentReference in class ContainerParser
Parameters:
resourceRoot - root element of the current resource
eObj - container element
uri - uri of the current resource

getParentResource

public Resource getParentResource()
Returns:
The parent resource provided when this parser was created. It may be null if the parsed resource does not have a container resource.

getFragments

public List<Resource> getFragments()
Returns:
The list of fragments. Elements are of type Resource. It may be empty if the parsed resource does not have fragments.

UML Modeling Layer

© Copyright IBM Corp. 2009. All rights reserved.