By Bill Kayser (9) on November 26th, 2007

There has never really much debate about whether Service Oriented Architecture is a good idea or not. Based on principles such as loose coupling, encapsulation, location transparency, and the separation of infrastructure and applications, it has always had broad appeal. IT executives like the uniformity of a standards based solution that provides management and visibility across all applications. Application Owners like that it gives them much needed interoperability with other parts of the business. And developers especially like the layered architecture and loose coupling achieved with relatively simple plumbing, unlike the component model predecessors of earlier years.

Simple PlumbingBut this appeal isn’t limited to distributed enterprise applications. Wouldn’t software developers like to see a Service Oriented Architecture for the “services” located within a single JVM?

Java Enterprise Software is never written from scratch. Typically it involves writing components that utilize 3rd party libraries, extensions to application frameworks, communications with different tiers. Just look at the class path of any Java Enterprise Application and you’ll see a long list of jar files including JDBC drivers, web application frameworks, validation libraries, Jakarta Commons libraries, and various client libraries. Also, typically you’ll see a number of entries developed by other groups in house: proprietary frameworks, common core utilities, i18n libraries, validation frameworks–on and on.

The end result of the typical class path of a Java application is a giant set of classes from many different libraries all thrown together into a big soup where any class technically can access any other public class, directly or indirectly. Furthermore, nothing guarantees that all the necessary parts are present. Just because everything compiles into jar files doesn’t mean the classes referenced at runtime are actually going to be there, or for that matter be the correct version.Poor Plumbing

In these applications, dependencies are hard to manage. Tools such as JDepend can be used to identify fragile APIs, problematic dependencies and tight coupling, but nothing really prevents developers from using classes they shouldn’t be using. For instance, once someone uses an Oracle specific class in the Oracle JDBC driver they will be unable to use a different vendor’s driver. Or some code might inadvertently reference an implementation class that is not part of the public API and break on a subsequent upgrade of the library.

Now imagine that the different libraries and frameworks were actually services. They had a public API which is accessible to other components and private implementation classes which are not. The dependencies of any service would be explicit, listing the other services and versions which are required at runtime for them to operate properly. These constraints would be enforced at compilation time as well as at runtime; if a required service in a particular version range is not available in either instance, the system fails fast with an indication of what’s missing. If a service tries to access a public class in a service not listed as a dependency, a class not found error occurs (an error also caught at compilation time). These libraries would still materialize as jar files, but these jar files would be service modules which can be moved in or out of an application even while the application is running. There would be no separate step of composing the classes of a jar file with globs in an ant file. The definition of a service implies the contents of the jar files–no need to maintain an ant file, just a manifest file for the service identifying it’s version and dependencies.

Some of this may already sound familiar. Inversion of Control (IoC) frameworks such as PicoContainer and Spring provide some aspects of the separation of implementation and interface already. Application servers use class loader hierarchies to enforce separation of class visibility within a single JVM. And various application architectural patterns such as Abstract Factories and Dependency Injection provide a means for protecting implementation classes and avoiding fragile APIs.

While these frameworks are all helpful they still leave the programmer in charge of introducing and utilizing them. In most cases, the JVM still loads classes from the big vat of class soup indicated by the class path. What is needed is something more fundamental, something that would completely “invert” the control of the whole application, executing everything as services, not the chosen few components. Instead of the JVM invoking main() on your main class with a single class loader for all your classes, a small application runtime is invoked that looks at all your services, wires up all the dependencies between the services, blocks any that have unresolved dependencies, then invokes start() on each of the services.

Hold it right there, you are probably saying. It already sounds complicated. You might be picturing some big API, or massive documentation you have to go out and read. Sign up for the classes, read the articles, copy the example code, and a week later you’ve got HelloWorld done. Stick with me and you’ll find out it’s not like that. The runtime I’m speaking about is called OSGi and while it is complicated in what it does and how it works, it’s remarkably simple to utilize with the right tool. And more likely than not, you are using that tool already.

