-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
283 additions
and
292 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
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
4 changes: 2 additions & 2 deletions
4
app/src/main/java/de/serviceflow/frankenstein/vf/segment/BWConfigController.java
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
package de.serviceflow.frankenstein.vf.segment; | ||
|
||
import de.serviceflow.frankenstein.plugin.api.SegmentConfigController; | ||
import de.serviceflow.frankenstein.plugin.api.DefaultSegmentConfigController; | ||
|
||
public class BWConfigController extends SegmentConfigController { | ||
public class BWConfigController extends DefaultSegmentConfigController { | ||
|
||
} |
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
4 changes: 2 additions & 2 deletions
4
app/src/main/java/de/serviceflow/frankenstein/vf/segment/StereoDistanceConfigController.java
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
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
13 changes: 12 additions & 1 deletion
13
...n/plugin/api/SegmentConfigController.java → ...n/api/DefaultSegmentConfigController.java
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
9 changes: 7 additions & 2 deletions
9
plugin-api/src/main/java/de/serviceflow/frankenstein/plugin/api/FilterContext.java
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 |
---|---|---|
@@ -1,6 +1,11 @@ | ||
package de.serviceflow.frankenstein.plugin.api; | ||
|
||
/** | ||
* Context of filters can be used access context information or to exchange | ||
* data, like results, between different filters in the pipeline. | ||
*/ | ||
public interface FilterContext { | ||
Object getValue(String Key); | ||
Object putValue(String Key, Object value); | ||
Object getValue(String key); | ||
|
||
Object putValue(String key, Object value); | ||
} |
11 changes: 11 additions & 0 deletions
11
plugin-api/src/main/java/de/serviceflow/frankenstein/plugin/api/JniFilterProxy.java
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,11 @@ | ||
package de.serviceflow.frankenstein.plugin.api; | ||
|
||
/** | ||
* Filter Proxy to JNI Implementation. | ||
*/ | ||
public interface JniFilterProxy { | ||
/** | ||
* basic initialization to be implemented native. | ||
*/ | ||
void init(); | ||
} |
41 changes: 0 additions & 41 deletions
41
plugin-api/src/main/java/de/serviceflow/frankenstein/plugin/api/NativeFilter.java
This file was deleted.
Oops, something went wrong.
62 changes: 62 additions & 0 deletions
62
plugin-api/src/main/java/de/serviceflow/frankenstein/plugin/api/NativeJniProxy.java
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,62 @@ | ||
package de.serviceflow.frankenstein.plugin.api; | ||
|
||
import java.lang.reflect.InvocationTargetException; | ||
import java.lang.reflect.Method; | ||
|
||
/** | ||
* Proxy for native JNI calls with the capability to be loaded from external jar | ||
* with methods and callback to load a plug-in-specific native library with base | ||
* name PLUGINNAME. Convention is that the name of the package of the | ||
* implementing class ends with ".plugin.PLUGINNAME". | ||
*/ | ||
public abstract class NativeJniProxy { | ||
|
||
/** | ||
* Creates new instance and ensured the native library is loaded, by | ||
* preparing it and invoking {@link #loadLibrary(String)}. | ||
* | ||
* @throws UnsatisfiedLinkError if loading the native library failed. | ||
*/ | ||
protected NativeJniProxy() throws UnsatisfiedLinkError { | ||
prepareLoadLibrary(this); | ||
} | ||
|
||
private void prepareLoadLibrary(NativeJniProxy invoker) throws UnsatisfiedLinkError { | ||
String packageName = invoker.getClass().getPackage().getName(); | ||
String pluginName = packageName.substring(packageName.lastIndexOf(".plugin.") + 1); | ||
pluginName = pluginName.substring(0, pluginName.indexOf('.', pluginName.indexOf('.') + 1)).replace('.', '-'); | ||
|
||
invoker.loadLibrary(prepareLoadLibrary(invoker.getClass(), pluginName)); | ||
} | ||
|
||
private String prepareLoadLibrary(Class<?> invokerClass, String pluginName) throws UnsatisfiedLinkError { | ||
try { | ||
Class<?> c = invokerClass.getClassLoader().loadClass("de.serviceflow.frankenstein.LibraryManager"); | ||
Object o = c.newInstance(); | ||
Method m = c.getMethod("prepareLoadLibrary", Class.class, String.class); | ||
return (String) m.invoke(o, invokerClass, pluginName); | ||
} catch (SecurityException | ClassNotFoundException | NoSuchMethodException | InstantiationException | ||
| IllegalAccessException | IllegalArgumentException e) { | ||
e.printStackTrace(); | ||
throw new UnsatisfiedLinkError( | ||
"Prepare to load library failed for " + pluginName + " with " + invokerClass.getName()); | ||
} catch (InvocationTargetException e) { | ||
Throwable t = e.getCause(); | ||
if (t != null) | ||
t.printStackTrace(); | ||
e.printStackTrace(); | ||
throw new UnsatisfiedLinkError( | ||
"Prepare to load library failed for " + pluginName + " with " + invokerClass.getName()); | ||
} | ||
} | ||
|
||
/** | ||
* The Implementing class should call "System.loadLibrary(name);" here. | ||
* Remark: The design of Java is to use reflection and internal class loader | ||
* methods. | ||
* | ||
* @param name | ||
* Name of the Library, including base name and architecture. | ||
*/ | ||
protected abstract void loadLibrary(String name); | ||
} |
Oops, something went wrong.