Class InstanceLifecycleManagerImpl
java.lang.Object
com.sap.cds.feature.mt.lib.subscription.InstanceLifecycleManagerImpl
- All Implemented Interfaces:
InstanceLifecycleManager
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.sap.cds.feature.mt.lib.subscription.InstanceLifecycleManager
InstanceLifecycleManager.ContainerStatus
-
Field Summary
FieldsFields inherited from interface com.sap.cds.feature.mt.lib.subscription.InstanceLifecycleManager
DATABASE_ID
-
Method Summary
Modifier and TypeMethodDescriptionvoid
checkThatTenantExists
(String tenantId) Checks if a schema has been created for a tenantvoid
createAndGetLibContainers
(DataSourceInfo dataSourceInfo) Creates on the database used by the given datasource a hdi container/schema reserved of the library itself.void
createNewInstance
(String tenantId, ProvisioningParameters instanceParameters, BindingParameters bindingParameters) void
deleteInstance
(String tenantId) getAllTenantInfos
(boolean forceCacheUpdate) Returns all tenants that have a DB container/schema.getContainerStatus
(String tenantId) getDataSourceInfo
(String tenantId, boolean forceCacheUpdate) protected DataSourceInfo
getDataSourceInfoInternal
(String tenantId, boolean forceCacheUpdate) boolean
hasCredentials
(String tenantId, boolean forceCacheUpdate) Checks if the tenant has credentials for the schema.boolean
void
insertDbIdentifiers
(DbIdentifiers dbIdentifiers) boolean
static void
setBlockRefresh
(BooleanSupplier blockRefresh) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.sap.cds.feature.mt.lib.subscription.InstanceLifecycleManager
createProvisioningParameters, getAllTenants, getMtLibContainerName
-
Field Details
-
CREATION_SUCCEEDED
- See Also:
-
-
Method Details
-
createNewInstance
public void createNewInstance(String tenantId, ProvisioningParameters instanceParameters, BindingParameters bindingParameters) throws InternalError - Specified by:
createNewInstance
in interfaceInstanceLifecycleManager
- Throws:
InternalError
-
deleteInstance
- Specified by:
deleteInstance
in interfaceInstanceLifecycleManager
- Throws:
InternalError
-
getDataSourceInfo
public DataSourceInfo getDataSourceInfo(String tenantId, boolean forceCacheUpdate) throws InternalError, UnknownTenant - Specified by:
getDataSourceInfo
in interfaceInstanceLifecycleManager
- Throws:
InternalError
UnknownTenant
-
getDataSourceInfoInternal
protected DataSourceInfo getDataSourceInfoInternal(String tenantId, boolean forceCacheUpdate) throws InternalError, UnknownTenant - Throws:
InternalError
UnknownTenant
-
getContainerStatus
public InstanceLifecycleManager.ContainerStatus getContainerStatus(String tenantId) throws InternalError - Specified by:
getContainerStatus
in interfaceInstanceLifecycleManager
- Throws:
InternalError
-
hasCredentials
Description copied from interface:InstanceLifecycleManager
Checks if the tenant has credentials for the schema.- Specified by:
hasCredentials
in interfaceInstanceLifecycleManager
- Parameters:
tenantId
- identifier of tenant that is checkedforceCacheUpdate
- If set, the current tenant is re-determined.- Returns:
- true if credentials are available
- Throws:
InternalError
- is thrown if a problem occurs, if for example service manager cannot be accessed
-
getAllTenantInfos
Description copied from interface:InstanceLifecycleManager
Returns all tenants that have a DB container/schema. In contrast toInstanceLifecycleManager.getAllTenants(boolean)
this method provides additional tenant properties like database_id if available.- Specified by:
getAllTenantInfos
in interfaceInstanceLifecycleManager
- Parameters:
forceCacheUpdate
- If set, the current list of tenants is re-determined.- Returns:
- A map with all
TenantMetadata
. Tenant id is used as key. - Throws:
InternalError
-
checkThatTenantExists
Description copied from interface:InstanceLifecycleManager
Checks if a schema has been created for a tenant- Specified by:
checkThatTenantExists
in interfaceInstanceLifecycleManager
- Parameters:
tenantId
- identifier of tenant that is checked- Throws:
UnknownTenant
- is thrown if tenant doesn't existInternalError
- is thrown if a problem occurs, if for example service manager or DB cannot be accessed
-
createAndGetLibContainers
public List<DataSourceInfo> createAndGetLibContainers(DataSourceInfo dataSourceInfo) throws InternalError Description copied from interface:InstanceLifecycleManager
Creates on the database used by the given datasource a hdi container/schema reserved of the library itself. If the parameter is null or the database cannot be determined, the missing containers are created on all databases. When used with Hana a service instance is created for tenant MT_LIB_TENANT-"database id" No error is thrown if container creation failed !- Specified by:
createAndGetLibContainers
in interfaceInstanceLifecycleManager
- Parameters:
dataSourceInfo
- Credentials of dataSource for which lib container is created- Returns:
- Info for lib container
- Throws:
InternalError
- is thrown when a communication problems arises
-
getLibContainers
- Specified by:
getLibContainers
in interfaceInstanceLifecycleManager
- Returns:
- the credentials of mt-libs's own containers/schemas. In case of HANA, the list is based on the current state of the instance manager client libs cache.
-
clearCache
public void clearCache() -
hasDbIdentifiers
public boolean hasDbIdentifiers()- Specified by:
hasDbIdentifiers
in interfaceInstanceLifecycleManager
-
insertDbIdentifiers
- Specified by:
insertDbIdentifiers
in interfaceInstanceLifecycleManager
-
getDbType
- Specified by:
getDbType
in interfaceInstanceLifecycleManager
-
knowsDbCredentials
public boolean knowsDbCredentials()- Specified by:
knowsDbCredentials
in interfaceInstanceLifecycleManager
-
setBlockRefresh
- Parameters:
blockRefresh
- lambda expression that is called before each refresh to decide if a refresh shall be executed. Needed for unit tests to enable refresh in a controlled way.
-