You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hivemind.apache.org by Knut Wannheden <kn...@gmail.com> on 2005/03/08 12:33:21 UTC

HiveMind application inside Eclipse

Hi all,

I don't know if this sounds a little bit odd, but I'd like to run a
HiveMind application inside Eclipse. As the application is split into
multiple modules, of which not always all will be used, I thought it
would be natural to map every module to an Eclipse plugin.

Without thinking further about it I did just that. Of course I ran
into problems: HiveMind doesn't find the module descriptors as I think
the Eclipse plugins are all loaded by a separate class loaders.

Before trying to implement a solution to this I was wondering if
anybody else had done something like this before.

I think it should be quite easy to support HiveMind applications
inside Eclipse. I'd have to create a HiveMind plugin which exposes a
extension point for registering HiveMind modules in other plugins.
This should let HiveMind (using a custom ModuleDescriptorProvider)
construct the registry. Are there problems with this approach or can
someone think of a better idea?

Cheers,

--knut

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org


Re: HiveMind application inside Eclipse

Posted by Mike D Pilsbury <mi...@pekim.co.uk>.
Thanks. Looks promising. I had to implement checkForClass in 
BundleClassResolver, as I am using alpha-2.

I haven't had enough time to play with it properly yet, but I'll 
feedback when I have.

Mike


Knut Wannheden wrote:

>Mike,
>
>I have attached (I hope it gets through...) the Eclipse plugin as a
>zip file. I stripped out all the jars so you will have to put those in
>place first to get it working, but I'm sure you'll figure that out.
>
>There are still a few classloader issues:
>
> - Make sure that if you use HiveMind's MessageFormatter class in your
>code that you use the MessageFormatter(Log, ResourceBundle)
>constructor (i.e. load the ResourceBundle in your code).
> - If you use HiveMind's ClassResolver you could have problems with
>working with some methods of the classloader returned by
>getClassLoader().
>
>Good luck and let me know if you find any problems!
>
>--knut
>
>On Thu, 10 Mar 2005 20:17:39 +0000, Mike D Pilsbury <mi...@pekim.co.uk> wrote:
>  
>
>> I tried to use HiveMind in an Eclipse plugin about 10 days ago, and ran in
>>to the classloader issues that you mention. I spent several hours trying to
>>understand Eclipse's classloaders, and how best to get HiveMind to be able
>>to find the modules with ClassLoader.getResources. I failed miserably, and
>>gave feeling very frustrated.
>> 
>> The root of the problem appeared to be that the hivemind.jar and
>>myplugin.jar were not even using the same ClassLoader, even though they were
>>in the one plugin. But I was so confused in the end that I could well be
>>mis-remembering.
>> 
>> You approach sounds ideal, and I would be extremely grateful if you were to
>>share the plugin.
>> 
>> Mike
>> 
>> 
>> Knut Wannheden wrote: 
>> Harish, If this plugin is useful to others I can certainly share it. Would
>>it maybe even make sense to make it available as a separate download under
>>the HiveMind project hood? As I mentioned there are a few classloader issues
>>with the plugin. The problem is basically that every plugin gets loaded by a
>>separate classloader. One of the problems is related to the HiveMind
>>MessageFormatter class and maybe this is something we should address in the
>>HiveMind framwork. 3 of the 4 MessageFormatter constructors will implicitly
>>load the ResourceBundle using the classloader which loaded the
>>MessageFormatter class (i.e. the classloader of the HiveMind plugin). For
>>other plugins than the HiveMind plugin itself this will of course not work.
>>I wonder if we thus should change MessageFormatter to always load the
>>ResourceBundle using an explicit ClassLoader instance and deprecate the
>>MessageFormatter(Log, String) constructor. What do you think? --knut On Tue,
>>8 Mar 2005 11:59:56 -0500, Harish Krishnaswamy <ha...@gmail.com>
>>wrote: 
>> Cool, any plans of open sourcing the Eclipse HiveMind plugin? -Harish On
>>Tue, 8 Mar 2005 17:38:57 +0100, Knut Wannheden <kn...@gmail.com>
>>wrote: 
>> Harish, On Tue, 8 Mar 2005 11:03:23 -0500, Harish Krishnaswamy
>><ha...@gmail.com> wrote: 
>> I did a similar thing for work here, but did not use Eclipse; a suite of
>>applications hosted by a very light-weight platform that provides a single
>>extension point for adding applications. The platform discovers applications
>>(a la plugins) in the classpath and adds it to the platform. I suppose you
>>are trying to use eclipse's discovery mechanism and HiveMind's injection and
>>interception features? Do you want to share components between plugins? That
>>may be a problem. What is your motive in using eclipse? SWT? My motive for
>>running the application in Eclipse is that it's an IDE application we're
>>developing, which we want to move to Eclipse. At the same time I'd like to
>>continue using HiveMind to structure the application as services and
>>configurations. In my mind all of my HiveMind modules correspond quite well
>>to individual Eclipse plugins. So I'd like to wrap every module with a
>>plugin and have the HiveMind registry span all plugins. I just created a
>>simple Eclipse HiveMind plugin which lets other plugins register HiveMind
>>modules using an extension point. The plugin implementation is really just a
>>wrapper around the RegistryBuilder. I had a few class loader issues to deal
>>with, but overall HiveMind and Eclipse seem to get along quite nicely.
>>--knut ---------------------------------------------------------------------
>>To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org For
>>additional commands, e-mail: hivemind-dev-help@jakarta.apache.org
>>--------------------------------------------------------------------- To
>>unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org For
>>additional commands, e-mail: hivemind-dev-help@jakarta.apache.org
>>    
>>
>>------------------------------------------------------------------------
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org


