public interface IExternalModule
Main classes of external modules must implement this interface.
Main classes are also required to have a no-arg constructor.
Recommended to extend the BaseExtModule
class instead of implementing this yourself as the BaseExtModule
class provides you some utilities.
See https://sites.google.com/site/scelight/external-modules for general info about external modules.
XConsts.EXT_MOD_API_VERSION
BaseExtModule
,
IExtModManifestBean
,
IServices
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Called when the external module is destroyed.
|
void |
init(IExtModManifestBean manifest,
IServices services,
IModEnv modEnv)
Called when the external module is started.
|
void init(IExtModManifestBean manifest, IServices services, IModEnv modEnv) throws java.lang.Exception
If this method throws an Exception
, the destroy()
method will be called and the module will be discarded.
If initialization fails (the module cannot initialize itself), an Exception
must be thrown to indicate the failure.
This method must not perform lengthy operations! If initialization task takes long, they must to be performed in separate threads / jobs. For
example if a module accesses network resources (e.g. connects to an external web server), since the connection time and the availability / reliability of
an independent server cannot be assured, it must be performed in a new thread.
The "Scelight way" to create and use threads is via using INormalThread
, IControlledThread
, IJob
and IProgressJob
.
Instances of these advanced threads can be acquired by the IFactory
interface.
manifest
- external module manifest loaded from the "Scelight-mod-x-manifest.xml"
file from the version folder of the external module
root folder; should be stored by the module if the module intends to use it laterservices
- module-independent services provided for the module; should be stored by the module if the module intends to use it latermodEnv
- external module environment, can be used to acquire external module specific infojava.lang.Exception
- must be thrown if initialization failsvoid destroy()
The module should release all allocated resources and stop all background jobs and threads created by it.
The module cannot perform any tasks after returning from this method because the application may be terminated at any time.
This method will be called if the module is instantiated successfully, even if the init(IExtModManifestBean, IServices, IModEnv)
method throws
an exception.
Any thrown Exception
will be silently discarded.
This API documentation is public and is intended for / allowed to be used by anyone.
Scelight home page: https://sites.google.com/site/scelight/
Scelight is a trademark of András Belicza. Copyright © András Belicza, 2013-2015. All rights reserved.