You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by Jarek Gawor <jg...@gmail.com> on 2010/01/29 17:50:29 UTC

ModuleBuilder API and Bundle deployment

Hi all,

The rfc66 extender uses the same ModueBuilders to deploy a Bundle as
regular deployment does. So it is important to update the
ModuleBuilders to work equally well for Bundle-based deployments as it
does for JarFile-based deployments. I've already updated a few
ModuleBuilders but there are few more that still might need to be
updated. So I wanted to share some information which API should or
should not be used within the ModuleBuilders in case you need to
update it:

1) Use DeploymentContext.getTargetURL() instead of
DeploymentContext.getTargetFile(). getTargetFile() will throw
exception in Bundle-based deployment.
2) Avoid DeploymentContext.getBaseDir() or
DeploymentContext.getInPlaceConfigurationDir(). They return null in
Bundle-based deployment.
3) DeploymentContext.addInclude* or addFile* don't do anything for
Bundle-based deployment so no need to worry about these calls.
4) Use Module.getDeployable() instead of Module.getModuleFile().
getModuleFile() will throw exception in Bundle-based deployment. The
getDeployable() returns object that implements Deployable interface
(so either DeployableBundle or DeployableJarFile). You can use the
Deployable interface to lookup resources on the object being deployed
in a consistent way.

There is one exception. You can use the
DeploymentContext.getTargetFile(). getBaseDir,
getInPlaceConfigurationDir, and Module.getModuleFile() within
ModuleBuilder.installModule() and
ModuleBuilderExtension.installModule(). The installModule() methods
are not called on Bundle-based deployments.

If you are looking for an example of ModuleBuilderExtension that works
with both types of deployments take a look at
JspModuleBuilderExtension.java

Hope this helps,
Jarek