Query – Queries a 5800 system server for specified metadata.
The query string is provided on the command line. Query can
print out the results as a list of name-value pairs or as a list of OIDs.
You can specify the maximum number of results returned.

Java Example Applications

This section provides detailed information about the Java example applications
provided with the 5800 system client SDK.

Examples Overview

Included with the 5800 system SDK are several command-line example
applications that demonstrate the Java API. The example applications are located
in the SDK in the java/examples directory. These example
applications come complete with a build script.

Software Requirements

Running the Applications

UNIX (.sh) and Windows (.bat)
scripts for running the example applications are provided in the java/scripts/ directory. These scripts must be run from the java/scripts/ directory. The scripts illustrate the CLASSPATH environment
variable required. The .jar files are in the java/lib/ directory.

Note –

The usage messages printed by the applications omit the CLASSPATH environment variable for the sake of readability. If you are running
the example application without using the provided scripts, then you must
set the CLASSPATH environment variable manually.

Building the Java Example Applications

To build the Java example applications, go to the java/examples/ directory
and execute the master-build.sh script for Solaris and
Linux environments or the master-build.bat script for
Windows environments. These scripts build the examples and put them in the honeycomb-sdk.jar archive located in the java/lib directory.

Running a Java Example Application

Once you have built the Java example applications, go to the java/scripts directory and execute the .sh scripts for Solaris
and Linux environments or .bat scripts for Windows environments:

Syntax: script_namearguments

See the scripts for details of how the applications are run.

About the Example Application Source Code

The Java example applications are all simple applications that follow
the same basic structure. First, Commandline.parse is called
to parse the argument list. Next, the appropriate method in the NameValueObjectArchive class is called to communicate with the 5800 system server.
Finally, output is delivered back to either standard output, a file, or both.
Refer to the comments in the sample code for further details.

Example Applications

The following sections describe the Java example applications that are
included with the 5800 system client SDK:

Source Code

RetrieveSchema

Returns the schema defined on a 5800 system server to standard output.

Synopsis

java RetrieveSchema [OPTIONS] <IP | HOST>

Description

Retrieves the metadata schema from a 5800 system server, printing
it to stdout.

Options

-h

Print this message.

Examples

java RetrieveSchema archivehost

Source Code

java/examples/RetrieveSchema.java

GetDate

Gets the date.

Synopsis

java GetDate <IP | HOST> [OPTIONS]

Description

Gets the current date used to compute time setting and checking during
store and delete operations.

Options

-h

Print this message.

Examples

java GetDate server

Source Code

java/examples/GetDate.java

C Example Applications

This section provides detailed information on the C example applications
provided with the 5800 system client SDK.

Example Overview

Included with the 5800 system SDK are several command-line example
applications that demonstrate the use of the C API. The example applications
are located in the SDK under c/examples. Appropriate libraries
are supplied for Solaris SPARC, Solaris x86, Red Hat Linux, and Windows.

Software Requirements

In Solaris and Linux, set the LD_LIBRARY_PATH environment
variable to SDK directory name/c/OS/lib where SDK directory
name is the directory into which you unzipped the 5800 system SDK
and OS is either Solaris or Linux. For example:

StorageTek500_SDK_1_1_82/c/Solaris/lib

In Microsoft Windows 2003:

The example programs will run if they are
run as installed in the default build directory. However, if you have moved
them elsewhere, the location of the library files (DLLs) must be added to
the PATH environment variable as follows:

C:\StorageTek500_SDK_1_1_82\c\Win32\lib

To edit the windows PATH environment variable:

Click the Start button.

Right-click My Computer and select properties
to launch System Properties.

Click the Advanced tab.

Click Environment Variables.

Under System Variables, scroll down and click Path.

Click Edit to launch Edit System Variable.

Add the full path name of the SDK lib directory
to the PATH environment variable. Make certain each path name
is separated by a semicolon (;).

Click OK to close each window.

Add C:\Program Files\Java\jdk_version\bin to the PATH environment
variable where jdk_version is the version, for
example, jdk5.0.

To edit the windows PATH environment variable:

Click the Start button.

Right-click My Computer and select properties
to launch System Properties.

Click the Advanced tab.

Click Environment Variables.

Under System Variables, scroll down and click Path.

Click Edit to launch Edit System Variable.

Add the Java path name to the PATH environment
variable. Make certain each path name is separated by a semicolon (;).

Building the C Example Applications

To build the C example applications, go to the c/examples directory
and run make. This will build the example applications
and put them in the c/examples/OS/build directory.

Each C example application can be built separately by running make program_name.

Running a C Example Application

Once you have built the C example applications, go to the c/examples/<OS>/build directory and execute the binary file with the appropriate command
line. The examples depend on libhoneycomb.so.

About the C Example Application Source Code

First, the function parseCommandline is called to
parse the command line and store the information in a struct called Commandline. Next, any files that contain data to be sent to the 5800 system server
are opened. The appropriate 5800 system C API is then called. Finally,
output is delivered back to either standard output, a file, or both. Refer
to the comments in the sample code for further details.

Example Applications

The following C example applications are included with the 5800 system client
SDK:

Source Code

c/examples/AddMetadata.c

DeleteRecord

Deletes a record associated with an OID.

Synopsis

DeleteRecord <IP | HOST> <OID> [OPTIONS]

Description

Deletes a record associated with an OID. The OID specifies which record to delete. The record consists of all metadata
associated with the OID, or the data if it is a data OID. The OID itself becomes inaccessible. If
this OID is the last OID associated with the data, the
data is also deleted.