7.0 Action Request System Java API

7.0 Action Request System Java API

AR System Java API

See:
          Description

Packages
com.remedy.arsys.api  

 

AR System Java API

Description of the AR System Java API

 

The Action Request System 7.0 Java API is an application programming interface to integrate with the AR System. The AR System Java API is a collection of classes, interfaces, and relationships that abstract the AR System C API and hide some of its details, such as the memory management for data structures, managing connections, and so on. Using the Java development environment, you can use the AR System Java API to communicate with the AR System server without programming in C.

In addition, many of the Java API objects are classes modeled after the Enterprise Java Beans (EJB) requirements for objects. Most of the methods required for an object to be classified as EJB (for example, load or store) are implemented in the AR System Java API.

If you have comments or suggestions about this documentation, contact Remedy Information Development by email at .

Table of Contents
I) What's New in 7.0?
II) Programming Model and Featured Design Patterns

A) Factory Design Pattern
B) Proxy Design Pattern
C) Criteria Objects
D) Criteria List Objects
E) Cloning Objects
F) Exception Handling (Errors)

III) Java API Program Structure

A) Naming Conventions: How C Structures and Functions Correspond to Java API Objects
B) Exceptions to Naming Conventions

IV) Installation and Deployment

A) Contents of AR System Java API Installation
B) Windows Environment Setup
C) UNIX Environment Setup
D) AR System Java API Programs at Runtime

V) Glossary Terms

 I) What's New in 7.0?

The main change in 7.0 is a new arapi70.jar file. As a result, if you link to the new arapi70.jar file, you must make changes to your programs, including the following:

In addition, the following new Java classes were added in the 7.0 release:

Otherwise, the main program structure of your AR System Java API programs need not change.

II) Programming Model

As a Java "wrapper," the Java calls are mapped to the C API through the Java Native Interface (JNI) layer. The AR System Java API is not "pure" Java. Accordingly, you can only use the AR System Java API on supported AR System platforms, and not simply any platform that is running a Java Virtual Machine. Specific platforms supported by the AR System here include:

The intended audience of the AR System Java API is programmers who are writing the following:

The AR System Java API with its classes and methods is designed to both adhere to object-oriented methodology and to be functionally equivalent to the AR System C API with its functions and data structures. In this implementation, the AR System server objects are treated as "objects" in the AR System Java API. All functionality of the AR System C API is represented as discrete objects used to create, retrieve, and manipulate AR System server objects and entries submitted by end users (or other client programs) in the database. You should note, however, that there is not a 1:1 correspondence in the mapping between the Java API and the C API.

You can also use the AR System Java API to manipulate data in the database. "Objects" you can manipulate with the AR System API include not only schemas, workflow, menus, and so on, but you can also use the Entry classes to manipulate entries in a form in different ways. For example, you can use the Java API to get a list of entries.

Note In the implementation of the AR System Java API, there are certain naming conventions, design patterns, and abstractions that you need to be familiar with in order to use it. If you are experienced with the AR System API, you shouldn't find it difficult to make sense of the Java API wrapper. However, you will want to be aware of how AR System C structures and functions correspond to the Java objects before you begin using the AR System Java API.

Featured Design Patterns

A) Factory Design Pattern [Return to TOC]

In the Java API, server objects are exposed as Java objects. As a programming convenience, the AR System Java API uses factory design patterns to create, destroy, and retrieve server objects.

The IARObjectFactory class is the superclass of the various object factory classes, for example, ActiveLinkFactory, SchemaFactory, and so on. Each server object contains the newInstance( ) method for creating instances of objects. You also must use the releaseInstance(Object obj) method to release the instance of the object. You can see a more detailed example in sample code.

Each server object has a corresponding special factory class (<Object>Factory, for example, SchemaFactory) that imposes a structure on each object. Each factory class then has methods for manipulating instances of that server object. For example, to create a schema, you would use SchemaFactory to instantiate a schema object.

