# EKM Client API 18.2

The EKM Client API is a Java library that can be used to develop client applications that interact with an EKM repository.

See: Description

Packages
Package | Description
--- | ---
com.ansys.ingress.client.api | This package contains the interfaces used to communicate and interact with an EKM server.
com.ansys.ingress.client.api.schema | This package contains data structures generated from schema and used by the EKM Client API.
com.ansys.ingress.client.api.search | This package contains classes for creating queries that can be executed on the EKM server and for processing the results of the executed queries.
com.ansys.ingress.client.api.transfers | This package contains the classes and interfaces used to monitor file transfers between the client and the EKM server.
com.ansys.ingress.client.api.utils | This package containus utility classes.

The EKM Client API is a Java library that can be used to develop client applications that interact with an EKM repository. The programs can be developed in Java or Jython. The API provides the following functionality:

- Search the repository for data
- Create, update, and delete objects in the repository
- Transfer files and folders to and from the repository
- Perform version control and locking operations on objects in the repository
- Trigger execution of scripts in the repository
- Manage users and groups in the repository

# Installation

The library is installed along with the EKM server product. Under the EKM installation directory, the following directories are provided for the library:

- ekm_base/ekm-client - the home directory for the library
- ekm_base/ekm-client/bin - scripts for running Jython and for building and running the included Java samples
- ekm_base/ekm-client/doc - API documentation
- ekm_base/ekm-client/lib - the JAR files that make up the library
- ekm_base/ekm-client/programs - additional programs needed to build and run the samples
- ekm_base/ekm-client/samples - Java and Jython sample applications
- ekm_base/ekm-client/schema - schema files needed by the library

After the installation is complete, add the ekm_base/ekm-client/bin directory to the path. The samples can be built and run in place on the server where the library was installed. Prior to running the samples, please make sure that the environment variables specified in the ekm_env script, located in the bin directory, have appropriate values assigned to them. To do this, do the following:

1. Open ekm-client/bin/ekm_env script in an editor
2. Change the EKM_BASE environment variable to point to the parent directory in of the ekm-client directory
3. Change the JAVA_HOME environment variable to point to a JDK installation on the server
4. Save your changes

## Installing on a Client

To install the library on the client, simply copy the ekm-client directory from the server install to a location on the client machine. The only prerequisite for the client machine is that it has the Java Development Kit (JDK) version 1.8.0_121 or later installed on it. Once the directory is copied to the client machine, do the following:

1. Open ekm-client/bin/ekm_env script in an editor
2. Change the EKM_BASE environment variable to point to the directory in which you placed the ekm-client directory
3. Change the JAVA_HOME environment variable to point to the JDK installation on the client machine
4. Save your changes

## Generating Sample and Test Documentation

Once you have modified the ekm_env script, the first thing you should do is generate the documentation for the samples and unit tests. To do this, execute the run-samples script with the doc target specified. Once this completes, the documentation will be in ekm-client/samples/doc. For example:

    D:\ekm181\v181\ekm-client\bin>run-samples.bat doc
    Buildfile: D:\ekm181\v181\ekm-client\build-samples.xml

    init:

    compile:
        [javac] D:\ekm181\v181\ekm-client\build-samples.xml:82: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
        [javac] Compiling 20 source files to D:\ekm181\v181\ekm-client\build

    doc:
      [javadoc] Generating Javadoc
      ...
      [javadoc] Building index for all classes...

    BUILD SUCCESSFUL
    Total time: 3 seconds

## Jython Samples

In addition to the Java samples, there are also a collection of Python samples that can be run using the Jython interpreter included with the installation. For example:

    D:\ekm181\v181\ekm-client\bin>jython.bat ..\samples\jython\OpenCloseConnection.py
    log4j:WARN No appenders could be found for logger (org.jboss.logging).
    log4j:WARN Please initialize the log4j system properly.
    log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
    >>>>> Connection Default@lebmmoales1 opened
    12:23:30,891 DEBUG EventManager:57 - Posting connection event: CONNECTION_CLOSED
    >>>>> Connection Default@lebmmoales1 closed

The Jython samples are primarily a collection of unit tests that can be executed individually or as a suite. To execute the suite, run the TestExecutor.py script found in the samples/jython directory. For example:

    D:\ekm181\v181\ekm-client\bin>jython.bat ..\samples\jython\TestExecutor.py
    log4j:WARN No appenders could be found for logger (org.jboss.logging).
    log4j:WARN Please initialize the log4j system properly.
    log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
    ...
    .
    ----------------------------------------------------------------------
    Ran 12 tests in 26.660s

    OK

Copyright © 2017 ANSYS, Inc. All rights reserved.