Skip to content

labelzoom/labelzoom-moca-client-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

92 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LabelZoom Logo

labelzoom-moca-client-java

Build Status Release codecov

MOCA client for Java, sponsored by LabelZoom.

Installation

Gradle

Step 1

Add a new maven closure to your repositories section that points to this repository.

repositories {
    mavenCentral() // You probably already have this
    maven {
        url = uri('https://maven.pkg.github.com/labelzoom/labelzoom-moca-client-java')
        credentials {
            username = project.findProperty('gpr.user') ?: System.getenv('GITHUB_ACTOR') // your GitHub username goes here
            password = project.findProperty('gpr.key') ?: System.getenv('GITHUB_TOKEN') // your GitHub PAT (Personal Access Token) goes here
        }
    }
}

Step 2

Add the dependency to your implementation dependencies:

dependencies {
    implementation 'com.labelzoom:labelzoom-moca-client-java:1.0.2'
}

Maven

TODO

How To Use

See tests for more examples.

Nested try-with-resources

try (final MocaConnection conn = new HttpMocaConnection(url, userId, password))
{
    try (final ResultSet res = conn.execute("publish data where message = 'Hello World!'"))
    {
        res.next();
        System.out.println("Message: " + res.getString("message"));
    }
}
catch (final SQLException | IOException e)
{
    e.printStackTrace();
}

Single try-with-resources with multiple resources

try (final MocaConnection conn = new HttpMocaConnection(url, userId, password);
     final ResultSet res = conn.execute("publish data where message = 'Hello World!'"))
{
    res.next();
    System.out.println("Message: " + res.getString("message"));
}
catch (final SQLException | IOException e)
{
    e.printStackTrace();
}