jmyapi

Java MYA API

License

License

GroupId

GroupId

org.jlab
ArtifactId

ArtifactId

jmyapi
Last Version

Last Version

6.1.0
Release Date

Release Date

Type

Type

pom.sha512
Description

Description

jmyapi
Java MYA API
Project URL

Project URL

https://github.com/JeffersonLab/jmyapi
Source Code Management

Source Code Management

https://github.com/JeffersonLab/jmyapi.git

Download jmyapi

Dependencies

runtime (1)

Group / Artifact Type Version
mysql : mysql-connector-java jar 5.1.42

Project Modules

There are no modules declared in this project.

jmyapi Java CI with Gradle Maven Central

A Java client query API library for MYA (JLab's EPICS Archiver).

If you are looking for a quick and easy way to obtain Archiver data see: Public MYA Web Service, which is built using this API plus myquery.



Usage

The library is a single jar file plus a dependency on the MySQL database driver jar and the Java 8+ JVM and standard library. You can obtain the jmyapi jar file from the Maven Central repository directly or from a Maven friendly build tool with the following coordinates (Gradle example shown):

implementation 'org.jlab:jmyapi:6.1.0'

You can check the Release Notes to see what has changed in each version.

API

Example

        DataNexus nexus = new OnDemandNexus("ops");

        String pv = "R123PMES";
        Instant begin = TimeUtil.toLocalDT("2017-01-01T00:00:00.123456");
        Instant end = TimeUtil.toLocalDT("2017-01-01T00:01:00.123456");

        Metadata<FloatEvent> metadata = nexus.findMetadata(pv, FloatEvent.class);
        try (EventStream<FloatEvent> stream = nexus.openEventStream(metadata, begin, end)) {

            FloatEvent event;

            while ((event = stream.read()) != null) {
                System.out.println(event.toString(6));
            }
        }

Configure

Properties

The library requires configuration properties be included in the runtime classpath. Specifically a deployments.properties file is needed to indicate the host names of MYA servers. A template for the properties can be found here. You must create your own deployments.properties file and include it on the runtime classpath.

Authentication

In order to interact with the MYA server users must authenticate (MySQL user auth). This is done using a username and password from a credentials.properties file, which must be included in the runtime classpath. A template for the properties can be found here.

Build

This Java 8+ project uses the Gradle 6 build tool to automatically download dependencies and build the project from source:

git clone https://github.com/JeffersonLab/jmyapi
cd jmyapi
gradlew build

Note: If you do not already have Gradle installed, it will be installed automatically by the wrapper script included in the source

Note: Jefferson Lab has an intercepting proxy

See Also

org.jlab

Jefferson Lab

Versions

Version
6.1.0