Overview

The main purpose of NetServe is to provide a simple framework for network services in Java and to lift some burden from the developer's shoulders.

There are three extension points for plugins. Each has it's own specific realm. Let's go into the details.

TCPService

The TCPService extension is first and the primary extension point. Here you've got the opportunity to write your own network service. NetServe opens a server socket and waits for an incoming connection. If a connection is received, NetServe passes a Request to your request handler.

Now it's your time! You have to implement your own IRequestHandler and handle the incoming request. Let's have a quick lock at the IRequestHandler interface. It has one simple method:

public interface IRequestHandler {
        public abstract void handleRequest(Object request);
}

As input you get a request object. But what is a RequestObject? Well, the request object wraps up the socket with the incoming connection and the TCPService configuration.

The configuration object implements the IConfigurationHandler interface. If your service doesn't need any configuration you can forget about it. You'll get a DefaultServiceConfigurationHandler. But most of the time you'll need some configuration. Therefore you have to implement the IConfigurationHandler interface. It has one method:

public interface IConfigurationHandler {
        public void configure(ITypedProperties properties);
}

It's basically a data object with one instance per service. When a service is started the method configure(ITypedProperties properties) is called. The ITypedProperties reflect your XML configuration. To give your service access to those values you're likely implementing a bunch of getters.

Global registry extension

The global registry is the second extension point. It started from the need to have pooled database connection. Since it's not practical to have for each and every service a separate connection pool the concept of a global registry was introduced.

Controller extension

The controller extension is the third extension point and emerged with the need to start and stop services at runtime, enable hot deploy of jars and gathering runtime information.