- public static <T> T applySCL(String module, String function, ReadGraph graph, Object ... args) throws DatabaseException {
- SCLContext sclContext = SCLContext.getCurrent();
- Object oldGraph = sclContext.put("graph", graph);
- try {
- T t = (T)((Function)SCLOsgi.MODULE_REPOSITORY.getValue(module, function)).applyArray(args);
- return t;
- } catch (ValueNotFound e) {
- throw new DatabaseException("SCL Value not found: " + e.name);
- } catch (Throwable t) {
- throw new DatabaseException(t);
- } finally {
- sclContext.put("graph", oldGraph);
- }
+ public static <T> T applySCL(String module, String function, Object ... args) throws DatabaseException {
+ try {
+ T t = (T)((Function)SCLOsgi.MODULE_REPOSITORY.getValue(module, function)).applyArray(args);
+ return t;
+ } catch (ValueNotFound e) {
+ throw new DatabaseException("SCL Value not found: " + e.name);
+ } catch (Throwable t) {
+ if (t instanceof DatabaseException)
+ throw (DatabaseException) t;
+ throw new DatabaseException(t);
+ }
+ }