Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your profile (name, country/region, and company) is displayed to the public and will accompany any content you post. You may update your IBM account at any time.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Apache Derby resources from the Web services perspective, Part 3: Manage Apache Derby using Web Services Distributed Management

David Medinets (david.medinets@gmail.com), Software Consultant, Eclectic Consulting
David Medinets has been programming since 1980, when he started with a TRS-80 Model 1. He still fondly remembers the days when he could cross-wire the keyboard to create funny-looking characters on the display. Since those days, he has spent time debugging the Emacs text editor on UNIX® machines, working on VAXen, and building cutting-edge Web applications (think Toys"R"Us and 7,000 simultaneous users in 1999). David is married to Kathryn and lives in Fairfax, Virginia. He runs Eclectic Consulting and has authored books on Perl, PHP, and BASH. He also runs the CodeBits.com site.

Summary:  So far in this three-part tutorial series about the concept of WS-resources and the Web Services Resource Framework (WSRF), you've created a Person resource and learned how to use WS-Notifications with it. This final installment shows you how to look at WS-Resources from a different perspective -- that of a tangible item rather than a set of information. You'll create a Web service to control the Apache Derby database you've been using throughout this project as well as the client that treats Derby as a WS-Resource.

View more content in this series

Date:  23 Mar 2007
Level:  Intermediate PDF:  A4 and Letter (80 KB | 26 pages)Get Adobe® Reader®

Activity:  9450 views
Comments:  

Before you start

This tutorial is for Java™ developers interested in taking advantage of Apache Derby and Web services. You'll be creating a number of Java classes that expose specific elements of a Derby database through the WSRF and the Web Services Notification (WS-Notification) standard.

About this series

This three-part tutorial series looks at Derby from the perspective of making it Web services aware. Web services are stateless, but most applications are not. In this series you expose database information through a standardized interface that's open and compatible, allowing you to then add and update that information through the same interface.

  • Part 1 showed you how to use WS-Resources to refer to Derby data and structures from within the inherently stateless environment of Web services.
  • Part 2 showed you how to produce and consume Web services notifications with Apache Derby. For example, the database may send out a notification when data is inserted or altered, or when an error occurs. It can also subscribe to a particular event, taking action (such as clearing a table) when it receives a specific notification.
  • This installment, Part 3, builds on Parts 1 and 2 by explaining how to remotely manage the Derby-based application. You'll use a Web service to start and stop the database.

About this tutorial

Parts 1 and 2 of this series focused on the creation of a WS-Resource from a bundle of information -- the Person resource. This resource had all of the qualities and capabilities of a WS-Resource in that it could be created, destroyed, and queried for ResourceProperties. But what about situations in which the resource you want to manage is not quite so abstract? In this tutorial, you'll create a WS-Resource out of the Derby database, rather than its data. In the course of this tutorial, you'll learn:

  • The software necessary for easily creating such an application.
  • How to install all of this software so it works together.
  • How to create a Web service that starts and stops Derby.
  • How to use the Muse software package.
  • How to create a client that starts and stops the database.

The example is fairly straightforward; because it's the database itself you'll manage, you won't build a separate application within the database.


Prerequisites

This tutorial assumes that you're familiar with the basic concept of WS-Resources and with Java programming. Familiarity with Web services will help, but isn't strictly necessary.


System requirements

The two previous tutorials in this series used the binary releases of Apache's Muse project. In this tutorial, you'll use the source release, because you'll be using the very latest version of the project.

You need to download the following to follow along with this tutorial:

  • Apache Ant 1.6.5 -- Ant is a Java-based build tool that uses an XML-based file to control its actions. You'll use Ant to simplify the process of compiling multiple Java files and creating a Web application. It's possible to perform the steps in this tutorial without Ant, but I don't recommend it.
  • Apache Derby 10.2.1.16 -- This is the database you'll be controlling.
  • Java SE 5 -- This tutorial was tested using Java Platform, Standard Edition (Java SE 5), but there's nothing about it that should keep you from using Java 1.4.2.
  • Apache Muse 2.1 -- This framework greatly simplifies your development, providing functionality for managing WS-Resources and a Web Services Description Language (WSDL) template that makes things easier.
  • Apache Tomcat 5.5.20 -- To control the Derby WS-Resource, you'll use a Web service. This tutorial was tested using Tomcat as the Web service engine, but you should be able to use other Web service engines as well.

Note: This example should definitely not be considered production-ready code. Considerations of encryption, authorized access to data, performance, resource caching, and proper exception handling are not discussed. These aspects of Web resources are beyond the scope of this article.

1 of 9 | Next

Comments



static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Open source, Information Management, SOA and Web services
ArticleID=204007
TutorialTitle=Apache Derby resources from the Web services perspective, Part 3: Manage Apache Derby using Web Services Distributed Management
publish-date=03232007
author1-email=david.medinets@gmail.com
author1-email-cc=ruterbo@us.ibm.com