Each <Object>Factory contains three different find methods (find, findByKey, findObjects) to query for server object instances that contain data retrieved from the AR System. In this way, you use the factory class methods of a server object to create new objects, or you use the find methods of the factory classes to search for existing objects on the AR System server. You use the get/set functions to allow you either to retrieve (getSchemaType) or to set (setSchemaType) data in that object. Then you would use the following methods to perform various operations on the AR System server:

You can see a more detailed example in sample code. This sample code uses the SchemaFactory to create a schema.


B) Proxy Design Pattern [Return to TOC]

The Proxy design pattern is used for handling the structural aspects of server objects, such as memory management and access to the AR System server. The Proxy class that performs this work is not visible to users of the AR System Java API and is designed for internal use only. The Proxy class contains all the native methods required for interaction with the AR System. Each of these native methods perform data conversion from C to Java (or Java to C) and "wrap" the AR System C API calls.

C) Criteria Objects [Return to TOC]

Criteria objects are used to evaluate and screen the results coming back to your Java program from the AR System. Criteria objects lets you define what attributes you want to retrieve. The following criteria objects are available in the Java API:

All server objects (workflow objects like active links, filters, and escalations; entry objects, support file, menu, field, form, and view objects) have criteria objects that allow you to specify which attributes to retrieve. For example, using the ActiveLinkCriteria object, you can specify name, the execution order, timestamp information, object properties, etc. Criteria objects follow this naming convention: <Object>Criteria (for example, ContainerCriteria, FilterCriteria, EntryCriteria, and so on.).

You can see a more detailed example in sample code that uses the findByKey method to retrieve a particular schema specified by the SchemaCriteria class.

D) Criteria List Objects [Return to TOC]

All server object lists that can be retrieved in the AR System C API have a corresponding criteria object as well. The list criteria object abstracts query information applicable to a collection of objects. The following criteria objects are available in the Java API:

Criteria objects for retrieving lists follow this naming convention:
<Object>ListCriteria (for example, ContainerListCriteria, EntryListCriteria, and so on.). The exception to this naming convention is with workflow (active link, filter, and escalation) objects, which use a common list criteria class called WorkFlowObjectListCriteria.

You can see a more detailed example in sample code that uses the find method to retrieve a list of schema names specified by the SchemaListCriteria class. There is also sample code that uses the find method to retrieve a list of active link names specified by the WorkFlowObjectListCriteria class.

E) Cloning Objects [Return to TOC]

Warning: Cloning was made available for all objects in the AR System Java API. However, in the 5.x and 6.x releases of the AR System Java API, the clone() method may not copy the underlying objects as expected. It is unstable and may crash any programs that use this method.

F) Exception Handling (Errors) [Return to TOC]

Errors are modeled through the ARException class. All error messages that are returned by the server are thrown as an ARException in theJava API.

III) Java API Program Structure 

To implement your programs, you will want to use the following idioms in your Java program.  All AR System Java API programs follow the same basic outline:

  1. Import the packages. In this part of the program, you import the com.remedy.arsys.api package as well as other packages you may be using in your program.
  2. Create a new ARServerUser. This step corresponds to Startup/Initialization (ARInitialization) for C API programs, except that you can create several ARServerUsers, each set up to talk to a different server as a different user or the same user.
  3. Use the server object factory class to create an instance of the server object you will work with. Do the set methods to describe and label the server object.
  4. Set the context for the operation. This corresponds to choosing the ARServerUser object (user, password, and server information) for the operation or operations that follow.

    Note This step illustrates another difference between the C API and the Java API. In the C API, the control argument in each call to the server provides access information (user and server information and initialization information) on per call basis. In the Java API, you provide the user and server information separate from the calls you will make for that operation.

  5. Perform the operation. At this point in the program, you create entries or manipulate existing entries in the AR System server you specified in the context (the previous step).
  6. Release the instance using its factory.

Because Java handles the deallocation of memory automatically (using garbage collection), another key difference between the C API and the AR System Java API is that when references to an object no longer exist, that object is assumed to no longer be needed, and then the memory occupied by that object is reclaimed. So, freeing allocated memory and shutdown/cleanup of the general structure of a C API program do not have a counterpart in an AR System Java API program. However, in an AR System Java API program, you must use the clear method to release context (user and server) information as well as other methods of the classes you use, and to use the releaseInstance method of the factory object to reclaim memory that has been allocated to a factory object. The underlying resources are not touched by garbage collection. They must be released.

