-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Java: Configure GEDS using string types.
Signed-off-by: Pascal Spörri <[email protected]>
- Loading branch information
Showing
9 changed files
with
403 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* Copyright 2023- IBM Inc. All rights reserved | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <memory> | ||
|
||
#include "GEDSConfig.h" | ||
|
||
struct GEDSConfigContainer { | ||
std::shared_ptr<GEDSConfig> element; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/** | ||
* Copyright 2023- IBM Inc. All rights reserved | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package com.ibm.geds; | ||
|
||
public class GEDSConfig { | ||
static { | ||
System.loadLibrary("geds_java"); | ||
} | ||
|
||
private long nativePtr = 0; | ||
|
||
public long getNativePtr() { | ||
return nativePtr; | ||
} | ||
|
||
public final String serverAddress; | ||
|
||
public GEDSConfig(String serverAddress) { | ||
this.serverAddress = serverAddress; | ||
this.nativePtr = initGEDSConfig(serverAddress); | ||
} | ||
|
||
public void set(String key, String value) { | ||
nativeSetString(nativePtr, key, value); | ||
} | ||
|
||
public void set(String key, int value) { | ||
nativeSetInt(nativePtr, key, value); | ||
} | ||
|
||
public void set(String key, long value) { | ||
nativeSetLong(nativePtr, key, value); | ||
} | ||
|
||
public String getString(String key) { | ||
return nativeGetString(nativePtr, key); | ||
} | ||
|
||
public int getInt(String key) { | ||
return nativeGetInt(nativePtr, key); | ||
} | ||
|
||
public long getLong(String key) { | ||
return nativeGetLong(nativePtr, key); | ||
} | ||
|
||
private static native long initGEDSConfig(String serverAddress); | ||
|
||
private static native void nativeSetString(long nativePtr, String key, String value); | ||
|
||
private static native void nativeSetInt(long nativePtr, String key, int value); | ||
|
||
private static native void nativeSetLong(long nativePtr, String key, long value); | ||
|
||
private static native String nativeGetString(long nativePtr, String key); | ||
|
||
private static native int nativeGetInt(long nativePtr, String key); | ||
|
||
private static native long nativeGetLong(long nativePtr, String key); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.