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)

Then

ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
Artifact moduleId = Artifact.create("mycom/myapp/1.0/car");
configurationManager.isInstalled(moduleId);
configurationManager.isLoaded(moduleId);
configurationManager.isRunning(moduleId);

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.

thanks
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...




Reply via email to