Comments
Richard Davies wrote: The UK has a good crop of technology pioneers in cloud computing - for example ElasticHosts, FlexiScale, Flexiant, OnApp - and also some strong government initiatives such as G-Cloud. We will have to see whether this kind of technical leadership converts into swift mass-market adoption or not.
Cloud Expo on Google News


2008 West
DIAMOND SPONSOR:
Data Direct
SOA, WOA and Cloud Computing: The New Frontier for Data Services
PLATINUM SPONSORS:
Red Hat
The Opening of Virtualization
GOLD SPONSORS:
Appsense
User Environment Management – The Third Layer of the Desktop
Cordys
Cloud Computing for Business Agility
EMC
CMIS: A Multi-Vendor Proposal for a Service-Based Content Management Interoperability Standard
Freedom OSS
Practical SOA” Max Yankelevich
Intel
Architecting an Enterprise Service Router (ESR) – A Cost-Effective Way to Scale SOA Across the Enterprise
Sensedia
Return on Assests: Bringing Visibility to your SOA Strategy
Symantec
Managing Hybrid Endpoint Environments
VMWare
Game-Changing Technology for Enterprise Clouds and Applications
Click For 2008 West
Event Webcasts

2008 West
PLATINUM SPONSORS:
Appcelerator
Get ‘Rich’ Quick: Rapid Prototyping for RIA with ZERO Server Code
Keynote Systems
Designing for and Managing Performance in the New Frontier of Rich Internet Applications
GOLD SPONSORS:
ICEsoft
How Can AJAX Improve Homeland Security?
Isomorphic
Beyond Widgets: What a RIA Platform Should Offer
Oracle
REAs: Rich Enterprise Applications
Click For 2008 Event Webcasts
SYS-CON.TV
Top Links You Must Click On


TopLink by the Object People
TopLink by the Object People

The distributor had just bought out a few rival businesses in town. The paperwork had been signed, the funds were transferred and the deal was complete. The only detail to be worked out was to link all the locations together into one coordinated unit. The MIS manager was horrified to learn that the databases of the other locations are as diverse as can be. Some of them are relational databases, whereas the home database is of the newer object type. What he needs is a tool that allows him to "wrap" all the databases together into one manageable, tightly knit application. What he needs is TopLink from The Object People.

TopLink is a powerful new application that allows the developer to work at the object level, even if the database in question is relational. The objects are mapped to the database in a non-intrusive manner; therefore, the relational database can be made to behave much like an object database.

Why Not Just Change the Database from Relational to Object?
There are a few good reasons why companies are not willing to do this at this time. One is that relational database technology is regarded as the standard. Accessible through a wide range of applications, the relational database is the one most working professionals are familiar with. The object database, although it has come a long way in the past few years, is still regarded as new, unfamiliar and untested technology. Even if an organization wanted to make the change, the time and expense of re-encoding data and training personnel would scare them away from this option.

TopLink Provides the Perfect Solution for this Dilemma
TopLink allows relational databases and objects to be "bridged" together in a cost-effective manner. If object database technology someday becomes the new standard (some think it will), TopLink can allow an easier migration to this change, saving a lot of time and expense in the process.

What is TopLink?
Basically, TopLink provides a flexible mechanism that allows the end user to store Java objects in relational database tables. It is a layer of Java code between a Java application and the relational database being used. It acts as an object-orientated "wrapper" around the relational database and allows "mapping" of objects into a series of relational tables. This wrapper protects the application from changes in the underlying database. Changes in the database should have no effect on the code in an application.

