@Path(value="session") public class SessionResource extends Object
Constructor and Description |
---|
SessionResource()
Instantiates a new session resource.
|
Modifier and Type | Method and Description |
---|---|
APIResult |
addResource(LensSessionHandle sessionid,
String type,
String path)
Add a resource to the session to all LensServices running in this Lens server
|
APIResult |
clearIdleSessions()
Clears idle sessions.
|
APIResult |
closeSession(LensSessionHandle sessionid)
Close a Lens server session.
|
APIResult |
deleteResource(LensSessionHandle sessionid,
String type,
String path)
Delete a resource from sesssion from all the @{link LensService}s running in this Lens server
|
String |
getMessage()
API to know if session service is up and running
|
StringList |
getParams(LensSessionHandle sessionid,
boolean verbose,
String key)
Get a list of key=value parameters set for this session.
|
List<UserSessionInfo> |
getSessionInfo()
Returns a list of all sessions
|
StringList |
listResources(LensSessionHandle sessionid,
String type)
Lists resources from the session for a given resource type.
|
LensSessionHandle |
openSession(String username,
String password,
String database,
LensConf sessionconf)
Create a new session with Lens server.
|
APIResult |
setParam(LensSessionHandle sessionid,
String key,
String value)
Set value for a parameter specified by key
|
public SessionResource() throws LensException
LensException
- the lens exception@GET @Produces(value="text/plain") public String getMessage()
@POST @Consumes(value="multipart/form-data") @Produces(value={"application/xml","application/json","text/plain"}) public LensSessionHandle openSession(String username, String password, @DefaultValue(value="") String database, LensConf sessionconf) throws LensException
username
- User name of the Lens server userpassword
- Password of the Lens server userdatabase
- Set current database to the supplied value, if providedsessionconf
- Key-value properties which will be used to configure this sessionLensException
@DELETE @Produces(value={"application/xml","application/json","text/plain"}) public APIResult closeSession(@QueryParam(value="sessionid") LensSessionHandle sessionid)
sessionid
- Session handle object of the session to be closed@PUT @Path(value="resources/add") @Consumes(value="multipart/form-data") @Produces(value={"application/xml","application/json","text/plain"}) public APIResult addResource(LensSessionHandle sessionid, String type, String path)
The returned @{link APIResult} will have status SUCCEEDED only if the add operation was successful for all services running in this Lens server.
sessionid
- session handle objecttype
- The type of resource. Valid types are 'jar', 'file' and 'archive'path
- path of the resourceAPIResult
with state APIResult.Status.SUCCEEDED
, if add was successful. APIResult
with state
APIResult.Status.PARTIAL
, if add succeeded only for some services. APIResult
with state
APIResult.Status.FAILED
, if add has failed@GET @Path(value="resources/list") @Produces(value={"application/xml","application/json","text/plain"}) public StringList listResources(@QueryParam(value="sessionid") LensSessionHandle sessionid, @QueryParam(value="type") String type)
sessionid
- session handle objecttype
- resource type. It can be jar, file or null@PUT @Path(value="resources/delete") @Consumes(value="multipart/form-data") @Produces(value={"application/xml","application/json","text/plain"}) public APIResult deleteResource(LensSessionHandle sessionid, String type, String path)
Similar to addResource, this call is successful only if resource was deleted from all services.
sessionid
- session handle objecttype
- The type of resource. Valid types are 'jar', 'file' and 'archive'path
- path of the resource to be deletedAPIResult
with state APIResult.Status.SUCCEEDED
, if delete was successful. APIResult
with
state APIResult.Status.PARTIAL
, if delete succeeded only for some services. APIResult
with state
APIResult.Status.FAILED
, if delete has failed@GET @Path(value="params") @Produces(value={"application/xml","application/json","text/plain"}) public StringList getParams(@QueryParam(value="sessionid") LensSessionHandle sessionid, @DefaultValue(value="false") @QueryParam(value="verbose") boolean verbose, @DefaultValue(value="") @QueryParam(value="key") String key)
sessionid
- session handle objectverbose
- If true, all the parameters will be returned. If false, configuration parameters will be returnedkey
- if this is empty, output will contain all parameters and their values,
if it is non empty parameters will be filtered by key@PUT @Path(value="params") @Produces(value={"application/xml","application/json","text/plain"}) public APIResult setParam(LensSessionHandle sessionid, String key, String value)
sessionid
- session handle objectkey
- parameter keyvalue
- parameter value@GET @Path(value="sessions") @Produces(value={"application/xml","application/json","text/plain"}) public List<UserSessionInfo> getSessionInfo()
@DELETE @Path(value="sessions") @Produces(value={"application/xml","application/json","text/plain"}) public APIResult clearIdleSessions() throws LensException
LensException
Copyright © 2014–2018 Apache Software Foundation. All rights reserved.