Home News Products Online Demos Shop Contact CSCare Inc.

ServiceConsole

Java Cartridges


This page explains, what the Service Console cartridge is and how to build your own cartridges.


What Is a Cartridge

The Service Console "cartridge" is a Java class providing almost unlimited Service Console versatility. You can imagine it as the Service Console extension or add-in that is able to check any non-standard service unsupported by Service Console until now.

Each class that implements interface TemplateCartridgeIface.java and resides in the Service Console working directory can be used as cartridge. The cartridge can be embedded in user defined template and configured from the Service Console Template Editor page. Using the user defined template, you can create a rule checking your special service.

As the TemplateCartridgeIface.java source is available in the ServiceConsole\Cartridges directory, you can develop your own cartridges.


Developing Your Cartridge

Developing cartridges presumes that you are famous with Java programming and with developing network applications. In addition, you need the information about the target service (e.g. the protocol which clients use to access the service). Mostly, the cartridge will perform a sequence of protocol commands against the service to determine if the service lives or not.


Compulsory Interface Description

Your cartridge must implement the TemplateCartridgeIface interface to be invokable from Service Console. The interface consists of two methods. The first is invoked when Service Console wants to check the service in question, the second is invoked on Service Console exit. Please, read also carefully the comments in the following interface source:

  • The checkService() method must return the error string or null. If it returns a String (even empty), Service Console thinks that an error appeared. You have to return null from this method if your service tests (communication with the service) passed successfully.
  • There is, of course, no obligation to check service by performing communication with remote host. The cartridge can check the service for example by testing the value of local environment variable, etc.

Compiling Your Class

Once you have your_cartridge.java implementing the TemplateCartridgeIface ready, you have to compile it. To do it, in the Cartridges directory, run your Java 1.1 compatible compiler to compile both TemplateCartridgeIface.java and your_cartridge.java sources.

  • Sun javac compiler example:

    C:\jdk1.1.8\bin\javac.exe -O -classpath C:\jdk1.1.8\lib\classes.zip *.java

  • Microsoft jvc compiler example:

    C:\sdk-java.32\bin\jvc /O *.java


Typical Implementation Errors

  • Class that you implemented don't have public constructor
  • Class that you implemented is abstract or the interface
  • You forgot to implement TemplateCartridgeIface

All mentioned errors are detected on runtime and reported similar way as the service check error. See also the Examples.


Putting It Together

When you have compiled your_cartridge.class, copy it to the Service Console working directory, then restart the Service Console.

Create a new template (e.g. Your Cartridge Template) based on User Defined template class. Fill in properly the fields Template Editor form. Ensure yourself that you have entered correct cartridge class name and service port number.

Create new rule (e.g. Your Cartridge Test) and specify that it will use new template for checking the service. For first test, specify rather lesser timeout (about 10s should be good).

In the Rules page, click the button Run Now. On the result page you will see the messages that you programmed in the cartridge implementation (they are the messages that you print on ps print stream - see the interface description).


Examples

Following examples shows both the correct implementation and some of the typical implementation errors.


Correct Cartridge Example

Here is the example of cartridge that can be used in user defined template. The example, in fact does not check any service. It only illustrates using of TemplateCartridgeIface.



Wrong Cartridge Example (Missing Public Constructor)

Here is the example of the cartridge that cannot be used in the user defined template, because the implementation overloads default public constructor by own, private.



Wrong Cartridge Example (Abstract Class)

Here is the example of the cartridge that cannot be used in the user defined template, because it is the abstract class.

Trap ConsoleActive SNMPJWinSvcService Console