Class ConnectorServiceImpl
java.lang.Object
org.bonitasoft.engine.core.connector.impl.ConnectorServiceImpl
- All Implemented Interfaces:
ConnectorService
- Author:
- Baptiste Mesta, Yanyan Liu, Matthieu Chaffotte, Elias Ricken de Medeiros, Celine Souchet
-
Field Summary
FieldsFields inherited from interface org.bonitasoft.engine.core.connector.ConnectorService
DONE, FAILED, SKIPPED, TO_BE_EXECUTED, TO_RE_EXECUTE -
Constructor Summary
ConstructorsConstructorDescriptionConnectorServiceImpl(CacheService cacheService, ConnectorExecutor connectorExecutor, ExpressionResolverService expressionResolverService, OperationService operationService, DependencyService dependencyService, ClassLoaderService classLoaderService, TimeTracker timeTracker, ProcessResourcesService processResourcesService, ConnectorExecutionTimeLogger connectorExecutionTimeLogger) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConnectorImplementation(Long processDefinitionId, String name, byte[] content) protected StringbuildConnectorImplementationKey(long rootDefinitionId, String connectorId, String version) protected voidcheckConnectorImplementationIsValid(org.bonitasoft.engine.core.connector.parser.SConnectorImplementationDescriptor connectorImplementationDescriptor, String connectorId, String connectorVersion) voiddisconnect(ConnectorResult result) evaluateInputParameters(String connectorId, Map<String, SExpression> parameters, SExpressionContext sExpressionContext, Map<String, Map<String, Serializable>> inputValues) executeConnector(long processDefinitionId, SConnectorInstance sConnectorInstance, org.bonitasoft.engine.core.connector.parser.SConnectorImplementationDescriptor connectorImplementationDescriptor, ClassLoader classLoader, Map<String, Object> inputParameters) executeMultipleEvaluation(long processDefinitionId, String connectorDefinitionId, String connectorDefinitionVersion, Map<String, SExpression> connectorInputParameters, Map<String, Map<String, Serializable>> inputValues, ClassLoader classLoader, SExpressionContext expressionContext) Execute a connector instance by given connectorDefinitionId and connectorDefinitionVersionvoidexecuteOutputOperation(List<SOperation> outputs, SExpressionContext expressionContext, ConnectorResult result) org.bonitasoft.engine.core.connector.parser.SConnectorImplementationDescriptorgetConnectorImplementation(long processDefinitionId, String connectorId, String connectorVersion) Get connector implementation descriptor for specified connector in a process definition.org.bonitasoft.engine.core.connector.parser.SConnectorImplementationDescriptorgetConnectorImplementationDescriptor(long processDefinitionId, String connectorId, String version) getConnectorImplementations(long processDefinitionId, int from, int numberOfElements) List<org.bonitasoft.engine.core.connector.parser.SConnectorImplementationDescriptor>getConnectorImplementations(long processDefinitionId, int fromIndex, int numberPerPage, String field, OrderByType order) Get a list of connector implementation descriptors for id specified process definition, the returned list is paginatedgetNumberOfConnectorImplementations(long processDefinitionId) protected booleanloadConnectors(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, String connectorId, String connectorVersion, byte[] connectorImplementationArchive) Set connector implementation for id and version specified connector.
-
Field Details
-
CONNECTOR_CACHE_NAME
- See Also:
-
-
Constructor Details
-
ConnectorServiceImpl
public ConnectorServiceImpl(CacheService cacheService, ConnectorExecutor connectorExecutor, ExpressionResolverService expressionResolverService, OperationService operationService, DependencyService dependencyService, ClassLoaderService classLoaderService, TimeTracker timeTracker, ProcessResourcesService processResourcesService, ConnectorExecutionTimeLogger connectorExecutionTimeLogger)
-
-
Method Details
-
executeConnector
public CompletableFuture<ConnectorResult> executeConnector(long processDefinitionId, SConnectorInstance sConnectorInstance, org.bonitasoft.engine.core.connector.parser.SConnectorImplementationDescriptor connectorImplementationDescriptor, ClassLoader classLoader, Map<String, Object> inputParameters) throws SConnectorException- Specified by:
executeConnectorin interfaceConnectorService- Returns:
- the result of the connector execution
- Throws:
SConnectorException
-
getConnectorImplementationDescriptor
public org.bonitasoft.engine.core.connector.parser.SConnectorImplementationDescriptor getConnectorImplementationDescriptor(long processDefinitionId, String connectorId, String version) throws SConnectorException - Specified by:
getConnectorImplementationDescriptorin interfaceConnectorService- Throws:
SConnectorException
-
executeOutputOperation
public void executeOutputOperation(List<SOperation> outputs, SExpressionContext expressionContext, ConnectorResult result) throws SConnectorException - Specified by:
executeOutputOperationin interfaceConnectorService- Throws:
SConnectorException
-
disconnect
- Specified by:
disconnectin interfaceConnectorService- Throws:
SConnectorException
-
buildConnectorImplementationKey
-
executeMultipleEvaluation
public ConnectorResult executeMultipleEvaluation(long processDefinitionId, String connectorDefinitionId, String connectorDefinitionVersion, Map<String, SExpression> connectorInputParameters, Map<String, throws SConnectorExceptionMap<String, Serializable>> inputValues, ClassLoader classLoader, SExpressionContext expressionContext) 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 connectorexpressionContext- The expression context- Returns:
- The output after connector executing
- Throws:
SConnectorException- Error thrown if has exceptions during the connector executing
-
evaluateInputParameters
public Map<String,Object> evaluateInputParameters(String connectorId, Map<String, SExpression> parameters, SExpressionContext sExpressionContext, Map<String, throws SExpressionTypeUnknownException, SExpressionEvaluationException, SExpressionDependencyMissingException, SInvalidExpressionExceptionMap<String, Serializable>> inputValues) - Specified by:
evaluateInputParametersin interfaceConnectorService- Returns:
- Throws:
SExpressionTypeUnknownExceptionSExpressionEvaluationExceptionSExpressionDependencyMissingExceptionSInvalidExpressionException
-
loadConnectors
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
-
loadConnectors
- Throws:
SConnectorException
-
setConnectorImplementation
public void setConnectorImplementation(SProcessDefinition sProcessDefinition, String connectorId, 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
-
checkConnectorImplementationIsValid
protected void checkConnectorImplementationIsValid(org.bonitasoft.engine.core.connector.parser.SConnectorImplementationDescriptor connectorImplementationDescriptor, String connectorId, String connectorVersion) throws SConnectorException, SInvalidConnectorImplementationException -
getNumberOfConnectorImplementations
public 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 List<org.bonitasoft.engine.core.connector.parser.SConnectorImplementationDescriptor> getConnectorImplementations(long processDefinitionId, int fromIndex, int numberPerPage, 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 org.bonitasoft.engine.core.connector.parser.SConnectorImplementationDescriptor getConnectorImplementation(long processDefinitionId, String connectorId, 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
-
getConnectorImplementations
public List<SBARResource> getConnectorImplementations(long processDefinitionId, int from, int numberOfElements) throws SBonitaReadException - Specified by:
getConnectorImplementationsin interfaceConnectorService- Throws:
SBonitaReadException
-
addConnectorImplementation
public void addConnectorImplementation(Long processDefinitionId, 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
-