|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.clerezza.rdf.core.access.TcProviderMultiplexer
org.apache.clerezza.rdf.core.access.TcManager
@Service(value=TcManager.class)
@Reference(name="weightedTcProvider",
policy=DYNAMIC,
referenceInterface=WeightedTcProvider.class,
cardinality=MANDATORY_MULTIPLE)
public class TcManager
This class implements TcManager, delegating the actual
provision and creation of Graphs or MGraphs to registered TcProviders. The class
attempts to satisfy the request using the register WeightedTcProvider
in decreasing order of weight. If multiple providers have the same weight the
lexicographical order of the fully qualified class name determines which one
is used, namely the one that occurs earlier. If a call to a registered provider
causes an IllegalArgumentException, NoSuchEntityException
or UnsupportedOperationException then the call is delegated to the
next provider.
Only one instance of this class should exist in a system, the public no
argument constructor is meant for initialization by dependency injection systems
such as OSGi-DS. Applications should use the static getInstance()
method if they aren't using a framework that injects them the instance.
This class returns LockableMGraphs a subtype of MGraph
that allows read/write locks.
| Field Summary | |
|---|---|
protected QueryEngine |
queryEngine
|
| Constructor Summary | |
|---|---|
TcManager()
the constructor sets the singleton instance to allow instantiation by OSGi-DS. |
|
| Method Summary | |
|---|---|
protected void |
activate(org.osgi.service.component.ComponentContext componentContext)
|
protected void |
bindWeightedTcProvider(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 |
protected void |
deactivate(org.osgi.service.component.ComponentContext componentContext)
|
void |
deleteTripleCollection(UriRef name)
Deletes the Graph or MGraph of a specified name. |
boolean |
executeSparqlQuery(AskQuery query,
TripleCollection defaultGraph)
Executes a sparql ASK query. |
Graph |
executeSparqlQuery(ConstructQuery query,
TripleCollection defaultGraph)
Executes a sparql CONSTRUCT query. |
Graph |
executeSparqlQuery(DescribeQuery query,
TripleCollection defaultGraph)
Executes a sparql DESCRIBE query. |
Object |
executeSparqlQuery(Query query,
TripleCollection defaultGraph)
Executes any sparql query. |
ResultSet |
executeSparqlQuery(SelectQuery query,
TripleCollection defaultGraph)
Executes a sparql SELECT query. |
Graph |
getGraph(UriRef name)
Get a Graph by its name |
static TcManager |
getInstance()
This returns the singleton instance. |
LockableMGraph |
getMGraph(UriRef name)
Get an MGraph by its name. |
Set<UriRef> |
getNames(Graph graph)
get a set of the names of a Graph |
TcAccessController |
getTcAccessController()
|
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). |
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). |
protected void |
unbindWeightedTcProvider(WeightedTcProvider provider)
Unregister a provider |
| Methods inherited from class org.apache.clerezza.rdf.core.access.TcProviderMultiplexer |
|---|
addWeightedTcProvider, getProviderList, removeWeightedTcProvider |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
@Reference(policy=DYNAMIC,
cardinality=MANDATORY_UNARY)
protected QueryEngine queryEngine
| Constructor Detail |
|---|
public TcManager()
getInstance method should be used.
| Method Detail |
|---|
public static TcManager getInstance()
protected void activate(org.osgi.service.component.ComponentContext componentContext)
protected void deactivate(org.osgi.service.component.ComponentContext componentContext)
public Graph getGraph(UriRef name)
throws NoSuchEntityException
TcProviderGraph by its name
getGraph in interface TcProvidergetGraph in class TcProviderMultiplexername - the name of the Graph
Graph with the specified name
NoSuchEntityException - if there is no Graph
with the specified namepublic LockableMGraph getMGraph(UriRef name)
TcProviderMGraph by its name. The instances
returned in different invocations are equals.
getMGraph in interface TcProvidergetMGraph in class TcProviderMultiplexerMGraph with the specified namepublic TripleCollection getTriples(UriRef name)
TcProviderTripleCollection 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.
getTriples in interface TcProvidergetTriples in class TcProviderMultiplexername - the name of the Graph or MGraph
Graph or MGraph
public LockableMGraph createMGraph(UriRef name)
throws UnsupportedOperationException
TcProviderMGraph with a specified name
createMGraph in interface TcProvidercreateMGraph in class TcProviderMultiplexername - names the new MGraph
MGraph
UnsupportedOperationException - if this provider doesn't support
creating MGraphS
public Graph createGraph(UriRef name,
TripleCollection triples)
TcProviderGraph with a specified name
createGraph in interface TcProvidercreateGraph in class TcProviderMultiplexername - the name of the Graph to be createdtriples - the triples of the new Graph
Graphpublic void deleteTripleCollection(UriRef name)
TcProviderGraph 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.
deleteTripleCollection in interface TcProviderdeleteTripleCollection in class TcProviderMultiplexername - the entity to be removedpublic Set<UriRef> getNames(Graph graph)
TcProviderGraph
getNames in interface TcProvidergetNames in class TcProviderMultiplexerGraph, the set is empty if
Graph is unknownpublic Set<UriRef> listGraphs()
TcProviderGraphs available through this
TcProvider, implementations may take into account the
security context and omit Graphs for which access is not
allowed.
listGraphs in interface TcProviderlistGraphs in class TcProviderMultiplexerGraphspublic Set<UriRef> listMGraphs()
TcProviderMGraphs available through this
TcProvider, implementations may take into account the
security context and omit MGraphs for which access is not
allowed.
listMGraphs in interface TcProviderlistMGraphs in class TcProviderMultiplexerMGraphspublic Set<UriRef> listTripleCollections()
TcProviderTripleCollections 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.
listTripleCollections in interface TcProviderlistTripleCollections in class TcProviderMultiplexerTripleCollections
public Object executeSparqlQuery(Query query,
TripleCollection defaultGraph)
query - the sparql query to executedefaultGraph - the default graph against which to execute the query if not
FROM clause is present
public ResultSet executeSparqlQuery(SelectQuery query,
TripleCollection defaultGraph)
query - the sparql SELECT query to executedefaultGraph - the default graph against which to execute the query if not
FROM clause is present
public boolean executeSparqlQuery(AskQuery query,
TripleCollection defaultGraph)
query - the sparql ASK query to executedefaultGraph - the default graph against which to execute the query if not
FROM clause is present
public Graph executeSparqlQuery(DescribeQuery query,
TripleCollection defaultGraph)
query - the sparql DESCRIBE query to executedefaultGraph - the default graph against which to execute the query if not
FROM clause is present
public Graph executeSparqlQuery(ConstructQuery query,
TripleCollection defaultGraph)
query - the sparql CONSTRUCT query to executedefaultGraph - the default graph against which to execute the query if not
FROM clause is present
public TcAccessController getTcAccessController()
protected void bindWeightedTcProvider(WeightedTcProvider provider)
provider - the provider to be registeredprotected void unbindWeightedTcProvider(WeightedTcProvider provider)
provider - the provider to be deregisteredprotected void mGraphAppears(UriRef name)
TcProviderMultiplexer
mGraphAppears in class TcProviderMultiplexerprotected void graphAppears(UriRef name)
TcProviderMultiplexer
graphAppears in class TcProviderMultiplexerprotected void tcDisappears(UriRef name)
TcProviderMultiplexer
tcDisappears in class TcProviderMultiplexer
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||