Package org.iplass.mtp.runtime
Interface EntryPoint
- All Superinterfaces:
AutoCloseable
By using EntryPoint, iPLAss can be initialized/destroyed directly from the code even if outside the servlet container, and logic can be executed by specifying a tenant/user. There can be only one EntryPoint per class loader unit where the class is loaded.
EntryPoint usage example
//initialize EntryPoint on application startup EntryPoint entryPoint = EntryPoint.builder() .config("/backend-service-config.xml") .serverRole("backendService") .build(); : : //do process some logic while application is running entryPoint.withTenant(tenantId).withLang("en").run(() -> { : : Entity e = entityManager.load(oid, "SomeEntity"); : : }); : : //destroy EntryPoint when application is shutdown entryPoint.destroy();
-
Method Summary
Modifier and TypeMethodDescriptionstatic EntryPointBuilder
builder()
Get EntryPoint Builder.default void
close()
Implementation of the close() method of the AutoCloseable interface.void
destroy()
Destroy EntryPoint and release resources managed by iPLAss.static EntryPoint
Get an instance of EntryPoint.static EntryPoint
init()
Initialize EntryPoint and get an instance of it.static boolean
isInited()
Gets whether EntryPoint has already been initialized.runner()
Get Runner to execute logic in iPLAss.default Runner
withAuth
(Credential credential) Get an instance of Runner logged in with Credential.default Runner
Get an instance of Runner with language specified.default Runner
withTenant
(Integer tenantId) Get an instance of Runner with tenant specified.default Runner
withTenant
(String tenantUrl) Get an instance of Runner with tenant specified.
-
Method Details
-
getInstance
Get an instance of EntryPoint. If EntryPoint has not been initialized, it will be initialized.- Returns:
-
init
Initialize EntryPoint and get an instance of it. If there is an EntryPoint that has already been initialized, an AlreadyInitializedException is thrown.- Returns:
- EntryPoint instance
- Throws:
AlreadyInitializedException
- When EntryPoint has already been initialized
-
builder
Get EntryPoint Builder. Parameters for building EntryPoint can be specified via Builder.- Returns:
-
isInited
static boolean isInited()Gets whether EntryPoint has already been initialized.- Returns:
-
runner
Runner runner()Get Runner to execute logic in iPLAss.- Returns:
-
withLang
Get an instance of Runner with language specified.- Parameters:
lang
-- Returns:
-
withAuth
Get an instance of Runner logged in with Credential.- Parameters:
credential
-- Returns:
-
withTenant
Get an instance of Runner with tenant specified.- Parameters:
tenantUrl
- Tenant URL (path of tenant)- Returns:
-
withTenant
Get an instance of Runner with tenant specified.- Parameters:
tenantId
- Tenant ID- Returns:
-
destroy
void destroy()Destroy EntryPoint and release resources managed by iPLAss. -
close
default void close()Implementation of the close() method of the AutoCloseable interface. Call destroy().- Specified by:
close
in interfaceAutoCloseable
-