hmm
don't like this just checking and then calling a static method...
But if more are liking this better.
How do developers know what to call it? With an interface it is clear.
Jonathan Locke wrote:
i was assuming threadlocal application... but i like your approach
better.
but no interface. instead, use reflection to call static method
init(Application)
my way works for your problem too. only simpler components can just
implement the init() method and not have to write a separate class to
do this.
ones with a zillion resources can decide to do what you're doing by
implementing
a helper class with a static init method. no?
Johan Compagner wrote:
No no static init block that is not possible
remember it has to be done for every Application object there is
inside a webapplication
(ok i know most of the times there will be only one, except our own
big example webapplication.....)
static init block must be replaced by something like this:
interface IComponentResources
{
registerResources(Application application);
}
class MyResources implements IComponentResources
{
registerResources(Application application)
{
new PackageResource(application,MyPage.class,"xxx/yyy.css")
}
}
wicket-resources.properties:
my.package.MyResources
johan
Jonathan Locke wrote:
agree. how about this?
just list class names in META-INF/wicket-components.txt
we load each class in the file. the class registers /itself/
and any resources in its static initializer block. end of story.
Johan Compagner wrote:
ImageIO just works with Services
they have a META-INF/services dir inside the jar
in that dir they have files like:
javax.imageio.spi.ImageReaderSpi
which contains just some lines:
# --- JAI-Image I/O ImageReader plug-ins ---
#
com.sun.media.imageioimpl.plugins.jpeg.CLibJPEGImageReaderSpi
com.sun.media.imageioimpl.plugins.png.CLibPNGImageReaderSpi
com.sun.media.imageioimpl.plugins.jpeg2000.J2KImageReaderSpi
com.sun.media.imageioimpl.plugins.jpeg2000.J2KImageReaderCodecLibSpi
com.sun.media.imageioimpl.plugins.wbmp.WBMPImageReaderSpi
com.sun.media.imageioimpl.plugins.bmp.BMPImageReaderSpi
com.sun.media.imageioimpl.plugins.pnm.PNMImageReaderSpi
com.sun.media.imageioimpl.plugins.raw.RawImageReaderSpi
com.sun.media.imageioimpl.plugins.tiff.TIFFImageReaderSpi
i like this approach, no xml parsing just reading in a file
And we have some more data... (locale)
but maybe I prefer the more wicket way..
just look for wicket.resources files on the classpath.
and in that file there is just a classname
that we call newInstance() on and call a interface method with the
current application object.
then you can code out all youre images.
johan
Martijn Dashorst wrote:
Jonathan Locke wrote:
1. user puts component jars and classfiles on classpath and is
blissfully ignorant of what's going on
2. Application constructor enumerates through jars and classes
via ClassLoader.getResources()
looking for xml metadata, each package containing a
Components.xml file
a. each xml file is processed to register resources for any
components in the jar or classpath folder
b. the minimum format for this xml file would be something
like:
<wicket-components>
<wicket-component
class="wicket.whatever.MyComponent" load="true/false">
<resources>
<package-resource path="images/foo.gif"
locale="en_CA" style="sporty"/>
...
</resources>
</wicket-component>
</wicket-components>
resources not registered using the <resource>
declarations for PackageResources would have to
be registered by setting load="true" and using a static
initializer block to do the work.
we can talk more about the format and where the info
should go, but the basic idea seems solid...
Sounds a lot like HiveMind, Oscar and/or Spring. Maybe we should
borrow the technology for this, instead of inventing our own lingua?
Martijn
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle
Practices
Agile & Plan-Driven Development * Managing Projects & Teams *
Testing & QA
Security * Process Improvement & Measurement *
http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle
Practices
Agile & Plan-Driven Development * Managing Projects & Teams *
Testing & QA
Security * Process Improvement & Measurement *
http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle
Practices
Agile & Plan-Driven Development * Managing Projects & Teams *
Testing & QA
Security * Process Improvement & Measurement *
http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle
Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing
& QA
Security * Process Improvement & Measurement *
http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle
Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing
& QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop