Hi Martin,

Martin Grigorov wrote:

> Hi,
> 
> 
> On Mon, Aug 24, 2015 at 4:06 PM, Jörg Schaible
> <joerg.schai...@swisspost.com
>> wrote:
> 
>> Hi,
>>
>> I am migrating an old Wicket application running in Apache Felix and I
>> wonder how I should register my initializer. According the migration docs
>> I should move and rename the "/wicket.properties" file to "META-
>> INF/wicket/<package>.properties".
>>
>> However, in Felix I have an URL for this resource like
>> "bundle://18.0:1/META-INF/wicket/". This is obviously not supported in
>> Application.collectWicketProperties().
>>
>>
> We can make this method protected or add another method where you could
> plug custom logic.
> 
> 
>> For now, I can return to the deprecated name and location, but I wonder
>> what
>> is the migration path when this support is dropped?
>>
>> Why do you iterate over all existing files anyway, when you stop the
>> iteration at the first occurrence (at least for jar protocol)? The
>> easiest solution would be to look again for a "known" resource, simply
>> gain the name
>> of the properties file from the current application instance:
>> this.getClass().getPackage.getName() + ".properties"
>>
> 
> Because wicket.properties is something like a plugin system. It is not
> properties of the Application, but properties which may define Application
> extensions/mixins - o.a.w.IInitilizer.

And in case of jar:// URL it stops at the first matching properties resource 
and ignores the rest. You cannot even control which one is taken.

> I.e. by using IInitialize any Wicket library could participate in the
> application start/stop to setup/cleanup whatever it needs.

Yes, but the current implementation is not compatible with all kind of 
classloaders. A Java ClassLoader does not offer a browse functionality, it 
can only search for stuff with known name. A browsing implementation is 
simply a hack. Wicket contains now code to support all kind of "unusual" 
protocols, e.g. a special one in a JBoss environment. How does the protocol 
looks like in WebLogic, WepSphere, ...? It fails badly at least in a Felix 
environment.

I wonder why Wicket does not simply use the standard Java SPI mechanism? 
Everyone could announce his personal initializers just by adding the class 
names in a resource named "META-INF/services/org.apache.wicket.Initializer".

>> Then you can stop making assumptions about the URL. Unfortunately it is
>> not possible to overwrite this behavior now because the interesting
>> methods are either final or private.
>>
> 
> Patches/PullRequests are very welcome!

As long as any 3rd party Wicket library relies on the fact that anything in 
META-INF/wicket is automatically found, it does not help to overload the 
functionality. Then I can also stick with the deprecated mechanism.

Cheers,
Jörg


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

Reply via email to