com.tinkerpop.rexster
Class AbstractSubResource
java.lang.Object
com.tinkerpop.rexster.BaseResource
com.tinkerpop.rexster.AbstractSubResource
- Direct Known Subclasses:
- EdgeResource, GraphResource, IndexResource, KeyIndexResource, PrefixResource, VertexResource
public abstract class AbstractSubResource
- extends BaseResource
Method Summary |
protected static List<RexsterExtension> |
findExtensionClasses(ExtensionSegmentSet extensionSegmentSet)
Tries to find an extension given the specified namespace and extension name. |
protected static ExtensionMethod |
findExtensionMethod(List<RexsterExtension> rexsterExtensions,
ExtensionPoint extensionPoint,
String extensionAction,
HttpMethod httpMethodRequested)
Find the method on the RexsterExtension implementation to call given the ExtensionPoint and the
extension action to be executed. |
RexsterApplicationGraph |
getRexsterApplicationGraph(String graphName)
|
protected Object |
invokeExtension(RexsterApplicationGraph rexsterApplicationGraph,
ExtensionMethod methodToCall)
|
protected Object |
invokeExtension(RexsterApplicationGraph rexsterApplicationGraph,
ExtensionMethod methodToCall,
com.tinkerpop.blueprints.Edge edgeContext)
|
protected Object |
invokeExtension(RexsterApplicationGraph rexsterApplicationGraph,
ExtensionMethod methodToCall,
com.tinkerpop.blueprints.Edge edgeContext,
com.tinkerpop.blueprints.Vertex vertexContext)
|
protected Object |
invokeExtension(RexsterApplicationGraph rexsterApplicationGraph,
ExtensionMethod methodToCall,
com.tinkerpop.blueprints.Vertex vertexContext)
|
protected ExtensionSegmentSet |
parseUriForExtensionSegment(String graphName,
ExtensionPoint extensionPoint)
Reads the URI of the request and tries to parse the extension requested. |
protected ExtensionResponse |
tryAppendRexsterAttributesIfJson(ExtensionResponse extResponse,
ExtensionMethod methodToCall,
String mediaType)
|
Methods inherited from class com.tinkerpop.rexster.BaseResource |
buildOptionsResponse, buildOptionsResponse, generateErrorObject, generateErrorObject, generateErrorObjectJsonFail, getNonRexsterRequest, getNonRexsterRequestKeys, getRequestObject, getRequestObject, getRequestObjectFlat, getRexsterApplication, getTimeAlive, getUriPath, setRequestObject |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
extensionCache
protected static final Map<ExtensionSegmentSet,List<RexsterExtension>> extensionCache
AbstractSubResource
protected AbstractSubResource(RexsterApplication ra)
getRexsterApplicationGraph
public RexsterApplicationGraph getRexsterApplicationGraph(String graphName)
findExtensionClasses
protected static List<RexsterExtension> findExtensionClasses(ExtensionSegmentSet extensionSegmentSet)
- Tries to find an extension given the specified namespace and extension name. Extensions
are loaded using ServiceLoader so ensure that the RexsterExtension file in META-INF.services
has all required extension implementations.
This method tries to look for an ExtensionNaming annotation on the RexsterExtension
implementation and uses that for the namespace and extension name. If for some reason that
annotation cannot be found or if the annotation is only partially defined defaults are used.
The default for the names is the reserved "g" namespace which is "global". The default for
the extension name is the name of the class.
- Returns:
- The found extension instance or null if one cannot be found.
parseUriForExtensionSegment
protected ExtensionSegmentSet parseUriForExtensionSegment(String graphName,
ExtensionPoint extensionPoint)
- Reads the URI of the request and tries to parse the extension requested.
- Throws:
javax.ws.rs.WebApplicationException
- If the segment is an invalid format.
findExtensionMethod
protected static ExtensionMethod findExtensionMethod(List<RexsterExtension> rexsterExtensions,
ExtensionPoint extensionPoint,
String extensionAction,
HttpMethod httpMethodRequested)
- Find the method on the RexsterExtension implementation to call given the ExtensionPoint and the
extension action to be executed.
This method will find the first matching extension method. If multiple extension method matches then
the remainder will be ignored.
The logic of this method takes the following approach: match a method on the extension point and extension
method. Then match the method that has an action and matches an definition path or has no action and
and has no definition path. If no match is found there then the methods are cycled again to find a
match where there is an action and no definition path.
- Parameters:
rexsterExtensions
- The extension instance to be called.extensionPoint
- One of the extension points (graph, edge, vertex).extensionAction
- This value may be null or empty if the RexsterExtension is being exposed as a
root level call (ie. the ExtensionDefinition annotation does not specify a
path, just an ExtensionPoint).httpMethodRequested
- The HTTP method made on the request.
- Returns:
- The method to call or null if it cannot be found.
invokeExtension
protected Object invokeExtension(RexsterApplicationGraph rexsterApplicationGraph,
ExtensionMethod methodToCall)
throws IllegalAccessException,
InvocationTargetException
- Throws:
IllegalAccessException
InvocationTargetException
invokeExtension
protected Object invokeExtension(RexsterApplicationGraph rexsterApplicationGraph,
ExtensionMethod methodToCall,
com.tinkerpop.blueprints.Vertex vertexContext)
throws IllegalAccessException,
InvocationTargetException
- Throws:
IllegalAccessException
InvocationTargetException
invokeExtension
protected Object invokeExtension(RexsterApplicationGraph rexsterApplicationGraph,
ExtensionMethod methodToCall,
com.tinkerpop.blueprints.Edge edgeContext)
throws IllegalAccessException,
InvocationTargetException
- Throws:
IllegalAccessException
InvocationTargetException
invokeExtension
protected Object invokeExtension(RexsterApplicationGraph rexsterApplicationGraph,
ExtensionMethod methodToCall,
com.tinkerpop.blueprints.Edge edgeContext,
com.tinkerpop.blueprints.Vertex vertexContext)
throws IllegalAccessException,
InvocationTargetException
- Throws:
IllegalAccessException
InvocationTargetException
tryAppendRexsterAttributesIfJson
protected ExtensionResponse tryAppendRexsterAttributesIfJson(ExtensionResponse extResponse,
ExtensionMethod methodToCall,
String mediaType)
Copyright © 2009-2012. All Rights Reserved.