Re: HiveMind application inside Eclipse

Posted by Knut Wannheden <kn...@gmail.com>.
Mike,

I have attached (I hope it gets through...) the Eclipse plugin as a
zip file. I stripped out all the jars so you will have to put those in
place first to get it working, but I'm sure you'll figure that out.

There are still a few classloader issues:

 - Make sure that if you use HiveMind's MessageFormatter class in your
code that you use the MessageFormatter(Log, ResourceBundle)
constructor (i.e. load the ResourceBundle in your code).
 - If you use HiveMind's ClassResolver you could have problems with
working with some methods of the classloader returned by
getClassLoader().

Good luck and let me know if you find any problems!

--knut

On Thu, 10 Mar 2005 20:17:39 +0000, Mike D Pilsbury <mi...@pekim.co.uk> wrote:
>  I tried to use HiveMind in an Eclipse plugin about 10 days ago, and ran in
> to the classloader issues that you mention. I spent several hours trying to
> understand Eclipse's classloaders, and how best to get HiveMind to be able
> to find the modules with ClassLoader.getResources. I failed miserably, and
> gave feeling very frustrated.
>  
>  The root of the problem appeared to be that the hivemind.jar and
> myplugin.jar were not even using the same ClassLoader, even though they were
> in the one plugin. But I was so confused in the end that I could well be
> mis-remembering.
>  
>  You approach sounds ideal, and I would be extremely grateful if you were to
> share the plugin.
>  
>  Mike
>  
>  
>  Knut Wannheden wrote: 
>  Harish, If this plugin is useful to others I can certainly share it. Would
> it maybe even make sense to make it available as a separate download under
> the HiveMind project hood? As I mentioned there are a few classloader issues
> with the plugin. The problem is basically that every plugin gets loaded by a
> separate classloader. One of the problems is related to the HiveMind
> MessageFormatter class and maybe this is something we should address in the
> HiveMind framwork. 3 of the 4 MessageFormatter constructors will implicitly
> load the ResourceBundle using the classloader which loaded the
> MessageFormatter class (i.e. the classloader of the HiveMind plugin). For
> other plugins than the HiveMind plugin itself this will of course not work.
> I wonder if we thus should change MessageFormatter to always load the
> ResourceBundle using an explicit ClassLoader instance and deprecate the
> MessageFormatter(Log, String) constructor. What do you think? --knut On Tue,
> 8 Mar 2005 11:59:56 -0500, Harish Krishnaswamy <ha...@gmail.com>
> wrote: 
>  Cool, any plans of open sourcing the Eclipse HiveMind plugin? -Harish On
> Tue, 8 Mar 2005 17:38:57 +0100, Knut Wannheden <kn...@gmail.com>
> wrote: 
>  Harish, On Tue, 8 Mar 2005 11:03:23 -0500, Harish Krishnaswamy
> <ha...@gmail.com> wrote: 
>  I did a similar thing for work here, but did not use Eclipse; a suite of
> applications hosted by a very light-weight platform that provides a single
> extension point for adding applications. The platform discovers applications
> (a la plugins) in the classpath and adds it to the platform. I suppose you
> are trying to use eclipse's discovery mechanism and HiveMind's injection and
> interception features? Do you want to share components between plugins? That
> may be a problem. What is your motive in using eclipse? SWT? My motive for
> running the application in Eclipse is that it's an IDE application we're
> developing, which we want to move to Eclipse. At the same time I'd like to
> continue using HiveMind to structure the application as services and
> configurations. In my mind all of my HiveMind modules correspond quite well
> to individual Eclipse plugins. So I'd like to wrap every module with a
> plugin and have the HiveMind registry span all plugins. I just created a
> simple Eclipse HiveMind plugin which lets other plugins register HiveMind
> modules using an extension point. The plugin implementation is really just a
> wrapper around the RegistryBuilder. I had a few class loader issues to deal
> with, but overall HiveMind and Eclipse seem to get along quite nicely.
> --knut ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org For
> additional commands, e-mail: hivemind-dev-help@jakarta.apache.org
> --------------------------------------------------------------------- To
> unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org For
> additional commands, e-mail: hivemind-dev-help@jakarta.apache.org

