Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# OpenTDF Java SDK Examples

This directory contains example code demonstrating how to use the OpenTDF Java SDK.

## Running the Examples

The examples can be run using the `exec-maven-plugin`. The general format is:

```bash
mvn -f examples/pom.xml exec:java@<ExampleName>
```

Replace `<ExampleName>` with the name of the example you want to run. For example, to run the `EncryptExample`, use the following command:

```bash
mvn -f examples/pom.xml exec:java@EncryptExample
```

### Available Examples

* `CreateAttribute`
* `CreateNamespace`
* `CreateSubjectConditionSet`
* `CreateSubjectMapping`
* `DecryptCollectionExample`
* `DecryptExample`
* `EncryptCollectionExample`
* `EncryptExample`
* `GetDecisions`
* `GetEntitlements`
* `GetManifestInformation`
* `ListAttributes`
* `ListNamespaces`
* `ListSubjectMappings`
Comment thread
cshamrick marked this conversation as resolved.

### Example with Arguments

Some examples, like `GetManifestInformation`, require command-line arguments. You can pass arguments to the examples using the `exec.args` property. For example:

```bash
mvn -f examples/pom.xml exec:java@GetManifestInformation -Dexec.args="my.ciphertext"
```
90 changes: 87 additions & 3 deletions examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.release>11</maven.compiler.release>
<platform.branch>protocol/go/v0.3.0</platform.branch>
<exec.cleanupDaemonThreads>false</exec.cleanupDaemonThreads>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -121,9 +122,92 @@
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<mainClass>io.opentdf.platform.App</mainClass>
</configuration>
<executions>
<execution>
<id>CreateAttribute</id>
<configuration>
<mainClass>io.opentdf.platform.CreateAttribute</mainClass>
</configuration>
</execution>
<execution>
<id>CreateNamespace</id>
<configuration>
<mainClass>io.opentdf.platform.CreateNamespace</mainClass>
</configuration>
</execution>
<execution>
<id>CreateSubjectConditionSet</id>
<configuration>
<mainClass>io.opentdf.platform.CreateSubjectConditionSet</mainClass>
</configuration>
</execution>
<execution>
<id>CreateSubjectMapping</id>
<configuration>
<mainClass>io.opentdf.platform.CreateSubjectMapping</mainClass>
</configuration>
</execution>
<execution>
<id>DecryptCollectionExample</id>
<configuration>
<mainClass>io.opentdf.platform.DecryptCollectionExample</mainClass>
</configuration>
</execution>
<execution>
<id>DecryptExample</id>
<configuration>
<mainClass>io.opentdf.platform.DecryptExample</mainClass>
</configuration>
</execution>
<execution>
<id>EncryptCollectionExample</id>
<configuration>
<mainClass>io.opentdf.platform.EncryptCollectionExample</mainClass>
</configuration>
</execution>
<execution>
<id>EncryptExample</id>
<configuration>
<mainClass>io.opentdf.platform.EncryptExample</mainClass>
</configuration>
</execution>
<execution>
<id>GetDecisions</id>
<configuration>
<mainClass>io.opentdf.platform.GetDecisions</mainClass>
</configuration>
</execution>
<execution>
<id>GetEntitlements</id>
<configuration>
<mainClass>io.opentdf.platform.GetEntitlements</mainClass>
</configuration>
</execution>
<execution>
<id>GetManifestInformation</id>
<configuration>
<mainClass>io.opentdf.platform.GetManifestInformation</mainClass>
</configuration>
</execution>
<execution>
<id>ListAttributes</id>
<configuration>
<mainClass>io.opentdf.platform.ListAttributes</mainClass>
</configuration>
</execution>
<execution>
<id>ListNamespaces</id>
<configuration>
<mainClass>io.opentdf.platform.ListNamespaces</mainClass>
</configuration>
</execution>
<execution>
<id>ListSubjectMappings</id>
<configuration>
<mainClass>io.opentdf.platform.ListSubjectMappings</mainClass>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<!-- </pluginManagement> -->
Expand Down
Loading