The steps for the AR System Java API Program Structure are summarized in the following diagram.

 Diagram of AR System Java API Program Structure

A) Naming Conventions: How C Structures and Functions Correspond to Java API Objects [Return to TOC]

Without too much difficulty, developers who are familiar with the AR System C API can find their way in the Java API. There are common terms in C that have their parallel in Java. The naming conventions of the Java API objects follows the basic pattern listed in the table below:

Differences in Naming Conventions

C API

Java API

Differences

AR<object>Struct (see exceptions below) <object>Info
  • The AR at the beginning of C functions is left out. For example, the names of functions associated with ARGetActiveLink are renamed to the ActiveLink class with its associated member functions used to get, set, or create active links.
  • Because there are no data structures in the Java environment, data structures in the C API translate to classes in the AR System Java API with the suffix -Info. For example, the ARQualifierStruct data structure translates to the QualifierInfo class.
AR<object>List <object>Info (an array) Because lists are handled as arrays, the -List suffix becomes the -Info suffix. For example, ARPermissionList from the C API corresponds to the PermissionInfo class in the AR System Java API.

The exceptions to these naming conventions pertain to the classes used for retrieving lists of entries and lists of fields. For example, in the C API, use
AREntryListList to return a list of entries as concatenated strings. In the Java API, you would use the find and findObjects factory methods to retrieve a list of entries as concatenated strings. See Program Structure for more information.
NameType NameID The C API suffix -Type becomes -ID in the Java API, so that a variable NameType becomes NameID.
Get load, findByKey  
Set store  
Create create  
Delete remove  
GetList find, findObjects  


B) Exceptions to Naming Conventions [Return to TOC]

The ARControlStruct is an exception to the naming conventions described here, because user information required to perform AR System operations is handled slightly differently in the Java API. The ARServerUser class is used to handle user login information for object operations. You specify user information via the ARServerUser class when you perform a setContext operation for a specific class of server object.

IV) Installation and Deployment

To use the AR System Java API, you must have the AR System C API library and *.dlls installed on the same machine where you run the AR System Java API. Please see the C API Reference Guide for more information.

A) Contents of the AR System Java Installation [Return to TOC]

arapi70.jar

JAR file that contains the API class files.

If two or more applications need to load the arapi70.jar file, it must be stored in the classes directory in order to be loaded multiple times. Use the following procedure:

  1. Copy the arapi70.jar file to the <Servlet_location_directory>/ServletExec NSAPI/<WebServer_directory>/classes directory.
  2. Delete the arapi70.jar (if it exists there) from WEB-INF/lib directory.
  3. Add the <Servlet_location_directory>/ServletExec NSAPI/<WebServer_directory>/classes/arapi70.jar file to the servlet classpath.
arutil70.jar

JAR file that contains utility routines for the arapi jar file.

If two or more applications need to load the arutil70.jar file, it must be stored in the classes directory in order to be loaded multiple times. Use the following procedure:

  1. Copy the arutil70.jar file to the <Servlet_location_directory>/ServletExec NSAPI/<WebServer_directory>/classes directory.
  2. Delete the arutil70.jar (if it exists there) from WEB-INF/lib directory.
  3. Add the <Servlet_location_directory>/ServletExec NSAPI/<WebServer_directory>/classes/arutil70.jar file to the servlet classpath.
  • arjni70.dll (Windows)
  • libarjni70.sl (AIX, HP-UX)
  • libarjni70.so (Solaris)
Java Native Interface (JNI) implementation.
ardoc70.jar Javadoc generated html docs for the API.

JavaDriver.java

  • InputWriter.java
  • OutputWriter.java
Sample Java code file that shows examples of using the Java API.
arapi70.dll, arutl70.dll, arrpc70.dll

(Windows only)
The current AR System API development kit. The debug versions of each dll are also included.

Windows
arcatalog_eng.dll
rcmn70.dll

Solaris, Linux
libosapi.so   


AIX
libosapi.a


HP-UX
libosapi.sl

Class Manager C API libraries for Class Manager C API clients.

Windows
arjni70.dll
arutiljni70.dll


Solaris, Linux
libarjni70.so

libarutiljni70.so
libjlicapi70.so


AIX
libarjni70.a
libarutiljni70.a
libjlicapi70.a

HP-UX
libarjni70.sl   libarutiljni70.sl    libjlicapi70.sl

Java Native Interface (JNI) libraries for Java to native code translation.

Windows
icudt32.dll
icuin32.dll
icuuc32.dll


Solaris, Linux
libicudata.so.32.0
libicui18n.so.32.0
libicuio.so.32.0

libicuuc.so.32.0


AIX
libicudata32.a
libicui18n32.a
libicuio32.0.a
libicuuc32.0.a


HP-UX

libicudata.sl.32.0
libicudt20b.sl
libicui18n.sl.32.0
libicuio.sl.32.0
libicuuc.sl.32.0

International Components for Unicode ( ICU) libraries for Unicode translation.

Windows
arxmlutil70.dll


Solaris, Linux
libarxmlutil.so


AIX
libarxmlutil.a


HP-UX
libarxmlutil.sl

AR System libraries for XML parcing and generation.

Windows
Xalan-C_1_9.dll
XalanMessages_1_9.dll
xerces-c_2_6.dll
xerces-depdom_2_6.dll


Solaris, Linux
libxalan-c.so.19.0
libxalanMsg.so.19.0
libxerces-c.so.26.0
libxerces-depdom.so.26.0


AIX
libxalan-c19.0.a
libxalanMsg19.0.a
libxerces-c.26.0.a
libxerces-depdom26.0.a


HP-UX
libxalan-c.sl.19.0
libxalanMsg.sl.19.0
libxerces-
c.sl.26.0
libxerces-depdom.sl.26.0

Xalan and Xerces libraries used for XML parcing and transformation.

B) Windows Environment Setup [Return to TOC]

The following information applies to Windows  environments.

Compiler Requires J2SE Software Development Kit (SDK) 1.4.2 (or higher). To install the JDK, use the instructions provided by Sun Microsystems.
JAR Files and CLASSPATH
  1. arapi70.jar should be present in CLASSPATH.
  2. If you are running the AR System Java API on a web server, you must set the ClassPath information on the web server.
DLLs and System Path

The Java API requires the AR System API *.dlls.

  1. All DLLs should be available in the DLL search path.
  2. Set arrpc70.dll, arutl70.dll, arjni70.dll, and arapi70.dll in the System path (you can either add <ar_install_dir> to your path or put your executable file in <ar_install_dir>).

C) UNIX Environment Setup [Return to TOC]

Implementations of the JDK on some operating system environments may vary, but for convenience you may want to make sure of the following:

Compiler Requires J2SE Software Development Kit (SDK) 1.4.2 (or higher). To install the JDK, use the instructions provided by Sun Microsystems.
JAR Files and CLASSPATH
  1. arapi70.jar should be present in CLASSPATH.
  2. If you are running the AR System Java API on a web server, you must set the ClassPath information on the web server.
PATH Update your PATH environment variable to include the bin directory for the JDK per the installation instructions from Sun.
Library Path

Set the library path environment variable to where the libarjni.<operating_system> file is installed for your particular UNIX OS:

  • For Solaris, IBM AIX, and Linux, set the LD_LIBRARY_PATH environment variable to the location of where libarjni70.so is installed.
  • For HP-UX, set the SHLIB_PATH environment variable to the location of where libarjni70.sl is installed.

 D) AR System Java API programs at Runtime

The final step in the deployment process occurs when the software is installed on individual user system. This step includes installing and configuring the Java Runtime Environment on the individual user system.

 Tips

java -D java.library.path = <directory>; -classpath .;arapi70.jar JavaDriver

 

V) Glossary Terms

The following are helpful terms and definitions when using the AR System Java API. Some terms are strictly Java terms that are defined here in terms of their use in the documentation for the AR System Java API.

Term

Definition

ARException The class that is used for handling errors from the AR System server. Use the ARException methods to obtain status information (using the StatusInfo class) and to describe errors.
ARServerUser The ARServerUser class represents user information that contains login information for accessing the AR System. You use a ARServerUser object to initialize calls to a particular AR System server.
clear A method that clears all of the references to member objects. Use the clear function in your programs after you have used an object and want to clear references to the object and prepare it for garbage collection. Use the clear method for objects that explicitly interact with the server.
clone A method that is part of the AR System Java API objects for generating a deep copy of the object on which it is called. When a clone is made, the constructor for the object being cloned is not called, because the clone is an exact copy of the original.
Context The user session information that pertains to the current operation within an object. When you set the context using setContext for an operation, you supply the user information (user name, password, etc.) contained in the ARServerUser object for an operation performed in the specified session.
create A server object member method that creates an object on the server specified in ARServerUser.
Factory A programming design pattern used to create and manipulate server objects, such as forms, entries, and workflow objects in the AR System Java API. Each server object has a factory class (for example, ActiveLinkFactory).
find

Server object factory member method that returns the following:

  • List of object names specified by the object's <Object>Key and <Object>ListCriteria. This information is returned from the AR System server specified in the ARServerUser object.
  • List of EntryKey objects specified by the EntryListCriteria.
findByKey Server object factory member method that returns information about the server object (or entry) specified by the <Object>Key (for example, ActiveLinkKey) and <Object>Criteria (for example, ActiveLinkKey). This information is returned from the AR System server specified in the ARServerUser object.
findObjects Server object factory member method that returns a list of server objects (or entries) specified by the object's <Object>ListCriteria and <Object>Criteria objects. This information is returned from the AR System server specified in the ARServerUser object.
Info The suffix for any class that represents an AR System C API data structure. For example: DisplayInstanceInfo in the Java API maps to ARDisplayInstaceStruct in the C API.

For more information, see
Naming Conventions.
Interface

The interface functions as the protocol followed by classes that extend it. In the AR System Java API, there are five interfaces that specify what a class must do, but not how it does it. The interfaces are:

  • IARIdentifier interface
  • IARObjectFactory interface
  • IARPersistentObject interface
  • IARQualifierOperand interface
  • IARRowIterator interface

Constants is also defined as an interface. It contains all the constant values used in the AR System Java API.

JNI The Java Native Interface. This is a C++ layer that takes calls from Java and makes corresponding calls to the C API. This happens transparently.
load Server object member method that populates an object with information from the AR System server.
<Object>ListCriteria The special class for a server object (for example, EntryListCriteria, ContainerListCriteria) used to specify the query information, or the format and scope of the list of query results returned from the AR System server.
<Object>Key The special class for a server object (for example, ActiveLinkKey, FilterKey, etc.) used for cloning an object or retrieving a specific instance of an object. An object's object key uniquely identifies that object.
<Object>Criteria The special class for a server object (for example, SchemaCriteria, EntryCriteria) used to specify the criteria by which an object is to be retrieved from the server specified in the ARServerUser object. The object criteria retrieves information for each object selected by the criteria list object.

The
<Object>Criteria class has methods to specify the list of object information or attributes to be retrieved. For example, you can retrieve certain field values for an entry using the EntryCriteria object, or you can retrieve owner information for a schema using the SchemaCriteria object. By default, none of the object attributes are retrieved unless otherwise specified. See also <Object>ListCriteria.
Package The package is a name space in Java for all objects and classes pertaining to the AR System Java API. In the case of the AR System, the package name represents the directory structure of the classes:

com.remedy.arsys.api
Proxy The Proxy class contains all the methods for loading the ARServerUser information with the session ID and specific information that pertains to the AR System API call that gets made with the AR System Java API. The proxy is transparent and not directly accessible through the AR System Java API.
remove Server object member method that deletes an object with the indicated ID from the specified server.
store Server object member method that updates an object on the database.

[Return to TOC]

 


7.0 Action Request System Java API