public class RelationService extends DefaultComponent implements RelationManager
It handles a registry of graph instances through extension points.
Modifier and Type | Field and Description |
---|---|
protected Map<String,GraphDescription> |
graphDescriptions
Graph name -> description
|
Map<String,GraphFactory> |
graphFactories
Graph name -> factory.
|
Map<String,Graph> |
graphRegistry
Graph name -> graph instance.
|
protected Map<String,Class<?>> |
graphTypes
Graph type -> class.
|
static ComponentName |
NAME |
protected Map<String,String> |
resourceAdapterRegistry |
lastModified
Constructor and Description |
---|
RelationService() |
Modifier and Type | Method and Description |
---|---|
void |
add(String graphName,
List<Statement> statements)
Deprecated.
|
void |
applicationStarted(ComponentContext context)
Notify the component that Nuxeo Framework finished starting all Nuxeo bundles.
|
void |
clear(String graphName)
Deprecated.
|
<T> T |
getAdapter(Class<T> adapter)
Returns an object which is an instance of the given class associated with this object.
|
Set<Resource> |
getAllResources(Serializable object,
Map<String,Object> context)
Computes all resources corresponding to the given object.
|
Graph |
getGraph(String name,
CoreSession session)
Gets a registered graph by name.
|
Graph |
getGraphByName(String name)
Gets a registered graph by name.
|
protected Graph |
getGraphFromRegistries(GraphDescription graphDescription,
CoreSession session)
Gets the graph from the registries.
|
List<String> |
getGraphNames()
Gets the list containing the graph names.
|
List<String> |
getGraphTypes() |
List<Node> |
getObjects(String graphName,
Node subject,
Node predicate)
Deprecated.
|
List<Node> |
getPredicates(String graphName,
Node subject,
Node object)
Deprecated.
|
Resource |
getResource(String namespace,
Serializable object,
Map<String,Object> context)
Gets a resource given a namespace and a serializable object.
|
Serializable |
getResourceRepresentation(String namespace,
Resource resource,
Map<String,Object> context)
Gets an object representing this resource given a namespace.
|
List<Statement> |
getStatements(String graphName)
Deprecated.
|
List<Statement> |
getStatements(String graphName,
Statement statement)
Deprecated.
|
List<Node> |
getSubjects(String graphName,
Node predicate,
Node object)
Deprecated.
|
Graph |
getTransientGraph(String type)
Gets a transient graph.
|
boolean |
hasResource(String graphName,
Resource resource)
Deprecated.
|
boolean |
hasStatement(String graphName,
Statement statement)
Deprecated.
|
protected Graph |
newGraph(String className) |
QueryResult |
query(String graphName,
String queryString,
String language,
String baseURI)
Deprecated.
|
boolean |
read(String graphName,
InputStream in,
String lang,
String base)
Deprecated.
|
void |
registerContribution(Object contribution,
String extensionPoint,
ComponentInstance contributor) |
protected void |
registerGraph(Object contribution)
Registers a graph instance.
|
void |
remove(String graphName,
List<Statement> statements)
Deprecated.
|
Long |
size(String graphName)
Deprecated.
|
void |
unregisterContribution(Object contribution,
String extensionPoint,
ComponentInstance contributor) |
protected void |
unregisterGraph(Object contribution)
Unregisters a graph.
|
boolean |
write(String graphName,
OutputStream out,
String lang,
String base)
Deprecated.
|
activate, deactivate, getApplicationStartedOrder, getLastModified, registerExtension, setLastModified, setModifiedNow, unregisterExtension
public static final ComponentName NAME
protected final Map<String,Class<?>> graphTypes
protected final Map<String,GraphDescription> graphDescriptions
public final Map<String,GraphFactory> graphFactories
public final Map<String,Graph> graphRegistry
protected final Map<String,String> resourceAdapterRegistry
public RelationService()
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
registerContribution
in class DefaultComponent
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
unregisterContribution
in class DefaultComponent
public <T> T getAdapter(Class<T> adapter)
Adaptable
null
if no such object can be found.getAdapter
in interface Adaptable
getAdapter
in class DefaultComponent
adapter
- the adapter class to look upnull
if this object does not have an adapter for
the given classpublic List<String> getGraphTypes()
protected void registerGraph(Object contribution)
The graph has to be declared as using a type already registered in the graph type registry.
protected void unregisterGraph(Object contribution)
public Graph getGraphByName(String name)
RelationManager
getGraphByName
in interface RelationManager
name
- string name of the graph used at registrationpublic Graph getGraph(String name, CoreSession session)
RelationManager
A CoreSession
should be passed to provide a context in which to store relations when using a "core"
graph.
getGraph
in interface RelationManager
name
- string name of the graph used at registrationsession
- the core sessionprotected Graph getGraphFromRegistries(GraphDescription graphDescription, CoreSession session)
public Graph getTransientGraph(String type)
RelationManager
getTransientGraph
in interface RelationManager
type
- The graph type.public Resource getResource(String namespace, Serializable object, Map<String,Object> context)
RelationManager
There can be several resources with different namespaces associated to an incoming object. A document can for instance be used to refer to itself as a precise version as well as to the set of all versions.
Context can hold any object useful for the adapters, like a CoreSession
.
getResource
in interface RelationManager
public Set<Resource> getAllResources(Serializable object, Map<String,Object> context)
RelationManager
Context can hold any object useful for the adapters, like a CoreSession
.
getAllResources
in interface RelationManager
public Serializable getResourceRepresentation(String namespace, Resource resource, Map<String,Object> context)
RelationManager
Context can hold any object useful for the adapters, like a CoreSession
.
getResourceRepresentation
in interface RelationManager
@Deprecated public void add(String graphName, List<Statement> statements)
add
in interface RelationManager
Graph.add(org.nuxeo.ecm.platform.relations.api.Statement)
@Deprecated public void clear(String graphName)
clear
in interface RelationManager
Graph.clear()
@Deprecated public List<Node> getObjects(String graphName, Node subject, Node predicate)
getObjects
in interface RelationManager
Graph.getObjects(org.nuxeo.ecm.platform.relations.api.Node, org.nuxeo.ecm.platform.relations.api.Node)
@Deprecated public List<Node> getPredicates(String graphName, Node subject, Node object)
getPredicates
in interface RelationManager
Graph.getPredicates(org.nuxeo.ecm.platform.relations.api.Node, org.nuxeo.ecm.platform.relations.api.Node)
@Deprecated public List<Statement> getStatements(String graphName, Statement statement)
getStatements
in interface RelationManager
Graph.getStatements()
@Deprecated public List<Statement> getStatements(String graphName)
getStatements
in interface RelationManager
Graph.getStatements()
@Deprecated public List<Node> getSubjects(String graphName, Node predicate, Node object)
getSubjects
in interface RelationManager
Graph.getSubjects(org.nuxeo.ecm.platform.relations.api.Node, org.nuxeo.ecm.platform.relations.api.Node)
@Deprecated public boolean hasResource(String graphName, Resource resource)
hasResource
in interface RelationManager
Graph.hasResource(org.nuxeo.ecm.platform.relations.api.Resource)
@Deprecated public boolean hasStatement(String graphName, Statement statement)
hasStatement
in interface RelationManager
Graph.hasStatement(org.nuxeo.ecm.platform.relations.api.Statement)
@Deprecated public QueryResult query(String graphName, String queryString, String language, String baseURI)
query
in interface RelationManager
Graph.query(java.lang.String, java.lang.String, java.lang.String)
@Deprecated public boolean read(String graphName, InputStream in, String lang, String base)
read
in interface RelationManager
Graph.read(java.lang.String, java.lang.String, java.lang.String)
@Deprecated public void remove(String graphName, List<Statement> statements)
remove
in interface RelationManager
Graph.remove(org.nuxeo.ecm.platform.relations.api.Statement)
@Deprecated public Long size(String graphName)
size
in interface RelationManager
Graph.size()
@Deprecated public boolean write(String graphName, OutputStream out, String lang, String base)
write
in interface RelationManager
Graph.write(java.lang.String, java.lang.String, java.lang.String)
public List<String> getGraphNames()
RelationManager
getGraphNames
in interface RelationManager
public void applicationStarted(ComponentContext context)
Component
applicationStarted
in interface Component
applicationStarted
in class DefaultComponent
Copyright © 2016 Nuxeo SA. All rights reserved.