Skip to main content



      Home
Home » Newcomers » Newcomers » Instantiate object in an other plugin
Instantiate object in an other plugin [message #257775] Sat, 07 June 2008 12:36 Go to next message
Eclipse UserFriend
Originally posted by: zsolt.zszs.hu

I run into another problem with my GenericPlugin strategy:

In GenericPlugin I've a CommandFactory

public class CommandFactory {
public static GenericCommand createCommand(
Class<? extends GenericCommand> commandClass ) {
//instantiate command with reflection
}
}

This factory works fine with commands defined in GenericPlugin but throws
ClassNotFoundException if the command is defined in SpecificPlugin which
depends on the GenericPlugin. In SpecificPlugin's manifest.mf I added:

Export-Package:
hu.itkodex.specifiplugin.commands

but it doesn't helped.

Generally I'm confused what are the visiblity constrants between plugins.
One plugin can see only classes from it's dependents plugins?

What about extension point? If I define a ICommandFactory extension point
in Generic plugin than I can request extenders to instantiate commands
defined in their plugin. This seems to be ugly.

What is your suggestion?

Thanks in advance,
Zsolt
Re: Instantiate object in an other plugin [message #257797 is a reply to message #257775] Sat, 07 June 2008 13:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Zsolt,

Generally a plugin can't see classes in downstream plugins (that depend
on it) but rather only in upstream ones.


Zsolt Zsuffa wrote:
> I run into another problem with my GenericPlugin strategy:
>
> In GenericPlugin I've a CommandFactory
>
> public class CommandFactory {
> public static GenericCommand createCommand( Class<? extends
> GenericCommand> commandClass ) {
> //instantiate command with reflection
> }
> }
>
> This factory works fine with commands defined in GenericPlugin but
> throws ClassNotFoundException if the command is defined in
> SpecificPlugin which depends on the
But you already have a class instance so what class isn't found?
> GenericPlugin. In SpecificPlugin's manifest.mf I added:
>
> Export-Package: hu.itkodex.specifiplugin.commands
>
> but it doesn't helped.
>
> Generally I'm confused what are the visiblity constrants between
> plugins. One plugin can see only classes from it's dependents plugins?
>
> What about extension point? If I define a ICommandFactory extension
> point in Generic plugin than I can request extenders to instantiate
> commands defined in their plugin. This seems to be ugly.
Extensions support creating an instance and that instance is created by
the extending plugin...
>
> What is your suggestion?
I'm confused by what class isn't found...
>
> Thanks in advance,
> Zsolt
>
Re: Instantiate object in an other plugin [message #257824 is a reply to message #257797] Sat, 07 June 2008 16:37 Go to previous message
Eclipse UserFriend
Originally posted by: zsolt.zszs.hu

Ed,

you are right. I did not read the stack trace thoroughly. It wasn't the
problem of instantiating the class given by the parameter, it was the
problem that SpecificPlgin doesn't saw the Logger class from Log4J
library, which is refered in the constructor of the class in question.

My conclusion is that the visibility of classes between different plguins
depends only the Export-Package declaration in manifest.mf file.

Thanks for your help,
Zsolt
Previous Topic:Re: How to adjust Section size?
Next Topic:Is it possible to add a List to a Section?
Goto Forum:
  


Current Time: Thu May 08 21:44:34 EDT 2025

Powered by FUDForum. Page generated in 0.08960 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top