]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.services/src/org/simantics/db/services/adaption/AdapterRegistry2.java
Only validate adapter definitions against schema in development mode
[simantics/platform.git] / bundles / org.simantics.db.services / src / org / simantics / db / services / adaption / AdapterRegistry2.java
index 1eb00704409ab15b5f3291af22afc76874b54026..0e52b8a417da4ebecf82c27369cf7581171c58e4 100644 (file)
@@ -354,7 +354,7 @@ public class AdapterRegistry2 {
             DocumentBuilderFactory factory =
                 DocumentBuilderFactory.newInstance();
             
-            if(schemaURL != null) {
+            if(schemaURL != null && validateAgainstSchema()) {
             
                    factory.setValidating(true);
                    factory.setAttribute(
@@ -410,20 +410,27 @@ public class AdapterRegistry2 {
         }
        
     }
-    
-    public void initialize(BundleContext context) {
+
+    private boolean validateAgainstSchema() {
+        return Platform.inDevelopmentMode();
+    }
+
+       public void initialize(BundleContext context) {
        
         try {
                
             DocumentBuilderFactory factory =
                 DocumentBuilderFactory.newInstance();
-            factory.setValidating(true);
-            factory.setAttribute(
-                    "http://java.sun.com/xml/jaxp/properties/schemaLanguage",
-            "http://www.w3.org/2001/XMLSchema");
-            factory.setAttribute(
-                    "http://java.sun.com/xml/jaxp/properties/schemaSource",
-                    context.getBundle().getResource("adapters.xsd").toString());
+
+            if (validateAgainstSchema()) {
+                factory.setValidating(true);
+                factory.setAttribute(
+                        "http://java.sun.com/xml/jaxp/properties/schemaLanguage",
+                        "http://www.w3.org/2001/XMLSchema");
+                factory.setAttribute(
+                        "http://java.sun.com/xml/jaxp/properties/schemaSource",
+                        context.getBundle().getResource("adapters.xsd").toString());
+            }
 
             // TODO Listen bundles (install/uninstall)
             if (exceptions.isEmpty())