public class AsyncSession extends Object implements Session
Modifier and Type | Class and Description |
---|---|
class |
AsyncSession.AsyncRequest
Asynchronous pooling based request
|
class |
AsyncSession.CompletableRequest
Request providing a completable call method for convenience.
|
Modifier and Type | Field and Description |
---|---|
protected static ExecutorService |
executor |
protected DefaultSession |
session |
Constructor and Description |
---|
AsyncSession(DefaultSession session) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Remove any resources held by this session.
|
Object |
execute(OperationRequest request) |
<T> T |
getAdapter(Class<T> type)
Get an adapter of the current session.
|
AutomationClient |
getClient()
Get the client that created this session.
|
Connector |
getConnector() |
String |
getDefaultSchemas()
Get the default schemas that should be sent by the server.
|
Blob |
getFile(String path)
Get a file from the server given a path identifying the file.
|
Blobs |
getFiles(String path)
Get a collection of files from the server given the path identifying the collection.
|
LoginInfo |
getLogin()
Get the login used to authenticate against the server
|
OperationDocumentation |
getOperation(String id) |
Map<String,OperationDocumentation> |
getOperations() |
Session |
getSession() |
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.
|
void |
setDefaultSchemas(String defaultSchemas)
Set the default schemas that should be sent by the server.
|
protected static ExecutorService executor
protected final DefaultSession session
public AsyncSession(DefaultSession session)
public Session getSession()
public AutomationClient getClient()
Session
public LoginInfo getLogin()
Session
public OperationRequest newRequest(String id)
Session
newRequest
in interface Session
id
- the ID of the operation to be executed.public OperationRequest newRequest(String id, Map<String,Object> ctx)
Session
newRequest
in interface Session
id
- the operation idctx
- the context map to be used when executing the operation on the server.public Object execute(OperationRequest request) throws IOException
execute
in interface Session
IOException
public Blob getFile(String path) throws IOException
Session
getFile
in interface Session
path
- the file pathIOException
public Blobs getFiles(String path) throws IOException
Session
getFiles
in interface Session
path
- the file pathIOException
public OperationDocumentation getOperation(String id)
getOperation
in interface Session
public Map<String,OperationDocumentation> getOperations()
getOperations
in interface Session
public <T> T getAdapter(Class<T> type)
Session
Optional operation. Environments that cannot support this method (like GWT) must throw
UnsupportedOperationException
getAdapter
in interface Session
AutomationClient#getAdapter(Object, Class)
public String getDefaultSchemas()
Session
This is a comma separated String (ex: dublincore,file)
default value is null (let the server decide what to send)
when Automation server convert the Documents to JSON, it will use this list to select what properties should be sent. You can explicitly set the X-NXDocumentProperties header at request level. If defaultSchemas, the request that don't already have the header set will inherit the default value.
getDefaultSchemas
in interface Session
public void setDefaultSchemas(String defaultSchemas)
Session
This is a comma separated String (ex: dublincore,file)
when Automation server convert the Documents to JSON, it will use this list to select what properties should be sent. You can explicitly set the X-NXDocumentProperties header at request level. If defaultSchemas, the request that don't already have the header set will inherit the default value.
setDefaultSchemas
in interface Session
defaultSchemas
- list of schemas as a comma separated stringpublic void close()
Session
public Connector getConnector()
Copyright © 2019 Nuxeo. All rights reserved.