Package org.apache.solr.api
Class AnnotatedApi
- java.lang.Object
-
- org.apache.solr.api.Api
-
- org.apache.solr.api.AnnotatedApi
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,SpecProvider
,PermissionNameProvider
public class AnnotatedApi extends Api implements PermissionNameProvider, Closeable
This class implements an Api just from an annotated java class The class must have an annotationEndPoint
Each method must have an annotationCommand
The methods that implement a command should have the first 2 parametersSolrQueryRequest
andSolrQueryResponse
or it may optionally have a third parameter which could be a java class annotated with jackson annotations. The third parameter is only valid if it is using a json command payload
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.solr.security.PermissionNameProvider
PermissionNameProvider.Name
-
-
Field Summary
Fields Modifier and Type Field Description static String
ERR
-
Fields inherited from class org.apache.solr.api.Api
commandSchema, spec
-
Fields inherited from interface org.apache.solr.security.PermissionNameProvider
ANY, NULL, values
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AnnotatedApi(SpecProvider specProvider, EndPoint endPoint, Map<String,org.apache.solr.api.AnnotatedApi.Cmd> commands, Api fallback)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
call(SolrQueryRequest req, SolrQueryResponse rsp)
The method that gets called for each requestvoid
close()
static Map<String,Object>
createSchema(Method m)
static List<Api>
getApis(Class<?> theClass, Object obj, boolean allowEmpty)
Get a list of Api-s supported by this class.static List<Api>
getApis(Object obj)
Map<String,org.apache.solr.api.AnnotatedApi.Cmd>
getCommands()
EndPoint
getEndPoint()
PermissionNameProvider.Name
getPermissionName(AuthorizationContext request)
-
Methods inherited from class org.apache.solr.api.Api
getCommandSchema, getSpec
-
-
-
-
Field Detail
-
ERR
public static final String ERR
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AnnotatedApi
protected AnnotatedApi(SpecProvider specProvider, EndPoint endPoint, Map<String,org.apache.solr.api.AnnotatedApi.Cmd> commands, Api fallback)
-
-
Method Detail
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
getEndPoint
public EndPoint getEndPoint()
-
getApis
public static List<Api> getApis(Class<?> theClass, Object obj, boolean allowEmpty)
Get a list of Api-s supported by this class.- Parameters:
theClass
- classobj
- object of this class (may be null)allowEmpty
- if false then an exception is thrown if no Api-s can be retrieved, if true then absence of Api-s is silently ignored.- Returns:
- list of discovered Api-s
-
getPermissionName
public PermissionNameProvider.Name getPermissionName(AuthorizationContext request)
- Specified by:
getPermissionName
in interfacePermissionNameProvider
-
call
public void call(SolrQueryRequest req, SolrQueryResponse rsp)
Description copied from class:Api
The method that gets called for each request
-
-