Class DefaultLifecycleService
- java.lang.Object
- 
- com.snowflake.connectors.application.lifecycle.DefaultLifecycleService
 
- 
- All Implemented Interfaces:
- LifecycleService
 
 public class DefaultLifecycleService extends Object implements LifecycleService Default implementation ofLifecycleService.
- 
- 
Field Summary- 
Fields inherited from interface com.snowflake.connectors.application.lifecycle.LifecycleServiceROLLBACK_CODE, UNKNOWN_ERROR_CODE
 
- 
 - 
Constructor SummaryConstructors Constructor Description DefaultLifecycleService(PrivilegeTools privilegeTools, ConnectorStatusService statusService, ConnectorStatus statusAfterRollback)Creates a newDefaultLifecycleService.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidupdateStatus(ConnectorStatus status)Updates the connector status to a provided one.voidvalidateRequiredPrivileges()Validates whether the application instance has been granted all privileges necessary to run the lifecycle processes.voidvalidateStatus(ConnectorStatus... statuses)Validates if the current connector status contains provided ones.ConnectorResponsewithRollbackHandling(Supplier<ConnectorResponse> action)Executes the specified action with handling of rollback and unexpected errors.
 
- 
- 
- 
Constructor Detail- 
DefaultLifecycleServicepublic DefaultLifecycleService(PrivilegeTools privilegeTools, ConnectorStatusService statusService, ConnectorStatus statusAfterRollback) Creates a newDefaultLifecycleService.- Parameters:
- privilegeTools- privilege tools instance
- statusService- connector status service instance
- statusAfterRollback- connector status set after connector rollback
 
 
- 
 - 
Method Detail- 
validateStatuspublic void validateStatus(ConnectorStatus... statuses) Description copied from interface:LifecycleServiceValidates if the current connector status contains provided ones.- Specified by:
- validateStatusin interface- LifecycleService
- Parameters:
- statuses- expected connector statuses
 
 - 
updateStatuspublic void updateStatus(ConnectorStatus status) Description copied from interface:LifecycleServiceUpdates the connector status to a provided one.- Specified by:
- updateStatusin interface- LifecycleService
- Parameters:
- status- new connector status
 
 - 
validateRequiredPrivilegespublic void validateRequiredPrivileges() Description copied from interface:LifecycleServiceValidates whether the application instance has been granted all privileges necessary to run the lifecycle processes.- Specified by:
- validateRequiredPrivilegesin interface- LifecycleService
 
 - 
withRollbackHandlingpublic ConnectorResponse withRollbackHandling(Supplier<ConnectorResponse> action) Description copied from interface:LifecycleServiceExecutes the specified action with handling of rollback and unexpected errors.If a ROLLBACKcode was returned by the action - the connector status is updated accordingly and the action response is returned by this method.If an unexpected exception has been thrown during the action execution - a response with an UNKNOWN_ERRORcode is returned by this method.- Specified by:
- withRollbackHandlingin interface- LifecycleService
- Parameters:
- action- an action to execute
- Returns:
- a response with the code OKif the execution was successful, a response with the codeROLLBACKif the action performed a rollback operation, or a response with anUNKNOWN_ERRORcode and an error message
 
 
- 
 
-