You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by Ivan <xh...@gmail.com> on 2009/10/26 04:31:47 UTC

Maintain a Artifact-Bundle or Location-Bundle Map in Geronimo

Hi:
    While working with the code refactoring of some plug-ins, it seems that
I did not have a way to get a Bundle object via Artifact.
    Is it possible for us to maintain a artifact-bundle or location-bundle
map for those bundles loaded by Geronimo (More accurately, I mean the
DependencyManager),  so that we could more easily to know whether the bundle
is installed, and we could get the bundle object.
    Any comment ?
-- 
Ivan

Re: Maintain a Artifact-Bundle or Location-Bundle Map in Geronimo

Posted by Ivan <xh...@gmail.com>.
Thanks, David !

2009/10/26 David Jencks <da...@yahoo.com>

>
> On Oct 26, 2009, at 12:28 AM, Ivan wrote:
>
> In the ActiveMQ portlet, the constructor of ConnectorDeployable is changed,
> it needs the geronimo-activemq-ra bundle to install the JMS resource.
>
> --- geronimo/server/trunk/plugins/
> activemq/activemq-portlets/src/main/java/org/apache/geronimo/console/jmsmanager/wizard/AbstractHandler.java
> (original)
> +++
> geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/java/org/apache/geronimo/console/jmsmanager/wizard/AbstractHandler.java
> Mon Oct 26 02:45:29 2009
> @@ -56,6 +56,7 @@
>  import org.apache.geronimo.deployment.tools.loader.ConnectorDeployable;
>  import org.apache.geronimo.kernel.repository.Artifact;
>  import org.apache.geronimo.naming.deployment.jsr88.GBeanLocator;
> +import org.osgi.framework.Bundle;
>  import org.slf4j.Logger;
>  import org.slf4j.LoggerFactory;
>
> @@ -495,7 +496,8 @@
>             DeploymentManager mgr =
> ManagementHelper.getManagementHelper(request).getDeploymentManager();
>             try {
>                 File rarFile = PortletManager.getRepositoryEntry(request,
> data.getRarURI());
> -                ConnectorDeployable deployable = new
> ConnectorDeployable(rarFile.toURL());
> +                Bundle rarBundle =
> PortletManager.getRepositoryEntryBundle(request, data.getRarURI());
> +                ConnectorDeployable deployable = new
> ConnectorDeployable(rarBundle);
>                 DeploymentConfiguration config =
> mgr.createConfiguration(deployable);
>                 final DDBeanRoot ddBeanRoot = deployable.getDDBeanRoot();
>                 Connector15DCBRoot root = (Connector15DCBRoot)
> config.getDConfigBeanRoot(ddBeanRoot);
>
>
> Using a bundle here may or may not be a good idea.  However, we're talking
> about installing a rar as a javaee app here, not deploying an osgi bundle.
>  There will never be a installed bundle for this rar file, only for already
> deployed instances of it.  We could create a temporary bundle for the rar
> file, but we should be sure to uninstall it as soon as we are done peeking
> inside.  So, any kind of information about already installed bundles would
> be irrelevant.
>
> thanks
> david jencks
>
>
>
> 2009/10/26 David Jencks <da...@yahoo.com>
>
>>
>> On Oct 25, 2009, at 8:31 PM, Ivan wrote:
>>
>>  Hi:
>>>    While working with the code refactoring of some plug-ins, it seems
>>> that I did not have a way to get a Bundle object via Artifact.
>>>    Is it possible for us to maintain a artifact-bundle or location-bundle
>>> map for those bundles loaded by Geronimo (More accurately, I mean the
>>> DependencyManager),  so that we could more easily to know whether the bundle
>>> is installed, and we could get the bundle object.
>>>    Any comment ?
>>>
>>
>> The KernelConfigurationManager has a map of Artifact to Configuration from
>> which you can get the BundleContext and thence the Bundle.  This only tells
>> you about the plugins that are loaded, not all the jars that are installed.
>>  In the DependencyManager so far I've relied on the mvn artifact urls to
>> convert the artifact to a location string and compared that to the locations
>> of the installed bundles.
>>
>> What are you working on that you need this?
>>
>> thanks
>> david jencks
>>
>>  --
>>> Ivan
>>>
>>
>>
>
>
> --
> Ivan
>
>
>


-- 
Ivan

Re: Maintain a Artifact-Bundle or Location-Bundle Map in Geronimo

Posted by David Jencks <da...@yahoo.com>.
On Oct 26, 2009, at 12:28 AM, Ivan wrote:

> In the ActiveMQ portlet, the constructor of ConnectorDeployable is  
> changed, it needs the geronimo-activemq-ra bundle to install the JMS  
> resource.
>
> --- geronimo/server/trunk/plugins/
> activemq/activemq-portlets/src/main/java/org/apache/geronimo/console/ 
> jmsmanager/wizard/AbstractHandler.java (original)
> +++ geronimo/server/trunk/plugins/activemq/activemq-portlets/src/ 
> main/java/org/apache/geronimo/console/jmsmanager/wizard/ 
> AbstractHandler.java Mon Oct 26 02:45:29 2009
> @@ -56,6 +56,7 @@
>  import  
> org.apache.geronimo.deployment.tools.loader.ConnectorDeployable;
>  import org.apache.geronimo.kernel.repository.Artifact;
>  import org.apache.geronimo.naming.deployment.jsr88.GBeanLocator;
> +import org.osgi.framework.Bundle;
>  import org.slf4j.Logger;
>  import org.slf4j.LoggerFactory;
>
> @@ -495,7 +496,8 @@
>             DeploymentManager mgr =  
> ManagementHelper.getManagementHelper(request).getDeploymentManager();
>             try {
>                 File rarFile =  
> PortletManager.getRepositoryEntry(request, data.getRarURI());
> -                ConnectorDeployable deployable = new  
> ConnectorDeployable(rarFile.toURL());
> +                Bundle rarBundle =  
> PortletManager.getRepositoryEntryBundle(request, data.getRarURI());
> +                ConnectorDeployable deployable = new  
> ConnectorDeployable(rarBundle);
>                 DeploymentConfiguration config =  
> mgr.createConfiguration(deployable);
>                 final DDBeanRoot ddBeanRoot =  
> deployable.getDDBeanRoot();
>                 Connector15DCBRoot root = (Connector15DCBRoot)  
> config.getDConfigBeanRoot(ddBeanRoot);

Using a bundle here may or may not be a good idea.  However, we're  
talking about installing a rar as a javaee app here, not deploying an  
osgi bundle.  There will never be a installed bundle for this rar  
file, only for already deployed instances of it.  We could create a  
temporary bundle for the rar file, but we should be sure to uninstall  
it as soon as we are done peeking inside.  So, any kind of information  
about already installed bundles would be irrelevant.

thanks
david jencks


>
> 2009/10/26 David Jencks <da...@yahoo.com>
>
> On Oct 25, 2009, at 8:31 PM, Ivan wrote:
>
> Hi:
>    While working with the code refactoring of some plug-ins, it  
> seems that I did not have a way to get a Bundle object via Artifact.
>    Is it possible for us to maintain a artifact-bundle or location- 
> bundle map for those bundles loaded by Geronimo (More accurately, I  
> mean the DependencyManager),  so that we could more easily to know  
> whether the bundle is installed, and we could get the bundle object.
>    Any comment ?
>
> The KernelConfigurationManager has a map of Artifact to  
> Configuration from which you can get the BundleContext and thence  
> the Bundle.  This only tells you about the plugins that are loaded,  
> not all the jars that are installed.  In the DependencyManager so  
> far I've relied on the mvn artifact urls to convert the artifact to  
> a location string and compared that to the locations of the  
> installed bundles.
>
> What are you working on that you need this?
>
> thanks
> david jencks
>
> -- 
> Ivan
>
>
>
>
> -- 
> Ivan


Re: Maintain a Artifact-Bundle or Location-Bundle Map in Geronimo

Posted by Ivan <xh...@gmail.com>.
In the ActiveMQ portlet, the constructor of ConnectorDeployable is changed,
it needs the geronimo-activemq-ra bundle to install the JMS resource.

--- geronimo/server/trunk/plugins/
activemq/activemq-portlets/src/main/java/org/apache/geronimo/console/jmsmanager/wizard/AbstractHandler.java
(original)
+++
geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/java/org/apache/geronimo/console/jmsmanager/wizard/AbstractHandler.java
Mon Oct 26 02:45:29 2009
@@ -56,6 +56,7 @@
 import org.apache.geronimo.deployment.tools.loader.ConnectorDeployable;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.naming.deployment.jsr88.GBeanLocator;
+import org.osgi.framework.Bundle;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

@@ -495,7 +496,8 @@
            DeploymentManager mgr =
ManagementHelper.getManagementHelper(request).getDeploymentManager();
            try {
                File rarFile = PortletManager.getRepositoryEntry(request,
data.getRarURI());
-                ConnectorDeployable deployable = new
ConnectorDeployable(rarFile.toURL());
+                Bundle rarBundle =
PortletManager.getRepositoryEntryBundle(request, data.getRarURI());
+                ConnectorDeployable deployable = new
ConnectorDeployable(rarBundle);
                DeploymentConfiguration config =
mgr.createConfiguration(deployable);
                final DDBeanRoot ddBeanRoot = deployable.getDDBeanRoot();
                Connector15DCBRoot root = (Connector15DCBRoot)
config.getDConfigBeanRoot(ddBeanRoot);


2009/10/26 David Jencks <da...@yahoo.com>

>
> On Oct 25, 2009, at 8:31 PM, Ivan wrote:
>
>  Hi:
>>    While working with the code refactoring of some plug-ins, it seems that
>> I did not have a way to get a Bundle object via Artifact.
>>    Is it possible for us to maintain a artifact-bundle or location-bundle
>> map for those bundles loaded by Geronimo (More accurately, I mean the
>> DependencyManager),  so that we could more easily to know whether the bundle
>> is installed, and we could get the bundle object.
>>    Any comment ?
>>
>
> The KernelConfigurationManager has a map of Artifact to Configuration from
> which you can get the BundleContext and thence the Bundle.  This only tells
> you about the plugins that are loaded, not all the jars that are installed.
>  In the DependencyManager so far I've relied on the mvn artifact urls to
> convert the artifact to a location string and compared that to the locations
> of the installed bundles.
>
> What are you working on that you need this?
>
> thanks
> david jencks
>
>  --
>> Ivan
>>
>
>


-- 
Ivan

Re: Maintain a Artifact-Bundle or Location-Bundle Map in Geronimo

Posted by David Jencks <da...@yahoo.com>.
On Oct 25, 2009, at 8:31 PM, Ivan wrote:

> Hi:
>     While working with the code refactoring of some plug-ins, it  
> seems that I did not have a way to get a Bundle object via Artifact.
>     Is it possible for us to maintain a artifact-bundle or location- 
> bundle map for those bundles loaded by Geronimo (More accurately, I  
> mean the DependencyManager),  so that we could more easily to know  
> whether the bundle is installed, and we could get the bundle object.
>     Any comment ?

The KernelConfigurationManager has a map of Artifact to Configuration  
from which you can get the BundleContext and thence the Bundle.  This  
only tells you about the plugins that are loaded, not all the jars  
that are installed.  In the DependencyManager so far I've relied on  
the mvn artifact urls to convert the artifact to a location string and  
compared that to the locations of the installed bundles.

What are you working on that you need this?

thanks
david jencks

> -- 
> Ivan