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.
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.
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.
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.
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.