History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: OSGI-549
Type: Improvement Improvement
Status: Open Open
Priority: Major Major
Assignee: Costin Leau
Reporter: Thomas Joseph
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Spring OSGi

WarScanner should be customizable

Created: 27/Jun/08 06:02 AM   Updated: 02/Jul/08 12:34 AM
Component/s: WEB
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified


 Description  « Hide
I would have liked a different strategy to be used to identify my bundle as being a web bundle, rather than searching for WEB-INF/web.xml. This is what the Default Scanner does.

The need for this could be an organizational one, that one simply would adopt other strategies to make the bundle appear as a traditional war. The point however is that there definitely needs to be such a flexibility. Of course, let the DefaultWarScanner function as it is.

If I look at the WarListenerConfiguration, I can see that it tries to get customised warScanner, however, the interface for it - the "WarScanner" itself is not exported by the web-extender bundle.

I would like to add that I would want to declare the implementation class outside the fragment. I think there is no reason why I should declare the bean definitions in the fragment bundle and keep the implementations outside.

I wish even the WarScanner to be like ContextPathStrategy and WarDeployer. The WarScanner could be exported, and not kept as an internal one.

 All   Comments   Work Log   Change History   FishEye   Related Builds      Sort Order: Ascending order - Click to sort in descending order
Thomas Joseph - 27/Jun/08 06:05 AM
Please read "... I think there is no reason why I should declare the bean definitions in the fragment bundle and keep the implementations outside. "

as "I think there is no reason why I should declare the bean definitions in the fragment bundle and could not keep the implementations outside."

Costin Leau - 30/Jun/08 10:37 AM
Thomas, could you please provide more input on how having the war customizable would help in your case? Btw, I'm planning on changing the default implementation to simply consider bundles with .war extension - this will support servlet 2.5 wars as well (whcih are based only on annotations), static wars not to mention that it will be closed to the behaviour in S2AP.

Thomas Joseph - 01/Jul/08 04:37 AM
Costin, what you have told is another valid situation where the .war extension is used to determine the bundle as a web-bundle.

In my case, I would like to have the web ui be split into modules. Modules like the shipping module will be build as a saparate bundle containing the ui components. Now consider that i would like to supply this bundle as a part of various other web-applications to be deployed at various client centers. Essentially, this module can now be part of various web applications, interaction of which would be leveraged by OSGi. In effect, my web ui (module) bundles will also work like any other bundle in OSGi, that would add up functionality to an existing bundle.

In this case, I would like my web module bundles (that will not have a web.xml) be recognised as a bundle to be deployed to web container, but should be treated in a different way altogether. This would require that the war-scanner be customisable. Right now, I am doing all this inside a fragment bundle, but I would be happy if I could move this out of the fragment bundle. (I am too early speaking on this, as I have just started off on it)

With the above idea (or using the .war), some of the method names such as getWebXmlConfiguration seem to be tied up to the web.xml concept. I don't know whether now you would consider the original requirement of customising the warScanner, or rather this would spark up a totally new idea in your mind.

Costin Leau - 01/Jul/08 04:49 AM
The warScanner is meant to run along the web deployer - if you don't have a web-inf/web.xml and your bundle is not war then the deployer (that is the web container) will not know what to do with it.
Or am I missing something here?
My point is that the web extender works with a certain workflow which you'd like to generalize. From what I understand, you won't reuse most of the web extender/web components and it seems that just creating your own extender would work better.

Thomas Joseph - 01/Jul/08 05:16 AM
Costin, I have mentioned my intentions above. Probably you are right, that I may end up writing my own web extender. But, as of now I am starting with writing fragment to the web-extender.

As I had mentioned above, I have just started off, I will get back to this issue once I am more clear.

BTW, it was good that you provided extending the WarScanner even as a fragment, since, I could start my work right away.!

Costin Leau - 01/Jul/08 05:39 AM
Thomas how exactly are you using the web scanner when the interface itself is internal? Even if you define a bean, if the type is not compatible, the configuration will not be picked up.

Thomas Joseph - 02/Jul/08 12:14 AM
I created a spring xml configuration file under /META-INF/spring/extender with an entry like this:

    <bean id="warScanner"
        class="point.to.class.inside.same.bundle.MyWarScanner" />

This class will implement the WarScanner interface. Now, my War Scanner logic is used instead of the default one.

Was this the reply you wanted?

Costin Leau - 02/Jul/08 12:34 AM
Ah right - now I understand why you have to put your scanner inside the fragment and not outside (as you would normally would).
Thomas, feel free to report back any feedback that you have but let me state that you are using an internal interface and internal behaviour which might change w/o a replacement at any point.