Hit the ground running with AIDE, Part 1: Building a touchpoint - IBM

Hit the ground running with AIDE, Part 1: Building a touchpoint - IBM Hit the ground running with AIDE, Part 1: Building a touchpoint - IBM

25.03.2013 Views

Hit the ground running with AIDE, Part 1: Building a touchpoint Skill Level: Intermediate Stephen B. Morris CTO Omey Communications 18 Apr 2006 This tutorial, the first in a series on the IBM Autonomic Integrated Development Environment (AIDE), shows how you can get up and running quickly with the IBM AIDE toolkit. Discover touchpoint creation, modification, and deployment and learn about the internals of the touchpoint in relation to the underlying model. Section 1. Before you start Learn what to expect from this tutorial and how to get the most out of it. About this series This tutorial is the first in a series that describes techniques for the development of autonomic computing technology using the IBM® Autonomic Integrated Development Environment (AIDE) toolkit. This tutorial was written as a type of one-stop shop for new AIDE users; its goal is to get you comfortable using the AIDE toolkit, the associated technologies, the design philosophy, and the examples that come bundled with the toolkit. The remaining tutorials in the series will describe touchpoint deployment on several platforms, including Linux®, MySql, and Apache. By the end of the series, you should have a sound understanding of the development of autonomic technology on generic and open source platforms. Building a touchpoint Trademarks © Copyright IBM Corporation 2006. All rights reserved. Page 1 of 23

<strong>Hit</strong> <strong>the</strong> <strong>ground</strong> <strong>running</strong> <strong>with</strong> <strong>AIDE</strong>, <strong>Part</strong> 1: <strong>Building</strong><br />

a <strong>touchpoint</strong><br />

Skill Level: Intermediate<br />

Stephen B. Morris<br />

CTO<br />

Omey Communications<br />

18 Apr 2006<br />

This tutorial, <strong>the</strong> first in a series on <strong>the</strong> <strong>IBM</strong> Autonomic Integrated Development<br />

Environment (<strong>AIDE</strong>), shows how you can get up and <strong>running</strong> quickly <strong>with</strong> <strong>the</strong> <strong>IBM</strong><br />

<strong>AIDE</strong> toolkit. Discover <strong>touchpoint</strong> creation, modification, and deployment and learn<br />

about <strong>the</strong> internals of <strong>the</strong> <strong>touchpoint</strong> in relation to <strong>the</strong> underlying model.<br />

Section 1. Before you start<br />

Learn what to expect from this tutorial and how to get <strong>the</strong> most out of it.<br />

About this series<br />

This tutorial is <strong>the</strong> first in a series that describes techniques for <strong>the</strong> development of<br />

autonomic computing technology using <strong>the</strong> <strong>IBM</strong>® Autonomic Integrated<br />

Development Environment (<strong>AIDE</strong>) toolkit. This tutorial was written as a type of<br />

one-stop shop for new <strong>AIDE</strong> users; its goal is to get you comfortable using <strong>the</strong> <strong>AIDE</strong><br />

toolkit, <strong>the</strong> associated technologies, <strong>the</strong> design philosophy, and <strong>the</strong> examples that<br />

come bundled <strong>with</strong> <strong>the</strong> toolkit.<br />

The remaining tutorials in <strong>the</strong> series will describe <strong>touchpoint</strong> deployment on several<br />

platforms, including Linux®, MySql, and Apache. By <strong>the</strong> end of <strong>the</strong> series, you<br />

should have a sound understanding of <strong>the</strong> development of autonomic technology on<br />

generic and open source platforms.<br />

<strong>Building</strong> a <strong>touchpoint</strong> Trademarks<br />

© Copyright <strong>IBM</strong> Corporation 2006. All rights reserved. Page 1 of 23


developerWorks® ibm.com/developerWorks<br />

The major benefit of autonomic computing on <strong>the</strong>se platforms is standards-based<br />

manageability. Too many operational software systems have ei<strong>the</strong>r proprietary point<br />

management facilities or are essentially unmanaged. The result is that resources are<br />

wasted because automated management procedures don't account for <strong>the</strong>m. Worse<br />

than this, many such systems are not optimized and are vulnerable to <strong>the</strong> threats of<br />

partial or complete failure and external attacks.<br />

The manageability requirements for autonomic computing consist of<br />

self-configuration, self-healing, self-optimization, and self-protection -- o<strong>the</strong>rwise<br />

known as self-CHOP. This requirement set underlies <strong>the</strong> autonomic computing<br />

philosophy that it is no longer sufficient merely to produce and deploy software and<br />

systems; ra<strong>the</strong>r, <strong>the</strong>se entities must now be augmented <strong>with</strong> standard open<br />

management capabilities above and beyond what can be achieved <strong>with</strong> proprietary<br />

instrumentation. The <strong>IBM</strong> vision for such management capability consists in large<br />

part of <strong>the</strong> <strong>touchpoint</strong> concept -- a relatively thin layer of software that interacts <strong>with</strong><br />

a managed resource to facilitate <strong>the</strong> requirements of automatic management.<br />

This series is for anyone who knows a bit of programming and who wants to better<br />

understand <strong>the</strong> growing need for manageable systems and software. The series'<br />

intention is to help autonomic computing programmers to become as productive as<br />

possible as quickly as possible. With this in mind, <strong>the</strong> tutorial openly discusses any<br />

