Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.automation.client.jaxrs.spi
Class JavaSession

java.lang.Object
  extended by org.nuxeo.ecm.automation.client.jaxrs.spi.JavaSession
All Implemented Interfaces:
Session

public abstract class JavaSession
extends Object
implements Session

Abstract class for sessions running on real JVMs.

When your implementation is designed for running in environment that supports limited Java API like GWT or portable devices you may need to directly implement the Session interface.

Author:
Bogdan Stefanescu

Constructor Summary
JavaSession(JavaClient client, LoginInfo login, OperationRegistry registry)
           
 
Method Summary
 void close()
          Remove any resources held by this session.
 void execute(OperationRequest request, AsyncCallback<Object> cb)
           
<T> T
getAdapter(Class<T> type)
          Get an adapter of the current session.
 AutomationClient getClient()
          Get the client that created this session.
 void getFile(String path, AsyncCallback<Blob> cb)
           
 void getFiles(String path, AsyncCallback<Blobs> cb)
           
 LoginInfo getLogin()
          Get the login used to authenticate against the server
 OperationDocumentation getOperation(String id)
           
 Map<String,OperationDocumentation> getOperations()
           
 OperationRequest newRequest(String id)
          Create a new operation request given an operation ID.
 OperationRequest newRequest(String id, Map<String,Object> ctx)
          Create a new operation request given an operation ID and an operation context map.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.nuxeo.ecm.automation.client.Session
execute, getFile, getFiles
 

Constructor Detail

JavaSession

public JavaSession(JavaClient client,
                   LoginInfo login,
                   OperationRegistry registry)
Method Detail

getClient

public AutomationClient getClient()
Description copied from interface: Session
Get the client that created this session.

Specified by:
getClient in interface Session
Returns:
the client. cannot be null.

getLogin

public LoginInfo getLogin()
Description copied from interface: Session
Get the login used to authenticate against the server

Specified by:
getLogin in interface Session
Returns:
the login. cannot be null.

getAdapter

public <T> T getAdapter(Class<T> type)
Description copied from interface: Session
Get an adapter of the current session. Adapters can be used to define custom API over a Nuxeo Automation Session.

Optional operation. Environments that cannot support this method (like GWT) must throw UnsupportedOperationException

Specified by:
getAdapter in interface Session
See Also:
AutomationClient.getAdapter(Object, Class)

execute

public void execute(OperationRequest request,
                    AsyncCallback<Object> cb)
Specified by:
execute in interface Session

getFile

public void getFile(String path,
                    AsyncCallback<Blob> cb)
             throws Exception
Specified by:
getFile in interface Session
Throws:
Exception

getFiles

public void getFiles(String path,
                     AsyncCallback<Blobs> cb)
              throws Exception
Specified by:
getFiles in interface Session
Throws:
Exception

newRequest

public OperationRequest newRequest(String id)
                            throws Exception
Description copied from interface: Session
Create a new operation request given an operation ID.

Specified by:
newRequest in interface Session
Parameters:
id - the ID of the operation to be executed.
Returns:
the operation request
Throws:
Exception

newRequest

public OperationRequest newRequest(String id,
                                   Map<String,Object> ctx)
                            throws Exception
Description copied from interface: Session
Create a new operation request given an operation ID and an operation context map.

Specified by:
newRequest in interface Session
Parameters:
id - the operation id
ctx - the context map to be used when executing the operation on the server.
Returns:
the operation request
Throws:
Exception

getOperation

public OperationDocumentation getOperation(String id)
Specified by:
getOperation in interface Session

getOperations

public Map<String,OperationDocumentation> getOperations()
Specified by:
getOperations in interface Session

close

public void close()
Description copied from interface: Session
Remove any resources held by this session. The session will no more be used again.

Specified by:
close in interface Session

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.