Installing TopLink
TopLink installation requires:

  • A JDBC driver which can connect with the local database system
  • A version of Java which is compatible with JDBC API

    If your system has an up-and-running Sun JDK 1.1 or higher, it should meet these requirements.

    Installation from the CD-ROM was basic and took only a few minutes. After installation is complete, it is necessary to perform a few steps:

  • The local JDBC drivers must be tested - This is done by entering database login information into some code that is supplied with the installation. The code must then be compiled and executed. If all goes well, a message reading: "Successful Disconnection. Test Complete" will be displayed.
  • Configure the local Java environment - Configure development environment parameters which are IDE specific.
  • Set the appropriate CLASSPATH variable - I ran the application in WIN 95 using JDK 1.1.5, so my CLASSPATH was set to the following:
    TopLink\Classes
    TopLink\Classes\TopLink.zip
    TopLink\Classes\Tools.zip
  • Run a final installation test - This is done by compiling and running some more of the supplied code. A message that reads: "Connection successful" will indicate that all is well.

    Using TopLink
    I found installation and configuration of TopLink to be smooth and uncomplicated. Now that the application is up and running, let's look at what it can do. I'll use the example supplied with the application to demonstrate some of the steps necessary to create a simple database application.

    The sample included with the software is an employee management database. It keeps track of information for all full-time and contract employees, including addresses and phone numbers. The object model being built consists of three classes:
    1. The Employee class represents all employees, both full time and contracted. It includes all personal information, including references to home addresses and phone numbers.
    2. The Address class represents home address. This includes country, street, city and zip code.
    3. The Phone number class contains, as you may have guessed, the phone number including area code.

    Each of the above classes contains cross-references to the others. The relational database stores all of this information in three tables, much in the same fashion that I've built the object model. It is important to point out here that it's not necessary to structure the object model after the table structure of the relational database. The object model can be based on application requirements rather than the database structure. This is a great feature, as the developer is not bound to the relational database structure.

    TopLink communicates with a relational database via a Database Session. This Java class keeps track of the following information:

  • Descriptors - Maintain the associations between tables and Java classes
  • Identity Maps - Used to cache and maintain identity
  • Database Accessor - Handles low level communication between the session and the relational database

    Logging into the Database
    In order to login to a database, it is first necessary to create a JDBCLogin instance. This holds the login parameters including the database name and type. This class is then passed to the DatabaseSession, which allows the login to occur. Here's a small fragment of the code that allows the creation of a login instance:

    Import TOPLink.Public.PublicInterface*;
    Import TOPLink.Public.Exceptions*;
    Project project = TOPLink.Public.
    PublicInterface.Project.read(
    “C:\\TOPLink\\BuilderDemos\\Emloyee.
    project”)

    Now that the database is logged into, it's time to discuss the initialization of the descriptors. This is done by the following steps:
    1. Create a Project using the TopLink Builder tool. This is a stand-alone application used to create and manage the descriptors and mappings. It's GUI interfaced and looks like your typical drop-menu driven application. It obtains data from the database and stores it in Table files. Class Definition files generated from the persistent Java classes are supplied, and the Builder is then used to map the table columns to class attributes. The Builder then writes Descriptor files to these mappings. These are used by the Java application to access the database.
    2. If required, modify your persistent Java classes. It is required that all persistent classes have a public default constructor which has no arguments. If any of the class attributes are declared private, it is necessary to create accessor methods to allow them to be written to the database.
    3. Create Class Definition Files for each of the persistent Java classes. Each of the Java classes in the project must have a descriptor. Opening the Builder and selecting "Add/Update" classes from the Descriptor menu can create these.
    4. Use the Builder's Database Login screen to connect to the database. This is done by selecting "Login To The Database" from the Builder menu. A dialogue box will drop open, allowing database connection information to be entered.
    5. Import table information from the database to the project. This is also done through the builder. All that's involved here is selecting the "Add Existing" from the Tables menu.

    All in all, it really hasn't been too difficult up to this point. There has been a little filling in the blanks of code, and then compiling to run, but most of the major jobs were done by clicking on menus. That's pretty amazing, when you consider just how potent an application this is. This fraction of an example only begins to scrape the surface of just how many uses there are for this powerful builder.

    It is also possible to develop three-tier applications using TopLink. It supports the following databases (and many others through JDBC drivers):

  • Oracle
  • Sybase
  • DB2
  • Microsoft SQL Server

    Mainframe connectivity is also available for legacy data.

    TopLink is one of the more powerful database tools I've seen. It offers flexibility and relative user-friendliness for this type of application. For those of you looking for a powerful tool to develop Java applications by using relational databases, or for someone who wants a good tool to develop a three-tier environment, it is definitely a must see.

    I remember when I first discovered Java. At first I though it was this neat little scripting language that jazzed up Web pages. I almost immediately discovered that I had underestimated its power. I watched that language, in a relatively short period of time, become a major competitor of C, the age-old deity of programming languages. Now, it seems Java is invading the database management and development platforms as well. Will Java take over these traditional applications, and become the dominant development environment of the next century? That remains to be seen, but applications like TopLink provide a good clue as to what just might happen.

    About Ed Zebrowski
    Edward Zebrowski is a technical writer based in the Orlando, Florida, area. Ed runs his own Web development company, ZebraWeb

  • In order to post a comment you need to be registered and logged in.

    Register | Sign-in

    Reader Feedback: Page 1 of 1

    Enterprise Open Source Magazine Latest Stories . . .
    Apache Deltacloud, the Red Hat-contributed ReSTful API that abstracts differences between clouds so services on any cloud can be managed – provided of course there’s a driver – has graduated from the Apache Foundation’s incubator and is now a full-fledged Top-Level Project (TLP). The...
    With Cloud Expo 2012 New York (10th Cloud Expo) just four months away, what better time to start introducing you in greater detail to the distinguished individuals in our incredible Speaker Faculty for the technical and strategy sessions at the conference... We have technical and st...
    AMD said late Tuesday that its chief sales officer Emilio Ghilardi had left the company and that CEO and president Rory Read is going to do his job while a replacement is sought. AMD didn’t say why Ghilardi left but it’s assumed Read wants his own people. Read is relatively new to th...
    During the lifespan of M3 (Monitis Monitor Manager) there has always been something lacking – timers. M3 execution procedure was outlined in this previous article. The execution mentioned in the latter was a one-time-execution, whereas server monitoring requires periodic invocati...
    Red Hat is putting its bought-in Gluster scale-out NAS storage technology, acquired in October, on the Amazon cloud. It’s styled Red Hat Virtual Storage Appliance for Amazon Web Services and other clouds are supposed to follow in short order.
    A new episode of the screencast series is now available at the OpenNebula YouTube Channel. This screencast demonstrates the new easily-customizable self-service portal for cloud consumers. Its aim is to offer a simplified access to shared infrastructure for non-IT end users. The scree...
    Subscribe to the World's Most Powerful Newsletters
    Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
    Click to Add our RSS Feeds to the Service of Your Choice:
    Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
    myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
    Publish Your Article! Please send it to editorial(at)sys-con.com!

    Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021


    SYS-CON Featured Whitepapers
    ADS BY GOOGLE