Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoberto E. Escobar2012-02-24 16:02:37 -0500
committerRyan D. Brooks2012-02-24 16:02:37 -0500
commit7803c382be2ab675c2f123fc2faa6416f5a0b5d6 (patch)
treeba0791f9e2444c5b04952b539e2c35f441963151 /plugins/org.eclipse.osee.framework.core.datastore
parent5258e6a1ace816ae2f9e057b22845fbd24562e08 (diff)
downloadorg.eclipse.osee-7803c382be2ab675c2f123fc2faa6416f5a0b5d6.tar.gz
org.eclipse.osee-7803c382be2ab675c2f123fc2faa6416f5a0b5d6.tar.xz
org.eclipse.osee-7803c382be2ab675c2f123fc2faa6416f5a0b5d6.zip
feature[ats_VVMH0]: Integrate branch management and core datastore into ORCS
Diffstat (limited to 'plugins/org.eclipse.osee.framework.core.datastore')
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/.classpath7
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/.pmd925
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/.project33
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/META-INF/MANIFEST.MF42
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/OSGI-INF/core.osee.schema.resource.xml7
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/build.properties6
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/BranchMoveOperation.java51
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/DatastoreInitOperation.java99
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/IOseeSchemaProvider.java22
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/IOseeSchemaResource.java24
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/OseeSchemaProvider.java46
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/SchemaCreationOptions.java50
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/AbstractDatabaseAccessor.java37
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/AbstractTypeDatabaseAccessor.java17
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/BranchStoreOperation.java147
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/BranchUpdateEventImpl.java140
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/DatabaseBranchAccessor.java177
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/DatabaseTransactionRecordAccessor.java179
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/IBranchUpdateEvent.java23
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/Activator.java34
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/ArtifactTypeDataAccessor.java152
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/CoreOseeSchemaResource.java40
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/ModelingServiceProvider.java8
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/OseeCachingServiceRegistrationHandler.java106
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/ServerOseeCachingServiceFactory.java92
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/AppliesToClause.java94
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ColumnDbData.java37
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ColumnMetadata.java92
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ConstraintElement.java147
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ConstraintFactory.java35
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ConstraintTypes.java38
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ForeignKey.java65
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/IndexElement.java134
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ReferenceClause.java165
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/SchemaData.java278
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/SchemaDataLookup.java46
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/SchemaXmlParser.java220
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/TableElement.java252
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/BackupTableDataOperation.java95
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/CreateSchemaOperation.java60
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/DatabaseDataExtractor.java253
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/DatabaseDataImporter.java255
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/ExtractDatabaseSchemaOperation.java478
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/FileUtility.java90
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/ImportDataFromDbServiceOperation.java185
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/LoadUserSchemasOperation.java152
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/OperationFactory.java45
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/PrintTables.java82
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/RestoreTableDataOperation.java100
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/FoxProDataType.java111
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/H2DataType.java112
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/H2SqlManager.java42
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/MySqlDataType.java112
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/MysqlSqlManager.java156
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/OracleSqlDataType.java124
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/OracleSqlManager.java80
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/PostgreSqlManager.java197
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/PostgresqlDataType.java112
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/SchemaSqlUtil.java114
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/SqlDataType.java193
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/SqlFactory.java53
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/SqlManager.java308
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/SqlManagerImpl.java68
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/support/SKYNET.VERSIONING.SCHEMA.xml640
64 files changed, 0 insertions, 8284 deletions
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/.classpath b/plugins/org.eclipse.osee.framework.core.datastore/.classpath
deleted file mode 100644
index ad32c83a78..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/.pmd b/plugins/org.eclipse.osee.framework.core.datastore/.pmd
deleted file mode 100644
index c7b0a9fb3f..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/.pmd
+++ /dev/null
@@ -1,925 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<pmd>
- <useProjectRuleSet>false</useProjectRuleSet>
- <ruleSetFile>.ruleset</ruleSetFile>
- <rules>
- <rule>
- <name>LooseCoupling</name>
- <ruleset>Type Resolution Rules</ruleset>
- </rule>
- <rule>
- <name>CloneMethodMustImplementCloneable</name>
- <ruleset>Type Resolution Rules</ruleset>
- </rule>
- <rule>
- <name>UnusedImports</name>
- <ruleset>Type Resolution Rules</ruleset>
- </rule>
- <rule>
- <name>SignatureDeclareThrowsException</name>
- <ruleset>Type Resolution Rules</ruleset>
- </rule>
- <rule>
- <name>IfStmtsMustUseBraces</name>
- <ruleset>Braces Rules</ruleset>
- </rule>
- <rule>
- <name>WhileLoopsMustUseBraces</name>
- <ruleset>Braces Rules</ruleset>
- </rule>
- <rule>
- <name>IfElseStmtsMustUseBraces</name>
- <ruleset>Braces Rules</ruleset>
- </rule>
- <rule>
- <name>ForLoopsMustUseBraces</name>
- <ruleset>Braces Rules</ruleset>
- </rule>
- <rule>
- <name>UseSingleton</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>SimplifyBooleanReturns</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>SimplifyBooleanExpressions</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>SwitchStmtsShouldHaveDefault</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>AvoidDeeplyNestedIfStmts</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>AvoidReassigningParameters</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>SwitchDensity</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>ConstructorCallsOverridableMethod</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>AccessorClassGeneration</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>FinalFieldCouldBeStatic</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>CloseResource</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>NonStaticInitializer</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>DefaultLabelNotLastInSwitchStmt</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>NonCaseLabelInSwitchStatement</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>OptimizableToArrayCall</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>BadComparison</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>EqualsNull</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>ConfusingTernary</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>InstantiationToGetClass</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>IdempotentOperations</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>SimpleDateFormatNeedsLocale</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>ImmutableField</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>UseLocaleWithCaseConversions</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>AvoidProtectedFieldInFinalClass</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>AssignmentToNonFinalStatic</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>MissingStaticMethodInNonInstantiatableClass</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>AvoidSynchronizedAtMethodLevel</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>MissingBreakInSwitch</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>UseNotifyAllInsteadOfNotify</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>AvoidInstanceofChecksInCatchClause</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>AbstractClassWithoutAbstractMethod</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>SimplifyConditional</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>CompareObjectsWithEquals</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>PositionLiteralsFirstInComparisons</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>UnnecessaryLocalBeforeReturn</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>NonThreadSafeSingleton</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>UncommentedEmptyMethod</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>UncommentedEmptyConstructor</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>AvoidConstantsInterface</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>UnsynchronizedStaticDateFormatter</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>PreserveStackTrace</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>UseCollectionIsEmpty</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>ClassWithOnlyPrivateConstructorsShouldBeFinal</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>EmptyMethodInAbstractClassShouldBeAbstract</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>SingularField</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>ReturnEmptyArrayRatherThanNull</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>AbstractClassWithoutAnyMethod</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>TooFewBranchesForASwitchStatement</name>
- <ruleset>Design Rules</ruleset>
- </rule>
- <rule>
- <name>AvoidCatchingThrowable</name>
- <ruleset>Strict Exception Rules</ruleset>
- </rule>
- <rule>
- <name>SignatureDeclareThrowsException</name>
- <ruleset>Type Resolution Rules</ruleset>
- </rule>
- <rule>
- <name>ExceptionAsFlowControl</name>
- <ruleset>Strict Exception Rules</ruleset>
- </rule>
- <rule>
- <name>AvoidCatchingNPE</name>
- <ruleset>Strict Exception Rules</ruleset>
- </rule>
- <rule>
- <name>AvoidThrowingRawExceptionTypes</name>
- <ruleset>Strict Exception Rules</ruleset>
- </rule>
- <rule>
- <name>AvoidThrowingNullPointerException</name>
- <ruleset>Strict Exception Rules</ruleset>
- </rule>
- <rule>
- <name>AvoidRethrowingException</name>
- <ruleset>Strict Exception Rules</ruleset>
- </rule>
- <rule>
- <name>DoNotExtendJavaLangError</name>
- <ruleset>Strict Exception Rules</ruleset>
- </rule>
- <rule>
- <name>DoNotThrowExceptionInFinally</name>
- <ruleset>Strict Exception Rules</ruleset>
- </rule>
- <rule>
- <name>AvoidThrowingNewInstanceOfSameException</name>
- <ruleset>Strict Exception Rules</ruleset>
- </rule>
- <rule>
- <name>UnusedPrivateField</name>
- <ruleset>Unused Code Rules</ruleset>
- </rule>
- <rule>
- <name>UnusedLocalVariable</name>
- <ruleset>Unused Code Rules</ruleset>
- </rule>
- <rule>
- <name>UnusedPrivateMethod</name>
- <ruleset>Unused Code Rules</ruleset>
- </rule>
- <rule>
- <name>UnusedFormalParameter</name>
- <ruleset>Unused Code Rules</ruleset>
- </rule>
- <rule>
- <name>MoreThanOneLogger</name>
- <ruleset>Java Logging Rules</ruleset>
- </rule>
- <rule>
- <name>LoggerIsNotStaticFinal</name>
- <ruleset>Java Logging Rules</ruleset>
- </rule>
- <rule>
- <name>SystemPrintln</name>
- <ruleset>Java Logging Rules</ruleset>
- </rule>
- <rule>
- <name>AvoidPrintStackTrace</name>
- <ruleset>Java Logging Rules</ruleset>
- </rule>
- <rule>
- <name>AvoidDuplicateLiterals</name>
- <ruleset>String and StringBuffer Rules</ruleset>
- </rule>
- <rule>
- <name>StringInstantiation</name>
- <ruleset>String and StringBuffer Rules</ruleset>
- </rule>
- <rule>
- <name>StringToString</name>
- <ruleset>String and StringBuffer Rules</ruleset>
- </rule>
- <rule>
- <name>InefficientStringBuffering</name>
- <ruleset>String and StringBuffer Rules</ruleset>
- </rule>
- <rule>
- <name>UnnecessaryCaseChange</name>
- <ruleset>String and StringBuffer Rules</ruleset>
- </rule>
- <rule>
- <name>UseStringBufferLength</name>
- <ruleset>String and StringBuffer Rules</ruleset>
- </rule>
- <rule>
- <name>AppendCharacterWithChar</name>
- <ruleset>String and StringBuffer Rules</ruleset>
- </rule>
- <rule>
- <name>ConsecutiveLiteralAppends</name>
- <ruleset>String and StringBuffer Rules</ruleset>
- </rule>
- <rule>
- <name>UseIndexOfChar</name>
- <ruleset>String and StringBuffer Rules</ruleset>
- </rule>
- <rule>
- <name>InefficientEmptyStringCheck</name>
- <ruleset>String and StringBuffer Rules</ruleset>
- </rule>
- <rule>
- <name>InsufficientStringBufferDeclaration</name>
- <ruleset>String and StringBuffer Rules</ruleset>
- </rule>
- <rule>
- <name>UselessStringValueOf</name>
- <ruleset>String and StringBuffer Rules</ruleset>
- </rule>
- <rule>
- <name>StringBufferInstantiationWithChar</name>
- <ruleset>String and StringBuffer Rules</ruleset>
- </rule>
- <rule>
- <name>UseEqualsToCompareStrings</name>
- <ruleset>String and StringBuffer Rules</ruleset>
- </rule>
- <rule>
- <name>AvoidStringBufferField</name>
- <ruleset>String and StringBuffer Rules</ruleset>
- </rule>
- <rule>
- <name>ReplaceVectorWithList</name>
- <ruleset>Migration Rules</ruleset>
- </rule>
- <rule>
- <name>ReplaceHashtableWithMap</name>
- <ruleset>Migration Rules</ruleset>
- </rule>
- <rule>
- <name>ReplaceEnumerationWithIterator</name>
- <ruleset>Migration Rules</ruleset>
- </rule>
- <rule>
- <name>AvoidEnumAsIdentifier</name>
- <ruleset>Migration Rules</ruleset>
- </rule>
- <rule>
- <name>AvoidAssertAsIdentifier</name>
- <ruleset>Migration Rules</ruleset>
- </rule>
- <rule>
- <name>IntegerInstantiation</name>
- <ruleset>Migration Rules</ruleset>
- </rule>
- <rule>
- <name>ByteInstantiation</name>
- <ruleset>Migration Rules</ruleset>
- </rule>
- <rule>
- <name>ShortInstantiation</name>
- <ruleset>Migration Rules</ruleset>
- </rule>
- <rule>
- <name>LongInstantiation</name>
- <ruleset>Migration Rules</ruleset>
- </rule>
- <rule>
- <name>JUnit4TestShouldUseBeforeAnnotation</name>
- <ruleset>Migration Rules</ruleset>
- </rule>
- <rule>
- <name>JUnit4TestShouldUseAfterAnnotation</name>
- <ruleset>Migration Rules</ruleset>
- </rule>
- <rule>
- <name>JUnit4TestShouldUseTestAnnotation</name>
- <ruleset>Migration Rules</ruleset>
- </rule>
- <rule>
- <name>JUnit4SuitesShouldUseSuiteAnnotation</name>
- <ruleset>Migration Rules</ruleset>
- </rule>
- <rule>
- <name>JUnitUseExpected</name>
- <ruleset>Migration Rules</ruleset>
- </rule>
- <rule>
- <name>UseProperClassLoader</name>
- <ruleset>J2EE Rules</ruleset>
- </rule>
- <rule>
- <name>MDBAndSessionBeanNamingConvention</name>
- <ruleset>J2EE Rules</ruleset>
- </rule>
- <rule>
- <name>RemoteSessionInterfaceNamingConvention</name>
- <ruleset>J2EE Rules</ruleset>
- </rule>
- <rule>
- <name>LocalInterfaceSessionNamingConvention</name>
- <ruleset>J2EE Rules</ruleset>
- </rule>
- <rule>
- <name>LocalHomeNamingConvention</name>
- <ruleset>J2EE Rules</ruleset>
- </rule>
- <rule>
- <name>RemoteInterfaceNamingConvention</name>
- <ruleset>J2EE Rules</ruleset>
- </rule>
- <rule>
- <name>DoNotCallSystemExit</name>
- <ruleset>J2EE Rules</ruleset>
- </rule>
- <rule>
- <name>StaticEJBFieldShouldBeFinal</name>
- <ruleset>J2EE Rules</ruleset>
- </rule>
- <rule>
- <name>DoNotUseThreads</name>
- <ruleset>J2EE Rules</ruleset>
- </rule>
- <rule>
- <name>AvoidInstantiatingObjectsInLoops</name>
- <ruleset>Optimization Rules</ruleset>
- </rule>
- <rule>
- <name>UseArrayListInsteadOfVector</name>
- <ruleset>Optimization Rules</ruleset>
- </rule>
- <rule>
- <name>SimplifyStartsWith</name>
- <ruleset>Optimization Rules</ruleset>
- </rule>
- <rule>
- <name>UseStringBufferForStringAppends</name>
- <ruleset>Optimization Rules</ruleset>
- </rule>
- <rule>
- <name>UseArraysAsList</name>
- <ruleset>Optimization Rules</ruleset>
- </rule>
- <rule>
- <name>AvoidArrayLoops</name>
- <ruleset>Optimization Rules</ruleset>
- </rule>
- <rule>
- <name>UnnecessaryWrapperObjectCreation</name>
- <ruleset>Optimization Rules</ruleset>
- </rule>
- <rule>
- <name>AddEmptyString</name>
- <ruleset>Optimization Rules</ruleset>
- </rule>
- <rule>
- <name>EmptyCatchBlock</name>
- <ruleset>Basic Rules</ruleset>
- </rule>
- <rule>
- <name>EmptyIfStmt</name>
- <ruleset>Basic Rules</ruleset>
- </rule>
- <rule>
- <name>EmptyWhileStmt</name>
- <ruleset>Basic Rules</ruleset>
- </rule>
- <rule>
- <name>EmptyTryBlock</name>
- <ruleset>Basic Rules</ruleset>
- </rule>
- <rule>
- <name>EmptyFinallyBlock</name>
- <ruleset>Basic Rules</ruleset>
- </rule>
- <rule>
- <name>EmptySwitchStatements</name>
- <ruleset>Basic Rules</ruleset>
- </rule>
- <rule>
- <name>JumbledIncrementer</name>
- <ruleset>Basic Rules</ruleset>
- </rule>
- <rule>
- <name>ForLoopShouldBeWhileLoop</name>
- <ruleset>Basic Rules</ruleset>
- </rule>
- <rule>
- <name>UnnecessaryConversionTemporary</name>
- <ruleset>Basic Rules</ruleset>
- </rule>
- <rule>
- <name>OverrideBothEqualsAndHashcode</name>
- <ruleset>Basic Rules</ruleset>
- </rule>
- <rule>
- <name>DoubleCheckedLocking</name>
- <ruleset>Basic Rules</ruleset>
- </rule>
- <rule>
- <name>ReturnFromFinallyBlock</name>
- <ruleset>Basic Rules</ruleset>
- </rule>
- <rule>
- <name>EmptySynchronizedBlock</name>
- <ruleset>Basic Rules</ruleset>
- </rule>
- <rule>
- <name>UnnecessaryReturn</name>
- <ruleset>Basic Rules</ruleset>
- </rule>
- <rule>
- <name>EmptyStaticInitializer</name>
- <ruleset>Basic Rules</ruleset>
- </rule>
- <rule>
- <name>UnconditionalIfStatement</name>
- <ruleset>Basic Rules</ruleset>
- </rule>
- <rule>
- <name>EmptyStatementNotInLoop</name>
- <ruleset>Basic Rules</ruleset>
- </rule>
- <rule>
- <name>BooleanInstantiation</name>
- <ruleset>Basic Rules</ruleset>
- </rule>
- <rule>
- <name>UnnecessaryFinalModifier</name>
- <ruleset>Basic Rules</ruleset>
- </rule>
- <rule>
- <name>CollapsibleIfStatements</name>
- <ruleset>Basic Rules</ruleset>
- </rule>
- <rule>
- <name>UselessOverridingMethod</name>
- <ruleset>Basic Rules</ruleset>
- </rule>
- <rule>
- <name>ClassCastExceptionWithToArray</name>
- <ruleset>Basic Rules</ruleset>
- </rule>
- <rule>
- <name>AvoidDecimalLiteralsInBigDecimalConstructor</name>
- <ruleset>Basic Rules</ruleset>
- </rule>
- <rule>
- <name>UselessOperationOnImmutable</name>
- <ruleset>Basic Rules</ruleset>
- </rule>
- <rule>
- <name>MisplacedNullCheck</name>
- <ruleset>Basic Rules</ruleset>
- </rule>
- <rule>
- <name>UnusedNullCheckInEquals</name>
- <ruleset>Basic Rules</ruleset>
- </rule>
- <rule>
- <name>AvoidThreadGroup</name>
- <ruleset>Basic Rules</ruleset>
- </rule>
- <rule>
- <name>BrokenNullCheck</name>
- <ruleset>Basic Rules</ruleset>
- </rule>
- <rule>
- <name>BigIntegerInstantiation</name>
- <ruleset>Basic Rules</ruleset>
- </rule>
- <rule>
- <name>AvoidUsingOctalValues</name>
- <ruleset>Basic Rules</ruleset>
- </rule>
- <rule>
- <name>AvoidUsingHardCodedIP</name>
- <ruleset>Basic Rules</ruleset>
- </rule>
- <rule>
- <name>CheckResultSet</name>
- <ruleset>Basic Rules</ruleset>
- </rule>
- <rule>
- <name>AvoidMultipleUnaryOperators</name>
- <ruleset>Basic Rules</ruleset>
- </rule>
- <rule>
- <name>EmptyInitializer</name>
- <ruleset>Basic Rules</ruleset>
- </rule>
- <rule>
- <name>MethodReturnsInternalArray</name>
- <ruleset>Security Code Guidelines</ruleset>
- </rule>
- <rule>
- <name>ArrayIsStoredDirectly</name>
- <ruleset>Security Code Guidelines</ruleset>
- </rule>
- <rule>
- <name>CouplingBetweenObjects</name>
- <ruleset>Coupling Rules</ruleset>
- </rule>
- <rule>
- <name>ExcessiveImports</name>
- <ruleset>Coupling Rules</ruleset>
- </rule>
- <rule>
- <name>LooseCoupling</name>
- <ruleset>Type Resolution Rules</ruleset>
- </rule>
- <rule>
- <name>DuplicateImports</name>
- <ruleset>Import Statement Rules</ruleset>
- </rule>
- <rule>
- <name>DontImportJavaLang</name>
- <ruleset>Import Statement Rules</ruleset>
- </rule>
- <rule>
- <name>UnusedImports</name>
- <ruleset>Type Resolution Rules</ruleset>
- </rule>
- <rule>
- <name>ImportFromSamePackage</name>
- <ruleset>Import Statement Rules</ruleset>
- </rule>
- <rule>
- <name>TooManyStaticImports</name>
- <ruleset>Import Statement Rules</ruleset>
- </rule>
- <rule>
- <name>JUnitStaticSuite</name>
- <ruleset>JUnit Rules</ruleset>
- </rule>
- <rule>
- <name>JUnitSpelling</name>
- <ruleset>JUnit Rules</ruleset>
- </rule>
- <rule>
- <name>JUnitAssertionsShouldIncludeMessage</name>
- <ruleset>JUnit Rules</ruleset>
- </rule>
- <rule>
- <name>JUnitTestsShouldIncludeAssert</name>
- <ruleset>JUnit Rules</ruleset>
- </rule>
- <rule>
- <name>TestClassWithoutTestCases</name>
- <ruleset>JUnit Rules</ruleset>
- </rule>
- <rule>
- <name>UnnecessaryBooleanAssertion</name>
- <ruleset>JUnit Rules</ruleset>
- </rule>
- <rule>
- <name>UseAssertEqualsInsteadOfAssertTrue</name>
- <ruleset>JUnit Rules</ruleset>
- </rule>
- <rule>
- <name>UseAssertSameInsteadOfAssertTrue</name>
- <ruleset>JUnit Rules</ruleset>
- </rule>
- <rule>
- <name>UseAssertNullInsteadOfAssertTrue</name>
- <ruleset>JUnit Rules</ruleset>
- </rule>
- <rule>
- <name>SimplifyBooleanAssertion</name>
- <ruleset>JUnit Rules</ruleset>
- </rule>
- <rule>
- <name>UnnecessaryConstructor</name>
- <ruleset>Controversial Rules</ruleset>
- </rule>
- <rule>
- <name>NullAssignment</name>
- <ruleset>Controversial Rules</ruleset>
- </rule>
- <rule>
- <name>UnusedModifier</name>
- <ruleset>Controversial Rules</ruleset>
- </rule>
- <rule>
- <name>AssignmentInOperand</name>
- <ruleset>Controversial Rules</ruleset>
- </rule>
- <rule>
- <name>AtLeastOneConstructor</name>
- <ruleset>Controversial Rules</ruleset>
- </rule>
- <rule>
- <name>DontImportSun</name>
- <ruleset>Controversial Rules</ruleset>
- </rule>
- <rule>
- <name>SuspiciousOctalEscape</name>
- <ruleset>Controversial Rules</ruleset>
- </rule>
- <rule>
- <name>CallSuperInConstructor</name>
- <ruleset>Controversial Rules</ruleset>
- </rule>
- <rule>
- <name>UnnecessaryParentheses</name>
- <ruleset>Controversial Rules</ruleset>
- </rule>
- <rule>
- <name>DefaultPackage</name>
- <ruleset>Controversial Rules</ruleset>
- </rule>
- <rule>
- <name>BooleanInversion</name>
- <ruleset>Controversial Rules</ruleset>
- </rule>
- <rule>
- <name>DataflowAnomalyAnalysis</name>
- <ruleset>Controversial Rules</ruleset>
- </rule>
- <rule>
- <name>AvoidFinalLocalVariable</name>
- <ruleset>Controversial Rules</ruleset>
- </rule>
- <rule>
- <name>AvoidUsingShortType</name>
- <ruleset>Controversial Rules</ruleset>
- </rule>
- <rule>
- <name>AvoidUsingVolatile</name>
- <ruleset>Controversial Rules</ruleset>
- </rule>
- <rule>
- <name>AvoidUsingNativeCode</name>
- <ruleset>Controversial Rules</ruleset>
- </rule>
- <rule>
- <name>AvoidAccessibilityAlteration</name>
- <ruleset>Controversial Rules</ruleset>
- </rule>
- <rule>
- <name>DoNotCallGarbageCollectionExplicitly</name>
- <ruleset>Controversial Rules</ruleset>
- </rule>
- <rule>
- <name>MethodNamingConventions</name>
- <ruleset>Naming Rules</ruleset>
- </rule>
- <rule>
- <name>ClassNamingConventions</name>
- <ruleset>Naming Rules</ruleset>
- </rule>
- <rule>
- <name>AbstractNaming</name>
- <ruleset>Naming Rules</ruleset>
- </rule>
- <rule>
- <name>AvoidDollarSigns</name>
- <ruleset>Naming Rules</ruleset>
- </rule>
- <rule>
- <name>MethodWithSameNameAsEnclosingClass</name>
- <ruleset>Naming Rules</ruleset>
- </rule>
- <rule>
- <name>SuspiciousHashcodeMethodName</name>
- <ruleset>Naming Rules</ruleset>
- </rule>
- <rule>
- <name>SuspiciousConstantFieldName</name>
- <ruleset>Naming Rules</ruleset>
- </rule>
- <rule>
- <name>SuspiciousEqualsMethodName</name>
- <ruleset>Naming Rules</ruleset>
- </rule>
- <rule>
- <name>AvoidFieldNameMatchingTypeName</name>
- <ruleset>Naming Rules</ruleset>
- </rule>
- <rule>
- <name>AvoidFieldNameMatchingMethodName</name>
- <ruleset>Naming Rules</ruleset>
- </rule>
- <rule>
- <name>NoPackage</name>
- <ruleset>Naming Rules</ruleset>
- </rule>
- <rule>
- <name>PackageCase</name>
- <ruleset>Naming Rules</ruleset>
- </rule>
- <rule>
- <name>MisleadingVariableName</name>
- <ruleset>Naming Rules</ruleset>
- </rule>
- <rule>
- <name>BooleanGetMethodName</name>
- <ruleset>Naming Rules</ruleset>
- </rule>
- <rule>
- <name>NPathComplexity</name>
- <ruleset>Code Size Rules</ruleset>
- </rule>
- <rule>
- <name>ExcessiveMethodLength</name>
- <ruleset>Code Size Rules</ruleset>
- </rule>
- <rule>
- <name>ExcessiveParameterList</name>
- <ruleset>Code Size Rules</ruleset>
- </rule>
- <rule>
- <name>ExcessiveClassLength</name>
- <ruleset>Code Size Rules</ruleset>
- </rule>
- <rule>
- <name>CyclomaticComplexity</name>
- <ruleset>Code Size Rules</ruleset>
- </rule>
- <rule>
- <name>ExcessivePublicCount</name>
- <ruleset>Code Size Rules</ruleset>
- </rule>
- <rule>
- <name>TooManyFields</name>
- <ruleset>Code Size Rules</ruleset>
- </rule>
- <rule>
- <name>NcssMethodCount</name>
- <ruleset>Code Size Rules</ruleset>
- </rule>
- <rule>
- <name>NcssTypeCount</name>
- <ruleset>Code Size Rules</ruleset>
- </rule>
- <rule>
- <name>NcssConstructorCount</name>
- <ruleset>Code Size Rules</ruleset>
- </rule>
- <rule>
- <name>TooManyMethods</name>
- <ruleset>Code Size Rules</ruleset>
- </rule>
- <rule>
- <name>EmptyFinalizer</name>
- <ruleset>Finalizer Rules</ruleset>
- </rule>
- <rule>
- <name>FinalizeOnlyCallsSuperFinalize</name>
- <ruleset>Finalizer Rules</ruleset>
- </rule>
- <rule>
- <name>FinalizeOverloaded</name>
- <ruleset>Finalizer Rules</ruleset>
- </rule>
- <rule>
- <name>FinalizeDoesNotCallSuperFinalize</name>
- <ruleset>Finalizer Rules</ruleset>
- </rule>
- <rule>
- <name>FinalizeShouldBeProtected</name>
- <ruleset>Finalizer Rules</ruleset>
- </rule>
- <rule>
- <name>AvoidCallingFinalize</name>
- <ruleset>Finalizer Rules</ruleset>
- </rule>
- <rule>
- <name>UseCorrectExceptionLogging</name>
- <ruleset>Jakarta Commons Logging Rules</ruleset>
- </rule>
- <rule>
- <name>ProperLogger</name>
- <ruleset>Jakarta Commons Logging Rules</ruleset>
- </rule>
- <rule>
- <name>MissingSerialVersionUID</name>
- <ruleset>JavaBean Rules</ruleset>
- </rule>
- <rule>
- <name>ProperCloneImplementation</name>
- <ruleset>Clone Implementation Rules</ruleset>
- </rule>
- <rule>
- <name>CloneThrowsCloneNotSupportedException</name>
- <ruleset>Clone Implementation Rules</ruleset>
- </rule>
- <rule>
- <name>CloneMethodMustImplementCloneable</name>
- <ruleset>Type Resolution Rules</ruleset>
- </rule>
- </rules>
- <includeDerivedFiles>false</includeDerivedFiles>
- <violationsAsErrors>true</violationsAsErrors>
-</pmd>
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/.project b/plugins/org.eclipse.osee.framework.core.datastore/.project
deleted file mode 100644
index fa4346eca8..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/.project
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.osee.framework.core.datastore</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ds.core.builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.core.datastore/META-INF/MANIFEST.MF
deleted file mode 100644
index 493fdcd269..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,42 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: OSEE Core Datastore
-Bundle-SymbolicName: org.eclipse.osee.framework.core.datastore;singleton:=true
-Bundle-Version: 0.9.9.qualifier
-Bundle-Activator: org.eclipse.osee.framework.core.datastore.internal.Activator
-Bundle-Vendor: Eclipse Open System Engineering Environment
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Import-Package: org.apache.commons.lang,
- org.apache.commons.lang.builder,
- org.eclipse.core.runtime,
- org.eclipse.core.runtime.jobs,
- org.eclipse.osee.framework.branch.management,
- org.eclipse.osee.framework.core.data,
- org.eclipse.osee.framework.core.enums,
- org.eclipse.osee.framework.core.exception,
- org.eclipse.osee.framework.core.message,
- org.eclipse.osee.framework.core.model,
- org.eclipse.osee.framework.core.model.cache,
- org.eclipse.osee.framework.core.model.type,
- org.eclipse.osee.framework.core.operation,
- org.eclipse.osee.framework.core.server,
- org.eclipse.osee.framework.core.services,
- org.eclipse.osee.framework.core.translation,
- org.eclipse.osee.framework.core.util,
- org.eclipse.osee.framework.database,
- org.eclipse.osee.framework.database.core,
- org.eclipse.osee.framework.database.operation,
- org.eclipse.osee.framework.jdk.core.persistence,
- org.eclipse.osee.framework.jdk.core.type,
- org.eclipse.osee.framework.jdk.core.util,
- org.eclipse.osee.framework.jdk.core.util.time,
- org.eclipse.osee.framework.jdk.core.util.xml,
- org.eclipse.osee.framework.logging,
- org.eclipse.osee.framework.resource.management,
- org.eclipse.osee.logger,
- org.osgi.framework,
- org.osgi.util.tracker
-Bundle-ActivationPolicy: lazy
-Eclipse-ExtensibleAPI: true
-Export-Package: org.eclipse.osee.framework.core.datastore
-Service-Component: OSGI-INF/core.osee.schema.resource.xml
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/OSGI-INF/core.osee.schema.resource.xml b/plugins/org.eclipse.osee.framework.core.datastore/OSGI-INF/core.osee.schema.resource.xml
deleted file mode 100644
index e16e3dfa67..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/OSGI-INF/core.osee.schema.resource.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0"?>
-<component name="core.osee.schema.resource" immediate="true" >
- <implementation class="org.eclipse.osee.framework.core.datastore.internal.CoreOseeSchemaResource"/>
- <service>
- <provide interface="org.eclipse.osee.framework.core.datastore.IOseeSchemaResource"/>
- </service>
-</component>
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/build.properties b/plugins/org.eclipse.osee.framework.core.datastore/build.properties
deleted file mode 100644
index 83eb93c180..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/build.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- OSGI-INF/,\
- support/
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/BranchMoveOperation.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/BranchMoveOperation.java
deleted file mode 100644
index 86311c27bb..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/BranchMoveOperation.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.core.datastore.internal.Activator;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.database.IOseeDatabaseService;
-import org.eclipse.osee.framework.database.core.AbstractDbTxOperation;
-import org.eclipse.osee.framework.database.core.OseeConnection;
-
-/**
- * @author Ryan D. Brooks
- */
-public class BranchMoveOperation extends AbstractDbTxOperation {
-
- private static final String INSERT_ADDRESSING =
- "insert into %s (transaction_id, gamma_id, tx_current, mod_type, branch_id) select transaction_id, gamma_id, tx_current, mod_type, branch_id from %s where branch_id = ?";
-
- public static final String DELETE_ADDRESSING = "delete from %s where branch_id = ?";
- private final boolean archive;
- private final Branch branch;
-
- public BranchMoveOperation(IOseeDatabaseService databaseService, boolean archive, Branch branch) {
- super(databaseService, "Branch Move", Activator.PLUGIN_ID);
- this.archive = archive;
- this.branch = branch;
- }
-
- @Override
- protected void doTxWork(IProgressMonitor monitor, OseeConnection connection) throws OseeCoreException {
- String sourceTableName = archive ? "osee_txs" : "osee_txs_archived";
- String destinationTableName = archive ? "osee_txs_archived" : "osee_txs";
-
- String sql = String.format(INSERT_ADDRESSING, destinationTableName, sourceTableName);
- getDatabaseService().runPreparedUpdate(connection, sql, branch.getId());
-
- sql = String.format(DELETE_ADDRESSING, sourceTableName);
- getDatabaseService().runPreparedUpdate(connection, sql, branch.getId());
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/DatastoreInitOperation.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/DatastoreInitOperation.java
deleted file mode 100644
index 72c52992af..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/DatastoreInitOperation.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore;
-
-import java.io.File;
-import java.util.logging.Level;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.branch.management.IOseeBranchService;
-import org.eclipse.osee.framework.core.datastore.internal.Activator;
-import org.eclipse.osee.framework.core.datastore.schema.operations.OperationFactory;
-import org.eclipse.osee.framework.core.enums.PermissionEnum;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.operation.AbstractOperation;
-import org.eclipse.osee.framework.core.operation.IOperation;
-import org.eclipse.osee.framework.core.server.IApplicationServerManager;
-import org.eclipse.osee.framework.core.server.OseeServerProperties;
-import org.eclipse.osee.framework.core.services.IOseeCachingService;
-import org.eclipse.osee.framework.core.services.IdentityService;
-import org.eclipse.osee.framework.core.util.Conditions;
-import org.eclipse.osee.framework.database.IOseeDatabaseService;
-import org.eclipse.osee.framework.database.core.OseeInfo;
-import org.eclipse.osee.framework.jdk.core.util.GUID;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.logging.OseeLog;
-
-/**
- * @author Roberto E. Escobar
- */
-public class DatastoreInitOperation extends AbstractOperation {
-
- private static final String ADD_PERMISSION =
- "INSERT INTO OSEE_PERMISSION (PERMISSION_ID, PERMISSION_NAME) VALUES (?,?)";
-
- private final IOseeCachingService cachingService;
- private final IOseeBranchService branchService;
- private final IOseeDatabaseService dbService;
- private final IOseeSchemaProvider schemaProvider;
- private final SchemaCreationOptions options;
- private final IApplicationServerManager appServerManager;
- private final IdentityService identityService;
-
- public DatastoreInitOperation(IApplicationServerManager appServerManager, IOseeDatabaseService dbService, IOseeCachingService cachingService, IOseeBranchService branchService, IOseeSchemaProvider schemaProvider, SchemaCreationOptions options, IdentityService identityService) {
- super("Datastore Initialization", Activator.PLUGIN_ID);
- this.appServerManager = appServerManager;
- this.dbService = dbService;
- this.cachingService = cachingService;
- this.branchService = branchService;
- this.schemaProvider = schemaProvider;
- this.options = options;
- this.identityService = identityService;
- }
-
- @Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
- Conditions.checkExpressionFailOnTrue(dbService.isProduction(),
- "Error - attempting to initialize a production datastore.");
-
- IOperation subOp = OperationFactory.createDbSchema(dbService, schemaProvider, options);
- doSubWork(subOp, monitor, 0.30);
-
- dbService.getSequence().clear();
- identityService.clear();
-
- appServerManager.executeLookupRegistration();
-
- deleteBinaryBackingData();
- String binaryDataPath = OseeServerProperties.getOseeApplicationServerData(null);
- Lib.deleteDir(new File(binaryDataPath + File.separator + "attr"));
-
- OseeInfo.putValue(OseeInfo.DB_ID_KEY, GUID.create());
- addDefaultPermissions();
-
- // cachingService.clearAll();
-
- subOp = branchService.createSystemRootBranch(monitor);
- doSubWork(subOp, monitor, 0.30);
- }
-
- @SuppressWarnings("unchecked")
- private void addDefaultPermissions() throws OseeCoreException {
- for (PermissionEnum permission : PermissionEnum.values()) {
- dbService.runPreparedUpdate(ADD_PERMISSION, permission.getPermId(), permission.getName());
- }
- }
-
- private static void deleteBinaryBackingData() {
- String binaryDataPath = OseeServerProperties.getOseeApplicationServerData(null);
- OseeLog.logf(Activator.class, Level.INFO, "Deleting application server binary data [%s]...", binaryDataPath);
- Lib.deleteDir(new File(binaryDataPath + File.separator + "attr"));
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/IOseeSchemaProvider.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/IOseeSchemaProvider.java
deleted file mode 100644
index 7ffb669d55..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/IOseeSchemaProvider.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore;
-
-import java.util.Collection;
-
-/**
- * @author Roberto E. Escobar
- */
-public interface IOseeSchemaProvider {
-
- Collection<IOseeSchemaResource> getSchemaResources();
-
-}
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
deleted file mode 100644
index 9371e0099a..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/IOseeSchemaResource.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore;
-
-import java.io.InputStream;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-
-/**
- * @author Roberto E. Escobar
- */
-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
deleted file mode 100644
index 1898ce7ab2..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/OseeSchemaProvider.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import org.eclipse.core.runtime.Platform;
-import org.osgi.framework.Bundle;
-import org.osgi.util.tracker.ServiceTracker;
-
-/**
- * @author Roberto E. Escobar
- */
-public class OseeSchemaProvider implements IOseeSchemaProvider {
-
- @Override
- public Collection<IOseeSchemaResource> getSchemaResources() {
- Collection<IOseeSchemaResource> providers = new ArrayList<IOseeSchemaResource>();
-
- Bundle bundle = Platform.getBundle("org.eclipse.osee.framework.core.datastore");
- ServiceTracker serviceTracker =
- new ServiceTracker(bundle.getBundleContext(), IOseeSchemaResource.class.getName(), null);
- serviceTracker.open(true);
- Object[] services = serviceTracker.getServices();
- if (services != null) {
- for (Object object : services) {
- if (object instanceof IOseeSchemaResource) {
- IOseeSchemaResource resource = (IOseeSchemaResource) object;
- if (resource.isApplicable()) {
- providers.add(resource);
- }
- }
- }
- }
- serviceTracker.close();
- return providers;
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/SchemaCreationOptions.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/SchemaCreationOptions.java
deleted file mode 100644
index 962ef9baa5..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/SchemaCreationOptions.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore;
-
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-
-/**
- * @author Roberto E. Escobar
- */
-public class SchemaCreationOptions {
-
- private final String tableDataSpace;
- private final String indexDataSpace;
- private final boolean useFileSpecifiedSchemas;
-
- public SchemaCreationOptions(String tableDataSpace, String indexDataSpace, boolean useFileSpecifiedSchemas) {
- super();
- this.tableDataSpace = tableDataSpace;
- this.indexDataSpace = indexDataSpace;
- this.useFileSpecifiedSchemas = useFileSpecifiedSchemas;
- }
-
- public String getTableDataSpace() {
- return tableDataSpace;
- }
-
- public String getIndexDataSpace() {
- return indexDataSpace;
- }
-
- public boolean isUseFileSpecifiedSchemas() {
- return useFileSpecifiedSchemas;
- }
-
- public boolean isIndexDataSpaceValid() {
- return Strings.isValid(getIndexDataSpace());
- }
-
- public boolean isTableDataSpaceValid() {
- return Strings.isValid(getTableDataSpace());
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/AbstractDatabaseAccessor.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/AbstractDatabaseAccessor.java
deleted file mode 100644
index 1804f4d43b..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/AbstractDatabaseAccessor.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.cache;
-
-import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
-import org.eclipse.osee.framework.core.model.IOseeStorable;
-import org.eclipse.osee.framework.core.model.cache.IOseeDataAccessor;
-import org.eclipse.osee.framework.database.IOseeDatabaseService;
-import org.eclipse.osee.framework.database.core.IOseeSequence;
-
-/**
- * @author Roberto E. Escobar
- */
-public abstract class AbstractDatabaseAccessor<K, T extends IOseeStorable> implements IOseeDataAccessor<K, T> {
-
- private final IOseeDatabaseService databaseService;
-
- protected AbstractDatabaseAccessor(IOseeDatabaseService databaseService) {
- this.databaseService = databaseService;
- }
-
- protected IOseeDatabaseService getDatabaseService() {
- return databaseService;
- }
-
- protected IOseeSequence getSequence() throws OseeDataStoreException {
- return getDatabaseService().getSequence();
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/AbstractTypeDatabaseAccessor.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/AbstractTypeDatabaseAccessor.java
deleted file mode 100644
index 4381b6ddfb..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/AbstractTypeDatabaseAccessor.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * Created on Aug 19, 2011
- *
- * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
- */
-package org.eclipse.osee.framework.core.datastore.cache;
-
-import org.eclipse.osee.framework.core.model.IOseeStorable;
-import org.eclipse.osee.framework.database.IOseeDatabaseService;
-
-public abstract class AbstractTypeDatabaseAccessor<T extends IOseeStorable> extends AbstractDatabaseAccessor<String, T> {
-
- protected AbstractTypeDatabaseAccessor(IOseeDatabaseService databaseService) {
- super(databaseService);
- }
-
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/BranchStoreOperation.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/BranchStoreOperation.java
deleted file mode 100644
index 142ee213b4..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/BranchStoreOperation.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.cache;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.core.datastore.BranchMoveOperation;
-import org.eclipse.osee.framework.core.datastore.internal.Activator;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.AbstractOseeType;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.BranchField;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
-import org.eclipse.osee.framework.core.operation.Operations;
-import org.eclipse.osee.framework.database.IOseeDatabaseService;
-import org.eclipse.osee.framework.database.core.AbstractDbTxOperation;
-import org.eclipse.osee.framework.database.core.OseeConnection;
-import org.eclipse.osee.framework.logging.OseeLog;
-
-/**
- * @author Ryan D. Brooks
- */
-public class BranchStoreOperation extends AbstractDbTxOperation {
- protected static final int NULL_PARENT_BRANCH_ID = -1;
-
- private static final String INSERT_BRANCH =
- "INSERT INTO osee_branch (branch_id, branch_guid, branch_name, parent_branch_id, parent_transaction_id, archived, associated_art_id, branch_type, branch_state, baseline_transaction_id) VALUES (?,?,?,?,?,?,?,?,?,?)";
-
- private static final String UPDATE_BRANCH =
- "update osee_branch SET branch_name = ?, parent_branch_id = ?, parent_transaction_id = ?, archived = ?, associated_art_id = ?, branch_type = ?, branch_state = ?, baseline_transaction_id = ? where branch_id = ?";
-
- private static final String DELETE_BRANCH = "DELETE from osee_branch where branch_id = ?";
-
- private final IBranchUpdateEvent eventSender;
- private final Collection<Branch> branches;
-
- public BranchStoreOperation(IOseeDatabaseService databaseService, IBranchUpdateEvent eventSender, Collection<Branch> branches) {
- super(databaseService, "Branch Archive Operation", Activator.PLUGIN_ID);
- this.eventSender = eventSender;
- this.branches = branches;
- }
-
- private Object[] toInsertValues(Branch branch) throws OseeCoreException {
- Branch parentBranch = branch.getParentBranch();
- TransactionRecord baseTxRecord = branch.getBaseTransaction();
- int parentBranchId = parentBranch != null ? parentBranch.getId() : NULL_PARENT_BRANCH_ID;
- int baselineTransaction = baseTxRecord != null ? baseTxRecord.getId() : NULL_PARENT_BRANCH_ID;
-
- return new Object[] {
- branch.getId(),
- branch.getGuid(),
- branch.getName(),
- parentBranchId,
- branch.getSourceTransaction().getId(),
- branch.getArchiveState().getValue(),
- branch.getAssociatedArtifactId(),
- branch.getBranchType().getValue(),
- branch.getBranchState().getValue(),
- baselineTransaction};
- }
-
- private Object[] toUpdateValues(Branch branch) throws OseeCoreException {
- Branch parentBranch = branch.getParentBranch();
- TransactionRecord baseTxRecord = branch.getBaseTransaction();
- int parentBranchId = parentBranch != null ? parentBranch.getId() : NULL_PARENT_BRANCH_ID;
- int baselineTransaction = baseTxRecord != null ? baseTxRecord.getId() : NULL_PARENT_BRANCH_ID;
- return new Object[] {
- branch.getName(),
- parentBranchId,
- branch.getSourceTransaction().getId(),
- branch.getArchiveState().getValue(),
- branch.getAssociatedArtifactId(),
- branch.getBranchType().getValue(),
- branch.getBranchState().getValue(),
- baselineTransaction,
- branch.getId()};
- }
-
- private Object[] toDeleteValues(Branch branch) {
- return new Object[] {branch.getId()};
- }
-
- @Override
- protected void doTxWork(IProgressMonitor monitor, OseeConnection connection) throws OseeCoreException {
- List<Object[]> insertData = new ArrayList<Object[]>();
- List<Object[]> updateData = new ArrayList<Object[]>();
- List<Object[]> deleteData = new ArrayList<Object[]>();
-
- for (Branch branch : branches) {
- if (isDataDirty(branch)) {
- switch (branch.getStorageState()) {
- case CREATED:
- branch.setId(getDatabaseService().getSequence().getNextBranchId());
- insertData.add(toInsertValues(branch));
- break;
- case MODIFIED:
- updateData.add(toUpdateValues(branch));
- break;
- case PURGED:
- deleteData.add(toDeleteValues(branch));
- break;
- default:
- break;
- }
- }
- if (branch.isFieldDirty(BranchField.BRANCH_ARCHIVED_STATE_FIELD_KEY)) {
- Operations.executeAsJob(new BranchMoveOperation(getDatabaseService(),
- branch.getArchiveState().isArchived(), branch), false);
- }
-
- }
- getDatabaseService().runBatchUpdate(connection, INSERT_BRANCH, insertData);
- getDatabaseService().runBatchUpdate(connection, UPDATE_BRANCH, updateData);
- getDatabaseService().runBatchUpdate(connection, DELETE_BRANCH, deleteData);
-
- for (Branch branch : branches) {
- branch.clearDirty();
- }
- try {
- eventSender.send(branches);
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, "Error creating branch update relay", ex);
- }
- }
-
- private boolean isDataDirty(Branch type) throws OseeCoreException {
- return type.areFieldsDirty(//
- AbstractOseeType.NAME_FIELD_KEY, //
- AbstractOseeType.UNIQUE_ID_FIELD_KEY, //
- BranchField.BRANCH_ARCHIVED_STATE_FIELD_KEY, //
- BranchField.BRANCH_STATE_FIELD_KEY, //
- BranchField.BRANCH_TYPE_FIELD_KEY, //
- BranchField.BRANCH_ASSOCIATED_ARTIFACT_ID_FIELD_KEY, //
- BranchField.BRANCH_BASE_TRANSACTION);
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/BranchUpdateEventImpl.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/BranchUpdateEventImpl.java
deleted file mode 100644
index aac3570e5f..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/BranchUpdateEventImpl.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.cache;
-
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Level;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.core.data.OseeServerContext;
-import org.eclipse.osee.framework.core.data.OseeServerInfo;
-import org.eclipse.osee.framework.core.datastore.internal.Activator;
-import org.eclipse.osee.framework.core.enums.CacheOperation;
-import org.eclipse.osee.framework.core.enums.CoreTranslatorId;
-import org.eclipse.osee.framework.core.enums.StorageState;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.message.BranchCacheStoreRequest;
-import org.eclipse.osee.framework.core.message.BranchRow;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.operation.AbstractOperation;
-import org.eclipse.osee.framework.core.operation.Operations;
-import org.eclipse.osee.framework.core.server.IApplicationServerLookup;
-import org.eclipse.osee.framework.core.server.IApplicationServerManager;
-import org.eclipse.osee.framework.core.translation.IDataTranslationService;
-import org.eclipse.osee.framework.core.util.HttpMessage;
-import org.eclipse.osee.framework.core.util.HttpProcessor.AcquireResult;
-import org.eclipse.osee.framework.jdk.core.util.HttpUrlBuilder;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.logging.OseeLog;
-
-/**
- * @author Roberto E. Escobar
- */
-public class BranchUpdateEventImpl implements IBranchUpdateEvent {
-
- private final IDataTranslationService translationService;
- private final IApplicationServerLookup lookupService;
- private final IApplicationServerManager manager;
-
- public BranchUpdateEventImpl(IDataTranslationService translationService, IApplicationServerManager manager, IApplicationServerLookup lookUpProvider) {
- super();
- this.translationService = translationService;
- this.lookupService = lookUpProvider;
- this.manager = manager;
- }
-
- @Override
- public void send(final Collection<Branch> branches) {
- List<Branch> branchToUpdate = new ArrayList<Branch>();
- for (Branch branch : branches) {
- if (!branch.isDirty()) {
- branchToUpdate.add(branch);
- }
- }
- Operations.executeAsJob(new ServerSyncOperation(branchToUpdate), false);
- }
-
- private final class ServerSyncOperation extends AbstractOperation {
-
- private final Collection<Branch> branches;
-
- public ServerSyncOperation(Collection<Branch> branches) {
- super("Server Sync", Activator.PLUGIN_ID);
- this.branches = branches;
- }
-
- private boolean is_0_9_2_Compatible(String... versions) {
- for (String version : versions) {
- if (Strings.isValid(version)) {
- String toCheck = version.toLowerCase();
- if (!toCheck.startsWith("0.9.0") && !toCheck.startsWith("0.9.1")) {
- return true;
- }
- }
- }
- return false;
- }
-
- private StorageState getCompatibleState(StorageState state) {
- StorageState toReturn = state;
- if (state == StorageState.PURGED) {
- toReturn = StorageState.DELETED;
- } else if (state == StorageState.LOADED) {
- toReturn = StorageState.MODIFIED;
- }
- return toReturn;
- }
-
- @Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
- BranchCacheStoreRequest request = BranchCacheStoreRequest.fromCache(branches);
- request.setServerUpdateMessage(true);
-
- BranchCacheStoreRequest request0_9_1 = BranchCacheStoreRequest.fromCache(branches);
- request0_9_1.setServerUpdateMessage(true);
- for (BranchRow row : request0_9_1.getBranchRows()) {
- row.setStorageState(getCompatibleState(row.getStorageState()));
- }
-
- Map<String, String> parameters = new HashMap<String, String>();
- parameters.put("function", CacheOperation.STORE.name());
-
- for (OseeServerInfo serverInfo : lookupService.getAvailableServers()) {
- if (!manager.getId().equals(serverInfo.getServerId()) && serverInfo.isAcceptingRequests()) {
- try {
-
- String urlString =
- HttpUrlBuilder.createURL(serverInfo.getServerAddress(), serverInfo.getPort(),
- OseeServerContext.CACHE_CONTEXT, parameters);
-
- BranchCacheStoreRequest message =
- is_0_9_2_Compatible(serverInfo.getVersion()) ? request : request0_9_1;
-
- AcquireResult updateResponse =
- HttpMessage.send(urlString, translationService, CoreTranslatorId.BRANCH_CACHE_STORE_REQUEST,
- message, null);
- if (!updateResponse.wasSuccessful()) {
- OseeLog.log(Activator.class, Level.SEVERE, "Error relaying branch updates to servers");
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, "Error relaying branch updates to servers", ex);
- } catch (UnsupportedEncodingException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, "Error relaying branch updates to servers", ex);
- }
- }
- }
- }
- };
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/DatabaseBranchAccessor.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/DatabaseBranchAccessor.java
deleted file mode 100644
index 0b1e93fe32..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/DatabaseBranchAccessor.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.cache;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.logging.Level;
-import org.eclipse.osee.framework.core.datastore.internal.Activator;
-import org.eclipse.osee.framework.core.enums.BranchArchivedState;
-import org.eclipse.osee.framework.core.enums.BranchState;
-import org.eclipse.osee.framework.core.enums.BranchType;
-import org.eclipse.osee.framework.core.enums.StorageState;
-import org.eclipse.osee.framework.core.exception.BranchDoesNotExist;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.BranchFactory;
-import org.eclipse.osee.framework.core.model.MergeBranch;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
-import org.eclipse.osee.framework.core.model.cache.BranchCache;
-import org.eclipse.osee.framework.core.model.cache.IOseeCache;
-import org.eclipse.osee.framework.core.model.cache.TransactionCache;
-import org.eclipse.osee.framework.core.operation.Operations;
-import org.eclipse.osee.framework.database.IOseeDatabaseService;
-import org.eclipse.osee.framework.database.core.IOseeStatement;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.logging.OseeLog;
-
-/**
- * @author Roberto E. Escobar
- */
-public class DatabaseBranchAccessor extends AbstractDatabaseAccessor<String, Branch> {
-
- private static final String SELECT_BRANCHES = "SELECT * FROM osee_branch";
- private static final String SELECT_MERGE_BRANCHES = "SELECT * FROM osee_merge";
-
- private final TransactionCache txCache;
- private final IBranchUpdateEvent eventSender;
- private final BranchFactory branchFactory;
-
- public DatabaseBranchAccessor(IOseeDatabaseService databaseService, IBranchUpdateEvent eventSender, TransactionCache txCache, BranchFactory branchFactory) {
- super(databaseService);
- this.txCache = txCache;
- this.eventSender = eventSender;
- this.branchFactory = branchFactory;
- }
-
- @Override
- public void load(IOseeCache<String, Branch> cache) throws OseeCoreException {
- long startTime = System.currentTimeMillis();
- Map<Branch, Integer> childToParent = new HashMap<Branch, Integer>();
- Map<Branch, Integer> branchToBaseTx = new HashMap<Branch, Integer>();
- Map<Branch, Integer> branchToSourceTx = new HashMap<Branch, Integer>();
- Map<Branch, Integer> associatedArtifact = new HashMap<Branch, Integer>();
-
- BranchCache brCache = (BranchCache) cache;
- loadBranches(brCache, childToParent, branchToBaseTx, branchToSourceTx, associatedArtifact);
- loadBranchHierarchy(brCache, childToParent);
- loadMergeBranches(brCache);
- loadAssociatedArtifacts(brCache, associatedArtifact);
- loadBranchRelatedTransactions(brCache, branchToBaseTx, branchToSourceTx);
-
- for (Branch branch : cache.getAll()) {
- branch.clearDirty();
- }
- OseeLog.logf(Activator.class, Level.INFO, "Branch Cache loaded [%s]", Lib.getElapseString(startTime));
- }
-
- private void loadBranches(BranchCache cache, Map<Branch, Integer> childToParent, Map<Branch, Integer> branchToBaseTx, Map<Branch, Integer> branchToSourceTx, Map<Branch, Integer> associatedArtifact) throws OseeCoreException {
- IOseeStatement chStmt = getDatabaseService().getStatement();
- try {
- chStmt.runPreparedQuery(2000, SELECT_BRANCHES);
- while (chStmt.next()) {
- try {
- int branchId = chStmt.getInt("branch_id");
-
- String branchName = chStmt.getString("branch_name");
- BranchState branchState = BranchState.getBranchState(chStmt.getInt("branch_state"));
- BranchType branchType = BranchType.valueOf(chStmt.getInt("branch_type"));
- boolean isArchived = BranchArchivedState.valueOf(chStmt.getInt("archived")).isArchived();
- String branchGuid = chStmt.getString("branch_guid");
- Branch branch =
- branchFactory.createOrUpdate(cache, branchId, StorageState.LOADED, branchGuid, branchName,
- branchType, branchState, isArchived);
-
- Integer parentBranchId = chStmt.getInt("parent_branch_id");
- if (parentBranchId != BranchStoreOperation.NULL_PARENT_BRANCH_ID) {
- childToParent.put(branch, parentBranchId);
- }
- branchToSourceTx.put(branch, chStmt.getInt("parent_transaction_id"));
- branchToBaseTx.put(branch, chStmt.getInt("baseline_transaction_id"));
- associatedArtifact.put(branch, chStmt.getInt("associated_art_id"));
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- }
- } finally {
- chStmt.close();
- }
- }
-
- private void loadAssociatedArtifacts(BranchCache cache, Map<Branch, Integer> associatedArtifact) throws OseeCoreException {
- for (Entry<Branch, Integer> entry : associatedArtifact.entrySet()) {
- Branch branch = entry.getKey();
- branch.setAssociatedArtifactId(entry.getValue());
- }
- }
-
- private void loadBranchRelatedTransactions(BranchCache cache, Map<Branch, Integer> branchToBaseTx, Map<Branch, Integer> branchToSourceTx) throws OseeCoreException {
- Set<Integer> transactionIds = new HashSet<Integer>();
- transactionIds.addAll(branchToSourceTx.values());
- transactionIds.addAll(branchToBaseTx.values());
- txCache.loadTransactions(transactionIds);
-
- for (Entry<Branch, Integer> entry : branchToBaseTx.entrySet()) {
- Branch branch = entry.getKey();
- if (branch.getBaseTransaction() == null) {
- TransactionRecord baseTx = txCache.getById(entry.getValue());
- branch.setBaseTransaction(baseTx);
- }
- }
-
- for (Entry<Branch, Integer> entry : branchToSourceTx.entrySet()) {
- Branch branch = entry.getKey();
- if (branch.getSourceTransaction() == null) {
- TransactionRecord srcTx = txCache.getById(entry.getValue());
- branch.setSourceTransaction(srcTx);
- }
- }
- }
-
- private void loadBranchHierarchy(BranchCache branchCache, Map<Branch, Integer> childToParent) throws OseeCoreException {
- for (Entry<Branch, Integer> entry : childToParent.entrySet()) {
- Branch childBranch = entry.getKey();
- Branch parentBranch = branchCache.getById(entry.getValue());
- if (parentBranch == null) {
- throw new BranchDoesNotExist("Parent Branch id:[%s] does not exist for child branch [%s]",
- entry.getValue(), entry.getKey());
- }
- childBranch.setParentBranch(parentBranch);
- }
- }
-
- private void loadMergeBranches(BranchCache branchCache) throws OseeCoreException {
- IOseeStatement chStmt = getDatabaseService().getStatement();
- try {
- chStmt.runPreparedQuery(1000, SELECT_MERGE_BRANCHES);
- while (chStmt.next()) {
- Branch sourceBranch = branchCache.getById(chStmt.getInt("source_branch_id"));
- Branch destBranch = branchCache.getById(chStmt.getInt("dest_branch_id"));
-
- MergeBranch mergeBranch = (MergeBranch) branchCache.getById(chStmt.getInt("merge_branch_id"));
- mergeBranch.setSourceBranch(sourceBranch);
- mergeBranch.setDestinationBranch(destBranch);
- }
- } finally {
- chStmt.close();
- }
-
- }
-
- @Override
- public void store(Collection<Branch> branches) throws OseeCoreException {
- Operations.executeWorkAndCheckStatus(new BranchStoreOperation(getDatabaseService(), eventSender, branches));
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/DatabaseTransactionRecordAccessor.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/DatabaseTransactionRecordAccessor.java
deleted file mode 100644
index feef2a63a7..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/DatabaseTransactionRecordAccessor.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.cache;
-
-import java.util.Collection;
-import java.util.Date;
-import org.eclipse.osee.framework.core.enums.TransactionDetailsType;
-import org.eclipse.osee.framework.core.enums.TransactionVersion;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeStateException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
-import org.eclipse.osee.framework.core.model.TransactionRecordFactory;
-import org.eclipse.osee.framework.core.model.cache.BranchCache;
-import org.eclipse.osee.framework.core.model.cache.ITransactionDataAccessor;
-import org.eclipse.osee.framework.core.model.cache.TransactionCache;
-import org.eclipse.osee.framework.database.IOseeDatabaseService;
-import org.eclipse.osee.framework.database.core.IOseeStatement;
-import org.eclipse.osee.framework.database.core.IdJoinQuery;
-import org.eclipse.osee.framework.database.core.JoinUtility;
-import org.eclipse.osee.framework.jdk.core.type.MutableInteger;
-
-/**
- * @author Roberto E. Escobar
- */
-public class DatabaseTransactionRecordAccessor implements ITransactionDataAccessor {
-
- private static final String SELECT_BASE_TRANSACTION =
- "select * from osee_tx_details where branch_id = ? and tx_type = ?";
-
- private static final String SELECT_BY_TRANSACTION = "select * from osee_tx_details WHERE transaction_id = ?";
-
- private static final String SELECT_HEAD_TRANSACTION =
- "select * from osee_tx_details where transaction_id = (select max(transaction_id) from osee_tx_details where branch_id = ?) and branch_id = ?";
-
- private static final String SELECT_TRANSACTIONS_BY_QUERY_ID =
- "select * from osee_join_id oji, osee_tx_details txd where oji.query_id = ? and txd.transaction_id = oji.id";
-
- private static final String SELECT_NON_EXISTING_TRANSACTIONS_BY_QUERY_ID =
- "select oji.id from osee_join_id oji where oji.query_id = ? and not exists (select 1 from osee_tx_details txd where txd.transaction_id = oji.id)";
-
- private static final String GET_PRIOR_TRANSACTION =
- "select max(transaction_id) FROM osee_tx_details where branch_id = ? and transaction_id < ?";
-
- private final IOseeDatabaseService oseeDatabaseService;
- private final BranchCache branchCache;
- private final TransactionRecordFactory factory;
-
- public DatabaseTransactionRecordAccessor(IOseeDatabaseService oseeDatabaseService, BranchCache branchCache, TransactionRecordFactory factory) {
- this.oseeDatabaseService = oseeDatabaseService;
- this.branchCache = branchCache;
- this.factory = factory;
- }
-
- private synchronized void ensureDependantCachePopulated() throws OseeCoreException {
- branchCache.ensurePopulated();
- }
-
- @Override
- public void loadTransactionRecord(TransactionCache cache, Collection<Integer> transactionIds) throws OseeCoreException {
- if (transactionIds.isEmpty()) {
- return;
- }
- ensureDependantCachePopulated();
- if (transactionIds.size() > 1) {
- IdJoinQuery joinQuery = JoinUtility.createIdJoinQuery();
- try {
- for (Integer txNumber : transactionIds) {
- joinQuery.add(txNumber);
- }
- joinQuery.store();
-
- loadTransactions(cache, transactionIds.size(), SELECT_TRANSACTIONS_BY_QUERY_ID, joinQuery.getQueryId());
-
- } finally {
- joinQuery.delete();
- }
- } else {
- loadTransaction(cache, SELECT_BY_TRANSACTION, transactionIds.iterator().next());
- }
- }
-
- @Override
- public TransactionRecord loadTransactionRecord(TransactionCache cache, Branch branch, TransactionVersion transactionType) throws OseeCoreException {
- ensureDependantCachePopulated();
- TransactionRecord toReturn = null;
- switch (transactionType) {
- case BASE:
- toReturn =
- loadTransaction(cache, SELECT_BASE_TRANSACTION, branch.getId(), TransactionDetailsType.Baselined);
- break;
- case HEAD:
- toReturn = loadTransaction(cache, SELECT_HEAD_TRANSACTION, branch.getId(), branch.getId());
- break;
- default:
- throw new OseeStateException("Transaction Type [%s] is not supported", transactionType);
- }
- return toReturn;
- }
-
- private void loadTransactions(TransactionCache cache, int expectedCount, String query, int queryId) throws OseeCoreException {
- MutableInteger numberLoaded = new MutableInteger(-1);
- loadFromTransaction(cache, expectedCount, numberLoaded, query, queryId);
-
- if (numberLoaded.getValue() != expectedCount) {
- IOseeStatement chStmt = oseeDatabaseService.getStatement();
- try {
- chStmt.runPreparedQuery(expectedCount, SELECT_NON_EXISTING_TRANSACTIONS_BY_QUERY_ID, queryId);
- while (chStmt.next()) {
- int transactionNumber = chStmt.getInt("id");
- factory.getOrCreate(cache, transactionNumber);
- }
- } finally {
- chStmt.close();
- }
- }
- }
-
- private TransactionRecord loadTransaction(TransactionCache cache, String query, Object... parameters) throws OseeCoreException {
- return loadFromTransaction(cache, 1, new MutableInteger(0), query, parameters);
- }
-
- private TransactionRecord loadFromTransaction(TransactionCache cache, int expectedCount, MutableInteger numberLoaded, String query, Object... parameters) throws OseeCoreException {
- IOseeStatement chStmt = oseeDatabaseService.getStatement();
- TransactionRecord record = null;
- int count = 0;
- try {
- chStmt.runPreparedQuery(expectedCount, query, parameters);
- while (chStmt.next()) {
- count++;
- int branchId = chStmt.getInt("branch_id");
- int transactionNumber = chStmt.getInt("transaction_id");
- String comment = chStmt.getString("osee_comment");
- Date timestamp = chStmt.getTimestamp("time");
- int authorArtId = chStmt.getInt("author");
- int commitArtId = chStmt.getInt("commit_art_id");
- TransactionDetailsType txType = TransactionDetailsType.toEnum(chStmt.getInt("tx_type"));
-
- record =
- prepareTransactionRecord(cache, transactionNumber, branchId, comment, timestamp, authorArtId,
- commitArtId, txType);
- }
- numberLoaded.setValue(count);
- } finally {
- chStmt.close();
- }
- return record;
- }
-
- private TransactionRecord prepareTransactionRecord(TransactionCache cache, int transactionNumber, int branchId, String comment, Date timestamp, int authorArtId, int commitArtId, TransactionDetailsType txType) throws OseeCoreException {
- TransactionRecord record =
- factory.createOrUpdate(cache, transactionNumber, branchId, comment, timestamp, authorArtId, commitArtId,
- txType);
- record.setBranchCache(branchCache);
- record.clearDirty();
- return record;
- }
-
- @SuppressWarnings("unused")
- @Override
- public void load(TransactionCache transactionCache) throws OseeCoreException {
- // Not implemented
- }
-
- @Override
- public TransactionRecord getOrLoadPriorTransaction(TransactionCache cache, int transactionNumber, int branchId) throws OseeCoreException {
- int priorTransactionId =
- oseeDatabaseService.runPreparedQueryFetchObject(-1, GET_PRIOR_TRANSACTION, branchId, transactionNumber);
- return cache.getOrLoad(priorTransactionId);
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/IBranchUpdateEvent.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/IBranchUpdateEvent.java
deleted file mode 100644
index be80486b7c..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/IBranchUpdateEvent.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.cache;
-
-import java.util.Collection;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-
-/**
- * @author Roberto E. Escobar
- */
-public interface IBranchUpdateEvent {
-
- void send(Collection<Branch> branches) throws OseeCoreException;
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/Activator.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/Activator.java
deleted file mode 100644
index 101007ce44..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/Activator.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.internal;
-
-import org.eclipse.osee.framework.core.util.ServiceDependencyTracker;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-public class Activator implements BundleActivator {
-
- public static final String PLUGIN_ID = "org.eclipse.osee.framework.core.datastore";
-
- private ServiceDependencyTracker tracker;
-
- @Override
- public void start(BundleContext context) throws Exception {
- tracker = new ServiceDependencyTracker(context, new OseeCachingServiceRegistrationHandler());
- tracker.open();
- }
-
- @Override
- public void stop(BundleContext context) throws Exception {
- Lib.close(tracker);
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/ArtifactTypeDataAccessor.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/ArtifactTypeDataAccessor.java
deleted file mode 100644
index b53282346c..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/ArtifactTypeDataAccessor.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Created on Aug 17, 2011
- *
- * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
- */
-package org.eclipse.osee.framework.core.datastore.internal;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
-import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.framework.core.enums.CoreBranches;
-import org.eclipse.osee.framework.core.enums.TxChange;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeExceptions;
-import org.eclipse.osee.framework.core.model.AbstractOseeType;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.OseeImportModelRequest;
-import org.eclipse.osee.framework.core.model.OseeImportModelResponse;
-import org.eclipse.osee.framework.core.model.cache.BranchCache;
-import org.eclipse.osee.framework.core.model.cache.IOseeCache;
-import org.eclipse.osee.framework.core.model.cache.IOseeDataAccessor;
-import org.eclipse.osee.framework.core.services.IdentityService;
-import org.eclipse.osee.framework.database.IOseeDatabaseService;
-import org.eclipse.osee.framework.database.core.IOseeStatement;
-import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.resource.management.IResource;
-import org.eclipse.osee.framework.resource.management.IResourceLocator;
-import org.eclipse.osee.framework.resource.management.IResourceLocatorManager;
-import org.eclipse.osee.framework.resource.management.IResourceManager;
-import org.eclipse.osee.framework.resource.management.StandardOptions;
-
-public class ArtifactTypeDataAccessor<T extends AbstractOseeType<Long>> implements IOseeDataAccessor<Long, T> {
-
- private static final String LOAD_OSEE_TYPE_DEF_URIS =
- "select attr.uri from osee_txs txs1, osee_artifact art, osee_attribute attr, osee_txs txs2 where txs1.branch_id = ? and txs1.tx_current = ? and txs1.gamma_id = art.gamma_id and txs2.branch_id = ? and txs2.tx_current = ? and txs2.gamma_id = attr.gamma_id and art.art_type_id = ? and art.art_id = attr.art_id and attr.attr_type_id = ?";
-
- private static volatile boolean loadInProgress;
-
- private final ModelingServiceProvider modelService;
- private final IOseeDatabaseService databaseService;
- private final IResourceLocatorManager locatorManager;
- private final IResourceManager resourceManager;
- private final BranchCache branchCache;
- private final IdentityService identityService;
-
- public ArtifactTypeDataAccessor(ModelingServiceProvider modelService, IOseeDatabaseService databaseService, IResourceLocatorManager locatorManager, IResourceManager resourceManager, BranchCache branchCache, IdentityService identityService) {
- this.modelService = modelService;
- this.databaseService = databaseService;
- this.locatorManager = locatorManager;
- this.resourceManager = resourceManager;
- this.branchCache = branchCache;
- this.identityService = identityService;
- }
-
- @Override
- public synchronized void load(IOseeCache<Long, T> cache) throws OseeCoreException {
- if (!loadInProgress) {
- loadInProgress = true;
- Collection<String> uriPaths = findOseeTypeData();
- if (!uriPaths.isEmpty()) {
- List<IResource> resources = getTypeData(uriPaths);
- String modelData = createCombinedFile(resources);
- String modelName = String.format("osee.types.%s.osee", Lib.getDateTimeString());
- OseeImportModelRequest request = new OseeImportModelRequest(modelName, modelData, false, false, true);
- OseeImportModelResponse response = new OseeImportModelResponse();
- modelService.getIOseeModelingService().importOseeTypes(new NullProgressMonitor(), true, request, response);
- }
- loadInProgress = false;
- }
- }
-
- @Override
- public void store(Collection<T> types) throws OseeCoreException {
- Collection<Long> remoteIds = new ArrayList<Long>();
- for (T type : types) {
- remoteIds.add(type.getGuid());
- }
- identityService.store(remoteIds);
- for (T type : types) {
- type.setId(identityService.getLocalId(type.getGuid()));
- type.clearDirty();
- }
- }
-
- private Collection<String> findOseeTypeData() throws OseeCoreException {
- Collection<String> paths = new ArrayList<String>();
-
- Integer artifactTypeId = identityService.getLocalId(CoreArtifactTypes.OseeTypeDefinition);
- Integer attributeTypeId = identityService.getLocalId(CoreAttributeTypes.UriGeneralStringData);
-
- Branch commonBranch = branchCache.get(CoreBranches.COMMON);
-
- if (commonBranch != null) {
- IOseeStatement chStmt = null;
- try {
- chStmt = databaseService.getStatement();
- chStmt.runPreparedQuery(LOAD_OSEE_TYPE_DEF_URIS, commonBranch.getId(), TxChange.CURRENT.getValue(),
- commonBranch.getId(), TxChange.CURRENT.getValue(), artifactTypeId, attributeTypeId);
- while (chStmt.next()) {
- String uri = chStmt.getString("uri");
- paths.add(uri);
- }
- } finally {
- Lib.close(chStmt);
- }
- }
- return paths;
- }
-
- private List<IResource> getTypeData(Collection<String> paths) throws OseeCoreException {
- List<IResource> toReturn = new ArrayList<IResource>();
-
- PropertyStore options = new PropertyStore();
- options.put(StandardOptions.DecompressOnAquire.name(), "true");
- for (String path : paths) {
- IResourceLocator locator = locatorManager.getResourceLocator(path);
- IResource resource = resourceManager.acquire(locator, options);
- toReturn.add(resource);
- }
- return toReturn;
- }
-
- private String createCombinedFile(List<IResource> resources) throws OseeCoreException {
- StringWriter writer = new StringWriter();
- for (IResource resource : resources) {
- InputStream inputStream = null;
- try {
- inputStream = resource.getContent();
- String oseeTypeFragment = Lib.inputStreamToString(inputStream);
- oseeTypeFragment = oseeTypeFragment.replaceAll("import\\s+\"", "// import \"");
- writer.write("\n");
- writer.write("////////////// ");
- writer.write(resource.getName());
- writer.write("\n");
- writer.write("\n");
- writer.write(oseeTypeFragment);
- } catch (IOException ex) {
- OseeExceptions.wrapAndThrow(ex);
- } finally {
- Lib.close(inputStream);
- }
- }
- return writer.toString();
- }
-}
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
deleted file mode 100644
index f038cb9987..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/CoreOseeSchemaResource.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.internal;
-
-import java.io.InputStream;
-import java.net.URL;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.osee.framework.core.datastore.IOseeSchemaResource;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeExceptions;
-import org.osgi.framework.Bundle;
-
-public class CoreOseeSchemaResource implements IOseeSchemaResource {
-
- @Override
- public InputStream getContent() throws OseeCoreException {
- InputStream inputStream = null;
- try {
- Bundle bundle = Platform.getBundle("org.eclipse.osee.framework.core.datastore");
- URL url = bundle.getEntry("support/SKYNET.VERSIONING.SCHEMA.xml");
- inputStream = url.openStream();
- } catch (Exception ex) {
- OseeExceptions.wrapAndThrow(ex);
- }
- 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/internal/ModelingServiceProvider.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/ModelingServiceProvider.java
deleted file mode 100644
index 8cab46844e..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/ModelingServiceProvider.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package org.eclipse.osee.framework.core.datastore.internal;
-
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.services.IOseeModelingService;
-
-public interface ModelingServiceProvider {
- IOseeModelingService getIOseeModelingService() throws OseeCoreException;
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/OseeCachingServiceRegistrationHandler.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/OseeCachingServiceRegistrationHandler.java
deleted file mode 100644
index 80012ecbd7..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/OseeCachingServiceRegistrationHandler.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.internal;
-
-import java.util.Map;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeStateException;
-import org.eclipse.osee.framework.core.server.IApplicationServerLookup;
-import org.eclipse.osee.framework.core.server.IApplicationServerManager;
-import org.eclipse.osee.framework.core.services.IOseeCachingService;
-import org.eclipse.osee.framework.core.services.IOseeCachingServiceFactory;
-import org.eclipse.osee.framework.core.services.IOseeModelFactoryService;
-import org.eclipse.osee.framework.core.services.IOseeModelingService;
-import org.eclipse.osee.framework.core.services.IdentityService;
-import org.eclipse.osee.framework.core.translation.IDataTranslationService;
-import org.eclipse.osee.framework.core.util.AbstractTrackingHandler;
-import org.eclipse.osee.framework.database.IOseeDatabaseService;
-import org.eclipse.osee.framework.resource.management.IResourceLocatorManager;
-import org.eclipse.osee.framework.resource.management.IResourceManager;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.util.tracker.ServiceTracker;
-
-/**
- * @author Roberto E. Escobar
- */
-public class OseeCachingServiceRegistrationHandler extends AbstractTrackingHandler {
-
- //@formatter:off
- private final static Class<?>[] SERVICE_DEPENDENCIES = new Class<?>[] {
- IOseeDatabaseService.class,
- IOseeModelFactoryService.class,
- IDataTranslationService.class,
- IApplicationServerLookup.class,
- IApplicationServerManager.class,
- IResourceLocatorManager.class,
- IResourceManager.class,
- IdentityService.class,
- };
- //@formatter:on
-
- private ServiceRegistration factoryRegistration;
- private ServiceRegistration cachingServiceRegistration;
-
- @Override
- public Class<?>[] getDependencies() {
- return SERVICE_DEPENDENCIES;
- }
-
- @Override
- public void onActivate(BundleContext context, Map<Class<?>, Object> services) {
- IOseeCachingServiceFactory factory = createCachingFactoryService(context, services);
- IOseeCachingService cachingService = factory.createCachingService(true);
-
- factoryRegistration = context.registerService(IOseeCachingServiceFactory.class.getName(), factory, null);
- cachingServiceRegistration = context.registerService(IOseeCachingService.class.getName(), cachingService, null);
- }
-
- @Override
- public void onDeActivate() {
- if (factoryRegistration != null) {
- factoryRegistration.unregister();
- }
- if (cachingServiceRegistration != null) {
- cachingServiceRegistration.unregister();
- }
- }
-
- private IOseeCachingServiceFactory createCachingFactoryService(final BundleContext context, Map<Class<?>, Object> services) {
- final IOseeDatabaseService dbService = getService(IOseeDatabaseService.class, services);
- final IOseeModelFactoryService modelFactoryService = getService(IOseeModelFactoryService.class, services);
- final IDataTranslationService translationService = getService(IDataTranslationService.class, services);
- final IApplicationServerLookup lookupService = getService(IApplicationServerLookup.class, services);
- final IApplicationServerManager appManager = getService(IApplicationServerManager.class, services);
- final IResourceManager resourceManager = getService(IResourceManager.class, services);
- final IResourceLocatorManager resourceLocatorManager = getService(IResourceLocatorManager.class, services);
- final IdentityService identityService = getService(IdentityService.class, services);
-
- ModelingServiceProvider provider = new ModelingServiceProvider() {
-
- @Override
- public IOseeModelingService getIOseeModelingService() throws OseeCoreException {
- ServiceTracker<IOseeModelingService, Object> tracker =
- new ServiceTracker<IOseeModelingService, Object>(context, IOseeModelingService.class, null);
- tracker.open(true);
-
- IOseeModelingService toReturn = (IOseeModelingService) tracker.getService();
- if (toReturn == null) {
- throw new OseeStateException("IOseeModelingService could not be found");
- }
- return toReturn;
- }
- };
-
- return new ServerOseeCachingServiceFactory(dbService, modelFactoryService, translationService, lookupService,
- appManager, provider, resourceLocatorManager, resourceManager, identityService);
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/ServerOseeCachingServiceFactory.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/ServerOseeCachingServiceFactory.java
deleted file mode 100644
index caab150cef..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/ServerOseeCachingServiceFactory.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.internal;
-
-import org.eclipse.osee.framework.core.datastore.cache.BranchUpdateEventImpl;
-import org.eclipse.osee.framework.core.datastore.cache.DatabaseBranchAccessor;
-import org.eclipse.osee.framework.core.datastore.cache.DatabaseTransactionRecordAccessor;
-import org.eclipse.osee.framework.core.datastore.cache.IBranchUpdateEvent;
-import org.eclipse.osee.framework.core.model.OseeCachingService;
-import org.eclipse.osee.framework.core.model.cache.ArtifactTypeCache;
-import org.eclipse.osee.framework.core.model.cache.AttributeTypeCache;
-import org.eclipse.osee.framework.core.model.cache.BranchCache;
-import org.eclipse.osee.framework.core.model.cache.OseeEnumTypeCache;
-import org.eclipse.osee.framework.core.model.cache.RelationTypeCache;
-import org.eclipse.osee.framework.core.model.cache.TransactionCache;
-import org.eclipse.osee.framework.core.model.type.ArtifactType;
-import org.eclipse.osee.framework.core.model.type.AttributeType;
-import org.eclipse.osee.framework.core.model.type.OseeEnumType;
-import org.eclipse.osee.framework.core.model.type.RelationType;
-import org.eclipse.osee.framework.core.server.IApplicationServerLookup;
-import org.eclipse.osee.framework.core.server.IApplicationServerManager;
-import org.eclipse.osee.framework.core.services.IOseeCachingService;
-import org.eclipse.osee.framework.core.services.IOseeCachingServiceFactory;
-import org.eclipse.osee.framework.core.services.IOseeModelFactoryService;
-import org.eclipse.osee.framework.core.services.IdentityService;
-import org.eclipse.osee.framework.core.translation.IDataTranslationService;
-import org.eclipse.osee.framework.database.IOseeDatabaseService;
-import org.eclipse.osee.framework.resource.management.IResourceLocatorManager;
-import org.eclipse.osee.framework.resource.management.IResourceManager;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ServerOseeCachingServiceFactory implements IOseeCachingServiceFactory {
-
- private final IOseeDatabaseService databaseService;
- private final IOseeModelFactoryService factoryService;
- private final IDataTranslationService translationService;
- private final IApplicationServerLookup serverLookUp;
- private final IApplicationServerManager appManager;
- private final ModelingServiceProvider modelingService;
- private final IResourceLocatorManager locatorManager;
- private final IResourceManager resourceManager;
- private final IdentityService identityService;
-
- public ServerOseeCachingServiceFactory(IOseeDatabaseService databaseService, IOseeModelFactoryService factoryService, IDataTranslationService translationService, IApplicationServerLookup serverLookUp, IApplicationServerManager appManager, ModelingServiceProvider modelingService, IResourceLocatorManager locatorManager, IResourceManager resourceManager, IdentityService identityService) {
- this.databaseService = databaseService;
- this.factoryService = factoryService;
- this.translationService = translationService;
- this.serverLookUp = serverLookUp;
- this.appManager = appManager;
- this.modelingService = modelingService;
- this.locatorManager = locatorManager;
- this.resourceManager = resourceManager;
- this.identityService = identityService;
- }
-
- @Override
- public IOseeCachingService createCachingService(boolean needsPriming) {
- TransactionCache txCache = new TransactionCache();
- IBranchUpdateEvent branchEventSender = new BranchUpdateEventImpl(translationService, appManager, serverLookUp);
- BranchCache branchCache =
- new BranchCache(new DatabaseBranchAccessor(databaseService, branchEventSender, txCache,
- factoryService.getBranchFactory()));
- txCache.setAccessor(new DatabaseTransactionRecordAccessor(databaseService, branchCache,
- factoryService.getTransactionFactory()));
-
- OseeEnumTypeCache oseeEnumTypeCache =
- new OseeEnumTypeCache(new ArtifactTypeDataAccessor<OseeEnumType>(modelingService, databaseService,
- locatorManager, resourceManager, branchCache, identityService));
- AttributeTypeCache attributeCache =
- new AttributeTypeCache(new ArtifactTypeDataAccessor<AttributeType>(modelingService, databaseService,
- locatorManager, resourceManager, branchCache, identityService));
- ArtifactTypeCache artifactCache =
- new ArtifactTypeCache(new ArtifactTypeDataAccessor<ArtifactType>(modelingService, databaseService,
- locatorManager, resourceManager, branchCache, identityService));
- RelationTypeCache relationCache =
- new RelationTypeCache(new ArtifactTypeDataAccessor<RelationType>(modelingService, databaseService,
- locatorManager, resourceManager, branchCache, identityService));
-
- return new OseeCachingService(branchCache, txCache, artifactCache, attributeCache, relationCache,
- oseeEnumTypeCache, identityService);
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/AppliesToClause.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/AppliesToClause.java
deleted file mode 100644
index 6cf4a8e3ea..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/AppliesToClause.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.core.datastore.schema.data;
-
-import org.apache.commons.lang.builder.EqualsBuilder;
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.eclipse.osee.framework.jdk.core.persistence.Xmlizable;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * @author Roberto E. Escobar
- */
-public class AppliesToClause implements Xmlizable {
- public static final String APPLIES_TO_TAG = "AppliesTo";
-
- public enum OrderType {
- Undefined,
- Ascending,
- Descending;
- }
-
- public enum AppliesToEntries {
- id,
- sort;
- }
-
- private String columnName;
- private OrderType orderType;
-
- public AppliesToClause(String columnName, OrderType orderType) {
- this.columnName = columnName;
- this.orderType = orderType;
- }
-
- public String getColumnName() {
- return columnName;
- }
-
- public void setColumnName(String columnName) {
- this.columnName = columnName;
- }
-
- public OrderType getOrderType() {
- return orderType;
- }
-
- public void setOrderType(OrderType orderType) {
- this.orderType = orderType;
- }
-
- @Override
- public String toString() {
- return String.format("%s:[%s]\t%s:[%s]", AppliesToEntries.id.name(), columnName, AppliesToEntries.sort.name(),
- orderType);
- }
-
- @Override
- public boolean equals(Object otherObject) {
- if (otherObject instanceof AppliesToClause == false) {
- return false;
- }
- if (this == otherObject) {
- return true;
- }
- AppliesToClause that = (AppliesToClause) otherObject;
- return new EqualsBuilder().appendSuper(super.equals(otherObject)).append(this.columnName, that.getColumnName()).append(
- this.orderType, that.getOrderType()).isEquals();
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder(23, 37).append(columnName).append(orderType).toHashCode();
- }
-
- @Override
- public Element toXml(Document doc) {
- Element element = doc.createElement(APPLIES_TO_TAG);
- element.setAttribute(AppliesToEntries.id.name(), columnName);
- if (!orderType.equals(OrderType.Undefined)) {
- element.setAttribute(AppliesToEntries.sort.name(), orderType.name());
- }
- return element;
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ColumnDbData.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ColumnDbData.java
deleted file mode 100644
index 5a0859245b..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ColumnDbData.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.data;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ColumnDbData {
- private final String columnName;
- private final String columnValue;
-
- public ColumnDbData(String columnName, String columnValue) {
- this.columnName = columnName;
- this.columnValue = columnValue;
- }
-
- public String getColumnName() {
- return columnName;
- }
-
- public String getColumnValue() {
- return columnValue;
- }
-
- @Override
- public String toString() {
- return "[" + columnName + ", " + columnValue + "]";
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ColumnMetadata.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ColumnMetadata.java
deleted file mode 100644
index ad9ab2eb81..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ColumnMetadata.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.core.datastore.schema.data;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import org.apache.commons.lang.builder.EqualsBuilder;
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.eclipse.osee.framework.core.datastore.schema.data.TableElement.ColumnFields;
-import org.eclipse.osee.framework.core.datastore.schema.data.TableElement.TableSections;
-import org.eclipse.osee.framework.jdk.core.persistence.Xmlizable;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ColumnMetadata implements Xmlizable {
- private final Map<ColumnFields, String> columnFields;
-
- public ColumnMetadata(String columnId) {
- columnFields = new HashMap<ColumnFields, String>();
- columnFields.put(ColumnFields.id, columnId);
- }
-
- public String getId() {
- return getColumnField(ColumnFields.id);
- }
-
- public Map<ColumnFields, String> getColumnFields() {
- return columnFields;
- }
-
- public void addColumnField(ColumnFields field, String value) {
- columnFields.put(field, value);
- }
-
- public String getColumnField(ColumnFields field) {
- if (columnFields.containsKey(field)) {
- return columnFields.get(field);
- }
- return "";
- }
-
- @Override
- public boolean equals(Object otherObject) {
- if (otherObject instanceof ColumnMetadata == false) {
- return false;
- }
- if (this == otherObject) {
- return true;
- }
- ColumnMetadata that = (ColumnMetadata) otherObject;
- return new EqualsBuilder().appendSuper(super.equals(otherObject)).append(this.columnFields,
- that.getColumnFields()).isEquals();
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder(101, 83).append(columnFields).toHashCode();
- }
-
- @Override
- public String toString() {
- String toReturn = TableSections.Column + ": ";
- Set<ColumnFields> keys = columnFields.keySet();
- for (ColumnFields field : keys) {
- String value = columnFields.get(field);
- toReturn += "\t" + field + "[" + value + "]";
- }
- return toReturn;
- }
-
- @Override
- public Element toXml(Document doc) {
- Element columnElement = doc.createElement(TableSections.Column.toString());
- for (ColumnFields key : columnFields.keySet()) {
- columnElement.setAttribute(key.toString(), columnFields.get(key));
- }
- return columnElement;
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ConstraintElement.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ConstraintElement.java
deleted file mode 100644
index 1b4cfb14e1..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ConstraintElement.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.core.datastore.schema.data;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.commons.lang.builder.EqualsBuilder;
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.eclipse.osee.framework.core.datastore.schema.data.TableElement.TableSections;
-import org.eclipse.osee.framework.jdk.core.persistence.Xmlizable;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ConstraintElement implements Xmlizable {
-
- public enum ConstraintFields {
- id,
- schema,
- type,
- appliesTo,
- deferrable
- };
-
- private final ConstraintTypes constraintType;
- private final boolean deferrable;
- private String schema;
- private String id;
- private final List<String> columns;
-
- public ConstraintElement(ConstraintTypes constraintType, String schema, String id, boolean deferrable) {
- this.schema = schema.toUpperCase();
- this.schema = this.schema.trim();
- this.id = id.toUpperCase();
- this.id = this.id.trim();
- this.deferrable = deferrable;
- this.constraintType = constraintType;
- this.columns = new ArrayList<String>();
- }
-
- public List<String> getColumns() {
- return columns;
- }
-
- public String getId() {
- return id;
- }
-
- public String getSchema() {
- return schema;
- }
-
- public void addColumn(String columnName) {
- columnName = columnName.toUpperCase();
- columnName = columnName.trim();
- this.columns.add(columnName);
- }
-
- public void setId(String id) {
- id = id.toUpperCase();
- id = id.trim();
- this.id = id;
- }
-
- public void setSchema(String schema) {
- schema = schema.toUpperCase();
- schema = schema.trim();
- this.schema = schema;
- }
-
- public String getFullyQualifiedId() {
- if (Strings.isValid(schema)) {
- return schema + "." + id;
- } else {
- return id;
- }
- }
-
- /**
- * @return Returns the deferrable.
- */
- public boolean isDeferrable() {
- return deferrable;
- }
-
- public ConstraintTypes getConstraintType() {
- return constraintType;
- }
-
- public String getCommaSeparatedColumnsList() {
- return org.eclipse.osee.framework.jdk.core.util.Collections.toString(",", columns);
- }
-
- @Override
- public String toString() {
- String toReturn = TableSections.Constraint + ": ";
- toReturn += "\t" + ConstraintFields.schema + "[" + schema + "]";
- toReturn += "\t" + ConstraintFields.id + "[" + id + "]";
- toReturn += "\t" + ConstraintFields.type + "[" + constraintType.toString() + "]";
- toReturn += "\t" + ConstraintFields.appliesTo + "[" + getCommaSeparatedColumnsList() + "]";
- toReturn += "\t" + ConstraintFields.deferrable + "[" + Boolean.toString(deferrable) + "]";
- return toReturn;
- }
-
- @Override
- public Element toXml(Document doc) {
- Element constraintElement = doc.createElement(TableSections.Constraint.toString());
- constraintElement.setAttribute(ConstraintFields.schema.name(), schema);
- constraintElement.setAttribute(ConstraintFields.id.name(), id);
- constraintElement.setAttribute(ConstraintFields.type.name(), constraintType.toString());
- constraintElement.setAttribute(ConstraintFields.appliesTo.name(), getCommaSeparatedColumnsList());
- constraintElement.setAttribute(ConstraintFields.deferrable.name(), Boolean.toString(deferrable));
- return constraintElement;
- }
-
- @Override
- public boolean equals(Object otherObject) {
- if (otherObject instanceof ConstraintElement == false) {
- return false;
- }
- if (this == otherObject) {
- return true;
- }
- ConstraintElement that = (ConstraintElement) otherObject;
- return new EqualsBuilder().appendSuper(super.equals(otherObject)).append(this.constraintType,
- that.getConstraintType()).append(this.schema, that.getSchema()).append(this.id, that.getId()).append(
- this.columns, that.getColumns()).append(this.deferrable, that.deferrable).isEquals();
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder(37, 11).append(constraintType).append(schema).append(id).append(columns).append(
- deferrable).toHashCode();
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ConstraintFactory.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ConstraintFactory.java
deleted file mode 100644
index 01b84e54ef..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ConstraintFactory.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.data;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ConstraintFactory {
-
- public static ConstraintElement getConstraint(ConstraintTypes constraintType, String schema, String id, boolean deferrable) {
- ConstraintElement element = null;
- if (constraintType != null) {
- switch (constraintType) {
- case FOREIGN_KEY:
- element = new ForeignKey(constraintType, schema, id, deferrable);
- break;
- case PRIMARY_KEY:
- case UNIQUE:
- case CHECK:
- default:
- element = new ConstraintElement(constraintType, schema, id, deferrable);
- break;
- }
- }
- return element;
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ConstraintTypes.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ConstraintTypes.java
deleted file mode 100644
index 9127d31a52..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ConstraintTypes.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.data;
-
-/**
- * @author Roberto E. Escobar
- */
-public enum ConstraintTypes {
- PRIMARY_KEY,
- FOREIGN_KEY,
- UNIQUE,
- CHECK;
-
- @Override
- public String toString() {
- String toReturn = super.toString();
- toReturn = toReturn.replaceAll("_", " ");
- return toReturn;
- }
-
- public static ConstraintTypes textToType(String text) {
- ConstraintTypes[] typesArray = ConstraintTypes.values();
- for (ConstraintTypes type : typesArray) {
- if (type.toString().equals(text.toUpperCase())) {
- return type;
- }
- }
- return null;
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ForeignKey.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ForeignKey.java
deleted file mode 100644
index c3dfa07a20..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ForeignKey.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.data;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import java.util.TreeSet;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ForeignKey extends ConstraintElement {
-
- List<ReferenceClause> references;
-
- public ForeignKey(ConstraintTypes constraintType, String schema, String id, boolean deferrable) {
- super(constraintType, schema, id, deferrable);
- references = new ArrayList<ReferenceClause>();
- }
-
- public void addReference(ReferenceClause reference) {
- references.add(reference);
- }
-
- public List<ReferenceClause> getReferences() {
- return references;
- }
-
- public Set<String> getReferencedTables() {
- Set<String> refTables = new TreeSet<String>();
- for (ReferenceClause ref : references) {
- refTables.add(ref.getFullyQualifiedTableName());
- }
- return refTables;
- }
-
- @Override
- public String toString() {
- String toReturn = super.toString();
- for (ReferenceClause reference : references) {
- toReturn += "\n\t\t" + reference.toString();
- }
- return toReturn;
- }
-
- @Override
- public Element toXml(Document doc) {
- Element parent = super.toXml(doc);
- for (ReferenceClause reference : references) {
- parent.appendChild(reference.toXml(doc));
- }
- return parent;
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/IndexElement.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/IndexElement.java
deleted file mode 100644
index 319bec1303..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/IndexElement.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.core.datastore.schema.data;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.commons.lang.builder.EqualsBuilder;
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.eclipse.osee.framework.core.datastore.schema.data.AppliesToClause.OrderType;
-import org.eclipse.osee.framework.jdk.core.persistence.Xmlizable;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * @author Roberto E. Escobar
- */
-public class IndexElement implements Xmlizable {
-
- public enum IndexFields {
- id,
- mySqlIgnore,
- type,
- tablespace;
- }
-
- private String id;
- private String indexType;
- private final List<AppliesToClause> appliesToList;
- private boolean ignoreMySql = false;
- private String tablespace;
-
- public IndexElement(String id) {
- this.id = id;
- this.appliesToList = new ArrayList<AppliesToClause>();
- this.indexType = "";
- this.tablespace = "";
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getId() {
- return id;
- }
-
- public void addAppliesTo(String name, OrderType type) {
- appliesToList.add(new AppliesToClause(name, type));
- }
-
- public List<AppliesToClause> getAppliesToList() {
- return appliesToList;
- }
-
- @Override
- public String toString() {
- StringBuilder toReturn = new StringBuilder();
- toReturn.append(" Index: " + id);
- toReturn.append(getAppliesToAsString());
- return toReturn.toString();
- }
-
- @Override
- public Element toXml(Document doc) {
- Element element = doc.createElement(TableElement.TableSections.Index.name());
- element.setAttribute(IndexFields.id.name(), id);
- for (AppliesToClause clause : appliesToList) {
- element.appendChild(clause.toXml(doc));
- }
- return element;
- }
-
- public String getAppliesToAsString() {
- StringBuilder toReturn = new StringBuilder();
- for (int index = 0; index < appliesToList.size(); index++) {
- toReturn.append("\n\t\tApplies to " + appliesToList.get(index));
- }
- return toReturn.toString();
- }
-
- @Override
- public boolean equals(Object otherObject) {
- if (otherObject instanceof IndexElement == false) {
- return false;
- }
- if (this == otherObject) {
- return true;
- }
- IndexElement that = (IndexElement) otherObject;
- return new EqualsBuilder().appendSuper(super.equals(otherObject)).append(this.appliesToList,
- that.getAppliesToList()).append(this.id, that.getId()).isEquals();
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder(113, 67).append(id).append(appliesToList).toHashCode();
- }
-
- public void setMySqlIgnore(boolean b) {
- this.ignoreMySql = b;
- }
-
- public void setIndexType(String indexType) {
- if (indexType != null) {
- this.indexType = indexType;
- }
- }
-
- public String getIndexType() {
- return indexType;
- }
-
- public boolean ignoreMySql() {
- return this.ignoreMySql;
- }
-
- public String getTablespace() {
- return Strings.isValid(tablespace) ? tablespace : "";
- }
-
- public void setTablespace(String tablespace) {
- this.tablespace = tablespace;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ReferenceClause.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ReferenceClause.java
deleted file mode 100644
index 6f064135e8..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ReferenceClause.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.core.datastore.schema.data;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.commons.lang.builder.EqualsBuilder;
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.eclipse.osee.framework.jdk.core.persistence.Xmlizable;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ReferenceClause implements Xmlizable {
- public static final String REFERENCES_TAG = "References";
-
- public enum ReferencesFields {
- schema,
- table,
- column,
- onUpdate,
- onDelete;
- }
-
- public enum OnDeleteEnum {
- NO_ACTION,
- RESTRICT,
- CASCADE,
- SET_NULL,
- UNSPECIFIED;
-
- @Override
- public String toString() {
- String toReturn = super.toString();
- toReturn = toReturn.replaceAll("_", " ");
- return toReturn;
- }
- }
-
- public enum OnUpdateEnum {
- NO_ACTION,
- RESTRICT,
- UNSPECIFIED;
-
- @Override
- public String toString() {
- String toReturn = super.toString();
- toReturn = toReturn.replaceAll("_", " ");
- return toReturn;
- }
- }
-
- private String schema;
- private String table;
- List<String> columns;
- OnDeleteEnum onDeleteAction;
- OnUpdateEnum onUpdateAction;
-
- public ReferenceClause(String schema, String table) {
- this.schema = schema.toUpperCase();
- this.schema = this.schema.trim();
- this.table = table.toUpperCase();
- this.table = this.table.trim();
- this.columns = new ArrayList<String>();
- this.onDeleteAction = OnDeleteEnum.UNSPECIFIED;
- this.onUpdateAction = OnUpdateEnum.UNSPECIFIED;
- }
-
- public void setSchema(String schema) {
- this.schema = schema;
- }
-
- public OnDeleteEnum getOnDeleteAction() {
- return onDeleteAction;
- }
-
- public OnUpdateEnum getOnUpdateAction() {
- return onUpdateAction;
- }
-
- public void setOnDeleteAction(OnDeleteEnum onDeleteAction) {
- this.onDeleteAction = onDeleteAction;
- }
-
- public void setOnUpdateAction(OnUpdateEnum onUpdateAction) {
- this.onUpdateAction = onUpdateAction;
- }
-
- public void addColumn(String column) {
- column = column.toUpperCase();
- column = column.trim();
- columns.add(column);
- }
-
- public String getFullyQualifiedTableName() {
- return schema + "." + table;
- }
-
- public List<String> getColumns() {
- return columns;
- }
-
- public String getCommaSeparatedColumnsList() {
- return org.eclipse.osee.framework.jdk.core.util.Collections.toString(",", columns);
- }
-
- @Override
- public String toString() {
- String toReturn = REFERENCES_TAG + ": " + getFullyQualifiedTableName();
- toReturn += "\t[";
- for (String column : columns) {
- toReturn += column + " ";
- }
- toReturn += "]";
- return toReturn;
- }
-
- @Override
- public Element toXml(Document doc) {
- Element refElement = doc.createElement(REFERENCES_TAG);
- refElement.setAttribute(ReferencesFields.schema.name(), schema);
- refElement.setAttribute(ReferencesFields.table.name(), table);
- refElement.setAttribute(ReferencesFields.column.name(), getCommaSeparatedColumnsList());
-
- if (!onDeleteAction.equals(OnDeleteEnum.UNSPECIFIED)) {
- refElement.setAttribute(ReferencesFields.onDelete.name(), onDeleteAction.toString());
- }
-
- if (!onUpdateAction.equals(OnUpdateEnum.UNSPECIFIED)) {
- refElement.setAttribute(ReferencesFields.onUpdate.name(), onUpdateAction.toString());
- }
- return refElement;
- }
-
- @Override
- public boolean equals(Object otherObject) {
- if (otherObject instanceof ReferenceClause == false) {
- return false;
- }
- if (this == otherObject) {
- return true;
- }
- ReferenceClause that = (ReferenceClause) otherObject;
- return new EqualsBuilder().appendSuper(super.equals(otherObject)).append(this.getFullyQualifiedTableName(),
- that.getFullyQualifiedTableName()).append(this.columns, that.getColumns()).append(this.onDeleteAction,
- that.getOnDeleteAction()).append(this.onUpdateAction, that.getOnUpdateAction()).isEquals();
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder(113, 67).append(schema).append(table).append(columns).append(onDeleteAction).append(
- onUpdateAction).toHashCode();
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/SchemaData.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/SchemaData.java
deleted file mode 100644
index 646f3ee6f0..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/SchemaData.java
+++ /dev/null
@@ -1,278 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.core.datastore.schema.data;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-import javax.xml.parsers.ParserConfigurationException;
-import org.apache.commons.lang.builder.EqualsBuilder;
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.eclipse.osee.framework.core.datastore.schema.data.TableElement.ColumnFields;
-import org.eclipse.osee.framework.jdk.core.persistence.Xmlizable;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.jdk.core.util.xml.Jaxp;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * @author Roberto E. Escobar
- */
-public class SchemaData implements Xmlizable {
-
- public static final String ROOT_TAG = "TableConfig";
- private List<TableElement> tableDefinitions;
- private final SchemaDataLookup schemaLookup;
-
- private final boolean isSorted;
-
- public SchemaData() {
- this.tableDefinitions = new ArrayList<TableElement>();
- this.isSorted = false;
- this.schemaLookup = new SchemaDataLookup(this);
- }
-
- public void setTableDataSpaceName(String tableDataSpace) {
- for (TableElement table : getTableMap().values()) {
- table.setTablespace(tableDataSpace);
- }
- }
-
- public void setIndexDataSpaceName(String indexDataSpace) {
- for (TableElement table : getTableMap().values()) {
- for (IndexElement indexElement : table.getIndexData()) {
- indexElement.setTablespace(indexDataSpace);
- }
- }
- }
-
- public List<TableElement> getTablesOrderedByDependency() {
- sortTablesForConstraints();
- markIdentityColumns();
- return tableDefinitions;
- }
-
- public Set<String> getTablesToBackup() {
- Set<String> backupTables = new TreeSet<String>();
- for (TableElement table : tableDefinitions) {
- if (table.isBackupDataSet()) {
- backupTables.add(table.getFullyQualifiedTableName());
- }
- }
- return backupTables;
- }
-
- public Map<String, Set<String>> getTablesToImport(String defaultSource) {
- Map<String, Set<String>> importTables = new HashMap<String, Set<String>>();
- for (TableElement table : tableDefinitions) {
- if (table.isImportDataSet()) {
- String importFrom = table.getImportFrom();
- if (!Strings.isValid(importFrom)) {
- importFrom = defaultSource;
- }
- Set<String> tableSet;
- if (importTables.containsKey(importFrom)) {
- tableSet = importTables.get(importFrom);
- } else {
- tableSet = new TreeSet<String>();
- }
- tableSet.add(table.getFullyQualifiedTableName());
- importTables.put(importFrom, tableSet);
- }
- }
- return importTables;
- }
-
- public void addTableDefinition(TableElement table) {
- tableDefinitions.add(table);
- }
-
- @Override
- public String toString() {
- String toReturn = "";
- for (TableElement table : tableDefinitions) {
- toReturn += table.toString();
- }
- return toReturn;
- }
-
- public Document getXmlDocument() throws ParserConfigurationException {
- Document doc = Jaxp.newDocumentNamespaceAware();
- Element root = doc.createElement(ROOT_TAG);
- doc.appendChild(root);
- for (TableElement table : tableDefinitions) {
- root.appendChild(table.toXml(doc));
- }
- return doc;
- }
-
- @Override
- public Element toXml(Document doc) {
- return null;
- }
-
- private void sortTablesForConstraints() {
- this.tableDefinitions = sortTablesForConstraints(this.tableDefinitions);
- }
-
- private boolean canCreate(TableElement table, Set<String> canCreate) {
- Set<String> dependencies = table.getTableDependency();
- if (canCreate.containsAll(dependencies)) {
- return true;
- }
- return false;
- }
-
- private void markIdentityColumns() {
- for (TableElement aTable : tableDefinitions) {
- determineIdentityColumns(aTable);
- }
- }
-
- private void determineIdentityColumns(TableElement tableDef) {
- List<String> primaryKeys = new ArrayList<String>();
-
- // first get all of the vars used for the primary key
- List<ConstraintElement> constraints = tableDef.getConstraints();
- for (ConstraintElement constraint : constraints) {
- if (constraint.getConstraintType().equals(ConstraintTypes.PRIMARY_KEY)) {
- List<String> columns = constraint.getColumns();
- for (String column : columns) {
- primaryKeys.add(column);
- }
- }
- }
-
- // now go through and remove any of the primary key vars that are foreign keys
- List<ForeignKey> foreignKeys = tableDef.getForeignKeyConstraints();
- for (ForeignKey fkConstraint : foreignKeys) {
- List<String> columns = fkConstraint.getColumns();
- for (String column : columns) {
- primaryKeys.remove(column);
- }
- }
-
- // now we should only be left with those primary keys that are identities.
- // we set them by setting their corresponding identity column to true, a little hokey but that
- // way we don't have to create special data structures for the column
- Map<String, ColumnMetadata> columns = tableDef.getColumns();
- Set<String> columnKeys = columns.keySet();
- for (String key : columnKeys) {
- ColumnMetadata column = columns.get(key);
- if (primaryKeys.contains(column.getId())) {
- column.addColumnField(ColumnFields.identity, Boolean.TRUE.toString());
- }
- }
- }
-
- private List<TableElement> sortTablesForConstraints(List<TableElement> tables) {
- List<TableElement> sorted = new ArrayList<TableElement>();
- Set<String> canCreate = new HashSet<String>();
-
- Map<TableElement, Boolean> toSort = new HashMap<TableElement, Boolean>();
-
- for (TableElement aTable : tables) {
- if (aTable.hasForeignKey()) {
- toSort.put(aTable, false);
- } else {
- sorted.add(aTable);
- canCreate.add(aTable.getFullyQualifiedTableName());
- }
- }
-
- // Prevent for endless loops caused by
- // foreign/primary key discrepancies
- int guard = toSort.size() * 2;
- int count = 0;
- while (toSort.containsValue(false) && count < guard) {
- Set<TableElement> elements = toSort.keySet();
-
- for (TableElement aTable : elements) {
-
- if (!toSort.get(aTable)) {
- if (canCreate(aTable, canCreate)) {
- canCreate.add(aTable.getFullyQualifiedTableName());
- sorted.add(aTable);
- toSort.put(aTable, true);
- }
- }
- }
- count++;
- }
-
- // If we were stuck in an endless loop copy all unsortable tables
- // to the end of the sorted array and return
- if (toSort.containsValue(false)) {
- Set<TableElement> elements = toSort.keySet();
- for (TableElement aTable : elements) {
- if (!toSort.get(aTable)) {
- canCreate.add(aTable.getFullyQualifiedTableName());
- sorted.add(aTable);
- toSort.put(aTable, true);
- }
- }
- }
-
- return sorted;
- }
-
- @Override
- public boolean equals(Object otherObject) {
- if (otherObject instanceof SchemaData == false) {
- return false;
- }
- if (this == otherObject) {
- return true;
- }
- SchemaData that = (SchemaData) otherObject;
- return hasEqualState(that);
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder(37, 11).append(tableDefinitions).append(isSorted).append(schemaLookup).toHashCode();
- }
-
- public Map<String, TableElement> getTableMap() {
- Map<String, TableElement> tableMap = new HashMap<String, TableElement>();
- for (TableElement table : tableDefinitions) {
- tableMap.put(table.getFullyQualifiedTableName(), table);
- }
- return tableMap;
- }
-
- public boolean hasEqualState(SchemaData that) {
- EqualsBuilder equalsBuilder = new EqualsBuilder();
- equalsBuilder.appendSuper(super.equals(that));
-
- Map<String, TableElement> thisTableMap = this.getTableMap();
- Map<String, TableElement> thatTableMap = that.getTableMap();
-
- Set<String> thisKey1 = thisTableMap.keySet();
- Set<String> thatKey2 = thatTableMap.keySet();
-
- boolean toReturn = true;
- if (thisKey1.equals(thatKey2)) {
- for (String key : thisKey1) {
- equalsBuilder.append(thisTableMap.get(key), thatTableMap.get(key));
- }
- toReturn &= equalsBuilder.isEquals();
- } else {
- toReturn = false;
- }
- return toReturn;
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/SchemaDataLookup.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/SchemaDataLookup.java
deleted file mode 100644
index ff4851f021..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/SchemaDataLookup.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.data;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Roberto E. Escobar
- */
-public class SchemaDataLookup {
-
- private final SchemaData schemaData;
-
- public SchemaDataLookup(SchemaData schemaData) {
- this.schemaData = schemaData;
- }
-
- public ColumnMetadata getColumnDefinition(TableElement table, String columnId) {
- Map<String, ColumnMetadata> columns = table.getColumns();
- return getColumnDefinition(columns, columnId);
- }
-
- public static ColumnMetadata getColumnDefinition(Map<String, ColumnMetadata> columns, String columnId) {
- if (columns.containsKey(columnId)) {
- return columns.get(columnId);
- }
- return null;
- }
-
- public TableElement getTableDefinition(String tableName) {
- List<TableElement> list = schemaData.getTablesOrderedByDependency();
- for (TableElement table : list) {
- return table;
- }
- return null;
- }
-}
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
deleted file mode 100644
index 2c7dea32ae..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/SchemaXmlParser.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-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 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;
-import org.eclipse.osee.framework.core.datastore.schema.data.IndexElement.IndexFields;
-import org.eclipse.osee.framework.core.datastore.schema.data.ReferenceClause.OnDeleteEnum;
-import org.eclipse.osee.framework.core.datastore.schema.data.ReferenceClause.OnUpdateEnum;
-import org.eclipse.osee.framework.core.datastore.schema.data.ReferenceClause.ReferencesFields;
-import org.eclipse.osee.framework.core.datastore.schema.data.TableElement.ColumnFields;
-import org.eclipse.osee.framework.core.datastore.schema.data.TableElement.TableDescriptionFields;
-import org.eclipse.osee.framework.core.datastore.schema.data.TableElement.TableSections;
-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;
-import org.w3c.dom.NamedNodeMap;
-
-/**
- * @author Roberto E. Escobar
- */
-public class SchemaXmlParser {
-
- private void parseTableDescription(Element element, TableElement tableEntry) {
- NamedNodeMap attributes = element.getAttributes();
- for (int i = 0; i < attributes.getLength(); i++) {
- Attr attribute = (Attr) attributes.item(i);
- TableDescriptionFields tableField = TableDescriptionFields.valueOf(attribute.getName());
- tableEntry.addTableDescription(tableField, attribute.getValue());
- }
- }
-
- private void parseColumnEntries(Element element, TableElement tableEntry) {
- List<Element> columns = Jaxp.getChildDirects(element, TableSections.Column.name());
- for (Element column : columns) {
- NamedNodeMap attributes = column.getAttributes();
- ColumnMetadata columnMetadata = new ColumnMetadata("");
- for (int i = 0; i < attributes.getLength(); i++) {
- Attr attribute = (Attr) attributes.item(i);
- ColumnFields columnField = ColumnFields.valueOf(attribute.getName());
- columnMetadata.addColumnField(columnField, attribute.getValue().toUpperCase());
- }
- tableEntry.addColumn(columnMetadata);
- }
- }
-
- private void parseConstraintEntries(Element element, TableElement tableEntry) {
- List<Element> constraints = Jaxp.getChildDirects(element, TableSections.Constraint.name());
- for (Element constraint : constraints) {
- Attr type = constraint.getAttributeNode(ConstraintFields.type.name());
- Attr id = constraint.getAttributeNode(ConstraintFields.id.name());
- String schema = constraint.getAttribute(ConstraintFields.schema.name());
- String deferrable = constraint.getAttribute(ConstraintFields.deferrable.name());
- if (type != null && id != null) {
-
- ConstraintElement constraintElement =
- ConstraintFactory.getConstraint(ConstraintTypes.textToType(type.getValue().toUpperCase()),
- schema.toUpperCase(), id.getValue().toUpperCase(),
- deferrable.equalsIgnoreCase(Boolean.toString(true)));
-
- Attr appliesTo = constraint.getAttributeNode(ConstraintFields.appliesTo.name());
- if (appliesTo != null) {
- String[] columns = appliesTo.getValue().split(",");
- for (String column : columns) {
- constraintElement.addColumn(column.toUpperCase());
- }
- }
-
- if (constraintElement instanceof ForeignKey) {
- Element reference = Jaxp.getChildDirect(constraint, ReferenceClause.REFERENCES_TAG);
- if (reference != null) {
- Attr table = reference.getAttributeNode(ReferencesFields.table.name());
- Attr refColumn = reference.getAttributeNode(ReferencesFields.column.name());
- Attr onUpdate = reference.getAttributeNode(ReferencesFields.onUpdate.name());
- Attr onDelete = reference.getAttributeNode(ReferencesFields.onDelete.name());
- String refSchema = reference.getAttribute(ReferencesFields.schema.name());
-
- if (table != null) {
-
- ReferenceClause references =
- new ReferenceClause(refSchema.toUpperCase(), table.getValue().toUpperCase());
- if (refColumn != null) {
- String[] columns = refColumn.getValue().split(",");
- for (String column : columns) {
- references.addColumn(column.toUpperCase());
- }
- }
- if (onUpdate != null) {
- OnUpdateEnum[] values = OnUpdateEnum.values();
- for (OnUpdateEnum value : values) {
- if (value.toString().equals(onUpdate.getValue().toUpperCase())) {
- references.setOnUpdateAction(value);
- }
- }
- }
- if (onDelete != null) {
- OnDeleteEnum[] values = OnDeleteEnum.values();
- for (OnDeleteEnum value : values) {
- if (value.toString().equals(onDelete.getValue().toUpperCase())) {
- references.setOnDeleteAction(value);
- }
- }
- }
- ((ForeignKey) constraintElement).addReference(references);
- }
- }
- }
- tableEntry.addConstraint(constraintElement);
- }
- }
- }
-
- private void parseIndexDataEntries(Element element, TableElement tableEntry) {
- List<Element> indexDataList = Jaxp.getChildDirects(element, TableSections.Index.name());
- for (Element indexDataEntry : indexDataList) {
- String id = indexDataEntry.getAttribute(IndexFields.id.name());
- String ignore = indexDataEntry.getAttribute(IndexFields.mySqlIgnore.name());
- Attr indexType = indexDataEntry.getAttributeNode(IndexFields.type.name());
- String tablespace = indexDataEntry.getAttribute(IndexFields.tablespace.name());
- if (id.length() > 0) {
- IndexElement indexData = new IndexElement(id);
- if (Boolean.parseBoolean(ignore)) {
- indexData.setMySqlIgnore(true);
- }
- if (indexType != null) {
- indexData.setIndexType(indexType.getValue());
- }
- if (tablespace != null) {
- indexData.setTablespace(tablespace);
- }
- parseAppliesToClause(indexDataEntry, indexData);
- tableEntry.addIndexData(indexData);
- }
- }
- }
-
- public void parseAppliesToClause(Element element, IndexElement indexData) {
- List<Element> appliesToList = Jaxp.getChildDirects(element, AppliesToClause.APPLIES_TO_TAG);
- for (Element appliesToElement : appliesToList) {
- String idString = appliesToElement.getAttribute(AppliesToEntries.id.name());
- String sortString = appliesToElement.getAttribute(AppliesToEntries.sort.name());
- if (idString.length() > 0) {
- OrderType orderType = OrderType.Undefined;
- if (sortString.equalsIgnoreCase("Ascending")) {
- orderType = OrderType.Ascending;
- } else if (sortString.equalsIgnoreCase("Descending")) {
- orderType = OrderType.Descending;
- }
- indexData.addAppliesTo(idString, orderType);
- }
- }
- }
-
- public SchemaData parseFromInputStream(InputStream configFile) throws Exception {
- Document document = Jaxp.readXmlDocument(configFile, "UTF-8");
- SchemaData schemaData = new SchemaData();
- List<Element> elements = Jaxp.getChildDirects(document.getDocumentElement(), TableTags.Table.name());
- for (Element element : elements) {
-
- TableElement tableEntry = new TableElement();
-
- parseTableDescription(element, tableEntry);
- parseColumnEntries(element, tableEntry);
- parseConstraintEntries(element, tableEntry);
- parseIndexDataEntries(element, tableEntry);
-
- schemaData.addTableDefinition(tableEntry);
- }
- return schemaData;
- }
-
- public void parseFromSchemaProvider(Collection<IOseeSchemaResource> schemaResources, Map<String, SchemaData> schemas) {
- for (IOseeSchemaResource schemaResource : schemaResources) {
- SchemaData schemaData;
- InputStream inputStream = null;
- try {
- inputStream = new BufferedInputStream(schemaResource.getContent());
- schemaData = parseFromInputStream(inputStream);
- List<TableElement> tables = schemaData.getTablesOrderedByDependency();
- for (TableElement table : tables) {
- String schemaAddress = table.getSchema();
-
- SchemaData schema = null;
- if (!schemas.containsKey(schemaAddress)) {
- schema = new SchemaData();
- schemas.put(schemaAddress, schema);
- } else {
- schema = schemas.get(schemaAddress);
- }
- schema.addTableDefinition(table);
- }
- } 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/data/TableElement.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/TableElement.java
deleted file mode 100644
index 1833f6a11c..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/TableElement.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.data;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-import org.apache.commons.lang.builder.EqualsBuilder;
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.eclipse.osee.framework.jdk.core.persistence.Xmlizable;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * @author Roberto E. Escobar
- */
-public class TableElement implements Xmlizable {
-
- public enum TableTags {
- Table,
- ColumnInfo,
- Row;
- }
-
- public enum TableSections {
- Column,
- Constraint,
- Index;
- };
-
- public enum TableDescriptionFields {
- name,
- schema,
- backupData,
- importData,
- importFrom,
- tablespace;
- };
-
- public enum ColumnFields {
- id,
- type,
- limits,
- identity,
- defaultValue;
- ;
- };
-
- private final Map<TableDescriptionFields, String> tableDescription;
- private final Map<String, ColumnMetadata> columns;
- private final List<ConstraintElement> constraints;
- private final List<ForeignKey> foreignKeys;
- private final List<IndexElement> indices;
-
- public TableElement() {
- this.tableDescription = new HashMap<TableDescriptionFields, String>();
- this.columns = new HashMap<String, ColumnMetadata>();
- this.constraints = new ArrayList<ConstraintElement>();
- this.foreignKeys = new ArrayList<ForeignKey>();
- this.indices = new ArrayList<IndexElement>();
- }
-
- public void addColumn(ColumnMetadata column) {
- this.columns.put(column.getId(), column);
- }
-
- public void addConstraint(ConstraintElement constraint) {
- if (constraint instanceof ForeignKey) {
- foreignKeys.add((ForeignKey) constraint);
- } else {
- constraints.add(constraint);
- }
- }
-
- public void addIndexData(IndexElement indexData) {
- indices.add(indexData);
- }
-
- public String getSchema() {
- return this.tableDescription.get(TableDescriptionFields.schema);
- }
-
- public String getName() {
- return this.tableDescription.get(TableDescriptionFields.name);
- }
-
- public boolean isBackupDataSet() {
- if (this.tableDescription.containsKey(TableDescriptionFields.backupData)) {
- return Boolean.parseBoolean(this.tableDescription.get(TableDescriptionFields.backupData));
- }
- return false;
- }
-
- public boolean isImportDataSet() {
- if (this.tableDescription.containsKey(TableDescriptionFields.importData)) {
- return Boolean.parseBoolean(this.tableDescription.get(TableDescriptionFields.importData));
- }
- return false;
- }
-
- public String getImportFrom() {
- if (this.tableDescription.containsKey(TableDescriptionFields.importFrom)) {
- return this.tableDescription.get(TableDescriptionFields.importFrom);
- }
- return null;
- }
-
- public void addTableDescription(TableDescriptionFields field, String value) {
- if (!field.equals(TableDescriptionFields.importFrom)) {
- value = value.toUpperCase();
- }
- value = value.trim();
- this.tableDescription.put(field, value);
- }
-
- public Map<String, ColumnMetadata> getColumns() {
- return this.columns;
- }
-
- public Map<TableDescriptionFields, String> getDescription() {
- return this.tableDescription;
- }
-
- public boolean hasForeignKey() {
- return foreignKeys.size() > 0;
- }
-
- public String getFullyQualifiedTableName() {
- if (getSchema() == null) {
- return getName();
- } else {
- return getSchema() + "." + getName();
- }
- }
-
- public List<ConstraintElement> getConstraints() {
- return constraints;
- }
-
- public List<ForeignKey> getForeignKeyConstraints() {
- return foreignKeys;
- }
-
- public List<IndexElement> getIndexData() {
- return indices;
- }
-
- @Override
- public String toString() {
- StringBuilder toReturn = new StringBuilder();
- toReturn.append(" Table : \n");
- Set<TableDescriptionFields> keys = tableDescription.keySet();
- for (TableDescriptionFields key : keys) {
- toReturn.append(" \t" + key.toString() + ": " + tableDescription.get(key));
- }
- toReturn.append("\n");
- int count = 0;
- Set<String> columnKeys = columns.keySet();
- for (String key : columnKeys) {
- toReturn.append("\t[" + ++count + "] " + columns.get(key).toString() + "\n");
- }
- count = 0;
- for (ConstraintElement constraint : constraints) {
- toReturn.append("\t[" + ++count + "] " + constraint.toString() + "\n");
- }
- for (ForeignKey fkeys : foreignKeys) {
- toReturn.append("\t[" + ++count + "] " + fkeys.toString() + "\n");
- }
- count = 0;
- for (IndexElement iData : indices) {
- toReturn.append("\t[" + ++count + "] " + iData.toString() + "\n");
- }
- return toReturn.toString();
- }
-
- /**
- * @param doc The XML document we're creating the XML for
- * @return The XML Element corresponding to this
- */
- @Override
- public Element toXml(Document doc) {
- Element tableElement = doc.createElement(TableTags.Table.name());
- for (TableDescriptionFields key : tableDescription.keySet()) {
- tableElement.setAttribute(key.toString(), tableDescription.get(key));
- }
- for (String key : columns.keySet()) {
- tableElement.appendChild(columns.get(key).toXml(doc));
- }
- for (ConstraintElement constraint : constraints) {
- tableElement.appendChild(constraint.toXml(doc));
- }
- for (ForeignKey constraint : foreignKeys) {
- tableElement.appendChild(constraint.toXml(doc));
- }
- for (IndexElement iData : indices) {
- tableElement.appendChild(iData.toXml(doc));
- }
- return tableElement;
- }
-
- public Set<String> getTableDependency() {
- Set<String> dependency = new TreeSet<String>();
- for (ForeignKey fk : foreignKeys) {
- Set<String> refTables = fk.getReferencedTables();
- for (String tableName : refTables) {
- dependency.add(tableName);
- }
- }
- return dependency;
- }
-
- @Override
- public boolean equals(Object otherObject) {
- if (otherObject instanceof TableElement == false) {
- return false;
- }
- if (this == otherObject) {
- return true;
- }
- TableElement that = (TableElement) otherObject;
- return new EqualsBuilder().appendSuper(super.equals(otherObject)).append(this.tableDescription,
- that.getDescription()).append(this.columns, that.getColumns()).append(this.constraints, that.getConstraints()).append(
- this.foreignKeys, that.getForeignKeyConstraints()).append(this.indices, that.getIndexData()).isEquals();
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder(79, 17).append(tableDescription).append(columns).append(constraints).append(
- foreignKeys).append(indices).toHashCode();
- }
-
- public String getTablespace() {
- String toReturn = getDescription().get(TableDescriptionFields.tablespace);
- return Strings.isValid(toReturn) ? toReturn : "";
- }
-
- public void setTablespace(String value) {
- getDescription().put(TableDescriptionFields.tablespace, value);
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/BackupTableDataOperation.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/BackupTableDataOperation.java
deleted file mode 100644
index 0172da2f12..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/BackupTableDataOperation.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.operations;
-
-import java.io.File;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.core.datastore.internal.Activator;
-import org.eclipse.osee.framework.core.datastore.schema.data.SchemaData;
-import org.eclipse.osee.framework.core.datastore.schema.data.TableElement;
-import org.eclipse.osee.framework.core.operation.AbstractOperation;
-import org.eclipse.osee.framework.database.IOseeDatabaseService;
-
-public class BackupTableDataOperation extends AbstractOperation {
- private final File backupDirectory;
- private final Set<String> schemas;
- private final Map<String, SchemaData> userSpecifiedConfig;
- private final Map<String, SchemaData> currentDatabaseConfig;
- private final IOseeDatabaseService databaseService;
-
- public BackupTableDataOperation(IOseeDatabaseService databaseService, String backupDirPath, Set<String> schemas, Map<String, SchemaData> userSpecifiedConfig, Map<String, SchemaData> currentDatabaseConfig) {
- super("Backup Table Data", Activator.PLUGIN_ID);
- this.databaseService = databaseService;
- this.schemas = schemas;
- this.userSpecifiedConfig = userSpecifiedConfig;
- this.currentDatabaseConfig = currentDatabaseConfig;
- this.backupDirectory = new File("BackupDirectory");
- }
-
- @Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
- Set<String> dataToBackup = getTablesToBackup();
- if (dataToBackup.size() > 0) {
- System.out.println(dataToBackup.toString().replaceAll(", ", "\n"));
- clearBackupDirectory();
- DatabaseDataExtractor dbDataExtractor = new DatabaseDataExtractor(databaseService, schemas, backupDirectory);
- Set<String> backupTables = dataToBackup;
- for (String backupTable : backupTables) {
- dbDataExtractor.addTableNameToExtract(backupTable);
- }
- doSubWork(dbDataExtractor, monitor, 0.90);
- dbDataExtractor.waitForWorkerThreads();
- }
- }
-
- private Set<String> getTablesToBackup() {
- Set<String> backupTables = new TreeSet<String>();
- Set<String> userSchemas = userSpecifiedConfig.keySet();
- for (String key : userSchemas) {
- // Backup data only if data exists in the current database
- if (currentDatabaseConfig.containsKey(key)) {
- SchemaData schemaDataInDb = currentDatabaseConfig.get(key);
- Map<String, TableElement> currentDbTableMap = schemaDataInDb.getTableMap();
- Set<String> currentDbTableNames = currentDbTableMap.keySet();
-
- SchemaData schemaData = userSpecifiedConfig.get(key);
- Set<String> tableNamesToBackup = schemaData.getTablesToBackup();
- for (String tableName : tableNamesToBackup) {
- // Check that table we want to backup exists in the database
- // before we add it to the list
- if (currentDbTableNames.contains(tableName)) {
- backupTables.add(tableName);
- } else {
- System.out.println("Table doesn't exist in Db. Unable to backup [" + tableName + "]");
- }
- }
- } else {
- System.out.println("Schema doesn't exist in Db. Unable to backup tables from schema [" + key + "]");
- }
- }
- return backupTables;
- }
-
- private void clearBackupDirectory() {
- if (backupDirectory != null && backupDirectory.exists() && backupDirectory.canWrite()) {
- File[] fileList = backupDirectory.listFiles();
- for (File fileToDelete : fileList) {
- fileToDelete.delete();
- }
- backupDirectory.delete();
- backupDirectory.mkdirs();
- }
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/CreateSchemaOperation.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/CreateSchemaOperation.java
deleted file mode 100644
index a4d46bb783..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/CreateSchemaOperation.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.operations;
-
-import java.sql.DatabaseMetaData;
-import java.util.Map;
-import java.util.Set;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.core.datastore.internal.Activator;
-import org.eclipse.osee.framework.core.datastore.schema.data.SchemaData;
-import org.eclipse.osee.framework.core.datastore.schema.sql.SchemaSqlUtil;
-import org.eclipse.osee.framework.core.datastore.schema.sql.SqlFactory;
-import org.eclipse.osee.framework.core.datastore.schema.sql.SqlManager;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.database.IOseeDatabaseService;
-import org.eclipse.osee.framework.database.core.AbstractDbTxOperation;
-import org.eclipse.osee.framework.database.core.OseeConnection;
-import org.eclipse.osee.framework.database.core.SupportedDatabase;
-
-/**
- * @author Roberto E. Escobar
- */
-public class CreateSchemaOperation extends AbstractDbTxOperation {
- private final Map<String, SchemaData> userSchema;
- private final Map<String, SchemaData> dbSchema;
-
- public CreateSchemaOperation(IOseeDatabaseService databaseService, Map<String, SchemaData> userSchema, Map<String, SchemaData> dbSchema) {
- super(databaseService, "Create Schema", Activator.PLUGIN_ID);
- this.userSchema = userSchema;
- this.dbSchema = dbSchema;
- }
-
- @Override
- protected void doTxWork(IProgressMonitor monitor, OseeConnection connection) throws OseeCoreException {
- DatabaseMetaData metaData = connection.getMetaData();
- SupportedDatabase dbType = SupportedDatabase.getDatabaseType(metaData);
- SqlManager sqlManager = SqlFactory.getSqlManager(metaData);
- SchemaSqlUtil dbInit = new SchemaSqlUtil(sqlManager);
-
- Set<String> schemas = userSchema.keySet();
-
- dbInit.dropIndices(schemas, userSchema, dbSchema);
- dbInit.dropTables(schemas, userSchema, dbSchema);
-
- if (dbType == SupportedDatabase.postgresql || dbType == SupportedDatabase.h2) {
- dbInit.dropSchema(schemas);
- dbInit.createSchema(schemas);
- }
- dbInit.addTables(schemas, userSchema);
- dbInit.addIndices(schemas, userSchema);
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/DatabaseDataExtractor.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/DatabaseDataExtractor.java
deleted file mode 100644
index bbdc59a316..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/DatabaseDataExtractor.java
+++ /dev/null
@@ -1,253 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.core.datastore.schema.operations;
-
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.OutputStream;
-import java.math.BigDecimal;
-import java.sql.Date;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.sql.Types;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.logging.Level;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamWriter;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.core.datastore.internal.Activator;
-import org.eclipse.osee.framework.core.datastore.schema.data.SchemaData;
-import org.eclipse.osee.framework.core.datastore.schema.data.TableElement;
-import org.eclipse.osee.framework.core.datastore.schema.data.TableElement.ColumnFields;
-import org.eclipse.osee.framework.core.datastore.schema.data.TableElement.TableDescriptionFields;
-import org.eclipse.osee.framework.core.datastore.schema.data.TableElement.TableTags;
-import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
-import org.eclipse.osee.framework.core.operation.AbstractOperation;
-import org.eclipse.osee.framework.database.IOseeDatabaseService;
-import org.eclipse.osee.framework.database.core.IOseeStatement;
-import org.eclipse.osee.framework.database.core.SQL3DataType;
-import org.eclipse.osee.framework.database.core.SupportedDatabase;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.logging.OseeLog;
-
-/**
- * @author Roberto E. Escobar
- */
-public class DatabaseDataExtractor extends AbstractOperation {
-
- private static final String SQL_WILD_QUERY = "SELECT * FROM ";
- private final Set<String> schemas;
- private final File directory;
- private final List<Thread> workerThreads;
- private final Set<String> extractTables;
-
- private class ColumnInfo {
- String name;
- SQL3DataType type;
- }
-
- private final IOseeDatabaseService databaseService;
-
- public DatabaseDataExtractor(IOseeDatabaseService databaseService, Set<String> schemas, File directory) {
- super("Extract Database Data", Activator.PLUGIN_ID);
- this.databaseService = databaseService;
- this.schemas = schemas;
- this.directory = directory;
- this.workerThreads = new ArrayList<Thread>();
- this.extractTables = new TreeSet<String>();
- }
-
- public void addTableNameToExtract(String fullyQualifiedTableName) {
- this.extractTables.add(fullyQualifiedTableName);
- }
-
- public void clearFilter() {
- this.extractTables.clear();
- }
-
- @Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
- FileUtility.setupDirectoryForWrite(directory);
-
- Map<String, SchemaData> schemaDataMap = new HashMap<String, SchemaData>();
- ExtractDatabaseSchemaOperation operation =
- new ExtractDatabaseSchemaOperation(databaseService, schemas, schemaDataMap);
- doSubWork(operation, monitor, 0.20);
-
- Set<String> schemaKeys = schemaDataMap.keySet();
- for (String schema : schemaKeys) {
- SchemaData schemaData = schemaDataMap.get(schema);
-
- List<TableElement> tables = schemaData.getTablesOrderedByDependency();
- for (TableElement table : tables) {
-
- boolean extract = true;
- // only extract items in filter since filter was set with data
- if (this.extractTables != null && this.extractTables.size() > 0) {
- extract = extractTables.contains(table.getFullyQualifiedTableName());
- }
-
- if (extract) {
- DataExtractorThread workerThread = new DataExtractorThread(table);
- workerThreads.add(workerThread);
- workerThread.start();
- }
- }
- }
- }
-
- private class DataExtractorThread extends Thread {
- private final TableElement table;
-
- public DataExtractorThread(TableElement table) {
- this.table = table;
- setName(table.getName() + " Extractor");
- }
-
- @Override
- public void run() {
- IOseeStatement chStmt = null;
- OutputStream outputStream = null;
- try {
- chStmt = databaseService.getStatement();
- String fileName = table.getFullyQualifiedTableName() + FileUtility.DB_DATA_EXTENSION;
- outputStream = new BufferedOutputStream(new FileOutputStream(new File(directory, fileName)));
-
- try {
- chStmt.runPreparedQuery(SQL_WILD_QUERY + table.getFullyQualifiedTableName());
- } catch (OseeDataStoreException ex) {
- chStmt.runPreparedQuery(SQL_WILD_QUERY + table.getName());
- }
-
- buildXml(chStmt, table, outputStream);
- } catch (Exception ex) {
- OseeLog.log(Activator.class, Level.SEVERE,
- "Error Processing Table [ " + table.getSchema() + "." + table.getName() + " ] Data ", ex);
- } finally {
- Lib.close(chStmt);
- Lib.close(outputStream);
- }
- }
- }
-
- public void waitForWorkerThreads() {
- for (Thread worker : workerThreads) {
- try {
- worker.join();
- } catch (InterruptedException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, "Thread [" + worker.getName() + "] was Interrupted. ", ex);
- }
- }
- }
-
- private void buildXml(IOseeStatement chStmt, TableElement table, OutputStream outputStream) throws Exception {
- ArrayList<ColumnInfo> columns = new ArrayList<ColumnInfo>();
- int numberOfColumns = chStmt.getColumnCount();
- for (int index = 1; index <= numberOfColumns; index++) {
- ColumnInfo columnInfo = new ColumnInfo();
- columnInfo.name = chStmt.getColumnName(index);
- columnInfo.name = columnInfo.name.toUpperCase();
-
- int dataType = chStmt.getColumnType(index);
- if (chStmt.isDatabaseType(SupportedDatabase.foxpro)) {
- if (dataType == Types.CHAR) {
- dataType = Types.VARCHAR;
- }
- }
- columnInfo.type = SQL3DataType.get(dataType);
- columns.add(columnInfo);
- }
-
- XMLOutputFactory factory = XMLOutputFactory.newInstance();
- XMLStreamWriter writer = factory.createXMLStreamWriter(outputStream);
- writer.writeStartDocument("UTF-8", "1.0");
- writer.writeStartElement(TableTags.Table.name());
- writer.writeAttribute(TableDescriptionFields.schema.name(), table.getSchema());
- writer.writeAttribute(TableDescriptionFields.name.name(), table.getName());
-
- for (ColumnInfo info : columns) {
- writer.writeStartElement(TableTags.ColumnInfo.name());
- writer.writeAttribute(ColumnFields.id.name(), info.name);
- writer.writeAttribute(ColumnFields.type.name(), info.type.name());
- writer.writeEndElement();
- }
-
- while (chStmt.next()) {
- writer.writeStartElement(TableTags.Row.name());
- for (ColumnInfo column : columns) {
- String columnValue;
- switch (column.type) {
- case BIGINT:
- BigDecimal bigD = chStmt.getBigDecimal(column.name);
- columnValue = bigD != null ? bigD.toString() : "";
- break;
- case DATE:
- Date date = chStmt.getDate(column.name);
- columnValue = date != null ? date.toString() : "";
- break;
- case TIME:
- Time time = chStmt.getTime(column.name);
- columnValue = time != null ? time.toString() : "";
- break;
- case TIMESTAMP:
- Timestamp timestamp = chStmt.getTimestamp(column.name);
- columnValue = timestamp != null ? timestamp.toString() : "";
- break;
- default:
- columnValue = chStmt.getString(column.name);
- columnValue = handleSpecialCharacters(columnValue);
- break;
- }
- writer.writeAttribute(column.name, (columnValue != null ? columnValue : ""));
- }
- writer.writeEndElement();
- }
- writer.writeEndElement();
- writer.writeEndDocument();
- writer.flush();
- }
-
- private String handleSpecialCharacters(String value) {
- // \0 An ASCII 0 (NUL) character.
- // '' A single quote character.
- // \b A backspace character.
- // \n A newline (linefeed) character.
- // \r A carriage return character.
- // \t A tab character.
- // \Z ASCII 26 (Control-Z). See note following the table.
-
- if (value != null) {
-
- value = value.replaceAll("\0", "");
- value = value.replaceAll("'", "''");
- // value = value.replaceAll("\"", "\\\\\""); No need to do this.
- Pattern pattern =
- Pattern.compile("[^" + "a-zA-Z0-9" + "!@#$%\\^&*\\(\\)" + "+ _.-=" + "\'\"<>{}\\[\\]|:;,\n\r\t\b?/`~\\\\]+");
- Matcher matcher = pattern.matcher(value);
-
- while (matcher.find()) {
- // System.out.println("Matcher: [" + matcher.group() + "]");
- value = value.replace(matcher.group(), "");
- }
- }
- return value;
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/DatabaseDataImporter.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/DatabaseDataImporter.java
deleted file mode 100644
index c80a33c7d4..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/DatabaseDataImporter.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.operations;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.logging.Level;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import org.eclipse.osee.framework.core.datastore.internal.Activator;
-import org.eclipse.osee.framework.core.datastore.schema.data.ColumnDbData;
-import org.eclipse.osee.framework.core.datastore.schema.data.ColumnMetadata;
-import org.eclipse.osee.framework.core.datastore.schema.data.TableElement;
-import org.eclipse.osee.framework.core.datastore.schema.data.TableElement.ColumnFields;
-import org.eclipse.osee.framework.core.datastore.schema.data.TableElement.TableDescriptionFields;
-import org.eclipse.osee.framework.core.datastore.schema.data.TableElement.TableTags;
-import org.eclipse.osee.framework.core.datastore.schema.sql.SqlManager;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * @author Roberto E. Escobar
- */
-public class DatabaseDataImporter {
- private final File directory;
- private final SqlManager sqlManager;
- private List<String> tableOrder;
- private String schemaToImportTo;
- private final Set<String> tableFilter;
-
- private class TableData extends TableElement {
- private final List<List<ColumnDbData>> rowData;
-
- public TableData() {
- rowData = new ArrayList<List<ColumnDbData>>();
- }
-
- public void addRow(List<ColumnDbData> row) {
- rowData.add(row);
- }
-
- public List<List<ColumnDbData>> getRows() {
- return rowData;
- }
- }
-
- public DatabaseDataImporter(File directory, SqlManager sqlManager) {
- this.directory = directory;
- this.sqlManager = sqlManager;
- this.tableFilter = new TreeSet<String>();
- }
-
- public void setImportOrder(List<String> tableOrder) {
- this.tableOrder = tableOrder;
- }
-
- public void setSchemaToImportTo(String schema) {
- this.schemaToImportTo = schema;
- }
-
- public void addToTableFilter(String fullyQualifiedTableName) {
- this.tableFilter.add(fullyQualifiedTableName);
- }
-
- public void clearTableFilter() {
- this.tableFilter.clear();
- }
-
- public List<File> orderFilesByImportOrder(Map<String, File> toOrder) {
- List<File> orderedSet = new ArrayList<File>();
- if (tableOrder != null && tableOrder.size() != 0) {
- for (String tableName : tableOrder) {
- String fileName = tableName + FileUtility.DB_DATA_EXTENSION;
- File file = toOrder.get(fileName);
- if (file != null) {
- orderedSet.add(file);
- }
- }
- } else {
- Set<String> keys = toOrder.keySet();
- for (String key : keys) {
- orderedSet.add(toOrder.get(key));
- }
- }
- return orderedSet;
- }
-
- public Map<String, File> filterDataToImport(Map<String, File> toProcess) {
- Map<String, File> filteredList = new HashMap<String, File>();
- if (tableFilter != null && tableFilter.size() != 0) {
- for (String tableName : tableFilter) {
- String fileName = tableName + FileUtility.DB_DATA_EXTENSION;
- File file = toProcess.get(fileName);
- if (file != null) {
- filteredList.put(fileName, file);
- }
- }
- } else {
- return toProcess;
- }
- return filteredList;
- }
-
- public void importDataIntoDatabase() {
- if (FileUtility.isValidDirectory(directory)) {
- Map<String, File> filesToProcess = getFilesToProcess();
- Map<String, File> filteredFiles = filterDataToImport(filesToProcess);
- List<File> files = orderFilesByImportOrder(filteredFiles);
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- DocumentBuilder builder;
- Document document;
- for (File file : files) {
- try {
- builder = factory.newDocumentBuilder();
- document = builder.parse(file);
- processData(parseXMLDbDataFile(document));
- } catch (ParserConfigurationException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, "Unable to Parse File. ", ex);
- } catch (Exception ex) {
- OseeLog.log(Activator.class, Level.SEVERE, "Exception: \n", ex);
- }
- }
- }
- }
-
- private Map<String, File> getFilesToProcess() {
- Map<String, File> toReturn = new HashMap<String, File>();
- List<File> files = FileUtility.getDBDataFileList(directory);
- for (File fileName : files) {
- toReturn.put(fileName.getName(), new File(directory + File.separator + fileName.getName()));
- }
- return toReturn;
- }
-
- private void processData(List<TableData> tables) throws OseeCoreException {
- if (tables.size() != 0) {
- for (TableData tableData : tables) {
- OseeLog.log(Activator.class, Level.INFO, "Populating: [ " + tableData.getFullyQualifiedTableName() + "]\n");
- List<List<ColumnDbData>> rows = tableData.getRows();
- if (!rows.isEmpty()) {
- for (List<ColumnDbData> rowData : rows) {
- sqlManager.insertData(rowData, tableData);
- }
- }
- }
- }
- }
-
- private void parseColumnMetadata(Element tableElement, TableData tableData) {
- NodeList columnElements = tableElement.getElementsByTagName(TableTags.ColumnInfo.name());
- if (columnElements != null) {
- for (int index = 0; index < columnElements.getLength(); index++) {
- Element columnElement = (Element) columnElements.item(index);
- if (columnElement != null) {
-
- NamedNodeMap attributeMap = columnElement.getAttributes();
- if (attributeMap != null && attributeMap.getLength() != 0) {
- ColumnMetadata columnMetaData = new ColumnMetadata("");
- for (int attributeIndex = 0; attributeIndex < attributeMap.getLength(); attributeIndex++) {
- Node node = attributeMap.item(attributeIndex);
- String nodeName = node.getNodeName();
- String nodeValue = node.getTextContent();
- if (Strings.isValid(nodeName)) {
- columnMetaData.addColumnField(ColumnFields.valueOf(nodeName),
- (nodeValue != null ? nodeValue : ""));
- }
- }
- tableData.addColumn(columnMetaData);
- }
- }
- }
- }
- }
-
- private void parseRowInformation(Element tableElement, TableData tableData) {
- NodeList rowElements = tableElement.getElementsByTagName(TableTags.Row.name());
- if (rowElements != null) {
- for (int rowIndex = 0; rowIndex < rowElements.getLength(); rowIndex++) {
- Element row = (Element) rowElements.item(rowIndex);
- if (row != null) {
- NamedNodeMap attributeMap = row.getAttributes();
- if (attributeMap != null && attributeMap.getLength() != 0) {
- List<ColumnDbData> rowData = new ArrayList<ColumnDbData>();
- tableData.addRow(rowData);
- for (int attributeIndex = 0; attributeIndex < attributeMap.getLength(); attributeIndex++) {
- Node node = attributeMap.item(attributeIndex);
- String nodeName = node.getNodeName();
- String nodeValue = node.getTextContent();
- if (Strings.isValid(nodeName)) {
- rowData.add(new ColumnDbData(nodeName, (nodeValue != null ? nodeValue : "")));
- }
- }
- }
- }
- }
- }
- }
-
- private List<TableData> parseXMLDbDataFile(Document document) {
- NodeList tableElements = document.getElementsByTagName(TableTags.Table.name());
- List<TableData> tables = new ArrayList<TableData>();
- for (int index = 0; index < tableElements.getLength(); index++) {
- Element tableXmlElement = (Element) tableElements.item(index);
- if (tableXmlElement != null) {
- NamedNodeMap map = tableXmlElement.getAttributes();
- if (map != null && map.getLength() != 0) {
- Node tableName = map.getNamedItem(TableDescriptionFields.name.name());
- Node tableAddress = map.getNamedItem(TableDescriptionFields.schema.name());
- String tableNameString = "";
- String tableAddressString = "";
- if (tableName != null) {
- tableNameString = tableName.getTextContent();
- }
- if (tableAddress != null) {
- tableAddressString = tableAddress.getTextContent();
- }
-
- if (Strings.isValid(tableNameString) && Strings.isValid(tableAddressString)) {
- TableData tableData = new TableData();
- tableData.addTableDescription(TableDescriptionFields.name, tableNameString);
- if (Strings.isValid(this.schemaToImportTo)) {
- tableData.addTableDescription(TableDescriptionFields.schema, schemaToImportTo);
- } else {
- tableData.addTableDescription(TableDescriptionFields.schema, tableAddressString);
- }
- parseRowInformation(tableXmlElement, tableData);
- parseColumnMetadata(tableXmlElement, tableData);
- tables.add(tableData);
- }
- }
- }
- }
- return tables;
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/ExtractDatabaseSchemaOperation.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/ExtractDatabaseSchemaOperation.java
deleted file mode 100644
index 552ef8ee05..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/ExtractDatabaseSchemaOperation.java
+++ /dev/null
@@ -1,478 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.operations;
-
-import java.sql.DatabaseMetaData;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Types;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.core.datastore.internal.Activator;
-import org.eclipse.osee.framework.core.datastore.schema.data.AppliesToClause;
-import org.eclipse.osee.framework.core.datastore.schema.data.AppliesToClause.OrderType;
-import org.eclipse.osee.framework.core.datastore.schema.data.ColumnMetadata;
-import org.eclipse.osee.framework.core.datastore.schema.data.ConstraintElement;
-import org.eclipse.osee.framework.core.datastore.schema.data.ConstraintFactory;
-import org.eclipse.osee.framework.core.datastore.schema.data.ConstraintTypes;
-import org.eclipse.osee.framework.core.datastore.schema.data.ForeignKey;
-import org.eclipse.osee.framework.core.datastore.schema.data.IndexElement;
-import org.eclipse.osee.framework.core.datastore.schema.data.ReferenceClause;
-import org.eclipse.osee.framework.core.datastore.schema.data.ReferenceClause.OnDeleteEnum;
-import org.eclipse.osee.framework.core.datastore.schema.data.ReferenceClause.OnUpdateEnum;
-import org.eclipse.osee.framework.core.datastore.schema.data.SchemaData;
-import org.eclipse.osee.framework.core.datastore.schema.data.TableElement;
-import org.eclipse.osee.framework.core.datastore.schema.data.TableElement.ColumnFields;
-import org.eclipse.osee.framework.core.datastore.schema.data.TableElement.TableDescriptionFields;
-import org.eclipse.osee.framework.core.operation.AbstractOperation;
-import org.eclipse.osee.framework.database.IOseeDatabaseService;
-import org.eclipse.osee.framework.database.core.OseeConnection;
-import org.eclipse.osee.framework.database.core.SQL3DataType;
-import org.eclipse.osee.framework.database.core.SupportedDatabase;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ExtractDatabaseSchemaOperation extends AbstractOperation {
- private static final String DEFAULT_FILTER = "BIN.*";
- private static final Pattern sqlPattern = Pattern.compile("SQL\\d+");
-
- private DatabaseMetaData dbData;
- private String dbName;
- private String dbVersion;
- private final Map<String, SchemaData> database;
- private final List<String> filter = new ArrayList<String>();
- private final Set<String> tablesToExtract = new TreeSet<String>();
- private final Set<String> schemas;
- private final IOseeDatabaseService dbService;
- private final Matcher indexMatcher;
-
- public ExtractDatabaseSchemaOperation(IOseeDatabaseService dbService, Set<String> schemas, Map<String, SchemaData> schemaData) {
- super("Extract Database Schema", Activator.PLUGIN_ID);
- this.dbService = dbService;
- this.schemas = schemas;
- this.database = schemaData;
- filter.add(DEFAULT_FILTER);
- this.indexMatcher = sqlPattern.matcher("");
- }
-
- @Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
- OseeConnection connection = dbService.getConnection();
- try {
- this.dbData = connection.getMetaData();
-
- this.dbName = dbData.getDatabaseProductName();
- this.dbVersion = dbData.getDatabaseProductVersion();
-
- for (String schema : schemas) {
- SchemaData dbTables = getTableInformation(schema);
- database.put(schema, dbTables);
- }
- } finally {
- connection.close();
- }
- }
-
- public void addToFilter(String value) {
- filter.add(value);
- }
-
- @Override
- public String toString() {
- StringBuilder buffer = new StringBuilder();
- Set<String> keys = database.keySet();
- for (String schema : keys) {
- SchemaData tableData = database.get(schema);
- buffer.append(" Schema: \n");
- buffer.append(schema);
- buffer.append("\n");
- buffer.append(tableData.toString());
- }
- return String.format("Name: [%s]\tVer: [%s]\n%s", dbName, dbVersion, buffer);
- }
-
- private boolean isFiltered(String value) {
- for (String filterExpression : filter) {
- Pattern searchPattern = Pattern.compile(filterExpression, Pattern.DOTALL);
- Matcher matcher = searchPattern.matcher(value);
- if (matcher.find()) {
- return true;
- }
- }
- return false;
- }
-
- public void addTableToExtract(String fullyqualifiedTableName) {
- this.tablesToExtract.add(fullyqualifiedTableName);
- }
-
- public void clearTableFilter() {
- tablesToExtract.clear();
- }
-
- private SchemaData getTableInformation(String schema) throws Exception {
- SchemaData dbTables = new SchemaData();
- ResultSet resultSet = null;
- try {
- resultSet = dbData.getTables(null, schema, null, new String[] {"TABLE"});
- if (resultSet != null) {
- while (resultSet.next()) {
- String tableName = resultSet.getString("TABLE_NAME").toUpperCase();
- String schemaName = resultSet.getString("TABLE_SCHEM");
- if (tableName != null && !isFiltered(tableName) && schemaName.equalsIgnoreCase(schema)) {
- boolean extract = true;
- if (!tablesToExtract.isEmpty()) {
- extract = tablesToExtract.contains(schema + "." + tableName);
- }
-
- if (extract) {
- TableElement tableEntry = new TableElement();
- tableEntry.addTableDescription(TableDescriptionFields.name, tableName);
- tableEntry.addTableDescription(TableDescriptionFields.schema, schemaName);
- getColumnInformation(tableEntry);
- getColumnPrimaryKey(tableEntry);
-
- if (!(SupportedDatabase.isDatabaseType(dbData, SupportedDatabase.foxpro) || SupportedDatabase.isDatabaseType(
- dbData, SupportedDatabase.postgresql))) {
- getColumnForeignKey(tableEntry);
- }
- getIndexInfo(tableEntry);
- dbTables.addTableDefinition(tableEntry);
- }
- }
- }
- }
- } finally {
- if (resultSet != null) {
- resultSet.close();
- }
- }
- return dbTables;
- }
-
- private void getColumnInformation(TableElement aTable) throws Exception {
- ResultSet columns = null;
- try {
- try {
- columns = dbData.getColumns(null, aTable.getSchema(), aTable.getName(), null);
- } catch (SQLException ex) {
- columns = dbData.getColumns(null, null, aTable.getName(), null);
- }
- while (columns.next()) {
- String id = columns.getString("COLUMN_NAME");
- id = id.toUpperCase();
- ColumnMetadata column = new ColumnMetadata(id);
-
- int dataType = columns.getInt("DATA_TYPE");
- if (SupportedDatabase.isDatabaseType(dbData, SupportedDatabase.foxpro)) {
- if (dataType == Types.CHAR) {
- dataType = Types.VARCHAR;
- }
- }
- String dataTypeName = SQL3DataType.get(dataType).name();
- column.addColumnField(ColumnFields.type, dataTypeName);
-
- String defaultValue = "";
- int defaultType = columns.getInt("NULLABLE");
- switch (defaultType) {
- case java.sql.DatabaseMetaData.columnNoNulls:
- defaultValue = "not null";
- break;
- case java.sql.DatabaseMetaData.columnNullable:
- // Dont specify if Null - Let DB Decide.
- defaultValue = "";
- break;
- case java.sql.DatabaseMetaData.columnNullableUnknown:
- default:
- // Since unknown then don't specify
- defaultValue = "";
- break;
- }
- if (!defaultValue.equals("")) {
- column.addColumnField(ColumnFields.defaultValue, defaultValue);
- }
-
- if (!SupportedDatabase.isDatabaseType(dbData, SupportedDatabase.foxpro)) {
- // int dataType = columns.getInt("DATA_TYPE");
- switch (dataType) {
- case java.sql.Types.CHAR:
- case java.sql.Types.VARCHAR:
- String limits = columns.getString("COLUMN_SIZE");
- if (Strings.isValid(limits)) {
- column.addColumnField(ColumnFields.limits, limits);
- }
- break;
- case java.sql.Types.DECIMAL:
- case java.sql.Types.NUMERIC:
- limits = columns.getString("COLUMN_SIZE");
- String decimal = columns.getString("DECIMAL_DIGITS");
- if (Strings.isValid(decimal)) {
- if (Strings.isValid(limits)) {
- limits += "," + decimal;
- }
- }
- if (Strings.isValid(limits)) {
- column.addColumnField(ColumnFields.limits, limits);
- }
- default:
- break;
- }
- } else {
- switch (dataType) {
- case java.sql.Types.CHAR:
- case java.sql.Types.VARCHAR:
- String limits = "255";
- column.addColumnField(ColumnFields.limits, limits);
- break;
- default:
- break;
- }
- }
- aTable.addColumn(column);
- }
- } finally {
- if (columns != null) {
- columns.close();
- }
- }
- }
-
- private void getColumnPrimaryKey(TableElement aTable) throws SQLException {
- ResultSet primaryKeys = null;
- try {
- try {
- primaryKeys = dbData.getPrimaryKeys(null, aTable.getSchema(), aTable.getName());
- } catch (SQLException ex) {
- primaryKeys = dbData.getPrimaryKeys(null, null, aTable.getName());
- }
- Map<String, Set<String>> constraintKeyMap = new HashMap<String, Set<String>>();
-
- while (primaryKeys.next()) {
- String column = primaryKeys.getString("COLUMN_NAME");
- String keyId = primaryKeys.getString("PK_NAME");
-
- if (!Strings.isValid(keyId)) {
- keyId = column + "_PK";
- }
-
- if (!constraintKeyMap.containsKey(keyId)) {
- Set<String> set = new TreeSet<String>();
- set.add(column);
- constraintKeyMap.put(keyId, set);
- } else {
- Set<String> set = constraintKeyMap.get(keyId);
- if (!set.contains(column)) {
- set.add(column);
- }
- }
- }
-
- Set<String> keys = constraintKeyMap.keySet();
- for (String pk : keys) {
- ConstraintElement constraint =
- ConstraintFactory.getConstraint(ConstraintTypes.PRIMARY_KEY, aTable.getSchema(), pk, false);
- Set<String> columnSet = constraintKeyMap.get(pk);
- for (String column : columnSet) {
- constraint.addColumn(column);
- }
- aTable.addConstraint(constraint);
- }
- } finally {
- if (primaryKeys != null) {
- primaryKeys.close();
- }
- }
- }
-
- private void getColumnForeignKey(TableElement aTable) throws SQLException {
- ResultSet importedKeys = null;
- try {
- importedKeys = dbData.getImportedKeys(null, aTable.getSchema(), aTable.getName());
-
- while (importedKeys.next()) {
-
- String appliesToColumnId = importedKeys.getString("FKCOLUMN_NAME");
- String fkeyId = importedKeys.getString("FK_NAME");
- String fKeyAddress = importedKeys.getString("FKTABLE_SCHEM");
-
- String refersToTable = importedKeys.getString("PKTABLE_NAME");
- String refersToTableAddress = importedKeys.getString("PKTABLE_SCHEM");
- String referencesColumn = importedKeys.getString("PKCOLUMN_NAME");
-
- OnDeleteEnum onDeleteAction = OnDeleteEnum.UNSPECIFIED;
- String onDeleteRule = importedKeys.getString("DELETE_RULE");
- if (Strings.isValid(onDeleteRule)) {
- // System.out.println("onDelete: " + onDeleteRule);
- int type = Integer.parseInt(onDeleteRule);
- switch (type) {
- case java.sql.DatabaseMetaData.importedKeyNoAction:
- onDeleteAction = OnDeleteEnum.NO_ACTION;
- break;
- case java.sql.DatabaseMetaData.importedKeyRestrict:
- onDeleteAction = OnDeleteEnum.RESTRICT;
- break;
- case java.sql.DatabaseMetaData.importedKeyCascade:
- onDeleteAction = OnDeleteEnum.CASCADE;
- break;
- case java.sql.DatabaseMetaData.importedKeySetNull:
- onDeleteAction = OnDeleteEnum.SET_NULL;
- break;
- case java.sql.DatabaseMetaData.importedKeySetDefault:
- default:
- onDeleteAction = OnDeleteEnum.UNSPECIFIED;
- break;
- }
- }
-
- OnUpdateEnum onUpdateAction = OnUpdateEnum.UNSPECIFIED;
- String onUpdateRule = importedKeys.getString("UPDATE_RULE");
- if (Strings.isValid(onUpdateRule)) {
- // System.out.println("onUpdate: " + onUpdateRule);
- int type = Integer.parseInt(onUpdateRule);
- switch (type) {
- case java.sql.DatabaseMetaData.importedKeyNoAction:
- onUpdateAction = OnUpdateEnum.NO_ACTION;
- break;
- case java.sql.DatabaseMetaData.importedKeyRestrict:
- onUpdateAction = OnUpdateEnum.RESTRICT;
- break;
- case java.sql.DatabaseMetaData.importedKeyCascade:
- case java.sql.DatabaseMetaData.importedKeySetNull:
- case java.sql.DatabaseMetaData.importedKeySetDefault:
- default:
- onUpdateAction = OnUpdateEnum.UNSPECIFIED;
- break;
- }
- }
-
- boolean deferrable = false;
- String deferrabilityId = importedKeys.getString("DEFERRABILITY");
- if (Strings.isValid(deferrabilityId)) {
- int type = Integer.parseInt(deferrabilityId);
- switch (type) {
- case java.sql.DatabaseMetaData.importedKeyInitiallyDeferred:
- case java.sql.DatabaseMetaData.importedKeyInitiallyImmediate:
- deferrable = true;
- break;
- case java.sql.DatabaseMetaData.importedKeyNotDeferrable:
- deferrable = false;
- break;
- default:
- deferrable = false;
- break;
- }
- }
-
- if (!Strings.isValid(fKeyAddress)) {
- fKeyAddress = aTable.getSchema();
- }
-
- if (!Strings.isValid(fkeyId)) {
- fkeyId = appliesToColumnId + "_FK";
- }
-
- if (!Strings.isValid(refersToTableAddress)) {
- refersToTableAddress = aTable.getSchema();
- }
-
- ConstraintElement constraint =
- ConstraintFactory.getConstraint(ConstraintTypes.FOREIGN_KEY, fKeyAddress, fkeyId, deferrable);
- constraint.addColumn(appliesToColumnId);
-
- ReferenceClause ref = new ReferenceClause(refersToTableAddress, refersToTable);
- ref.addColumn(referencesColumn);
-
- ref.setOnDeleteAction(onDeleteAction);
- ref.setOnUpdateAction(onUpdateAction);
-
- ((ForeignKey) constraint).addReference(ref);
-
- aTable.addConstraint(constraint);
- }
- } finally {
- if (importedKeys != null) {
- importedKeys.close();
- }
- }
- }
-
- private void getIndexInfo(TableElement aTable) throws SQLException {
- ResultSet indexKeys = null;
- try {
- indexKeys = dbData.getIndexInfo(null, aTable.getSchema(), aTable.getName(), false, false);
-
- Map<String, Map<Integer, AppliesToClause>> indexMap = new HashMap<String, Map<Integer, AppliesToClause>>();
-
- while (indexKeys.next()) {
- String indexName = indexKeys.getString("INDEX_NAME");
-
- if (indexName != null && indexName.length() > 0) {
- Matcher matcher = indexMatcher.reset(indexName);
- if (!matcher.matches()) {
- if (indexKeys.getShort("TYPE") == DatabaseMetaData.tableIndexOther) {
-
- short ordinal = indexKeys.getShort("ORDINAL_POSITION");
- String columnName = indexKeys.getString("COLUMN_NAME");
-
- String orderTypeString = indexKeys.getString("ASC_OR_DESC");
- OrderType orderType = OrderType.Undefined;
- if (orderTypeString != null) {
- if (orderTypeString.equalsIgnoreCase("A")) {
- orderType = OrderType.Ascending;
- } else if (orderTypeString.equalsIgnoreCase("D")) {
- orderType = OrderType.Descending;
- }
- }
-
- Map<Integer, AppliesToClause> appliesTo = null;
- if (indexMap.containsKey(indexName)) {
- appliesTo = indexMap.get(indexName);
- } else {
- appliesTo = new HashMap<Integer, AppliesToClause>();
- indexMap.put(indexName, appliesTo);
- }
- appliesTo.put(new Integer(ordinal), new AppliesToClause(columnName, orderType));
- }
- }
- }
- }
- for (String indexName : indexMap.keySet()) {
- Map<Integer, AppliesToClause> clauseMap = indexMap.get(indexName);
- IndexElement element = new IndexElement(indexName);
-
- Set<Integer> index = clauseMap.keySet();
- Set<Integer> sortedIndex = new TreeSet<Integer>();
- for (Integer val : index) {
- sortedIndex.add(val);
- }
-
- for (Integer val : sortedIndex) {
- AppliesToClause clause = clauseMap.get(val);
- element.addAppliesTo(clause.getColumnName(), clause.getOrderType());
- }
- aTable.addIndexData(element);
- }
- } finally {
- if (indexKeys != null) {
- indexKeys.close();
- }
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/FileUtility.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/FileUtility.java
deleted file mode 100644
index b4c54ab91d..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/FileUtility.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.operations;
-
-import java.io.File;
-import java.io.FilenameFilter;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-// TODO: this class has some overlap with methods provided in org.eclipse.osee.framework.jdk.core.Lib
-public final class FileUtility {
-
- public static String SCHEMA_EXTENSION = ".SCHEMA.xml";
- public static String DB_DATA_EXTENSION = ".DATA.xml";
-
- private FileUtility() {
- // Utility class
- }
-
- public static boolean isValidDirectory(File directory) {
- if (directory != null && directory.exists() && directory.canRead()) {
- File[] listOfFiles = directory.listFiles();
- if (listOfFiles.length != 0) {
- return true;
- }
- }
- return false;
- }
-
- public static void setupDirectoryForWrite(File directory) {
- if (directory.exists() && directory.canWrite()) {
- if (!directory.isDirectory()) {
- directory.mkdirs();
- }
- } else {
- directory.mkdirs();
- }
- }
-
- public static List<File> getFileList(File sourceDirectory, final String extension) {
- File[] listOfFiles = sourceDirectory.listFiles(new FilenameFilter() {
- @Override
- public boolean accept(File directoryName, String filename) {
- return filename.endsWith(extension) && new File(directoryName + File.separator + filename).canRead();
- }
- });
- return Arrays.asList(listOfFiles);
- }
-
- public static List<URL> getSchemaFileList(File sourceDirectory) {
- List<File> files = getFileList(sourceDirectory, SCHEMA_EXTENSION);
- List<URL> streams = new ArrayList<URL>();
- for (File file : files) {
- try {
- streams.add(file.toURI().toURL());
- } catch (MalformedURLException e) {
- e.printStackTrace();
- }
- }
- return streams;
- }
-
- public static List<File> getDBDataFileList(File sourceDirectory) {
- return getFileList(sourceDirectory, DB_DATA_EXTENSION);
- }
-
- public static List<URL> getDBDataFileListInputStream(File sourceDirectory) {
- List<File> files = getFileList(sourceDirectory, DB_DATA_EXTENSION);
- List<URL> streams = new ArrayList<URL>();
- for (File file : files) {
- try {
- streams.add(file.toURI().toURL());
- } catch (MalformedURLException e) {
- e.printStackTrace();
- }
- }
- return streams;
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/ImportDataFromDbServiceOperation.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/ImportDataFromDbServiceOperation.java
deleted file mode 100644
index ce3c0f6046..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/ImportDataFromDbServiceOperation.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.operations;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.core.data.IDatabaseInfo;
-import org.eclipse.osee.framework.core.datastore.internal.Activator;
-import org.eclipse.osee.framework.core.datastore.schema.data.SchemaData;
-import org.eclipse.osee.framework.core.datastore.schema.data.TableElement;
-import org.eclipse.osee.framework.core.operation.AbstractOperation;
-import org.eclipse.osee.framework.database.IOseeDatabaseService;
-import org.eclipse.osee.framework.database.core.DatabaseInfoManager;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ImportDataFromDbServiceOperation extends AbstractOperation {
-
- private static final File backupDirectory = new File("BackupDirectory");
-
- private final Map<String, SchemaData> userSpecifiedConfig;
- private final String tableImportSource;
- private final IOseeDatabaseService databaseService;
-
- public ImportDataFromDbServiceOperation(IOseeDatabaseService databaseService, Map<String, SchemaData> userSpecifiedConfig, String tableImportSource) {
- super("Import Data from Db Service", Activator.PLUGIN_ID);
- this.databaseService = databaseService;
- this.userSpecifiedConfig = userSpecifiedConfig;
- this.tableImportSource = tableImportSource;
- }
-
- @Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
- Set<String> importConnections = getImportConnections();
- for (String importFromDbService : importConnections) {
- System.out.println("Import Table Data from Db: " + importFromDbService);
-
- IDatabaseInfo dbInfo = DatabaseInfoManager.getDataStoreById(importFromDbService);
- System.out.println("Gathering information from ..." + importFromDbService);
-
- String userName = dbInfo.getDatabaseLoginName();
- if (Strings.isValid(userName)) {
-
- Set<String> schemasToGet = new TreeSet<String>();
- schemasToGet.add(userName.toUpperCase());
-
- Map<String, Set<String>> dataToImport = getTablesToImport(monitor, userName.toUpperCase(), schemasToGet);
- if (dataToImport.size() > 0) {
- System.out.println(dataToImport.toString().replaceAll(", ", "\n"));
- makeBackupDirectoryIfItDoesntExist();
-
- System.out.println("Backing up Files to: " + backupDirectory.getAbsolutePath());
- DatabaseDataExtractor dbDataExtractor =
- new DatabaseDataExtractor(databaseService, schemasToGet, backupDirectory);
-
- Set<String> tablesToImport;
- if (importFromDbService.equals(determineDefaultConnection())) {
- tablesToImport = dataToImport.get(tableImportSource);
- } else {
- tablesToImport = dataToImport.get(importFromDbService);
- }
-
- for (String importTable : tablesToImport) {
- dbDataExtractor.addTableNameToExtract(importTable);
- }
- doSubWork(dbDataExtractor, monitor, 0.10);
- dbDataExtractor.waitForWorkerThreads();
-
- prepareFilesForImport();
- }
- }
- }
- }
-
- private void prepareFilesForImport() {
- Set<String> keys = userSpecifiedConfig.keySet();
- if (keys.size() == 1) {
- String userName = "";
- for (String temp : keys) {
- userName = temp;
- }
- List<File> files = FileUtility.getDBDataFileList(backupDirectory);
- for (File fileName : files) {
- String filename = fileName.getAbsolutePath().toString();
- filename = filename.substring(filename.lastIndexOf(File.separator) + 1, filename.length());
- filename = filename.substring(filename.indexOf(".") + 1, filename.length());
- fileName.renameTo(new File(backupDirectory + File.separator + userName + "." + filename));
- }
- }
- }
-
- private String determineDefaultConnection() {
- String importFromDbService = System.getProperty(tableImportSource);
- if (!Strings.isValid(importFromDbService)) {
- importFromDbService = "oracle";
- }
- return importFromDbService;
- }
-
- private Set<String> getImportConnections() {
- String defaultConnection = determineDefaultConnection();
- Set<String> userSchemas = userSpecifiedConfig.keySet();
- Set<String> connectionsNeeded = new TreeSet<String>();
- for (String key : userSchemas) {
- SchemaData schemaDataInUserConfig = userSpecifiedConfig.get(key);
- Map<String, Set<String>> tableNamesToImport = schemaDataInUserConfig.getTablesToImport(tableImportSource);
- Set<String> keys = tableNamesToImport.keySet();
- for (String connectionString : keys) {
- if (connectionString.equals(tableImportSource)) {
- connectionsNeeded.add(defaultConnection);
- } else {
- connectionsNeeded.add(connectionString);
- }
- }
- }
- return connectionsNeeded;
- }
-
- private Map<String, SchemaData> getAvailableSchemasFromImportDb(IProgressMonitor monitor, Set<String> schemas) throws Exception {
- Map<String, SchemaData> schemaMap = new HashMap<String, SchemaData>();
- ExtractDatabaseSchemaOperation schemaExtractor =
- new ExtractDatabaseSchemaOperation(databaseService, schemas, schemaMap);
- doSubWork(schemaExtractor, monitor, 0.20);
- return schemaMap;
- }
-
- private Map<String, Set<String>> getTablesToImport(IProgressMonitor monitor, String userName, Set<String> schemasToGet) throws Exception {
- Map<String, SchemaData> currentDbSchemas = getAvailableSchemasFromImportDb(monitor, schemasToGet);
- Set<String> userSchemas = userSpecifiedConfig.keySet();
-
- SchemaData schemaData = currentDbSchemas.get(userName);
- Map<String, TableElement> tableMap = schemaData.getTableMap();
-
- Map<String, Set<String>> importTables = new HashMap<String, Set<String>>();
- for (String key : userSchemas) {
- SchemaData schemaDataInUserConfig = userSpecifiedConfig.get(key);
- Map<String, Set<String>> tableNamesToImport = schemaDataInUserConfig.getTablesToImport(tableImportSource);
-
- Set<String> keys = tableNamesToImport.keySet();
- for (String importKey : keys) {
- Set<String> namesToImport = tableNamesToImport.get(importKey);
-
- for (String tableName : namesToImport) {
- tableName = tableName.replaceAll(key + "\\.", userName + ".");
-
- if (tableMap.containsKey(tableName)) {
- Set<String> tableSet;
- if (importTables.containsKey(importKey)) {
- tableSet = importTables.get(importKey);
- } else {
- tableSet = new TreeSet<String>();
- }
- tableSet.add(tableName);
- importTables.put(importKey, tableSet);
- }
- }
- }
- }
- return importTables;
- }
-
- private void makeBackupDirectoryIfItDoesntExist() {
- if (backupDirectory != null && backupDirectory.exists() && backupDirectory.canWrite()) {
- return;
- } else {
- backupDirectory.mkdirs();
- }
- }
-
-} \ No newline at end of file
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
deleted file mode 100644
index 44e5bfe362..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/LoadUserSchemasOperation.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-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;
-import org.eclipse.osee.framework.core.datastore.schema.data.ConstraintElement;
-import org.eclipse.osee.framework.core.datastore.schema.data.ForeignKey;
-import org.eclipse.osee.framework.core.datastore.schema.data.IndexElement;
-import org.eclipse.osee.framework.core.datastore.schema.data.ReferenceClause;
-import org.eclipse.osee.framework.core.datastore.schema.data.SchemaData;
-import org.eclipse.osee.framework.core.datastore.schema.data.SchemaXmlParser;
-import org.eclipse.osee.framework.core.datastore.schema.data.TableElement;
-import org.eclipse.osee.framework.core.datastore.schema.data.TableElement.TableDescriptionFields;
-import org.eclipse.osee.framework.core.exception.OseeExceptions;
-import org.eclipse.osee.framework.core.operation.AbstractOperation;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-
-/**
- * @author Roberto E. Escobar
- */
-public class LoadUserSchemasOperation extends AbstractOperation {
-
- private final Map<String, SchemaData> schemas;
- private final IOseeSchemaProvider schemaProvider;
- private final SchemaCreationOptions options;
-
- public LoadUserSchemasOperation(Map<String, SchemaData> schemas, IOseeSchemaProvider schemaProvider, SchemaCreationOptions options) {
- super("Load Schema Data from URIs", Activator.PLUGIN_ID);
- this.schemas = schemas;
- this.schemaProvider = schemaProvider;
- this.options = options;
- }
-
- @Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
- Collection<IOseeSchemaResource> schemaResources = schemaProvider.getSchemaResources();
- SchemaXmlParser parser = new SchemaXmlParser();
- parser.parseFromSchemaProvider(schemaResources, schemas);
-
- if (!options.isUseFileSpecifiedSchemas()) {
- try {
- DatabaseMetaData meta = ConnectionHandler.getMetaData();
- if (meta != null) {
- String userName = meta.getUserName();
- if (Strings.isValid(userName)) {
- int index = userName.indexOf('@');
- if (index > 1) {
- userName = userName.substring(0, index);
- }
- Map<String, SchemaData> newData = useUserNameAsSchema(userName.toUpperCase(), schemas);
- schemas.clear();
- schemas.putAll(newData);
- }
- }
- } catch (SQLException ex) {
- OseeExceptions.wrapAndThrow(ex);
- }
- }
-
- if (options.isTableDataSpaceValid()) {
- for (SchemaData schemaData : schemas.values()) {
- schemaData.setTableDataSpaceName(options.getTableDataSpace());
- }
- }
-
- if (options.isIndexDataSpaceValid()) {
- for (SchemaData schemaData : schemas.values()) {
- schemaData.setIndexDataSpaceName(options.getIndexDataSpace());
- }
- }
- }
-
- private Map<String, SchemaData> useUserNameAsSchema(String userName, Map<String, SchemaData> userSchemas) {
- Map<String, SchemaData> newData = new HashMap<String, SchemaData>();
- SchemaData newSchemaData = new SchemaData();
- Set<String> keys = userSchemas.keySet();
- for (String key : keys) {
- SchemaData schemaData = userSchemas.get(key);
- List<TableElement> tables = schemaData.getTablesOrderedByDependency();
- for (TableElement table : tables) {
- TableElement newTable = useUserNameAsSchemaForTable(userName, table);
- newSchemaData.addTableDefinition(newTable);
- }
- }
- newData.put(userName, newSchemaData);
- return newData;
- }
-
- private TableElement useUserNameAsSchemaForTable(String userName, TableElement table) {
- TableElement newTable = new TableElement();
-
- Map<TableDescriptionFields, String> tableDescription = table.getDescription();
- Map<String, ColumnMetadata> columns = table.getColumns();
- List<ConstraintElement> constraints = table.getConstraints();
- List<ForeignKey> foreignKeys = table.getForeignKeyConstraints();
- List<IndexElement> indexElements = table.getIndexData();
-
- TableDescriptionFields[] descriptors = TableDescriptionFields.values();
- for (TableDescriptionFields field : descriptors) {
- String value = tableDescription.get(field);
- if (field.equals(TableDescriptionFields.schema)) {
- value = userName;
- }
- if (Strings.isValid(value)) {
- newTable.addTableDescription(field, value);
- }
- }
-
- Set<String> columnKeys = columns.keySet();
- for (String key : columnKeys) {
- newTable.addColumn(columns.get(key));
- }
- for (ConstraintElement constraint : constraints) {
- constraint.setSchema(userName);
- newTable.addConstraint(constraint);
- }
- for (ForeignKey constraint : foreignKeys) {
- constraint.setSchema(userName);
- List<ReferenceClause> references = constraint.getReferences();
- for (ReferenceClause clause : references) {
- clause.setSchema(userName);
- }
- newTable.addConstraint(constraint);
- }
- for (IndexElement indexElement : indexElements) {
- newTable.addIndexData(indexElement);
- }
- return newTable;
- }
-
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/OperationFactory.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/OperationFactory.java
deleted file mode 100644
index 7debb510aa..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/OperationFactory.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.operations;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.eclipse.osee.framework.core.datastore.IOseeSchemaProvider;
-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.SchemaData;
-import org.eclipse.osee.framework.core.operation.CompositeOperation;
-import org.eclipse.osee.framework.core.operation.IOperation;
-import org.eclipse.osee.framework.database.IOseeDatabaseService;
-
-/**
- * @author Roberto E. Escobar
- */
-public final class OperationFactory {
-
- private OperationFactory() {
- // Utility class
- }
-
- public static IOperation createDbSchema(final IOseeDatabaseService databaseService, IOseeSchemaProvider schemaProvider, SchemaCreationOptions options) {
- Map<String, SchemaData> userSpecifiedConfig = new HashMap<String, SchemaData>();
- Map<String, SchemaData> currentDatabaseConfig = new HashMap<String, SchemaData>();
-
- List<IOperation> ops = new ArrayList<IOperation>();
- ops.add(new LoadUserSchemasOperation(userSpecifiedConfig, schemaProvider, options));
- ops.add(new ExtractDatabaseSchemaOperation(databaseService, userSpecifiedConfig.keySet(), currentDatabaseConfig));
- ops.add(new CreateSchemaOperation(databaseService, userSpecifiedConfig, currentDatabaseConfig));
-
- return new CompositeOperation("Create OSEE Schema", Activator.PLUGIN_ID, ops);
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/PrintTables.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/PrintTables.java
deleted file mode 100644
index ae2948d2d3..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/PrintTables.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.operations;
-
-import java.io.Writer;
-import java.util.Map;
-import java.util.Set;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.core.datastore.internal.Activator;
-import org.eclipse.osee.framework.core.datastore.schema.data.SchemaData;
-import org.eclipse.osee.framework.core.operation.AbstractOperation;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
-import org.eclipse.osee.framework.database.core.IOseeStatement;
-
-/**
- * @author Roberto E. Escobar
- */
-public class PrintTables extends AbstractOperation {
-
- private final Map<String, SchemaData> userConfig;
- private final Writer writer;
-
- public PrintTables(Map<String, SchemaData> userConfig, Writer writer) {
- super("Print Schema", Activator.PLUGIN_ID);
- this.userConfig = userConfig;
- this.writer = writer;
- }
-
- @Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
- Set<String> keys = userConfig.keySet();
- for (String key : keys) {
- SchemaData schemaData = userConfig.get(key);
- Set<String> tables = schemaData.getTableMap().keySet();
- for (String tableName : tables) {
- printTable(tableName);
- }
- }
- }
-
- private void printTable(String tableName) throws Exception {
- IOseeStatement chStmt = ConnectionHandler.getStatement();
- try {
- chStmt.runPreparedQuery("select * from " + tableName);
- int numberOfColumns = chStmt.getColumnCount();
- String header = "\nTable:\t" + tableName + "\n";
- header += "Columns:\t";
- for (int index = 1; index <= numberOfColumns; index++) {
- header += chStmt.getColumnName(index);
- if (index + 1 <= numberOfColumns) {
- header += ", ";
- }
- }
- header += "\n";
-
- writer.write(header);
-
- String results = "";
- while (chStmt.next()) {
- results = "Data:\t";
- for (int index = 1; index <= numberOfColumns; index++) {
- results += chStmt.getObject(index).toString();
- if (index + 1 <= numberOfColumns) {
- results += ", ";
- }
- }
- results += "\n";
- writer.write(results);
- }
- } finally {
- chStmt.close();
- }
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/RestoreTableDataOperation.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/RestoreTableDataOperation.java
deleted file mode 100644
index c0e1e32ddf..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/RestoreTableDataOperation.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.operations;
-
-import java.io.File;
-import java.util.ArrayList;
-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.internal.Activator;
-import org.eclipse.osee.framework.core.datastore.schema.data.SchemaData;
-import org.eclipse.osee.framework.core.datastore.schema.data.TableElement;
-import org.eclipse.osee.framework.core.datastore.schema.sql.SqlFactory;
-import org.eclipse.osee.framework.core.datastore.schema.sql.SqlManager;
-import org.eclipse.osee.framework.core.operation.AbstractOperation;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
-
-/**
- * @author Roberto E. Escobar
- */
-public class RestoreTableDataOperation extends AbstractOperation {
- private static final File backupDirectory = new File("backupDirectory");
-
- private final Set<String> schemas;
- private final Map<String, SchemaData> userSpecifiedConfig;
- private final String importDatabaseSource;
-
- public RestoreTableDataOperation(Set<String> schemas, Map<String, SchemaData> userSpecifiedConfig, String importDatabaseSource) {
- super("Restore Table Data", Activator.PLUGIN_ID);
- this.schemas = schemas;
- this.userSpecifiedConfig = userSpecifiedConfig;
- this.importDatabaseSource = importDatabaseSource;
- }
-
- @Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
- SqlManager sqlManager = SqlFactory.getSqlManager(ConnectionHandler.getMetaData());
-
- for (String schemaKey : schemas) {
- if (userSpecifiedConfig.containsKey(schemaKey)) {
- DatabaseDataImporter importer = new DatabaseDataImporter(backupDirectory, sqlManager);
- SchemaData schemaData = userSpecifiedConfig.get(schemaKey);
-
- setImportOrder(importer, schemaData);
- setTablesToImport(importer, schemaData);
- importer.setSchemaToImportTo(schemaKey);
-
- importer.importDataIntoDatabase();
- }
- }
-
- clearBackupDirectory();
- }
-
- private void setImportOrder(DatabaseDataImporter importer, SchemaData schemaData) {
- List<String> importOrder = new ArrayList<String>();
-
- List<TableElement> tables = schemaData.getTablesOrderedByDependency();
- for (TableElement table : tables) {
- importOrder.add(table.getFullyQualifiedTableName());
- }
- importer.setImportOrder(importOrder);
- }
-
- private void setTablesToImport(DatabaseDataImporter importer, SchemaData schemaData) {
- importer.clearTableFilter();
- Set<String> selectedTables = schemaData.getTablesToBackup();
- for (String tableName : selectedTables) {
- importer.addToTableFilter(tableName);
- }
- Map<String, Set<String>> importedTables = schemaData.getTablesToImport(importDatabaseSource);
- Set<String> keys = importedTables.keySet();
- for (String key : keys) {
- Set<String> tables = importedTables.get(key);
- for (String tableName : tables) {
- importer.addToTableFilter(tableName);
- }
- }
- }
-
- private void clearBackupDirectory() {
- if (backupDirectory != null && backupDirectory.exists() && backupDirectory.canWrite()) {
- File[] fileList = backupDirectory.listFiles();
- for (File fileToDelete : fileList) {
- fileToDelete.delete();
- }
- backupDirectory.delete();
- }
- }
-
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/FoxProDataType.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/FoxProDataType.java
deleted file mode 100644
index 4889d4f2d8..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/FoxProDataType.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.sql;
-
-/**
- * @author Roberto E. Escobar
- */
-public class FoxProDataType extends SqlDataType {
-
- public FoxProDataType() {
- super();
- }
-
- @Override
- public String getBooleanType() {
- return "number";
- }
-
- @Override
- public String getBitType() {
- return "number";
- }
-
- @Override
- public String getIntegerType() {
- return "integer";
- }
-
- @Override
- public String getDecimalType() {
- return "number";
- }
-
- @Override
- public String getFloatType() {
- return "float";
- }
-
- @Override
- public String getDoubleType() {
- return "number";
- }
-
- @Override
- public String getRealType() {
- return "real";
- }
-
- @Override
- public String getDateType() {
- return "date";
- }
-
- @Override
- public String getCharType() {
- return "char";
- }
-
- @Override
- public String getVarCharType() {
- return "varchar";
- }
-
- @Override
- public String getSmallIntType() {
- return "smallint";
- }
-
- @Override
- protected String getClobType() {
- return "clob";
- }
-
- @Override
- protected String getTimestamp() {
- return "timestamp";
- }
-
- @Override
- protected String getTime() {
- return "time";
- }
-
- @Override
- protected String getBlobType() {
- return "blob";
- }
-
- @Override
- protected String getBigInt() {
- return "number";
- }
-
- @Override
- protected String getLongVarCharType() {
- return "long varchar";
- }
-
- @Override
- protected String getNumericType() {
- return "number";
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/H2DataType.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/H2DataType.java
deleted file mode 100644
index d9f74bf1ce..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/H2DataType.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.sql;
-
-/**
- * @author Roberto E. Escobar
- */
-public class H2DataType extends SqlDataType {
-
- public H2DataType() {
- super();
- }
-
- @Override
- public String getBooleanType() {
- return "boolean";
- }
-
- @Override
- public String getBitType() {
- return "tinyint";
- }
-
- @Override
- public String getIntegerType() {
- return "int";
- }
-
- @Override
- public String getDecimalType() {
- return "decimal";
- }
-
- @Override
- public String getFloatType() {
- return "double";
- }
-
- @Override
- public String getRealType() {
- return "real";
- }
-
- @Override
- public String getDoubleType() {
- return "double";
- }
-
- @Override
- public String getDateType() {
- return "date";
- }
-
- @Override
- public String getCharType() {
- return "char";
- }
-
- @Override
- public String getVarCharType() {
- return "varchar";
- }
-
- @Override
- public String getSmallIntType() {
- return "smallint";
- }
-
- @Override
- protected String getClobType() {
- return "clob";
- }
-
- @Override
- protected String getTimestamp() {
- return "timestamp";
- }
-
- @Override
- protected String getTime() {
- return "time";
- }
-
- @Override
- protected String getBlobType() {
- return "blob";
- }
-
- @Override
- protected String getBigInt() {
- return "bigint";
- }
-
- @Override
- protected String getLongVarCharType() {
- return "varchar";
- }
-
- @Override
- protected String getNumericType() {
- return "numeric";
- }
-
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/H2SqlManager.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/H2SqlManager.java
deleted file mode 100644
index c5505c5d82..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/H2SqlManager.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.sql;
-
-import org.eclipse.osee.framework.core.datastore.schema.data.TableElement;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
-
-/**
- * @author Roberto E. Escobar
- */
-public class H2SqlManager extends SqlManagerImpl {
-
- public H2SqlManager(SqlDataType sqlDataType) {
- super(sqlDataType);
- }
-
- @Override
- public void createSchema(String schema) throws OseeCoreException {
- ConnectionHandler.runPreparedUpdate(String.format("%s SCHEMA IF NOT EXISTS \"%s\"", CREATE_STRING,
- schema.toUpperCase()));
- }
-
- @Override
- public void dropSchema(String schema) throws OseeCoreException {
- ConnectionHandler.runPreparedUpdate(String.format("%s SCHEMA IF EXISTS \"%s\"", DROP_STRING, schema.toUpperCase()));
- }
-
- @Override
- public void dropIndex(TableElement tableDef) {
- // Do Nothing -- Indexes are dropped during table drop
- }
-
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/MySqlDataType.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/MySqlDataType.java
deleted file mode 100644
index 8ed63cbeeb..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/MySqlDataType.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.sql;
-
-/**
- * @author Roberto E. Escobar
- */
-public class MySqlDataType extends SqlDataType {
-
- public MySqlDataType() {
- super();
- }
-
- @Override
- public String getBooleanType() {
- return "boolean";
- }
-
- @Override
- public String getBitType() {
- return "smallint";
- }
-
- @Override
- public String getIntegerType() {
- return "integer";
- }
-
- @Override
- public String getDecimalType() {
- return "decimal";
- }
-
- @Override
- public String getFloatType() {
- return "float";
- }
-
- @Override
- public String getRealType() {
- return "real";
- }
-
- @Override
- public String getDoubleType() {
- return getRealType();
- }
-
- @Override
- public String getDateType() {
- return "date";
- }
-
- @Override
- public String getCharType() {
- return "char";
- }
-
- @Override
- public String getVarCharType() {
- return "varchar";
- }
-
- @Override
- public String getSmallIntType() {
- return "smallint";
- }
-
- @Override
- protected String getClobType() {
- return "blob";
- }
-
- @Override
- protected String getTimestamp() {
- return "timestamp";
- }
-
- @Override
- protected String getTime() {
- return "time";
- }
-
- @Override
- protected String getBlobType() {
- return "blob";
- }
-
- @Override
- protected String getBigInt() {
- return "bigint";
- }
-
- @Override
- protected String getLongVarCharType() {
- return "long varchar";
- }
-
- @Override
- protected String getNumericType() {
- return "numeric";
- }
-
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/MysqlSqlManager.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/MysqlSqlManager.java
deleted file mode 100644
index ecff1984bf..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/MysqlSqlManager.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.sql;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.logging.Level;
-import org.apache.commons.lang.StringUtils;
-import org.eclipse.osee.framework.core.datastore.internal.Activator;
-import org.eclipse.osee.framework.core.datastore.schema.data.ColumnMetadata;
-import org.eclipse.osee.framework.core.datastore.schema.data.ConstraintElement;
-import org.eclipse.osee.framework.core.datastore.schema.data.ForeignKey;
-import org.eclipse.osee.framework.core.datastore.schema.data.IndexElement;
-import org.eclipse.osee.framework.core.datastore.schema.data.ReferenceClause;
-import org.eclipse.osee.framework.core.datastore.schema.data.ReferenceClause.OnDeleteEnum;
-import org.eclipse.osee.framework.core.datastore.schema.data.ReferenceClause.OnUpdateEnum;
-import org.eclipse.osee.framework.core.datastore.schema.data.TableElement;
-import org.eclipse.osee.framework.core.datastore.schema.data.TableElement.ColumnFields;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
-import org.eclipse.osee.framework.database.core.OseeConnection;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.logging.OseeLog;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-public class MysqlSqlManager extends SqlManagerImpl {
-
- public MysqlSqlManager(SqlDataType sqlDataType) {
- super(sqlDataType);
- }
-
- private String handleColumnCreationSection(OseeConnection connection, Map<String, ColumnMetadata> columns) {
- List<String> lines = new ArrayList<String>();
- Set<String> keys = columns.keySet();
- for (String key : keys) {
- Map<ColumnFields, String> column = columns.get(key).getColumnFields();
- lines.add(columnDataToSQL(column));
- }
- String toExecute = org.eclipse.osee.framework.jdk.core.util.Collections.toString(",\n", lines);
- return toExecute;
- }
-
- public void createTable(OseeConnection connection, TableElement tableDef) throws OseeCoreException {
- String toExecute = "CREATE TABLE " + tableDef.getFullyQualifiedTableName() + " ( \n";
- toExecute += handleColumnCreationSection(connection, tableDef.getColumns());
- toExecute += handleConstraintCreationSection(tableDef.getConstraints(), tableDef.getFullyQualifiedTableName());
- toExecute +=
- handleConstraintCreationSection(tableDef.getForeignKeyConstraints(), tableDef.getFullyQualifiedTableName());
- toExecute += " \n)\n";
- OseeLog.log(Activator.class, Level.INFO, "Creating Table: [ " + tableDef.getFullyQualifiedTableName() + "]");
- ConnectionHandler.runPreparedUpdate(connection, toExecute);
- }
-
- @Override
- public void dropTable(TableElement tableDef) throws OseeCoreException {
- String toExecute = "DROP TABLE " + formatQuotedString(tableDef.getFullyQualifiedTableName(), "\\.");
- OseeLog.log(Activator.class, Level.INFO, "Dropping Table: [ " + tableDef.getFullyQualifiedTableName() + "]");
- ConnectionHandler.runPreparedUpdate(toExecute);
- }
-
- @Override
- protected String formatQuotedString(String value, String splitAt) {
- String[] array = value.split(splitAt);
- for (int index = 0; index < array.length; index++) {
- array[index] = array[index];
- }
- return StringUtils.join(array, splitAt.replaceAll("\\\\", ""));
- }
-
- @Override
- public void dropIndex(TableElement tableDef) throws OseeCoreException {
- List<IndexElement> tableIndices = tableDef.getIndexData();
- String tableName = tableDef.getFullyQualifiedTableName();
- for (IndexElement iData : tableIndices) {
- if (iData.ignoreMySql()) {
- continue;
- }
- OseeLog.logf(Activator.class, Level.INFO,
- "Dropping Index: [%s] FROM [%s]", iData.getId(), tableName);
- if (iData.getId().equals("PRIMARY")) {
- ConnectionHandler.runPreparedUpdate("ALTER TABLE " + tableDef.getFullyQualifiedTableName() + " DROP PRIMARY KEY");
- } else {
- ConnectionHandler.runPreparedUpdate("ALTER TABLE " + tableDef.getFullyQualifiedTableName() + " DROP INDEX " + iData.getId());
- }
- }
- }
-
- @Override
- public String constraintDataToSQL(ConstraintElement constraint, String tableID) {
- StringBuilder toReturn = new StringBuilder();
- String id = formatQuotedString(constraint.getId(), "\\.");
- String type = constraint.getConstraintType().toString();
- String appliesTo = formatQuotedString(constraint.getCommaSeparatedColumnsList(), ",");
-
- if (Strings.isValid(id) && Strings.isValid(appliesTo)) {
- toReturn.append("CONSTRAINT " + id + " " + type + " (" + appliesTo + ")");
-
- if (constraint instanceof ForeignKey) {
- ForeignKey fk = (ForeignKey) constraint;
- List<ReferenceClause> refs = fk.getReferences();
-
- for (ReferenceClause ref : refs) {
- String refTable = formatQuotedString(ref.getFullyQualifiedTableName(), "\\.");
- String refColumns = formatQuotedString(ref.getCommaSeparatedColumnsList(), ",");
-
- String onUpdate = "";
- if (!ref.getOnUpdateAction().equals(OnUpdateEnum.UNSPECIFIED)) {
- onUpdate = "ON UPDATE " + ref.getOnUpdateAction().toString();
- }
-
- String onDelete = "";
- if (!ref.getOnDeleteAction().equals(OnDeleteEnum.UNSPECIFIED)) {
- onDelete = "ON DELETE " + ref.getOnDeleteAction().toString();
- }
-
- if (refTable != null && refColumns != null && !refTable.equals("") && !refColumns.equals("")) {
- toReturn.append(" REFERENCES " + refTable + " (" + refColumns + ")");
- if (!onUpdate.equals("")) {
- toReturn.append(" " + onUpdate);
- }
-
- if (!onDelete.equals("")) {
- toReturn.append(" " + onDelete);
- }
-
- // if (constraint.isDeferrable()) {
- // toReturn.append(" DEFERRABLE");
- // }
- }
-
- else {
- OseeLog.log(Activator.class, Level.WARNING,
- "Skipping CONSTRAINT at Table: " + tableID + "\n\t " + fk.toString());
- }
-
- }
- }
- } else {
- OseeLog.log(Activator.class, Level.WARNING,
- "Skipping CONSTRAINT at Table: " + tableID + "\n\t " + constraint.toString());
- }
- return toReturn.toString();
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/OracleSqlDataType.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/OracleSqlDataType.java
deleted file mode 100644
index 074d5036cc..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/OracleSqlDataType.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.sql;
-
-import org.eclipse.osee.framework.database.core.SQL3DataType;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-
-/**
- * @author Roberto E. Escobar
- */
-public class OracleSqlDataType extends SqlDataType {
-
- public OracleSqlDataType() {
- super();
- }
-
- @Override
- public String getLimit(SQL3DataType dataType, String limit) {
- if (dataType == SQL3DataType.VARCHAR && Strings.isValid(limit)) {
- return limit + " CHAR";
- } else {
- return super.getLimit(dataType, limit);
- }
- }
-
- @Override
- public String getBooleanType() {
- return "number";
- }
-
- @Override
- public String getBitType() {
- return "number";
- }
-
- @Override
- public String getIntegerType() {
- return "integer";
- }
-
- @Override
- public String getDecimalType() {
- return "number";
- }
-
- @Override
- public String getFloatType() {
- return "float";
- }
-
- @Override
- public String getRealType() {
- return "real";
- }
-
- @Override
- public String getDoubleType() {
- return "number";
- }
-
- @Override
- public String getDateType() {
- return "date";
- }
-
- @Override
- public String getCharType() {
- return "char";
- }
-
- @Override
- public String getVarCharType() {
- return "varchar2";
- }
-
- @Override
- public String getSmallIntType() {
- return "smallint";
- }
-
- @Override
- protected String getClobType() {
- return "clob";
- }
-
- @Override
- protected String getTimestamp() {
- return "timestamp";
- }
-
- @Override
- protected String getTime() {
- return "time";
- }
-
- @Override
- protected String getBlobType() {
- return "blob";
- }
-
- @Override
- protected String getBigInt() {
- return "number";
- }
-
- @Override
- protected String getLongVarCharType() {
- return "varchar2";
- }
-
- @Override
- protected String getNumericType() {
- return "number";
- }
-
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/OracleSqlManager.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/OracleSqlManager.java
deleted file mode 100644
index 665cbb49ae..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/OracleSqlManager.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.sql;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.logging.Level;
-import org.eclipse.osee.framework.core.datastore.internal.Activator;
-import org.eclipse.osee.framework.core.datastore.schema.data.ColumnMetadata;
-import org.eclipse.osee.framework.core.datastore.schema.data.IndexElement;
-import org.eclipse.osee.framework.core.datastore.schema.data.TableElement;
-import org.eclipse.osee.framework.core.datastore.schema.data.TableElement.ColumnFields;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
-import org.eclipse.osee.framework.logging.OseeLog;
-
-/**
- * @author Roberto E. Escobar
- */
-public class OracleSqlManager extends SqlManager {
-
- public OracleSqlManager(SqlDataType sqlDataType) {
- super(sqlDataType);
- }
-
- protected String handleColumnCreationSection(Map<String, ColumnMetadata> columns) {
- List<String> lines = new ArrayList<String>();
- Set<String> keys = columns.keySet();
- for (String key : keys) {
- Map<ColumnFields, String> column = columns.get(key).getColumnFields();
- lines.add(columnDataToSQL(column));
- }
- String toExecute = org.eclipse.osee.framework.jdk.core.util.Collections.toString(",\n", lines);
- return toExecute;
- }
-
- @Override
- public void createTable(TableElement tableDef) throws OseeCoreException {
- StringBuilder toExecute = new StringBuilder();
- toExecute.append(SqlManager.CREATE_STRING + " TABLE " + formatQuotedString(tableDef.getFullyQualifiedTableName(),
- "\\.") + " ( \n");
- toExecute.append(handleColumnCreationSection(tableDef.getColumns()));
- toExecute.append(handleConstraintCreationSection(tableDef.getConstraints(), tableDef.getFullyQualifiedTableName()));
- toExecute.append(handleConstraintCreationSection(tableDef.getForeignKeyConstraints(),
- tableDef.getFullyQualifiedTableName()));
- toExecute.append(" \n)");
- toExecute.append(" tablespace ");
- toExecute.append(tableDef.getTablespace());
- toExecute.append("\n");
- OseeLog.log(Activator.class, Level.FINE, "Creating Table: [ " + tableDef.getFullyQualifiedTableName() + "]");
- ConnectionHandler.runPreparedUpdate(toExecute.toString());
- }
-
- @Override
- protected String createIndexPostProcess(IndexElement indexElement, String original) {
- StringBuilder buffer = new StringBuilder(original);
- buffer.append(" tablespace ");
- buffer.append(indexElement.getTablespace());
- return buffer.toString();
- }
-
- @Override
- public void dropTable(TableElement tableDef) throws OseeCoreException {
- StringBuilder toExecute = new StringBuilder();
- toExecute.append(SqlManager.DROP_STRING + " TABLE " + formatQuotedString(tableDef.getFullyQualifiedTableName(),
- "\\.") + " cascade constraints purge");
- OseeLog.log(Activator.class, Level.FINE, "Dropping Table: [ " + tableDef.getFullyQualifiedTableName() + "]");
- ConnectionHandler.runPreparedUpdate(toExecute.toString());
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/PostgreSqlManager.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/PostgreSqlManager.java
deleted file mode 100644
index 8146b528c2..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/PostgreSqlManager.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.sql;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.logging.Level;
-import org.apache.commons.lang.StringUtils;
-import org.eclipse.osee.framework.core.datastore.internal.Activator;
-import org.eclipse.osee.framework.core.datastore.schema.data.AppliesToClause;
-import org.eclipse.osee.framework.core.datastore.schema.data.ColumnMetadata;
-import org.eclipse.osee.framework.core.datastore.schema.data.ConstraintElement;
-import org.eclipse.osee.framework.core.datastore.schema.data.ForeignKey;
-import org.eclipse.osee.framework.core.datastore.schema.data.IndexElement;
-import org.eclipse.osee.framework.core.datastore.schema.data.ReferenceClause;
-import org.eclipse.osee.framework.core.datastore.schema.data.ReferenceClause.OnDeleteEnum;
-import org.eclipse.osee.framework.core.datastore.schema.data.ReferenceClause.OnUpdateEnum;
-import org.eclipse.osee.framework.core.datastore.schema.data.TableElement;
-import org.eclipse.osee.framework.core.datastore.schema.data.TableElement.ColumnFields;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
-import org.eclipse.osee.framework.database.core.OseeConnection;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.logging.OseeLog;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-public class PostgreSqlManager extends SqlManagerImpl {
- public PostgreSqlManager(SqlDataType sqlDataType) {
- super(sqlDataType);
- }
-
- private String handleColumnCreationSection(OseeConnection connection, Map<String, ColumnMetadata> columns) {
- List<String> lines = new ArrayList<String>();
- Set<String> keys = columns.keySet();
- for (String key : keys) {
- Map<ColumnFields, String> column = columns.get(key).getColumnFields();
- lines.add(columnDataToSQL(column));
- }
- String toExecute = org.eclipse.osee.framework.jdk.core.util.Collections.toString(",\n", lines);
- return toExecute;
- }
-
- public void createTable(OseeConnection connection, TableElement tableDef) throws OseeCoreException {
- String toExecute = "CREATE TABLE " + tableDef.getFullyQualifiedTableName() + " ( \n";
- toExecute += handleColumnCreationSection(connection, tableDef.getColumns());
- toExecute += handleConstraintCreationSection(tableDef.getConstraints(), tableDef.getFullyQualifiedTableName());
- toExecute +=
- handleConstraintCreationSection(tableDef.getForeignKeyConstraints(), tableDef.getFullyQualifiedTableName());
- toExecute += " \n)\n";
- OseeLog.log(Activator.class, Level.FINE, "Creating Table: [ " + tableDef.getFullyQualifiedTableName() + "]");
- ConnectionHandler.runPreparedUpdate(connection, toExecute);
- }
-
- @Override
- public void dropTable(TableElement tableDef) throws OseeCoreException {
- String toExecute = "DROP TABLE " + formatQuotedString(tableDef.getFullyQualifiedTableName(), "\\.") + " CASCADE";
- OseeLog.log(Activator.class, Level.FINE, "Dropping Table: [ " + tableDef.getFullyQualifiedTableName() + "]");
- ConnectionHandler.runPreparedUpdate(toExecute);
- }
-
- @Override
- protected String formatQuotedString(String value, String splitAt) {
- String[] array = value.split(splitAt);
- for (int index = 0; index < array.length; index++) {
- array[index] = array[index];
- }
- return StringUtils.join(array, splitAt.replaceAll("\\\\", ""));
- }
-
- public void dropIndex(OseeConnection connection, TableElement tableDef) throws OseeCoreException {
- List<IndexElement> tableIndices = tableDef.getIndexData();
- String tableName = tableDef.getFullyQualifiedTableName();
- for (IndexElement iData : tableIndices) {
- if (iData.ignoreMySql()) {
- continue;
- }
- OseeLog.logf(Activator.class, Level.FINE,
- "Dropping Index: [%s] FROM [%s]\n", iData.getId(), tableName);
- if (iData.getId().equals("PRIMARY")) {
- ConnectionHandler.runPreparedUpdate(connection,
- "ALTER TABLE " + tableDef.getFullyQualifiedTableName() + " DROP PRIMARY KEY");
- } else {
- ConnectionHandler.runPreparedUpdate(connection,
- "ALTER TABLE " + tableDef.getFullyQualifiedTableName() + " DROP INDEX " + iData.getId());
- }
- }
- }
-
- @Override
- public String constraintDataToSQL(ConstraintElement constraint, String tableID) {
- StringBuilder toReturn = new StringBuilder();
- String id = formatQuotedString(constraint.getId(), "\\.");
- String type = constraint.getConstraintType().toString();
- String appliesTo = formatQuotedString(constraint.getCommaSeparatedColumnsList(), ",");
-
- if (Strings.isValid(id) && Strings.isValid(appliesTo)) {
- toReturn.append("CONSTRAINT " + id + " " + type + " (" + appliesTo + ")");
-
- if (constraint instanceof ForeignKey) {
- ForeignKey fk = (ForeignKey) constraint;
- List<ReferenceClause> refs = fk.getReferences();
-
- for (ReferenceClause ref : refs) {
- String refTable = formatQuotedString(ref.getFullyQualifiedTableName(), "\\.");
- String refColumns = formatQuotedString(ref.getCommaSeparatedColumnsList(), ",");
-
- String onUpdate = "";
- if (!ref.getOnUpdateAction().equals(OnUpdateEnum.UNSPECIFIED)) {
- onUpdate = "ON UPDATE " + ref.getOnUpdateAction().toString();
- }
-
- String onDelete = "";
- if (!ref.getOnDeleteAction().equals(OnDeleteEnum.UNSPECIFIED)) {
- onDelete = "ON DELETE " + ref.getOnDeleteAction().toString();
- }
-
- if (refTable != null && refColumns != null && !refTable.equals("") && !refColumns.equals("")) {
- toReturn.append(" REFERENCES " + refTable + " (" + refColumns + ")");
- if (!onUpdate.equals("")) {
- toReturn.append(" " + onUpdate);
- }
-
- if (!onDelete.equals("")) {
- toReturn.append(" " + onDelete);
- }
-
- if (constraint.isDeferrable()) {
- toReturn.append(" DEFERRABLE");
- }
- }
-
- else {
- OseeLog.log(Activator.class, Level.WARNING,
- "Skipping CONSTRAINT at Table: " + tableID + "\n\t " + fk.toString());
- }
-
- }
- }
- } else {
- OseeLog.log(Activator.class, Level.WARNING,
- "Skipping CONSTRAINT at Table: " + tableID + "\n\t " + constraint.toString());
- }
- return toReturn.toString();
- }
-
- public void createIndex(OseeConnection connection, TableElement tableDef) throws OseeCoreException {
- List<IndexElement> tableIndices = tableDef.getIndexData();
- String indexId = null;
- StringBuilder appliesTo = new StringBuilder();
- String tableName = formatQuotedString(tableDef.getFullyQualifiedTableName(), "\\.");
- for (IndexElement iData : tableIndices) {
- if (iData.ignoreMySql()) {
- continue;
- }
- indexId = iData.getId();
- appliesTo.delete(0, appliesTo.length());
-
- List<AppliesToClause> appliesToList = iData.getAppliesToList();
- for (int index = 0; index < appliesToList.size(); index++) {
- AppliesToClause record = appliesToList.get(index);
- appliesTo.append(record.getColumnName());
-
- // switch (record.getOrderType()) {
- // case Ascending:
- // appliesTo.append(" ASC");
- // break;
- // case Descending:
- // appliesTo.append(" DESC");
- // break;
- // default:
- // break;
- // }
- if (index + 1 < appliesToList.size()) {
- appliesTo.append(", ");
- }
- }
- String toExecute =
- String.format(CREATE_STRING + " " + iData.getIndexType() + " INDEX %s ON %s (%s)", indexId, tableName,
- appliesTo);
- OseeLog.log(Activator.class, Level.FINE, toExecute);
- ConnectionHandler.runPreparedUpdate(connection, toExecute);
- }
- }
-
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/PostgresqlDataType.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/PostgresqlDataType.java
deleted file mode 100644
index 42d4dd91c2..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/PostgresqlDataType.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.sql;
-
-/**
- * @author Roberto E. Escobar
- */
-public class PostgresqlDataType extends SqlDataType {
-
- public PostgresqlDataType() {
- super();
- }
-
- @Override
- public String getBooleanType() {
- return "bool";
- }
-
- @Override
- public String getBitType() {
- return "number";
- }
-
- @Override
- public String getIntegerType() {
- return "integer";
- }
-
- @Override
- public String getDecimalType() {
- return "decimal";
- }
-
- @Override
- public String getFloatType() {
- return "float";
- }
-
- @Override
- public String getRealType() {
- return "float8";
- }
-
- @Override
- public String getDoubleType() {
- return "numeric";
- }
-
- @Override
- public String getDateType() {
- return "date";
- }
-
- @Override
- public String getCharType() {
- return "char";
- }
-
- @Override
- public String getVarCharType() {
- return "varchar";
- }
-
- @Override
- public String getSmallIntType() {
- return "smallint";
- }
-
- @Override
- protected String getClobType() {
- return "text";
- }
-
- @Override
- protected String getTimestamp() {
- return "timestamp";
- }
-
- @Override
- protected String getTime() {
- return "time";
- }
-
- @Override
- protected String getBlobType() {
- return "bytea";
- }
-
- @Override
- protected String getBigInt() {
- return "numeric";
- }
-
- @Override
- protected String getLongVarCharType() {
- return "varchar";
- }
-
- @Override
- protected String getNumericType() {
- return "numeric";
- }
-
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/SchemaSqlUtil.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/SchemaSqlUtil.java
deleted file mode 100644
index 760eca33af..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/SchemaSqlUtil.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.sql;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.eclipse.osee.framework.core.datastore.schema.data.SchemaData;
-import org.eclipse.osee.framework.core.datastore.schema.data.TableElement;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-
-public class SchemaSqlUtil {
- private final SqlManager sqlManager;
-
- public SchemaSqlUtil(SqlManager sqlManager) {
- this.sqlManager = sqlManager;
- }
-
- public void addIndices(Set<String> schemas, Map<String, SchemaData> userSpecifiedConfig) throws OseeCoreException {
- for (String schemaId : schemas) {
- if (userSpecifiedConfig.containsKey(schemaId)) {
- SchemaData schemaData = userSpecifiedConfig.get(schemaId);
-
- for (TableElement tableDef : schemaData.getTableMap().values()) {
- sqlManager.createIndex(tableDef);
- }
- }
- }
- }
-
- public void addTables(Set<String> schemas, Map<String, SchemaData> userSpecifiedConfig) throws OseeCoreException {
- for (String schemaId : schemas) {
- if (userSpecifiedConfig.containsKey(schemaId)) {
- SchemaData schemaData = userSpecifiedConfig.get(schemaId);
-
- List<TableElement> tableDefs = schemaData.getTablesOrderedByDependency();
- for (TableElement tableDef : tableDefs) {
- sqlManager.createTable(tableDef);
- }
- }
- }
- }
-
- public void dropTables(Set<String> schemas, Map<String, SchemaData> userSpecifiedConfig, Map<String, SchemaData> currentDatabaseConfig) throws OseeCoreException {
- for (String schemaId : schemas) {
- if (currentDatabaseConfig.containsKey(schemaId)) {
- SchemaData currentDbSchemaData = currentDatabaseConfig.get(schemaId);
- SchemaData userSchema = userSpecifiedConfig.get(schemaId);
- Map<String, TableElement> currentDBmap = currentDbSchemaData.getTableMap();
- Map<String, TableElement> userDbMap = userSchema.getTableMap();
- Set<String> currentDbKeys = currentDBmap.keySet();
- Set<String> userDbKeys = userDbMap.keySet();
-
- SchemaData toDrop = new SchemaData();
- for (String userKey : userDbKeys) {
- if (currentDbKeys.contains(userKey)) {
- toDrop.addTableDefinition(currentDBmap.get(userKey));
- }
- }
-
- List<TableElement> tableDefs = toDrop.getTablesOrderedByDependency();
- for (int index = tableDefs.size() - 1; index >= 0; index--) {
- TableElement tableDef = tableDefs.get(index);
- sqlManager.dropTable(tableDef);
- }
- }
- }
- }
-
- public void dropIndices(Set<String> schemas, Map<String, SchemaData> userSpecifiedConfig, Map<String, SchemaData> currentDatabaseConfig) throws OseeCoreException {
- for (String schemaId : schemas) {
- if (currentDatabaseConfig.containsKey(schemaId)) {
- SchemaData currentDbSchemaData = currentDatabaseConfig.get(schemaId);
- SchemaData userSchema = userSpecifiedConfig.get(schemaId);
- Map<String, TableElement> currentDBmap = currentDbSchemaData.getTableMap();
- Map<String, TableElement> userDbMap = userSchema.getTableMap();
- Set<String> currentDbKeys = currentDBmap.keySet();
- Set<String> userDbKeys = userDbMap.keySet();
-
- SchemaData toDrop = new SchemaData();
- for (String userKey : userDbKeys) {
- if (currentDbKeys.contains(userKey)) {
- toDrop.addTableDefinition(currentDBmap.get(userKey));
- }
- }
-
- for (TableElement tableDef : toDrop.getTableMap().values()) {
- sqlManager.dropIndex(tableDef);
- }
- }
- }
- }
-
- public void createSchema(Set<String> schemas) throws OseeCoreException {
- for (String schemaId : schemas) {
- sqlManager.createSchema(schemaId.toLowerCase());
- }
- }
-
- public void dropSchema(Set<String> schemas) throws OseeCoreException {
- for (String schemaId : schemas) {
- sqlManager.dropSchema(schemaId.toLowerCase());
- }
- }
-
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/SqlDataType.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/SqlDataType.java
deleted file mode 100644
index 55241b1bf0..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/SqlDataType.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.sql;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.eclipse.osee.framework.database.core.SQL3DataType;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-
-/**
- * @author Roberto E. Escobar
- */
-public abstract class SqlDataType {
-
- public SqlDataType() {
- super();
- }
-
- protected abstract String getBooleanType();
-
- protected abstract String getBitType();
-
- protected abstract String getSmallIntType();
-
- protected abstract String getIntegerType();
-
- protected abstract String getDecimalType();
-
- protected abstract String getFloatType();
-
- protected abstract String getDoubleType();
-
- protected abstract String getRealType();
-
- protected abstract String getDateType();
-
- protected abstract String getCharType();
-
- protected abstract String getVarCharType();
-
- protected abstract String getClobType();
-
- protected abstract String getBlobType();
-
- protected abstract String getTimestamp();
-
- protected abstract String getTime();
-
- protected abstract String getBigInt();
-
- protected abstract String getLongVarCharType();
-
- protected abstract String getNumericType();
-
- public String getLimit(SQL3DataType dataType, String limit) {
- return limit;
- }
-
- public String getType(SQL3DataType dataType) {
- String toReturn = "";
-
- switch (dataType) {
- case BOOLEAN:
- toReturn = this.getBooleanType();
- break;
- case BIT:
- toReturn = this.getBitType();
- break;
- case SMALLINT:
- toReturn = this.getSmallIntType();
- break;
- case INTEGER:
- toReturn = this.getIntegerType();
- break;
- case REAL:
- toReturn = this.getRealType();
- break;
- case DECIMAL:
- toReturn = this.getDecimalType();
- break;
- case FLOAT:
- toReturn = this.getFloatType();
- break;
- case DOUBLE:
- toReturn = this.getDoubleType();
- break;
- case DATE:
- toReturn = this.getDateType();
- break;
- case CHAR:
- toReturn = this.getCharType();
- break;
- case VARCHAR:
- toReturn = this.getVarCharType();
- break;
- case CLOB:
- toReturn = this.getClobType();
- break;
- case TIMESTAMP:
- toReturn = this.getTimestamp();
- break;
- case TIME:
- toReturn = this.getTime();
- break;
- case BLOB:
- toReturn = this.getBlobType();
- break;
- case BIGINT:
- toReturn = this.getBigInt();
- break;
- case LONGVARCHAR:
- toReturn = this.getLongVarCharType();
- break;
- case NUMERIC:
- toReturn = this.getNumericType();
- break;
- default:
- toReturn = "ADDTHISTYPE:" + dataType.name();
- break;
- }
- return toReturn;
- }
-
- public String formatDataValueforDataType(String columnValue, SQL3DataType columnType) {
- String toReturn = "";
- switch (columnType) {
- case BIGINT:
- case BIT:
- case BOOLEAN:
- case DECIMAL:
- case DOUBLE:
- case FLOAT:
- case INTEGER:
- case REAL:
- case NUMERIC:
- case SMALLINT:
- case TINYINT:
- toReturn = Strings.isValid(columnValue) ? columnValue : "0";
- break;
- case DATE:
- toReturn = "{d '" + formatDate(columnValue) + "'}";
- break;
- case TIMESTAMP:
- toReturn = "{ts '" + formatDate(columnValue) + "'}";
- break;
- case TIME:
- toReturn = "{t '" + columnValue + "'}";
- break;
- default:
- toReturn = "'" + columnValue + "'";
- break;
- }
- return toReturn;
- }
-
- private String formatDate(String input) {
- String[] sets = input.split(" ");
- String date = sets[0];
- String time = "";
- if (sets.length > 1) {
- time += " ";
- for (int i = 1; i < sets.length; i++) {
- time += sets[i];
- }
- }
- if (!date.contains("/") && !date.contains("-") && !date.contains(":")) {
- Pattern pattern = Pattern.compile("([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])");
- Matcher matcher = pattern.matcher(date);
-
- if (matcher.find()) {
- if (matcher.groupCount() == 3) {
- String year = matcher.group(1);
- String month = matcher.group(2);
- String day = matcher.group(3);
-
- date = year + "-" + month + "-" + day;
- }
- }
- } else {
- date = date.replaceAll("/", "-");
- date = date.replaceAll(":", "-");
- }
- return date + time;
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/SqlFactory.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/SqlFactory.java
deleted file mode 100644
index 5434156848..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/SqlFactory.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.sql;
-
-import java.sql.DatabaseMetaData;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.database.core.SupportedDatabase;
-
-/**
- * @author Roberto E. Escobar
- */
-public class SqlFactory {
-
- private SqlFactory() {
- super();
- }
-
- public static SqlManager getSqlManager(DatabaseMetaData metaData) throws OseeCoreException {
- return getSqlManager(SupportedDatabase.getDatabaseType(metaData));
- }
-
- private static SqlManager getSqlManager(SupportedDatabase db) {
- SqlManager instance = null;
- switch (db) {
- case oracle:
- instance = new OracleSqlManager(new OracleSqlDataType());
- break;
- case foxpro:
- instance = new SqlManagerImpl(new FoxProDataType());
- break;
- case mysql:
- instance = new MysqlSqlManager(new MySqlDataType());
- break;
- case postgresql:
- instance = new PostgreSqlManager(new PostgresqlDataType());
- break;
- case h2:
- instance = new H2SqlManager(new H2DataType());
- break;
- default:
- break;
- }
- return instance;
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/SqlManager.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/SqlManager.java
deleted file mode 100644
index 7ab6da9590..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/SqlManager.java
+++ /dev/null
@@ -1,308 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.sql;
-
-import java.io.BufferedInputStream;
-import java.io.ByteArrayInputStream;
-import java.math.BigDecimal;
-import java.sql.Date;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Level;
-import org.apache.commons.lang.StringUtils;
-import org.eclipse.osee.framework.core.datastore.internal.Activator;
-import org.eclipse.osee.framework.core.datastore.schema.data.AppliesToClause;
-import org.eclipse.osee.framework.core.datastore.schema.data.ColumnDbData;
-import org.eclipse.osee.framework.core.datastore.schema.data.ColumnMetadata;
-import org.eclipse.osee.framework.core.datastore.schema.data.ConstraintElement;
-import org.eclipse.osee.framework.core.datastore.schema.data.ForeignKey;
-import org.eclipse.osee.framework.core.datastore.schema.data.IndexElement;
-import org.eclipse.osee.framework.core.datastore.schema.data.ReferenceClause;
-import org.eclipse.osee.framework.core.datastore.schema.data.ReferenceClause.OnDeleteEnum;
-import org.eclipse.osee.framework.core.datastore.schema.data.ReferenceClause.OnUpdateEnum;
-import org.eclipse.osee.framework.core.datastore.schema.data.SchemaDataLookup;
-import org.eclipse.osee.framework.core.datastore.schema.data.TableElement;
-import org.eclipse.osee.framework.core.datastore.schema.data.TableElement.ColumnFields;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
-import org.eclipse.osee.framework.database.core.SQL3DataType;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.jdk.core.util.time.GlobalTime;
-import org.eclipse.osee.framework.logging.OseeLog;
-
-/**
- * @author Roberto E. Escobar
- */
-public abstract class SqlManager {
- protected SqlDataType sqlDataType;
- public static final String CREATE_STRING = "CREATE";
- public static final String DROP_STRING = "DROP";
-
- public SqlManager(SqlDataType sqlDataType) {
- this.sqlDataType = sqlDataType;
- }
-
- public abstract void createTable(TableElement tableDef) throws OseeCoreException;
-
- public abstract void dropTable(TableElement tableDef) throws OseeCoreException;
-
- public void insertData(List<ColumnDbData> rowData, TableElement tableMetadata) throws OseeCoreException {
- List<String> columnNames = new ArrayList<String>();
- List<String> placeHolders = new ArrayList<String>();
- List<String> columnValues = new ArrayList<String>();
- List<SQL3DataType> columnTypes = new ArrayList<SQL3DataType>();
-
- for (ColumnDbData dbData : rowData) {
- String columnId = dbData.getColumnName();
- String columnValue = dbData.getColumnValue();
-
- ColumnMetadata columnMetadata = SchemaDataLookup.getColumnDefinition(tableMetadata.getColumns(), columnId);
- SQL3DataType type = SQL3DataType.valueOf(columnMetadata.getColumnField(ColumnFields.type));
-
- columnNames.add("\"" + columnId + "\"");
- placeHolders.add("?");
- columnValues.add(columnValue);
- columnTypes.add(type);
- }
-
- String toExecute =
- "INSERT INTO " + formatQuotedString(tableMetadata.getFullyQualifiedTableName(), "\\.") + " (\n";
- toExecute += StringUtils.join(columnNames, ",");
- toExecute += "\n) VALUES (\n";
- toExecute += StringUtils.join(placeHolders, ",");
- toExecute += ")\n";
-
- Object[] data = new Object[columnNames.size()];
- for (int index = 0; index < columnNames.size(); index++) {
- data[index] = preparedStatementHelper(columnTypes.get(index), columnValues.get(index));
- }
- ConnectionHandler.runPreparedUpdate(toExecute, data);
- }
-
- public Object preparedStatementHelper(SQL3DataType columnType, String value) throws OseeDataStoreException {
- switch (columnType) {
- case BINARY:
- case BIT:
- return Strings.isValid(value) ? Byte.parseByte(value) : 0;
- case TINYINT:
- case SMALLINT:
- return Strings.isValid(value) ? Short.valueOf(value) : 0;
- case INTEGER:
- return Strings.isValid(value) ? Integer.valueOf(value) : 0;
- case BIGINT:
- return Strings.isValid(value) ? BigDecimal.valueOf(Double.valueOf(value)) : new BigDecimal(0);
- case FLOAT:
- return Strings.isValid(value) ? Float.valueOf(value) : 0.0f;
- case NUMERIC:
- case DECIMAL:
- case REAL:
- case DOUBLE:
- return Strings.isValid(value) ? Double.valueOf(value) : 0.0;
- case CHAR:
- case VARCHAR:
- case LONGVARCHAR:
- return value;
- case DATE:
- return !Strings.isValid(value) ? SQL3DataType.DATE : Date.valueOf(value);
- case TIMESTAMP:
- return Strings.isValid(value) ? Timestamp.valueOf(value) : GlobalTime.GreenwichMeanTimestamp();
- case TIME:
- return !Strings.isValid(value) ? SQL3DataType.TIME : Time.valueOf(value);
- case VARBINARY:
- case LONGVARBINARY:
- return value.getBytes();
- case BLOB:
- return new BufferedInputStream(new ByteArrayInputStream(value.getBytes()));
- case CLOB:
- return new BufferedInputStream(new ByteArrayInputStream(value.getBytes()));
- case BOOLEAN:
- return !Strings.isValid(value) ? false : Boolean.parseBoolean(value);
- default:
- throw new OseeDataStoreException("unexpected column type [%s]", columnType);
- }
- }
-
- public String getType(SQL3DataType dataType) {
- return sqlDataType.getType(dataType);
- }
-
- public String columnDataToSQL(Map<ColumnFields, String> column) {
- StringBuilder toReturn = new StringBuilder();
-
- String columnLimits = column.get(ColumnFields.limits);
- String defaultValue = column.get(ColumnFields.defaultValue);
-
- SQL3DataType dataType = SQL3DataType.valueOf(column.get(ColumnFields.type));
- columnLimits = sqlDataType.getLimit(dataType, columnLimits);
- toReturn.append(column.get(ColumnFields.id));
- toReturn.append(" ");
- toReturn.append(sqlDataType.getType(dataType));
-
- if (Strings.isValid(columnLimits)) {
- toReturn.append(" (" + columnLimits + ")");
- }
- if (Strings.isValid(defaultValue)) {
- toReturn.append(" " + defaultValue);
- }
- return toReturn.toString();
- }
-
- protected String handleConstraintCreationSection(List<? extends ConstraintElement> constraints, String tableId) {
- List<String> constraintStatements = new ArrayList<String>();
- for (ConstraintElement constraint : constraints) {
- constraintStatements.add(constraintDataToSQL(constraint, tableId));
- }
- StringBuilder toExecute = new StringBuilder();
- toExecute.append((constraintStatements.size() != 0 ? ",\n" : ""));
- toExecute.append(StringUtils.join(constraintStatements, ",\n"));
- return toExecute.toString();
- }
-
- protected String formatQuotedString(String value, String splitAt) {
- String[] array = value.split(splitAt);
- for (int index = 0; index < array.length; index++) {
- array[index] = "\"" + array[index] + "\"";
- }
- return StringUtils.join(array, splitAt.replaceAll("\\\\", ""));
- }
-
- public String constraintDataToSQL(ConstraintElement constraint, String tableID) {
- StringBuilder toReturn = new StringBuilder();
- String id = formatQuotedString(constraint.getId(), "\\.");
- String type = constraint.getConstraintType().toString();
- String appliesTo = formatQuotedString(constraint.getCommaSeparatedColumnsList(), ",");
-
- if (Strings.isValid(id) && Strings.isValid(appliesTo)) {
- toReturn.append("CONSTRAINT " + id + " " + type + " (" + appliesTo + ")");
-
- if (constraint instanceof ForeignKey) {
- ForeignKey fk = (ForeignKey) constraint;
- List<ReferenceClause> refs = fk.getReferences();
-
- for (ReferenceClause ref : refs) {
- String refTable = formatQuotedString(ref.getFullyQualifiedTableName(), "\\.");
- String refColumns = formatQuotedString(ref.getCommaSeparatedColumnsList(), ",");
-
- String onUpdate = "";
- if (!ref.getOnUpdateAction().equals(OnUpdateEnum.UNSPECIFIED)) {
- onUpdate = "ON UPDATE " + ref.getOnUpdateAction().toString();
- }
-
- String onDelete = "";
- if (!ref.getOnDeleteAction().equals(OnDeleteEnum.UNSPECIFIED)) {
- onDelete = "ON DELETE " + ref.getOnDeleteAction().toString();
- }
-
- if (refTable != null && refColumns != null && !refTable.equals("") && !refColumns.equals("")) {
- toReturn.append(" REFERENCES " + refTable + " (" + refColumns + ")");
- if (!onUpdate.equals("")) {
- toReturn.append(" " + onUpdate);
- }
-
- if (!onDelete.equals("")) {
- toReturn.append(" " + onDelete);
- }
-
- if (constraint.isDeferrable()) {
- toReturn.append(" DEFERRABLE");
- }
- }
-
- else {
- OseeLog.log(Activator.class, Level.WARNING,
- "Skipping CONSTRAINT at Table: " + tableID + "\n\t " + fk.toString());
- }
-
- }
- }
- } else {
- OseeLog.log(Activator.class, Level.WARNING,
- "Skipping CONSTRAINT at Table: " + tableID + "\n\t " + constraint.toString());
- }
- return toReturn.toString();
- }
-
- public void createSchema(String schema) throws OseeCoreException {
- ConnectionHandler.runPreparedUpdate(CREATE_STRING + " SCHEMA \"" + schema + "\"");
- }
-
- public void dropSchema(String schema) throws OseeCoreException {
- ConnectionHandler.runPreparedUpdate(DROP_STRING + " SCHEMA \"" + schema + "\" CASCADE");
- }
-
- protected String insertDataToSQL(String fullyQualifiedTableName, List<String> columns, List<String> columnData) {
- StringBuilder toExecute = new StringBuilder();
- toExecute.append("INSERT INTO " + formatQuotedString(fullyQualifiedTableName, "\\.") + " (\n");
- toExecute.append(StringUtils.join(columns, ","));
- toExecute.append("\n) VALUES (\n");
- toExecute.append(StringUtils.join(columnData, ","));
- toExecute.append(")\n");
- return toExecute.toString();
- }
-
- public void createIndex(TableElement tableDef) throws OseeCoreException {
- List<IndexElement> tableIndices = tableDef.getIndexData();
- String indexId = null;
- StringBuilder appliesTo = new StringBuilder();
- String tableName = formatQuotedString(tableDef.getFullyQualifiedTableName(), "\\.");
- for (IndexElement iData : tableIndices) {
- if (iData.ignoreMySql()) {
- continue;
- }
- indexId = iData.getId();
- appliesTo.delete(0, appliesTo.length());
-
- List<AppliesToClause> appliesToList = iData.getAppliesToList();
- for (int index = 0; index < appliesToList.size(); index++) {
- AppliesToClause record = appliesToList.get(index);
- appliesTo.append(record.getColumnName());
-
- switch (record.getOrderType()) {
- case Ascending:
- appliesTo.append(" ASC");
- break;
- case Descending:
- appliesTo.append(" DESC");
- break;
- default:
- break;
- }
- if (index + 1 < appliesToList.size()) {
- appliesTo.append(", ");
- }
- }
- String toExecute =
- String.format("%s %s INDEX %s ON %s (%s)", CREATE_STRING, iData.getIndexType(), indexId, tableName,
- appliesTo);
- toExecute = createIndexPostProcess(iData, toExecute);
- OseeLog.log(Activator.class, Level.FINE, toExecute);
- ConnectionHandler.runPreparedUpdate(toExecute);
- }
- }
-
- protected String createIndexPostProcess(IndexElement indexElement, String original) {
- return original;
- }
-
- public void dropIndex(TableElement tableDef) throws OseeCoreException {
- List<IndexElement> tableIndices = tableDef.getIndexData();
- String tableName = tableDef.getFullyQualifiedTableName();
- for (IndexElement iData : tableIndices) {
- OseeLog.logf(Activator.class, Level.FINE,
- "Dropping Index: [%s] FROM [%s]\n", iData.getId(), tableName);
- ConnectionHandler.runPreparedUpdate(DROP_STRING + " INDEX " + iData.getId());
- }
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/SqlManagerImpl.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/SqlManagerImpl.java
deleted file mode 100644
index f95810fb85..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/SqlManagerImpl.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.sql;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.logging.Level;
-import org.eclipse.osee.framework.core.datastore.internal.Activator;
-import org.eclipse.osee.framework.core.datastore.schema.data.ColumnMetadata;
-import org.eclipse.osee.framework.core.datastore.schema.data.TableElement;
-import org.eclipse.osee.framework.core.datastore.schema.data.TableElement.ColumnFields;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
-import org.eclipse.osee.framework.logging.OseeLog;
-
-/**
- * @author Roberto E. Escobar
- */
-public class SqlManagerImpl extends SqlManager {
-
- public SqlManagerImpl(SqlDataType sqlDataType) {
- super(sqlDataType);
- }
-
- private String handleColumnCreationSection(Map<String, ColumnMetadata> columns) {
- List<String> lines = new ArrayList<String>();
- Set<String> keys = columns.keySet();
- for (String key : keys) {
- Map<ColumnFields, String> column = columns.get(key).getColumnFields();
- lines.add(columnDataToSQL(column));
- }
- String toExecute = org.eclipse.osee.framework.jdk.core.util.Collections.toString(",\n", lines);
- return toExecute;
- }
-
- @Override
- public void createTable(TableElement tableDef) throws OseeCoreException {
- StringBuilder toExecute = new StringBuilder();
- toExecute.append(SqlManager.CREATE_STRING + " TABLE " + formatQuotedString(tableDef.getFullyQualifiedTableName(),
- "\\.") + " ( \n");
- toExecute.append(handleColumnCreationSection(tableDef.getColumns()));
- toExecute.append(handleConstraintCreationSection(tableDef.getConstraints(), tableDef.getFullyQualifiedTableName()));
- toExecute.append(handleConstraintCreationSection(tableDef.getForeignKeyConstraints(),
- tableDef.getFullyQualifiedTableName()));
- toExecute.append(" \n)\n");
- OseeLog.log(Activator.class, Level.FINE, "Creating Table: [ " + tableDef.getFullyQualifiedTableName() + "]");
- ConnectionHandler.runPreparedUpdate(toExecute.toString());
- }
-
- @Override
- public void dropTable(TableElement tableDef) throws OseeCoreException {
- StringBuilder toExecute = new StringBuilder();
- toExecute.append(SqlManager.DROP_STRING + " TABLE " + formatQuotedString(tableDef.getFullyQualifiedTableName(),
- "\\."));
- OseeLog.log(Activator.class, Level.FINE, "Dropping Table: [ " + tableDef.getFullyQualifiedTableName() + "]");
- ConnectionHandler.runPreparedUpdate(toExecute.toString());
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/support/SKYNET.VERSIONING.SCHEMA.xml b/plugins/org.eclipse.osee.framework.core.datastore/support/SKYNET.VERSIONING.SCHEMA.xml
deleted file mode 100644
index 0c39834d36..0000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore/support/SKYNET.VERSIONING.SCHEMA.xml
+++ /dev/null
@@ -1,640 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<TableConfig>
-
-
- <!-- __________________________________________________________ -->
- <!-- Type Tables -->
- <!-- __________________________________________________________ -->
-
- <Table name="OSEE_TYPE_ID_MAP" schema="OSEE" tablespace="osee_data">
- <Column id="LOCAL_ID" defaultValue="not null" type="smallint" />
- <Column id="REMOTE_ID" defaultValue="not null" type="BIGINT" />
- <Constraint schema="OSEE" id="OSEE_TYPE_ID_MAP_AT_L_PK" type="PRIMARY KEY" appliesTo="LOCAL_ID" />
- <Index id="OSEE_TYPE_ID_MAP_R_IDX" type="UNIQUE" tablespace="osee_index">
- <AppliesTo id="REMOTE_ID"/>
- </Index>
- </Table>
-
- <TableDescription referenceTable="OSEE_TYPE_ID_MAP">
- <Note purpose="Mapping of remote_id to local_id for type token lookups"/>
- <Column id="LOCAL_ID" description="" />
- <Column id="REMOTE_ID" description="" />
- </TableDescription>
-
- <!-- _____________________________________________________ -->
- <!-- -->
- <!-- MAIN ARTIFACT TABLES -->
- <!-- -->
- <!-- _____________________________________________________ -->
-
- <Table name="OSEE_ARTIFACT" schema="OSEE" tablespace="osee_data">
- <Column id="GAMMA_ID" defaultValue="not null" type="BIGINT" />
- <Column id="ART_ID" defaultValue="not null" type="INTEGER" />
- <Column id="ART_TYPE_ID" defaultValue="not null" type="smallint" />
- <Column id="GUID" defaultValue="not null" limits="22" type="VARCHAR" />
- <Column id="HUMAN_READABLE_ID" defaultValue="not null" limits="5" type="VARCHAR" />
- <Constraint schema="OSEE" id="OSEE_ART__G_A_PK" type="PRIMARY KEY" appliesTo="ART_ID, GAMMA_ID" />
- <Constraint schema="OSEE" id="OSEE_ART__ART_TYPE_ID_FK" type="FOREIGN KEY" appliesTo="ART_TYPE_ID" deferrable="true">
- <References schema="OSEE" table="OSEE_TYPE_ID_MAP" column="LOCAL_ID" />
- </Constraint>
-
- <Index id="OSEE_ART__ART_ID_IDX" tablespace="osee_index">
- <AppliesTo id="ART_ID"/>
- </Index>
- <Index id="OSEE_ART__GUID_IDX" tablespace="osee_index">
- <AppliesTo id="GUID"/>
- </Index>
- <Index id="OSEE_ART__ART_TYPE_ID_IDX" tablespace="osee_index">
- <AppliesTo id="ART_TYPE_ID"/>
- </Index>
- </Table>
-
- <TableDescription referenceTable="OSEE_ARTIFACT">
- <Note purpose="Core definition for artifact instances."/>
- <Column id="GAMMA_ID" description="unique identifier for a version of this artifact"/>
- <Column id="ART_ID" description="unique identifier of this artifact" />
- <Column id="ART_TYPE_ID" description="this artifact&apos;s type - foreign key to osee_artifact_type.art_type_id " />
- <Column id="GUID" description="Global Unique IDentifier of this artifact" />
- <Column id="HUMAN_READABLE_ID" description="a human understandble unique identifier of this artifact" />
- </TableDescription>
-
- <Table name="OSEE_ATTRIBUTE" schema="OSEE" tablespace="osee_data">
- <Column id="GAMMA_ID" defaultValue="not null" type="BIGINT" />
- <Column id="ART_ID" defaultValue="not null" type="INTEGER" />
- <Column id="ATTR_ID" defaultValue="not null" type="INTEGER" />
- <Column id="ATTR_TYPE_ID" defaultValue="not null" type="smallint" />
- <Column id="VALUE" limits="4000" type="VARCHAR" />
- <Column id="URI" limits="200" type="VARCHAR" />
- <Constraint schema="OSEE" id="OSEE_ATTRIBUTE_AT_G_PK" type="PRIMARY KEY" appliesTo="ATTR_ID, GAMMA_ID" />
- <Index id="OSEE_ATTRIBUTE_ATT_IDX" tablespace="osee_index">
- <AppliesTo id="ATTR_TYPE_ID"/>
- </Index>
- <Index id="OSEE_ATTRIBUTE_V_IDX" mySqlIgnore="true" tablespace="osee_index">
- <AppliesTo id="VALUE"/>
- </Index>
- <Index id="OSEE_ATTRIBUTE_AR_V_IDX" mySqlIgnore="true" tablespace="osee_index">
- <AppliesTo id="ART_ID"/>
- <AppliesTo id="VALUE"/>
- </Index>
- <Index id="OSEE_ATTRIBUTE_AR_G_IDX" type="UNIQUE" tablespace="osee_index">
- <AppliesTo id="ART_ID"/>
- <AppliesTo id="GAMMA_ID"/>
- </Index>
- <Index id="OSEE_ATTRIBUTE_G_AT_IDX" type="UNIQUE" tablespace="osee_index">
- <AppliesTo id="GAMMA_ID"/>
- <AppliesTo id="ATTR_ID"/>
- </Index>
- <Index id="OSEE_ATTRIBUTE_G_IDX" type="UNIQUE" tablespace="osee_index">
- <AppliesTo id="GAMMA_ID"/>
- </Index>
- <Index id="OSEE_ATTRIBUTE_AT_IDX" tablespace="osee_index">
- <AppliesTo id="ATTR_ID"/>
- </Index>
- <Index id="OSEE_ATTRIBUTE_AR_IDX" mySqlIgnore="true" tablespace="osee_index">
- <AppliesTo id="ART_ID"/>
- </Index>
- </Table>
-
- <TableDescription referenceTable="OSEE_ATTRIBUTE">
- <Note purpose="Core descriptions for types of attributes."/>
- <Column id="GAMMA_ID" description="" />
- <Column id="ART_ID" description="" />
- <Column id="ATTR_ID" description="" />
- <Column id="ATTR_TYPE_ID" description="" />
- <Column id="VALUE" description="" />
- <Column id="URI" description="" />
- </TableDescription>
-
- <Table name="OSEE_RELATION_LINK" schema="OSEE" tablespace="osee_data">
- <Column id="GAMMA_ID" defaultValue="not null" type="BIGINT" />
- <Column id="REL_LINK_ID" defaultValue="not null" type="INTEGER" />
- <Column id="REL_LINK_TYPE_ID" defaultValue="not null" type="smallint" />
- <Column id="A_ART_ID" defaultValue="not null" type="INTEGER" />
- <Column id="B_ART_ID" defaultValue="not null" type="INTEGER" />
- <Column id="RATIONALE" limits="4000" type="VARCHAR" />
- <Constraint schema="OSEE" id="OSEE_RELATION__G_PK" type="PRIMARY KEY" appliesTo="GAMMA_ID" />
- <Constraint schema="OSEE" id="OSEE_RELATION__REL_TYPE_FK" type="FOREIGN KEY" appliesTo="REL_LINK_TYPE_ID" deferrable="true">
- <References schema="OSEE" table="OSEE_TYPE_ID_MAP" column="LOCAL_ID" />
- </Constraint>
- <Index id="OSEE_RELATION__R_G_IDX" type="UNIQUE" tablespace="osee_index">
- <AppliesTo id="REL_LINK_ID"/>
- <AppliesTo id="GAMMA_ID"/>
- </Index>
- <Index id="OSEE_RELATION__A_IDX" tablespace="osee_index">
- <AppliesTo id="A_ART_ID"/>
- </Index>
- <Index id="OSEE_RELATION__B_IDX" tablespace="osee_index">
- <AppliesTo id="B_ART_ID"/>
- </Index>
- </Table>
-
- <TableDescription referenceTable="OSEE_RELATION_LINK">
- <Note purpose="Relation instances which relate exactly 2 (different) artifacts."/>
- <Column id="RATIONALE" description="Provides an explantion/justification for the existance of this relation" />
- </TableDescription>
-
- <!-- __________________________________________________________ -->
- <!-- -->
- <!-- MAIN VERSIONING TABLES - CHANGE, TX, AND BRANCH SUPPORT -->
- <!-- -->
- <!-- __________________________________________________________ -->
-
-
- <Table name="OSEE_BRANCH" schema="OSEE" tablespace="osee_data">
- <Column id="BRANCH_GUID" defaultValue="not null" limits="28" type="VARCHAR" />
- <Column id="BRANCH_ID" defaultValue="not null" type="INTEGER" />
- <Column id="BRANCH_NAME" defaultValue="not null" limits="200" type="VARCHAR" />
- <Column id="PARENT_BRANCH_ID" defaultValue="not null" type="INTEGER" />
- <Column id="PARENT_TRANSACTION_ID" defaultValue="not null" type="INTEGER" />
- <Column id="ARCHIVED" defaultValue="not null" type="smallint" />
- <Column id="BRANCH_STATE" defaultValue="not null" type="smallint" />
- <Column id="ASSOCIATED_ART_ID" defaultValue="not null" type="INTEGER" />
- <Column id="BRANCH_TYPE" defaultValue="not null" type="smallint" />
- <Column id="BASELINE_TRANSACTION_ID" defaultValue="not null" type="INTEGER" />
-
- <Constraint schema="OSEE" id="OSEE_BRANCH_B_PK" type="PRIMARY KEY" appliesTo="BRANCH_ID" />
- <Constraint schema="OSEE" id="OSEE_BRANCH_G_IDX" type="UNIQUE" appliesTo="BRANCH_GUID" />
- <Index id="OSEE_BRANCH_A_IDX" tablespace="osee_index">
- <AppliesTo id="ARCHIVED" />
- </Index>
- </Table>
-
- <TableDescription referenceTable="OSEE_BRANCH">
- <Note purpose="Core table describing instances of OSEE Branches."/>
- <Column id="BRANCH_GUID" description="self-explanatory" />
- <Column id="BRANCH_ID" description="self-explanatory" />
- <Column id="BRANCH_NAME" description="Simple string name" />
- <Column id="PARENT_BRANCH_ID" description="self-explanatory" />
- <Column id="PARENT_TRANSACTION_ID" description="self-explanatory" />
- <Column id="ARCHIVED" description="Indicates whether transaction information (tx) related to this branch have been kept in the main OSEE_TXS transaction table or moved to the OSEE_TXS_ARCHIVED. " />
- <Column id="BRANCH_STATE" description="????" />
- <Column id="ASSOCIATED_ART_ID" description="-1 Unknown, 0 Created, 1 Modified, 2 Committed, 3 Rebaselined as referenced in enum BranchState.java" />
- <Column id="BRANCH_TYPE" description="0 Working, 2 Baseline, 3 Merge, 4 System Root as referenced in BranchType.java" />
- <Column id="BASELINE_TRANSACTION_ID" description="??? what did this mean" />
- </TableDescription>
-
- <Table name="OSEE_TXS" schema="OSEE" tablespace="osee_data">
- <Column id="BRANCH_ID" type="INTEGER" defaultValue="not null" />
- <Column id="GAMMA_ID" defaultValue="not null" type="BIGINT" />
- <Column id="TRANSACTION_ID" defaultValue="not null" type="INTEGER" />
- <Column id="TX_CURRENT" defaultValue="not null" type="smallint" />
- <Column id="MOD_TYPE" defaultValue="not null" type="smallint" />
- <Index id="OSEE_TXS_B_G_T_IDX" type="UNIQUE" tablespace="osee_index">
- <AppliesTo id="BRANCH_ID"/>
- <AppliesTo id="GAMMA_ID"/>
- <AppliesTo id="TRANSACTION_ID" />
- </Index>
- </Table>
-
- <TableDescription referenceTable="OSEE_TXS">
- <Note purpose="Addressing table"/>
- <Column id="GAMMA_ID" description="A given gamma may be referenced by many branches" />
- </TableDescription>
-
- <Table name="OSEE_TXS_ARCHIVED" schema="OSEE" tablespace="osee_archive_data">
- <Column id="BRANCH_ID" defaultValue="not null" type="INTEGER" />
- <Column id="GAMMA_ID" defaultValue="not null" type="BIGINT" />
- <Column id="TRANSACTION_ID" defaultValue="not null" type="INTEGER" />
- <Column id="TX_CURRENT" defaultValue="not null" type="smallint" />
- <Column id="MOD_TYPE" defaultValue="not null" type="smallint" />
- <Index id="OSEE_TXSA_B_G_T_IDX" type="UNIQUE" tablespace="osee_archive_index">
- <AppliesTo id="BRANCH_ID"/>
- <AppliesTo id="GAMMA_ID"/>
- <AppliesTo id="TRANSACTION_ID" />
- </Index>
- </Table>
-
- <TableDescription referenceTable="OSEE_TXS_ARCHIVED">
- <Note purpose="Transactions (tx) removed (archived in OSEE domain) are simply transactions removed from OSEE_TXS. Details of these can be found in OSEE_TXS_DETAILS."/>
- <Column id="BRANCH_ID" description="" />
- <Column id="GAMMA_ID" description="" />
- <Column id="TX_CURRENT" description="" />
- <Column id="MOD_TYPE" description="" />
- <Column id="TRANSACTION_ID" description="" />
- </TableDescription>
-
- <Table name="OSEE_TX_DETAILS" schema="OSEE" tablespace="osee_data">
- <Column id="TRANSACTION_ID" defaultValue="not null" type="INTEGER" />
- <Column id="TX_TYPE" defaultValue="not null" type="smallint" />
- <Column id="BRANCH_ID" defaultValue="not null" type="INTEGER" />
- <Column id="OSEE_COMMENT" limits="1000" type="VARCHAR" />
- <Column id="TIME" defaultValue="not null" type="TIMESTAMP"/>
- <Column id="AUTHOR" defaultValue="not null" type="INTEGER"/>
- <Column id="COMMIT_ART_ID" type="INTEGER" />
- <Constraint schema="OSEE" id="BRANCH_ID_FK1" type="FOREIGN KEY" appliesTo="BRANCH_ID" deferrable="true">
- <References schema="OSEE" table="OSEE_BRANCH" column="BRANCH_ID" />
- </Constraint>
- <Index id="OSEE_TX_DETAILS_B_TX_IDX" type="UNIQUE" tablespace="osee_index">
- <AppliesTo id="BRANCH_ID"/>
- <AppliesTo id="TRANSACTION_ID" />
- </Index>
- </Table>
-
- <TableDescription referenceTable="OSEE_TX_DETAILS">
- <Note purpose="Core table describing individual transactions from both OSEE_TXS and OSEE_TXS_ARCHIVED in larger context. Unique? transaction id."/>
- <Column id="TRANSACTION_ID" description="Transaction ID sequence derrived from OSEE_SEQUENCE.SKYNET_TRANSACTION_ID_SEQ" example="241"/>
- <Column id="TX_TYPE" description="??? 1 - Baseline, 0 - Non Baseline tx, meaning tx beginning tx on a branch derived from parent branch" />
- <Column id="BRANCH_ID" description="simple, integer based id" example="1" />
- <Column id="OSEE_COMMENT" description="Optional comment user gets to enter before certain transactions." />
- <Column id="TIME" description="self-explanatory"/>
- <Column id="AUTHOR" description="self-explanatory"/>
- <Column id="COMMIT_ART_ID" description="if NOT NULL, identifies committed branches (all types of commits of a branch).
- You can trace this Artifact ID back to a particular instance of an artifact performing the commit.
- Usually this references an Action (type-of-artifact)" example="370"/>
- </TableDescription>
-
- <!-- __________________________________________________________ -->
- <!-- -->
- <!-- ACCESS CONTROL LIST TABLES -->
- <!-- -->
- <!-- __________________________________________________________ -->
-
- <Table name="OSEE_ARTIFACT_ACL" schema="OSEE" tablespace="osee_data">
- <Column id="ART_ID" defaultValue="not null" type="INTEGER" />
- <Column id="PERMISSION_ID" defaultValue="not null" type="INTEGER" />
- <Column id="PRIVILEGE_ENTITY_ID" defaultValue="not null" type="INTEGER" />
- <Column id="BRANCH_ID" defaultValue="not null" type="INTEGER" />
- <Constraint schema="OSEE" id="OSEE_ARTIFACT_ACL_A_P_B_PK" type="PRIMARY KEY" appliesTo="ART_ID, PRIVILEGE_ENTITY_ID, BRANCH_ID" />
- <Constraint schema="OSEE" id="ARTIFACT_ACL_PERM_FK" type="FOREIGN KEY" appliesTo="PERMISSION_ID" deferrable="true">
- <References schema="OSEE" table="OSEE_PERMISSION" column="PERMISSION_ID" />
- </Constraint>
- </Table>
-
- <Table name="OSEE_BRANCH_ACL" schema="OSEE" tablespace="osee_data">
- <Column id="BRANCH_ID" defaultValue="not null" type="INTEGER" />
- <Column id="PERMISSION_ID" defaultValue="not null" type="INTEGER" />
- <Column id="PRIVILEGE_ENTITY_ID" defaultValue="not null" type="INTEGER" />
- <Constraint schema="OSEE" id="OSEE_BRANCH_ACL_B_P_PK" type="PRIMARY KEY" appliesTo="BRANCH_ID, PRIVILEGE_ENTITY_ID" />
- <Constraint schema="OSEE" id="BRANCH_ACL_FK" type="FOREIGN KEY" appliesTo="BRANCH_ID" deferrable="true">
- <References schema="OSEE" table="OSEE_BRANCH" column="BRANCH_ID" />
- </Constraint>
- <Constraint schema="OSEE" id="BRANCH_ACL_PERM_FK" type="FOREIGN KEY" appliesTo="PERMISSION_ID" deferrable="true">
- <References schema="OSEE" table="OSEE_PERMISSION" column="PERMISSION_ID" />
- </Constraint>
- </Table>
-
- <Table name="OSEE_PERMISSION" schema="OSEE" tablespace="osee_data">
- <Column id="PERMISSION_ID" defaultValue="not null" type="INTEGER" />
- <Column id="PERMISSION_NAME" defaultValue="not null" limits="50" type="VARCHAR" />
- <Constraint schema="OSEE" id="PERMISSION_PK" type="PRIMARY KEY" appliesTo="PERMISSION_ID" />
- </Table>
-
- <!-- __________________________________________________________ -->
- <!-- -->
- <!-- TAGGING TABLES -->
- <!-- -->
- <!-- __________________________________________________________ -->
-
- <Table name="OSEE_SEARCH_TAGS" schema="OSEE" tablespace="osee_data">
- <Column id="GAMMA_ID" defaultValue="not null" type="BIGINT" />
- <Column id="CODED_TAG_ID" defaultValue="not null" type="BIGINT" />
- <Constraint schema="OSEE" id="OSEE_SEARCH_TAGS__PK" type="PRIMARY KEY" appliesTo="CODED_TAG_ID, GAMMA_ID" />
- <Index id="OSEE_SEARCH_TAGS_C_IDX" tablespace="osee_index">
- <AppliesTo id="CODED_TAG_ID"/>
- </Index>
- <Index id="OSEE_SEARCH_TAGS_G_IDX" tablespace="osee_index">
- <AppliesTo id="GAMMA_ID"/>
- </Index>
- </Table>
-
- <TableDescription referenceTable="OSEE_SEARCH_TAGS">
- <Note purpose="Core table describing individual transactions from both OSEE_TXS and OSEE_TXS_ARCHIVED in larger context. Unique? transaction id."/>
- <Column id="TRANSACTION_ID" description="Transaction ID sequence derrived from OSEE_SEQUENCE.SKYNET_TRANSACTION_ID_SEQ" example="241"/>
- <Column id="TX_TYPE" description="??? 1 - Baseline, 0 - Non Baseline tx, meaning tx beginning tx on a branch derived from parent branch" />
- <Column id="BRANCH_ID" description="simple, integer based id" example="1" />
- <Column id="OSEE_COMMENT" description="Optional comment user gets to enter before certain transactions." />
- <Column id="TIME" description="self-explanatory"/>
- <Column id="AUTHOR" description="self-explanatory"/>
- <Column id="COMMIT_ART_ID" description="if NOT NULL, identifies committed branches (all types of commits of a branch).
- You can trace this Artifact ID back to a particular instance of an artifact performing the commit.
- Usually this references an Action (type-of-artifact)" example="370"/>
- </TableDescription>
-
- <Table name="OSEE_JOIN_SEARCH_TAGS" schema="OSEE" tablespace="osee_data">
- <Column id="QUERY_ID" defaultValue="not null" type="INTEGER" />
- <Column id="CODED_TAG_ID" defaultValue="not null" type="BIGINT" />
- <Column id="INSERT_TIME" defaultValue="not null" type="TIMESTAMP" />
- <Constraint schema="OSEE" id="OSEE_JOIN_SEARCH_TAGS_Q_C_PK" type="PRIMARY KEY" appliesTo="QUERY_ID, CODED_TAG_ID" />
- <Index id="OSEE_JOIN_SEARCH_TAGS_Q_IDX" tablespace="osee_index">
- <AppliesTo id="QUERY_ID"/>
- </Index>
- </Table>
-
- <TableDescription referenceTable="OSEE_JOIN_SEARCH_TAGS">
- <Note purpose="Core table describing ?"/>
- <Column id="QUERY_ID" description="randomly generated identifier for this short-lived join" />
- <Column id="CODED_TAG_ID" description="" />
- <Column id="INSERT_TIME" description="" />
- </TableDescription>
-
- <Table name="OSEE_TAG_GAMMA_QUEUE" schema="OSEE" tablespace="osee_data">
- <Column id="QUERY_ID" defaultValue="not null" type="INTEGER" />
- <Column id="GAMMA_ID" defaultValue="not null" type="BIGINT" />
- <Column id="INSERT_TIME" defaultValue="not null" type="TIMESTAMP" />
- <Constraint schema="OSEE" id="OSEE_JOIN_GAMMA_Q_G_PK" type="PRIMARY KEY" appliesTo="QUERY_ID, GAMMA_ID" />
- </Table>
-
- <TableDescription referenceTable="OSEE_TAG_GAMMA_QUEUE">
- <Note purpose="Core table describing ?"/>
- <Column id="QUERY_ID" description="randomly generated identifier for this short-lived join" />
- <Column id="GAMMA_ID" description="" />
- <Column id="INSERT_TIME" description="" />
- </TableDescription>
-
- <!-- __________________________________________________________ -->
- <!-- -->
- <!-- OSEE SEQUENCES and INFO -->
- <!-- -->
- <!-- __________________________________________________________ -->
-
- <Table name="OSEE_SEQUENCE" schema="OSEE" tablespace="osee_data">
- <Column id="LAST_SEQUENCE" defaultValue="not null" type="BIGINT" />
- <Column id="SEQUENCE_NAME" defaultValue="not null" type="VARCHAR" limits="128" />
- <Constraint schema="OSEE" id="SEQUENCE_ID_UN" type="UNIQUE" appliesTo="SEQUENCE_NAME" />
- </Table>
-
- <TableDescription referenceTable="OSEE_SEQUENCE">
- <Note purpose="Keeps track of last generated value of a sequence of given name - SEQUENCE_NAME."/>
- </TableDescription>
-
- <Table name="OSEE_INFO" schema="OSEE" tablespace="osee_data">
- <Column id="OSEE_VALUE" defaultValue="not null" type="VARCHAR" limits="1000" />
- <Column id="OSEE_KEY" defaultValue="not null" type="VARCHAR" limits="50" />
- <Constraint schema="OSEE" id="OSEE_INFO_KEY_UN_IDX" type="UNIQUE" appliesTo="OSEE_KEY" />
- </Table>
-
- <TableDescription referenceTable="OSEE_INFO">
- <Note purpose="Core table describing ?"/>
- <Column id="OSEE_VALUE" description="" />
- <Column id="OSEE_KEY" description="" />
- </TableDescription>
-
- <!-- __________________________________________________________ -->
- <!-- -->
- <!-- OSEE Merge -->
- <!-- -->
- <!-- __________________________________________________________ -->
-
- <Table name="OSEE_MERGE" schema="OSEE" tablespace="osee_data">
- <Column id="SOURCE_BRANCH_ID" defaultValue="not null" type="INTEGER" />
- <Column id="DEST_BRANCH_ID" defaultValue="not null" type="INTEGER" />
- <Column id="MERGE_BRANCH_ID" defaultValue="not null" type="INTEGER" />
- <Column id="COMMIT_TRANSACTION_ID" defaultValue="not null" type="INTEGER" />
- <Constraint schema="OSEE" id="OSEE_MERGE__PK" type="PRIMARY KEY" appliesTo="MERGE_BRANCH_ID" />
- <Constraint schema="OSEE" id="OSEE_MERGE__MBI_FK" type="FOREIGN KEY" appliesTo="MERGE_BRANCH_ID">
- <References schema="OSEE" table="OSEE_BRANCH" column="BRANCH_ID" />
- </Constraint>
- <Constraint schema="OSEE" id="OSEE_MERGE__DBI_FK" type="FOREIGN KEY" appliesTo="DEST_BRANCH_ID">
- <References schema="OSEE" table="OSEE_BRANCH" column="BRANCH_ID" />
- </Constraint>
- </Table>
-
- <TableDescription referenceTable="OSEE_MERGE">
- <Note purpose="Core table describing merge branches, these entries stay around because it is currently the only way to view merges.
- Please refer to http://wiki.eclipse.org/osee/branch for a developer guide on OSEE branches."/>
- <Column id="SOURCE_BRANCH_ID" description="branch being committed, 'working branch' " />
- <Column id="DEST_BRANCH_ID" description="branch being committed into, most commonly parent branch of source." />
- <Column id="MERGE_BRANCH_ID" description="self-explanatory" />
- <Column id="COMMIT_TRANSACTION_ID" description="if the merge branch has been already commited" />
- </TableDescription>
-
- <Table name="OSEE_CONFLICT" schema="OSEE" tablespace="osee_data">
- <Column id="CONFLICT_ID" defaultValue="not null" type="INTEGER" />
- <Column id="MERGE_BRANCH_ID" defaultValue="not null" type="INTEGER" />
- <Column id="CONFLICT_TYPE" defaultValue="not null" type="smallint" />
- <Column id="SOURCE_GAMMA_ID" defaultValue="not null" type="BIGINT" />
- <Column id="DEST_GAMMA_ID" defaultValue="not null" type="BIGINT" />
- <Column id="STATUS" defaultValue="not null" type="smallint" />
- <Constraint schema="OSEE" id="OSEE_CONFLICT__PK" type="PRIMARY KEY" appliesTo="MERGE_BRANCH_ID, SOURCE_GAMMA_ID" />
- <Constraint schema="OSEE" id="OSEE_CONFLICT__MBI_FK" type="FOREIGN KEY" appliesTo="MERGE_BRANCH_ID">
- <References schema="OSEE" table="OSEE_MERGE" column="MERGE_BRANCH_ID" />
- </Constraint>
- </Table>
-
- <TableDescription referenceTable="OSEE_CONFLICT">
- <Note purpose="Core table describing individual conflicts per merge branch."/>
- <Column id="CONFLICT_ID" description="" />
- <Column id="MERGE_BRANCH_ID" description="" />
- <Column id="CONFLICT_TYPE" description="" />
- <Column id="SOURCE_GAMMA_ID" description="" />
- <Column id="DEST_GAMMA_ID" description="" />
- <Column id="STATUS" description="" />
- </TableDescription>
-
- <!-- __________________________________________________________ -->
- <!-- -->
- <!-- IMPORT TABLES -->
- <!-- __________________________________________________________ -->
-
- <Table name="OSEE_JOIN_EXPORT_IMPORT" schema="OSEE" tablespace="osee_data">
- <Column id="QUERY_ID" defaultValue="not null" type="INTEGER" />
- <Column id="ID1" defaultValue="not null" type="BIGINT" />
- <Column id="ID2" defaultValue="not null" type="BIGINT" />
- <Column id="INSERT_TIME" defaultValue="not null" type="TIMESTAMP" />
- <Index id="OSEE_JOIN_EXPORT_IMPORT_Q_IDX" tablespace="osee_index">
- <AppliesTo id="QUERY_ID"/>
- </Index>
- </Table>
-
- <TableDescription referenceTable="OSEE_JOIN_EXPORT_IMPORT">
- <Note purpose="Core table describing ?"/>
- </TableDescription>
-
- <Table name="OSEE_IMPORT_SOURCE" schema="OSEE" tablespace="osee_data">
- <Column id="IMPORT_ID" defaultValue="not null" type="INTEGER" />
- <Column id="DB_SOURCE_GUID" defaultValue="not null" type="VARCHAR" limits="28"/>
- <Column id="SOURCE_EXPORT_DATE" defaultValue="not null" type="TIMESTAMP" />
- <Column id="DATE_IMPORTED" defaultValue="not null" type="TIMESTAMP" />
- <Constraint schema="OSEE" id="OSEE_IMPORT_MAP_PK" type="PRIMARY KEY" appliesTo="IMPORT_ID" />
- </Table>
-
- <TableDescription referenceTable="OSEE_IMPORT_SOURCE">
- <Note purpose="Core table describing ?"/>
- </TableDescription>
-
- <Table name="OSEE_IMPORT_SAVE_POINT" schema="OSEE" tablespace="osee_data">
- <Column id="IMPORT_ID" defaultValue="not null" type="INTEGER" />
- <Column id="SAVE_POINT_NAME" defaultValue="not null" type="VARCHAR" limits="128"/>
- <Column id="STATUS" defaultValue="not null" type="INTEGER" />
- <Column id="STATE_ERROR" type="VARCHAR" limits="4000" />
- <Constraint schema="OSEE" id="OSEE_IMP_SAVE_POINT_II_PK" type="PRIMARY KEY" appliesTo="IMPORT_ID, SAVE_POINT_NAME" />
- <Constraint schema="OSEE" id="OSEE_IMP_SAVE_POINT_II_FK" type="FOREIGN KEY" appliesTo="IMPORT_ID" deferrable="true">
- <References schema="OSEE" table="OSEE_IMPORT_SOURCE" column="IMPORT_ID" />
- </Constraint>
- </Table>
-
- <TableDescription referenceTable="OSEE_IMPORT_SAVE_POINT">
- <Note purpose="Core table describing ?"/>
- </TableDescription>
-
- <Table name="OSEE_IMPORT_MAP" schema="OSEE" tablespace="osee_data">
- <Column id="IMPORT_ID" defaultValue="not null" type="INTEGER" />
- <Column id="SEQUENCE_ID" defaultValue="not null" type="INTEGER" />
- <Column id="SEQUENCE_NAME" defaultValue="not null" type="VARCHAR" limits="128"/>
- <Constraint schema="OSEE" id="OSEE_IMPORT_MAP_II_PK" type="PRIMARY KEY" appliesTo="SEQUENCE_ID" />
- <Constraint schema="OSEE" id="OSEE_IMPORT_MAP_II_FK" type="FOREIGN KEY" appliesTo="IMPORT_ID" deferrable="true">
- <References schema="OSEE" table="OSEE_IMPORT_SOURCE" column="IMPORT_ID" />
- </Constraint>
- </Table>
-
- <TableDescription referenceTable="OSEE_IMPORT_MAP">
- <Note purpose="Core table describing ?"/>
- </TableDescription>
-
- <Table name="OSEE_IMPORT_INDEX_MAP" schema="OSEE" tablespace="osee_data">
- <Column id="SEQUENCE_ID" defaultValue="not null" type="INTEGER" />
- <Column id="ORIGINAL_ID" defaultValue="not null" type="BIGINT"/>
- <Column id="MAPPED_ID" defaultValue="not null" type="BIGINT" />
- <Constraint schema="OSEE" id="OSEE_IMPORT_INDEX_MAP_IOM_PK" type="PRIMARY KEY" appliesTo="SEQUENCE_ID, ORIGINAL_ID, MAPPED_ID" />
- <Constraint schema="OSEE" id="OSEE_IMPORT_INDEX_MAP_II_FK" type="FOREIGN KEY" appliesTo="SEQUENCE_ID" deferrable="true">
- <References schema="OSEE" table="OSEE_IMPORT_MAP" column="SEQUENCE_ID" />
- </Constraint>
- <Index id="OSEE_IMPORT_INDEX_MAP_IO_IDX" tablespace="osee_index">
- <AppliesTo id="SEQUENCE_ID"/>
- <AppliesTo id="ORIGINAL_ID"/>
- </Index>
- <Index id="OSEE_IMPORT_INDEX_MAP_IM_IDX" tablespace="osee_index">
- <AppliesTo id="SEQUENCE_ID"/>
- <AppliesTo id="MAPPED_ID"/>
- </Index>
- </Table>
-
- <TableDescription referenceTable="OSEE_IMPORT_INDEX_MAP">
- <Note purpose="Core table describing ?"/>
- </TableDescription>
-
- <!-- __________________________________________________________ -->
- <!-- -->
- <!-- Application Server -->
- <!-- -->
- <!-- __________________________________________________________ -->
-
- <Table name="OSEE_SERVER_LOOKUP" schema="OSEE" tablespace="osee_data">
- <Column id="VERSION_ID" defaultValue="not null" type="VARCHAR" limits="100" />
- <Column id="SERVER_ADDRESS" defaultValue="not null" type="VARCHAR" limits="255"/>
- <Column id="PORT" defaultValue="not null" type="INTEGER" />
- <Column id="ACCEPTS_REQUESTS" defaultValue="not null" type="smallint" />
- <Column id="START_TIME" defaultValue="not null" type="TIMESTAMP" />
- <Column id="SERVER_ID" defaultValue="not null" type="VARCHAR" limits="40" />
- <Constraint schema="OSEE" id="OSEE_SERVER_LOOKUP_PK" type="PRIMARY KEY" appliesTo="SERVER_ADDRESS, PORT, VERSION_ID" />
- </Table>
-
- <TableDescription referenceTable="OSEE_SERVER_LOOKUP">
- <Note purpose="Core table used in arbitration of current OSEE servers"/>
- </TableDescription>
-
- <Table name="OSEE_SESSION" schema="OSEE" tablespace="osee_data">
- <Column id="MANAGED_BY_SERVER_ID" defaultValue="not null" type="VARCHAR" limits="40" />
- <Column id="SESSION_ID" defaultValue="not null" type="VARCHAR" limits="28" />
- <Column id="USER_ID" defaultValue="not null" type="VARCHAR" limits="100"/>
- <Column id="CLIENT_MACHINE_NAME" defaultValue="not null" type="VARCHAR" limits="100"/>
- <Column id="CLIENT_ADDRESS" defaultValue="not null" type="VARCHAR" limits="255"/>
- <Column id="CLIENT_PORT" defaultValue="not null" type="INTEGER" />
- <Column id="CLIENT_VERSION" defaultValue="not null" type="VARCHAR" limits="100"/>
- <Column id="CREATED_ON" defaultValue="not null" type="TIMESTAMP" />
- <Column id="LAST_INTERACTION_DATE" defaultValue="not null" type="TIMESTAMP" />
- <Column id="LAST_INTERACTION" defaultValue="not null" type="VARCHAR" limits="1000"/>
- <Constraint schema="OSEE" id="OSEE_SESSION_PK" type="PRIMARY KEY" appliesTo="SESSION_ID" />
- </Table>
-
- <TableDescription referenceTable="OSEE_SESSION">
- <Note purpose="Core table describing ?"/>
- </TableDescription>
-
-
- <!-- __________________________________________________________ -->
- <!-- Join Tables -->
- <!-- __________________________________________________________ -->
-
- <Table name="OSEE_JOIN_ARTIFACT" schema="OSEE" tablespace="osee_data">
- <Column id="QUERY_ID" defaultValue="not null" type="INTEGER" />
- <Column id="ART_ID" defaultValue="not null" type="INTEGER" />
- <Column id="BRANCH_ID" defaultValue="not null" type="INTEGER" />
- <Column id="TRANSACTION_ID" type="INTEGER" />
- <Column id="INSERT_TIME" defaultValue="not null" type="TIMESTAMP" />
- <Index id="OSEE_JOIN_ART__Q_A_B_T_IDX" type="UNIQUE" tablespace="osee_index">
- <AppliesTo id="QUERY_ID"/>
- <AppliesTo id="ART_ID"/>
- <AppliesTo id="BRANCH_ID"/>
- <AppliesTo id="TRANSACTION_ID"/>
- </Index>
- </Table>
-
- <TableDescription referenceTable="OSEE_JOIN_ARTIFACT">
- <Note purpose="Temporary working table to improve performance of joins"/>
- <Column id="QUERY_ID" description="randomly generated identifier for this short-lived join" />
- <Column id="ART_ID" description="application specific INTEGER identifier" />
- <Column id="BRANCH_ID" description="application specific INTEGER identifier" />
- <Column id="TRANSACTION_ID" description="application specific INTEGER identifier" />
- <Column id="INSERT_TIME" description="time this join query was started" />
- </TableDescription>
-
- <Table name="OSEE_JOIN_ID" schema="OSEE" tablespace="osee_data">
- <Column id="QUERY_ID" defaultValue="not null" type="INTEGER" />
- <Column id="ID" type="INTEGER" />
- <Column id="INSERT_TIME" type="TIMESTAMP" />
- <Index id="OSEE_JOIN_ID__Q_I_IDX" type="UNIQUE" tablespace="osee_index">
- <AppliesTo id="QUERY_ID"/>
- <AppliesTo id="ID"/>
- </Index>
- </Table>
-
- <TableDescription referenceTable="OSEE_JOIN_ID">
- <Note purpose="Temporary working table to improve performance of joins"/>
- <Column id="QUERY_ID" description="randomly generated identifier for this short-lived join"/>
- <Column id="ID" description="application specific INTEGER identifier"/>
- <Column id="INSERT_TIME" description="time this join query was started"/>
- </TableDescription>
-
- <Table name="OSEE_JOIN_CLEANUP" schema="OSEE" tablespace="osee_data">
- <Column id="QUERY_ID" defaultValue="not null" type="INTEGER" />
- <Column id="SESSION_ID" defaultValue="not null" type="VARCHAR" limits="28" />
- <Column id="TABLE_NAME" defaultValue="not null" type="VARCHAR" limits="28"/>
- <Index id="OSEE_JOIN_CLEANUP__Q_IDX" type="UNIQUE" tablespace="osee_index">
- <AppliesTo id="QUERY_ID"/>
- </Index>
- </Table>
-
- <TableDescription referenceTable="OSEE_JOIN_CLEANUP">
- <Note purpose="Temporary working table that tracks query joins that are used in the other join tables for later clean-up.
- This cleanup is only needed if the application/server fails to do the expected delete
- based on the corresponding query id. Cleanup is performed when the corresponding session has been closed."/>
- <Column id="QUERY_ID" description="randomly generated identifier for this short-lived join"/>
- <Column id="SESSION_ID" description="unique identifier of the session that issued the query"/>
- <Column id="TABLE_NAME" description="name of the join table that stores the join with this query_id"/>
- </TableDescription>
-
- <Table name="OSEE_JOIN_CHAR_ID" schema="OSEE" tablespace="osee_data">
- <Column id="QUERY_ID" defaultValue="not null" type="INTEGER" />
- <Column id="ID" defaultValue="not null" type="VARCHAR" limits="4000"/>
- <Index id="OSEE_JOIN_CHAR__Q_IDX" tablespace="osee_index">
- <AppliesTo id="QUERY_ID"/>
- </Index>
- </Table>
-
- <TableDescription referenceTable="OSEE_JOIN_CHAR_ID">
- <Note purpose="Temporary working table to improve performance of joins of type VARCHAR"/>
- <Column id="QUERY_ID" description="randomly generated identifier for this short-lived join"/>
- <Column id="ID" description="application specific VARCHAR identifier"/>
- </TableDescription>
-
-
- <Table name="OSEE_JOIN_TRANSACTION" schema="OSEE" tablespace="osee_data">
- <Column id="QUERY_ID" defaultValue="not null" type="INTEGER" />
- <Column id="TRANSACTION_ID" defaultValue="not null" type="INTEGER" />
- <Column id="GAMMA_ID" defaultValue="not null" type="BIGINT" />
- <Column id="INSERT_TIME" defaultValue="not null" type="TIMESTAMP" />
- <Column id="BRANCH_ID" type="INTEGER" />
- <Index id="OSEE_JOIN_TRANSACTION_Q_IDX" tablespace="osee_index">
- <AppliesTo id="QUERY_ID"/>
- </Index>
- </Table>
-
- <TableDescription referenceTable="OSEE_JOIN_TRANSACTION">
- <Note purpose="Temporary working table to improve performance of joins"/>
- <Column id="QUERY_ID" description="randomly generated identifier for this short-lived join"/>
- <Column id="TRANSACTION_ID" description="application specific INTEGER identifier"/>
- <Column id="GAMMA_ID" description="application specific INTEGER identifier"/>
- <Column id="INSERT_TIME" description="time this join query was started"/>
- </TableDescription>
-</TableConfig>

Back to the top