Nuxeo ECM Projects 5.4.3-SNAPSHOT

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

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

public class DefaultSession
extends Object
implements Session

Author:
Bogdan Stefanescu

Constructor Summary
DefaultSession(AbstractAutomationClient client, Connector connector, LoginInfo login)
           
 
Method Summary
 void close()
          Remove any resources held by this session.
 Object execute(OperationRequest request)
           
 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.
 Connector getConnector()
           
 Blob getFile(String path)
          Get a file from the server given a path identifying the file.
 void getFile(String path, AsyncCallback<Blob> cb)
           
 Blobs getFiles(String path)
          Get a collection of files from the server given the path identifying the collection.
 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
 

Constructor Detail

DefaultSession

public DefaultSession(AbstractAutomationClient client,
                      Connector connector,
                      LoginInfo login)
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.

getConnector

public Connector getConnector()

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 Object execute(OperationRequest request)
               throws Exception
Specified by:
execute in interface Session
Throws:
Exception

execute

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

getFile

public Blob getFile(String path)
             throws Exception
Description copied from interface: Session
Get a file from the server given a path identifying the file.

Specified by:
getFile in interface Session
Parameters:
path - the file path
Returns:
a blob representation of the file
Throws:
Exception

getFiles

public Blobs getFiles(String path)
               throws Exception
Description copied from interface: Session
Get a collection of files from the server given the path identifying the collection.

Specified by:
getFiles in interface Session
Parameters:
path - the file path
Returns:
a collection of files represented as blobs.
Throws:
Exception

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.