The CDR resource adaptor comes with the CDR Generation example service. To deploy the example:

1

Start Rhino:

$RHINO_HOME/start-rhino.sh

2

Unpack the CDR resource adaptor distribution package into $RHINO_HOME.

Note If unpacked elsewhere, adjust the client.home configuration property in the build.properties file.

3

The properties in build.properties are used to configure the CDR resource adaptor during deployment. Edit it to verify that the configuration is correct for your local environment. In particular, verify these properties:

Property

cdr.directory={rhino.dir.home}{/}cdr

Specifies

Name of the directory into which the CDRs will be written. The resource adaptor must have write permissions for it. This parameter is mandatory, and its value is set to $RHINO_HOME/cdr.

Note If you intend to modify the value of cdr.directory to point to somewhere else, you need to update the security-permissions in the resource-adaptor-jar.xml deployment descriptor, in the resource adaptor’s deployable unit.

Property

cdr.archivecommand=$RHINO_HOME/cdr-bin/archive-cdr-log.sh {0}

Specifies

Command to run on each CDR file completion. The resource adaptor must have execute permissions for the designated command.

{0} in the command line denotes the absolute path to the CDR file.

If empty, no command is run.

4

To deploy the examples, using Ant, execute the deploy-all target:

$ cd $RHINO_HOME/cdr-ra-VERSION/examples
$ ant deploy-all

This copies the archive script to the cdr folder, deploys the CDR Resource Adaptor, example (Telnet) resource adaptor, and the CDR Generation example service.

5

Use a Telnet utility to connect to the example resource adaptor:

telnet localhost 9999

6

Try these commands:

Command Description Example
send <number> [streamName]

Sends the number of CDRs to be written to the specified stream (or the default stream if streamName is not specified).

send 1
send-ext <number> [streamName]

Sends the number of CDRs with an additional extension field set to be written to the specified stream (or the default stream if streamName is not specified).

send-ext 1
close

Closes the Telnet connection and exits.

close
help

Displays the usage commands.

help
Tip Source code for the example service can be found in the examples/src subdirectory of the CDR Resource Adaptor package. This code may be freely altered and reused. It is made available under a BSD-style license.

Example: processing binary CDR files

The CDR Generation example service is accompanied by example code that processes the resulting binary CDR files. The examples are custom extensions of cdrpipeline tool.

Note The cdrpipeline tool is part of the CDR Resource Adaptor package, described in Extendable binary CDR file processing tools.

To run the binary CDR file processing examples:

1

Deploy the example service by following the steps in Example Service.

2

Use the example service to generate one or more completed binary CDR files.

Tip

The CDR Resource Adaptor writes CDRs to temporary files which are later completed (that is: closed, renamed, and possibly archived). After the CDR file is completed, the CDR Resource Adaptor no longer operates on the CDR file, at which time other tools can safely process the finalized CDR file. To force the CDR Resource Adaptor to complete a CDR file:

  1. Generate more than ~1 MB of CDRs (because the example service uses a stream configured with maxSize set to 1000000 bytes) — repeatedly use the send 1000 command until CDR file rollover occurs.

  2. Generate at least one CDR.

  3. Deactivate the resource adaptor.

3

To display the content of generated CDR files on the console, execute these commands:

$ cd $RHINO_HOME/cdr-ra-VERSION/examples
$ ant run-sysout-cdr-processor

This invokes the cdrpipeline tool with example SysOutDynamicCdrProcessor.

4

To create a temporary JavaDB database in $RHINO_HOME/cdr-ra-VERSION/examples/cdrdb and load the content of generated CDR files, execute these commands:

$ cd $RHINO_HOME/cdr-ra-VERSION/examples
$ ant run-db-insert-cdr-processor

This invokes the cdrpipeline tool with example DBInsertCdrProcessor. The Ant run-db-insert-cdr-processor target outputs a text message containing:

  • a command that may be used to start the Java DB ij tool (interactive JDBC) connected to the created database

  • example SQL queries that interrogate the imported CDR data (to be run in the ij tool connected to the created database).

Tip Source code for the example CdrProcessor(s) can be found in the examples/src subdirectory of the CDR Resource Adaptor package. Reviewing the Ant targets run-sysout-cdr-processor and run-db-insert-cdr-processor in examples/build.xml is also recommended.
Previous page