You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Decebal Suiu <de...@asf.ro> on 2012/11/09 16:22:11 UTC

need advice for wicket-plugin's implementation

Hi

I'm working to first version of wicket-plugin. I encounter some problems.
In few words I implemented a PluginManagerInitializer that create a
PluginManager, load and start the plugins from a directory 
and store the plugin manager to application using wicket meta data.
Each plugin is loaded with a PluginClassLaoder.
I want to map each plugin's resources on ./plugin/plugin-name/...

My problem is how to create a reference to a plugin resource.

See this code:

    @Extension
    public static class HelloSection extends SimpleSection {

	public HelloSection() {
            //super(new Model<String>("Hello"), new
PluginResourceReference(HelloSection.class, "settings.png"));
  		super(new Model<String>("Hello"), new
PackageResourceReference(HelloSection.class, "settings.png"));
    	}

    }

In above code I want to add a new tab (section) to my TabbedPanel (I created
a demo application with a tabbed panel and itabs from plugins) 
but HelloSection.class is not visible to wicket (I retrieve a
CastClassException).
It seems to me that I cannot use ResourceReference in my case because
"scope" parameter (must be visible in wicket but I want something relative
to plugin baseResourcesPath).

Any advice how can I implement my idea is welcome.

Best regards,
Decebal 




--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/need-advice-for-wicket-plugin-s-implementation-tp4653751.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: need advice for wicket-plugin's implementation

Posted by Jesse Long <jp...@unknown.za.net>.
See CompoundClassResolver. Designed for this purpose.

On 12/11/2012 14:12, Martin Grigorov wrote:
> Hi,
>
> Since you use custom ClassLoaders you have to use custom IClassResolver too.
>
>
> On Fri, Nov 9, 2012 at 5:22 PM, Decebal Suiu <de...@asf.ro> wrote:
>
>> Hi
>>
>> I'm working to first version of wicket-plugin. I encounter some problems.
>> In few words I implemented a PluginManagerInitializer that create a
>> PluginManager, load and start the plugins from a directory
>> and store the plugin manager to application using wicket meta data.
>> Each plugin is loaded with a PluginClassLaoder.
>> I want to map each plugin's resources on ./plugin/plugin-name/...
>>
>> My problem is how to create a reference to a plugin resource.
>>
>> See this code:
>>
>>      @Extension
>>      public static class HelloSection extends SimpleSection {
>>
>>          public HelloSection() {
>>              //super(new Model<String>("Hello"), new
>> PluginResourceReference(HelloSection.class, "settings.png"));
>>                  super(new Model<String>("Hello"), new
>> PackageResourceReference(HelloSection.class, "settings.png"));
>>          }
>>
>>      }
>>
>> In above code I want to add a new tab (section) to my TabbedPanel (I
>> created
>> a demo application with a tabbed panel and itabs from plugins)
>> but HelloSection.class is not visible to wicket (I retrieve a
>> CastClassException).
>> It seems to me that I cannot use ResourceReference in my case because
>> "scope" parameter (must be visible in wicket but I want something relative
>> to plugin baseResourcesPath).
>>
>> Any advice how can I implement my idea is welcome.
>>
>> Best regards,
>> Decebal
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://apache-wicket.1842946.n4.nabble.com/need-advice-for-wicket-plugin-s-implementation-tp4653751.html
>> Sent from the Users forum mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: need advice for wicket-plugin's implementation

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

Since you use custom ClassLoaders you have to use custom IClassResolver too.


On Fri, Nov 9, 2012 at 5:22 PM, Decebal Suiu <de...@asf.ro> wrote:

> Hi
>
> I'm working to first version of wicket-plugin. I encounter some problems.
> In few words I implemented a PluginManagerInitializer that create a
> PluginManager, load and start the plugins from a directory
> and store the plugin manager to application using wicket meta data.
> Each plugin is loaded with a PluginClassLaoder.
> I want to map each plugin's resources on ./plugin/plugin-name/...
>
> My problem is how to create a reference to a plugin resource.
>
> See this code:
>
>     @Extension
>     public static class HelloSection extends SimpleSection {
>
>         public HelloSection() {
>             //super(new Model<String>("Hello"), new
> PluginResourceReference(HelloSection.class, "settings.png"));
>                 super(new Model<String>("Hello"), new
> PackageResourceReference(HelloSection.class, "settings.png"));
>         }
>
>     }
>
> In above code I want to add a new tab (section) to my TabbedPanel (I
> created
> a demo application with a tabbed panel and itabs from plugins)
> but HelloSection.class is not visible to wicket (I retrieve a
> CastClassException).
> It seems to me that I cannot use ResourceReference in my case because
> "scope" parameter (must be visible in wicket but I want something relative
> to plugin baseResourcesPath).
>
> Any advice how can I implement my idea is welcome.
>
> Best regards,
> Decebal
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/need-advice-for-wicket-plugin-s-implementation-tp4653751.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

Re: need advice for wicket-plugin's implementation

Posted by Decebal Suiu <de...@asf.ro>.
Hi

I will abort the solution with ResourceReference.

I will try to use a IRequestMapper (PluginResourceMapper) for each started
plugin (if request url is ./plugin/plugin-name/...). The mapRequest() method
will return a ResourceRequestHandler (PluginResourceRequestHandler) that
returns a ContextRelativResource (PluginResource) on getResource() method.

Each wicket plugin has a method getPluginResourceUrl(String relativePath) -
with a possible implementation
getRequestCycle().urlFor(PluginResourceRequestHandler).toString().

Does this make sense?

Best regards,
Decebal



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/need-advice-for-wicket-plugin-s-implementation-tp4653751p4653755.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org