problems encountered using <strong>the</strong> software and provides workarounds and solutions -things<br />

you can't get from <strong>the</strong> Help file!<br />

About this tutorial<br />

This tutorial describes how to get started <strong>with</strong> <strong>the</strong> <strong>AIDE</strong> toolkit and takes you from<br />

<strong>the</strong> point of installing and starting to use <strong>the</strong> toolkit to creating a complete <strong>touchpoint</strong>.<br />

In moving beyond <strong>the</strong> early stages of using <strong>the</strong> technology, you learn how to use<br />

and modify <strong>the</strong> <strong>touchpoint</strong> examples that are bundled <strong>with</strong> <strong>the</strong> package.<br />

For this introductory tutorial, <strong>the</strong> platform is generic: Any platform that supports <strong>the</strong><br />

Eclipse and <strong>AIDE</strong> toolkit pair. For example, Microsoft® Windows® XP is more than<br />

adequate.<br />

In this tutorial, you learn how to use <strong>the</strong> <strong>AIDE</strong> toolkit to create a fully functional<br />

autonomic computing <strong>touchpoint</strong>. In addition, you learn how to modify and test<br />

<strong>touchpoint</strong> code.<br />

Prerequisites<br />

This tutorial is written for programmers <strong>with</strong> a reasonable knowledge of Java<br />

programming, Eclipse, and system management. The ability to use an integrated<br />

development environment (IDE) such as Eclipse and <strong>the</strong> various tools and plug-ins<br />

<strong>Building</strong> a <strong>touchpoint</strong> Trademarks<br />

© Copyright <strong>IBM</strong> Corporation 2006. All rights reserved. Page 2 of 23


ibm.com/developerWorks developerWorks®<br />

that go <strong>with</strong> it is helpful but not necessary. Likewise, a basic understanding of <strong>the</strong><br />

following is useful:<br />

• SOAP<br />

• Web Services Addressing (WS-Addressing)<br />

• Web Services Distributed Management (WSDM)<br />

System requirements<br />

To run <strong>the</strong> examples in this tutorial, <strong>the</strong> minimum platform requirements are a<br />

computer <strong>running</strong> Windows XP on which you've installed <strong>the</strong> <strong>AIDE</strong> software and<br />

Apache Tomcat V5.<br />

Note: You can use Apache Tomcat V4, but you must use <strong>the</strong> compatibility package,<br />

as well.<br />

Section 2. Getting started<br />

<strong>AIDE</strong> is an Eclipse-based integrated development environment for <strong>the</strong> creation and<br />

maintenance of autonomic computing <strong>touchpoint</strong>s. <strong>AIDE</strong> accommodates <strong>the</strong> needs<br />

of architects and programmers alike <strong>with</strong> full support for modeling as well as code<br />

generation. Touchpoints can also be deployed onto a range of application servers.<br />

To start using <strong>AIDE</strong> quickly, use Tomcat V5. If you don't want to update your Java<br />

software development kit (JDK) or your <strong>IBM</strong> Java Runtime Environment (JRE), <strong>the</strong><br />

Apache Tomcat V4 compatibility package is available for download from <strong>the</strong> Apache<br />

Tomcat home page.<br />

Install <strong>AIDE</strong><br />

Installing <strong>AIDE</strong> is similar to installing o<strong>the</strong>r Eclipse plug-ins, although <strong>the</strong>re isn't really<br />

an installation program as such. The <strong>AIDE</strong> zip file contains two folders -- one named<br />

Features and ano<strong>the</strong>r named Plugins. Copy <strong>the</strong> contents of <strong>the</strong> Features folder into<br />

<strong>the</strong> Features folder of your Eclipse installation (ECLIPSE_HOME/features or, on a<br />

computer <strong>running</strong> Windows, %ECLIPSE_HOME%/features). Similarly, copy <strong>the</strong><br />

contents of <strong>the</strong> Plugins folder into <strong>the</strong> Plugins folder of your Eclipse installation<br />

($ECLIPSE_HOME/plugins or, for Windows, %ECLIPSE_HOME%/plugins).<br />

<strong>Building</strong> a <strong>touchpoint</strong> Trademarks<br />

© Copyright <strong>IBM</strong> Corporation 2006. All rights reserved. Page 3 of 23


developerWorks® ibm.com/developerWorks<br />

Restart Eclipse. The plug-ins are loaded; you should see <strong>the</strong> <strong>AIDE</strong><br />

help/cheatsheets/docs folder in <strong>the</strong> Help > Help Contents menu. These help<br />

documents include <strong>the</strong> overview of WS-RF/WSDM/AC, <strong>the</strong> run-time environment,<br />

tooling basics, examples, and so on.<br />

Gotchas and pitfalls<br />

The name of <strong>the</strong> installation folder into which you install <strong>the</strong> toolkit should be<br />

something short, such as C:\MyApps. I experienced problems getting <strong>the</strong> sample<br />

<strong>touchpoint</strong>s to work when I had long paths and folder names <strong>with</strong> embedded spaces.<br />

I reinstalled <strong>the</strong> toolkit and <strong>the</strong>se problems went away. So keep it simple!<br />

After you start using <strong>AIDE</strong>, keep a close eye on <strong>the</strong> Eclipse console window for any<br />

error messages. The toolkit generates a lot of informational messages interspersed<br />

