@ConsumerType
public interface DeploymentHook
This interface can be implemented by a client to define a DEPLOY-V2 Cloudlet hook.
DeploymentHook
instances can be used to customize the behavior of the DEPLOY-V2
Cloudlet by executing user-defined code at specific stages of deployment requests.
A DeploymentHook
implementation must be registered as an OSGi service and it is identified by the
value of the kura.service.pid
service property.
In order for a registered hook to be used for a particular request the following conditions must be verified:
request.type
of string type.request.type
and the kura.service.pid
of a registered DeploymentHook
implementation.
The associations between request.type
and hook kura.service.pid
are maintained in the configuration
of the DEPLOY-V2 Cloudlet and are modifiable using the Kura WEB Ui.
The DeploymentHook
methods can be executed at different stages of the /EXEC/download
and
/EXEC/install
as specified below.
Method | /EXEC/download | /EXEC/install |
---|---|---|
preDownload() |
Called immediately after a valid request is received by the Cloudlet. | Never called. |
postDownload() |
Called immediately after the download is completed successfully, or immediately after the
preDownload method is called if the requested file already exists.
When this method is called the requested file should be available on the device. |
Called immediately after a valid request is received by the Cloudlet, and only if the requested file is available on the device |
postInstall() |
Called immediately after the downloaded deployment package/script has been successfully installed/executed. | Called immediately after the downloaded deployment package/script has been successfully installed/executed. |
If any of the methods specified by this interface throws an exception, the current request will be aborted.
Modifier and Type | Method and Description |
---|---|
void |
postDownload(RequestContext context,
java.util.Map<java.lang.String,java.lang.Object> properties)
This method is called at the
preDownload phase, see class description for more details. |
void |
postInstall(RequestContext context,
java.util.Map<java.lang.String,java.lang.Object> properties)
This method is called at the
preDownload phase, see class description for more details. |
void |
preDownload(RequestContext context,
java.util.Map<java.lang.String,java.lang.Object> properties)
This method is called at the
preDownload phase, see class description for more details. |
void preDownload(RequestContext context, java.util.Map<java.lang.String,java.lang.Object> properties) throws KuraException
preDownload
phase, see class description for more details.context
- a RequestContext
instance representing the current DEPLOY-V2 requestproperties
- an hook-specific map of propertiesKuraException
- if an exception is thrown the current request will be abortedvoid postDownload(RequestContext context, java.util.Map<java.lang.String,java.lang.Object> properties) throws KuraException
preDownload
phase, see class description for more details.context
- a RequestContext
instance representing the current DEPLOY-V2 requestproperties
- an hook-specific map of propertiesKuraException
- if an exception is thrown the current request will be abortedvoid postInstall(RequestContext context, java.util.Map<java.lang.String,java.lang.Object> properties) throws KuraException
preDownload
phase, see class description for more details.context
- a RequestContext
instance representing the current DEPLOY-V2 requestproperties
- an hook-specific map of propertiesKuraException
- if an exception is thrown the current request will be aborted