Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrescobar2011-03-01 19:13:03 -0500
committerRyan D. Brooks2011-03-01 19:13:03 -0500
commitbc8e657e3cfb522c223019f4ef45c06bfde726c7 (patch)
tree393bfda66a5c99979c467de5e31f86cb631c070b /plugins/org.eclipse.osee.framework.core.datastore
parentb65415d399b26b6d910780097e12597f4033af58 (diff)
downloadorg.eclipse.osee-bc8e657e3cfb522c223019f4ef45c06bfde726c7.tar.gz
org.eclipse.osee-bc8e657e3cfb522c223019f4ef45c06bfde726c7.tar.xz
org.eclipse.osee-bc8e657e3cfb522c223019f4ef45c06bfde726c7.zip
feature[ats_LCBBP]: Add schema resource isApplicable method
Diffstat (limited to 'plugins/org.eclipse.osee.framework.core.datastore')
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/IOseeSchemaResource.java2
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/OseeSchemaProvider.java5
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/CoreOseeSchemaResource.java5
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/SchemaXmlParser.java13
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/LoadUserSchemasOperation.java5
5 files changed, 23 insertions, 7 deletions
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/IOseeSchemaResource.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/IOseeSchemaResource.java
index 6c717fee83..9371e0099a 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/IOseeSchemaResource.java
+++ b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/IOseeSchemaResource.java
@@ -18,5 +18,7 @@ import org.eclipse.osee.framework.core.exception.OseeCoreException;
*/
public interface IOseeSchemaResource {
+ public boolean isApplicable();
+
public InputStream getContent() throws OseeCoreException;
}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/OseeSchemaProvider.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/OseeSchemaProvider.java
index 625a1b0d4a..1898ce7ab2 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/OseeSchemaProvider.java
+++ b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/OseeSchemaProvider.java
@@ -33,7 +33,10 @@ public class OseeSchemaProvider implements IOseeSchemaProvider {
if (services != null) {
for (Object object : services) {
if (object instanceof IOseeSchemaResource) {
- providers.add((IOseeSchemaResource) object);
+ IOseeSchemaResource resource = (IOseeSchemaResource) object;
+ if (resource.isApplicable()) {
+ providers.add(resource);
+ }
}
}
}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/CoreOseeSchemaResource.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/CoreOseeSchemaResource.java
index b4055848ba..f038cb9987 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/CoreOseeSchemaResource.java
+++ b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/CoreOseeSchemaResource.java
@@ -32,4 +32,9 @@ public class CoreOseeSchemaResource implements IOseeSchemaResource {
}
return inputStream;
}
+
+ @Override
+ public boolean isApplicable() {
+ return true;
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/SchemaXmlParser.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/SchemaXmlParser.java
index 3030189e24..2c7dea32ae 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/SchemaXmlParser.java
+++ b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/SchemaXmlParser.java
@@ -12,10 +12,12 @@ package org.eclipse.osee.framework.core.datastore.schema.data;
import java.io.BufferedInputStream;
import java.io.InputStream;
+import java.util.Collection;
import java.util.List;
import java.util.Map;
-import org.eclipse.osee.framework.core.datastore.IOseeSchemaProvider;
+import java.util.logging.Level;
import org.eclipse.osee.framework.core.datastore.IOseeSchemaResource;
+import org.eclipse.osee.framework.core.datastore.internal.Activator;
import org.eclipse.osee.framework.core.datastore.schema.data.AppliesToClause.AppliesToEntries;
import org.eclipse.osee.framework.core.datastore.schema.data.AppliesToClause.OrderType;
import org.eclipse.osee.framework.core.datastore.schema.data.ConstraintElement.ConstraintFields;
@@ -29,6 +31,7 @@ import org.eclipse.osee.framework.core.datastore.schema.data.TableElement.TableS
import org.eclipse.osee.framework.core.datastore.schema.data.TableElement.TableTags;
import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.framework.jdk.core.util.xml.Jaxp;
+import org.eclipse.osee.framework.logging.OseeLog;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -187,8 +190,8 @@ public class SchemaXmlParser {
return schemaData;
}
- public void parseFromSchemaProvider(IOseeSchemaProvider schemaProvider, Map<String, SchemaData> schemas) {
- for (IOseeSchemaResource schemaResource : schemaProvider.getSchemaResources()) {
+ public void parseFromSchemaProvider(Collection<IOseeSchemaResource> schemaResources, Map<String, SchemaData> schemas) {
+ for (IOseeSchemaResource schemaResource : schemaResources) {
SchemaData schemaData;
InputStream inputStream = null;
try {
@@ -207,8 +210,8 @@ public class SchemaXmlParser {
}
schema.addTableDefinition(table);
}
- } catch (Exception e) {
- e.printStackTrace();
+ } catch (Exception ex) {
+ OseeLog.log(Activator.class, Level.WARNING, ex);
} finally {
Lib.close(inputStream);
}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/LoadUserSchemasOperation.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/LoadUserSchemasOperation.java
index e81a70df09..44e5bfe362 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/LoadUserSchemasOperation.java
+++ b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/LoadUserSchemasOperation.java
@@ -12,12 +12,14 @@ package org.eclipse.osee.framework.core.datastore.schema.operations;
import java.sql.DatabaseMetaData;
import java.sql.SQLException;
+import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osee.framework.core.datastore.IOseeSchemaProvider;
+import org.eclipse.osee.framework.core.datastore.IOseeSchemaResource;
import org.eclipse.osee.framework.core.datastore.SchemaCreationOptions;
import org.eclipse.osee.framework.core.datastore.internal.Activator;
import org.eclipse.osee.framework.core.datastore.schema.data.ColumnMetadata;
@@ -52,8 +54,9 @@ public class LoadUserSchemasOperation extends AbstractOperation {
@Override
protected void doWork(IProgressMonitor monitor) throws Exception {
+ Collection<IOseeSchemaResource> schemaResources = schemaProvider.getSchemaResources();
SchemaXmlParser parser = new SchemaXmlParser();
- parser.parseFromSchemaProvider(schemaProvider, schemas);
+ parser.parseFromSchemaProvider(schemaResources, schemas);
if (!options.isUseFileSpecifiedSchemas()) {
try {

Back to the top