geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <>
Subject Re: method to check for existence of a module?
Date Tue, 29 May 2007 17:00:55 GMT
I'm not sure what you are trying to find out: there are at least  
three possible states for a module

- in the repo
- loaded in the kernel
- running.

First you need a kernel.  If your code is in a gbean you can get it  
as a gbean attribute.  Otherwise you can use  
KernelRegistry.getSingleKernel() (unless you are running more than  
one kernel in the vm, something I think no one has done yet)


ConfigurationManager configurationManager =  
Artifact moduleId = Artifact.create("mycom/myapp/1.0/car");

Another approach in a gbean is to have a collection valued reference  
of type Configuration and put the name of the desired configuration  
in the plan: then your code can check the cardinality of the  
collection to see if the other configuration is running.

david jencks

On May 29, 2007, at 9:42 AM, pgrey wrote:

> Is there a way to ask the Geronimo container whether or not a specific
> module (by name) is deployed.  I'd like to do something like
> String moduleId = "mycom/myapp/1.0/car";
> if (moduleExists(moduleId) {
>     doSomething();
> } else {
>     doSomethingElse();
> }
> Possibly the class
> org.apache.geronimo.kernel.repository.DefaultArtifactResolver will  
> provide
> this functionality, but I have fiddled with it a bit and it doesn't  
> seem
> immediately apparent exactly how to use it.
> Thanks all...

View raw message