DZone
Java Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Java Zone > Pluggable Spring RC? (OSGi with Spring Rich Client)

Pluggable Spring RC? (OSGi with Spring Rich Client)

Peter Karussell user avatar by
Peter Karussell
·
Sep. 19, 09 · Java Zone · Interview
Like (0)
Save
Tweet
7.41K Views

Join the DZone community and get the full member experience.

Join For Free

my last post was about pure swing, which could be easily osgified. osgi technology can be  used to hotdeploy or undeploy jar files to your application server (at the moment only spring’s server is suggested) or simply to update your swing application at runtime or write plugins for them. i don’t know for sure, but it seems to me that eclipse is the most prominent user of osgi (equinox is one implementation of the specification…) as desktop application, although netbeans can now use osgi bundles .

(btw: do you know a funny myth where the small “i” from osgi could come from? no? read the comments here !)

in the last post i show you several swing applications, which were successfully osgified, today i would like to list swing- or eclipse-based applications which use spring dynamic modules :

  • https://spar.dev.java.net/
  • http://sourceforge.net/projects/agilercp/
  • http://max-server.myftp.org/trac/mp3m/ eclipse rcp
  • http://max-server.myftp.org/trac/pm swing app framework, even webstart will work here

then today, in contrast to my last post, i would like to show you an identical solution for the spring rich client project .

why should i use another framework on the top of osgi? this is simple: spring dm provides several nice features, like no dependency on the osgi implementation ( felix , equinox , knopflerfish ) and even no one on osgi at all. everything (and think) is a bean, like always! but why spring dm? why not declarative services from osgi itself or apache ipojo ? this is simple: i don’t know the others and spring rich client cries for the spring solution ;-)

but to make this short story very short: after struggling the last two days to get spring dynamic modules integrated with spring rich client i gave it up and tried the pure osgi solution – and – it works. it might be an ugly solution for all those of you who like dependency injection, but this can be optimized later. today this might be the first plugin for spring rich client – ever:

osgified-springrc

the button “say hello” with its joptionpane message was installed through the dynamically loaded plugin. the source code is nearly identical to the one in my previous post. just add the spring rc startup before you grab the menu from the application to create a menutracker, which calls the menuservice(=plugin):

@override
public void start(bundlecontext context) throws exception {
startup.start();
menutracker = new menutracker(context, application.instance().getactivewindow().getcontrol().getjmenubar().getmenu(1));
menutracker.open();
}

the source is available from my timefinder project via:

svn checkout -r 595 https://timefinder.svn.sourceforge.net/svnroot/timefinder/trunk timefinder

be sure to start the application from de.timefinder.core.osgi.activator (main method!).

i hope this post inspired someone to be the first one with spring dm + spring rc marriage … or sb. suggests working examples how spring dm could be started from command line or from netbeans.

from http://karussell.wordpress.com

Spring Framework

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Querying Kafka Topics Using Presto
  • Java Hashtable, HashMap, ConcurrentHashMap: Performance Impact
  • Product Owner Anti-Patterns
  • How to Hash, Salt, and Verify Passwords in NodeJS, Python, Golang, and Java

Comments

Java Partner Resources

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo