Datastore Users Guide
How you can assemble new service to the server?
previous :: contents ::

Back to > Overview > Users Guide

How you can assemble new service to the server?

Authors:
Szabo Csaba <crow@nolimits.ro>
Antal Attila <atech@nolimits.ro>
Table of Contents
1. Prewiew
    1.1. About servers
    1.2. About services
2. Implementing a new block
    2.1. Requests for your block
    2.2. Steps to resolve
        2.2.1. Step.1 - Get the server directory
        2.2.2. Step.2 - Adding the new service (block) file
        2.2.3. Step.3 - Assambling the blocks
        2.2.4. Step.4 - Register dependencies
        2.2.5. Step.5 - Configure your block
        2.2.6. Step.6 - Register logging
        2.2.7. Step.7 - Create the new server file
    2.3. Verifying


1. Prewiew

1.1. About servers

The datastore can include a number of servers, each server can have lots of services. Those servers and it services will be run with the Avalon framework. The server is an archive file with a sar file extension ( datastore.sar ). This file (or files in case of many servers) can be found in the datastore_home/apps directory, where the datastore_home directory is the place where you have installed the datastore. After you starting the datastore framework the server archive file(s) will be unpacked into the datastore_home/apps/servername/ directory. Where the servername is the name of the file with sar extension.

The content of this directory is:

top

1.2. About services

The services (also called blocks) can offer services to other blocks or to the server. The blocks can be found in the directory SAR-INF/lib/ in the server system. Every block is a jar file ( in older Phoenix versions was bar extension).

The services that can be found in the datastore server system is the following:

top

2. Implementing a new block

2.1. Requests for your block

top

2.2. Steps to resolve

2.2.1. Step.1 - Get the server directory

If the server was already started, stop it and go to the server directory:

Linux:

Windows:

If the server was not started before, go to the Avalon application directory, create directory named datastore, and unpack the datastore.sar file to this place in order to get the server directory system.

Linux:

Windows:

Where, the datastore_home is your datastore distribution directory.

top

2.2.2. Step.2 - Adding the new service (block) file

Copy your new block (something.jar) file to the server SAR-INF/lib/ directory:

Linux:

Windows:

Where, the block_home is your block directory.

top

2.2.3. Step.3 - Assambling the blocks

Go to the server configuration directory and edit the assembly.xml file

Linux:

Windows:

Insert the following line in the <blocks> element:

Where the blockname is the friendly name of your block and the classname of your block class name is like, for example org.media.datastore.beepserver.BeepServer

top

2.2.4. Step.4 - Register dependencies

If your block is dependent of other blocks (uses other blocks' services) then you must register them. In the assembly.xml modify the inserted line mentioned at Step.3:

Where the servicename is the service offered by the dependency creating block (it is the friendly name), and the classname is the classname of the dependency creating block.

top

2.2.5. Step.5 - Configure your block

If your block is using external configuration (avalon: implements Configurable), edit the config.xml file. Insert a new node in the <config> element, named exactly as your previous blockname and insert your configuration block.:

top

2.2.6. Step.6 - Register logging

If your block uses the avalon log services, you need to register your block in the environment.xml file. Insert the following lines in the <logs> element:

The target points to a file where the log messages will be placed. If you want to use an existing target you don't have to insert the second line, but in the first line, in the target attribute, you need to give an already existing target name (you can find it there).

top

2.2.7. Step.7 - Create the new server file

Make sure that your directory is datastore_home/apps/datastore/, if not, change it.

Pack your files with jar:

Linux:

Windows:

Make sure that the packing was successful. Delete the datastore directory from the datastore_home/apps/ and make sure that there is only the datastore.sar file.

top

2.3. Verifying

Go to the datastore_home/ and start your application with bin/run.sh (Unix users) or bin/run.bat (Windows users). If the application doesn't start, doesn't do anything or somewhere it crashes, stop it and study carefully all the log files in the datastore_home/logs/

top


© 2001