com.att.gs.codip.resource
Interface ResourceManager


public interface ResourceManager

Defines required functionality of a Kage Resource Manager.


Method Summary
 void addAlias(java.lang.String anAlias, LogicalResource theResource)
          Adds an alias for the supplied Resource.
 void addParameter(java.lang.String theURI, java.lang.String aParameter, java.lang.Object aValue)
          Adds or replaces an Resource parameter.
 void addResource(LogicalResource theResource)
          Adds the provided Resource to the managed collection.
 java.util.Iterator aliases()
          Provides an iterator over all aliases known by this manager.
 java.util.Iterator aliases(LogicalResource theResource)
          Provides an iterator over all aliases for the spefcified Resource that are known by this manager.
 boolean containsAlias(java.lang.String anAlias)
          Checks for the existence of an alias in this manager.
 boolean containsResource(java.lang.Object theID)
          Checks for the existence of an Resource in the mananged colleciton whose ID matches the provided ID.
 LogicalResource createResource()
          Creates a new instance of an Resource with a generated unique URI.
 LogicalResource createResource(java.lang.String theID)
          Finds or creates an Resource by URI.
 java.lang.String getID()
          Getter method for the ID of this manager.
 java.util.Map getParameters(java.lang.String theURI)
          Returns an Resource's parameter map.
 LogicalResource getResource(java.lang.Object theURI)
          Looks for an Resource in the managed colleciton whose URI matches the provided URI.
 java.lang.Object lookupParameter(java.lang.String theURI, java.lang.String aParameter)
          Looks up and returns an Resource's parameter value.
 LogicalResource lookupResource(java.lang.Object theID)
          Looks for an existing instance the specified Resource by ID.
 LogicalResource lookupResource(java.lang.Object theURI, boolean pLoad)
          Looks for the specified Resource by ID.
 void removeAlias(java.lang.String anAlias)
          Removes the supplied alias.
 void removeParameter(java.lang.String theURI, java.lang.String aParameter)
          Removes an Resource's parameter.
 void removeResource(LogicalResource theResource)
          Removes the provided Resource from the managed collection.
 java.util.Iterator resources()
          Provides a iterator for the ALL of the managed resources.
 

Method Detail

getID

public java.lang.String getID()
Getter method for the ID of this manager. The ID is immutable after creation. It provides a mechanism to distiguish between mutltiple resoruce managers is needed.

Returns:
The ID String.

lookupResource

public LogicalResource lookupResource(java.lang.Object theID)
Looks for an existing instance the specified Resource by ID. The ID can be either a URI or an alias. First the manged collection is searched by URI. If a matching Resource is found it is returned. Then the collection is searched by alias. Again, if a matching Resource is found it is return.

Parameters:
theID - The ID ie alias of the sought Resource.
Returns:
The matching Resource if found, otherwise returns void.

lookupResource

public LogicalResource lookupResource(java.lang.Object theURI,
                                      boolean pLoad)
Looks for the specified Resource by ID. Searches for the resource whose URI matches the provided URI. Will atempt to load a new physical instance with the appropriate URI if none exists.

Parameters:
pLoad - true causes a new physical instance to be loaded if no existing match is found.
Returns:
The matching resource if found or created, otherwise returns null.

createResource

public LogicalResource createResource()
Creates a new instance of an Resource with a generated unique URI. The created Resource is empty. It is identified by a unique URI.

Returns:
The Resource if created, otherwise returns null.

createResource

public LogicalResource createResource(java.lang.String theID)
Finds or creates an Resource by URI. Searches first for an onlology whose ID matches the provided URI, if no match is found a new instance is created.

Parameters:
theID - The URI of the new Resource.
Returns:
The matching resource if found or created, otherwise returns null.

addResource

public void addResource(LogicalResource theResource)
Adds the provided Resource to the managed collection. The provided Resource instance is added only if there is not a currently managed instance with the same URI.

Parameters:
theResource - The Resource instance to add to the collection.

removeResource

public void removeResource(LogicalResource theResource)
Removes the provided Resource from the managed collection. When the Resource is removed from the managed colleciton, all aliases refering to it and all other interanl reference to it are also removed. The removed Resource may be garbage collected if no other references exist.

Parameters:
theResource - The Resource to remove from the collection.

getResource

public LogicalResource getResource(java.lang.Object theURI)
Looks for an Resource in the managed colleciton whose URI matches the provided URI. The Resource manager assumes that ontologies are uniquely identified by their URI and therefore maintains a static colletion of ontologies with the URI as key.

Parameters:
theURI - The URI of the sought Resource.
Returns:
The matching Resource if found, otherwise returns null.

containsResource

public boolean containsResource(java.lang.Object theID)
Checks for the existence of an Resource in the mananged colleciton whose ID matches the provided ID.

Parameters:
theID - The ID of the sought Resource.
Returns:
true if the Resource exists in this collection.

resources

public java.util.Iterator resources()
Provides a iterator for the ALL of the managed resources.

Returns:
An iterator over all the resources.

containsAlias

public boolean containsAlias(java.lang.String anAlias)
Checks for the existence of an alias in this manager.

Parameters:
anAlias - The alias string.
Returns:
true if the alias exists.

addAlias

public void addAlias(java.lang.String anAlias,
                     LogicalResource theResource)
Adds an alias for the supplied Resource.

Parameters:
anAlias - The alias string.
theResource - The Resource refered to by the alias string.

removeAlias

public void removeAlias(java.lang.String anAlias)
Removes the supplied alias.

Parameters:
anAlias - The alias string.

aliases

public java.util.Iterator aliases()
Provides an iterator over all aliases known by this manager.

Returns:
The iterator.

aliases

public java.util.Iterator aliases(LogicalResource theResource)
Provides an iterator over all aliases for the spefcified Resource that are known by this manager.

Returns:
The iterator.

getParameters

public java.util.Map getParameters(java.lang.String theURI)
Returns an Resource's parameter map.

Parameters:
theURI - The URI of the Resource.
Returns:
a Map object containing the parameters for the Resource.

lookupParameter

public java.lang.Object lookupParameter(java.lang.String theURI,
                                        java.lang.String aParameter)
Looks up and returns an Resource's parameter value.

Parameters:
theURI - The URI of the Resource.
aParameter - The name of the parameter.
Returns:
The value of the parameter for the Resource.

addParameter

public void addParameter(java.lang.String theURI,
                         java.lang.String aParameter,
                         java.lang.Object aValue)
Adds or replaces an Resource parameter.

Parameters:
theURI - The URI of the Resource.
aParameter - The name of the parameter to add or update.
aValue - The new value of the parameter.

removeParameter

public void removeParameter(java.lang.String theURI,
                            java.lang.String aParameter)
Removes an Resource's parameter.

Parameters:
theURI - The URI of the Resource.
aParameter - The name of the parameter to remove.


CODIP AT&T Government Solutions, Inc.