Permalink
Browse files

Fix issue #134 by supporting com.xmlcalabash.safe-mode and com.xmlcal…

…abash.log-style system properties and a log-style element in the configuration file
  • Loading branch information...
ndw committed Dec 13, 2013
1 parent dcc6e75 commit b29a37f6937ac403c9fb3af621c5999bcc3c5644
Showing with 33 additions and 0 deletions.
  1. +33 −0 src/com/xmlcalabash/core/XProcConfiguration.java
@@ -307,6 +307,7 @@ private void loadConfiguration() {
extensionValues = "true".equals(System.getProperty("com.xmlcalabash.general-values", ""+extensionValues));
xpointerOnText = "true".equals(System.getProperty("com.xmlcalabash.xpointer-on-text", ""+xpointerOnText));
transparentJSON = "true".equals(System.getProperty("com.xmlcalabash.transparent-json", ""+transparentJSON));
+ safeMode = "true".equals(System.getProperty("com.xmlcalabash.safe-mode", ""+safeMode));
jsonFlavor = System.getProperty("com.xmlcalabash.json-flavor", jsonFlavor);
useXslt10 = "true".equals(System.getProperty("com.xmlcalabash.use-xslt-10", ""+useXslt10));
entityResolver = System.getProperty("com.xmlcalabash.entity-resolver", entityResolver);
@@ -321,6 +322,21 @@ private void loadConfiguration() {
mailUser = System.getProperty("com.xmlcalabash.mail-username", mailUser);
mailPass = System.getProperty("com.xmlcalabash.mail-password", mailPass);
+ if (System.getProperty("com.xmlcalabash.log-style") != null) {
+ String s = System.getProperty("com.xmlcalabash.log-style");
+ if ("off".equals(s)) {
+ logOpt = LogOptions.OFF;
+ } else if ("plain".equals(s)) {
+ logOpt = LogOptions.PLAIN;
+ } else if ("wrapped".equals(s)) {
+ logOpt = LogOptions.WRAPPED;
+ } else if ("directory".equals(s)) {
+ logOpt = LogOptions.DIRECTORY;
+ } else {
+ throw new XProcException("Invalid log-style specified in com.xmlcalabash.log-style property");
+ }
+ }
+
if (System.getProperty("com.xmlcalabash.piperack-port") != null) {
piperackPort = Integer.parseInt(System.getProperty("com.xmlcalabash.piperack-port"));
}
@@ -444,6 +460,8 @@ public void parse(XdmNode doc) {
parseSendMail(node);
} else if ("saxon-configuration-property".equals(localName)) {
saxonConfigurationProperty(node);
+ } else if ("log-style".equals(localName)) {
+ logStyle(node);
} else if ("pipeline-loader".equals(localName)) {
pipelineLoader(node);
} else if ("piperack-port".equals(localName)) {
@@ -683,6 +701,21 @@ private void saxonConfigurationProperty(XdmNode node) {
}
}
+ private void logStyle(XdmNode node) {
+ String style = node.getAttributeValue(_value);
+ if ("off".equals(style)) {
+ logOpt = LogOptions.OFF;
+ } else if ("plain".equals(style)) {
+ logOpt = LogOptions.PLAIN;
+ } else if ("wrapped".equals(style)) {
+ logOpt = LogOptions.WRAPPED;
+ } else if ("directory".equals(style)) {
+ logOpt = LogOptions.DIRECTORY;
+ } else {
+ throw new XProcException("Configuration option 'log-style' must be one of 'off', 'plain', 'wrapped', or 'directory'");
+ }
+ }
+
private void pipelineLoader(XdmNode node) {
String data = node.getAttributeValue(_data);
String href = node.getAttributeValue(_href);

0 comments on commit b29a37f

Please sign in to comment.