[jboss-as7-dev] JBoss Modules: can I dynamically add dependency?

David M. Lloyd david.lloyd at redhat.com
Mon Sep 24 08:15:38 EDT 2012


Unfortunately this premise is flawed from the start: if you had two 
apps, each requiring a different JSF implementation, this idea could 
never work.

In any case you cannot change the dependencies of a static module at 
runtime.  Normally when multiple implementations are available you would 
use reflection to instantiate the implementation you need.  If this is 
not possible then you'll need a separate module for each implementation 
type.

On 09/24/2012 07:06 AM, ssilvert at redhat.com wrote:
> I have a module defined like this (currently in master with main and
> slot="1.2):
> <module xmlns="urn:jboss:module:1.1" name="org.jboss.as.jsf-injection">
>      <resources>
>          <resource-root
> path="jboss-as-jsf-injection-7.2.0.Alpha1-SNAPSHOT.jar"/>
>      </resources>
>
>      <dependencies>
>          <module name="com.sun.jsf-impl"/>   <----- this needs to be dynamic
>          <module name="javax.api"/>
>          <module name="org.jboss.as.web"/>
>          <module name="javax.servlet.api"/>
>      </dependencies>
> </module>
>
> Inside a DeploymentUnitProcessor, the module above is added to the
> ModuleSpecification along with the module for the selected JSF
> implementation.  The problem I have is that the JSF Injection code is
> the same for any Mojarra implementation.  But to support multiple
> implementations I need to declare a separate jsf-injection module with a
> hard-coded dependency on each implementation installed.
>
> If I could create a module dynamically and dynamically add its
> dependencies then there would be no need to create more and more modules
> containing the same jsf-injection jar.
>
> I've been looking at the JBoss Modules API and I don't see how to do
> this.  Is it possible?
>
> Stan
> _______________________________________________
> jboss-as7-dev mailing list
> jboss-as7-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
>


-- 
- DML




More information about the jboss-as7-dev mailing list