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

SYS-CON.TV
Cloud Expo & Virtualization 2009 East
PLATINUM SPONSORS:
IBM
Smarter Business Solutions Through Dynamic Infrastructure
IBM
Smarter Insights: How the CIO Becomes a Hero Again
Microsoft
Windows Azure
GOLD SPONSORS:
Appsense
Why VDI?
CA
Maximizing the Business Value of Virtualization in Enterprise and Cloud Computing Environments
ExactTarget
Messaging in the Cloud - Email, SMS and Voice
Freedom OSS
Stairway to the Cloud
Sun
Sun's Incubation Platform: Helping Startups Serve the Enterprise
POWER PANELS:
Cloud Computing & Enterprise IT: Cost & Operational Benefits
How and Why is a Flexible IT Infrastructure the Key To the Future?
Click For 2008 West
Event Webcasts
A String Bean: Making JavaBeans With VAJ
A String Bean: Making JavaBeans With VAJ

Visual Age for Javaª provides a good IDE for object oriented development. One of the strong points of Visual Age for Java is its support for JavaBeans. As everyone in the world knows by now JavaBeans are components, or software parts, from which applications can be built. This has been the holy grail of object-oriented development, and Visual Age for Java supports it well. It provides a convenient, connect-the-dots metaphor for assembling an application from parts.

One of the obvious questions one might ask, of course, is, "Where do the parts come from?" IBM does supply some JavaBeans with Visual Age for Java but, naturally, they won't do everything. If you need parts, and they're not available, Visual Age for Java makes the process easy. Once you've made the new parts they are reusable in any application. They can even be exported for use outside VAJ.

I'll illustrate this with the String Bean. Let's say you've developed a number of string handling functions that could be used in various situations or programs. You could simply include them when they're needed in a new application but JavaBeans provides a better alternative. You can reuse Beans without changing, or even knowing about, the code itself. You can then expose the methods or properties of the Bean and connect your application to them.

For example, you might need to parse an input string into its component words. If a method for this was included in a String Bean, you could design the input applet or application frame visually in Visual Age for Java using the supplied design beans, adding an instance of the String Bean to your frame and then connecting the JavaBeans. These are the steps you need to take to create a simple application that will allow input of a text string, and then display the individual words of the string in a list box at the click of a button.

First, open Visual Age for Java and create a new applet. When prompted for project and package names, use StringBeanProj and StringBeanPack. The hierarchy should look something like that in Figure1.

Next, create a new class and name it StringBean, but choose not to design it visually. Be sure to import the java.awt.* and java.util.* packages when prompted. Then, create a new method for the StringBean class called stringToken with a signature of public static void stringToken (String Instring, List fillList). Add the code block in Listing 1 and save it.

Now, if you select the BeanInfo tab you see a list of all available features and properties for the new StringBean bean. It should look like Figure 2.

Next, select the StringBeanPack package in the hierarchy and click the C button to build a new class. Call this class StringBeanView and select the choice to design it visually, or go to the Visual Composition editor. After the blank applet panel is displayed, you'll need to add the appropriate beans from those supplied with Visual Age for Java to complete the application/applet. First, add a TextField bean. Then, add a List bean. Finally, add a Button bean and change the label property of the bean to String Bean.

You're ready to add the StringBean JavaBean we just created. From the main menu select Options, then Add Bean. In the dialog box displayed, you can either type StringBean or choose to Browse through the available beans and select it off the list. Click OK, then click again anywhere outside the frame boundary and the jigsaw part icon for StringBean1 to appear.

Now that all the beans are in place it's time to connect them together. For the first connection click the right mouse button on the String Bean Button, then select Connect and then actionPerformed(java.awt.event.ActionEvent) from the drop down menus. Move the mouse pointer to the StringBean1 icon and click mouse button 1, then select All Features. From the bean Features list, select the stringToken() method created earlier.

For the second connection to the TextField bean click mouse button 2 on the first connection line and select Connect. From the list displayed, select inString. Drag the mouse pointer to the TextField bean and click mouse button 1. From the list displayed, select text.For the third connection to the List bean click mouse button 2 on the first connection line and select Connect. From the list displayed, select fillList. Drag the mouse pointer to the List bean and click mouse button 1. From the list displayed, select "this."

Now that all the connections between the beans are complete the design panel should look like Figure 3.

You can test the StringBean applet by selecting Tools->Test->Run from the main menu of Visual Age for Java. Type some text into the TextField(be sure to leave some blanks between words), click the String Bean button and a list of the words in the input string will be displayed in the list box.

I'm sure you can see how this humble foundation could be used to build more extensive applications. Other string handling and manipulation functions can be added to the StringBean bean at any time, making their addition to a new application a simple drag and drop operation. You could even add a StringBean feature that changes string text colors from black to green!

About Mike Fichtelman
Mike Fichtelman is a certified senior project manager at IBM supporting their Web hosting business. He has over 20 years' experience in the information technology field as a developer, designer, and project manager. Mike has an MBA from Hofstra University and his work has been published in a number of journals on subjects ranging from infrastructure to the development of wireless applications using Java, XML, and WAP. He also teaches an e-business course in the MBA program at the University of Phoenix.

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

Register | Sign-in

Reader Feedback: Page 1 of 1

Latest Cloud Developer Stories
Rackspace Hosting, the service leader in cloud computing, on Thursday announced its acquisition of SharePoint911, an industry leader in SharePoint consulting, training, and "JumpStart" services within SharePoint. The unification of both companies provides capabilities to deliver ...
With Cloud Expo 2012 New York (10th Cloud Expo) now under 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 techn...
Nimble, the social CRM platform has announced the launch of Nimble 2.0, billed as the “most social” CRM platform on the market today. Nimble was designed entirely with social CRM in mind and is the first social business platform that empowers companies with the ability to get clo...
2011 was a year of rapid adoption for public and private cloud services. Instant and on-demand server provisioning was the driving force behind the massive growth. On top, cloud server templates and script automation simplified application installation for simple and pre-defined ...
"Having been in the IT field for many years, I believe the cloud computing chapter in the industry is an exciting one and I am proud to be a part of it," said National Reconaissance Office (NRO) Chief Information Officer Jill T. Singer Tuesday, as it was announced that she was on...
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

Breaking Cloud Computing News
Joyent Cloud, the highest performance public cloud, and Amplify, a startup accelerator focused on su...