summaryrefslogtreecommitdiffstats
path: root/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/StandardXSDFactory.java
diff options
context:
space:
mode:
Diffstat (limited to 'sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/StandardXSDFactory.java')
-rw-r--r--sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/StandardXSDFactory.java39
1 files changed, 39 insertions, 0 deletions
diff --git a/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/StandardXSDFactory.java b/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/StandardXSDFactory.java
new file mode 100644
index 0000000000..828b0117e6
--- /dev/null
+++ b/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/StandardXSDFactory.java
@@ -0,0 +1,39 @@
+package test.sdo21.tests.TestData;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.Type;
+
+/**
+ *
+ * Concrete specialization of the StandardFactory test data creation factory
+ * which uses an XSD to create the required metadata.
+ *
+ */
+public class StandardXSDFactory extends StandardFactory {
+
+ public final static String TEST_MODEL = "/api_test.xsd";
+
+
+ public void defineMetaData(HelperContext hc) throws IOException {
+
+ Type t = hc.getTypeHelper().getType(TEST_NAMESPACE, "Abstract");
+ if (t != null) {
+ // the test types have already been defined in this HelperContext (this will happen when the
+ // implementation being tested does not support multiple contexts, which is not a 2.1 requirement).
+ return;
+ }
+
+ // Populate the meta data for the test model (APITest)
+ URL url = this.getClass().getResource(TEST_MODEL);
+ InputStream inputStream = url.openStream();
+ hc.getXSDHelper().define(inputStream, url.toString());
+ inputStream.close();
+
+ }
+
+
+}