Is OSGi the right approach for us? -
we have support @ least 2 versions of functionality @ same time. can in web side or services, meaning we'll have different layout different users in web or service implementation different different users. should able route users based on login right version of web application / bundle.
we thought of (please see bigger picture here http://i.stack.imgur.com/6nxhf.png).

also possible have multiple web applications / bundles deployed 1 eba? if yes, possible share session between these web apps / bundles? new osgi, looking forward suggestion on design have chosen. appreciate / suggestions on this.
thanks,
bab.
yes, osgi can lot this.
the architecture have chosen looks fine, suggest perhaps adding 'sessionmanager' suggested christian.
regarding osgi specifics need this:
if have 2 different versions of "services" bundle, packaged in same java packages, should define package versions when exporting them in manifests:
in services v1:
export-package: com.acme.foo;version="1.24" and in services v2
export-package: com.acme.foo;version="2.3" you can control package imported in web bundles defining restrictions, e.g. whole intervals:
import-package: com.acme.foo;version="[1.23, 2)" the beauty of due modularity of osgi , separate classloaders of bundles both versions of com.acme.foo can installed , used in same system. cannot achieve in "usual" java setup, because there there 1 classloader , 1 version of package shadow other.
you can see osgi demos , examples example here
this packages , libraries. actual service objects:
you have 2 versions of same service published in osgi service registry. easiest way differentiate between 2 use service properties when registering service:
hashtable properties = new hashtable(); properties.put( "service_flavour", "advanced" ); context.registerservice( someservice.class.getname(), this, properties ); you can use props lookup correct service in web bundles:
servicetracker someservicetracker = new servicetracker(bc, "(&(objectclass="+someservice.class.getname()+")(service_flavour=advanced))", null); someservicetracker.open(); regarding question eba - not sure mean. can install many bundles want in osgi framework, , can register under different aliases in osgi http service. long aliases don't have conflict each other ok. can have 1 main servlet if want, , distribute handling of different pages other bundles without registering them servlets - main web servlet them in osgi service registry example, , distribute work. depends whether expect more application logic/calculations etc, or more formatting , representation of existing data.
hope helps.
Comments
Post a Comment