Re: HiveMind application inside Eclipse

Posted by Knut Wannheden <kn...@gmail.com>.
Harish,

If this plugin is useful to others I can certainly share it. Would it
maybe even make sense to make it available as a separate download
under the HiveMind project hood?

As I mentioned there are a few classloader issues with the plugin. The
problem is basically that every plugin gets loaded by a separate
classloader.

One of the problems is related to the HiveMind MessageFormatter class
and maybe this is something we should address in the HiveMind
framwork. 3 of the 4 MessageFormatter constructors will implicitly
load the ResourceBundle using the classloader which loaded the
MessageFormatter class (i.e. the classloader of the HiveMind plugin).
For other plugins than the HiveMind plugin itself this will of course
not work. I wonder if we thus should change MessageFormatter to always
load the ResourceBundle using an explicit ClassLoader instance and
deprecate the MessageFormatter(Log, String) constructor. What do you
think?

--knut

On Tue, 8 Mar 2005 11:59:56 -0500, Harish Krishnaswamy
<ha...@gmail.com> wrote:
> Cool, any plans of open sourcing the Eclipse HiveMind plugin?
> 
> -Harish
> 
> On Tue, 8 Mar 2005 17:38:57 +0100, Knut Wannheden
> <kn...@gmail.com> wrote:
> > Harish,
> >
> > On Tue, 8 Mar 2005 11:03:23 -0500, Harish Krishnaswamy
> > <ha...@gmail.com> wrote:
> > > I did a similar thing for work here, but did not use Eclipse; a suite
> > > of applications hosted by a very light-weight platform that provides a
> > > single extension point for adding applications. The platform discovers
> > > applications (a la plugins) in the classpath and adds it to the
> > > platform.
> > >
> > > I suppose you are trying to use eclipse's discovery mechanism and
> > > HiveMind's injection and interception features? Do you want to share
> > > components between plugins? That may be a problem. What is your motive
> > > in using eclipse? SWT?
> > >
> >
> > My motive for running the application in Eclipse is that it's an IDE
> > application we're developing, which we want to move to Eclipse. At the
> > same time I'd like to continue using HiveMind to structure the
> > application as services and configurations.
> >
> > In my mind all of my HiveMind modules correspond quite well to
> > individual Eclipse plugins. So I'd like to wrap every module with a
> > plugin and have the HiveMind registry span all plugins.
> >
> > I just created a simple Eclipse HiveMind plugin which lets other
> > plugins register HiveMind modules using an extension point. The plugin
> > implementation is really just a wrapper around the RegistryBuilder.  I
> > had a few class loader issues to deal with, but overall HiveMind and
> > Eclipse seem to get along quite nicely.
> >
> > --knut
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org


