public class SBMLResolverRegistry extends java.lang.Object
This class of objects is defined by libSBML only and has no direct equivalent in terms of SBML components. It is a class used in the implementation of extra functionality provided by libSBML.
LibSBML provides facilities for resolving SBML documents in various ways
from a given URI. Resolvers are implemented as objects derived from the
class SBMLResolver
.
The resolver registry maintains a list of known resolvers and provides
methods for discovering them. It is implemented as a singleton object of
class SBMLResolverRegistry
. Callers can use the method
SBMLResolverRegistry.getNumResolvers()
to find out how many resolvers are
registered, then use SBMLResolverRegistry.getResolverByIndex(int)
to iterate over each one
SBMLFileResolver
Modifier and Type | Method and Description |
---|---|
int |
addOwnedSBMLDocument(SBMLDocument doc)
Adds the given
SBMLDocument to the registry of SBML documents that will need to be deleted. |
int |
addResolver(SBMLResolver resolver)
Adds the given resolver to the registry of SBML resolvers.
|
void |
delete()
Explicitly deletes the underlying native object.
|
static void |
deleteResolerRegistryInstance()
deletes the static resolver registry instance
|
static SBMLResolverRegistry |
getInstance()
Returns the singleton instance for the resolver registry.
|
int |
getNumResolvers()
Returns the number of resolvers known by the registry.
|
SBMLResolver |
getResolverByIndex(int index)
Returns the resolver with the given index number.
|
int |
removeResolver(int index)
Removes the resolver with the given index.
|
SBMLDocument |
resolve(java.lang.String uri)
Resolves the document for the given URI.
|
SBMLDocument |
resolve(java.lang.String uri,
java.lang.String baseUri)
Resolves the document for the given URI.
|
SBMLUri |
resolveUri(java.lang.String uri)
Resolves the full URI for the given URI without actually reading the
document.
|
SBMLUri |
resolveUri(java.lang.String uri,
java.lang.String baseUri)
Resolves the full URI for the given URI without actually reading the
document.
|
public void delete()
In general, application software will not need to call this method directly. The Java language binding for libSBML is implemented as a language wrapper that provides a Java interface to libSBML's underlying C++/C code. Some of the Java methods return objects that are linked to objects created not by Java code, but by C++ code. The Java objects wrapped around them will be deleted when the garbage collector invokes the corresponding C++ finalize()
methods for the objects. The finalize()
methods in turn call the SBMLResolverRegistry.delete()
method on the libSBML object.
This method is exposed in case calling programs want to ensure that the underlying object is freed immediately, and not at some arbitrary time determined by the Java garbage collector. In normal usage, callers do not need to invoke SBMLResolverRegistry.delete()
themselves.
public static SBMLResolverRegistry getInstance()
Prior to using the registry, callers have to obtain a copy of the registry. This static method provides the means for doing that.
public int addResolver(SBMLResolver resolver)
resolver
- the resolver to add to the registry.
public int addOwnedSBMLDocument(SBMLDocument doc)
SBMLDocument
to the registry of SBML documents that will need to be deleted.
When calculating reference cycles, sometimes we need SBML Documents to persist, but nobody else owns them directly. We hand them to the registry here so they can be cleaned up
doc
- the SBML Document to add to the registry.
public int removeResolver(int index)
index
- the index of the resolver to be removed
public SBMLResolver getResolverByIndex(int index)
Resolvers are given arbitrary index numbers by the registry. Callers
can use the method SBMLResolverRegistry.getNumResolvers()
to find
out how many resolvers are registered, then use this method to
iterate over the list and obtain each one in turn.
index
- the zero-based index of the resolver to fetch.
null
if the
number is less than 0
or there is no resolver at the given index
position.public int getNumResolvers()
SBMLResolverRegistry.getResolverByIndex(int)
public SBMLDocument resolve(java.lang.String uri, java.lang.String baseUri)
uri
- the URI to the target documentbaseUri
- base URI, in case the URI is a relative one
public SBMLDocument resolve(java.lang.String uri)
uri
- the URI to the target documentbaseUri
- base URI, in case the URI is a relative one
public SBMLUri resolveUri(java.lang.String uri, java.lang.String baseUri)
uri
- the URI to the target documentbaseUri
- base URI, in case the URI is a relative one
public SBMLUri resolveUri(java.lang.String uri)
uri
- the URI to the target documentbaseUri
- base URI, in case the URI is a relative one
public static void deleteResolerRegistryInstance()