();
+
+ /**
+ * @param entity
+ * @param description
+ */
+ public EntityDescriptions(RelationalEntity entity, String description) {
+ CoreArgCheck.isNotNull(entity);
+ CoreArgCheck.isNotNull(description);
+
+ this.entity = entity;
+ this.descriptions.add(description);
+ }
+
+ /**
+ * @return the entity
+ */
+ public RelationalEntity getEntity() {
+ return this.entity;
+ }
+
+ /**
+ * @return the first description in the list,
+ * which is considered to have the highest priority
+ */
+ public String getPreferredDescription() {
+ return this.descriptions.get(0);
+ }
+
+ /**
+ * @return the complete description,
+ * which is the concatenation of all descriptions
+ */
+ public String getCompleteDescription() {
+ StringBuilder builder = new StringBuilder();
+ for (String description : descriptions) {
+ builder.append(description);
+ builder.append("\n"); //$NON-NLS-1$
+ }
+
+ return builder.toString();
+ }
+ /**
+ * Add a description to the list of descriptions.
+ *
+ * Descriptions are in priority order with the preferred description
+ * being first in the list. Therefore, the first description is
+ * considered to be the preferred description.
+ *
+ * Use the given {@link DescriptionOperation} to determine whether
+ * to prepend or append the given description.
+ *
+ * @param description
+ * @param operation
+ */
+ public void addDescription(String description, DescriptionOperation operation) {
+ if (DescriptionOperation.PREPEND.equals(operation))
+ descriptions.add(0, description);
+ else
+ descriptions.add(description);
+ }
+
+ @Override
+ public int hashCode() {
+ return entity.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null) return false;
+ if (getClass() != obj.getClass()) return false;
+ EntityDescriptions other = (EntityDescriptions)obj;
+ if (this.entity == null) {
+ if (other.entity != null) return false;
+ } else if (!this.entity.equals(other.entity)) return false;
+ return true;
+ }
+ }
+
+ private final RelationalFactory factory = RelationalFactory.eINSTANCE;
+
+ private ModelType modelType;
+
+ private String modelName;
+
+ private ModelResource model;
+
+ private ModelResourceSelector startingSelector;
+
+ private TransientModelSelector endingSelector;
+
+ private DifferenceProcessor differenceProcessor;
+
+ private IProgressMonitor monitor;
+
+ private List messages;
+
+ private boolean optToCreateModelEntitiesForUnsupportedDdl;
+
+ private boolean optToSetModelEntityDescription;
+
+ private Collection descriptionPairs = new ArrayList();
+
+ private DdlNodeImporter nodeImporter;
+
+ /**
+ * @param model
+ */
+ public void setRelationalModel(ModelResource model) {
+ this.model = model;
+ }
+
+ /**
+ * @param modelType the modelType to set
+ */
+ public void setModelType(ModelType modelType) {
+ this.modelType = modelType;
+ }
+
+ /**
+ * @return the modelType
+ */
+ public ModelType getModelType() {
+ return this.modelType;
+ }
+
+ /**
+ * @param modelName the modelName to set
+ */
+ public void setModelName(String modelName) {
+ this.modelName = modelName;
+ }
+
+ /**
+ * @return the modelName
+ */
+ public String getModelName() {
+ return this.modelName;
+ }
+
+ /**
+ * @param monitor
+ */
+ public void setProgressMonitor(IProgressMonitor monitor) {
+ this.monitor = monitor;
+ }
+
+ /**
+ * Get the progress monitor
+ *
+ * @return {@link IProgressMonitor}
+ */
+ public IProgressMonitor getProgressMonitor() {
+ if (monitor == null) {
+ monitor = new NullProgressMonitor();
+ }
+
+ return monitor;
+ }
+
+ /**
+ * @param messages
+ */
+ public void setProgressMessages(List messages) {
+ this.messages = messages;
+ }
+
+ /**
+ * Get the progress monitor
+ *
+ * @return {@link IProgressMonitor}
+ */
+ public List getProgressMessages() {
+ if (messages == null) {
+ messages = new ArrayList();
+ }
+
+ return messages;
+ }
+
+ /**
+ * Get the starting selector
+ *
+ * @return {@link ModelSelector}
+ */
+ public ModelSelector getStartingSelector() {
+ CoreArgCheck.isNotNull(model);
+
+ if (startingSelector == null)
+ startingSelector = new ModelResourceSelector(model);
+
+ return startingSelector;
+ }
+
+ /**
+ * Get the ending selector
+ *
+ * @return {@link ModelSelector}
+ *
+ * @throws Exception
+ */
+ public ModelSelector getEndingSelector() throws Exception {
+ CoreArgCheck.isNotNull(model);
+
+ if (endingSelector == null) {
+ final URI mdlUri = URI.createFileURI(model.getPath().toFile().getAbsolutePath());
+ final ModelAnnotation mdlAnnotation = model.getModelAnnotation();
+ endingSelector = new TransientModelSelector(mdlUri, mdlAnnotation);
+ }
+
+ return endingSelector;
+ }
+
+ /**
+ * Get the DifferenceProcessor
+ *
+ * @return the difference processor
+ * @throws Exception
+ */
+ public DifferenceProcessor getDifferenceProcessor() throws Exception {
+ if (differenceProcessor == null) {
+ differenceProcessor = new DifferenceProcessorImpl(getStartingSelector(), getEndingSelector());
+ differenceProcessor.addEObjectMatcherFactories(ModelerComparePlugin.createEObjectMatcherFactories());
+ }
+
+ return differenceProcessor;
+ }
+
+ /**
+ * @return the factory
+ */
+ public RelationalFactory getFactory() {
+ return factory;
+ }
+
+ /**
+ * @return the optToCreateModelEntitiesForUnsupportedDdl
+ */
+ public boolean optToCreateModelEntitiesForUnsupportedDdl() {
+ return optToCreateModelEntitiesForUnsupportedDdl;
+ }
+
+ /**
+ * @param optToCreateModelEntitiesForUnsupportedDdl
+ */
+ public void setOptToCreateModelEntitiesForUnsupportedDdl(boolean optToCreateModelEntitiesForUnsupportedDdl) {
+ this.optToCreateModelEntitiesForUnsupportedDdl = optToCreateModelEntitiesForUnsupportedDdl;
+ }
+
+ /**
+ * @return the optToSetModelEntityDescription
+ */
+ public boolean optToSetModelEntityDescription() {
+ return optToSetModelEntityDescription;
+ }
+
+ /**
+ * @param optToSetModelEntityDescription
+ */
+ public void setOptToSetModelEntityDescription(boolean optToSetModelEntityDescription) {
+ this.optToSetModelEntityDescription = optToSetModelEntityDescription;
+ }
+
+ /**
+ * @param entity
+ * @param description
+ * @param operation
+ */
+ public void addDescription(RelationalEntity entity, String description, DescriptionOperation operation) {
+ for (EntityDescriptions pair : descriptionPairs) {
+ if (pair.getEntity().equals(entity)) {
+ pair.addDescription(description, operation);
+ return;
+ }
+ }
+
+ // Completely new entity description
+ descriptionPairs.add(new EntityDescriptions(entity, description));
+ }
+
+ /**
+ * @return the descriptionPairs
+ */
+ public Collection getEntityDescriptions() {
+ return this.descriptionPairs;
+ }
+
+ /**
+ * @param nodeImporter
+ */
+ public void setNodeImporter(DdlNodeImporter nodeImporter) {
+ this.nodeImporter = nodeImporter;
+ }
+
+ /**
+ * @return the nodeImporter
+ */
+ public DdlNodeImporter getNodeImporter() {
+ return this.nodeImporter;
+ }
+}
diff --git a/plugins/org.teiid.designer.ddl.spi/src/org/teiid/designer/ddl/DdlNodeImporter.java b/plugins/org.teiid.designer.ddl.spi/src/org/teiid/designer/ddl/DdlNodeImporter.java
new file mode 100644
index 0000000000..e7212080b1
--- /dev/null
+++ b/plugins/org.teiid.designer.ddl.spi/src/org/teiid/designer/ddl/DdlNodeImporter.java
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+*
+* See the LEGAL.txt file distributed with this work for information regarding copyright ownership and licensing.
+*
+* See the AUTHORS.txt file distributed with this work for a full listing of individual contributors.
+*/
+package org.teiid.designer.ddl;
+
+import org.modeshape.sequencer.ddl.node.AstNode;
+
+
+/**
+ *
+ */
+public interface DdlNodeImporter {
+
+ /**
+ * Import the contents of the given {@link AstNode}
+ *
+ * @param importerModel
+ * @param rootNode
+ * @throws Exception
+ */
+ void importNode(DdlImporterModel importerModel, AstNode rootNode) throws Exception;
+
+ /**
+ * Perform any final processes upon completion of the import
+ *
+ * @throws Exception
+ */
+ void importFinalize() throws Exception;
+
+}
diff --git a/plugins/org.teiid.designer.ddl.spi/src/org/teiid/designer/ddl/registry/DdlNodeImporterRegistry.java b/plugins/org.teiid.designer.ddl.spi/src/org/teiid/designer/ddl/registry/DdlNodeImporterRegistry.java
new file mode 100644
index 0000000000..e0311b511c
--- /dev/null
+++ b/plugins/org.teiid.designer.ddl.spi/src/org/teiid/designer/ddl/registry/DdlNodeImporterRegistry.java
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source.
+*
+* See the LEGAL.txt file distributed with this work for information regarding copyright ownership and licensing.
+*
+* See the AUTHORS.txt file distributed with this work for a full listing of individual contributors.
+*/
+package org.teiid.designer.ddl.registry;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.teiid.designer.ddl.DdlNodeImporter;
+import org.teiid.designer.registry.AbstractExtensionRegistry;
+
+/**
+ * Registry for ddl node importer implementations
+ */
+public class DdlNodeImporterRegistry extends AbstractExtensionRegistry {
+
+ private static final String EXT_POINT_ID = "org.teiid.designer.ddl.nodeImporter"; //$NON-NLS-1$
+
+ private static final String IMPORTER_ID = "importer"; //$NON-NLS-1$
+
+ private static final String DIALECT_ID = "dialect"; //$NON-NLS-1$
+
+ private static DdlNodeImporterRegistry registry;
+
+ /**
+ * Get the singleton instance of this registry
+ *
+ * @return singleton {@link DdlNodeImporterRegistry}
+ *
+ * @throws Exception
+ */
+ public static DdlNodeImporterRegistry getInstance() throws Exception {
+ if (registry == null) {
+ registry = new DdlNodeImporterRegistry();
+ }
+
+ return registry;
+ }
+
+ private DdlNodeImporterRegistry() throws Exception {
+ super(EXT_POINT_ID, IMPORTER_ID);
+ }
+
+ @Override
+ protected void register(IConfigurationElement configurationElement, DdlNodeImporter ddlImporter) {
+ String dialect = configurationElement.getAttribute(DIALECT_ID);
+ register(dialect.toUpperCase(), ddlImporter);
+ }
+}
diff --git a/plugins/pom.xml b/plugins/pom.xml
index 6785c3fc9f..30e36bd73a 100644
--- a/plugins/pom.xml
+++ b/plugins/pom.xml
@@ -28,6 +28,7 @@
org.teiid.designer.datatools.ui
org.teiid.designer.ddl
org.teiid.designer.ddl.importer.ui
+ org.teiid.designer.ddl.spi
org.teiid.designer.ddl.importer
org.teiid.designer.diagram.ui
org.teiid.designer.dqp