users@jersey.java.net

Re: [Jersey] RAD hacking of Jersey apps with JRebel...

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 17 Mar 2010 16:40:57 +0100

On Mar 17, 2010, at 1:51 PM, James Strachan wrote:

> On 17 March 2010 12:08, Paul Sandoz <Paul.Sandoz_at_sun.com> wrote:
>>
>> On Mar 17, 2010, at 12:19 PM, James Strachan wrote:
>>
>>> On 17 March 2010 09:39, Paul Sandoz <Paul.Sandoz_at_sun.com> wrote:
>>>>
>>>> Hi James,
>>>>
>>>> Having had a quick look at the JavaDoc i believe it should be
>>>> possible to
>>>> plugin in similar to what was mentioned in the blog entry.
>>>>
>>>> From the link you send on the forum a developer states:
>>>>
>>>> "but to implement ReloadListener requires having javarebel
>>>> included for
>>>> the
>>>> project, which I do not intend to do. "
>>>>
>>>> I do not see how this can be avoided in some sense, since Jersey
>>>> needs to
>>>> be
>>>> notified when JavaRebel detects changes. This seems to be more of
>>>> an
>>>> implementation detail.
>>>>
>>>> If there was a jersey-java-rebel module this would isolate things
>>>> appropriately and we might be able to declare the
>>>> ContainerNotifier in
>>>> the
>>>> META-INF/services, although i am not totally sure about that.
>>>
>>> Yeah; I was hoping we could go the META-INF/services route so that
>>> you
>>> could put the jersey-jrebel moduel in your glassfish/jersey plugin
>>> in
>>> maven; adding it to the classpath when you run your app in
>>> glassfish/jersey/whatever - yet your app and your WAR stays free
>>> from
>>> JRebel.
>>
>> OK. I anticipate we should be able to do something like:
>>
>> public class Reloader implements ContainerNotifier, ReloadListener {
>> @PostConstruct
>> public void postConstruct() {
>> // Not sure this can be performed in the constructor
>> ReloaderFactory.getInstance().addReloadListener(this);
>> }
>>
>> // Synchronized in case JRebel notifications while ContainerListener
>> // is being added.
>> private final List<ContainerListener> ls =
>> Collections.synchronizedList(new ArrayList<ContainerListener>());
>>
>> public void addListener(ContainerListener l) {
>> ls.add(l);
>> }
>>
>> // JRebel notification methods
>> ... ...() {
>> for (ContainerListener l : ls) {
>> l.onReload();
>> }
>> }
>> }
>
> Looks good to me.
>
>> Do you know if JRebel is available from a maven repo?
>
> I managed to find this
> http://blogs.codehaus.org/people/mkleint/2009/07/maven-netbeans-platform-javare.html
>
> looks like the SDK is in the repo...
> http://repos.zeroturnaround.com/maven2/
>
> I guess this could be it?
> http://repos.zeroturnaround.com/maven2/org/zeroturnaround/jr-sdk/3.0-M2/
>

Thanks, that should be enough to chew on and create an appropriate
module.

Paul.