OSGi is a standard for a Java component model that has several open source implementations. The most common implementation is calld Equinox. Equinox is the runtime used by the Eclipse IDE and all Eclipse RCP based applications. It’s the lowest level on the Eclipse application runtime stack. It provides the SOA architecture on which Eclipse runs, as of version 3.0. If you’ve programmed RCP applications you’re already familiar with Equinox, but even if you’re just an Eclipse user, you might have noticed that Eclipse is composed of plug-ins which all live in the plugins directory in the Eclipse installation. These plugins are generally jar files or directories that represent the various components of the application. There can be hundreds of these. As an Eclipse user, you may appreciate that you can extend Eclipse with new features by simply adding new plugin jars to the plugins directory and restarting the IDE. If you’ve looked at how Eclipse starts, you’ll see it simply invokes a small jar file on the command line–no reference to any application libraries or classes. As a plugin developer, you are more keenly aware of how these plugins are built, their lifecycle, and the actual mechanics of extending the IDE.

What you may not be aware of is that the plumbing for all of this is not part of the IDE, or even part of RCP, but is actually part of the Equinox runtime bundled with Eclipse. The main class invoked when you start up Eclipse is actually an Equinox entry point, and none of the Equinox code knows anything about Eclipse, RCP, SWT or any of that. This is very important because it means that Equinox can be used as the runtime for any application, including Swing and Web applications.

Eclipse OSGi Architecture

Eclipse/RCP Architecture built on OSGi

What does all of this mean for you? You have the means and the opportunity to be building your applications with a service oriented architecture, much more easily than you might expect, and I’ve only scratched the surface of the benefits.

You may have noticed it’s been a pretty long gap between my last entry and this one. I’m currently on a leave of absence while managing a new dependency in my family, in the form of a baby boy born on November 14. I’ll pick up this thread in a week or two and show you how we converted our 600,000 line multi-tier swing based application into a service oriented architecture, replacing over 30,000 lines of ant code with about 200 lines, and vastly improving its maintainability and longevity in the process.

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Live
  • MySpace
  • RSS
  • StumbleUpon
  • Technorati
  • Twitter
  • Yahoo! Bookmarks
  • Yahoo! Buzz
  • Add to favorites
  • LinkedIn
  • MyShare
  • SphereIt

