https://github.com/labelzoom/labelzoom-moca-client-java
MOCA client for Java
https://github.com/labelzoom/labelzoom-moca-client-java
blue-yonder blueyonder jda moca redprairie
Last synced: 6 months ago
JSON representation
MOCA client for Java
- Host: GitHub
- URL: https://github.com/labelzoom/labelzoom-moca-client-java
- Owner: labelzoom
- License: bsd-3-clause
- Created: 2024-01-13T22:47:07.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-08-18T18:00:37.000Z (11 months ago)
- Last Synced: 2025-08-18T20:16:13.462Z (11 months ago)
- Topics: blue-yonder, blueyonder, jda, moca, redprairie
- Language: Java
- Homepage:
- Size: 229 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README

# labelzoom-moca-client-java
[](https://github.com/labelzoom/labelzoom-moca-client-java/actions?query=branch%3Amain)
[](https://github.com/labelzoom/labelzoom-moca-client-java/releases)
[](https://codecov.io/gh/labelzoom/labelzoom-moca-client-java)
MOCA client for Java, sponsored by [LabelZoom](https://www.labelzoom.net).
## Installation
### Gradle
#### Step 1
Add a new `maven` closure to your `repositories` section that points to this repository.
```groovy
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:
```groovy
dependencies {
implementation 'com.labelzoom:labelzoom-moca-client-java:1.0.2'
}
```
### Maven
TODO
## How To Use
See [tests](src/test) for more examples.
### Nested _try-with-resources_
```java
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
```java
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();
}
```