org.apache.clerezza.rdf.core.access
Class TcProviderMultiplexer

java.lang.Object
  extended by org.apache.clerezza.rdf.core.access.TcProviderMultiplexer
All Implemented Interfaces:
TcProvider
Direct Known Subclasses:
TcManager

public class TcProviderMultiplexer
extends Object
implements TcProvider

This makes a set of WeightedTcProvider appear as one TcProvider. It delegates requests to the WeightedTcProvider with the highest Weight

Author:
reto

Constructor Summary
TcProviderMultiplexer()
           
 
Method Summary
 void addWeightedTcProvider(WeightedTcProvider provider)
          Registers a provider
 Graph createGraph(UriRef name, TripleCollection triples)
          Creates a Graph with a specified name
 LockableMGraph createMGraph(UriRef name)
          Creates an initially empty MGraph with a specified name
 void deleteTripleCollection(UriRef name)
          Deletes the Graph or MGraph of a specified name.
 Graph getGraph(UriRef name)
          Get a Graph by its name
 LockableMGraph getMGraph(UriRef name)
          Get an MGraph by its name.
 Set<UriRef> getNames(Graph graph)
          get a set of the names of a Graph
 SortedSet<WeightedTcProvider> getProviderList()
           
 TripleCollection getTriples(UriRef name)
          This method is used to get a TripleCollection indifferently whether it's a Graph or an MGraph.
protected  void graphAppears(UriRef name)
          subclasses overwrite this method to be notified when a new Graph is available (either because it has been created or being provided by a newly added WeightedTcProvider).
 Set<UriRef> listGraphs()
          Lists the name of the Graphs available through this TcProvider, implementations may take into account the security context and omit Graphs for which access is not allowed.
 Set<UriRef> listMGraphs()
          Lists the name of the MGraphs available through this TcProvider, implementations may take into account the security context and omit MGraphs for which access is not allowed.
 Set<UriRef> listTripleCollections()
          Lists the name of the TripleCollections available through this TcProvider indifferently whether they are Graphs or an MGraphs, implementations may take into account the security context and omit TripleCollections for which access is not allowed.
protected  void mGraphAppears(UriRef name)
          subclasses overwrite this method to be notified when a new MGraph is available (either because it has been created or being provided by a newly added WeightedTcProvider).
 void removeWeightedTcProvider(WeightedTcProvider provider)
          Unregister a provider
protected  void tcDisappears(UriRef name)
          subclasses overwrite this method to be notified whenTripleCollection is no longer available (either because it has been deleted or bacause its WeightedTcProvider was removed).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TcProviderMultiplexer

public TcProviderMultiplexer()
Method Detail

addWeightedTcProvider

public void addWeightedTcProvider(WeightedTcProvider provider)
Registers a provider

Parameters:
provider - the provider to be registered

removeWeightedTcProvider

public void removeWeightedTcProvider(WeightedTcProvider provider)
Unregister a provider

Parameters:
provider - the provider to be deregistered

graphAppears

protected void graphAppears(UriRef name)
subclasses overwrite this method to be notified when a new Graph is available (either because it has been created or being provided by a newly added WeightedTcProvider). The default implementation does nothing.

Parameters:
name -

mGraphAppears

protected void mGraphAppears(UriRef name)
subclasses overwrite this method to be notified when a new MGraph is available (either because it has been created or being provided by a newly added WeightedTcProvider). The default implementation does nothing.

Parameters:
name -

tcDisappears

protected void tcDisappears(UriRef name)
subclasses overwrite this method to be notified whenTripleCollection is no longer available (either because it has been deleted or bacause its WeightedTcProvider was removed). The default implementation does nothing. for implementational reasons even for name of TripleCollection not previously registered.

Parameters:
name -

getGraph

public Graph getGraph(UriRef name)
               throws NoSuchEntityException
Description copied from interface: TcProvider
Get a Graph by its name

Specified by:
getGraph in interface TcProvider
Parameters:
name - the name of the Graph
Returns:
the Graph with the specified name
Throws:
NoSuchEntityException - if there is no Graph with the specified name

getMGraph

public LockableMGraph getMGraph(UriRef name)
                         throws NoSuchEntityException
Description copied from interface: TcProvider
Get an MGraph by its name. The instances returned in different invocations are equals.

Specified by:
getMGraph in interface TcProvider
Returns:
name the MGraph with the specified name
Throws:
NoSuchEntityException - if there is no MGraph with the specified name

getTriples

public TripleCollection getTriples(UriRef name)
                            throws NoSuchEntityException
Description copied from interface: TcProvider
This method is used to get a TripleCollection indifferently whether it's a Graph or an MGraph. If the name names an MGraph the result is the same as when invoking getMGraph with that argument, analogously for GraphS the method returns an instance equals to what getGraph would return.

Specified by:
getTriples in interface TcProvider
Parameters:
name - the name of the Graph or MGraph
Returns:
the Graph or MGraph
Throws:
NoSuchEntityException - if there is no Graph or MGraph with the specified name

createMGraph

public LockableMGraph createMGraph(UriRef name)
                            throws UnsupportedOperationException
Description copied from interface: TcProvider
Creates an initially empty MGraph with a specified name

Specified by:
createMGraph in interface TcProvider
Parameters:
name - names the new MGraph
Returns:
the newly created MGraph
Throws:
UnsupportedOperationException - if this provider doesn't support creating MGraphS

createGraph

public Graph createGraph(UriRef name,
                         TripleCollection triples)
Description copied from interface: TcProvider
Creates a Graph with a specified name

Specified by:
createGraph in interface TcProvider
Parameters:
name - the name of the Graph to be created
triples - the triples of the new Graph
Returns:
the newly created Graph

deleteTripleCollection

public void deleteTripleCollection(UriRef name)
Description copied from interface: TcProvider
Deletes the Graph or MGraph of a specified name. If name references a Graph and the graph has other names, it will still be available with those other names.

Specified by:
deleteTripleCollection in interface TcProvider
Parameters:
name - the entity to be removed

getNames

public Set<UriRef> getNames(Graph graph)
Description copied from interface: TcProvider
get a set of the names of a Graph

Specified by:
getNames in interface TcProvider
Returns:
the set names of Graph, the set is empty if Graph is unknown

listGraphs

public Set<UriRef> listGraphs()
Description copied from interface: TcProvider
Lists the name of the Graphs available through this TcProvider, implementations may take into account the security context and omit Graphs for which access is not allowed.

Specified by:
listGraphs in interface TcProvider
Returns:
the list of Graphs

listMGraphs

public Set<UriRef> listMGraphs()
Description copied from interface: TcProvider
Lists the name of the MGraphs available through this TcProvider, implementations may take into account the security context and omit MGraphs for which access is not allowed.

Specified by:
listMGraphs in interface TcProvider
Returns:
the list of MGraphs

listTripleCollections

public Set<UriRef> listTripleCollections()
Description copied from interface: TcProvider
Lists the name of the TripleCollections available through this TcProvider indifferently whether they are Graphs or an MGraphs, implementations may take into account the security context and omit TripleCollections for which access is not allowed.

Specified by:
listTripleCollections in interface TcProvider
Returns:
the list of TripleCollections

getProviderList

public SortedSet<WeightedTcProvider> getProviderList()


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.