Skip to content
Permalink
Browse files

Added static step initialization

  • Loading branch information
ndw committed Apr 17, 2015
1 parent 01b8f7a commit 28b8e18a93c7415cfc4e3d3e75d5c8a121e148b3
Showing with 23 additions and 0 deletions.
  1. +23 −0 src/main/java/com/xmlcalabash/core/XProcRuntime.java
@@ -27,6 +27,8 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URI;
import java.net.URISyntaxException;
import java.security.MessageDigest;
@@ -265,6 +267,8 @@ else if (def instanceof ExtensionFunction)
htmlParser = config.htmlParser;

reset();

initializeSteps();
}

public XProcRuntime(XProcRuntime runtime) {
@@ -302,6 +306,25 @@ public XProcRuntime(XProcRuntime runtime) {
}

reset();

initializeSteps();
}

private void initializeSteps() {
for (Class klass : config.implementations.values()) {
try {
Method config = klass.getMethod("configureStep", XProcRuntime.class);
config.invoke(null, this);
} catch (NoSuchMethodException e) {
// nevermind
} catch (IllegalAccessException e) {
// nevermind
} catch (InvocationTargetException e) {
// nevermind
} catch (Exception e) {
System.err.println("Caught: " + e);
}
}
}

public void close() {

0 comments on commit 28b8e18

Please sign in to comment.
You can’t perform that action at this time.