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 EntryPointBuilderbuilder()Get EntryPoint Builder.default voidclose()Implementation of the close() method of the AutoCloseable interface.voiddestroy()Destroy EntryPoint and release resources managed by iPLAss.static EntryPointGet an instance of EntryPoint.static EntryPointinit()Initialize EntryPoint and get an instance of it.static booleanisInited()Gets whether EntryPoint has already been initialized.runner()Get Runner to execute logic in iPLAss.default RunnerwithAuth(Credential credential) Get an instance of Runner logged in with Credential.default RunnerGet an instance of Runner with language specified.default RunnerwithTenant(Integer tenantId) Get an instance of Runner with tenant specified.default RunnerwithTenant(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:
closein interfaceAutoCloseable
-