org.deegree.gml
Class GMLDocumentIdContext

java.lang.Object
  extended by org.deegree.gml.GMLDocumentIdContext
All Implemented Interfaces:
GMLReferenceResolver, ReferenceResolver

public class GMLDocumentIdContext
extends Object
implements GMLReferenceResolver

Keeps track of GMLObjects inside GML instance documents, their ids and local xlink references during the parsing of GML documents.

Can be used for resolving local xlink-references at the end of the parsing process of a GML instance document or to access all encountered objects on any level of the document.

Version:
$Revision:$, $Date:$
Author:
Markus Schneider , last edited by: $Author:$
See Also:
GMLReferenceResolver, GMLStreamReader

Constructor Summary
GMLDocumentIdContext(GMLVersion version)
          Creates a new GMLDocumentIdContext instance for a GML document of the given version.
 
Method Summary
 void addObject(GMLObject object)
          Adds a new GMLObject that has been encountered during the parsing of the GML document.
 void addReference(GMLReference<?> ref)
          Adds a new GMLReference that has been encountered during the parsing of the GML document.
 GMLObject getObject(String id)
          Returns the GMLObject with the specified id.
 GMLObject getObject(String uri, String baseURL)
          Returns the GMLObject that is referenced by the given URI.
 Map<String,GMLObject> getObjects()
          Returns all GMLObject (but no GMLReference instances) that have been added.
 List<GMLReference<?>> getReferences()
          Return all GMLReference instances that have been added.
 void resolveLocalRefs()
          Resolves all local references that have been added before against the added objects.
 void setApplicationSchema(AppSchema schema)
          Sets the application schema (necessary for getObject(String, String).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GMLDocumentIdContext

public GMLDocumentIdContext(GMLVersion version)
Creates a new GMLDocumentIdContext instance for a GML document of the given version.

Parameters:
version - GML version, must not be null
Method Detail

setApplicationSchema

public void setApplicationSchema(AppSchema schema)
Sets the application schema (necessary for getObject(String, String).

Parameters:
schema - application schema to use for parsing external references

addObject

public void addObject(GMLObject object)
Adds a new GMLObject that has been encountered during the parsing of the GML document.

Parameters:
object - GML object, must not be null and must not be of type GMLReference

addReference

public void addReference(GMLReference<?> ref)
Adds a new GMLReference that has been encountered during the parsing of the GML document.

Parameters:
ref - GML reference, must not be null

getObject

public GMLObject getObject(String id)
Returns the GMLObject with the specified id.

Parameters:
id - id of the object to be returned
Returns:
the object, or null if it has not been added before

getObjects

public Map<String,GMLObject> getObjects()
Returns all GMLObject (but no GMLReference instances) that have been added.

Returns:
all gml objects that have been added before, may be empty, but never null

getReferences

public List<GMLReference<?>> getReferences()
Return all GMLReference instances that have been added.

Returns:
all gml references that have been added before, may be empty, but never null

getObject

public GMLObject getObject(String uri,
                           String baseURL)
Description copied from interface: GMLReferenceResolver
Returns the GMLObject that is referenced by the given URI.

Specified by:
getObject in interface GMLReferenceResolver
Specified by:
getObject in interface ReferenceResolver
Parameters:
uri - URI that identifies the object, must not be null
baseURL - optional baseURL for resolving URIs that are relative URLs, may be null
Returns:
the referenced object or null if no such object exists

resolveLocalRefs

public void resolveLocalRefs()
                      throws ReferenceResolvingException
Resolves all local references that have been added before against the added objects.

Throws:
ReferenceResolvingException - if a local reference cannot be resolved


Copyright © 2011. All Rights Reserved.