geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "pgrey" <pg...@iss.net>
Subject Re: method to check for existence of a module?
Date Tue, 29 May 2007 17:09:35 GMT
Thanks so much, that was exactly what I was looking for (and then some).


"David Jencks" <david_jencks@yahoo.com> wrote 
in message news:7CE3AB08-FA60-438F-A5F1-5E376EFC96CE@yahoo.com...
> 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...
>>
>>
>>
>
> 




Mime
View raw message