Package org.bonitasoft.engine.connector
Class ConnectorServiceDecorator
- java.lang.Object
-
- org.bonitasoft.engine.connector.ConnectorServiceDecorator
-
- All Implemented Interfaces:
ConnectorService
public class ConnectorServiceDecorator extends java.lang.Object implements ConnectorService
This service wraps the connector service and add engine variables like apiAccessor, engineExecutionContext.- Author:
- Matthieu Chaffotte, Elias Ricken de Medeiros, Celine Souchet
-
-
Field Summary
-
Fields inherited from interface org.bonitasoft.engine.core.connector.ConnectorService
DONE, FAILED, SKIPPED, TO_BE_EXECUTED, TO_RE_EXECUTE
-
-
Constructor Summary
Constructors Constructor Description ConnectorServiceDecorator(ConnectorService connectorService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddConnectorImplementation(java.lang.Long processDefinitionId, java.lang.String name, byte[] content)voiddisconnect(ConnectorResult result)java.util.Map<java.lang.String,java.lang.Object>evaluateInputParameters(java.lang.String connectorId, java.util.Map<java.lang.String,SExpression> parameters, SExpressionContext sExpressionContext, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.io.Serializable>> inputValues)java.util.concurrent.CompletableFuture<ConnectorResult>executeConnector(long processDefinitionId, SConnectorInstance sConnectorInstance, SConnectorImplementationDescriptor connectorImplementationDescriptor, java.lang.ClassLoader classLoader, java.util.Map<java.lang.String,java.lang.Object> inputParameters)ConnectorResultexecuteMultipleEvaluation(long processDefinitionId, java.lang.String connectorDefinitionId, java.lang.String connectorDefinitionVersion, java.util.Map<java.lang.String,SExpression> connectorInputParameters, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.io.Serializable>> inputValues, java.lang.ClassLoader classLoader, SExpressionContext sexpContext)Execute a connector instance by given connectorDefinitionId and connectorDefinitionVersionvoidexecuteOutputOperation(java.util.List<SOperation> outputs, SExpressionContext expressionContext, ConnectorResult connectorOutput)SConnectorImplementationDescriptorgetConnectorImplementation(long processDefinitionId, java.lang.String connectorId, java.lang.String connectorVersion)Get connector implementation descriptor for specified connector in a process definition.SConnectorImplementationDescriptorgetConnectorImplementationDescriptor(long processDefinitionId, java.lang.String connectorId, java.lang.String version)java.util.List<SBARResource>getConnectorImplementations(long processDefinitionId, int from, int numberOfElements)java.util.List<SConnectorImplementationDescriptor>getConnectorImplementations(long processDefinitionId, int fromIndex, int numberPerPage, java.lang.String field, OrderByType order)Get a list of connector implementation descriptors for id specified process definition, the returned list is paginatedjava.lang.LonggetNumberOfConnectorImplementations(long processDefinitionId)booleanloadConnectors(SProcessDefinition sDefinition)Load connectors for given process definition and tenant, connectors will be stored in cache after loadingvoidremoveConnectorImplementations(long processDefinitionId)voidsetConnectorImplementation(SProcessDefinition sProcessDefinition, java.lang.String connectorId, java.lang.String connectorVersion, byte[] connectorImplementationArchive)Set connector implementation for id and version specified connector.
-
-
-
Constructor Detail
-
ConnectorServiceDecorator
public ConnectorServiceDecorator(ConnectorService connectorService)
-
-
Method Detail
-
executeMultipleEvaluation
public ConnectorResult executeMultipleEvaluation(long processDefinitionId, java.lang.String connectorDefinitionId, java.lang.String connectorDefinitionVersion, java.util.Map<java.lang.String,SExpression> connectorInputParameters, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.io.Serializable>> inputValues, java.lang.ClassLoader classLoader, SExpressionContext sexpContext) throws SConnectorException
Description copied from interface:ConnectorServiceExecute a connector instance by given connectorDefinitionId and connectorDefinitionVersion- Specified by:
executeMultipleEvaluationin interfaceConnectorService- Parameters:
processDefinitionId- The identifier of process definitionconnectorDefinitionId- The identifier of connector definitionconnectorDefinitionVersion- The version of connector definitionconnectorInputParameters- The input of connectorinputValues- The input values of connectorclassLoader- The class loader used to load and run connectorsexpContext- The expression context- Returns:
- The output after connector executing
- Throws:
SConnectorException- Error thrown if has exceptions during the connector executing
-
loadConnectors
public boolean loadConnectors(SProcessDefinition sDefinition) throws SConnectorException
Description copied from interface:ConnectorServiceLoad connectors for given process definition and tenant, connectors will be stored in cache after loading- Specified by:
loadConnectorsin interfaceConnectorService- Parameters:
sDefinition- The process definition- Returns:
- true if all connectors found have all them dependencies resolved and are correctly loaded
- Throws:
SConnectorException- Error thrown if has exceptions during the connector loading
-
setConnectorImplementation
public void setConnectorImplementation(SProcessDefinition sProcessDefinition, java.lang.String connectorId, java.lang.String connectorVersion, byte[] connectorImplementationArchive) throws SConnectorException, SInvalidConnectorImplementationException
Description copied from interface:ConnectorServiceSet connector implementation for id and version specified connector. Store all connector related files if they are not existed and replace the old implementation with the new one in file system. Delete former and load current connectors in cache.- Specified by:
setConnectorImplementationin interfaceConnectorService- Parameters:
sProcessDefinition- The process definition which the connector belongs toconnectorId- Id of connector definition.connectorVersion- Version of connector definitionconnectorImplementationArchive- zip byte array containing the connector implementation information- Throws:
SConnectorException- Error thrown if has exceptions during the connector implementation settingSInvalidConnectorImplementationException
-
getConnectorImplementations
public java.util.List<SConnectorImplementationDescriptor> getConnectorImplementations(long processDefinitionId, int fromIndex, int numberPerPage, java.lang.String field, OrderByType order) throws SConnectorException
Description copied from interface:ConnectorServiceGet a list of connector implementation descriptors for id specified process definition, the returned list is paginated- Specified by:
getConnectorImplementationsin interfaceConnectorService- Parameters:
processDefinitionId- Identifier of process definitionfromIndex- Start index of connector recordnumberPerPage- Number of connectors we want to get. Maximum number of connectors returned.field- The field that the result ordered byorder- The order, ACS or DESC- Returns:
- A list of all satisfied connector implementation descriptor objects
- Throws:
SConnectorException- Error thrown if has exceptions during the connector implementations retrieve
-
getConnectorImplementation
public SConnectorImplementationDescriptor getConnectorImplementation(long processDefinitionId, java.lang.String connectorId, java.lang.String connectorVersion) throws SConnectorException
Description copied from interface:ConnectorServiceGet connector implementation descriptor for specified connector in a process definition.- Specified by:
getConnectorImplementationin interfaceConnectorService- Parameters:
processDefinitionId- Identifier of process definitionconnectorId- id of connector definitionconnectorVersion- version of connector definition- Returns:
- connector implementation descriptor object
- Throws:
SConnectorException- Error thrown if has exceptions during the connector implementation get
-
evaluateInputParameters
public java.util.Map<java.lang.String,java.lang.Object> evaluateInputParameters(java.lang.String connectorId, java.util.Map<java.lang.String,SExpression> parameters, SExpressionContext sExpressionContext, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.io.Serializable>> inputValues) throws SExpressionTypeUnknownException, SExpressionEvaluationException, SExpressionDependencyMissingException, SInvalidExpressionException- Specified by:
evaluateInputParametersin interfaceConnectorService- Returns:
- Throws:
SExpressionTypeUnknownExceptionSExpressionEvaluationExceptionSExpressionDependencyMissingExceptionSInvalidExpressionException
-
executeOutputOperation
public void executeOutputOperation(java.util.List<SOperation> outputs, SExpressionContext expressionContext, ConnectorResult connectorOutput) throws SConnectorException
- Specified by:
executeOutputOperationin interfaceConnectorService- Throws:
SConnectorException
-
executeConnector
public java.util.concurrent.CompletableFuture<ConnectorResult> executeConnector(long processDefinitionId, SConnectorInstance sConnectorInstance, SConnectorImplementationDescriptor connectorImplementationDescriptor, java.lang.ClassLoader classLoader, java.util.Map<java.lang.String,java.lang.Object> inputParameters) throws SConnectorException
- Specified by:
executeConnectorin interfaceConnectorService- Returns:
- the result of the connector execution
- Throws:
SConnectorException
-
disconnect
public void disconnect(ConnectorResult result) throws SConnectorException
- Specified by:
disconnectin interfaceConnectorService- Throws:
SConnectorException
-
getNumberOfConnectorImplementations
public java.lang.Long getNumberOfConnectorImplementations(long processDefinitionId) throws SConnectorException- Specified by:
getNumberOfConnectorImplementationsin interfaceConnectorService- Parameters:
processDefinitionId- the id of the process definition- Returns:
- the number of connector implementation for this process definition
- Throws:
SConnectorException
-
getConnectorImplementations
public java.util.List<SBARResource> getConnectorImplementations(long processDefinitionId, int from, int numberOfElements) throws SBonitaReadException
- Specified by:
getConnectorImplementationsin interfaceConnectorService- Throws:
SBonitaReadException
-
addConnectorImplementation
public void addConnectorImplementation(java.lang.Long processDefinitionId, java.lang.String name, byte[] content) throws SRecorderException- Specified by:
addConnectorImplementationin interfaceConnectorService- Throws:
SRecorderException
-
removeConnectorImplementations
public void removeConnectorImplementations(long processDefinitionId) throws SBonitaReadException, SRecorderException- Specified by:
removeConnectorImplementationsin interfaceConnectorService- Throws:
SBonitaReadExceptionSRecorderException
-
getConnectorImplementationDescriptor
public SConnectorImplementationDescriptor getConnectorImplementationDescriptor(long processDefinitionId, java.lang.String connectorId, java.lang.String version) throws SConnectorException
- Specified by:
getConnectorImplementationDescriptorin interfaceConnectorService- Throws:
SConnectorException
-
-