dol: initial dol commit
[jump.git] / dol / src / dol / util / SchemaLocation.java
diff --git a/dol/src/dol/util/SchemaLocation.java b/dol/src/dol/util/SchemaLocation.java
new file mode 100644 (file)
index 0000000..de46cef
--- /dev/null
@@ -0,0 +1,137 @@
+/* $Id: SchemaLocation.java 1 2010-02-24 13:03:05Z haidw $ */
+package dol.util;
+
+/**
+ * Class to get the location of schemas.
+ */
+public class SchemaLocation {
+
+    protected static final String PN_NAMESPACE =
+            "http://www.tik.ee.ethz.ch/~shapes/schema/PROCESSNETWORK";
+    protected static final String PN_LOCATION =
+            "http://www.tik.ee.ethz.ch/~shapes/schema/processnetwork.xsd";
+    protected static final String ARCH_NAMESPACE =
+            "http://www.tik.ee.ethz.ch/~shapes/schema/ARCHITECTURE";
+    protected static final String ARCH_LOCATION =
+            "http://www.tik.ee.ethz.ch/~shapes/schema/architecture.xsd";
+    protected static final String ARCH_NAMESPACE_OLD =
+            "http://www.tik.ee.ethz.ch/~shapes/schema/ARCHITECTURE_OLD";
+    protected static final String MAP_NAMESPACE =
+            "http://www.tik.ee.ethz.ch/~shapes/schema/MAPPING";
+    protected static final String MAP_LOCATION =
+            "http://www.tik.ee.ethz.ch/~shapes/schema/mapping.xsd";
+    protected static final String MAP_NAMESPACE_OLD =
+            "http://www.tik.ee.ethz.ch/~shapes/schema/MAPPING_OLD";
+
+    /** singleton instance */
+    protected final static SchemaLocation _schemaLocation =
+        new SchemaLocation();
+
+    /**
+     * Default constructor.
+     */
+    public SchemaLocation() {
+    }
+
+    /**
+     * Return the process network namespace.
+     *
+     * @return process network namespace
+     */
+    public static String getProcessNetworkNamespace() {
+        return PN_NAMESPACE;
+    }
+
+    /**
+     * Return the process network schema location.
+     *
+     * @return process network schema location
+     */
+    public static String getProcessNetworkSchemaLocation() {
+        return PN_LOCATION;
+    }
+
+    /**
+     * Return the architecture namespace.
+     *
+     * @return architecture namespace
+     */
+    public static String getArchitectureNamespace() {
+        return ARCH_NAMESPACE;
+    }
+
+    /**
+     * Return the architecture schema location.
+     *
+     * @return architecture schema location
+     */
+    public static String getArchitectureSchemaLocation() {
+        return ARCH_LOCATION;
+    }
+
+    /**
+     * Return the mapping namespace.
+     *
+     * @return mapping namespace
+     */
+    public static String getMappingNamespace() {
+        return MAP_NAMESPACE;
+    }
+
+    /**
+     * Return the mapping schema location.
+     *
+     * @return mapping schema location
+     */
+    public static String getMappingSchemaLocation() {
+        return MAP_LOCATION;
+    }
+
+    /**
+     * Return a string with the references to the external schema files.
+     *
+     * @return references to external schemas
+     */
+    public static String getExternalSchemaLocation() {
+        String loc = PN_NAMESPACE + " ";
+        loc += _schemaLocation.getClass().getResource(
+                "/schema/processnetwork.xsd");
+        loc += " " + ARCH_NAMESPACE + " ";
+        loc += _schemaLocation.getClass().getResource(
+                "/schema/architecture.xsd");
+        loc += " " + ARCH_NAMESPACE_OLD + " ";
+        loc += _schemaLocation.getClass().getResource(
+                "/schema/architecture_old.xsd");
+        loc += " " + MAP_NAMESPACE + " ";
+        loc += _schemaLocation.getClass().getResource(
+                "/schema/mapping.xsd");
+        return loc;
+    }
+
+    /**
+     * Return a string with the references to the internal schema files.
+     *
+     * @return references to internal schemas
+     */
+    public static String getInternalSchemaLocation() {
+        String loc = PN_NAMESPACE + " ";
+        loc += _schemaLocation.getClass().getResource(
+                "/schema/internal/processnetwork_internal.xsd");
+        loc += " " + ARCH_NAMESPACE + " ";
+        loc += _schemaLocation.getClass().getResource(
+                "/schema/internal/architecture_internal.xsd");
+        loc += " " + ARCH_NAMESPACE_OLD + " ";
+        loc += _schemaLocation.getClass().getResource(
+                "/schema/internal/architecture_old_internal.xsd");
+        loc += " " + MAP_NAMESPACE + " ";
+        loc += _schemaLocation.getClass().getResource(
+                "/schema/internal/mapping_internal.xsd");
+        loc += " " + MAP_NAMESPACE_OLD + " ";
+        loc += _schemaLocation.getClass().getResource(
+               "/schema/internal/mapping_old_internal.xsd");
+        return loc;
+    }
+}
+
+
+