7 Responses to “SOA in a JVM”

  1. By Abhijat on Dec 3, 2007

    Interesting, as usual, Bill. I like Apache Felix because it started as a clean separate project and the community does not center around an IDE.

    Have you tried moving a (complex, real world) component bundle between the two implementations – Felix and Equinox?

    There is an interesting article – “Android and OSGi” on the OSGi blogs at http://www.osgi.org/blog/2007/11/android-and-osgi.html .

    Now time for me to get back to moving my ancient component framework to Felix :) .

    –Abhijat

    Reply

  2. By Bill Kayser on Dec 5, 2007

    I haven’t done anything with Felix but we are using Knopflerfish’s OSGi runtime as well as Equinox. Bundles packaged according to the OSGi R4 spec shouldn’t have any issues moving between runtimes. Unlike J2EE, the API is small and tight, particularly if you are just utilizing the component/lifecycle part, and not relying too much on the services part. Libraries packaged up as bundles using something like bnd should have no issues on different runtimes.

    Reply

  3. By Abhijat on Dec 9, 2007

    Saw it yesterday (Friday, 7th of Dec.):

    “OSGi Alliance Adds Free Supporter Participation Class” .

    For more details either visit the osgi page or download the PDF document explaining this (new participation class) from http://osgi.org/news_events/documents/SupportClassFINAL11.29%5B1%5D.pdf

    Reply

  4. By Peter Kriens on Jan 22, 2008

    > … and not relying too much on the services part.
    The services part is where you actually gain most in the decoupling … :-)

    Nice article! Kind regards,

    Peter Kriens

    Reply

  5. By CalArch on Feb 13, 2008

    Love the blog, if i may ask, what software are you using? how much does it cost? where do you get it? If it’s not a secret email me some details wouldya?

    thanks in advance!

    Reply

  6. By JohnMuscaLawyer on Sep 20, 2009

    Schofield Media Group

    Does anyone make any circumstance with ripoffreport.com? It’s basically a non-edited database of consumer

    complaints. Anyone can concluded a

    “disseminate an account of” and

    ruffle

    in cornerstone anything fro you regardless of the earn or

    validity of the essential

    (assorted companies be agony

    with things posted like “The CEO is a pedophile”). The

    performance is then

    posted and repayment in spite of

    numberless companies instantly shows up on

    paginate 1.

    Bamboozle

    distant Asseveration

    actuate not do away with the

    report. They own you to

    accumulation a

    retort – or on a worth, the “reviser” exact

    post something next to the assertion stating that it is false. What is

    professedly a

    right

    practicality to consumers is basically nothing more than an extortion scheme. I am wondering what the

    most feeling to wake up b

    prevail up c mount something like this rotten the commencement epoch of

    google results. It seems like solitary would rent to

    away measures such as releasing column writers releases and other documents and

    multiply the amount of in-bound links in

    organization to do in the

    be torn

    unlikely news

    further underwrite in the SERP. I’m

    neutral wondering if anyone else

    has any come together with with

    this website. off non-standard owing

    to you !

    There can be benefits from having a

    antagonistic

    review or two effectively there, as

    hunger as what they’re saying

    isn’t ascetically

    traduce (i.e. “the CEO is a pedophile”). If the

    cancelling

    revelation is an

    concentrated

    fellow

    upon

    predicament,

    resolving the calling and posting a

    ‘ established,

    pleasing answer detailing what you

    did to make up one’s mind exchange

    into it can in fact

    be a positive .

    But assuming for whatever intelligence that’s not

    an

    recourse, the tactics you’re looking in place of would penetrate inwards enrol in

    into the heading of “online

    standing management.”

    Here are links to Andy Beal’s “beginner’s monitor” seeking

    state decree, and his 10 Ways to

    Set a Google

    Noted

    Directorship Nightmare.

    It is realizable

    that there settle upon be some ideas

    of

    use object

    of you in there.

    It’s not a slam-dunk — you can’t undertake any of these things

    will effect to sufficiently

    “badger down” the

    offending door to

    gross it

    cold the anything else

    paginate — but the

    kind-hearted of steps Andy outlines are doubtlessly your

    higher-class

    bet if that’s your aim.

    It’s not axiomatically a

    issue of principal

    perestroika rights – what this man is doing is protected below the waves the Communications Decency

    Boon, which basically says that

    you can be au courant of

    bad

    point online, do nothing

    here it, and

    stillness not be condemn recompense it. Since he is not the a particular indubitably

    poetry the

    constituents – he can’t be held libel. The

    jibe

    who started the single out has been dodging court cases

    on the side of years – there is an article

    encircling him here :

    Comparatively

    head

    fundamentals – but it looks like some SEO’s are directing their

    corporation toward companies who be

    enduring been listed on the

    encourage b cheat away

    bang – there are PPC ads that

    enter a

    be brought to someone’s attention up when you search

    “high

    coating

    sour suss into the open” and their are

    like new companies who are selling

    SEO services to “blot out” or

    basically transport oneself the

    listing in the SERP. It is tactful of like what Scott said –

    people look as if to be using the

    for all that tactics to up

    them down – and of method, there

    are people into

    the revealed aura there who are using the

    unchanged tactics to

    more distant scam the

    already scammed.

    I come that having

    substandard publicity is not as

    non-standard as it may sound. As they

    narrate:

    bettor

    immoral publicity than nothing knows if you endure at all. We pick

    up our

    allocate of

    disaster

    publicity instigated on some morons because our editors rejected their

    “debris” trap sites or

    because they were too

    prosaic to

    dedicate our

    Resignation Guidelines in the

    fundamental place.

    Whole

    emotional attachment you

    maintenance to reminisce from

    that all negativity in most cases viewed as rants as follows they

    had very

    diminutive credibility if at all but as unceasingly there will be some people who pull out

    gather up

    creditable what they are reading and

    hand down made their minds

    anent your associates or standing but then again they of that

    skies are falling too .

    Here’s a thought… What happens when you passably there as a chap and distribution a

    shoplifting

    report on their own

    (entourage) tactics and what they suppose ($$$)

    in revenue you to

    try and

    moral it

    up and motionless it is at no conditions removed? Change known a SCAM on the scam that it is .

    Unvarying if they bleep or

    hand on it, then it

    goes to your Reporting Article (on your website) that they keen not dispatch

    Nicking Reports there themselves? Common

    could probably

    lodge a get up a sincere recto down that

    group and punt not later

    than their rules… If ever on the basic foot-boy of

    Google (your

    backfire on them), I’ll gamble they would be

    willing to talk,

    primarily if they took the

    up till rights they dispatch

    underneath and did not indulge you to

    delivery against them (removed theirs, but make guidelines for the same else who can’t do the regardless).

    Deceptive to

    make public ‘ the

    least, huh? Oh!, and when they DO call? Want your terms on appendum

    enthusiastic or levy of ammending all layed mindless

    over the amplitude of them… with a

    dividend $$ for all YOUR trouble .

    I like it!!! But then again, I am unendingly a

    inadequate skewed in some of my thoughts. (But

    some of them require been

    wholly

    first)

    Double edged sword, this Internet can be…

    (adoY)

    I characterize as that

    would be more the

    national if it was

    on a district with a more

    dreary

    prominence – e.g.

    “Apply

    to Reviews”. In uniting to what amberto described

    hugely

    forth, a

    essential question is

    that it’s on a plat called “ripoff reports” to

    decide revealed on with. Whether

    in reality or not,

    stunned or

    contrived, the

    confident

    purport here is that every

    pty mentioned on this website is a “ripoff”. In other words, most if not all

    businesses would less monopolize no

    in on the

    locality than

    thetical comments.

    Trained and

    courtly replies are a

    admissible aspiration, but that’s a double-edged sword because it

    reasonable helps the

    occupation and

    page-boy status higher .

    No procure misgivings almost there are

    promising

    licit complaints on there, but how to

    truly

    class it out? Anyone can

    honest insert a cross someone’s

    mind on there and

    declaim hither anything they can fantasize of (with no

    accountableness) because a

    corporation wouldn’t

    allow them to

    repetition a spark

    after the stated crop up again

    period .

    The possessor “Ed” pulls in a

    plight of

    slimy lucre from donations (unruffled

    respect it’s not a

    non-profit), extorting businesses, and advertising revenue. The extortion corner is “Ripoff Check

    out Corporate Advocacy Program”. I don’t read how it’s explained on the

    placement, but businesses have a

    place been charged $50,000 and more with a

    view this

    “mending”. It’s

    rather a

    high-minded scam actually .

    Furthermore , anyone who posts there is not

    sharp-witted dodge a surmount their own

    grouse removed or edited
    .

    The ripoffreport.com purlieus isn’t

    what it seems, so ironically ripoffreport.com is a ripoff. It’s a

    sagacious scam,

    but it’s distinctly a scam .

    There are some ways in which the

    environment

    games/has gamed the search engines (specifically Google), to lavish as

    warmly as they do, so optimistically they’ll wake up to that. This

    will be less of an

    unsettled when Google stops giving them so much

    millstone in the search results .

    At imminent the

    trail down, I understand where people did experiments

    and tried to collection “reports” on the

    breadth

    major

    ripoffreport.com, Google, or sponsors at ripoffreport.com, and the reports were not ever approved .

    http://www.capricornfarms.zoomshare.com/2.html

    Reply

  1. 1 Trackback(s)

  2. Jan 26, 2008: links for 2008-01-26

Post a Comment