Re: HiveMind application inside Eclipse

Posted by Knut Wannheden <kn...@gmail.com>.
Harish,

On Tue, 8 Mar 2005 11:03:23 -0500, Harish Krishnaswamy
<ha...@gmail.com> wrote:
> I did a similar thing for work here, but did not use Eclipse; a suite
> of applications hosted by a very light-weight platform that provides a
> single extension point for adding applications. The platform discovers
> applications (a la plugins) in the classpath and adds it to the
> platform.
> 
> I suppose you are trying to use eclipse's discovery mechanism and
> HiveMind's injection and interception features? Do you want to share
> components between plugins? That may be a problem. What is your motive
> in using eclipse? SWT?
> 

My motive for running the application in Eclipse is that it's an IDE
application we're developing, which we want to move to Eclipse. At the
same time I'd like to continue using HiveMind to structure the
application as services and configurations.

In my mind all of my HiveMind modules correspond quite well to
individual Eclipse plugins. So I'd like to wrap every module with a
plugin and have the HiveMind registry span all plugins.

I just created a simple Eclipse HiveMind plugin which lets other
plugins register HiveMind modules using an extension point. The plugin
implementation is really just a wrapper around the RegistryBuilder.  I
had a few class loader issues to deal with, but overall HiveMind and
Eclipse seem to get along quite nicely.

--knut

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org


Re: HiveMind application inside Eclipse

Posted by Harish Krishnaswamy <ha...@gmail.com>.
I did a similar thing for work here, but did not use Eclipse; a suite
of applications hosted by a very light-weight platform that provides a
single extension point for adding applications. The platform discovers
applications (a la plugins) in the classpath and adds it to the
platform.

I suppose you are trying to use eclipse's discovery mechanism and
HiveMind's injection and interception features? Do you want to share
components between plugins? That may be a problem. What is your motive
in using eclipse? SWT?

-Harish

On Tue, 8 Mar 2005 12:33:21 +0100, Knut Wannheden
<kn...@gmail.com> wrote:
> Hi all,
> 
> I don't know if this sounds a little bit odd, but I'd like to run a
> HiveMind application inside Eclipse. As the application is split into
> multiple modules, of which not always all will be used, I thought it
> would be natural to map every module to an Eclipse plugin.
> 
> Without thinking further about it I did just that. Of course I ran
> into problems: HiveMind doesn't find the module descriptors as I think
> the Eclipse plugins are all loaded by a separate class loaders.
> 
> Before trying to implement a solution to this I was wondering if
> anybody else had done something like this before.
> 
> I think it should be quite easy to support HiveMind applications
> inside Eclipse. I'd have to create a HiveMind plugin which exposes a
> extension point for registering HiveMind modules in other plugins.
> This should let HiveMind (using a custom ModuleDescriptorProvider)
> construct the registry. Are there problems with this approach or can
> someone think of a better idea?
> 
> Cheers,
> 
> --knut
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org