diff options
Diffstat (limited to 'plugins')
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 6c717fee831..9371e0099a7 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 625a1b0d4af..1898ce7ab28 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 b4055848ba4..f038cb9987c 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 3030189e24c..2c7dea32ae0 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 e81a70df09e..44e5bfe3621 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 { |