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, name| Constructor and Description | 
|---|
RelationService()  | 
| Modifier and Type | Method and Description | 
|---|---|
<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()  | 
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. 
 | 
Graph | 
getTransientGraph(String type)
Gets a transient graph. 
 | 
protected Graph | 
newGraph(String className)  | 
void | 
registerContribution(Object contribution,
                    String extensionPoint,
                    ComponentInstance contributor)  | 
protected void | 
registerGraph(Object contribution)
Registers a graph instance. 
 | 
void | 
start(ComponentContext context)
Start the component. 
 | 
void | 
unregisterContribution(Object contribution,
                      String extensionPoint,
                      ComponentInstance contributor)  | 
protected void | 
unregisterGraph(Object contribution)
Unregisters a graph. 
 | 
activate, deactivate, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerExtension, setLastModified, setModifiedNow, setName, stop, unregister, unregisterExtensionclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitapplicationStarted, getApplicationStartedOrderpublic 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 DefaultComponentpublic void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
unregisterContribution in class DefaultComponentpublic <T> T getAdapter(Class<T> adapter)
Adaptablenull
 if no such object can be found.getAdapter in interface AdaptablegetAdapter in class DefaultComponentadapter - 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)
RelationManagergetGraphByName in interface RelationManagername - 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 RelationManagername - string name of the graph used at registrationsession - the core sessionprotected Graph getGraphFromRegistries(GraphDescription graphDescription, CoreSession session)
public Graph getTransientGraph(String type)
RelationManagergetTransientGraph in interface RelationManagertype - The graph type.public Resource getResource(String namespace, Serializable object, Map<String,Object> context)
RelationManagerThere 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 RelationManagerpublic 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 RelationManagerpublic 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 RelationManagerpublic List<String> getGraphNames()
RelationManagergetGraphNames in interface RelationManagerpublic void start(ComponentContext context)
Componentstart in interface Componentstart in class DefaultComponentCopyright © 2019 Nuxeo. All rights reserved.