<strong>with</strong> occasional error messages (for example, if something isn't working properly).<br />

Section 3. <strong>Building</strong> your first <strong>touchpoint</strong><br />

The steps to create a project and a basic <strong>touchpoint</strong> are described in some detail in<br />

<strong>the</strong> <strong>AIDE</strong> online help files. The purpose of this tutorial is to get you up and <strong>running</strong><br />

quickly, so I will briefly describe <strong>the</strong> main steps required to create <strong>the</strong> basic<br />

<strong>touchpoint</strong> and make it operational <strong>with</strong>out your having to refer to <strong>the</strong> help.<br />

Note: It can be a bit cumbersome trying to view <strong>the</strong> online help while <strong>running</strong> <strong>the</strong><br />

various wizards. If you need to access <strong>the</strong> help often, consider printing <strong>the</strong> relevant<br />

pages before <strong>running</strong> <strong>the</strong> wizards.<br />

Create a Manageability Endpoint Project<br />

Now that you've installed all <strong>the</strong> required software, open <strong>the</strong> Eclipse workbench.<br />

Create a new Manageability Endpoint Project by completing <strong>the</strong> following steps:<br />

1. Click File > New > Autonomic Integrated Development Environment.<br />

2. Select Manageability Endpoint Project and <strong>the</strong>n click Next.<br />

3. Type <strong>the</strong> project name PlatformProject.<br />

4. Click Finish.<br />

<strong>Building</strong> a <strong>touchpoint</strong> Trademarks<br />

© Copyright <strong>IBM</strong> Corporation 2006. All rights reserved. Page 4 of 23


ibm.com/developerWorks developerWorks®<br />

You have a container for <strong>the</strong> manageability endpoint; now you must fill it. Start by<br />

creating <strong>the</strong> <strong>touchpoint</strong> type.<br />

Create <strong>the</strong> <strong>touchpoint</strong> type<br />

From <strong>the</strong> Eclipse workbench, complete <strong>the</strong> following steps:<br />

1. Click File > New > Autonomic Integrated Development Environment.<br />

2. Select Touchpoint Type and <strong>the</strong>n click Next.<br />

3. Type http://tempuri.org/PlatformProject for <strong>the</strong> <strong>touchpoint</strong><br />

type name.<br />

4. Click Finish to include <strong>the</strong> bare minimum in <strong>the</strong> <strong>touchpoint</strong> type.<br />

If you prefer, you can configure <strong>the</strong> default name space from <strong>the</strong> Manageability<br />

Endpoint Builder properties. To do so, complete <strong>the</strong> following steps:<br />

1. Click Window > Preferences.<br />

2. In <strong>the</strong> Preferences window, expand Autonomic Integrated Development<br />

Environment, <strong>the</strong>n select Manageability Endpoint Builder.<br />

3. Type <strong>the</strong> default namespace you want to use (for example,<br />

http://ibm.com).<br />

Create <strong>the</strong> <strong>touchpoint</strong> capability<br />

From <strong>the</strong> Eclipse workbench, complete <strong>the</strong> following steps:<br />

1. Click File > New > Autonomic Integrated Development Environment.<br />

2. Select Touchpoint Capability.<br />

3. Click Next to create an empty capability, <strong>the</strong>n click Next again.<br />

4. Type http://tempuri.org/PlatformProject for <strong>the</strong> name space.<br />

5. Click Finish.<br />

With <strong>the</strong> <strong>touchpoint</strong> capability set up, create <strong>the</strong> <strong>touchpoint</strong> implementation<br />

<strong>Building</strong> a <strong>touchpoint</strong> Trademarks<br />

© Copyright <strong>IBM</strong> Corporation 2006. All rights reserved. Page 5 of 23


developerWorks® ibm.com/developerWorks<br />

definition.<br />

Create <strong>the</strong> <strong>touchpoint</strong> implementation definition<br />

From <strong>the</strong> Eclipse workbench, complete <strong>the</strong> following steps:<br />

1. Click File > New > Autonomic Integrated Development Environment.<br />

2. Select Touchpoint Implementation, <strong>the</strong>n click Next.<br />

3. Click Finish.<br />

You've finished <strong>with</strong> <strong>the</strong> creation wizards for this <strong>touchpoint</strong>. Now, you're ready to<br />

generate <strong>the</strong> Java code and <strong>the</strong> associated utilities. Your <strong>touchpoint</strong> model is nearly<br />

complete.<br />

Section 4. Working <strong>with</strong> <strong>the</strong> <strong>touchpoint</strong><br />

Learn how to generate and run your <strong>touchpoint</strong>.<br />

Generate <strong>the</strong> <strong>touchpoint</strong><br />

From <strong>the</strong> Eclipse workbench, complete <strong>the</strong> following steps to generate <strong>the</strong><br />

<strong>touchpoint</strong> implementation definition:<br />

1. Right-click <strong>the</strong> Touchpoint Implementation definition, <strong>the</strong>n click Generate<br />

Touchpoint to launch <strong>the</strong> Generate Touchpoint Implementation Wizard.<br />

2. Click Add Touchpoint Type.<br />

3. Add <strong>the</strong> <strong>touchpoint</strong> type you created in <strong>the</strong> section on creating <strong>the</strong><br />

<strong>touchpoint</strong> type.<br />

4. Click Finish.<br />

Clicking Finish initiates <strong>the</strong> automatic code-generation process, after which you<br />

should see new files and folders in <strong>the</strong> workspace pane, shown in Figure 1.<br />

Figure 1. The generated files<br />

<strong>Building</strong> a <strong>touchpoint</strong> Trademarks<br />

© Copyright <strong>IBM</strong> Corporation 2006. All rights reserved. Page 6 of 23


ibm.com/developerWorks developerWorks®<br />

<strong>Building</strong> a <strong>touchpoint</strong> Trademarks<br />

© Copyright <strong>IBM</strong> Corporation 2006. All rights reserved. Page 7 of 23


developerWorks® ibm.com/developerWorks<br />

Note <strong>the</strong> separation between <strong>the</strong> model and <strong>the</strong> generated code. These two entities<br />

exist independently of one ano<strong>the</strong>r, which facilitates <strong>the</strong> use of model-driven<br />

development and allows for separate ownership of <strong>the</strong> model and its associated<br />

instantiation (in code). So, architects and designers can control and own <strong>the</strong> model,<br />

while programmers are responsible for <strong>the</strong> code and any associated customizations.<br />

This arrangement accommodates <strong>the</strong> emerging trend toward architecture-driven<br />

software development.<br />

Ano<strong>the</strong>r powerful aspect of <strong>AIDE</strong> is its substantial use of wizard technology. As <strong>with</strong><br />

any use of wizards, this behavior facilitates efficient and accurate design and<br />

development workflows. It's likely that future versions of <strong>AIDE</strong> will extend this<br />

function to make <strong>the</strong> process of <strong>touchpoint</strong> generation increasingly automated.<br />

Run <strong>the</strong> <strong>touchpoint</strong><br />

You're ready to run <strong>the</strong> <strong>touchpoint</strong> on Apache Tomcat (or whichever Web container<br />

you choose). From <strong>the</strong> Eclipse workbench, complete <strong>the</strong> following steps:<br />

1. Open a command prompt and run deploy.bat in <strong>the</strong><br />

WebContent\WEB-INF folder.<br />

2. Right-click <strong>the</strong> project, <strong>the</strong>n click Run As > Run on Server.<br />

If Apache Tomcat isn't <strong>running</strong>, step 2 starts <strong>the</strong> server for you after you register <strong>the</strong><br />

required server. This process launches <strong>the</strong> Run On Server wizard, shown in Figure<br />

2.<br />

Figure 2. The Run On Server wizard<br />

<strong>Building</strong> a <strong>touchpoint</strong> Trademarks<br />

© Copyright <strong>IBM</strong> Corporation 2006. All rights reserved. Page 8 of 23


ibm.com/developerWorks developerWorks®<br />

Click Finish to run <strong>the</strong> <strong>touchpoint</strong> on <strong>the</strong> Apache Tomcat server. If everything is<br />

correctly installed, you should see something like Figure 3.<br />

Figure 3. The finished <strong>touchpoint</strong><br />

<strong>Building</strong> a <strong>touchpoint</strong> Trademarks<br />

© Copyright <strong>IBM</strong> Corporation 2006. All rights reserved. Page 9 of 23


developerWorks® ibm.com/developerWorks<br />

You have your autonomic launch pad. Now, look at <strong>the</strong> <strong>touchpoint</strong>.<br />

Section 5. The <strong>touchpoint</strong> schema<br />

Learn how to create <strong>the</strong> <strong>touchpoint</strong> schema and avoid common <strong>touchpoint</strong>-related<br />

pitfalls.<br />

<strong>Building</strong> a <strong>touchpoint</strong> Trademarks<br />

© Copyright <strong>IBM</strong> Corporation 2006. All rights reserved. Page 10 of 23


ibm.com/developerWorks developerWorks®<br />

Create and browse <strong>the</strong> <strong>touchpoint</strong> schema<br />

Start by clicking Create & browse to display <strong>the</strong> schema and <strong>the</strong> allowed<br />

operations. The Create link contacts a software factory that in turn creates a new<br />

instance of <strong>the</strong> manageability endpoint. It also displays <strong>the</strong> property values of <strong>the</strong><br />

endpoint in a table and provides form controls for manipulating <strong>the</strong> endpoint. This is<br />

a basic manager.<br />

Problem: Touchpoint non-deployment<br />

If you forget to deploy <strong>the</strong> <strong>touchpoint</strong> on Apache Tomcat, you might see <strong>the</strong><br />

exception shown in Figure 4.<br />

Figure 4. An exception<br />

<strong>Building</strong> a <strong>touchpoint</strong> Trademarks<br />

© Copyright <strong>IBM</strong> Corporation 2006. All rights reserved. Page 11 of 23


developerWorks® ibm.com/developerWorks<br />

This problem is easily fixed. Simply follow <strong>the</strong> steps outlined in <strong>the</strong> section on<br />

<strong>running</strong> <strong>the</strong> <strong>touchpoint</strong> to run deploy.bat. After <strong>the</strong> <strong>touchpoint</strong> has been successfully<br />

deployed, you should be able to click Create & browse or View WSDL <strong>with</strong>out<br />

exceptions occurring.<br />

Problem: Running multiple instances of Apache Tomcat<br />

Occasionally, you might encounter <strong>the</strong> error message shown in Figure 5.<br />

Figure 5. Trying to run Tomcat twice<br />

Test in your browser<br />

If you want to test <strong>the</strong> <strong>touchpoint</strong> outside Eclipse, point your browser<br />

to http://localhost:8080/PlatformProject. You should see <strong>the</strong> same<br />

window as shown in Figure 3 during <strong>the</strong> Eclipse test. You can carry<br />

out <strong>the</strong> same schema examination and operations steps as above<br />

using your browser.<br />

Again, this problem is easily fixed. Identify <strong>the</strong> <strong>running</strong> instance of Tomcat, stop it,<br />

and <strong>the</strong>n retry. If for some reason Eclipse itself is <strong>running</strong> Tomcat yet you can't run<br />

your <strong>touchpoint</strong>, restart Eclipse to fix <strong>the</strong> problem.<br />

Undeploying <strong>the</strong> <strong>touchpoint</strong><br />

When you're finished <strong>with</strong> <strong>the</strong> <strong>touchpoint</strong>, you can "undeploy" it by opening a<br />

command prompt and <strong>running</strong> undeploy.bat in <strong>the</strong> WebContent\WEB-INF folder (<strong>the</strong><br />

same folder that contains deploy.bat).<br />

Section 6. Model-driven development<br />

<strong>Building</strong> a <strong>touchpoint</strong> Trademarks<br />

© Copyright <strong>IBM</strong> Corporation 2006. All rights reserved. Page 12 of 23


ibm.com/developerWorks developerWorks®<br />

The steps you've taken to create a <strong>touchpoint</strong> are, in fact, steps to create a model.<br />

The elements of this model consist of:<br />

• Touchpoint types<br />

• Touchpoint capabilities<br />

• Touchpoint implementation guidelines<br />

The <strong>AIDE</strong> toolkit comes bundled <strong>with</strong> three examples of preconfigured <strong>touchpoint</strong>s:<br />

• Apache Derby Database example<br />

• Wea<strong>the</strong>rStation example<br />

• Generic Log Adapter (GLA) Touchpoint example<br />

I discuss <strong>the</strong> Wea<strong>the</strong>rStation example later, but you can extract, import, and build<br />

<strong>the</strong>se models yourself by following <strong>the</strong> steps described in <strong>the</strong> online help.<br />

When you generate code, you are in a sense instantiating <strong>the</strong> model for an<br />

execution environment. The <strong>touchpoint</strong> is an abstraction for a managed resource.<br />

Using <strong>the</strong> Wea<strong>the</strong>rStation example that comes bundled <strong>with</strong> <strong>AIDE</strong>, <strong>the</strong> associated<br />

model entities appear in Figure 6.<br />

Figure 6. The Wea<strong>the</strong>rStation <strong>touchpoint</strong> model elements<br />

You employ this model to create an executable <strong>touchpoint</strong> that matches your<br />

management system environment. In o<strong>the</strong>r words, your management system can<br />

execute <strong>the</strong> <strong>touchpoint</strong> and use it to acquire data from and control <strong>the</strong> operation of<br />

<strong>the</strong> underlying managed resource.<br />

Gotchas and pitfalls<br />

The many steps and wizard interactions associated <strong>with</strong> model-driven development<br />

can seem a bit of a drag at first. Don't despair: It's worth pursuing, because this is<br />

increasingly how software is being produced. If you need more information on this<br />

subject, <strong>the</strong> online Help has many excellent articles and worked examples on <strong>the</strong><br />

<strong>Building</strong> a <strong>touchpoint</strong> Trademarks<br />

© Copyright <strong>IBM</strong> Corporation 2006. All rights reserved. Page 13 of 23


developerWorks® ibm.com/developerWorks<br />

Eclipse Modeling Framework (EMF), Service Data Objects (SDO), and so on. These<br />

are well worth reading in <strong>the</strong>ir own right as well because of <strong>the</strong> light <strong>the</strong>y shed on <strong>the</strong><br />

approach <strong>IBM</strong> is taking on <strong>touchpoint</strong> technology.<br />

Change <strong>touchpoint</strong> parts<br />

As mentioned earlier, <strong>AIDE</strong> uses Eclipse-based model facilities (called <strong>the</strong> Eclipse<br />

Modeling Framework) to generate <strong>the</strong> <strong>touchpoint</strong>. The online Help includes details<br />

about <strong>the</strong> way <strong>AIDE</strong> uses <strong>the</strong> EMF.<br />

In this section, I use <strong>the</strong> Wea<strong>the</strong>rStation example <strong>touchpoint</strong> packaged <strong>with</strong> <strong>the</strong><br />

<strong>AIDE</strong> toolkit. The help files provide detailed directions for building and deploying this<br />

example. Following <strong>the</strong>se directions and <strong>the</strong> above steps, you will be able to run <strong>the</strong><br />

<strong>touchpoint</strong> as shown in Figure 7.<br />

Figure 7. The Wea<strong>the</strong>rStation <strong>touchpoint</strong><br />

<strong>Building</strong> a <strong>touchpoint</strong> Trademarks<br />

© Copyright <strong>IBM</strong> Corporation 2006. All rights reserved. Page 14 of 23


ibm.com/developerWorks developerWorks®<br />

Experiment <strong>with</strong> this <strong>touchpoint</strong>, clicking <strong>the</strong> various buttons and observing <strong>the</strong><br />

resulting operations and any associated data changes. For example, clicking<br />

Kickme() to reload <strong>the</strong> schema data executes Java code; you should see some text<br />

fly past in <strong>the</strong> console window. Scroll up <strong>the</strong> console window to reveal <strong>the</strong> text from<br />

<strong>the</strong> Kickme() method, which is "I've been kicked!" You modify this text in <strong>the</strong> next<br />

section so that you can see how relatively easy it is to change and rebuild <strong>the</strong><br />

underlying generated source code.<br />

You can also change some of <strong>the</strong> data in <strong>the</strong> schema. Try typing some text in <strong>the</strong><br />

Insert box -- for example, Hello World!. Click <strong>the</strong> down control to display <strong>the</strong><br />

schema items and select Description from <strong>the</strong> drop-down list as shown in Figure 8.<br />

<strong>Building</strong> a <strong>touchpoint</strong> Trademarks<br />

© Copyright <strong>IBM</strong> Corporation 2006. All rights reserved. Page 15 of 23


developerWorks® ibm.com/developerWorks<br />

Figure 8. Setting data<br />

Change <strong>the</strong> Description schema variable field by clicking Insert, which initiates<br />

<strong>the</strong> update. Then scroll down to <strong>the</strong> Description field in <strong>the</strong> schema to see <strong>the</strong><br />

modified text. This is an example of what's often called a set operation -- modifying<br />

managed data. As you can imagine, this operation can be quite sensitive in a real<br />

system. By setting <strong>the</strong> wrong item or applying erroneous data to an item, you can<br />

actually do damage.<br />

<strong>Building</strong> a <strong>touchpoint</strong> Trademarks<br />

© Copyright <strong>IBM</strong> Corporation 2006. All rights reserved. Page 16 of 23


ibm.com/developerWorks developerWorks®<br />

So, an important element of allowing set messages is <strong>the</strong> associated<br />

au<strong>the</strong>ntication, authorization, and auditing procedures. Many networking vendors<br />

only allow read permission and require additional configuration of <strong>the</strong>ir products<br />

before management system-originated updates can be made.<br />

There are many reasons for this approach, not least of which is avoiding (or at least<br />

minimizing <strong>the</strong> effect of) Denial of Service (DoS) attacks that use set messages. If<br />

set messages aren't allowed, such messages are dropped quickly, <strong>the</strong>reby<br />

minimizing <strong>the</strong> amount of processing.<br />

A quick look at <strong>the</strong> generated Java code<br />

As described in <strong>the</strong> online help, <strong>the</strong> Java source code consists of three major<br />

sections:<br />

• ibm: The location of <strong>the</strong> code that <strong>AIDE</strong> generated to implement your<br />

manageability endpoint.<br />

• proxy: The location of Java proxies for your manageability endpoint.<br />

• tests: The location of Java tests for your manageability endpoint.<br />

You should edit only <strong>the</strong> ibm item. The EMF allows for modifications to <strong>the</strong> .impl<br />

classes while still allowing for future model updates. In o<strong>the</strong>r words, you can change<br />

<strong>the</strong> .impl Java code now and still allow for future model updates and code<br />

regeneration. The next section shows how <strong>the</strong> EMF meets this seemingly<br />

contradictory requirement.<br />

Customize <strong>the</strong> <strong>touchpoint</strong> code<br />

If you followed <strong>the</strong> steps in <strong>the</strong> online Help regarding this project (copying <strong>the</strong><br />

Wea<strong>the</strong>rStationImpl.java file from <strong>the</strong> extracted files into <strong>the</strong> generated project<br />

folder), <strong>the</strong>re should be a method called kickme(), which is shown in Listing 1.<br />

Change <strong>the</strong> code displayed in bold in Listing 1.<br />

Listing 1. A method in Wea<strong>the</strong>rStationImpl.java<br />

/**<br />

* <br />

* <br />

* @generated NOT<br />

*/<br />

public void Kickme() throws<br />

BaseFault<br />

{ this.erratic = true;<br />

System.out.println("I've been<br />

<strong>Building</strong> a <strong>touchpoint</strong> Trademarks<br />

© Copyright <strong>IBM</strong> Corporation 2006. All rights reserved. Page 17 of 23


developerWorks® ibm.com/developerWorks<br />

kicked!");<br />

}<br />

The Wea<strong>the</strong>rStationImpl.java class derives from <strong>the</strong> EMF EDataObjectImpl<br />

class.<br />

An important aspect of Listing 1 is <strong>the</strong> comment line: @generated NOT. This line is<br />

a directive to <strong>the</strong> code generator to indicate that <strong>the</strong> code following <strong>the</strong> tag is user<br />

code. If you regenerate <strong>the</strong> code, <strong>the</strong> generator detects a collision and simply<br />

discards <strong>the</strong> generated version of <strong>the</strong> method. This behavior provides a convenient<br />

mechanism for <strong>the</strong> peaceful co-existence of user code and generated code.<br />

Now, change <strong>the</strong> contents of <strong>the</strong> kickme() method. Using Eclipse (or a text editor if<br />

you prefer), complete <strong>the</strong> following steps:<br />

1. Open Wea<strong>the</strong>rStationImpl.java in <strong>the</strong> JavaSource\ibm\com\impl<br />

folder.<br />

2. Search for <strong>the</strong> text, "I've been kicked," change it to Ouch, I've been<br />

kicked!, and save <strong>the</strong> Java file.<br />

3. Undeploy <strong>the</strong> Wea<strong>the</strong>rStation <strong>touchpoint</strong>.<br />

4. Open <strong>the</strong> Wea<strong>the</strong>rStationModels project.<br />

5. Right-click <strong>the</strong> Wea<strong>the</strong>rStation.actpim file, <strong>the</strong>n click Generate<br />

Touchpoint.<br />

6. Accept <strong>the</strong> defaults appropriate to your environment.<br />

7. Deploy <strong>the</strong> Wea<strong>the</strong>rStation <strong>touchpoint</strong>.<br />

8. When you click Kickme(), you should see <strong>the</strong> updated text string in <strong>the</strong><br />

console -- namely, "Ouch, I've been kicked!"<br />

Congratulations! In spite of taking a bit of a kicking, you've just made your first code<br />

change to an autonomic computing <strong>touchpoint</strong>! You've also seen how to regenerate<br />

<strong>the</strong> <strong>touchpoint</strong> from <strong>the</strong> model. This is perhaps a good point at which to dig deeper<br />

and describe some of <strong>the</strong> key principles of information technology (IT) management.<br />

First however, let's see how to return your project to its unchanged state.<br />

Revert to <strong>the</strong> unchanged project<br />

It's easy enough to get back to <strong>the</strong> original project state. Even though you've made a<br />

trivial change (in this case), you need to know how to get back to square one,<br />

<strong>Building</strong> a <strong>touchpoint</strong> Trademarks<br />

© Copyright <strong>IBM</strong> Corporation 2006. All rights reserved. Page 18 of 23


ibm.com/developerWorks developerWorks®<br />

especially if you make changes that you later want to remove. To revert to <strong>the</strong><br />

unchanged project, complete <strong>the</strong> following steps:<br />

1. Undeploy <strong>the</strong> <strong>touchpoint</strong> from Apache Tomcat.<br />

2. Stop <strong>the</strong> instance of Apache Tomcat <strong>running</strong> in <strong>the</strong> Eclipse workbench.<br />

3. Remove <strong>the</strong> <strong>touchpoint</strong> from Apache Tomcat as shown in Figure 9.<br />

Figure 9. Deleting <strong>the</strong> Tomcat <strong>touchpoint</strong> instance<br />

4. Close any editors that have files open belonging to <strong>the</strong> project.<br />

5. Right-click <strong>the</strong> generated project, <strong>the</strong>n click Delete.<br />

6. When prompted to select <strong>the</strong> contents, click Delete all.<br />

7. Restart <strong>the</strong> Eclipse workbench.<br />

<strong>Building</strong> a <strong>touchpoint</strong> Trademarks<br />

© Copyright <strong>IBM</strong> Corporation 2006. All rights reserved. Page 19 of 23


developerWorks® ibm.com/developerWorks<br />

8. Regenerate <strong>the</strong> <strong>touchpoint</strong>.<br />

Note that this procedure removes any user code changes, so make sure that you<br />

save any modified files that you want to keep. You should now be back to a clean,<br />

freshly generated project. Now, of course, you must redeploy <strong>the</strong> project on Apache<br />

Tomcat and re-register a Tomcat instance.<br />

Gets, sets, and events<br />

By its nature, IT management is a problem of distributed computing. A manager<br />

entity typically resides at location x and <strong>the</strong> managed entity (or entities) resides at<br />

location y. So, for management to occur, you must get data from x to y and back<br />

again. Traditionally, this problem has been solved using a simple model that allows<br />

managed data (on <strong>the</strong> managed entity) to be:<br />

Gets<br />

• Updated (through set operations)<br />

• Retrieved (through get operations)<br />

• Notified to <strong>the</strong> manager (through event operations)<br />

So far in this tutorial, you've seen get and set operations. A get operation is<br />

equivalent to reading data from <strong>the</strong> managed entity or device or a proxy entity.<br />

In network management, <strong>the</strong> operation that corresponds to a read is called polling.<br />

In this procedure, <strong>the</strong> manager explicitly selects a given device or software entity<br />

and requests data from it. The remote device or software entity receives <strong>the</strong> request,<br />

ga<strong>the</strong>rs <strong>the</strong> required data (if it can), and sends a response message back to <strong>the</strong><br />

manager. If such messages are security-enabled, <strong>the</strong> managed entity may have<br />

more work to do in au<strong>the</strong>nticating and authorizing <strong>the</strong> operation.<br />

Needless to say, polling can be an expensive operation on large networks. On a<br />

more subtle level, polling can also consume considerable resources on <strong>the</strong> managed<br />

entity -- for example, if tables need to be traversed or large numbers of complex<br />

values must be computed.<br />

Sets<br />

A set operation amounts to a modification of data on <strong>the</strong> entity or device. The scope<br />

for performing set operations is quite wide, ranging from modifying <strong>the</strong><br />

administrative status of a network port to disabling packet forwarding.<br />

Ano<strong>the</strong>r common use for set operations is to initiate long-<strong>running</strong> operations, such<br />

<strong>Building</strong> a <strong>touchpoint</strong> Trademarks<br />

© Copyright <strong>IBM</strong> Corporation 2006. All rights reserved. Page 20 of 23


ibm.com/developerWorks developerWorks®<br />

as FTP file transfers. The latter can occur when it's required to update firmware on a<br />

given device or when backing up <strong>the</strong> configuration of a network device.<br />

Events<br />

So, what happens when an important data change occurs on <strong>the</strong> managed entity?<br />

Often, such changes can be significant -- for example, a partial hardware failure, an<br />

unexpected temperature rise, or <strong>the</strong> onset of congestion on a given port. How does<br />

<strong>the</strong> managed entity tell <strong>the</strong> manager? The answer lies in <strong>the</strong> use of events or<br />

notifications. The next tutorial in this series provides more details on this key topic.<br />

Section 7. Summary<br />

This tutorial introduced you to <strong>the</strong> <strong>IBM</strong> <strong>AIDE</strong> toolkit. You should now be equipped<br />

<strong>with</strong> a general appreciation of this Eclipse-based environment. No software system<br />

is perfect and I've attempted to describe and provide workarounds for potential<br />

stumbling blocks.<br />

An important element of management system technology is a basic description of<br />

<strong>the</strong> general philosophy of this important field. You saw some details on this<br />

philosophy throughout this tutorial, including examples of get and set operations.<br />

You also saw how to make minor changes to <strong>the</strong> generated code. As <strong>the</strong> series<br />

progresses, I'll expand on this coverage, showing you how to build <strong>touchpoint</strong>s for<br />

Linux, MySql, and Apache.<br />

<strong>Building</strong> a <strong>touchpoint</strong> Trademarks<br />

© Copyright <strong>IBM</strong> Corporation 2006. All rights reserved. Page 21 of 23


developerWorks® ibm.com/developerWorks<br />

Resources<br />

Learn<br />

• New to Autonomic computing: A guide to introduce you to autonomic<br />

computing.<br />

• "Simulate autonomic resources in your IT system" (developerWorks, April<br />

2005): This tutorial demonstrates how to simulate autonomic resources using<br />

<strong>the</strong> <strong>IBM</strong> Manageability Endpoint Simulator.<br />

• The autonomic computing edge: Keeping in touch <strong>with</strong> <strong>touchpoint</strong>s<br />

(developerWorks, August 2005): This Edge article describes what a <strong>touchpoint</strong><br />

is, how <strong>touchpoint</strong>s encapsulate managed resources, and some things to<br />

consider when designing <strong>touchpoint</strong>s.<br />

• developerWorks technical events and webcasts: Stay current <strong>with</strong><br />

developerWorks technical events and Webcasts.<br />

• developerWorks autonomic computing zone: Stay up to date on <strong>the</strong> latest<br />

developments and technology in autonomic computing <strong>with</strong> <strong>the</strong> developerWorks<br />

autonomic computing zone.<br />

Get products and technologies<br />

• Autonomic Computing Toolkit: The Toolkit is a collection of <strong>IBM</strong> self-managing<br />

autonomic computing technology components, tools, scenarios, and<br />

documentation designed for users wanting to learn, adapt, and develop<br />

autonomic behavior in <strong>the</strong>ir products and systems.<br />

• <strong>IBM</strong> Autonomic Integrated Development Environment (<strong>AIDE</strong>): A set of software<br />

development tools that embrace <strong>the</strong> Web Services Distributed Management<br />

(WSDM) standard. Includes tools such as <strong>the</strong> <strong>IBM</strong> Manageability Endpoint<br />

Builder (for building endpoints that allow products to expose manageability<br />

interfaces) and <strong>the</strong> <strong>IBM</strong> Manageability Endpoint Simulator (previously known as<br />

<strong>IBM</strong> Touchpoint Simulator).<br />

• <strong>IBM</strong> trial products for download: Build your next development project <strong>with</strong> <strong>IBM</strong><br />

trial software, available for download directly from developerWorks.<br />

Discuss<br />

• developerWorks blogs: <strong>Part</strong>icipate in developerWorks blogs and get involved in<br />

<strong>the</strong> developerWorks community.<br />

• Join <strong>the</strong> discussion: Drop in on <strong>the</strong> "Autonomic computing: an insider's<br />

perspective" discussion forum.<br />

<strong>Building</strong> a <strong>touchpoint</strong> Trademarks<br />

© Copyright <strong>IBM</strong> Corporation 2006. All rights reserved. Page 22 of 23


ibm.com/developerWorks developerWorks®<br />

About <strong>the</strong> author<br />

Stephen B. Morris<br />

Stephen is <strong>the</strong> CTO of Omey Communications in Ireland. For <strong>the</strong> past<br />

20 years, Stephen has worked for some of <strong>the</strong> world's largest<br />

networking companies on a wide range of software projects, including<br />

J2EE/J2SE-based network management systems, billing applications,<br />

porting and developing SNMP entities, network device technologies,<br />

and GSM mobile networking applications. He is <strong>the</strong> author of Network<br />

Management, MIBs and MPLS: Principles, Design and Implementation<br />

(Prentice Hall PTR, 2003) as well as several articles on network<br />

management and o<strong>the</strong>r topics for InformIT and OnJava.com. You can<br />

reach Stephen at stephenbjm@yahoo.com.<br />

<strong>Building</strong> a <strong>touchpoint</strong> Trademarks<br />

© Copyright <strong>IBM</strong> Corporation 2006. All rights reserved. Page 23 of 23

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!