Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--features/org.eclipse.osee.orcs.feature.source/feature.xml7
-rw-r--r--features/org.eclipse.osee.orcs.feature/feature.xml7
-rw-r--r--plugins/org.eclipse.osee.database.schema/.classpath (renamed from plugins/org.eclipse.osee.framework.core.datastore.test/.classpath)0
-rw-r--r--plugins/org.eclipse.osee.database.schema/.project (renamed from plugins/org.eclipse.osee.framework.core.datastore.test/.project)2
-rw-r--r--plugins/org.eclipse.osee.database.schema/META-INF/MANIFEST.MF19
-rw-r--r--plugins/org.eclipse.osee.database.schema/build.properties9
-rw-r--r--plugins/org.eclipse.osee.database.schema/pom.xml34
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/DatabaseCallable.java65
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/DatabaseTxCallable.java (renamed from plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/util/DatabaseTxCallable.java)32
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/InitializeSchemaCallable.java47
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/SchemaOptions.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/SchemaCreationOptions.java)6
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/SchemaResource.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/IOseeSchemaResource.java)4
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/SchemaResourceProvider.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/IOseeSchemaProvider.java)6
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/callable/BackupTableCallable.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/BackupTableDataOperation.java)33
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/callable/CreateSchemaCallable.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/CreateSchemaOperation.java)30
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/callable/DatabaseDataExtractorCallable.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/DatabaseDataExtractor.java)45
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/callable/ExtractSchemaCallable.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/ExtractDatabaseSchemaOperation.java)50
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/callable/ImportDataFromDbCallable.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/ImportDataFromDbServiceOperation.java)51
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/callable/LoadUserSchemasCallable.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/LoadUserSchemasOperation.java)66
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/callable/PrintTablesCallable.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/PrintTables.java)53
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/callable/RestoreTableDataOperation.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/RestoreTableDataOperation.java)35
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/data/AppliesToClause.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/AppliesToClause.java)53
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/data/ColumnDbData.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ColumnDbData.java)2
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/data/ColumnMetadata.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ColumnMetadata.java)56
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/data/ConstraintElement.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ConstraintElement.java)67
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/data/ConstraintFactory.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ConstraintFactory.java)2
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/data/ConstraintTypes.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ConstraintTypes.java)2
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/data/ForeignKey.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ForeignKey.java)2
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/data/IndexElement.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/IndexElement.java)63
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/data/ReferenceClause.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ReferenceClause.java)65
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/data/SchemaData.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/SchemaData.java)78
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/data/SchemaDataLookup.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/SchemaDataLookup.java)33
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/data/SchemaXmlParser.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/SchemaXmlParser.java)48
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/data/TableElement.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/TableElement.java)87
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/sql/FoxProDataType.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/FoxProDataType.java)2
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/sql/H2DataType.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/H2DataType.java)2
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/sql/H2SqlManager.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/H2SqlManager.java)9
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/sql/MySqlDataType.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/MySqlDataType.java)2
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/sql/MysqlSqlManager.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/MysqlSqlManager.java)44
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/sql/OracleSqlDataType.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/OracleSqlDataType.java)2
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/sql/OracleSqlManager.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/OracleSqlManager.java)22
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/sql/PostgreSqlManager.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/PostgreSqlManager.java)51
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/sql/PostgresqlDataType.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/PostgresqlDataType.java)2
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/sql/SchemaSqlUtil.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/SchemaSqlUtil.java)6
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/sql/SqlDataType.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/SqlDataType.java)2
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/sql/SqlFactory.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/SqlFactory.java)20
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/sql/SqlManager.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/SqlManager.java)74
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/sql/SqlManagerImpl.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/SqlManagerImpl.java)22
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/util/DatabaseDataImporter.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/DatabaseDataImporter.java)62
-rw-r--r--plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/util/FileUtility.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/FileUtility.java)2
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/BranchManagementTestSuite.java8
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/mocks/MockBranchOperationFactory.java41
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/purge/BranchOperationTest.java101
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/.project5
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/META-INF/MANIFEST.MF21
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/OSGI-INF/branch.exchange.xml16
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/OSGI-INF/exchange.provider.xml15
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/OSGI-INF/locator.provider.exchange.xml15
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/build.properties14
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/IOseeBranchService.java48
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/TxCurrentsAndModTypesCommand.java4
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/change/ChangeItemLoader.java193
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/BranchExchangeImpl.java (renamed from plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/BranchExchange.java)76
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/ExchangeDb.java13
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/ExchangeIntegrity.java12
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/ExchangeUtil.java23
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/ExportController.java30
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/ForeignKeyReader.java5
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/IOseeExchangeDataProvider.java5
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/ImportController.java22
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/OseeServices.java105
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/PrimaryKeyCollector.java5
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/ReferentialIntegrityConstraint.java8
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/export/AbstractExportItem.java9
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/export/DbTableExportItem.java5
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/handler/BaseDbSaxHandler.java16
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/handler/BaseExportImportSaxHandler.java1
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/handler/BranchDataSaxHandler.java21
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/handler/DbTableSaxHandler.java21
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/handler/ImportOseeModelHandler.java3
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/handler/StandardOseeDbExportDataProvider.java18
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/resource/ExchangeProvider.java60
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/ExchangeDataProcessor.java3
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_8_3Transformer.java1
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_9_0Transformer.java2
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_9_0TxDetailsHandler.java1
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_9_0TypeHandler.java1
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_9_2ArtifactVersionHandler.java1
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_9_2TxDetailsHandler.java1
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_9_4Transformer.java1
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/internal/Activator.java48
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/internal/OseeBranchService.java223
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/internal/trackers/OseeBranchExchangeServiceRegistrationHandler.java72
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/internal/trackers/OseeBranchServiceRegistrationHandler.java89
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/BranchOperation.java84
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/IBranchOperationFactory.java21
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/PurgeBranchOperation.java99
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/PurgeBranchOperationFactory.java38
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore.test/.pmd925
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore.test/META-INF/MANIFEST.MF10
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore.test/build.properties4
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore.test/src/org/eclipse/osee/framework/core/datastore/test/cache/DatabaseTransactionRecordAccessorTest.java66
-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/OseeSchemaProvider.java46
-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/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/operations/OperationFactory.java45
-rw-r--r--plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/Branch.java25
-rw-r--r--plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/ReadableBranch.java61
-rw-r--r--plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/WriteableBranch.java18
-rw-r--r--plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/BranchFilter.java4
-rw-r--r--plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/InternalTestSuite.java3
-rw-r--r--plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/branch/BranchTestSuite.java (renamed from plugins/org.eclipse.osee.framework.core.datastore.test/src/org/eclipse/osee/framework/core/datastore/test/AllCoreDatastoreTestSuite.java)18
-rw-r--r--plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/branch/provider/BranchProviderTestSuite.java (renamed from plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/purge/PurgeTestSuite.java)6
-rw-r--r--plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/branch/provider/DeletedBranchProviderTest.java (renamed from plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/purge/DeletedBranchProviderTest.java)4
-rw-r--r--plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/branch/provider/MockBranchProvider.java (renamed from plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/mocks/MockBranchProvider.java)5
-rw-r--r--plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/branch/provider/MultiBranchProviderTest.java (renamed from plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/purge/MultiBranchProviderTest.java)4
-rw-r--r--plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/branch/provider/PurgeBranchTest.java140
-rw-r--r--plugins/org.eclipse.osee.orcs.core/META-INF/MANIFEST.MF2
-rw-r--r--plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.api.xml2
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/BranchDataStore.java37
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/DataStoreAdmin.java25
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/DataStoreConstants.java (renamed from plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/IOseeBranchServiceProvider.java)13
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/DataStoreInfo.java (renamed from plugins/org.eclipse.osee.framework.core.datastore.test/src/org/eclipse/osee/framework/core/datastore/test/cache/CacheAccessorSuite.java)13
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsAdminImpl.java46
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsApiImpl.java60
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsBranchImpl.java104
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/SystemPreferencesImpl.java5
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/admin/AbstractAdminCallable.java88
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/admin/CreateDatastoreCallable.java46
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/admin/FetchDatastoreMetadataCallable.java43
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/AbstractBranchCallable.java95
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/ArchiveUnarchiveBranchCallable.java58
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/BranchUtil.java49
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/ChangeBranchStateCallable.java57
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/ChangeBranchTypeCallable.java57
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/CommitBranchCallable.java59
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/CompareBranchCallable.java53
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/CreateBranchCallable.java46
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/DeleteBranchCallable.java58
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/PurgeBranchCallable.java80
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/provider/BranchProvider.java (renamed from plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/IBranchesProvider.java)4
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/provider/DeletedBranchProvider.java (renamed from plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/DeletedBranchProvider.java)5
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/provider/MultiBranchProvider.java (renamed from plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/MultiBranchProvider.java)4
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/provider/SingleBranchProvider.java (renamed from plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/SingleBranchProvider.java)4
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/OrcsTransactionImpl.java139
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionFactoryImpl.java43
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/ChangeTestSuite.java (renamed from plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/change/ChangeTestSuite.java)8
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/ChangeTestUtility.java66
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/ComputeNetChangeTest.java (renamed from plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/change/ComputeNetChangeTest.java)25
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/MockChangeItem.java24
-rw-r--r--plugins/org.eclipse.osee.orcs.db/META-INF/MANIFEST.MF7
-rw-r--r--plugins/org.eclipse.osee.orcs.db/OSGI-INF/branch.data.store.xml11
-rw-r--r--plugins/org.eclipse.osee.orcs.db/OSGI-INF/data.store.admin.xml12
-rw-r--r--plugins/org.eclipse.osee.orcs.db/OSGI-INF/osee.datastore.schema.resource.xml8
-rw-r--r--plugins/org.eclipse.osee.orcs.db/build.properties10
-rw-r--r--plugins/org.eclipse.osee.orcs.db/schema/SKYNET.VERSIONING.SCHEMA.xml (renamed from plugins/org.eclipse.osee.framework.core.datastore/support/SKYNET.VERSIONING.SCHEMA.xml)0
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/DataStoreAdminImpl.java107
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/DataStoreConstants.java26
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/DatabaseBranchAccessor.java7
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/DatabaseConflictAccessor.java (renamed from plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/change/DatabaseOseeConflictAccessor.java)16
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/UpdatePreviousTxCurrent.java (renamed from plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/commit/UpdatePreviousTxCurrent.java)32
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/branch/BranchDataStoreImpl.java87
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/branch/BranchUpdateEventImpl.java111
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/branch/CreateDatabaseBranch.java90
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CommitBranchDatabaseCallable.java112
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CommitBranchDatabaseTxCallable.java (renamed from plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/commit/CommitDbOperation.java)62
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CompareDatabaseCallable.java79
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CreateBranchDatabaseCallable.java103
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CreateBranchDatabaseTxCallable.java (renamed from plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/creation/CreateBranchOperation.java)137
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/DeleteRelationDatabaseCallable.java125
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/InitializeDatastoreCallable.java126
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/MoveBranchDatabaseCallable.java (renamed from plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/MoveBranchCallable.java)17
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/PurgeBranchDatabaseCallable.java89
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/StoreBranchDatabaseCallable.java (renamed from plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/StoreBranchCallable.java)20
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/AddArtifactChangeDataCallable.java (renamed from plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/internal/AddArtifactChangeData.java)16
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/ArtifactChangeItemFactory.java62
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/AttributeChangeItemFactory.java65
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/ChangeItemLoader.java73
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/ComputeNetChangeCallable.java (renamed from plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/change/ComputeNetChangeOperation.java)26
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/LoadDeltasBetweenBranches.java (renamed from plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/change/LoadDeltasBetweenBranches.java)70
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/LoadDeltasBetweenTxsOnTheSameBranch.java (renamed from plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/change/LoadDeltasBetweenTxsOnTheSameBranch.java)59
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/RelationChangeItemFactory.java66
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/conflict/ComputeConflictsCallable.java (renamed from plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/change/ComputeConflictsOperation.java)26
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/conflict/Conflict.java (renamed from plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/change/Conflict.java)2
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/conflict/ConflictUtil.java (renamed from plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/change/ConflictUtil.java)2
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/proxy/MappedDataProxy.java2
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/resource/AttributeProvider.java4
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/resource/OseeDatastoreSchemaResource.java (renamed from plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/CoreOseeSchemaResource.java)15
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/resource/ResourceConstants.java13
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/util/DataStoreInfoImpl.java23
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/util/DynamicSchemaResourceProvider.java59
-rw-r--r--plugins/org.eclipse.osee.orcs.parent/pom.xml18
-rw-r--r--plugins/org.eclipse.osee.orcs/META-INF/MANIFEST.MF2
-rw-r--r--plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/OrcsAdmin.java (renamed from plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/commit/BranchCommitServiceTest.java)21
-rw-r--r--plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/OrcsApi.java8
-rw-r--r--plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/OrcsBranch.java51
-rw-r--r--plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/OrcsMetaData.java (renamed from plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/commit/CommitTestSuite.java)11
-rw-r--r--plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/ArchiveOperation.java6
-rw-r--r--plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/CreateBranchData.java137
-rw-r--r--plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/transaction/OrcsTransaction.java25
-rw-r--r--plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/transaction/TransactionFactory.java23
-rw-r--r--plugins/org.eclipse.osee.support.config/launchConfig/OSEE.X.Server.launch4
220 files changed, 4937 insertions, 5537 deletions
diff --git a/features/org.eclipse.osee.orcs.feature.source/feature.xml b/features/org.eclipse.osee.orcs.feature.source/feature.xml
index 0eb494ed66d..65a980e8e0e 100644
--- a/features/org.eclipse.osee.orcs.feature.source/feature.xml
+++ b/features/org.eclipse.osee.orcs.feature.source/feature.xml
@@ -74,6 +74,13 @@
unpack="false"/>
<plugin
+ id="org.eclipse.osee.database.schema.source"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
id="org.eclipse.osee.orcs.rest.source"
download-size="0"
install-size="0"
diff --git a/features/org.eclipse.osee.orcs.feature/feature.xml b/features/org.eclipse.osee.orcs.feature/feature.xml
index 68bd47e1032..78d3b12d812 100644
--- a/features/org.eclipse.osee.orcs.feature/feature.xml
+++ b/features/org.eclipse.osee.orcs.feature/feature.xml
@@ -101,4 +101,11 @@
version="0.0.0"
unpack="false"/>
+ <plugin
+ id="org.eclipse.osee.database.schema"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
</feature>
diff --git a/plugins/org.eclipse.osee.framework.core.datastore.test/.classpath b/plugins/org.eclipse.osee.database.schema/.classpath
index ad32c83a788..ad32c83a788 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore.test/.classpath
+++ b/plugins/org.eclipse.osee.database.schema/.classpath
diff --git a/plugins/org.eclipse.osee.framework.core.datastore.test/.project b/plugins/org.eclipse.osee.database.schema/.project
index 7f1efefc8c4..1655ce19fd0 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore.test/.project
+++ b/plugins/org.eclipse.osee.database.schema/.project
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>org.eclipse.osee.framework.core.datastore.test</name>
+ <name>org.eclipse.osee.database.schema</name>
<comment></comment>
<projects>
</projects>
diff --git a/plugins/org.eclipse.osee.database.schema/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.database.schema/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..7e0ace28743
--- /dev/null
+++ b/plugins/org.eclipse.osee.database.schema/META-INF/MANIFEST.MF
@@ -0,0 +1,19 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: OSEE Database Schema Utility
+Bundle-SymbolicName: org.eclipse.osee.database.schema
+Bundle-Version: 0.9.9.qualifier
+Bundle-Vendor: Open System Engineering Environment
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Import-Package: org.eclipse.osee.executor.admin,
+ org.eclipse.osee.framework.core.data,
+ org.eclipse.osee.framework.core.exception,
+ org.eclipse.osee.framework.database,
+ org.eclipse.osee.framework.database.core,
+ org.eclipse.osee.framework.jdk.core.persistence,
+ 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.logger
+Export-Package: org.eclipse.osee.database.schema
+Require-Bundle: org.eclipse.core.runtime
diff --git a/plugins/org.eclipse.osee.database.schema/build.properties b/plugins/org.eclipse.osee.database.schema/build.properties
new file mode 100644
index 00000000000..38d0540e5f3
--- /dev/null
+++ b/plugins/org.eclipse.osee.database.schema/build.properties
@@ -0,0 +1,9 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
+additional.bundles = org.eclipse.osee.framework.database,\
+ org.eclipse.osee.logger,\
+ org.eclipse.osee.framework.jdk.core,\
+ org.eclipse.osee.framework.core,\
+ org.eclipse.osee.executor.admin
diff --git a/plugins/org.eclipse.osee.database.schema/pom.xml b/plugins/org.eclipse.osee.database.schema/pom.xml
new file mode 100644
index 00000000000..a3f28abc989
--- /dev/null
+++ b/plugins/org.eclipse.osee.database.schema/pom.xml
@@ -0,0 +1,34 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.eclipse.osee</groupId>
+ <artifactId>org.eclipse.osee.orcs.parent</artifactId>
+ <version>0.9.9-SNAPSHOT</version>
+ <relativePath>../../plugins/org.eclipse.osee.orcs.parent</relativePath>
+ </parent>
+
+ <artifactId>org.eclipse.osee.database.schema</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <name>OSEE Database Schema Utility - (Incubation)</name>
+
+ <build>
+ <!-- workaround for https://issues.sonatype.org/browse/TYCHO-168 -->
+ <resources>
+ <resource>
+ <directory>src</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-source-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project> \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/DatabaseCallable.java b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/DatabaseCallable.java
new file mode 100644
index 00000000000..82625a6c83d
--- /dev/null
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/DatabaseCallable.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * 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.database.schema;
+
+import java.util.concurrent.Callable;
+import org.eclipse.osee.executor.admin.CancellableCallable;
+import org.eclipse.osee.framework.database.IOseeDatabaseService;
+import org.eclipse.osee.logger.Log;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public abstract class DatabaseCallable<T> extends CancellableCallable<T> {
+
+ private final IOseeDatabaseService service;
+ private final Log logger;
+ private Callable<?> innerWorker;
+
+ protected DatabaseCallable(Log logger, IOseeDatabaseService service) {
+ this.logger = logger;
+ this.service = service;
+ }
+
+ protected IOseeDatabaseService getDatabaseService() {
+ return service;
+ }
+
+ protected Log getLogger() {
+ return logger;
+ }
+
+ protected <K> K callAndCheckForCancel(Callable<K> callable) throws Exception {
+ checkForCancelled();
+ setInnerWorker(callable);
+ K result = callable.call();
+ setInnerWorker(null);
+ return result;
+ }
+
+ private synchronized void setInnerWorker(Callable<?> callable) {
+ innerWorker = callable;
+ }
+
+ @Override
+ public void setCancel(boolean isCancelled) {
+ super.setCancel(isCancelled);
+ final Callable<?> inner = innerWorker;
+ if (inner != null) {
+ synchronized (inner) {
+ if (inner instanceof CancellableCallable) {
+ ((CancellableCallable<?>) inner).setCancel(isCancelled);
+ }
+ }
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/util/DatabaseTxCallable.java b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/DatabaseTxCallable.java
index 6fc796d7f00..adc01f09efb 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/util/DatabaseTxCallable.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/DatabaseTxCallable.java
@@ -8,47 +8,42 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.orcs.db.internal.util;
+package org.eclipse.osee.database.schema;
-import java.util.concurrent.Callable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.database.IOseeDatabaseService;
import org.eclipse.osee.framework.database.core.DatabaseTransactions;
import org.eclipse.osee.framework.database.core.IDbTransactionWork;
import org.eclipse.osee.framework.database.core.OseeConnection;
+import org.eclipse.osee.logger.Log;
/**
* @author Roberto E. Escobar
*/
-public abstract class DatabaseTxCallable implements Callable<IStatus> {
+public abstract class DatabaseTxCallable<T> extends DatabaseCallable<T> {
- private final IOseeDatabaseService dbService;
private final String name;
- protected DatabaseTxCallable(IOseeDatabaseService dbService, String name) {
- this.dbService = dbService;
+ protected DatabaseTxCallable(Log logger, IOseeDatabaseService dbService, String name) {
+ super(logger, dbService);
this.name = name;
}
- protected IOseeDatabaseService getDatabaseService() {
- return dbService;
- }
-
@Override
- public final IStatus call() throws Exception {
+ public final T call() throws Exception {
OseeConnection connection = getDatabaseService().getConnection();
+ T value = null;
try {
InternalTxWork work = new InternalTxWork();
DatabaseTransactions.execute(connection, work);
+ value = work.getResult();
} finally {
connection.close();
}
- return Status.OK_STATUS;
+ return value;
}
- protected abstract void handleTxWork(OseeConnection connection) throws OseeCoreException;
+ protected abstract T handleTxWork(OseeConnection connection) throws OseeCoreException;
protected void handleTxException(Exception ex) {
// Do nothing
@@ -60,15 +55,20 @@ public abstract class DatabaseTxCallable implements Callable<IStatus> {
}
private final class InternalTxWork implements IDbTransactionWork {
+ private T result;
@Override
public String getName() {
return name;
}
+ public T getResult() {
+ return result;
+ }
+
@Override
public void handleTxWork(OseeConnection connection) throws OseeCoreException {
- DatabaseTxCallable.this.handleTxWork(connection);
+ result = DatabaseTxCallable.this.handleTxWork(connection);
}
@Override
diff --git a/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/InitializeSchemaCallable.java b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/InitializeSchemaCallable.java
new file mode 100644
index 00000000000..92e83b7f453
--- /dev/null
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/InitializeSchemaCallable.java
@@ -0,0 +1,47 @@
+/*
+ * Created on Feb 10, 2012
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.database.schema;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+import org.eclipse.osee.database.schema.internal.callable.CreateSchemaCallable;
+import org.eclipse.osee.database.schema.internal.callable.ExtractSchemaCallable;
+import org.eclipse.osee.database.schema.internal.callable.LoadUserSchemasCallable;
+import org.eclipse.osee.database.schema.internal.data.SchemaData;
+import org.eclipse.osee.framework.database.IOseeDatabaseService;
+import org.eclipse.osee.logger.Log;
+
+public class InitializeSchemaCallable extends DatabaseCallable<Object> {
+
+ private final SchemaResourceProvider schemaProvider;
+ private final SchemaOptions options;
+
+ public InitializeSchemaCallable(Log logger, IOseeDatabaseService service, SchemaResourceProvider schemaProvider, SchemaOptions options) {
+ super(logger, service);
+ this.schemaProvider = schemaProvider;
+ this.options = options;
+ }
+
+ @Override
+ public Object call() throws Exception {
+ Map<String, SchemaData> userSpecifiedConfig = new HashMap<String, SchemaData>();
+ Map<String, SchemaData> currentDatabaseConfig = new HashMap<String, SchemaData>();
+
+ List<Callable<?>> ops = new ArrayList<Callable<?>>();
+ ops.add(new LoadUserSchemasCallable(getLogger(), getDatabaseService(), userSpecifiedConfig, schemaProvider,
+ options));
+ ops.add(new ExtractSchemaCallable(getLogger(), getDatabaseService(), userSpecifiedConfig.keySet(),
+ currentDatabaseConfig));
+ ops.add(new CreateSchemaCallable(getLogger(), getDatabaseService(), userSpecifiedConfig, currentDatabaseConfig));
+ for (Callable<?> op : ops) {
+ op.call();
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/SchemaCreationOptions.java b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/SchemaOptions.java
index 962ef9baa53..1c42ab6e9a3 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/SchemaCreationOptions.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/SchemaOptions.java
@@ -8,20 +8,20 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore;
+package org.eclipse.osee.database.schema;
import org.eclipse.osee.framework.jdk.core.util.Strings;
/**
* @author Roberto E. Escobar
*/
-public class SchemaCreationOptions {
+public class SchemaOptions {
private final String tableDataSpace;
private final String indexDataSpace;
private final boolean useFileSpecifiedSchemas;
- public SchemaCreationOptions(String tableDataSpace, String indexDataSpace, boolean useFileSpecifiedSchemas) {
+ public SchemaOptions(String tableDataSpace, String indexDataSpace, boolean useFileSpecifiedSchemas) {
super();
this.tableDataSpace = tableDataSpace;
this.indexDataSpace = indexDataSpace;
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/IOseeSchemaResource.java b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/SchemaResource.java
index 9371e0099a7..ce18fd91427 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/IOseeSchemaResource.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/SchemaResource.java
@@ -8,7 +8,7 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore;
+package org.eclipse.osee.database.schema;
import java.io.InputStream;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
@@ -16,7 +16,7 @@ import org.eclipse.osee.framework.core.exception.OseeCoreException;
/**
* @author Roberto E. Escobar
*/
-public interface IOseeSchemaResource {
+public interface SchemaResource {
public boolean isApplicable();
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/IOseeSchemaProvider.java b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/SchemaResourceProvider.java
index 7ffb669d553..cf3ecfcff02 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/IOseeSchemaProvider.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/SchemaResourceProvider.java
@@ -8,15 +8,15 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore;
+package org.eclipse.osee.database.schema;
import java.util.Collection;
/**
* @author Roberto E. Escobar
*/
-public interface IOseeSchemaProvider {
+public interface SchemaResourceProvider {
- Collection<IOseeSchemaResource> getSchemaResources();
+ Collection<SchemaResource> getSchemaResources();
}
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.database.schema/src/org/eclipse/osee/database/schema/internal/callable/BackupTableCallable.java
index 0172da2f122..6b3a79a361e 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/BackupTableDataOperation.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/callable/BackupTableCallable.java
@@ -8,29 +8,26 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.operations;
+package org.eclipse.osee.database.schema.internal.callable;
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.database.schema.DatabaseCallable;
+import org.eclipse.osee.database.schema.internal.data.SchemaData;
+import org.eclipse.osee.database.schema.internal.data.TableElement;
import org.eclipse.osee.framework.database.IOseeDatabaseService;
+import org.eclipse.osee.logger.Log;
-public class BackupTableDataOperation extends AbstractOperation {
+public class BackupTableCallable extends DatabaseCallable<Object> {
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;
+ public BackupTableCallable(Log logger, IOseeDatabaseService dbService, String backupDirPath, Set<String> schemas, Map<String, SchemaData> userSpecifiedConfig, Map<String, SchemaData> currentDatabaseConfig) {
+ super(logger, dbService);
this.schemas = schemas;
this.userSpecifiedConfig = userSpecifiedConfig;
this.currentDatabaseConfig = currentDatabaseConfig;
@@ -38,19 +35,21 @@ public class BackupTableDataOperation extends AbstractOperation {
}
@Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
+ public Object call() throws Exception {
Set<String> dataToBackup = getTablesToBackup();
- if (dataToBackup.size() > 0) {
+ if (!dataToBackup.isEmpty()) {
System.out.println(dataToBackup.toString().replaceAll(", ", "\n"));
clearBackupDirectory();
- DatabaseDataExtractor dbDataExtractor = new DatabaseDataExtractor(databaseService, schemas, backupDirectory);
+ DatabaseDataExtractorCallable dbDataExtractor =
+ new DatabaseDataExtractorCallable(getLogger(), getDatabaseService(), schemas, backupDirectory);
Set<String> backupTables = dataToBackup;
for (String backupTable : backupTables) {
dbDataExtractor.addTableNameToExtract(backupTable);
}
- doSubWork(dbDataExtractor, monitor, 0.90);
+ callAndCheckForCancel(dbDataExtractor);
dbDataExtractor.waitForWorkerThreads();
}
+ return null;
}
private Set<String> getTablesToBackup() {
@@ -71,11 +70,11 @@ public class BackupTableDataOperation extends AbstractOperation {
if (currentDbTableNames.contains(tableName)) {
backupTables.add(tableName);
} else {
- System.out.println("Table doesn't exist in Db. Unable to backup [" + tableName + "]");
+ getLogger().error("Table doesn't exist in Db. Unable to backup [%s]", tableName);
}
}
} else {
- System.out.println("Schema doesn't exist in Db. Unable to backup tables from schema [" + key + "]");
+ getLogger().error("Schema doesn't exist in Db. Unable to backup tables from schema [%s]", key);
}
}
return backupTables;
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.database.schema/src/org/eclipse/osee/database/schema/internal/callable/CreateSchemaCallable.java
index a4d46bb7839..2afe3556545 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/CreateSchemaOperation.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/callable/CreateSchemaCallable.java
@@ -8,41 +8,44 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.operations;
+package org.eclipse.osee.database.schema.internal.callable;
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.database.schema.DatabaseTxCallable;
+import org.eclipse.osee.database.schema.internal.data.SchemaData;
+import org.eclipse.osee.database.schema.internal.sql.SchemaSqlUtil;
+import org.eclipse.osee.database.schema.internal.sql.SqlFactory;
+import org.eclipse.osee.database.schema.internal.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;
+import org.eclipse.osee.logger.Log;
/**
* @author Roberto E. Escobar
*/
-public class CreateSchemaOperation extends AbstractDbTxOperation {
+public class CreateSchemaCallable extends DatabaseTxCallable<Object> {
+
+ private final Log logger;
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);
+ public CreateSchemaCallable(Log logger, IOseeDatabaseService dbService, Map<String, SchemaData> userSchema, Map<String, SchemaData> dbSchema) {
+ super(logger, dbService, "Create Schema");
+ this.logger = logger;
this.userSchema = userSchema;
this.dbSchema = dbSchema;
}
@Override
- protected void doTxWork(IProgressMonitor monitor, OseeConnection connection) throws OseeCoreException {
+ protected Object handleTxWork(OseeConnection connection) throws OseeCoreException {
DatabaseMetaData metaData = connection.getMetaData();
+
SupportedDatabase dbType = SupportedDatabase.getDatabaseType(metaData);
- SqlManager sqlManager = SqlFactory.getSqlManager(metaData);
+ SqlManager sqlManager = SqlFactory.getSqlManager(logger, metaData);
SchemaSqlUtil dbInit = new SchemaSqlUtil(sqlManager);
Set<String> schemas = userSchema.keySet();
@@ -56,5 +59,6 @@ public class CreateSchemaOperation extends AbstractDbTxOperation {
}
dbInit.addTables(schemas, userSchema);
dbInit.addIndices(schemas, userSchema);
+ return null;
}
}
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.database.schema/src/org/eclipse/osee/database/schema/internal/callable/DatabaseDataExtractorCallable.java
index bbdc59a3162..665af38781d 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/DatabaseDataExtractor.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/callable/DatabaseDataExtractorCallable.java
@@ -9,7 +9,7 @@
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.operations;
+package org.eclipse.osee.database.schema.internal.callable;
import java.io.BufferedOutputStream;
import java.io.File;
@@ -26,31 +26,29 @@ 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.database.schema.DatabaseCallable;
+import org.eclipse.osee.database.schema.internal.data.SchemaData;
+import org.eclipse.osee.database.schema.internal.data.TableElement;
+import org.eclipse.osee.database.schema.internal.data.TableElement.ColumnFields;
+import org.eclipse.osee.database.schema.internal.data.TableElement.TableDescriptionFields;
+import org.eclipse.osee.database.schema.internal.data.TableElement.TableTags;
+import org.eclipse.osee.database.schema.internal.util.FileUtility;
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;
+import org.eclipse.osee.logger.Log;
/**
* @author Roberto E. Escobar
*/
-public class DatabaseDataExtractor extends AbstractOperation {
+public class DatabaseDataExtractorCallable extends DatabaseCallable<Object> {
private static final String SQL_WILD_QUERY = "SELECT * FROM ";
private final Set<String> schemas;
@@ -63,11 +61,8 @@ public class DatabaseDataExtractor extends AbstractOperation {
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;
+ public DatabaseDataExtractorCallable(Log logger, IOseeDatabaseService dbService, Set<String> schemas, File directory) {
+ super(logger, dbService);
this.schemas = schemas;
this.directory = directory;
this.workerThreads = new ArrayList<Thread>();
@@ -83,13 +78,13 @@ public class DatabaseDataExtractor extends AbstractOperation {
}
@Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
+ public Object call() 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);
+ ExtractSchemaCallable operation =
+ new ExtractSchemaCallable(getLogger(), getDatabaseService(), schemas, schemaDataMap);
+ callAndCheckForCancel(operation);
Set<String> schemaKeys = schemaDataMap.keySet();
for (String schema : schemaKeys) {
@@ -111,6 +106,7 @@ public class DatabaseDataExtractor extends AbstractOperation {
}
}
}
+ return null;
}
private class DataExtractorThread extends Thread {
@@ -126,7 +122,7 @@ public class DatabaseDataExtractor extends AbstractOperation {
IOseeStatement chStmt = null;
OutputStream outputStream = null;
try {
- chStmt = databaseService.getStatement();
+ chStmt = getDatabaseService().getStatement();
String fileName = table.getFullyQualifiedTableName() + FileUtility.DB_DATA_EXTENSION;
outputStream = new BufferedOutputStream(new FileOutputStream(new File(directory, fileName)));
@@ -138,8 +134,7 @@ public class DatabaseDataExtractor extends AbstractOperation {
buildXml(chStmt, table, outputStream);
} catch (Exception ex) {
- OseeLog.log(Activator.class, Level.SEVERE,
- "Error Processing Table [ " + table.getSchema() + "." + table.getName() + " ] Data ", ex);
+ getLogger().error(ex, "Error Processing Table [%s.%s] Data ", table.getSchema(), table.getName());
} finally {
Lib.close(chStmt);
Lib.close(outputStream);
@@ -152,7 +147,7 @@ public class DatabaseDataExtractor extends AbstractOperation {
try {
worker.join();
} catch (InterruptedException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, "Thread [" + worker.getName() + "] was Interrupted. ", ex);
+ getLogger().error(ex, "Thread [%s] was Interrupted.", worker.getName());
}
}
}
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.database.schema/src/org/eclipse/osee/database/schema/internal/callable/ExtractSchemaCallable.java
index 552ef8ee055..f6188afff4e 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/ExtractDatabaseSchemaOperation.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/callable/ExtractSchemaCallable.java
@@ -8,7 +8,7 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.operations;
+package org.eclipse.osee.database.schema.internal.callable;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
@@ -22,34 +22,33 @@ 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.database.schema.DatabaseCallable;
+import org.eclipse.osee.database.schema.internal.data.AppliesToClause;
+import org.eclipse.osee.database.schema.internal.data.AppliesToClause.OrderType;
+import org.eclipse.osee.database.schema.internal.data.ColumnMetadata;
+import org.eclipse.osee.database.schema.internal.data.ConstraintElement;
+import org.eclipse.osee.database.schema.internal.data.ConstraintFactory;
+import org.eclipse.osee.database.schema.internal.data.ConstraintTypes;
+import org.eclipse.osee.database.schema.internal.data.ForeignKey;
+import org.eclipse.osee.database.schema.internal.data.IndexElement;
+import org.eclipse.osee.database.schema.internal.data.ReferenceClause;
+import org.eclipse.osee.database.schema.internal.data.ReferenceClause.OnDeleteEnum;
+import org.eclipse.osee.database.schema.internal.data.ReferenceClause.OnUpdateEnum;
+import org.eclipse.osee.database.schema.internal.data.SchemaData;
+import org.eclipse.osee.database.schema.internal.data.TableElement;
+import org.eclipse.osee.database.schema.internal.data.TableElement.ColumnFields;
+import org.eclipse.osee.database.schema.internal.data.TableElement.TableDescriptionFields;
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;
+import org.eclipse.osee.logger.Log;
/**
* @author Roberto E. Escobar
*/
-public class ExtractDatabaseSchemaOperation extends AbstractOperation {
+public class ExtractSchemaCallable extends DatabaseCallable<Object> {
private static final String DEFAULT_FILTER = "BIN.*";
private static final Pattern sqlPattern = Pattern.compile("SQL\\d+");
@@ -60,12 +59,10 @@ public class ExtractDatabaseSchemaOperation extends AbstractOperation {
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;
+ public ExtractSchemaCallable(Log logger, IOseeDatabaseService dbService, Set<String> schemas, Map<String, SchemaData> schemaData) {
+ super(logger, dbService);
this.schemas = schemas;
this.database = schemaData;
filter.add(DEFAULT_FILTER);
@@ -73,8 +70,8 @@ public class ExtractDatabaseSchemaOperation extends AbstractOperation {
}
@Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
- OseeConnection connection = dbService.getConnection();
+ public Object call() throws Exception {
+ OseeConnection connection = getDatabaseService().getConnection();
try {
this.dbData = connection.getMetaData();
@@ -88,6 +85,7 @@ public class ExtractDatabaseSchemaOperation extends AbstractOperation {
} finally {
connection.close();
}
+ return null;
}
public void addToFilter(String value) {
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.database.schema/src/org/eclipse/osee/database/schema/internal/callable/ImportDataFromDbCallable.java
index ce3c0f6046b..78fe3235b3e 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/ImportDataFromDbServiceOperation.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/callable/ImportDataFromDbCallable.java
@@ -8,7 +8,7 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.operations;
+package org.eclipse.osee.database.schema.internal.callable;
import java.io.File;
import java.util.HashMap;
@@ -16,42 +16,40 @@ 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.database.schema.DatabaseCallable;
+import org.eclipse.osee.database.schema.internal.data.SchemaData;
+import org.eclipse.osee.database.schema.internal.data.TableElement;
+import org.eclipse.osee.database.schema.internal.util.FileUtility;
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;
+import org.eclipse.osee.logger.Log;
/**
* @author Roberto E. Escobar
*/
-public class ImportDataFromDbServiceOperation extends AbstractOperation {
+public class ImportDataFromDbCallable extends DatabaseCallable<Object> {
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;
+ public ImportDataFromDbCallable(Log logger, IOseeDatabaseService databaseService, Map<String, SchemaData> userSpecifiedConfig, String tableImportSource) {
+ super(logger, databaseService);
this.userSpecifiedConfig = userSpecifiedConfig;
this.tableImportSource = tableImportSource;
}
@Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
+ public Object call() throws Exception {
Set<String> importConnections = getImportConnections();
for (String importFromDbService : importConnections) {
- System.out.println("Import Table Data from Db: " + importFromDbService);
+ getLogger().info("Import Table Data from Db: [%s]", importFromDbService);
IDatabaseInfo dbInfo = DatabaseInfoManager.getDataStoreById(importFromDbService);
- System.out.println("Gathering information from ..." + importFromDbService);
+ getLogger().info("Gathering information from ... [%s]", importFromDbService);
String userName = dbInfo.getDatabaseLoginName();
if (Strings.isValid(userName)) {
@@ -59,14 +57,14 @@ public class ImportDataFromDbServiceOperation extends AbstractOperation {
Set<String> schemasToGet = new TreeSet<String>();
schemasToGet.add(userName.toUpperCase());
- Map<String, Set<String>> dataToImport = getTablesToImport(monitor, userName.toUpperCase(), schemasToGet);
+ Map<String, Set<String>> dataToImport = getTablesToImport(userName.toUpperCase(), schemasToGet);
if (dataToImport.size() > 0) {
- System.out.println(dataToImport.toString().replaceAll(", ", "\n"));
+ getLogger().info(dataToImport.toString().replaceAll(", ", "\n"));
makeBackupDirectoryIfItDoesntExist();
- System.out.println("Backing up Files to: " + backupDirectory.getAbsolutePath());
- DatabaseDataExtractor dbDataExtractor =
- new DatabaseDataExtractor(databaseService, schemasToGet, backupDirectory);
+ getLogger().info("Backing up Files to: [%s]", backupDirectory.getAbsolutePath());
+ DatabaseDataExtractorCallable dbDataExtractor =
+ new DatabaseDataExtractorCallable(getLogger(), getDatabaseService(), schemasToGet, backupDirectory);
Set<String> tablesToImport;
if (importFromDbService.equals(determineDefaultConnection())) {
@@ -78,13 +76,14 @@ public class ImportDataFromDbServiceOperation extends AbstractOperation {
for (String importTable : tablesToImport) {
dbDataExtractor.addTableNameToExtract(importTable);
}
- doSubWork(dbDataExtractor, monitor, 0.10);
+ dbDataExtractor.call();
dbDataExtractor.waitForWorkerThreads();
prepareFilesForImport();
}
}
}
+ return null;
}
private void prepareFilesForImport() {
@@ -131,16 +130,16 @@ public class ImportDataFromDbServiceOperation extends AbstractOperation {
return connectionsNeeded;
}
- private Map<String, SchemaData> getAvailableSchemasFromImportDb(IProgressMonitor monitor, Set<String> schemas) throws Exception {
+ private Map<String, SchemaData> getAvailableSchemasFromImportDb(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);
+ ExtractSchemaCallable schemaExtractor =
+ new ExtractSchemaCallable(getLogger(), getDatabaseService(), schemas, schemaMap);
+ schemaExtractor.call();
return schemaMap;
}
- private Map<String, Set<String>> getTablesToImport(IProgressMonitor monitor, String userName, Set<String> schemasToGet) throws Exception {
- Map<String, SchemaData> currentDbSchemas = getAvailableSchemasFromImportDb(monitor, schemasToGet);
+ private Map<String, Set<String>> getTablesToImport(String userName, Set<String> schemasToGet) throws Exception {
+ Map<String, SchemaData> currentDbSchemas = getAvailableSchemasFromImportDb(schemasToGet);
Set<String> userSchemas = userSpecifiedConfig.keySet();
SchemaData schemaData = currentDbSchemas.get(userName);
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.database.schema/src/org/eclipse/osee/database/schema/internal/callable/LoadUserSchemasCallable.java
index 44e5bfe3621..12d134c62ac 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/LoadUserSchemasOperation.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/callable/LoadUserSchemasCallable.java
@@ -8,59 +8,66 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.operations;
+package org.eclipse.osee.database.schema.internal.callable;
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.database.schema.DatabaseCallable;
+import org.eclipse.osee.database.schema.SchemaOptions;
+import org.eclipse.osee.database.schema.SchemaResourceProvider;
+import org.eclipse.osee.database.schema.internal.data.ColumnMetadata;
+import org.eclipse.osee.database.schema.internal.data.ConstraintElement;
+import org.eclipse.osee.database.schema.internal.data.ForeignKey;
+import org.eclipse.osee.database.schema.internal.data.IndexElement;
+import org.eclipse.osee.database.schema.internal.data.ReferenceClause;
+import org.eclipse.osee.database.schema.internal.data.SchemaData;
+import org.eclipse.osee.database.schema.internal.data.SchemaXmlParser;
+import org.eclipse.osee.database.schema.internal.data.TableElement;
+import org.eclipse.osee.database.schema.internal.data.TableElement.TableDescriptionFields;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
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.database.IOseeDatabaseService;
+import org.eclipse.osee.framework.database.core.OseeConnection;
import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.logger.Log;
/**
* @author Roberto E. Escobar
*/
-public class LoadUserSchemasOperation extends AbstractOperation {
+public class LoadUserSchemasCallable extends DatabaseCallable<Object> {
private final Map<String, SchemaData> schemas;
- private final IOseeSchemaProvider schemaProvider;
- private final SchemaCreationOptions options;
+ private final SchemaResourceProvider provider;
+ private final SchemaOptions options;
- public LoadUserSchemasOperation(Map<String, SchemaData> schemas, IOseeSchemaProvider schemaProvider, SchemaCreationOptions options) {
- super("Load Schema Data from URIs", Activator.PLUGIN_ID);
+ public LoadUserSchemasCallable(Log logger, IOseeDatabaseService dbService, Map<String, SchemaData> schemas, SchemaResourceProvider provider, SchemaOptions options) {
+ super(logger, dbService);
this.schemas = schemas;
- this.schemaProvider = schemaProvider;
+ this.provider = provider;
this.options = options;
}
+ private DatabaseMetaData getMetaData() throws OseeCoreException {
+ OseeConnection connection = getDatabaseService().getConnection();
+ try {
+ return connection.getMetaData();
+ } finally {
+ connection.close();
+ }
+ }
+
@Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
- Collection<IOseeSchemaResource> schemaResources = schemaProvider.getSchemaResources();
- SchemaXmlParser parser = new SchemaXmlParser();
- parser.parseFromSchemaProvider(schemaResources, schemas);
+ public Object call() throws Exception {
+ SchemaXmlParser parser = new SchemaXmlParser(getLogger());
+ parser.parse(provider.getSchemaResources(), schemas);
if (!options.isUseFileSpecifiedSchemas()) {
try {
- DatabaseMetaData meta = ConnectionHandler.getMetaData();
+ DatabaseMetaData meta = getMetaData();
if (meta != null) {
String userName = meta.getUserName();
if (Strings.isValid(userName)) {
@@ -89,6 +96,7 @@ public class LoadUserSchemasOperation extends AbstractOperation {
schemaData.setIndexDataSpaceName(options.getIndexDataSpace());
}
}
+ return null;
}
private Map<String, SchemaData> useUserNameAsSchema(String userName, Map<String, SchemaData> userSchemas) {
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.database.schema/src/org/eclipse/osee/database/schema/internal/callable/PrintTablesCallable.java
index ae2948d2d3b..01df840d278 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/PrintTables.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/callable/PrintTablesCallable.java
@@ -8,34 +8,33 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.operations;
+package org.eclipse.osee.database.schema.internal.callable;
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.database.schema.DatabaseCallable;
+import org.eclipse.osee.database.schema.internal.data.SchemaData;
+import org.eclipse.osee.framework.database.IOseeDatabaseService;
import org.eclipse.osee.framework.database.core.IOseeStatement;
+import org.eclipse.osee.logger.Log;
/**
* @author Roberto E. Escobar
*/
-public class PrintTables extends AbstractOperation {
+public class PrintTablesCallable extends DatabaseCallable<Object> {
private final Map<String, SchemaData> userConfig;
private final Writer writer;
- public PrintTables(Map<String, SchemaData> userConfig, Writer writer) {
- super("Print Schema", Activator.PLUGIN_ID);
+ public PrintTablesCallable(Log logger, IOseeDatabaseService dbService, Map<String, SchemaData> userConfig, Writer writer) {
+ super(logger, dbService);
this.userConfig = userConfig;
this.writer = writer;
}
@Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
+ public Object call() throws Exception {
Set<String> keys = userConfig.keySet();
for (String key : keys) {
SchemaData schemaData = userConfig.get(key);
@@ -44,39 +43,47 @@ public class PrintTables extends AbstractOperation {
printTable(tableName);
}
}
+ return null;
}
private void printTable(String tableName) throws Exception {
- IOseeStatement chStmt = ConnectionHandler.getStatement();
+ IOseeStatement chStmt = getDatabaseService().getStatement();
try {
chStmt.runPreparedQuery("select * from " + tableName);
int numberOfColumns = chStmt.getColumnCount();
- String header = "\nTable:\t" + tableName + "\n";
- header += "Columns:\t";
+
+ StringBuilder builder = new StringBuilder();
+
+ builder.append("\nTable:\t");
+ builder.append(tableName);
+ builder.append("\n");
+ builder.append("Columns:\t");
for (int index = 1; index <= numberOfColumns; index++) {
- header += chStmt.getColumnName(index);
+ builder.append(chStmt.getColumnName(index));
if (index + 1 <= numberOfColumns) {
- header += ", ";
+ builder.append(", ");
}
}
- header += "\n";
+ builder.append("\n");
- writer.write(header);
+ writer.write(builder.toString());
+ builder.delete(0, builder.length());
- String results = "";
while (chStmt.next()) {
- results = "Data:\t";
+ builder.append("Data:\t");
for (int index = 1; index <= numberOfColumns; index++) {
- results += chStmt.getObject(index).toString();
+ builder.append(chStmt.getObject(index).toString());
if (index + 1 <= numberOfColumns) {
- results += ", ";
+ builder.append(", ");
}
}
- results += "\n";
- writer.write(results);
+ builder.append("\n");
+ writer.write(builder.toString());
+ builder.delete(0, builder.length());
}
} 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.database.schema/src/org/eclipse/osee/database/schema/internal/callable/RestoreTableDataOperation.java
index c0e1e32ddff..4df15303c1f 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/RestoreTableDataOperation.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/callable/RestoreTableDataOperation.java
@@ -8,46 +8,50 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.operations;
+package org.eclipse.osee.database.schema.internal.callable;
import java.io.File;
+import java.sql.DatabaseMetaData;
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;
+import org.eclipse.osee.database.schema.DatabaseTxCallable;
+import org.eclipse.osee.database.schema.internal.data.SchemaData;
+import org.eclipse.osee.database.schema.internal.data.TableElement;
+import org.eclipse.osee.database.schema.internal.sql.SqlFactory;
+import org.eclipse.osee.database.schema.internal.sql.SqlManager;
+import org.eclipse.osee.database.schema.internal.util.DatabaseDataImporter;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.database.IOseeDatabaseService;
+import org.eclipse.osee.framework.database.core.OseeConnection;
+import org.eclipse.osee.logger.Log;
/**
* @author Roberto E. Escobar
*/
-public class RestoreTableDataOperation extends AbstractOperation {
+public class RestoreTableDataOperation extends DatabaseTxCallable<Object> {
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);
+ public RestoreTableDataOperation(Log logger, IOseeDatabaseService dbService, Set<String> schemas, Map<String, SchemaData> userSpecifiedConfig, String importDatabaseSource) {
+ super(logger, dbService, "Restore Table Data");
this.schemas = schemas;
this.userSpecifiedConfig = userSpecifiedConfig;
this.importDatabaseSource = importDatabaseSource;
}
@Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
- SqlManager sqlManager = SqlFactory.getSqlManager(ConnectionHandler.getMetaData());
+ protected Object handleTxWork(OseeConnection connection) throws OseeCoreException {
+ DatabaseMetaData metaData = connection.getMetaData();
+ SqlManager sqlManager = SqlFactory.getSqlManager(getLogger(), metaData);
for (String schemaKey : schemas) {
if (userSpecifiedConfig.containsKey(schemaKey)) {
- DatabaseDataImporter importer = new DatabaseDataImporter(backupDirectory, sqlManager);
+ DatabaseDataImporter importer = new DatabaseDataImporter(getLogger(), backupDirectory, sqlManager);
SchemaData schemaData = userSpecifiedConfig.get(schemaKey);
setImportOrder(importer, schemaData);
@@ -59,6 +63,7 @@ public class RestoreTableDataOperation extends AbstractOperation {
}
clearBackupDirectory();
+ return null;
}
private void setImportOrder(DatabaseDataImporter importer, SchemaData schemaData) {
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.database.schema/src/org/eclipse/osee/database/schema/internal/data/AppliesToClause.java
index 6cf4a8e3ea1..82f5e3d3bc3 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/AppliesToClause.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/data/AppliesToClause.java
@@ -9,10 +9,8 @@
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.data;
+package org.eclipse.osee.database.schema.internal.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;
@@ -65,30 +63,47 @@ public class AppliesToClause implements Xmlizable {
}
@Override
- public boolean equals(Object otherObject) {
- if (otherObject instanceof AppliesToClause == false) {
- return false;
- }
- if (this == otherObject) {
- return true;
+ 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());
}
- AppliesToClause that = (AppliesToClause) otherObject;
- return new EqualsBuilder().appendSuper(super.equals(otherObject)).append(this.columnName, that.getColumnName()).append(
- this.orderType, that.getOrderType()).isEquals();
+ return element;
}
@Override
public int hashCode() {
- return new HashCodeBuilder(23, 37).append(columnName).append(orderType).toHashCode();
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((columnName == null) ? 0 : columnName.hashCode());
+ result = prime * result + ((orderType == null) ? 0 : orderType.hashCode());
+ return result;
}
@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());
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
}
- return element;
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ AppliesToClause other = (AppliesToClause) obj;
+ if (columnName == null) {
+ if (other.columnName != null) {
+ return false;
+ }
+ } else if (!columnName.equals(other.columnName)) {
+ return false;
+ }
+ if (orderType != other.orderType) {
+ return false;
+ }
+ return true;
}
+
}
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.database.schema/src/org/eclipse/osee/database/schema/internal/data/ColumnDbData.java
index 5a0859245b0..3a03fd99938 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ColumnDbData.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/data/ColumnDbData.java
@@ -8,7 +8,7 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.data;
+package org.eclipse.osee.database.schema.internal.data;
/**
* @author Roberto E. Escobar
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.database.schema/src/org/eclipse/osee/database/schema/internal/data/ColumnMetadata.java
index ad9ab2eb81d..139cf516678 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ColumnMetadata.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/data/ColumnMetadata.java
@@ -9,15 +9,13 @@
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.data;
+package org.eclipse.osee.database.schema.internal.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.database.schema.internal.data.TableElement.ColumnFields;
+import org.eclipse.osee.database.schema.internal.data.TableElement.TableSections;
import org.eclipse.osee.framework.jdk.core.persistence.Xmlizable;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -53,24 +51,6 @@ public class ColumnMetadata implements Xmlizable {
}
@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();
@@ -89,4 +69,34 @@ public class ColumnMetadata implements Xmlizable {
}
return columnElement;
}
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((columnFields == null) ? 0 : columnFields.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ ColumnMetadata other = (ColumnMetadata) obj;
+ if (columnFields == null) {
+ if (other.columnFields != null) {
+ return false;
+ }
+ } else if (!columnFields.equals(other.columnFields)) {
+ return false;
+ }
+ return true;
+ }
}
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.database.schema/src/org/eclipse/osee/database/schema/internal/data/ConstraintElement.java
index 1b4cfb14e11..c9d3bbc7fd7 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ConstraintElement.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/data/ConstraintElement.java
@@ -9,13 +9,11 @@
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.data;
+package org.eclipse.osee.database.schema.internal.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.database.schema.internal.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;
@@ -126,22 +124,57 @@ public class ConstraintElement implements Xmlizable {
}
@Override
- public boolean equals(Object otherObject) {
- if (otherObject instanceof ConstraintElement == false) {
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((columns == null) ? 0 : columns.hashCode());
+ result = prime * result + ((constraintType == null) ? 0 : constraintType.hashCode());
+ result = prime * result + (deferrable ? 1231 : 1237);
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ result = prime * result + ((schema == null) ? 0 : schema.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
return false;
}
- if (this == otherObject) {
- return true;
+ if (getClass() != obj.getClass()) {
+ return false;
}
- 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();
+ ConstraintElement other = (ConstraintElement) obj;
+ if (columns == null) {
+ if (other.columns != null) {
+ return false;
+ }
+ } else if (!columns.equals(other.columns)) {
+ return false;
+ }
+ if (constraintType != other.constraintType) {
+ return false;
+ }
+ if (deferrable != other.deferrable) {
+ return false;
+ }
+ if (id == null) {
+ if (other.id != null) {
+ return false;
+ }
+ } else if (!id.equals(other.id)) {
+ return false;
+ }
+ if (schema == null) {
+ if (other.schema != null) {
+ return false;
+ }
+ } else if (!schema.equals(other.schema)) {
+ return false;
+ }
+ return true;
}
- @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.database.schema/src/org/eclipse/osee/database/schema/internal/data/ConstraintFactory.java
index 01b84e54efd..3714df73e3a 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ConstraintFactory.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/data/ConstraintFactory.java
@@ -8,7 +8,7 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.data;
+package org.eclipse.osee.database.schema.internal.data;
/**
* @author Roberto E. Escobar
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.database.schema/src/org/eclipse/osee/database/schema/internal/data/ConstraintTypes.java
index 9127d31a52c..06844778c83 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ConstraintTypes.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/data/ConstraintTypes.java
@@ -8,7 +8,7 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.data;
+package org.eclipse.osee.database.schema.internal.data;
/**
* @author Roberto E. Escobar
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.database.schema/src/org/eclipse/osee/database/schema/internal/data/ForeignKey.java
index c3dfa07a207..87adbdccd4d 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ForeignKey.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/data/ForeignKey.java
@@ -8,7 +8,7 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.data;
+package org.eclipse.osee.database.schema.internal.data;
import java.util.ArrayList;
import java.util.List;
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.database.schema/src/org/eclipse/osee/database/schema/internal/data/IndexElement.java
index 319bec13037..d0df33441ca 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/IndexElement.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/data/IndexElement.java
@@ -9,13 +9,11 @@
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.data;
+package org.eclipse.osee.database.schema.internal.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.database.schema.internal.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;
@@ -88,24 +86,6 @@ public class IndexElement implements Xmlizable {
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;
}
@@ -131,4 +111,43 @@ public class IndexElement implements Xmlizable {
public void setTablespace(String tablespace) {
this.tablespace = tablespace;
}
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((appliesToList == null) ? 0 : appliesToList.hashCode());
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ IndexElement other = (IndexElement) obj;
+ if (appliesToList == null) {
+ if (other.appliesToList != null) {
+ return false;
+ }
+ } else if (!appliesToList.equals(other.appliesToList)) {
+ return false;
+ }
+ if (id == null) {
+ if (other.id != null) {
+ return false;
+ }
+ } else if (!id.equals(other.id)) {
+ return false;
+ }
+ return true;
+ }
+
} \ 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.database.schema/src/org/eclipse/osee/database/schema/internal/data/ReferenceClause.java
index 6f064135e8f..f1a55cd85d7 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/ReferenceClause.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/data/ReferenceClause.java
@@ -9,12 +9,10 @@
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.data;
+package org.eclipse.osee.database.schema.internal.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;
@@ -144,22 +142,57 @@ public class ReferenceClause implements Xmlizable {
}
@Override
- public boolean equals(Object otherObject) {
- if (otherObject instanceof ReferenceClause == false) {
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((columns == null) ? 0 : columns.hashCode());
+ result = prime * result + ((onDeleteAction == null) ? 0 : onDeleteAction.hashCode());
+ result = prime * result + ((onUpdateAction == null) ? 0 : onUpdateAction.hashCode());
+ result = prime * result + ((schema == null) ? 0 : schema.hashCode());
+ result = prime * result + ((table == null) ? 0 : table.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
return false;
}
- if (this == otherObject) {
- return true;
+ if (getClass() != obj.getClass()) {
+ return false;
}
- 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();
+ ReferenceClause other = (ReferenceClause) obj;
+ if (columns == null) {
+ if (other.columns != null) {
+ return false;
+ }
+ } else if (!columns.equals(other.columns)) {
+ return false;
+ }
+ if (onDeleteAction != other.onDeleteAction) {
+ return false;
+ }
+ if (onUpdateAction != other.onUpdateAction) {
+ return false;
+ }
+ if (schema == null) {
+ if (other.schema != null) {
+ return false;
+ }
+ } else if (!schema.equals(other.schema)) {
+ return false;
+ }
+ if (table == null) {
+ if (other.table != null) {
+ return false;
+ }
+ } else if (!table.equals(other.table)) {
+ return false;
+ }
+ return true;
}
- @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.database.schema/src/org/eclipse/osee/database/schema/internal/data/SchemaData.java
index 646f3ee6f0f..f2b5466745f 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/SchemaData.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/data/SchemaData.java
@@ -9,7 +9,7 @@
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.data;
+package org.eclipse.osee.database.schema.internal.data;
import java.util.ArrayList;
import java.util.HashMap;
@@ -19,9 +19,7 @@ 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.database.schema.internal.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;
@@ -229,23 +227,6 @@ public class SchemaData implements Xmlizable {
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) {
@@ -254,25 +235,46 @@ public class SchemaData implements Xmlizable {
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();
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (isSorted ? 1231 : 1237);
+ result = prime * result + ((schemaLookup == null) ? 0 : schemaLookup.hashCode());
+ result = prime * result + ((tableDefinitions == null) ? 0 : tableDefinitions.hashCode());
+ return result;
+ }
- boolean toReturn = true;
- if (thisKey1.equals(thatKey2)) {
- for (String key : thisKey1) {
- equalsBuilder.append(thisTableMap.get(key), thatTableMap.get(key));
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ SchemaData other = (SchemaData) obj;
+ if (isSorted != other.isSorted) {
+ return false;
+ }
+ if (schemaLookup == null) {
+ if (other.schemaLookup != null) {
+ return false;
}
- toReturn &= equalsBuilder.isEquals();
- } else {
- toReturn = false;
+ } else if (!schemaLookup.equals(other.schemaLookup)) {
+ return false;
}
- return toReturn;
+ if (tableDefinitions == null) {
+ if (other.tableDefinitions != null) {
+ return false;
+ }
+ } else if (!tableDefinitions.equals(other.tableDefinitions)) {
+ return false;
+ }
+ return true;
}
+
}
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.database.schema/src/org/eclipse/osee/database/schema/internal/data/SchemaDataLookup.java
index ff4851f021b..db7681943c2 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/SchemaDataLookup.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/data/SchemaDataLookup.java
@@ -8,7 +8,7 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.data;
+package org.eclipse.osee.database.schema.internal.data;
import java.util.List;
import java.util.Map;
@@ -43,4 +43,35 @@ public class SchemaDataLookup {
}
return null;
}
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((schemaData == null) ? 0 : schemaData.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ SchemaDataLookup other = (SchemaDataLookup) obj;
+ if (schemaData == null) {
+ if (other.schemaData != null) {
+ return false;
+ }
+ } else if (!schemaData.equals(other.schemaData)) {
+ return false;
+ }
+ return true;
+ }
+
}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/SchemaXmlParser.java b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/data/SchemaXmlParser.java
index 2c7dea32ae0..48dbab83cfe 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/SchemaXmlParser.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/data/SchemaXmlParser.java
@@ -8,30 +8,28 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.data;
+package org.eclipse.osee.database.schema.internal.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.database.schema.SchemaResource;
+import org.eclipse.osee.database.schema.internal.data.AppliesToClause.AppliesToEntries;
+import org.eclipse.osee.database.schema.internal.data.AppliesToClause.OrderType;
+import org.eclipse.osee.database.schema.internal.data.ConstraintElement.ConstraintFields;
+import org.eclipse.osee.database.schema.internal.data.IndexElement.IndexFields;
+import org.eclipse.osee.database.schema.internal.data.ReferenceClause.OnDeleteEnum;
+import org.eclipse.osee.database.schema.internal.data.ReferenceClause.OnUpdateEnum;
+import org.eclipse.osee.database.schema.internal.data.ReferenceClause.ReferencesFields;
+import org.eclipse.osee.database.schema.internal.data.TableElement.ColumnFields;
+import org.eclipse.osee.database.schema.internal.data.TableElement.TableDescriptionFields;
+import org.eclipse.osee.database.schema.internal.data.TableElement.TableSections;
+import org.eclipse.osee.database.schema.internal.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.eclipse.osee.logger.Log;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -42,6 +40,12 @@ import org.w3c.dom.NamedNodeMap;
*/
public class SchemaXmlParser {
+ private final Log logger;
+
+ public SchemaXmlParser(Log logger) {
+ this.logger = logger;
+ }
+
private void parseTableDescription(Element element, TableElement tableEntry) {
NamedNodeMap attributes = element.getAttributes();
for (int i = 0; i < attributes.getLength(); i++) {
@@ -155,7 +159,7 @@ public class SchemaXmlParser {
}
}
- public void parseAppliesToClause(Element element, IndexElement indexData) {
+ private 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());
@@ -172,7 +176,7 @@ public class SchemaXmlParser {
}
}
- public SchemaData parseFromInputStream(InputStream configFile) throws Exception {
+ public SchemaData parse(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());
@@ -190,13 +194,13 @@ public class SchemaXmlParser {
return schemaData;
}
- public void parseFromSchemaProvider(Collection<IOseeSchemaResource> schemaResources, Map<String, SchemaData> schemas) {
- for (IOseeSchemaResource schemaResource : schemaResources) {
+ public void parse(Collection<SchemaResource> schemaResources, Map<String, SchemaData> schemas) {
+ for (SchemaResource schemaResource : schemaResources) {
SchemaData schemaData;
InputStream inputStream = null;
try {
inputStream = new BufferedInputStream(schemaResource.getContent());
- schemaData = parseFromInputStream(inputStream);
+ schemaData = parse(inputStream);
List<TableElement> tables = schemaData.getTablesOrderedByDependency();
for (TableElement table : tables) {
String schemaAddress = table.getSchema();
@@ -211,7 +215,7 @@ public class SchemaXmlParser {
schema.addTableDefinition(table);
}
} catch (Exception ex) {
- OseeLog.log(Activator.class, Level.WARNING, ex);
+ logger.warn(ex, "Problem parsing [%s]", schemaResource);
} 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.database.schema/src/org/eclipse/osee/database/schema/internal/data/TableElement.java
index 1833f6a11c8..d66c87bd351 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/data/TableElement.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/data/TableElement.java
@@ -8,7 +8,7 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.data;
+package org.eclipse.osee.database.schema.internal.data;
import java.util.ArrayList;
import java.util.HashMap;
@@ -16,8 +16,6 @@ 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;
@@ -221,26 +219,6 @@ public class TableElement implements Xmlizable {
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 : "";
@@ -249,4 +227,67 @@ public class TableElement implements Xmlizable {
public void setTablespace(String value) {
getDescription().put(TableDescriptionFields.tablespace, value);
}
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((columns == null) ? 0 : columns.hashCode());
+ result = prime * result + ((constraints == null) ? 0 : constraints.hashCode());
+ result = prime * result + ((foreignKeys == null) ? 0 : foreignKeys.hashCode());
+ result = prime * result + ((indices == null) ? 0 : indices.hashCode());
+ result = prime * result + ((tableDescription == null) ? 0 : tableDescription.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ TableElement other = (TableElement) obj;
+ if (columns == null) {
+ if (other.columns != null) {
+ return false;
+ }
+ } else if (!columns.equals(other.columns)) {
+ return false;
+ }
+ if (constraints == null) {
+ if (other.constraints != null) {
+ return false;
+ }
+ } else if (!constraints.equals(other.constraints)) {
+ return false;
+ }
+ if (foreignKeys == null) {
+ if (other.foreignKeys != null) {
+ return false;
+ }
+ } else if (!foreignKeys.equals(other.foreignKeys)) {
+ return false;
+ }
+ if (indices == null) {
+ if (other.indices != null) {
+ return false;
+ }
+ } else if (!indices.equals(other.indices)) {
+ return false;
+ }
+ if (tableDescription == null) {
+ if (other.tableDescription != null) {
+ return false;
+ }
+ } else if (!tableDescription.equals(other.tableDescription)) {
+ return false;
+ }
+ return true;
+ }
+
}
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.database.schema/src/org/eclipse/osee/database/schema/internal/sql/FoxProDataType.java
index 4889d4f2d82..ff77b0cf5c0 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/FoxProDataType.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/sql/FoxProDataType.java
@@ -8,7 +8,7 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.sql;
+package org.eclipse.osee.database.schema.internal.sql;
/**
* @author Roberto E. Escobar
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.database.schema/src/org/eclipse/osee/database/schema/internal/sql/H2DataType.java
index d9f74bf1ce5..9ffd2127d61 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/H2DataType.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/sql/H2DataType.java
@@ -8,7 +8,7 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.sql;
+package org.eclipse.osee.database.schema.internal.sql;
/**
* @author Roberto E. Escobar
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.database.schema/src/org/eclipse/osee/database/schema/internal/sql/H2SqlManager.java
index c5505c5d821..ecb12ad57d9 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/H2SqlManager.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/sql/H2SqlManager.java
@@ -8,19 +8,20 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.sql;
+package org.eclipse.osee.database.schema.internal.sql;
-import org.eclipse.osee.framework.core.datastore.schema.data.TableElement;
+import org.eclipse.osee.database.schema.internal.data.TableElement;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.database.core.ConnectionHandler;
+import org.eclipse.osee.logger.Log;
/**
* @author Roberto E. Escobar
*/
public class H2SqlManager extends SqlManagerImpl {
- public H2SqlManager(SqlDataType sqlDataType) {
- super(sqlDataType);
+ public H2SqlManager(Log logger, SqlDataType sqlDataType) {
+ super(logger, sqlDataType);
}
@Override
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.database.schema/src/org/eclipse/osee/database/schema/internal/sql/MySqlDataType.java
index 8ed63cbeebf..acae9714085 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/MySqlDataType.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/sql/MySqlDataType.java
@@ -8,7 +8,7 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.sql;
+package org.eclipse.osee.database.schema.internal.sql;
/**
* @author Roberto E. Escobar
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.database.schema/src/org/eclipse/osee/database/schema/internal/sql/MysqlSqlManager.java
index ecff1984bfb..de9ebfb4489 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/MysqlSqlManager.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/sql/MysqlSqlManager.java
@@ -8,37 +8,34 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.sql;
+package org.eclipse.osee.database.schema.internal.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.database.schema.internal.data.ColumnMetadata;
+import org.eclipse.osee.database.schema.internal.data.ConstraintElement;
+import org.eclipse.osee.database.schema.internal.data.ForeignKey;
+import org.eclipse.osee.database.schema.internal.data.IndexElement;
+import org.eclipse.osee.database.schema.internal.data.ReferenceClause;
+import org.eclipse.osee.database.schema.internal.data.TableElement;
+import org.eclipse.osee.database.schema.internal.data.ReferenceClause.OnDeleteEnum;
+import org.eclipse.osee.database.schema.internal.data.ReferenceClause.OnUpdateEnum;
+import org.eclipse.osee.database.schema.internal.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;
+import org.eclipse.osee.logger.Log;
/**
* @author Andrew M. Finkbeiner
*/
public class MysqlSqlManager extends SqlManagerImpl {
- public MysqlSqlManager(SqlDataType sqlDataType) {
- super(sqlDataType);
+ public MysqlSqlManager(Log logger, SqlDataType sqlDataType) {
+ super(logger, sqlDataType);
}
private String handleColumnCreationSection(OseeConnection connection, Map<String, ColumnMetadata> columns) {
@@ -59,14 +56,14 @@ public class MysqlSqlManager extends SqlManagerImpl {
toExecute +=
handleConstraintCreationSection(tableDef.getForeignKeyConstraints(), tableDef.getFullyQualifiedTableName());
toExecute += " \n)\n";
- OseeLog.log(Activator.class, Level.INFO, "Creating Table: [ " + tableDef.getFullyQualifiedTableName() + "]");
+ getLogger().debug("Creating Table: [%s]", 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() + "]");
+ getLogger().debug("Dropping Table: [%s]", tableDef.getFullyQualifiedTableName());
ConnectionHandler.runPreparedUpdate(toExecute);
}
@@ -76,7 +73,7 @@ public class MysqlSqlManager extends SqlManagerImpl {
for (int index = 0; index < array.length; index++) {
array[index] = array[index];
}
- return StringUtils.join(array, splitAt.replaceAll("\\\\", ""));
+ return join(array, splitAt.replaceAll("\\\\", ""));
}
@Override
@@ -87,8 +84,7 @@ public class MysqlSqlManager extends SqlManagerImpl {
if (iData.ignoreMySql()) {
continue;
}
- OseeLog.logf(Activator.class, Level.INFO,
- "Dropping Index: [%s] FROM [%s]", iData.getId(), tableName);
+ getLogger().debug("Dropping Index: [%s] FROM [%s]", iData.getId(), tableName);
if (iData.getId().equals("PRIMARY")) {
ConnectionHandler.runPreparedUpdate("ALTER TABLE " + tableDef.getFullyQualifiedTableName() + " DROP PRIMARY KEY");
} else {
@@ -141,15 +137,13 @@ public class MysqlSqlManager extends SqlManagerImpl {
}
else {
- OseeLog.log(Activator.class, Level.WARNING,
- "Skipping CONSTRAINT at Table: " + tableID + "\n\t " + fk.toString());
+ getLogger().warn("Skipping CONSTRAINT at Table: %s\n\t%s", tableID, fk.toString());
}
}
}
} else {
- OseeLog.log(Activator.class, Level.WARNING,
- "Skipping CONSTRAINT at Table: " + tableID + "\n\t " + constraint.toString());
+ getLogger().warn("Skipping CONSTRAINT at Table: %s\n\t%s", tableID, 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.database.schema/src/org/eclipse/osee/database/schema/internal/sql/OracleSqlDataType.java
index 074d5036cce..1cc4024ab44 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/OracleSqlDataType.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/sql/OracleSqlDataType.java
@@ -8,7 +8,7 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.sql;
+package org.eclipse.osee.database.schema.internal.sql;
import org.eclipse.osee.framework.database.core.SQL3DataType;
import org.eclipse.osee.framework.jdk.core.util.Strings;
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.database.schema/src/org/eclipse/osee/database/schema/internal/sql/OracleSqlManager.java
index 665cbb49aef..5d4e7531d94 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/OracleSqlManager.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/sql/OracleSqlManager.java
@@ -8,29 +8,27 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.sql;
+package org.eclipse.osee.database.schema.internal.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.database.schema.internal.data.ColumnMetadata;
+import org.eclipse.osee.database.schema.internal.data.IndexElement;
+import org.eclipse.osee.database.schema.internal.data.TableElement;
+import org.eclipse.osee.database.schema.internal.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;
+import org.eclipse.osee.logger.Log;
/**
* @author Roberto E. Escobar
*/
public class OracleSqlManager extends SqlManager {
- public OracleSqlManager(SqlDataType sqlDataType) {
- super(sqlDataType);
+ public OracleSqlManager(Log logger, SqlDataType sqlDataType) {
+ super(logger, sqlDataType);
}
protected String handleColumnCreationSection(Map<String, ColumnMetadata> columns) {
@@ -57,7 +55,7 @@ public class OracleSqlManager extends SqlManager {
toExecute.append(" tablespace ");
toExecute.append(tableDef.getTablespace());
toExecute.append("\n");
- OseeLog.log(Activator.class, Level.FINE, "Creating Table: [ " + tableDef.getFullyQualifiedTableName() + "]");
+ getLogger().debug("Creating Table: [%s]", tableDef.getFullyQualifiedTableName());
ConnectionHandler.runPreparedUpdate(toExecute.toString());
}
@@ -74,7 +72,7 @@ public class OracleSqlManager extends SqlManager {
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() + "]");
+ getLogger().debug("Dropping Table: [%s]", 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.database.schema/src/org/eclipse/osee/database/schema/internal/sql/PostgreSqlManager.java
index 8146b528c23..4e56efc07be 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/PostgreSqlManager.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/sql/PostgreSqlManager.java
@@ -8,37 +8,35 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.sql;
+package org.eclipse.osee.database.schema.internal.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.database.schema.internal.data.AppliesToClause;
+import org.eclipse.osee.database.schema.internal.data.ColumnMetadata;
+import org.eclipse.osee.database.schema.internal.data.ConstraintElement;
+import org.eclipse.osee.database.schema.internal.data.ForeignKey;
+import org.eclipse.osee.database.schema.internal.data.IndexElement;
+import org.eclipse.osee.database.schema.internal.data.ReferenceClause;
+import org.eclipse.osee.database.schema.internal.data.TableElement;
+import org.eclipse.osee.database.schema.internal.data.ReferenceClause.OnDeleteEnum;
+import org.eclipse.osee.database.schema.internal.data.ReferenceClause.OnUpdateEnum;
+import org.eclipse.osee.database.schema.internal.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;
+import org.eclipse.osee.logger.Log;
/**
* @author Andrew M. Finkbeiner
*/
public class PostgreSqlManager extends SqlManagerImpl {
- public PostgreSqlManager(SqlDataType sqlDataType) {
- super(sqlDataType);
+
+ public PostgreSqlManager(Log logger, SqlDataType sqlDataType) {
+ super(logger, sqlDataType);
}
private String handleColumnCreationSection(OseeConnection connection, Map<String, ColumnMetadata> columns) {
@@ -59,14 +57,14 @@ public class PostgreSqlManager extends SqlManagerImpl {
toExecute +=
handleConstraintCreationSection(tableDef.getForeignKeyConstraints(), tableDef.getFullyQualifiedTableName());
toExecute += " \n)\n";
- OseeLog.log(Activator.class, Level.FINE, "Creating Table: [ " + tableDef.getFullyQualifiedTableName() + "]");
+ getLogger().debug("Creating Table: [%s]", 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() + "]");
+ getLogger().debug("Dropping Table: [%s]", tableDef.getFullyQualifiedTableName());
ConnectionHandler.runPreparedUpdate(toExecute);
}
@@ -76,7 +74,7 @@ public class PostgreSqlManager extends SqlManagerImpl {
for (int index = 0; index < array.length; index++) {
array[index] = array[index];
}
- return StringUtils.join(array, splitAt.replaceAll("\\\\", ""));
+ return join(array, splitAt.replaceAll("\\\\", ""));
}
public void dropIndex(OseeConnection connection, TableElement tableDef) throws OseeCoreException {
@@ -86,8 +84,7 @@ public class PostgreSqlManager extends SqlManagerImpl {
if (iData.ignoreMySql()) {
continue;
}
- OseeLog.logf(Activator.class, Level.FINE,
- "Dropping Index: [%s] FROM [%s]\n", iData.getId(), tableName);
+ getLogger().debug("Dropping Index: [%s] FROM [%s]\n", iData.getId(), tableName);
if (iData.getId().equals("PRIMARY")) {
ConnectionHandler.runPreparedUpdate(connection,
"ALTER TABLE " + tableDef.getFullyQualifiedTableName() + " DROP PRIMARY KEY");
@@ -142,15 +139,13 @@ public class PostgreSqlManager extends SqlManagerImpl {
}
else {
- OseeLog.log(Activator.class, Level.WARNING,
- "Skipping CONSTRAINT at Table: " + tableID + "\n\t " + fk.toString());
+ getLogger().warn("Skipping CONSTRAINT at Table: %s\n\t%s", tableID, fk.toString());
}
}
}
} else {
- OseeLog.log(Activator.class, Level.WARNING,
- "Skipping CONSTRAINT at Table: " + tableID + "\n\t " + constraint.toString());
+ getLogger().warn("Skipping CONSTRAINT at Table: %s\n\t%s", tableID, constraint.toString());
}
return toReturn.toString();
}
@@ -187,9 +182,9 @@ public class PostgreSqlManager extends SqlManagerImpl {
}
}
String toExecute =
- String.format(CREATE_STRING + " " + iData.getIndexType() + " INDEX %s ON %s (%s)", indexId, tableName,
+ String.format("%s %s INDEX %s ON %s (%s)", CREATE_STRING, iData.getIndexType(), indexId, tableName,
appliesTo);
- OseeLog.log(Activator.class, Level.FINE, toExecute);
+ getLogger().debug(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.database.schema/src/org/eclipse/osee/database/schema/internal/sql/PostgresqlDataType.java
index 42d4dd91c27..7c760e4e1f5 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/PostgresqlDataType.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/sql/PostgresqlDataType.java
@@ -8,7 +8,7 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.sql;
+package org.eclipse.osee.database.schema.internal.sql;
/**
* @author Roberto E. Escobar
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.database.schema/src/org/eclipse/osee/database/schema/internal/sql/SchemaSqlUtil.java
index 760eca33afe..d8a93ceec16 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/SchemaSqlUtil.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/sql/SchemaSqlUtil.java
@@ -8,13 +8,13 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.sql;
+package org.eclipse.osee.database.schema.internal.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.database.schema.internal.data.SchemaData;
+import org.eclipse.osee.database.schema.internal.data.TableElement;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
public class SchemaSqlUtil {
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.database.schema/src/org/eclipse/osee/database/schema/internal/sql/SqlDataType.java
index 55241b1bf09..1ebf2710500 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/SqlDataType.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/sql/SqlDataType.java
@@ -8,7 +8,7 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.sql;
+package org.eclipse.osee.database.schema.internal.sql;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
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.database.schema/src/org/eclipse/osee/database/schema/internal/sql/SqlFactory.java
index 5434156848a..63c775a29e3 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/SqlFactory.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/sql/SqlFactory.java
@@ -8,11 +8,12 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.sql;
+package org.eclipse.osee.database.schema.internal.sql;
import java.sql.DatabaseMetaData;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.database.core.SupportedDatabase;
+import org.eclipse.osee.logger.Log;
/**
* @author Roberto E. Escobar
@@ -23,27 +24,28 @@ public class SqlFactory {
super();
}
- public static SqlManager getSqlManager(DatabaseMetaData metaData) throws OseeCoreException {
- return getSqlManager(SupportedDatabase.getDatabaseType(metaData));
+ public static SqlManager getSqlManager(Log logger, DatabaseMetaData metaData) throws OseeCoreException {
+ SupportedDatabase db = SupportedDatabase.getDatabaseType(metaData);
+ return getSqlManager(logger, db);
}
- private static SqlManager getSqlManager(SupportedDatabase db) {
+ private static SqlManager getSqlManager(Log logger, SupportedDatabase db) {
SqlManager instance = null;
switch (db) {
case oracle:
- instance = new OracleSqlManager(new OracleSqlDataType());
+ instance = new OracleSqlManager(logger, new OracleSqlDataType());
break;
case foxpro:
- instance = new SqlManagerImpl(new FoxProDataType());
+ instance = new SqlManagerImpl(logger, new FoxProDataType());
break;
case mysql:
- instance = new MysqlSqlManager(new MySqlDataType());
+ instance = new MysqlSqlManager(logger, new MySqlDataType());
break;
case postgresql:
- instance = new PostgreSqlManager(new PostgresqlDataType());
+ instance = new PostgreSqlManager(logger, new PostgresqlDataType());
break;
case h2:
- instance = new H2SqlManager(new H2DataType());
+ instance = new H2SqlManager(logger, new H2DataType());
break;
default:
break;
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.database.schema/src/org/eclipse/osee/database/schema/internal/sql/SqlManager.java
index 7ab6da95905..13a575add70 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/SqlManager.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/sql/SqlManager.java
@@ -8,7 +8,7 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.sql;
+package org.eclipse.osee.database.schema.internal.sql;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
@@ -19,41 +19,54 @@ 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.database.schema.internal.data.AppliesToClause;
+import org.eclipse.osee.database.schema.internal.data.ColumnDbData;
+import org.eclipse.osee.database.schema.internal.data.ColumnMetadata;
+import org.eclipse.osee.database.schema.internal.data.ConstraintElement;
+import org.eclipse.osee.database.schema.internal.data.ForeignKey;
+import org.eclipse.osee.database.schema.internal.data.IndexElement;
+import org.eclipse.osee.database.schema.internal.data.ReferenceClause;
+import org.eclipse.osee.database.schema.internal.data.SchemaDataLookup;
+import org.eclipse.osee.database.schema.internal.data.TableElement;
+import org.eclipse.osee.database.schema.internal.data.ReferenceClause.OnDeleteEnum;
+import org.eclipse.osee.database.schema.internal.data.ReferenceClause.OnUpdateEnum;
+import org.eclipse.osee.database.schema.internal.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.Collections;
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;
+import org.eclipse.osee.logger.Log;
/**
* @author Roberto E. Escobar
*/
public abstract class SqlManager {
+
+ private final Log logger;
protected SqlDataType sqlDataType;
public static final String CREATE_STRING = "CREATE";
public static final String DROP_STRING = "DROP";
- public SqlManager(SqlDataType sqlDataType) {
+ protected SqlManager(Log logger, SqlDataType sqlDataType) {
+ this.logger = logger;
this.sqlDataType = sqlDataType;
}
+ protected Log getLogger() {
+ return logger;
+ }
+
+ protected String join(String[] data, String separator) {
+ return Collections.toString(separator, (Object[]) data);
+ }
+
+ protected String join(List<String> data, String separator) {
+ return Collections.toString(separator, data);
+ }
+
public abstract void createTable(TableElement tableDef) throws OseeCoreException;
public abstract void dropTable(TableElement tableDef) throws OseeCoreException;
@@ -79,9 +92,9 @@ public abstract class SqlManager {
String toExecute =
"INSERT INTO " + formatQuotedString(tableMetadata.getFullyQualifiedTableName(), "\\.") + " (\n";
- toExecute += StringUtils.join(columnNames, ",");
+ toExecute += join(columnNames, ",");
toExecute += "\n) VALUES (\n";
- toExecute += StringUtils.join(placeHolders, ",");
+ toExecute += join(placeHolders, ",");
toExecute += ")\n";
Object[] data = new Object[columnNames.size()];
@@ -166,7 +179,7 @@ public abstract class SqlManager {
}
StringBuilder toExecute = new StringBuilder();
toExecute.append((constraintStatements.size() != 0 ? ",\n" : ""));
- toExecute.append(StringUtils.join(constraintStatements, ",\n"));
+ toExecute.append(join(constraintStatements, ",\n"));
return toExecute.toString();
}
@@ -175,7 +188,8 @@ public abstract class SqlManager {
for (int index = 0; index < array.length; index++) {
array[index] = "\"" + array[index] + "\"";
}
- return StringUtils.join(array, splitAt.replaceAll("\\\\", ""));
+ String separator = splitAt.replaceAll("\\\\", "");
+ return join(array, separator);
}
public String constraintDataToSQL(ConstraintElement constraint, String tableID) {
@@ -221,15 +235,12 @@ public abstract class SqlManager {
}
else {
- OseeLog.log(Activator.class, Level.WARNING,
- "Skipping CONSTRAINT at Table: " + tableID + "\n\t " + fk.toString());
+ getLogger().warn("Skipping CONSTRAINT at Table: %s\n\t %s", tableID, fk);
}
-
}
}
} else {
- OseeLog.log(Activator.class, Level.WARNING,
- "Skipping CONSTRAINT at Table: " + tableID + "\n\t " + constraint.toString());
+ getLogger().warn("Skipping CONSTRAINT at Table: %s\n\t %s", tableID, constraint);
}
return toReturn.toString();
}
@@ -245,9 +256,9 @@ public abstract class SqlManager {
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(join(columns, ","));
toExecute.append("\n) VALUES (\n");
- toExecute.append(StringUtils.join(columnData, ","));
+ toExecute.append(join(columnData, ","));
toExecute.append(")\n");
return toExecute.toString();
}
@@ -287,7 +298,7 @@ public abstract class SqlManager {
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);
+ getLogger().debug(toExecute);
ConnectionHandler.runPreparedUpdate(toExecute);
}
}
@@ -300,8 +311,7 @@ public abstract class SqlManager {
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);
+ getLogger().debug("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.database.schema/src/org/eclipse/osee/database/schema/internal/sql/SqlManagerImpl.java
index f95810fb859..af3e1941bd1 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/sql/SqlManagerImpl.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/sql/SqlManagerImpl.java
@@ -8,28 +8,26 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.sql;
+package org.eclipse.osee.database.schema.internal.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.database.schema.internal.data.ColumnMetadata;
+import org.eclipse.osee.database.schema.internal.data.TableElement;
+import org.eclipse.osee.database.schema.internal.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;
+import org.eclipse.osee.logger.Log;
/**
* @author Roberto E. Escobar
*/
public class SqlManagerImpl extends SqlManager {
- public SqlManagerImpl(SqlDataType sqlDataType) {
- super(sqlDataType);
+ public SqlManagerImpl(Log logger, SqlDataType sqlDataType) {
+ super(logger, sqlDataType);
}
private String handleColumnCreationSection(Map<String, ColumnMetadata> columns) {
@@ -39,7 +37,7 @@ public class SqlManagerImpl extends SqlManager {
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);
+ String toExecute = join(lines, ",\n");
return toExecute;
}
@@ -53,7 +51,7 @@ public class SqlManagerImpl extends SqlManager {
toExecute.append(handleConstraintCreationSection(tableDef.getForeignKeyConstraints(),
tableDef.getFullyQualifiedTableName()));
toExecute.append(" \n)\n");
- OseeLog.log(Activator.class, Level.FINE, "Creating Table: [ " + tableDef.getFullyQualifiedTableName() + "]");
+ getLogger().debug("Creating Table: [%s]", tableDef.getFullyQualifiedTableName());
ConnectionHandler.runPreparedUpdate(toExecute.toString());
}
@@ -62,7 +60,7 @@ public class SqlManagerImpl extends SqlManager {
StringBuilder toExecute = new StringBuilder();
toExecute.append(SqlManager.DROP_STRING + " TABLE " + formatQuotedString(tableDef.getFullyQualifiedTableName(),
"\\."));
- OseeLog.log(Activator.class, Level.FINE, "Dropping Table: [ " + tableDef.getFullyQualifiedTableName() + "]");
+ getLogger().debug("Dropping Table: [%s]", tableDef.getFullyQualifiedTableName());
ConnectionHandler.runPreparedUpdate(toExecute.toString());
}
}
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.database.schema/src/org/eclipse/osee/database/schema/internal/util/DatabaseDataImporter.java
index c80a33c7d40..8d05ac75938 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/DatabaseDataImporter.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/util/DatabaseDataImporter.java
@@ -8,7 +8,7 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.operations;
+package org.eclipse.osee.database.schema.internal.util;
import java.io.File;
import java.util.ArrayList;
@@ -17,21 +17,19 @@ 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.database.schema.internal.data.ColumnDbData;
+import org.eclipse.osee.database.schema.internal.data.ColumnMetadata;
+import org.eclipse.osee.database.schema.internal.data.TableElement;
+import org.eclipse.osee.database.schema.internal.data.TableElement.ColumnFields;
+import org.eclipse.osee.database.schema.internal.data.TableElement.TableDescriptionFields;
+import org.eclipse.osee.database.schema.internal.data.TableElement.TableTags;
+import org.eclipse.osee.database.schema.internal.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.eclipse.osee.logger.Log;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
@@ -47,24 +45,10 @@ public class DatabaseDataImporter {
private List<String> tableOrder;
private String schemaToImportTo;
private final Set<String> tableFilter;
+ private final Log logger;
- 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) {
+ public DatabaseDataImporter(Log logger, File directory, SqlManager sqlManager) {
+ this.logger = logger;
this.directory = directory;
this.sqlManager = sqlManager;
this.tableFilter = new TreeSet<String>();
@@ -135,9 +119,9 @@ public class DatabaseDataImporter {
document = builder.parse(file);
processData(parseXMLDbDataFile(document));
} catch (ParserConfigurationException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, "Unable to Parse File. ", ex);
+ logger.error(ex, "Unable to Parse File. ");
} catch (Exception ex) {
- OseeLog.log(Activator.class, Level.SEVERE, "Exception: \n", ex);
+ logger.error(ex, "Error importing into database");
}
}
}
@@ -155,7 +139,7 @@ public class DatabaseDataImporter {
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");
+ logger.info("Populating: [%s]\n", tableData.getFullyQualifiedTableName());
List<List<ColumnDbData>> rows = tableData.getRows();
if (!rows.isEmpty()) {
for (List<ColumnDbData> rowData : rows) {
@@ -252,4 +236,20 @@ public class DatabaseDataImporter {
}
return tables;
}
+
+ private static 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;
+ }
+ }
}
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.database.schema/src/org/eclipse/osee/database/schema/internal/util/FileUtility.java
index b4c54ab91d6..6920a000b86 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/schema/operations/FileUtility.java
+++ b/plugins/org.eclipse.osee.database.schema/src/org/eclipse/osee/database/schema/internal/util/FileUtility.java
@@ -8,7 +8,7 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.schema.operations;
+package org.eclipse.osee.database.schema.internal.util;
import java.io.File;
import java.io.FilenameFilter;
diff --git a/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/BranchManagementTestSuite.java b/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/BranchManagementTestSuite.java
index 35e64360798..e4d7d0190ef 100644
--- a/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/BranchManagementTestSuite.java
+++ b/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/BranchManagementTestSuite.java
@@ -10,19 +10,13 @@
*******************************************************************************/
package org.eclipse.osee.framework.branch.management.test;
-import org.eclipse.osee.framework.branch.management.test.change.ChangeTestSuite;
-import org.eclipse.osee.framework.branch.management.test.commit.CommitTestSuite;
import org.eclipse.osee.framework.branch.management.test.exchange.ExchangeTestSuite;
-import org.eclipse.osee.framework.branch.management.test.purge.PurgeTestSuite;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({//
-ChangeTestSuite.class, //
- CommitTestSuite.class, //
- ExchangeTestSuite.class,//
- PurgeTestSuite.class,//
+ExchangeTestSuite.class,//
})
/**
* @author Roberto E. Escobar
diff --git a/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/mocks/MockBranchOperationFactory.java b/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/mocks/MockBranchOperationFactory.java
deleted file mode 100644
index e020c8a507f..00000000000
--- a/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/mocks/MockBranchOperationFactory.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 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.branch.management.test.mocks;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.osee.framework.branch.management.purge.IBranchOperationFactory;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.operation.IOperation;
-import org.eclipse.osee.framework.core.test.mocks.MockOperation;
-
-/**
- * @author John Misinco
- */
-public final class MockBranchOperationFactory implements IBranchOperationFactory {
-
- private final MockOperation mockOp = new MockOperation();
- private final List<Branch> calledBranches = new ArrayList<Branch>();
-
- public boolean getCalled() {
- return mockOp.getCalled();
- }
-
- public List<Branch> getCallOrder() {
- return calledBranches;
- }
-
- @Override
- public IOperation createOperation(Branch branch) {
- calledBranches.add(branch);
- return mockOp;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/purge/BranchOperationTest.java b/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/purge/BranchOperationTest.java
deleted file mode 100644
index 4415b631d89..00000000000
--- a/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/purge/BranchOperationTest.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 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.branch.management.test.purge;
-
-import java.util.List;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.osee.framework.branch.management.purge.BranchOperation;
-import org.eclipse.osee.framework.branch.management.test.mocks.MockBranchOperationFactory;
-import org.eclipse.osee.framework.branch.management.test.mocks.MockBranchProvider;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.operation.NullOperationLogger;
-import org.eclipse.osee.framework.core.operation.OperationLogger;
-import org.eclipse.osee.framework.core.operation.Operations;
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * @author John Misinco
- */
-public final class BranchOperationTest {
-
- private void runTest(boolean nullFactory, boolean nullProvider, boolean nullLogger, boolean expectedResult) throws OseeCoreException {
- OperationLogger logger = NullOperationLogger.getSingleton();
-
- MockBranchOperationFactory mbo = new MockBranchOperationFactory();
- MockBranchProvider mbp = new MockBranchProvider();
-
- if (nullFactory) {
- mbo = null;
- }
- if (nullProvider) {
- mbp = null;
- }
- if (nullLogger) {
- logger = null;
- }
-
- BranchOperation bo = new BranchOperation(logger, mbo, mbp);
- IStatus status = Operations.executeWork(bo);
-
- if (expectedResult) {
- Assert.assertEquals(Status.OK_STATUS, status);
- Assert.assertTrue(mbo.getCalled() == expectedResult);
- Assert.assertTrue(verifyCallOrder(mbo.getCallOrder()));
- } else {
- Assert.assertFalse(Status.OK_STATUS == status);
- }
-
- }
-
- private boolean verifyCallOrder(List<Branch> callOrder) throws OseeCoreException {
- boolean result = true;
- for (Branch cur : callOrder) {
- int idxCur = callOrder.indexOf(cur);
- Branch parent = cur.getParentBranch();
- if (parent != null) {
- int idxParent = callOrder.indexOf(parent);
- if (idxCur > idxParent) {
- result = false;
- break;
- }
- }
- }
- return result;
- }
-
- @Test
- public void testBranchOperation() throws OseeCoreException {
- runTest(false, false, false, true);
- }
-
- @Test
- public void testBranchOperationException__nullFactory() throws OseeCoreException {
- runTest(true, false, false, false);
- }
-
- @Test
- public void testBranchOperationException__nullProvider() throws OseeCoreException {
- runTest(false, true, false, false);
- }
-
- @Test
- public void testBranchOperationException__nullLogger() throws OseeCoreException {
- runTest(false, false, true, false);
- }
-
- @Test
- public void testBranchOperationException__allNull() throws OseeCoreException {
- runTest(true, true, true, false);
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.branch.management/.project b/plugins/org.eclipse.osee.framework.branch.management/.project
index 9de8f889a10..3253ccdaaa3 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/.project
+++ b/plugins/org.eclipse.osee.framework.branch.management/.project
@@ -20,6 +20,11 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ds.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
diff --git a/plugins/org.eclipse.osee.framework.branch.management/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.branch.management/META-INF/MANIFEST.MF
index 74f71a85573..d3eb4fad443 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.framework.branch.management/META-INF/MANIFEST.MF
@@ -4,9 +4,7 @@ Bundle-Name: Branch Management Plug-in
Bundle-SymbolicName: org.eclipse.osee.framework.branch.management;singleton:=true
Bundle-Version: 0.9.9.qualifier
Eclipse-ExtensibleAPI: true
-Bundle-Activator: org.eclipse.osee.framework.branch.management.internal.Activator
-Import-Package: org.eclipse.core.runtime,
- org.eclipse.core.runtime.jobs,
+Import-Package: org.eclipse.osee.executor.admin,
org.eclipse.osee.framework.core.data,
org.eclipse.osee.framework.core.enums,
org.eclipse.osee.framework.core.exception,
@@ -14,11 +12,8 @@ Import-Package: org.eclipse.core.runtime,
org.eclipse.osee.framework.core.model,
org.eclipse.osee.framework.core.model.cache,
org.eclipse.osee.framework.core.model.change,
- 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,
@@ -29,20 +24,14 @@ Import-Package: org.eclipse.core.runtime,
org.eclipse.osee.framework.jdk.core.type,
org.eclipse.osee.framework.jdk.core.util,
org.eclipse.osee.framework.jdk.core.util.io.xml,
- 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.framework.resource.management.exception,
org.eclipse.osee.framework.resource.management.util,
org.eclipse.osee.logger,
- org.eclipse.osgi.framework.console,
- org.osgi.framework,
- org.osgi.util.tracker
+ org.eclipse.osee.orcs.core
Bundle-ActivationPolicy: lazy
-Export-Package: org.eclipse.osee.framework.branch.management,
- org.eclipse.osee.framework.branch.management.commit,
- org.eclipse.osee.framework.branch.management.purge
-Service-Component: OSGI-INF/exchange.provider.xml,
- OSGI-INF/locator.provider.exchange.xml
+Export-Package: org.eclipse.osee.framework.branch.management
+Service-Component: OSGI-INF/*.xml
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: org.eclipse.core.runtime
diff --git a/plugins/org.eclipse.osee.framework.branch.management/OSGI-INF/branch.exchange.xml b/plugins/org.eclipse.osee.framework.branch.management/OSGI-INF/branch.exchange.xml
new file mode 100644
index 00000000000..296d82ab644
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.branch.management/OSGI-INF/branch.exchange.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" deactivate="stop" name="org.eclipse.osee.framework.branch.management.exchange.BranchExchangeImpl">
+ <implementation class="org.eclipse.osee.framework.branch.management.exchange.BranchExchangeImpl"/>
+ <service>
+ <provide interface="org.eclipse.osee.framework.branch.management.IBranchExchange"/>
+ </service>
+ <reference bind="setResourceManager" cardinality="1..1" interface="org.eclipse.osee.framework.resource.management.IResourceManager" name="IResourceManager" policy="static"/>
+ <reference bind="setResourceLocator" cardinality="1..1" interface="org.eclipse.osee.framework.resource.management.IResourceLocatorManager" name="IResourceLocatorManager" policy="static"/>
+ <reference bind="setModelingService" cardinality="1..1" interface="org.eclipse.osee.framework.core.services.IOseeModelingService" name="IOseeModelingService" policy="static"/>
+ <reference bind="setCachingService" cardinality="1..1" interface="org.eclipse.osee.framework.core.services.IOseeCachingService" name="IOseeCachingService" policy="static"/>
+ <reference bind="setDatabaseService" cardinality="1..1" interface="org.eclipse.osee.framework.database.IOseeDatabaseService" name="IOseeDatabaseService" policy="static"/>
+ <reference bind="setIdentityService" cardinality="1..1" interface="org.eclipse.osee.framework.core.services.IdentityService" name="IdentityService" policy="static"/>
+ <reference bind="setLogger" cardinality="1..1" interface="org.eclipse.osee.logger.Log" name="Log" policy="static"/>
+ <reference bind="setExecutorAdmin" cardinality="1..1" interface="org.eclipse.osee.executor.admin.ExecutorAdmin" name="ExecutorAdmin" policy="static"/>
+ <reference bind="setSystemPreferences" cardinality="1..1" interface="org.eclipse.osee.orcs.core.SystemPreferences" name="SystemPreferences" policy="static"/>
+</scr:component>
diff --git a/plugins/org.eclipse.osee.framework.branch.management/OSGI-INF/exchange.provider.xml b/plugins/org.eclipse.osee.framework.branch.management/OSGI-INF/exchange.provider.xml
index 158577a3826..e71a3500b16 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/OSGI-INF/exchange.provider.xml
+++ b/plugins/org.eclipse.osee.framework.branch.management/OSGI-INF/exchange.provider.xml
@@ -1,7 +1,10 @@
-<?xml version="1.0"?>
-<component name="exchange.resource.provider">
- <implementation class="org.eclipse.osee.framework.branch.management.exchange.resource.ExchangeProvider"/>
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" deactivate="stop" name="org.eclipse.osee.framework.branch.management.exchange.resource.ExchangeProvider">
+ <implementation
+ class="org.eclipse.osee.framework.branch.management.exchange.resource.ExchangeProvider" />
<service>
- <provide interface="org.eclipse.osee.framework.resource.management.IResourceProvider"/>
- </service>
-</component> \ No newline at end of file
+ <provide
+ interface="org.eclipse.osee.framework.resource.management.IResourceProvider" />
+ </service>
+ <reference bind="setSystemPreferences" cardinality="1..1" interface="org.eclipse.osee.orcs.core.SystemPreferences" name="SystemPreferences" policy="static"/>
+</scr:component>
diff --git a/plugins/org.eclipse.osee.framework.branch.management/OSGI-INF/locator.provider.exchange.xml b/plugins/org.eclipse.osee.framework.branch.management/OSGI-INF/locator.provider.exchange.xml
index 30651fc3aff..416d2649dd1 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/OSGI-INF/locator.provider.exchange.xml
+++ b/plugins/org.eclipse.osee.framework.branch.management/OSGI-INF/locator.provider.exchange.xml
@@ -1,7 +1,10 @@
-<?xml version="1.0"?>
-<component name="resource.locator.exchange">
- <implementation class="org.eclipse.osee.framework.branch.management.exchange.resource.ExchangeLocatorProvider"/>
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
+ name="org.eclipse.osee.framework.branch.management.exchange.resource.ExchangeLocatorProvider">
+ <implementation
+ class="org.eclipse.osee.framework.branch.management.exchange.resource.ExchangeLocatorProvider" />
<service>
- <provide interface="org.eclipse.osee.framework.resource.management.IResourceLocatorProvider"/>
- </service>
-</component> \ No newline at end of file
+ <provide
+ interface="org.eclipse.osee.framework.resource.management.IResourceLocatorProvider" />
+ </service>
+</scr:component> \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.branch.management/build.properties b/plugins/org.eclipse.osee.framework.branch.management/build.properties
index c58ea2178c3..3f48ec8b0b1 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/build.properties
+++ b/plugins/org.eclipse.osee.framework.branch.management/build.properties
@@ -1,5 +1,15 @@
-source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
- OSGI-INF/
+ OSGI-INF/,\
+ OSGI-INF/branch.exchange.xml
+source.. = src/
+additional.bundles = org.eclipse.osee.framework.jdk.core,\
+ org.eclipse.osee.framework.database,\
+ org.eclipse.osee.framework.core.model,\
+ org.eclipse.osee.framework.core,\
+ org.eclipse.osee.framework.resource.management,\
+ org.eclipse.osee.logger,\
+ org.eclipse.osee.framework.core.message,\
+ org.eclipse.osee.orcs.core,\
+ org.eclipse.osee.executor.admin
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/IOseeBranchService.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/IOseeBranchService.java
deleted file mode 100644
index 6df97a399ad..00000000000
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/IOseeBranchService.java
+++ /dev/null
@@ -1,48 +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.branch.management;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.message.BranchCommitRequest;
-import org.eclipse.osee.framework.core.message.BranchCommitResponse;
-import org.eclipse.osee.framework.core.message.BranchCreationRequest;
-import org.eclipse.osee.framework.core.message.BranchCreationResponse;
-import org.eclipse.osee.framework.core.message.ChangeBranchArchiveStateRequest;
-import org.eclipse.osee.framework.core.message.ChangeBranchStateRequest;
-import org.eclipse.osee.framework.core.message.ChangeBranchTypeRequest;
-import org.eclipse.osee.framework.core.message.ChangeReportRequest;
-import org.eclipse.osee.framework.core.message.ChangeReportResponse;
-import org.eclipse.osee.framework.core.message.PurgeBranchRequest;
-import org.eclipse.osee.framework.core.operation.IOperation;
-import org.eclipse.osee.framework.core.operation.OperationLogger;
-
-/**
- * @author Jeff C. Phillips
- */
-public interface IOseeBranchService {
- void commitBranch(IProgressMonitor monitor, BranchCommitRequest branchCommitData, BranchCommitResponse response) throws OseeCoreException;
-
- IOperation getChanges(IProgressMonitor monitor, ChangeReportRequest request, ChangeReportResponse response) throws OseeCoreException;
-
- IOperation createBranch(IProgressMonitor monitor, BranchCreationRequest request, BranchCreationResponse response) throws OseeCoreException;
-
- IOperation purge(IProgressMonitor monitor, PurgeBranchRequest request, OperationLogger logger) throws OseeCoreException;
-
- IOperation updateBranchType(IProgressMonitor monitor, ChangeBranchTypeRequest request) throws OseeCoreException;
-
- IOperation updateBranchState(IProgressMonitor monitor, ChangeBranchStateRequest request) throws OseeCoreException;
-
- IOperation updateBranchArchiveState(IProgressMonitor monitor, ChangeBranchArchiveStateRequest request) throws OseeCoreException;
-
- IOperation createSystemRootBranch(IProgressMonitor monitor) throws OseeCoreException;
-}
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/TxCurrentsAndModTypesCommand.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/TxCurrentsAndModTypesCommand.java
index 72a2911d644..2c14cb9c9a2 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/TxCurrentsAndModTypesCommand.java
+++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/TxCurrentsAndModTypesCommand.java
@@ -12,7 +12,6 @@ package org.eclipse.osee.framework.branch.management;
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.osee.framework.branch.management.internal.Activator;
import org.eclipse.osee.framework.core.operation.CompositeOperation;
import org.eclipse.osee.framework.core.operation.IOperation;
import org.eclipse.osee.framework.core.operation.OperationLogger;
@@ -22,8 +21,9 @@ import org.eclipse.osee.framework.database.operation.InvalidTxCurrentsAndModType
* @author Ryan D. Brooks
*/
public class TxCurrentsAndModTypesCommand extends CompositeOperation {
+
public TxCurrentsAndModTypesCommand(OperationLogger logger, boolean archived) {
- super("TxCurrents And Mod Types", Activator.PLUGIN_ID, logger, buildSubOperations(logger, archived));
+ super("TxCurrents And Mod Types", "Plugin Id", logger, buildSubOperations(logger, archived));
}
private static List<IOperation> buildSubOperations(OperationLogger logger, boolean archived) {
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/change/ChangeItemLoader.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/change/ChangeItemLoader.java
deleted file mode 100644
index 7c8c044d78a..00000000000
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/change/ChangeItemLoader.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.branch.management.change;
-
-import java.util.HashMap;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.core.enums.ModificationType;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.change.ArtifactChangeItem;
-import org.eclipse.osee.framework.core.model.change.AttributeChangeItem;
-import org.eclipse.osee.framework.core.model.change.ChangeItem;
-import org.eclipse.osee.framework.core.model.change.RelationChangeItem;
-import org.eclipse.osee.framework.database.IOseeDatabaseServiceProvider;
-import org.eclipse.osee.framework.database.core.IOseeStatement;
-import org.eclipse.osee.framework.database.core.IdJoinQuery;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ChangeItemLoader {
-
- private final IOseeDatabaseServiceProvider oseeDatabaseProvider;
- private final HashMap<Long, ModificationType> changeByGammaId;
-
- public static interface ChangeItemFactory {
-
- String getItemTableName();
-
- String getItemIdColumnName();
-
- String getItemValueColumnName();
-
- String getLoadByGammaQuery();
-
- ChangeItem createItem(IOseeStatement statement) throws OseeCoreException;
- }
-
- public ChangeItemLoader(IOseeDatabaseServiceProvider oseeDatabaseProvider, HashMap<Long, ModificationType> changeByGammaId) {
- this.oseeDatabaseProvider = oseeDatabaseProvider;
- this.changeByGammaId = changeByGammaId;
- }
-
- public ChangeItemFactory createArtifactChangeItemFactory() {
- return new ArtifactChangeItemFactory();
- }
-
- public ChangeItemFactory createAttributeChangeItemFactory() {
- return new AttributeChangeItemFactory();
- }
-
- public ChangeItemFactory createRelationChangeItemFactory() {
- return new RelationChangeItemFactory();
- }
-
- public void loadItemIdsBasedOnGammas(IProgressMonitor monitor, ChangeItemFactory factory, int queryId, HashMap<Integer, ChangeItem> changesByItemId, IdJoinQuery idJoin) throws OseeCoreException {
- IOseeStatement chStmt = oseeDatabaseProvider.getOseeDatabaseService().getStatement();
- try {
- chStmt.runPreparedQuery(10000, factory.getLoadByGammaQuery(), queryId);
- while (chStmt.next()) {
- ChangeItem item = factory.createItem(chStmt);
- Integer itemId = item.getItemId();
- changesByItemId.put(itemId, item);
- idJoin.add(itemId);
- }
- } finally {
- chStmt.close();
- }
- }
-
- private final class ArtifactChangeItemFactory implements ChangeItemFactory {
- private static final String SELECT_ARTIFACTS_BY_GAMMAS =
- "select art_id, art_type_id, txj.gamma_id from osee_artifact id, osee_join_transaction txj where id.gamma_id = txj.gamma_id and txj.query_id = ?";
-
- @Override
- public String getLoadByGammaQuery() {
- return SELECT_ARTIFACTS_BY_GAMMAS;
- }
-
- @Override
- public ChangeItem createItem(IOseeStatement chStmt) throws OseeCoreException {
- int artId = chStmt.getInt("art_id");
- int artTypeId = chStmt.getInt("art_type_id");
-
- long gammaId = chStmt.getLong("gamma_id");
- ModificationType modType = changeByGammaId.get(gammaId);
-
- return new ArtifactChangeItem(artId, artTypeId, gammaId, modType);
- }
-
- @Override
- public String getItemIdColumnName() {
- return "art_id";
- }
-
- @Override
- public String getItemTableName() {
- return "osee_artifact";
- }
-
- @Override
- public String getItemValueColumnName() {
- return null;
- }
- }
-
- private final class AttributeChangeItemFactory implements ChangeItemFactory {
- private static final String SELECT_ATTRIBUTES_BY_GAMMAS =
- "select art_id, attr_id, value, attr_type_id, txj.gamma_id from osee_attribute id, osee_join_transaction txj where id.gamma_id = txj.gamma_id and txj.query_id = ?";
-
- @Override
- public String getLoadByGammaQuery() {
- return SELECT_ATTRIBUTES_BY_GAMMAS;
- }
-
- @Override
- public ChangeItem createItem(IOseeStatement chStmt) throws OseeCoreException {
- int attrId = chStmt.getInt("attr_id");
- int attrTypeId = chStmt.getInt("attr_type_id");
- int artId = chStmt.getInt("art_id");
-
- long gammaId = chStmt.getLong("gamma_id");
- ModificationType modType = changeByGammaId.get(gammaId);
-
- String value = chStmt.getString("value");
-
- return new AttributeChangeItem(attrId, attrTypeId, artId, gammaId, modType, value);
- }
-
- @Override
- public String getItemIdColumnName() {
- return "attr_id";
- }
-
- @Override
- public String getItemTableName() {
- return "osee_attribute";
- }
-
- @Override
- public String getItemValueColumnName() {
- return "value";
- }
- }
-
- private final class RelationChangeItemFactory implements ChangeItemFactory {
- private static final String SELECT_RELATIONS_BY_GAMMAS =
- "select a_art_id, b_art_id, rel_link_id, rel_link_type_id, rationale, txj.gamma_id from osee_relation_link id, osee_join_transaction txj where id.gamma_id = txj.gamma_id and txj.query_id = ?";
-
- @Override
- public String getLoadByGammaQuery() {
- return SELECT_RELATIONS_BY_GAMMAS;
- }
-
- @Override
- public ChangeItem createItem(IOseeStatement chStmt) throws OseeCoreException {
- int relLinkId = chStmt.getInt("rel_link_id");
- int relTypeId = chStmt.getInt("rel_link_type_id");
-
- long gammaId = chStmt.getLong("gamma_id");
- ModificationType modType = changeByGammaId.get(gammaId);
-
- int aArtId = chStmt.getInt("a_art_id");
- int bArtId = chStmt.getInt("b_art_id");
- String rationale = chStmt.getString("rationale");
-
- return new RelationChangeItem(relLinkId, relTypeId, gammaId, modType, aArtId, bArtId, rationale);
- }
-
- @Override
- public String getItemIdColumnName() {
- return "rel_link_id";
- }
-
- @Override
- public String getItemTableName() {
- return "osee_relation_link";
- }
-
- @Override
- public String getItemValueColumnName() {
- return "rationale";
- }
- }
-
-}
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/BranchExchange.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/BranchExchangeImpl.java
index 56f4da149a0..9cec39fde84 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/BranchExchange.java
+++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/BranchExchangeImpl.java
@@ -12,29 +12,90 @@ package org.eclipse.osee.framework.branch.management.exchange;
import java.io.File;
import java.util.List;
+import org.eclipse.osee.executor.admin.ExecutorAdmin;
import org.eclipse.osee.framework.branch.management.IBranchExchange;
import org.eclipse.osee.framework.branch.management.exchange.handler.StandardOseeDbExportDataProvider;
import org.eclipse.osee.framework.branch.management.exchange.resource.ExchangeLocatorProvider;
import org.eclipse.osee.framework.branch.management.exchange.transform.ExchangeDataProcessor;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
import org.eclipse.osee.framework.core.operation.OperationLogger;
+import org.eclipse.osee.framework.core.services.IOseeCachingService;
+import org.eclipse.osee.framework.core.services.IOseeModelingService;
+import org.eclipse.osee.framework.core.services.IdentityService;
+import org.eclipse.osee.framework.database.IOseeDatabaseService;
import org.eclipse.osee.framework.jdk.core.type.Pair;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
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.logger.Log;
+import org.eclipse.osee.orcs.core.SystemPreferences;
/**
* @author Roberto E. Escobar
*/
-public class BranchExchange implements IBranchExchange {
+public class BranchExchangeImpl implements IBranchExchange {
private final OseeServices oseeServices;
- public BranchExchange(OseeServices oseeServices) {
- this.oseeServices = oseeServices;
+ public BranchExchangeImpl() {
+ this.oseeServices = new OseeServices();
+ }
+
+ public void setLogger(Log logger) {
+ oseeServices.setLogger(logger);
+ }
+
+ public void setSystemPreferences(SystemPreferences systemPreferences) {
+ oseeServices.setSystemPreferences(systemPreferences);
+ }
+
+ public void setResourceManager(IResourceManager resourceService) {
+ oseeServices.setResourceService(resourceService);
+ }
+
+ public void setResourceLocator(IResourceLocatorManager locatorSservice) {
+ oseeServices.setLocatorService(locatorSservice);
+ }
+
+ public void setModelingService(IOseeCachingService cachingService) {
+ oseeServices.setCachingService(cachingService);
+ }
+
+ public void setCachingService(IOseeModelingService modelService) {
+ oseeServices.setModelService(modelService);
+ }
+
+ public void setDatabaseService(IOseeDatabaseService databaseService) {
+ oseeServices.setDatabaseService(databaseService);
+ }
+
+ public void setIdentityService(IdentityService identityService) {
+ oseeServices.setIdentityService(identityService);
+ }
+
+ public void setExecutorAdmin(ExecutorAdmin executorAdmin) {
+ oseeServices.setExecutorAdmin(executorAdmin);
+ }
+
+ public void start() {
+ oseeServices.setIsReady(true);
+ }
+
+ public void stop() {
+ oseeServices.clear();
+ }
+
+ private void checkInitialized() throws OseeCoreException {
+ if (!oseeServices.isReady()) {
+ throw new OseeStateException("BranchExchangeService was not initialized properly");
+ }
}
@Override
public IResourceLocator exportBranch(String exportName, PropertyStore options, List<Integer> branchIds) throws OseeCoreException {
+ checkInitialized();
ExportController controller = new ExportController(oseeServices, exportName, options, branchIds);
controller.handleTxWork();
return oseeServices.getResourceLocatorManager().generateResourceLocator(ExchangeLocatorProvider.PROTOCOL, "",
@@ -43,6 +104,7 @@ public class BranchExchange implements IBranchExchange {
@Override
public void importBranch(IResourceLocator exportDataLocator, PropertyStore options, List<Integer> branchIds, OperationLogger logger) throws OseeCoreException {
+ checkInitialized();
IOseeExchangeDataProvider exportDataProvider = createExportDataProvider(exportDataLocator);
ImportController importController =
new ImportController(oseeServices, exportDataProvider, options, branchIds, logger);
@@ -51,6 +113,7 @@ public class BranchExchange implements IBranchExchange {
@Override
public IResourceLocator checkIntegrity(IResourceLocator fileToCheck) throws OseeCoreException {
+ checkInitialized();
IOseeExchangeDataProvider exportDataProvider = createExportDataProvider(fileToCheck);
ExchangeDataProcessor processor = new ExchangeDataProcessor(exportDataProvider);
ExchangeIntegrity exchangeIntegrityCheck = new ExchangeIntegrity(oseeServices, exportDataProvider, processor);
@@ -60,8 +123,11 @@ public class BranchExchange implements IBranchExchange {
}
private IOseeExchangeDataProvider createExportDataProvider(IResourceLocator exportDataLocator) throws OseeCoreException {
+ checkInitialized();
Pair<Boolean, File> result =
- ExchangeUtil.getTempExchangeFile(exportDataLocator, oseeServices.getResourceManager());
- return new StandardOseeDbExportDataProvider(result.getSecond(), result.getFirst());
+ ExchangeUtil.getTempExchangeFile(oseeServices.getExchangeBasePath(), oseeServices.getLogger(),
+ exportDataLocator, oseeServices.getResourceManager());
+ return new StandardOseeDbExportDataProvider(oseeServices.getExchangeBasePath(), oseeServices.getLogger(),
+ result.getSecond(), result.getFirst());
}
}
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/ExchangeDb.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/ExchangeDb.java
index b3e734f9a42..89fc8f861b4 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/ExchangeDb.java
+++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/ExchangeDb.java
@@ -21,6 +21,7 @@ import static org.eclipse.osee.framework.branch.management.exchange.handler.Expo
import static org.eclipse.osee.framework.branch.management.exchange.handler.ExportItem.OSEE_TXS_ARCHIVED_DATA;
import static org.eclipse.osee.framework.branch.management.exchange.handler.ExportItem.OSEE_TXS_DATA;
import static org.eclipse.osee.framework.branch.management.exchange.handler.ExportItem.OSEE_TX_DETAILS_DATA;
+import java.sql.DatabaseMetaData;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
@@ -38,6 +39,7 @@ import org.eclipse.osee.framework.core.exception.OseeArgumentException;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.database.IOseeDatabaseService;
import org.eclipse.osee.framework.database.core.IOseeSequence;
+import org.eclipse.osee.framework.database.core.OseeConnection;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
import org.eclipse.osee.framework.jdk.core.util.Strings;
@@ -154,11 +156,20 @@ public final class ExchangeDb {
this.exportJoinId = exportJoinId;
}
+ private DatabaseMetaData getMetaData() throws OseeCoreException {
+ OseeConnection connection = services.getDatabaseService().getConnection();
+ try {
+ return connection.getMetaData();
+ } finally {
+ connection.close();
+ }
+ }
+
List<AbstractExportItem> createTaskList() throws OseeCoreException {
this.gammaJoinId = setupGammaJoin();
items.add(new ManifestExportItem(items, options));
- items.add(new MetadataExportItem(items, services.getDatabaseService().getConnection().getMetaData()));
+ items.add(new MetadataExportItem(items, getMetaData()));
items.add(new OseeTypeModelExportItem(services.getModelingService()));
addExportItem(OSEE_BRANCH_DATA, BRANCH_TABLE_QUERY);
addExportItem(OSEE_TX_DETAILS_DATA, TX_DETAILS_TABLE_QUERY);
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/ExchangeIntegrity.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/ExchangeIntegrity.java
index 318e88d056e..b6cea0f18e6 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/ExchangeIntegrity.java
+++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/ExchangeIntegrity.java
@@ -16,16 +16,14 @@ import java.io.Writer;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
-import java.util.logging.Level;
import org.eclipse.osee.framework.branch.management.exchange.handler.ExportItem;
import org.eclipse.osee.framework.branch.management.exchange.transform.ExchangeDataProcessor;
-import org.eclipse.osee.framework.branch.management.internal.Activator;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeExceptions;
import org.eclipse.osee.framework.jdk.core.type.HashCollection;
import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.framework.jdk.core.util.xml.Xml;
-import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.logger.Log;
/**
* @author Roberto E. Escobar
@@ -97,9 +95,11 @@ public class ExchangeIntegrity {
try {
writer = openResults();
+ Log logger = services.getLogger();
for (ReferentialIntegrityConstraint constraint : constraints) {
- OseeLog.logf(Activator.class, Level.INFO, "Verifing constraint [%s]", constraint.getPrimaryKeyListing());
- constraint.checkConstraint(services.getDatabaseService(), processor);
+ logger.info("Verifing constraint [%s]", constraint.getPrimaryKeyListing());
+
+ constraint.checkConstraint(logger, services.getDatabaseService(), processor);
writeConstraintResults(writer, constraint);
}
ExportImportXml.closeXmlNode(writer, ExportImportXml.DATA);
@@ -108,7 +108,7 @@ public class ExchangeIntegrity {
} finally {
Lib.close(writer);
processor.cleanUp();
- OseeLog.logf(Activator.class, Level.INFO, "Verified [%s] in [%s]", exportDataProvider.getExportedDataRoot(),
+ services.getLogger().info("Verified [%s] in [%s]", exportDataProvider.getExportedDataRoot(),
Lib.getElapseString(startTime));
}
}
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/ExchangeUtil.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/ExchangeUtil.java
index e23a907fd97..27ea414f017 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/ExchangeUtil.java
+++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/ExchangeUtil.java
@@ -19,18 +19,16 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
-import java.util.logging.Level;
-import org.eclipse.osee.framework.branch.management.exchange.resource.ExchangeProvider;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeExceptions;
import org.eclipse.osee.framework.core.util.Conditions;
import org.eclipse.osee.framework.jdk.core.type.Pair;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.resource.management.IResource;
import org.eclipse.osee.framework.resource.management.IResourceLocator;
import org.eclipse.osee.framework.resource.management.IResourceManager;
+import org.eclipse.osee.logger.Log;
import org.xml.sax.ContentHandler;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
@@ -54,7 +52,7 @@ public class ExchangeUtil {
return writer;
}
- public static Pair<Boolean, File> getTempExchangeFile(IResourceLocator locator, IResourceManager resourceManager) throws OseeCoreException {
+ public static Pair<Boolean, File> getTempExchangeFile(String exchangePath, Log logger, IResourceLocator locator, IResourceManager resourceManager) throws OseeCoreException {
File importSource = null;
boolean wasZipExtractionRequired = false;
IResource resource = resourceManager.acquire(locator, new PropertyStore());
@@ -63,9 +61,8 @@ public class ExchangeUtil {
File source = new File(resource.getLocation());
if (source.isFile()) {
wasZipExtractionRequired = true;
- importSource = ExchangeUtil.createTempFolder();
- OseeLog.logf(ExchangeUtil.class, Level.INFO,
- "Extracting Exchange File: [%s] to [%s]", source.getName(), importSource);
+ importSource = ExchangeUtil.createTempFolder(exchangePath);
+ logger.info("Extracting Exchange File: [%s] to [%s]", source.getName(), importSource);
try {
Lib.decompressStream(new FileInputStream(source), importSource);
} catch (Exception ex) {
@@ -79,19 +76,17 @@ public class ExchangeUtil {
return new Pair<Boolean, File>(wasZipExtractionRequired, importSource);
}
- public static void cleanUpTempExchangeFile(File exchangeSource, boolean wasZipExtractionRequired) {
+ public static void cleanUpTempExchangeFile(String exchangePath, Log logger, File exchangeSource, boolean wasZipExtractionRequired) {
if (wasZipExtractionRequired && exchangeSource != null && exchangeSource.exists() && !exchangeSource.getAbsolutePath().equals(
- ExchangeProvider.getExchangeFilePath())) {
- OseeLog.logf(ExchangeUtil.class, Level.INFO,
- "Deleting Branch Import Temp Folder - [%s]", exchangeSource);
+ exchangePath)) {
+ logger.info("Deleting Branch Import Temp Folder - [%s]", exchangeSource);
Lib.deleteDir(exchangeSource);
}
}
- public static File createTempFolder() {
- String basePath = ExchangeProvider.getExchangeFilePath();
+ public static File createTempFolder(String exchangePath) {
String fileName = TEMP_NAME_PREFIX + Lib.getDateTimeString();
- File rootDirectory = new File(basePath, fileName + File.separator);
+ File rootDirectory = new File(exchangePath, fileName + File.separator);
rootDirectory.mkdirs();
return rootDirectory;
}
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/ExportController.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/ExportController.java
index 98abbdb7d1d..08758d6c14c 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/ExportController.java
+++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/ExportController.java
@@ -15,11 +15,8 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
import java.util.concurrent.Future;
-import java.util.logging.Level;
+import org.eclipse.osee.executor.admin.ExecutorAdmin;
import org.eclipse.osee.framework.branch.management.ExportOptions;
import org.eclipse.osee.framework.branch.management.IExchangeTaskListener;
import org.eclipse.osee.framework.branch.management.exchange.export.AbstractExportItem;
@@ -31,7 +28,6 @@ import org.eclipse.osee.framework.database.core.JoinUtility;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.logging.OseeLog;
/**
* @author Roberto E. Escobar
@@ -43,7 +39,6 @@ final class ExportController implements IExchangeTaskListener {
private final PropertyStore options;
private final List<Integer> branchIds;
private final ExportImportJoinQuery exportJoinId;
- private ExecutorService executorService;
private final List<String> errorList = new CopyOnWriteArrayList<String>();
private final OseeServices oseeServices;
@@ -75,12 +70,10 @@ final class ExportController implements IExchangeTaskListener {
} catch (OseeCoreException ex) {
onException("Export Clean-Up", ex);
}
- this.executorService.shutdown();
- this.executorService = null;
}
- private File createTempFolder() {
- File rootDirectory = ExchangeUtil.createTempFolder();
+ private File createTempFolder() throws OseeCoreException {
+ File rootDirectory = ExchangeUtil.createTempFolder(oseeServices.getExchangeBasePath());
if (!Strings.isValid(getExchangeFileName())) {
setExchangeFileName(rootDirectory.getName());
}
@@ -98,9 +91,6 @@ final class ExportController implements IExchangeTaskListener {
if (userMaxTx == Long.MIN_VALUE || userMaxTx > maxTx) {
options.put(ExportOptions.MAX_TXS.name(), Long.toString(maxTx));
}
-
- //ServerThreads.createNewThreadFactory("branch.export.worker")
- executorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
}
protected void handleTxWork() throws OseeCoreException {
@@ -125,33 +115,35 @@ final class ExportController implements IExchangeTaskListener {
} finally {
cleanUp(taskList);
}
- OseeLog.logf(this.getClass(), Level.INFO, "Exported [%s] branch%s in [%s]", branchIds.size(),
+ oseeServices.getLogger().info("Exported [%s] branch%s in [%s]", branchIds.size(),
branchIds.size() != 1 ? "es" : "", Lib.getElapseString(startTime));
}
private void finishExport(File tempFolder) throws IllegalArgumentException, IOException {
String zipTargetName = getExchangeFileName() + ZIP_EXTENSION;
if (options.getBoolean(ExportOptions.COMPRESS.name())) {
- OseeLog.logf(this.getClass(), Level.INFO, "Compressing Branch Export Data - [%s]", zipTargetName);
+ oseeServices.getLogger().info("Compressing Branch Export Data - [%s]", zipTargetName);
File zipTarget = new File(tempFolder.getParent(), zipTargetName);
Lib.compressDirectory(tempFolder, zipTarget.getAbsolutePath(), true);
- OseeLog.logf(this.getClass(), Level.INFO, "Deleting Branch Export Temp Folder - [%s]", tempFolder);
+ oseeServices.getLogger().info("Deleting Branch Export Temp Folder - [%s]", tempFolder);
Lib.deleteDir(tempFolder);
} else {
File target = new File(tempFolder.getParent(), getExchangeFileName());
if (!target.equals(tempFolder)) {
if (!tempFolder.renameTo(target)) {
- OseeLog.logf(this.getClass(), Level.INFO, "Unable to move [%s] to [%s]", tempFolder.getAbsolutePath(),
+ oseeServices.getLogger().info("Unable to move [%s] to [%s]", tempFolder.getAbsolutePath(),
target.getAbsolutePath());
}
}
}
}
- private void sendTasksToExecutor(List<AbstractExportItem> taskList, final File exportFolder) throws InterruptedException, ExecutionException, OseeCoreException {
+ private void sendTasksToExecutor(List<AbstractExportItem> taskList, final File exportFolder) throws Exception {
List<Future<?>> futures = new ArrayList<Future<?>>();
+
+ ExecutorAdmin executor = oseeServices.getExecutorAdmin();
for (AbstractExportItem exportItem : taskList) {
- futures.add(this.executorService.submit(exportItem));
+ futures.add(executor.schedule("branch.export.worker", exportItem));
}
for (Future<?> future : futures) {
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/ForeignKeyReader.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/ForeignKeyReader.java
index dda928df163..c70aac9e4ab 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/ForeignKeyReader.java
+++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/ForeignKeyReader.java
@@ -14,6 +14,7 @@ import java.util.Map;
import org.eclipse.osee.framework.branch.management.exchange.handler.BaseDbSaxHandler;
import org.eclipse.osee.framework.branch.management.exchange.handler.IExportItem;
import org.eclipse.osee.framework.database.IOseeDatabaseService;
+import org.eclipse.osee.logger.Log;
/**
* @author Ryan D. Brooks
@@ -23,8 +24,8 @@ public class ForeignKeyReader extends BaseDbSaxHandler {
private final PrimaryKeyCollector primaryKeyCollector;
private final IExportItem foreignTable;
- public ForeignKeyReader(IOseeDatabaseService service, PrimaryKeyCollector primaryKeyCollector, IExportItem foreignTable, String... foreignKeys) {
- super(service, true, 0);
+ public ForeignKeyReader(Log logger, IOseeDatabaseService service, PrimaryKeyCollector primaryKeyCollector, IExportItem foreignTable, String... foreignKeys) {
+ super(logger, service, true, 0);
this.primaryKeyCollector = primaryKeyCollector;
this.foreignKeys = foreignKeys;
this.foreignTable = foreignTable;
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/IOseeExchangeDataProvider.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/IOseeExchangeDataProvider.java
index 6d4b68b345b..8f94a68325e 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/IOseeExchangeDataProvider.java
+++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/IOseeExchangeDataProvider.java
@@ -12,6 +12,7 @@ package org.eclipse.osee.framework.branch.management.exchange;
import java.io.File;
import org.eclipse.osee.framework.branch.management.exchange.handler.IExportItem;
+import org.eclipse.osee.logger.Log;
/**
* @author Ryan D. Brooks
@@ -25,4 +26,8 @@ public interface IOseeExchangeDataProvider {
public File getFile(IExportItem item);
public File getFile(String fileName);
+
+ public Log getLogger();
+
+ public String getExchangeBasePath();
}
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/ImportController.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/ImportController.java
index 2a7a57ab43f..85b013f5387 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/ImportController.java
+++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/ImportController.java
@@ -19,7 +19,6 @@ import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-import java.util.logging.Level;
import org.eclipse.osee.framework.branch.management.ImportOptions;
import org.eclipse.osee.framework.branch.management.exchange.handler.BaseDbSaxHandler;
import org.eclipse.osee.framework.branch.management.exchange.handler.BranchDataSaxHandler;
@@ -34,7 +33,6 @@ import org.eclipse.osee.framework.branch.management.exchange.transform.ExchangeD
import org.eclipse.osee.framework.branch.management.exchange.transform.ExchangeTransformProvider;
import org.eclipse.osee.framework.branch.management.exchange.transform.ExchangeTransformer;
import org.eclipse.osee.framework.branch.management.exchange.transform.IExchangeTransformProvider;
-import org.eclipse.osee.framework.branch.management.internal.Activator;
import org.eclipse.osee.framework.core.exception.OseeArgumentException;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeExceptions;
@@ -46,7 +44,6 @@ import org.eclipse.osee.framework.database.core.IOseeStatement;
import org.eclipse.osee.framework.database.core.OseeConnection;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.logging.OseeLog;
/**
* @author Roberto E. Escobar
@@ -130,7 +127,7 @@ public final class ImportController {
CommitImportSavePointsTx saveImportState = new CommitImportSavePointsTx();
saveImportState.execute();
} catch (OseeCoreException ex) {
- OseeLog.log(this.getClass(), Level.WARNING,
+ oseeServices.getLogger().warn(ex,
"Error during save point save - you will not be able to reimport from last source again.");
throw ex;
} finally {
@@ -172,7 +169,7 @@ public final class ImportController {
addSavePoint(currentSavePoint);
} catch (Throwable ex) {
reportError(currentSavePoint, ex);
- OseeLog.log(Activator.class, Level.SEVERE, ex);
+ oseeServices.getLogger().error(ex, "Error importing");
} finally {
cleanup();
}
@@ -189,7 +186,7 @@ public final class ImportController {
initializeHandler(handler, metadata);
boolean cleanDataTable = options.getBoolean(ImportOptions.CLEAN_BEFORE_IMPORT.name());
cleanDataTable &= !doesSavePointExist(currentSavePoint);
- OseeLog.logf(this.getClass(), Level.INFO, "Importing: [%s] %s Meta: %s", exportItem.getSource(),
+ oseeServices.getLogger().info("Importing: [%s] %s Meta: %s", exportItem.getSource(),
cleanDataTable ? "clean before import" : "", metadata.getColumnNames());
if (cleanDataTable) {
handler.clearDataTable();
@@ -214,11 +211,11 @@ public final class ImportController {
private void processImportFiles(Collection<IExportItem> importItems) throws Exception {
final DbTableSaxHandler handler =
- DbTableSaxHandler.createWithLimitedCache(oseeServices, exportDataProvider, 50000);
+ DbTableSaxHandler.createWithLimitedCache(oseeServices.getLogger(), oseeServices, exportDataProvider, 50000);
handler.setSelectedBranchIds(branchesToImport);
for (final IExportItem item : importItems) {
- OseeLog.logf(Activator.class, Level.INFO, "starting import for [%s]", item);
+ oseeServices.getLogger().info("starting import for [%s]", item);
currentSavePoint = item.getSource();
handler.setExportItem(item);
if (!doesSavePointExist(currentSavePoint)) {
@@ -227,7 +224,7 @@ public final class ImportController {
handler.reset();
addSavePoint(currentSavePoint);
} else {
- OseeLog.logf(Activator.class, Level.INFO, "Save point found for: [%s] - skipping", item.getSource());
+ oseeServices.getLogger().info("Save point found for: [%s] - skipping", item.getSource());
}
}
}
@@ -282,7 +279,8 @@ public final class ImportController {
public ImportBranchesTx() {
super();
- branchHandler = BranchDataSaxHandler.createWithCacheAll(oseeServices.getDatabaseService());
+ branchHandler =
+ BranchDataSaxHandler.createWithCacheAll(oseeServices.getLogger(), oseeServices.getDatabaseService());
branchesStored = new int[0];
}
@@ -292,7 +290,7 @@ public final class ImportController {
branchHandler.updateBaselineAndParentTransactionId(branchesStored);
addSavePoint(currentSavePoint);
} else {
- OseeLog.logf(this.getClass(), Level.INFO, "Save point found for: [%s] - skipping", currentSavePoint);
+ oseeServices.getLogger().info("Save point found for: [%s] - skipping", currentSavePoint);
}
}
@@ -308,7 +306,7 @@ public final class ImportController {
addSavePoint(currentSavePoint);
} else {
// This step has already been performed - only get branches needed for remaining operations
- OseeLog.logf(this.getClass(), Level.INFO, "Save point found for: [%s] - skipping", currentSavePoint);
+ oseeServices.getLogger().info("Save point found for: [%s] - skipping", currentSavePoint);
branchesStored = branchHandler.store(connection, false, branchesToImport);
}
}
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/OseeServices.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/OseeServices.java
index 89e7362cbc3..f76824f7de0 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/OseeServices.java
+++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/OseeServices.java
@@ -1,5 +1,5 @@
-/*******************************************************************************
- * Copyright (c) 2010 Boeing.
+/****************u***************************************************************
+ * Copyright (c) 2ll010 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
@@ -10,30 +10,49 @@
*******************************************************************************/
package org.eclipse.osee.framework.branch.management.exchange;
+import org.eclipse.osee.executor.admin.ExecutorAdmin;
+import org.eclipse.osee.framework.branch.management.exchange.resource.ExchangeProvider;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.services.IOseeCachingService;
import org.eclipse.osee.framework.core.services.IOseeModelingService;
import org.eclipse.osee.framework.core.services.IdentityService;
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.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.core.SystemPreferences;
public class OseeServices {
- private final IResourceManager resourceService;
- private final IResourceLocatorManager locatorSservice;
- private final IOseeCachingService cachingService;
- private final IOseeModelingService modelService;
- private final IOseeDatabaseService databaseService;
- private final IdentityService identityService;
+ private Log logger;
+ private SystemPreferences systemPreferences;
+ private IResourceManager resourceService;
+ private IResourceLocatorManager locatorService;
+ private IOseeCachingService cachingService;
+ private IOseeModelingService modelService;
+ private IOseeDatabaseService databaseService;
+ private IdentityService identityService;
+ private ExecutorAdmin executorAdmin;
+ private volatile boolean isReady;
- public OseeServices(IResourceManager resourceService, IResourceLocatorManager locatorSservice, IOseeCachingService cachingService, IOseeModelingService modelService, IOseeDatabaseService databaseService, IdentityService identityService) {
+ public OseeServices() {
super();
- this.resourceService = resourceService;
- this.locatorSservice = locatorSservice;
- this.cachingService = cachingService;
- this.modelService = modelService;
- this.databaseService = databaseService;
- this.identityService = identityService;
+ }
+
+ public boolean isReady() {
+ return isReady;
+ }
+
+ public synchronized void setIsReady(boolean isReady) {
+ this.isReady = isReady;
+ }
+
+ public Log getLogger() {
+ return logger;
+ }
+
+ public String getExchangeBasePath() throws OseeCoreException {
+ return ExchangeProvider.getExchangeDataPath(systemPreferences);
}
public IResourceManager getResourceManager() {
@@ -41,7 +60,7 @@ public class OseeServices {
}
public IResourceLocatorManager getResourceLocatorManager() {
- return locatorSservice;
+ return locatorService;
}
public IOseeCachingService getCachingService() {
@@ -59,4 +78,58 @@ public class OseeServices {
public IdentityService getIdentityService() {
return identityService;
}
+
+ public ExecutorAdmin getExecutorAdmin() {
+ return executorAdmin;
+ }
+
+ public void setLogger(Log logger) {
+ this.logger = logger;
+ }
+
+ public void setResourceService(IResourceManager resourceService) {
+ this.resourceService = resourceService;
+ }
+
+ public void setLocatorService(IResourceLocatorManager locatorService) {
+ this.locatorService = locatorService;
+ }
+
+ public void setCachingService(IOseeCachingService cachingService) {
+ this.cachingService = cachingService;
+ }
+
+ public void setModelService(IOseeModelingService modelService) {
+ this.modelService = modelService;
+ }
+
+ public void setDatabaseService(IOseeDatabaseService databaseService) {
+ this.databaseService = databaseService;
+ }
+
+ public void setIdentityService(IdentityService identityService) {
+ this.identityService = identityService;
+ }
+
+ public void setExecutorAdmin(ExecutorAdmin executorAdmin) {
+ this.executorAdmin = executorAdmin;
+ }
+
+ public void setSystemPreferences(SystemPreferences systemPreferences) {
+ this.systemPreferences = systemPreferences;
+ }
+
+ public void clear() {
+ setIsReady(false);
+ setLogger(null);
+ setSystemPreferences(null);
+ setResourceService(null);
+ setLocatorService(null);
+ setCachingService(null);
+ setModelService(null);
+ setDatabaseService(null);
+ setIdentityService(null);
+ setExecutorAdmin(null);
+ }
+
}
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/PrimaryKeyCollector.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/PrimaryKeyCollector.java
index bfe8dbdba50..5aa783f61a6 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/PrimaryKeyCollector.java
+++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/PrimaryKeyCollector.java
@@ -18,6 +18,7 @@ import java.util.Set;
import org.eclipse.osee.framework.branch.management.exchange.handler.BaseDbSaxHandler;
import org.eclipse.osee.framework.database.IOseeDatabaseService;
import org.eclipse.osee.framework.jdk.core.type.HashCollection;
+import org.eclipse.osee.logger.Log;
/**
* @author Ryan D. Brooks
@@ -31,8 +32,8 @@ public class PrimaryKeyCollector extends BaseDbSaxHandler {
this.primaryKey = primaryKey;
}
- public PrimaryKeyCollector(IOseeDatabaseService service) {
- super(service, true, 0);
+ public PrimaryKeyCollector(Log logger, IOseeDatabaseService service) {
+ super(logger, service, true, 0);
}
@Override
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/ReferentialIntegrityConstraint.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/ReferentialIntegrityConstraint.java
index 7abf1eb5c36..774d5ea29ec 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/ReferentialIntegrityConstraint.java
+++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/ReferentialIntegrityConstraint.java
@@ -20,6 +20,7 @@ import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.database.IOseeDatabaseService;
import org.eclipse.osee.framework.jdk.core.type.HashCollection;
import org.eclipse.osee.framework.jdk.core.util.Collections;
+import org.eclipse.osee.logger.Log;
/**
* @author Ryan D. Brooks
@@ -87,15 +88,16 @@ public class ReferentialIntegrityConstraint {
return collector.getUnreferencedPrimaryKeys();
}
- public void checkConstraint(IOseeDatabaseService service, ExchangeDataProcessor processor) throws OseeCoreException {
- collector = new PrimaryKeyCollector(service);
+ public void checkConstraint(Log logger, IOseeDatabaseService service, ExchangeDataProcessor processor) throws OseeCoreException {
+ collector = new PrimaryKeyCollector(logger, service);
for (IExportItem primaryTable : getPrimaryItems()) {
collector.setPrimaryKey(getPrimaryKey());
processor.parse(primaryTable, collector);
}
for (IExportItem foreignTable : getForeignItems()) {
- ForeignKeyReader foreignKeyReader = new ForeignKeyReader(service, collector, foreignTable, getForeignKeys());
+ ForeignKeyReader foreignKeyReader =
+ new ForeignKeyReader(logger, service, collector, foreignTable, getForeignKeys());
processor.parse(foreignTable, foreignKeyReader);
}
}
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/export/AbstractExportItem.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/export/AbstractExportItem.java
index 150b1726124..466a8be3775 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/export/AbstractExportItem.java
+++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/export/AbstractExportItem.java
@@ -14,13 +14,14 @@ import java.io.File;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
+import java.util.concurrent.Callable;
import org.eclipse.osee.framework.branch.management.IExchangeTaskListener;
import org.eclipse.osee.framework.branch.management.exchange.handler.ExportItem;
/**
* @author Roberto E. Escobar
*/
-public abstract class AbstractExportItem implements Runnable {
+public abstract class AbstractExportItem implements Callable<Boolean> {
private final ExportItem id;
private final String fileName;
private final Set<IExchangeTaskListener> exportListeners;
@@ -81,17 +82,21 @@ public abstract class AbstractExportItem implements Runnable {
}
@Override
- public final void run() {
+ public final Boolean call() throws Exception {
+ boolean wasSuccessful = false;
long startTime = System.currentTimeMillis();
try {
if (!isCancel()) {
executeWork();
}
+ wasSuccessful = true;
} catch (Exception ex) {
notifyOnExportException(ex);
+ throw ex;
} finally {
notifyOnExportItemCompleted(System.currentTimeMillis() - startTime);
}
+ return wasSuccessful;
}
protected void notifyOnExportException(Throwable ex) {
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/export/DbTableExportItem.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/export/DbTableExportItem.java
index 139a844e3e6..a84063214ae 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/export/DbTableExportItem.java
+++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/export/DbTableExportItem.java
@@ -19,11 +19,9 @@ import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Timestamp;
-import java.util.logging.Level;
import org.eclipse.osee.framework.branch.management.exchange.ExportImportXml;
import org.eclipse.osee.framework.branch.management.exchange.OseeServices;
import org.eclipse.osee.framework.branch.management.exchange.handler.ExportItem;
-import org.eclipse.osee.framework.branch.management.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.cache.AbstractOseeCache;
@@ -34,7 +32,6 @@ import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.jdk.core.util.xml.Xml;
-import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.resource.management.IResource;
import org.eclipse.osee.framework.resource.management.IResourceLocator;
@@ -184,7 +181,7 @@ public class DbTableExportItem extends AbstractXmlExportItem {
} catch (NoSuchMethodException ex) {
// Do Nothing
} catch (Exception ex) {
- OseeLog.log(Activator.class, Level.WARNING, ex);
+ services.getLogger().warn(ex, "Error converting [%s] to timestamp", value);
}
}
return toReturn;
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/handler/BaseDbSaxHandler.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/handler/BaseDbSaxHandler.java
index 1e852259892..442e415e84f 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/handler/BaseDbSaxHandler.java
+++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/handler/BaseDbSaxHandler.java
@@ -15,15 +15,13 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
-import java.util.logging.Level;
import org.eclipse.osee.framework.branch.management.exchange.TranslationManager;
-import org.eclipse.osee.framework.branch.management.internal.Activator;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.database.IOseeDatabaseService;
import org.eclipse.osee.framework.database.core.OseeConnection;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.logger.Log;
/**
* @author Roberto E. Escobar
@@ -38,13 +36,15 @@ public abstract class BaseDbSaxHandler extends BaseExportImportSaxHandler {
private TranslationManager translator;
private PropertyStore options;
private final IOseeDatabaseService service;
+ private final Log logger;
- protected BaseDbSaxHandler(IOseeDatabaseService service, boolean isCacheAll, int cacheLimit) {
+ protected BaseDbSaxHandler(Log logger, IOseeDatabaseService service, boolean isCacheAll, int cacheLimit) {
super();
if (cacheLimit < 0) {
throw new IllegalArgumentException(String.format("Cache limit cannot be less than zero - cacheLimit=[%d]",
cacheLimit));
}
+ this.logger = logger;
this.service = service;
this.options = new PropertyStore();
this.translator = null;
@@ -54,6 +54,10 @@ public abstract class BaseDbSaxHandler extends BaseExportImportSaxHandler {
this.data = new ArrayList<Object[]>();
}
+ protected Log getLogger() {
+ return logger;
+ }
+
public void setOptions(PropertyStore options) {
if (options != null) {
this.options = options;
@@ -115,7 +119,7 @@ public abstract class BaseDbSaxHandler extends BaseExportImportSaxHandler {
}
}
} catch (SQLException ex1) {
- OseeLog.log(Activator.class, Level.INFO, ex1);
+ logger.info(ex1, "Error determining truncate support");
} finally {
if (resultSet != null) {
try {
@@ -137,7 +141,7 @@ public abstract class BaseDbSaxHandler extends BaseExportImportSaxHandler {
try {
getDatabaseService().runPreparedUpdate(deleteSql);
} catch (OseeCoreException ex) {
- OseeLog.logf(Activator.class, Level.INFO, ex, "Error clearing: %s", deleteSql);
+ logger.info(ex, "Error clearing: %s", deleteSql);
throw ex;
}
}
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/handler/BaseExportImportSaxHandler.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/handler/BaseExportImportSaxHandler.java
index c0bfc51110a..cc9702038cf 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/handler/BaseExportImportSaxHandler.java
+++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/handler/BaseExportImportSaxHandler.java
@@ -68,6 +68,7 @@ public abstract class BaseExportImportSaxHandler extends AbstractSaxHandler {
}
protected void finishData() {
+ //
}
private void handleEntry(Attributes attributes) {
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/handler/BranchDataSaxHandler.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/handler/BranchDataSaxHandler.java
index f502af752a5..e845a8f9a4b 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/handler/BranchDataSaxHandler.java
+++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/handler/BranchDataSaxHandler.java
@@ -18,7 +18,6 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.logging.Level;
import org.eclipse.osee.framework.branch.management.ImportOptions;
import org.eclipse.osee.framework.branch.management.exchange.ExchangeDb;
import org.eclipse.osee.framework.core.enums.BranchType;
@@ -30,7 +29,7 @@ import org.eclipse.osee.framework.database.IOseeDatabaseService;
import org.eclipse.osee.framework.database.core.IOseeStatement;
import org.eclipse.osee.framework.database.core.OseeConnection;
import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.logger.Log;
/**
* @author Roberto E. Escobar
@@ -40,16 +39,16 @@ public class BranchDataSaxHandler extends BaseDbSaxHandler {
private final Map<Integer, BranchData> idToImportFileBranchData;
private OseeConnection connection;
- public static BranchDataSaxHandler createWithCacheAll(IOseeDatabaseService service) {
- return new BranchDataSaxHandler(service, true, 0);
+ public static BranchDataSaxHandler createWithCacheAll(Log logger, IOseeDatabaseService service) {
+ return new BranchDataSaxHandler(logger, service, true, 0);
}
- public static BranchDataSaxHandler newLimitedCacheBranchDataSaxHandler(IOseeDatabaseService service, int cacheLimit) {
- return new BranchDataSaxHandler(service, false, cacheLimit);
+ public static BranchDataSaxHandler newLimitedCacheBranchDataSaxHandler(Log logger, IOseeDatabaseService service, int cacheLimit) {
+ return new BranchDataSaxHandler(logger, service, false, cacheLimit);
}
- private BranchDataSaxHandler(IOseeDatabaseService service, boolean isCacheAll, int cacheLimit) {
- super(service, isCacheAll, cacheLimit);
+ private BranchDataSaxHandler(Log logger, IOseeDatabaseService service, boolean isCacheAll, int cacheLimit) {
+ super(logger, service, isCacheAll, cacheLimit);
this.idToImportFileBranchData = new HashMap<Integer, BranchData>();
this.connection = null;
}
@@ -171,12 +170,10 @@ public class BranchDataSaxHandler extends BaseDbSaxHandler {
String query =
"update osee_branch set parent_transaction_id = ?, baseline_transaction_id = ? where branch_id = ?";
int updateCount = getDatabaseService().runBatchUpdate(query, data);
- OseeLog.logf(this.getClass(), Level.INFO,
- "Updated [%s] baseline and parent transaction id info on branches [%s]", updateCount,
+ getLogger().info("Updated [%s] baseline and parent transaction id info on branches [%s]", updateCount,
Arrays.toString(branchesStored));
} else {
- OseeLog.logf(this.getClass(), Level.INFO,
- "No branches found to update baseline and parent txs: branches - [%s] - skipping",
+ getLogger().info("No branches found to update baseline and parent txs: branches - [%s] - skipping",
Arrays.toString(branchesStored));
}
}
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/handler/DbTableSaxHandler.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/handler/DbTableSaxHandler.java
index 790614d39b7..a3a87064293 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/handler/DbTableSaxHandler.java
+++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/handler/DbTableSaxHandler.java
@@ -16,13 +16,11 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.logging.Level;
import org.eclipse.osee.framework.branch.management.exchange.ExchangeDb;
import org.eclipse.osee.framework.branch.management.exchange.ExportImportXml;
import org.eclipse.osee.framework.branch.management.exchange.IOseeExchangeDataProvider;
import org.eclipse.osee.framework.branch.management.exchange.OseeServices;
import org.eclipse.osee.framework.branch.management.exchange.resource.ZipBinaryResource;
-import org.eclipse.osee.framework.branch.management.internal.Activator;
import org.eclipse.osee.framework.core.enums.ConflictType;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeStateException;
@@ -32,17 +30,17 @@ import org.eclipse.osee.framework.core.util.HexUtil;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.resource.management.IResourceLocator;
import org.eclipse.osee.framework.resource.management.IResourceManager;
+import org.eclipse.osee.logger.Log;
/**
* @author Roberto E. Escobar
*/
public class DbTableSaxHandler extends BaseDbSaxHandler {
- public static DbTableSaxHandler createWithLimitedCache(OseeServices services, IOseeExchangeDataProvider exportDataProvider, int cacheLimit) {
- return new DbTableSaxHandler(services, exportDataProvider, false, cacheLimit);
+ public static DbTableSaxHandler createWithLimitedCache(Log logger, OseeServices services, IOseeExchangeDataProvider exportDataProvider, int cacheLimit) {
+ return new DbTableSaxHandler(logger, services, exportDataProvider, false, cacheLimit);
}
private final List<IResourceLocator> transferredBinaryContent;
@@ -51,8 +49,8 @@ public class DbTableSaxHandler extends BaseDbSaxHandler {
private final OseeServices services;
private IExportItem exportItem;
- protected DbTableSaxHandler(OseeServices services, IOseeExchangeDataProvider exportDataProvider, boolean isCacheAll, int cacheLimit) {
- super(services.getDatabaseService(), isCacheAll, cacheLimit);
+ protected DbTableSaxHandler(Log logger, OseeServices services, IOseeExchangeDataProvider exportDataProvider, boolean isCacheAll, int cacheLimit) {
+ super(logger, services.getDatabaseService(), isCacheAll, cacheLimit);
this.branchesToImport = new HashSet<Integer>();
this.transferredBinaryContent = new ArrayList<IResourceLocator>();
this.exportDataProvider = exportDataProvider;
@@ -180,7 +178,7 @@ public class DbTableSaxHandler extends BaseDbSaxHandler {
}
} catch (OseeCoreException ex) {
cleanUpBinaryContent();
- OseeLog.logf(Activator.class, Level.SEVERE, ex, "Error processing in [%s]", getMetaData().getTableName());
+ services.getLogger().error(ex, "Error processing in [%s]", getMetaData().getTableName());
throw ex;
}
}
@@ -203,10 +201,9 @@ public class DbTableSaxHandler extends BaseDbSaxHandler {
}
}
if (errorMessage.length() > 0) {
- OseeLog.log(
- this.getClass(),
- Level.SEVERE,
- "Error deleting binary data after transfer error. Please delete all content manually. " + errorMessage.toString());
+ services.getLogger().error(
+ "Error deleting binary data after transfer error. Please delete all content manually. [%s]",
+ errorMessage.toString());
}
}
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/handler/ImportOseeModelHandler.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/handler/ImportOseeModelHandler.java
index e098ca4ee95..21a95a9e0b8 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/handler/ImportOseeModelHandler.java
+++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/handler/ImportOseeModelHandler.java
@@ -11,7 +11,6 @@ import java.io.InputStream;
import java.net.URI;
import java.net.URL;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.branch.management.internal.Activator;
import org.eclipse.osee.framework.core.model.OseeImportModelRequest;
import org.eclipse.osee.framework.core.model.OseeImportModelResponse;
import org.eclipse.osee.framework.core.operation.AbstractOperation;
@@ -25,7 +24,7 @@ public class ImportOseeModelHandler extends AbstractOperation {
private final URI model;
public ImportOseeModelHandler(IOseeModelingService modelingService, OperationLogger logger, URI model) {
- super("Import Exchange Type Model", Activator.PLUGIN_ID, logger);
+ super("Import Exchange Type Model", "pluginId", logger);
this.modelingService = modelingService;
this.model = model;
}
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/handler/StandardOseeDbExportDataProvider.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/handler/StandardOseeDbExportDataProvider.java
index 1ae346d9674..a0b1ab4f85e 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/handler/StandardOseeDbExportDataProvider.java
+++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/handler/StandardOseeDbExportDataProvider.java
@@ -13,6 +13,7 @@ package org.eclipse.osee.framework.branch.management.exchange.handler;
import java.io.File;
import org.eclipse.osee.framework.branch.management.exchange.IOseeExchangeDataProvider;
+import org.eclipse.osee.logger.Log;
/**
* @author Ryan D. Brooks
@@ -20,8 +21,12 @@ import org.eclipse.osee.framework.branch.management.exchange.IOseeExchangeDataPr
public class StandardOseeDbExportDataProvider implements IOseeExchangeDataProvider {
private final File exportDataRootPath;
private final boolean wasZipExtractionRequired;
+ private final Log logger;
+ private final String exchangeBasePath;
- public StandardOseeDbExportDataProvider(File exportDataRootPath, boolean wasZipExtractionRequired) {
+ public StandardOseeDbExportDataProvider(String exchangeBasePath, Log logger, File exportDataRootPath, boolean wasZipExtractionRequired) {
+ this.exchangeBasePath = exchangeBasePath;
+ this.logger = logger;
this.wasZipExtractionRequired = wasZipExtractionRequired;
this.exportDataRootPath = exportDataRootPath;
@@ -46,4 +51,15 @@ public class StandardOseeDbExportDataProvider implements IOseeExchangeDataProvid
public File getExportedDataRoot() {
return exportDataRootPath;
}
+
+ @Override
+ public Log getLogger() {
+ return logger;
+ }
+
+ @Override
+ public String getExchangeBasePath() {
+ return exchangeBasePath;
+ }
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/resource/ExchangeProvider.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/resource/ExchangeProvider.java
index d5f2d48af0c..90240c98007 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/resource/ExchangeProvider.java
+++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/resource/ExchangeProvider.java
@@ -22,7 +22,7 @@ import java.util.Collection;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeExceptions;
import org.eclipse.osee.framework.core.exception.OseeStateException;
-import org.eclipse.osee.framework.core.server.OseeServerProperties;
+import org.eclipse.osee.framework.core.util.Conditions;
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;
@@ -31,20 +31,64 @@ import org.eclipse.osee.framework.resource.management.IResourceManager;
import org.eclipse.osee.framework.resource.management.IResourceProvider;
import org.eclipse.osee.framework.resource.management.exception.MalformedLocatorException;
import org.eclipse.osee.framework.resource.management.util.OptionsProcessor;
+import org.eclipse.osee.orcs.core.SystemPreferences;
/**
* @author Roberto E. Escobar
*/
public class ExchangeProvider implements IResourceProvider {
- private static final String BASE_PATH = OseeServerProperties.getOseeApplicationServerData(null);
- private static final String RESOLVED_PATH =
- BASE_PATH + File.separator + ExchangeLocatorProvider.PROTOCOL + File.separator;
+
+ private String binaryDataPath;
+ private String exchangeDataPath;
+ private SystemPreferences preferences;
+ private boolean isInitialized;
public ExchangeProvider() {
+ super();
+ isInitialized = false;
+ }
+
+ public void setSystemPreferences(SystemPreferences preferences) {
+ this.preferences = preferences;
+ }
+
+ public static String getBinaryDataPath(SystemPreferences preferences) throws OseeCoreException {
+ return preferences.getValue("osee.application.server.data");
+ }
+
+ public static String getExchangeDataPath(SystemPreferences preferences) throws OseeCoreException {
+ String binaryDataPath = preferences.getValue("osee.application.server.data");
+ return binaryDataPath + File.separator + ExchangeLocatorProvider.PROTOCOL + File.separator;
+ }
+
+ public void start() throws OseeCoreException {
+ // TODO: Use Constants
+ binaryDataPath = getBinaryDataPath(preferences);
+ exchangeDataPath = getExchangeDataPath(preferences);
+ isInitialized = true;
+ }
+
+ public void stop() {
+ binaryDataPath = null;
+ exchangeDataPath = null;
+ isInitialized = false;
+ }
+
+ private void ensureInitialized() throws OseeCoreException {
+ Conditions.checkExpressionFailOnTrue(!isInitialized,
+ "Exchange Data Path - not initialized - ensure start() was called");
+ Conditions.checkNotNull(binaryDataPath, "exchange data path");
+ Conditions.checkNotNull(exchangeDataPath, "exchange data path");
+ }
+
+ public String getExchangeDataPath() throws OseeCoreException {
+ ensureInitialized();
+ return exchangeDataPath;
}
- public static String getExchangeFilePath() {
- return RESOLVED_PATH;
+ public String getBinaryDataPath() throws OseeCoreException {
+ ensureInitialized();
+ return binaryDataPath;
}
private URI resolve(IResourceLocator locator) throws OseeCoreException {
@@ -52,7 +96,7 @@ public class ExchangeProvider implements IResourceProvider {
StringBuilder builder = new StringBuilder();
String rawPath = locator.getRawPath();
if (!rawPath.startsWith("file:/")) {
- builder.append(RESOLVED_PATH);
+ builder.append(getExchangeDataPath());
builder.append(rawPath);
File file = new File(builder.toString());
toReturn = file.toURI();
@@ -82,7 +126,7 @@ public class ExchangeProvider implements IResourceProvider {
if (file.exists() != true) {
toReturn = IResourceManager.RESOURCE_NOT_FOUND;
} else if (file.exists() == true && file.canWrite() == true) {
- boolean result = Lib.deleteFileAndEmptyParents(BASE_PATH, file);
+ boolean result = Lib.deleteFileAndEmptyParents(getBinaryDataPath(), file);
if (result) {
toReturn = IResourceManager.OK;
}
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/ExchangeDataProcessor.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/ExchangeDataProcessor.java
index ae67acf5dfb..7ceffd5bc61 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/ExchangeDataProcessor.java
+++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/ExchangeDataProcessor.java
@@ -126,6 +126,7 @@ public final class ExchangeDataProcessor {
}
public void cleanUp() {
- ExchangeUtil.cleanUpTempExchangeFile(dataProvider.getExportedDataRoot(), dataProvider.wasZipExtractionRequired());
+ ExchangeUtil.cleanUpTempExchangeFile(dataProvider.getExchangeBasePath(), dataProvider.getLogger(),
+ dataProvider.getExportedDataRoot(), dataProvider.wasZipExtractionRequired());
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_8_3Transformer.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_8_3Transformer.java
index 27877e862e0..03873ba0f97 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_8_3Transformer.java
+++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_8_3Transformer.java
@@ -42,6 +42,7 @@ public class V0_8_3Transformer implements IOseeExchangeVersionTransformer {
@Override
public void finalizeTransform(ExchangeDataProcessor ruleProcessor, OperationLogger logger) {
+ //
}
@Override
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_9_0Transformer.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_9_0Transformer.java
index 685f40c8e0f..6721e1f9d57 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_9_0Transformer.java
+++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_9_0Transformer.java
@@ -54,6 +54,7 @@ public class V0_9_0Transformer implements IOseeExchangeVersionTransformer {
return MAX_VERSION;
}
+ @SuppressWarnings("rawtypes")
private void replaceDataTypeIdsWithGuids(ExchangeDataProcessor processor, AbstractOseeCache cache, ExportItem exportItem, String typeIdColumn, String typeNameColumn) throws OseeCoreException {
V0_9_0TypeHandler typeHandler = new V0_9_0TypeHandler(cache, typeIdColumn, typeNameColumn);
processor.parse(exportItem + ".type.xml", typeHandler);
@@ -64,6 +65,7 @@ public class V0_9_0Transformer implements IOseeExchangeVersionTransformer {
@Override
public void finalizeTransform(ExchangeDataProcessor processor, OperationLogger logger) {
+ //
}
@Override
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_9_0TxDetailsHandler.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_9_0TxDetailsHandler.java
index f0a0a5bf7d6..cd53192362a 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_9_0TxDetailsHandler.java
+++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_9_0TxDetailsHandler.java
@@ -22,6 +22,7 @@ public class V0_9_0TxDetailsHandler extends AbstractSaxHandler {
@Override
public void endElementFound(String uri, String localName, String qName) {
+ //
}
@Override
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_9_0TypeHandler.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_9_0TypeHandler.java
index 46c3c26e731..7c5a6d1ffb1 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_9_0TypeHandler.java
+++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_9_0TypeHandler.java
@@ -33,6 +33,7 @@ public class V0_9_0TypeHandler extends AbstractSaxHandler {
@Override
public void endElementFound(String uri, String localName, String qName) {
+ //
}
@Override
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_9_2ArtifactVersionHandler.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_9_2ArtifactVersionHandler.java
index 179a6dc7df3..29e956e288e 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_9_2ArtifactVersionHandler.java
+++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_9_2ArtifactVersionHandler.java
@@ -25,6 +25,7 @@ public class V0_9_2ArtifactVersionHandler extends AbstractSaxHandler {
@Override
public void endElementFound(String uri, String localName, String qName) {
+ //
}
public Map<Long, Long> getArtifactGammaToNetGammaId() {
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_9_2TxDetailsHandler.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_9_2TxDetailsHandler.java
index c27d4c14bac..44235393c3b 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_9_2TxDetailsHandler.java
+++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_9_2TxDetailsHandler.java
@@ -27,6 +27,7 @@ public class V0_9_2TxDetailsHandler extends AbstractSaxHandler {
@Override
public void endElementFound(String uri, String localName, String qName) {
+ //
}
@Override
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_9_4Transformer.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_9_4Transformer.java
index 44bed633d6c..af7bbf633ee 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_9_4Transformer.java
+++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_9_4Transformer.java
@@ -31,5 +31,6 @@ public class V0_9_4Transformer implements IOseeExchangeVersionTransformer {
@Override
public void finalizeTransform(ExchangeDataProcessor processor, OperationLogger logger) {
+ //
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/internal/Activator.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/internal/Activator.java
deleted file mode 100644
index e8876b258b2..00000000000
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/internal/Activator.java
+++ /dev/null
@@ -1,48 +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.branch.management.internal;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.osee.framework.branch.management.internal.trackers.OseeBranchExchangeServiceRegistrationHandler;
-import org.eclipse.osee.framework.branch.management.internal.trackers.OseeBranchServiceRegistrationHandler;
-import org.eclipse.osee.framework.core.util.ServiceDependencyTracker;
-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.branch.management";
-
- private final List<ServiceDependencyTracker> services;
-
- public Activator() {
- this.services = new ArrayList<ServiceDependencyTracker>();
- }
-
- @Override
- public void start(BundleContext context) throws Exception {
- services.add(new ServiceDependencyTracker(context, new OseeBranchServiceRegistrationHandler()));
- services.add(new ServiceDependencyTracker(context, new OseeBranchExchangeServiceRegistrationHandler()));
-
- for (ServiceDependencyTracker service : services) {
- service.open();
- }
- }
-
- @Override
- public void stop(BundleContext context) throws Exception {
- for (ServiceDependencyTracker service : services) {
- service.close();
- }
- services.clear();
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/internal/OseeBranchService.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/internal/OseeBranchService.java
deleted file mode 100644
index f90cc277343..00000000000
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/internal/OseeBranchService.java
+++ /dev/null
@@ -1,223 +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.branch.management.internal;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.branch.management.IOseeBranchService;
-import org.eclipse.osee.framework.branch.management.change.ComputeNetChangeOperation;
-import org.eclipse.osee.framework.branch.management.change.LoadDeltasBetweenBranches;
-import org.eclipse.osee.framework.branch.management.change.LoadDeltasBetweenTxsOnTheSameBranch;
-import org.eclipse.osee.framework.branch.management.commit.CommitDbOperation;
-import org.eclipse.osee.framework.branch.management.creation.CreateBranchOperation;
-import org.eclipse.osee.framework.branch.management.purge.BranchOperation;
-import org.eclipse.osee.framework.branch.management.purge.IBranchOperationFactory;
-import org.eclipse.osee.framework.branch.management.purge.IBranchesProvider;
-import org.eclipse.osee.framework.branch.management.purge.MultiBranchProvider;
-import org.eclipse.osee.framework.branch.management.purge.PurgeBranchOperationFactory;
-import org.eclipse.osee.framework.branch.management.purge.SingleBranchProvider;
-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.CoreBranches;
-import org.eclipse.osee.framework.core.enums.TransactionVersion;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.message.BranchCommitRequest;
-import org.eclipse.osee.framework.core.message.BranchCommitResponse;
-import org.eclipse.osee.framework.core.message.BranchCreationRequest;
-import org.eclipse.osee.framework.core.message.BranchCreationResponse;
-import org.eclipse.osee.framework.core.message.ChangeBranchArchiveStateRequest;
-import org.eclipse.osee.framework.core.message.ChangeBranchStateRequest;
-import org.eclipse.osee.framework.core.message.ChangeBranchTypeRequest;
-import org.eclipse.osee.framework.core.message.ChangeReportRequest;
-import org.eclipse.osee.framework.core.message.ChangeReportResponse;
-import org.eclipse.osee.framework.core.message.PurgeBranchRequest;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.TransactionDelta;
-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.BranchFilter;
-import org.eclipse.osee.framework.core.model.cache.TransactionCache;
-import org.eclipse.osee.framework.core.model.change.ChangeItem;
-import org.eclipse.osee.framework.core.operation.AbstractOperation;
-import org.eclipse.osee.framework.core.operation.CompositeOperation;
-import org.eclipse.osee.framework.core.operation.IOperation;
-import org.eclipse.osee.framework.core.operation.OperationLogger;
-import org.eclipse.osee.framework.core.operation.Operations;
-import org.eclipse.osee.framework.core.services.IOseeCachingServiceProvider;
-import org.eclipse.osee.framework.core.services.IOseeModelFactoryServiceProvider;
-import org.eclipse.osee.framework.database.IOseeDatabaseServiceProvider;
-
-/**
- * @author Jeff C. Phillips
- * @author Megumi Telles
- * @author Ryan D. Brooks
- * @author Roberto E. Escobar
- * @author Andrew M. Finkbeiner
- */
-public class OseeBranchService implements IOseeBranchService {
- private final IOseeDatabaseServiceProvider oseeDatabaseProvider;
- private final IOseeCachingServiceProvider cachingService;
- private final IOseeModelFactoryServiceProvider modelFactory;
-
- public OseeBranchService(IOseeDatabaseServiceProvider oseeDatabaseProvider, IOseeCachingServiceProvider cachingService, IOseeModelFactoryServiceProvider modelFactory) {
- this.oseeDatabaseProvider = oseeDatabaseProvider;
- this.cachingService = cachingService;
- this.modelFactory = modelFactory;
- }
-
- @Override
- public void commitBranch(IProgressMonitor monitor, BranchCommitRequest branchCommitData, BranchCommitResponse response) throws OseeCoreException {
- int userId = branchCommitData.getUserArtId();
- BranchCache branchCache = cachingService.getOseeCachingService().getBranchCache();
- TransactionCache transactionCache = cachingService.getOseeCachingService().getTransactionCache();
-
- Branch sourceBranch = branchCache.getById(branchCommitData.getSourceBranchId());
- Branch destinationBranch = branchCache.getById(branchCommitData.getDestinationBranchId());
- Branch mergeBranch = branchCache.findMergeBranch(sourceBranch, destinationBranch);
-
- TransactionRecord sourceTx = transactionCache.getTransaction(sourceBranch, TransactionVersion.HEAD);
- TransactionRecord destinationTx = transactionCache.getTransaction(destinationBranch, TransactionVersion.HEAD);
-
- TransactionDelta txDelta = new TransactionDelta(sourceTx, destinationTx);
- TransactionRecord mergeTx =
- mergeBranch != null ? transactionCache.getTransaction(mergeBranch, TransactionVersion.HEAD) : null;
-
- List<ChangeItem> changes = new ArrayList<ChangeItem>();
-
- List<IOperation> ops = new ArrayList<IOperation>();
- ops.add(new LoadDeltasBetweenBranches(oseeDatabaseProvider, txDelta, mergeTx, changes));
- ops.add(new ComputeNetChangeOperation(changes));
- ops.add(new CommitDbOperation(oseeDatabaseProvider.getOseeDatabaseService(), branchCache, userId, sourceBranch,
- destinationBranch, mergeBranch, changes, response, modelFactory));
-
- String opName =
- String.format("Commit: [%s]->[%s]", sourceBranch.getShortName(), destinationBranch.getShortName());
- IOperation op = new CompositeOperation(opName, Activator.PLUGIN_ID, ops);
- Operations.executeWorkAndCheckStatus(op, monitor);
-
- TransactionRecord newTransaction = response.getTransaction();
- newTransaction.setBranchCache(branchCache);
- transactionCache.cache(newTransaction);
- if (branchCommitData.isArchiveAllowed()) {
- sourceBranch.setArchived(true);
- branchCache.storeItems(sourceBranch);
- }
- }
-
- @Override
- public IOperation createBranch(IProgressMonitor monitor, BranchCreationRequest request, BranchCreationResponse response) throws OseeCoreException {
- return new CreateBranchOperation(oseeDatabaseProvider.getOseeDatabaseService(), modelFactory,
- cachingService.getOseeCachingService(), request, response);
- }
-
- @Override
- public IOperation getChanges(IProgressMonitor monitor, ChangeReportRequest request, ChangeReportResponse response) throws OseeCoreException {
- TransactionCache txCache = cachingService.getOseeCachingService().getTransactionCache();
- TransactionRecord srcTx = txCache.getOrLoad(request.getSourceTx());
- TransactionRecord destTx = txCache.getOrLoad(request.getDestinationTx());
-
- TransactionDelta txDelta = new TransactionDelta(srcTx, destTx);
-
- List<IOperation> ops = new ArrayList<IOperation>();
- if (txDelta.areOnTheSameBranch()) {
- ops.add(new LoadDeltasBetweenTxsOnTheSameBranch(oseeDatabaseProvider, txDelta, response.getChangeItems()));
- } else {
- TransactionRecord mergeTx = getMergeTransaction(srcTx, destTx);
- ops.add(new LoadDeltasBetweenBranches(oseeDatabaseProvider, txDelta, mergeTx, response.getChangeItems()));
- }
- ops.add(new ComputeNetChangeOperation(response.getChangeItems()));
- ops.add(new AddArtifactChangeData(response.getChangeItems()));
-
- String opName = String.format("Gathering changes");
- return new CompositeOperation(opName, Activator.PLUGIN_ID, ops);
- }
-
- private TransactionRecord getMergeTransaction(TransactionRecord sourceTx, TransactionRecord destinationTx) throws OseeCoreException {
- BranchCache cache = cachingService.getOseeCachingService().getBranchCache();
- Branch mergeBranch = cache.findMergeBranch(sourceTx.getBranch(), destinationTx.getBranch());
- return mergeBranch != null ? cachingService.getOseeCachingService().getTransactionCache().getTransaction(
- mergeBranch, TransactionVersion.HEAD) : null;
- }
-
- @Override
- public IOperation purge(IProgressMonitor monitor, PurgeBranchRequest request, OperationLogger logger) throws OseeCoreException {
- BranchCache branchCache = cachingService.getOseeCachingService().getBranchCache();
- Branch branch = branchCache.getById(request.getBranchId());
- IBranchOperationFactory factory =
- new PurgeBranchOperationFactory(logger, branchCache, oseeDatabaseProvider.getOseeDatabaseService());
-
- IBranchesProvider provider;
- if (request.isRecursive()) {
- provider = new MultiBranchProvider(true, Collections.singleton(branch), new BranchFilter());
- } else {
- provider = new SingleBranchProvider(branch);
- }
-
- return new BranchOperation(logger, factory, provider);
- }
-
- @Override
- public IOperation updateBranchArchiveState(IProgressMonitor monitor, ChangeBranchArchiveStateRequest request) {
- return createBranchChangeOp(monitor, "Branch Archive State Change", request.getBranchId(), null, null,
- request.getState());
- }
-
- @Override
- public IOperation updateBranchState(IProgressMonitor monitor, ChangeBranchStateRequest request) {
- return createBranchChangeOp(monitor, "Branch State Change", request.getBranchId(), request.getState(), null, null);
- }
-
- @Override
- public IOperation updateBranchType(IProgressMonitor monitor, ChangeBranchTypeRequest request) {
- return createBranchChangeOp(monitor, "Branch Type Change", request.getBranchId(), null, request.getType(), null);
- }
-
- private IOperation createBranchChangeOp(IProgressMonitor monitor, String opName, final int branchId, final BranchState branchState, final BranchType branchType, final BranchArchivedState archivedState) {
- IOperation operation = new AbstractOperation(opName, Activator.PLUGIN_ID) {
-
- @Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
- BranchCache branchCache = cachingService.getOseeCachingService().getBranchCache();
- Branch branch = branchCache.getById(branchId);
-
- if (branchType != null) {
- branch.setBranchType(branchType);
- }
- if (branchState != null) {
- branch.setBranchState(branchState);
- }
- if (archivedState != null) {
- branch.setArchived(archivedState.isArchived());
- }
- branchCache.storeItems(branch);
- }
- };
- return operation;
- }
-
- @Override
- public IOperation createSystemRootBranch(IProgressMonitor monitor) throws OseeCoreException {
- // boolean doesSystemRootExist =
- // cachingService.getOseeCachingService().getBranchCache().existsByGuid(CoreBranches.SYSTEM_ROOT.getGuid());
- // Conditions.checkExpressionFailOnTrue(doesSystemRootExist, "System Root branch already exists.");
-
- final int NULL_PARENT_BRANCH_ID = -1;
- BranchCreationResponse response = new BranchCreationResponse(-1);
- BranchCreationRequest request =
- new BranchCreationRequest(BranchType.SYSTEM_ROOT, 1, NULL_PARENT_BRANCH_ID,
- CoreBranches.SYSTEM_ROOT.getGuid(), CoreBranches.SYSTEM_ROOT.getName(), -1, -1,
- CoreBranches.SYSTEM_ROOT.getName() + " Creation", -1, -1);
- return createBranch(monitor, request, response);
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/internal/trackers/OseeBranchExchangeServiceRegistrationHandler.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/internal/trackers/OseeBranchExchangeServiceRegistrationHandler.java
deleted file mode 100644
index 5d898714f3c..00000000000
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/internal/trackers/OseeBranchExchangeServiceRegistrationHandler.java
+++ /dev/null
@@ -1,72 +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.branch.management.internal.trackers;
-
-import java.util.Map;
-import org.eclipse.osee.framework.branch.management.IBranchExchange;
-import org.eclipse.osee.framework.branch.management.exchange.BranchExchange;
-import org.eclipse.osee.framework.branch.management.exchange.OseeServices;
-import org.eclipse.osee.framework.core.services.IOseeCachingService;
-import org.eclipse.osee.framework.core.services.IOseeModelingService;
-import org.eclipse.osee.framework.core.services.IdentityService;
-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;
-
-/**
- * @author Roberto E. Escobar
- */
-public class OseeBranchExchangeServiceRegistrationHandler extends AbstractTrackingHandler {
-
- private final static Class<?>[] SERVICE_DEPENDENCIES = new Class<?>[] {
- IResourceManager.class,
- IResourceLocatorManager.class,
- IOseeModelingService.class,
- IOseeCachingService.class,
- IOseeDatabaseService.class,
- IdentityService.class,};
-
- private ServiceRegistration serviceRegistration;
-
- @Override
- public Class<?>[] getDependencies() {
- return SERVICE_DEPENDENCIES;
- }
-
- @Override
- public void onActivate(BundleContext context, Map<Class<?>, Object> services) {
- IBranchExchange branchExchangeService = createBranchExchangeService(services);
- serviceRegistration = context.registerService(IBranchExchange.class.getName(), branchExchangeService, null);
- }
-
- @Override
- public void onDeActivate() {
- if (serviceRegistration != null) {
- serviceRegistration.unregister();
- }
- }
-
- private IBranchExchange createBranchExchangeService(Map<Class<?>, Object> services) {
- IResourceManager resourceManager = getService(IResourceManager.class, services);
- IResourceLocatorManager resourceLocatorManager = getService(IResourceLocatorManager.class, services);
- IOseeModelingService modelingService = getService(IOseeModelingService.class, services);
- IOseeCachingService cachingService = getService(IOseeCachingService.class, services);
- IOseeDatabaseService databaseService = getService(IOseeDatabaseService.class, services);
- IdentityService identityService = getService(IdentityService.class, services);
- OseeServices oseeServices =
- new OseeServices(resourceManager, resourceLocatorManager, cachingService, modelingService, databaseService,
- identityService);
- return new BranchExchange(oseeServices);
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/internal/trackers/OseeBranchServiceRegistrationHandler.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/internal/trackers/OseeBranchServiceRegistrationHandler.java
deleted file mode 100644
index 8dbb3b07104..00000000000
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/internal/trackers/OseeBranchServiceRegistrationHandler.java
+++ /dev/null
@@ -1,89 +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.branch.management.internal.trackers;
-
-import java.util.Map;
-import org.eclipse.osee.framework.branch.management.IOseeBranchService;
-import org.eclipse.osee.framework.branch.management.internal.OseeBranchService;
-import org.eclipse.osee.framework.core.services.IOseeCachingService;
-import org.eclipse.osee.framework.core.services.IOseeCachingServiceProvider;
-import org.eclipse.osee.framework.core.services.IOseeModelFactoryService;
-import org.eclipse.osee.framework.core.services.IOseeModelFactoryServiceProvider;
-import org.eclipse.osee.framework.core.util.AbstractTrackingHandler;
-import org.eclipse.osee.framework.database.IOseeDatabaseService;
-import org.eclipse.osee.framework.database.IOseeDatabaseServiceProvider;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
-
-/**
- * @author Roberto E. Escobar
- */
-public class OseeBranchServiceRegistrationHandler extends AbstractTrackingHandler {
-
- //@formatter:off
- private final static Class<?>[] SERVICE_DEPENDENCIES = new Class<?>[] {
- IOseeDatabaseService.class,
- IOseeModelFactoryService.class,
- IOseeCachingService.class
- };
- //@formatter:on
-
- private ServiceRegistration serviceRegistration;
-
- @Override
- public Class<?>[] getDependencies() {
- return SERVICE_DEPENDENCIES;
- }
-
- @Override
- public void onActivate(BundleContext context, Map<Class<?>, Object> services) {
- IOseeBranchService branchService = createBranchService(services);
- serviceRegistration = context.registerService(IOseeBranchService.class.getName(), branchService, null);
- }
-
- @Override
- public void onDeActivate() {
- if (serviceRegistration != null) {
- serviceRegistration.unregister();
- }
- }
-
- private IOseeBranchService createBranchService(Map<Class<?>, Object> services) {
- final IOseeDatabaseService dbService = getService(IOseeDatabaseService.class, services);
- final IOseeModelFactoryService modelService = getService(IOseeModelFactoryService.class, services);
- final IOseeCachingService cachingService = getService(IOseeCachingService.class, services);
-
- IOseeDatabaseServiceProvider dbProvider = new IOseeDatabaseServiceProvider() {
- @Override
- public IOseeDatabaseService getOseeDatabaseService() {
- return dbService;
- }
- };
-
- IOseeModelFactoryServiceProvider modelProvider = new IOseeModelFactoryServiceProvider() {
-
- @Override
- public IOseeModelFactoryService getOseeFactoryService() {
- return modelService;
- }
- };
-
- IOseeCachingServiceProvider cachingProvider = new IOseeCachingServiceProvider() {
-
- @Override
- public IOseeCachingService getOseeCachingService() {
- return cachingService;
- }
- };
-
- return new OseeBranchService(dbProvider, cachingProvider, modelProvider);
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/BranchOperation.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/BranchOperation.java
deleted file mode 100644
index a22f630bac2..00000000000
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/BranchOperation.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 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.branch.management.purge;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.branch.management.internal.Activator;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.operation.AbstractOperation;
-import org.eclipse.osee.framework.core.operation.IOperation;
-import org.eclipse.osee.framework.core.operation.OperationLogger;
-import org.eclipse.osee.framework.core.util.Conditions;
-
-/**
- * @author John Misinco
- */
-public final class BranchOperation extends AbstractOperation {
-
- private final IBranchOperationFactory operationFactory;
- private final IBranchesProvider branchProvider;
-
- public BranchOperation(OperationLogger logger, IBranchOperationFactory operationFactory, IBranchesProvider branchProvider) {
- super("Branches", Activator.PLUGIN_ID, logger);
- this.operationFactory = operationFactory;
- this.branchProvider = branchProvider;
- }
-
- public BranchOperation(OperationLogger logger, IBranchOperationFactory operationFactory, Branch branch) {
- this(logger, operationFactory, new SingleBranchProvider(branch));
- }
-
- @Override
- protected void doWork(IProgressMonitor monitor) throws OseeCoreException {
- Conditions.checkNotNull(operationFactory, "operationFactory");
- Conditions.checkNotNull(branchProvider, "branchProvider");
- Collection<Branch> branches = branchProvider.getBranches();
- Conditions.checkNotNull(branches, "branches");
-
- logf("Branch Operation Starting for %d branch(es).", branches.size());
- for (Branch branch : order(branches)) {
- AbstractOperation.checkForCancelledStatus(monitor);
- IOperation subOp = operationFactory.createOperation(branch);
- log(subOp.getName());
- doSubWork(subOp, monitor, 0);
- }
- log("Branch Operation Completed.");
- }
-
- private List<Branch> order(Collection<Branch> branches) throws OseeCoreException {
- List<Branch> list = new ArrayList<Branch>(branches);
- for (int i = 0; i < list.size(); i++) {
- Branch cur = list.get(i);
- Branch parent = cur.getParentBranch();
-
- //this is the last element in the list
- if (parent == null || !list.contains(parent)) {
- Branch last = list.get(list.size() - 1);
- list.set(i, last);
- list.set(list.size() - 1, cur);
- } else {
- int parentIdx = list.indexOf(parent);
- //need to swap
- if (parentIdx < i) {
- list.set(i, parent);
- list.set(parentIdx, cur);
- //reset i
- i--;
- }
- }
- }
- return list;
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/IBranchOperationFactory.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/IBranchOperationFactory.java
deleted file mode 100644
index 9bf2869fb05..00000000000
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/IBranchOperationFactory.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 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.branch.management.purge;
-
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.operation.IOperation;
-
-/**
- * @author John Misinco
- */
-public interface IBranchOperationFactory {
- public IOperation createOperation(Branch branch);
-}
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/PurgeBranchOperation.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/PurgeBranchOperation.java
deleted file mode 100644
index b1de16cbd79..00000000000
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/PurgeBranchOperation.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.branch.management.purge;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.branch.management.internal.Activator;
-import org.eclipse.osee.framework.core.enums.StorageState;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.cache.BranchCache;
-import org.eclipse.osee.framework.core.operation.OperationLogger;
-import org.eclipse.osee.framework.database.IOseeDatabaseService;
-import org.eclipse.osee.framework.database.core.AbstractDbTxOperation;
-import org.eclipse.osee.framework.database.core.OseeConnection;
-
-/**
- * @author Megumi Telles
- * @author Jeff C. Phillips
- * @author Robert A. Fisher
- * @author Ryan D. Brooks
- */
-public class PurgeBranchOperation extends AbstractDbTxOperation {
- private static final String DELETE_FROM_BRANCH_TABLE = "DELETE FROM osee_branch WHERE branch_id = ?";
- private static final String DELETE_FROM_MERGE =
- "DELETE FROM osee_merge WHERE merge_branch_id = ? AND source_branch_id = ?";
- private static final String DELETE_FROM_CONFLICT = "DELETE FROM osee_conflict WHERE merge_branch_id = ?";
- private static final String DELETE_FROM_TX_DETAILS = "DELETE FROM osee_tx_details WHERE branch_id = ?";
- private final String DELETE_ARTIFACT_ACL_FROM_BRANCH = "DELETE FROM OSEE_ARTIFACT_ACL WHERE branch_id =?";
- private final String DELETE_BRANCH_ACL_FROM_BRANCH = "DELETE FROM OSEE_BRANCH_ACL WHERE branch_id =?";
-
- private final Branch branch;
- private final int branchId;
- private OseeConnection connection;
- private IProgressMonitor monitor;
- private final String sourceTableName;
- private final BranchCache branchCache;
- private final IOseeDatabaseService databaseService;
-
- public PurgeBranchOperation(OperationLogger logger, Branch branch, BranchCache branchCache, IOseeDatabaseService databaseService) {
- super(databaseService, String.format("Purge Branch: [(%s)-%s]", branch.getId(), branch.getShortName()),
- Activator.PLUGIN_ID, logger);
- this.branch = branch;
- branchId = branch.getId();
- this.sourceTableName = branch.getArchiveState().isArchived() ? "osee_txs_archived" : "osee_txs";
- this.branchCache = branchCache;
- this.databaseService = databaseService;
- }
-
- @Override
- protected void doTxWork(IProgressMonitor monitor, OseeConnection connection) throws OseeCoreException {
- this.connection = connection;
- this.monitor = monitor;
-
- if (branch.getStorageState() == StorageState.PURGED) {
- return;
- }
-
- if (!branch.getAllChildBranches(false).isEmpty()) {
- throw new OseeArgumentException("Unable to purge a branch containing children: branchGuid[%s] branchType[%s]",
- branch.getGuid(), branch.getBranchType());
- }
-
- monitor.worked(calculateWork(0.05));
-
- String sql = String.format("DELETE FROM %s WHERE branch_id = ?", sourceTableName);
- purgeFromTable(sourceTableName, sql, 0.20, branchId);
- purgeFromTable("Tx Details", DELETE_FROM_TX_DETAILS, 0.09, branchId);
- purgeFromTable("Conflict", DELETE_FROM_CONFLICT, 0.01, branchId);
- purgeFromTable("Merge", DELETE_FROM_MERGE, 0.01, branchId, branch.getParentBranch().getId());
- purgeFromTable("Branch", DELETE_FROM_BRANCH_TABLE, 0.01, branchId);
- purgeAccessControlTables(branch);
-
- branch.setStorageState(StorageState.PURGED);
- branchCache.storeItems(branch);
- branch.internalRemovePurgedBranchFromParent();
- }
-
- private void purgeAccessControlTables(Branch branch) throws OseeCoreException {
- databaseService.runPreparedUpdate(DELETE_ARTIFACT_ACL_FROM_BRANCH, branchId);
- databaseService.runPreparedUpdate(DELETE_BRANCH_ACL_FROM_BRANCH, branchId);
- }
-
- private void purgeFromTable(String tableName, String sql, double percentage, Object... data) throws OseeCoreException {
- monitor.setTaskName(String.format("Purge from %s", tableName));
- checkForCancelledStatus(monitor);
- databaseService.runPreparedUpdate(connection, sql, data);
- monitor.worked(calculateWork(percentage));
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/PurgeBranchOperationFactory.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/PurgeBranchOperationFactory.java
deleted file mode 100644
index cf30ea81a14..00000000000
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/PurgeBranchOperationFactory.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 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.branch.management.purge;
-
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.cache.BranchCache;
-import org.eclipse.osee.framework.core.operation.IOperation;
-import org.eclipse.osee.framework.core.operation.OperationLogger;
-import org.eclipse.osee.framework.database.IOseeDatabaseService;
-
-/**
- * @author John Misinco
- */
-public final class PurgeBranchOperationFactory implements IBranchOperationFactory {
-
- private final BranchCache branchCache;
- private final IOseeDatabaseService databaseService;
- private final OperationLogger logger;
-
- public PurgeBranchOperationFactory(OperationLogger logger, BranchCache branchCache, IOseeDatabaseService databaseService) {
- this.branchCache = branchCache;
- this.databaseService = databaseService;
- this.logger = logger;
- }
-
- @Override
- public IOperation createOperation(Branch branch) {
- return new PurgeBranchOperation(logger, branch, branchCache, databaseService);
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore.test/.pmd b/plugins/org.eclipse.osee.framework.core.datastore.test/.pmd
deleted file mode 100644
index c7b0a9fb3f5..00000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore.test/.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.test/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.core.datastore.test/META-INF/MANIFEST.MF
deleted file mode 100644
index c1b6511ddb6..00000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore.test/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,10 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: OSEE Core Datastore Test
-Bundle-SymbolicName: org.eclipse.osee.framework.core.datastore.test;singleton:=true
-Bundle-Version: 0.9.9.qualifier
-Bundle-Vendor: Eclipse Open System Engineering Environment
-Fragment-Host: org.eclipse.osee.framework.core.datastore
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Require-Bundle: org.junit
-Export-Package: org.eclipse.osee.framework.core.datastore.test
diff --git a/plugins/org.eclipse.osee.framework.core.datastore.test/build.properties b/plugins/org.eclipse.osee.framework.core.datastore.test/build.properties
deleted file mode 100644
index 34d2e4d2dad..00000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore.test/build.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .
diff --git a/plugins/org.eclipse.osee.framework.core.datastore.test/src/org/eclipse/osee/framework/core/datastore/test/cache/DatabaseTransactionRecordAccessorTest.java b/plugins/org.eclipse.osee.framework.core.datastore.test/src/org/eclipse/osee/framework/core/datastore/test/cache/DatabaseTransactionRecordAccessorTest.java
deleted file mode 100644
index 455a2473573..00000000000
--- a/plugins/org.eclipse.osee.framework.core.datastore.test/src/org/eclipse/osee/framework/core/datastore/test/cache/DatabaseTransactionRecordAccessorTest.java
+++ /dev/null
@@ -1,66 +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.test.cache;
-
-import org.eclipse.osee.framework.core.datastore.cache.DatabaseTransactionRecordAccessor;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- * Test Case For {@link DatabaseTransactionRecordAccessor}
- *
- * @author Roberto E. Escobar
- */
-public class DatabaseTransactionRecordAccessorTest {
-
- @Ignore
- @Test
- public void testTX() {
-
- }
-
- // private final class MockConnectionHandlerStatement extends ConnectionHandlerStatement {
- //
- // @Override
- // public void runPreparedQuery(int fetchSize, String query, Object... data) throws OseeDataStoreException {
- // runPreparedQuery(query, data);
- // }
- //
- // @Override
- // public void runPreparedQuery(String query, Object... data) throws OseeDataStoreException {
- //
- // }
- //
- // @Override
- // public int getInt(String columnName) throws OseeDataStoreException {
- // return super.getInt(columnName);
- // }
- //
- // @Override
- // public String getString(String columnName) throws OseeDataStoreException {
- // return super.getString(columnName);
- // }
- //
- // @Override
- // public Timestamp getTimestamp(String columnName) throws OseeDataStoreException {
- // return super.getTimestamp(columnName);
- // }
- //
- // }
- //
- // private final class Handler implements IConnectionHandlerStatementProvider {
- //
- // @Override
- // public ConnectionHandlerStatement getStatement() {
- // return null;
- // }
- // }
-}
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 ad32c83a788..00000000000
--- 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 c7b0a9fb3f5..00000000000
--- 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 fa4346eca82..00000000000
--- 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 493fdcd269b..00000000000
--- 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 e16e3dfa671..00000000000
--- 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 83eb93c180c..00000000000
--- 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 86311c27bbf..00000000000
--- 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 72c52992af4..00000000000
--- 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/OseeSchemaProvider.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/OseeSchemaProvider.java
deleted file mode 100644
index 1898ce7ab28..00000000000
--- 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/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 1804f4d43b1..00000000000
--- 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 4381b6ddfb1..00000000000
--- 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 142ee213b41..00000000000
--- 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 aac3570e5f3..00000000000
--- 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 0b1e93fe32d..00000000000
--- 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 feef2a63a7a..00000000000
--- 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 be80486b7c2..00000000000
--- 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 101007ce448..00000000000
--- 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 b53282346c6..00000000000
--- 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/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 8cab46844e0..00000000000
--- 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 80012ecbd7a..00000000000
--- 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 caab150cefe..00000000000
--- 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/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 7debb510aa4..00000000000
--- 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.model/src/org/eclipse/osee/framework/core/model/Branch.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/Branch.java
index a604bed9293..722735088d7 100644
--- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/Branch.java
+++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/Branch.java
@@ -32,7 +32,7 @@ import org.eclipse.osee.framework.jdk.core.util.Strings;
/**
* @author Roberto E. Escobar
*/
-public class Branch extends AbstractOseeType<String> implements IAdaptable, IOseeBranch {
+public class Branch extends AbstractOseeType<String> implements WriteableBranch, IAdaptable {
private static final int SHORT_NAME_LIMIT = 35;
@@ -58,6 +58,7 @@ public class Branch extends AbstractOseeType<String> implements IAdaptable, IOse
addField(BranchField.BRANCH_CHILDREN, new CollectionField<Branch>(childBranches));
}
+ @Override
public Branch getParentBranch() throws OseeCoreException {
return getFieldValue(BranchField.PARENT_BRANCH);
}
@@ -77,10 +78,12 @@ public class Branch extends AbstractOseeType<String> implements IAdaptable, IOse
}
}
+ @Override
public boolean hasParentBranch() throws OseeCoreException {
return getParentBranch() != null;
}
+ @Override
public String getShortName() {
return getShortName(this);
}
@@ -89,18 +92,22 @@ public class Branch extends AbstractOseeType<String> implements IAdaptable, IOse
return Strings.truncate(branch.getName(), SHORT_NAME_LIMIT);
}
+ @Override
public BranchType getBranchType() {
return getFieldValueLogException(null, BranchField.BRANCH_TYPE_FIELD_KEY);
}
+ @Override
public BranchState getBranchState() {
return getFieldValueLogException(null, BranchField.BRANCH_STATE_FIELD_KEY);
}
+ @Override
public BranchArchivedState getArchiveState() {
return getFieldValueLogException(null, BranchField.BRANCH_ARCHIVED_STATE_FIELD_KEY);
}
+ @Override
public Integer getAssociatedArtifactId() throws OseeCoreException {
return getFieldValue(BranchField.BRANCH_ASSOCIATED_ARTIFACT_ID_FIELD_KEY);
}
@@ -109,10 +116,12 @@ public class Branch extends AbstractOseeType<String> implements IAdaptable, IOse
setField(BranchField.BRANCH_ASSOCIATED_ARTIFACT_ID_FIELD_KEY, artId);
}
+ @Override
public TransactionRecord getBaseTransaction() throws OseeCoreException {
return getFieldValue(BranchField.BRANCH_BASE_TRANSACTION);
}
+ @Override
public TransactionRecord getSourceTransaction() throws OseeCoreException {
return getFieldValue(BranchField.BRANCH_SOURCE_TRANSACTION);
}
@@ -149,6 +158,7 @@ public class Branch extends AbstractOseeType<String> implements IAdaptable, IOse
setField(BranchField.BRANCH_SOURCE_TRANSACTION, srcTx);
}
+ @Override
public boolean isEditable() {
BranchState state = getBranchState();
return !state.isCommitInProgress() && !state.isCommitted() && !state.isRebaselined() && //
@@ -177,6 +187,7 @@ public class Branch extends AbstractOseeType<String> implements IAdaptable, IOse
return this;
}
+ @Override
public Collection<Branch> getChildBranches() throws OseeCoreException {
return getChildBranches(false);
}
@@ -186,6 +197,7 @@ public class Branch extends AbstractOseeType<String> implements IAdaptable, IOse
* @return all unarchived child branches that are not of type merge
* @throws OseeCoreException
*/
+ @Override
public Collection<Branch> getChildBranches(boolean recurse) throws OseeCoreException {
Set<Branch> children = new HashSet<Branch>();
BranchFilter filter = new BranchFilter(BranchArchivedState.UNARCHIVED);
@@ -200,13 +212,20 @@ public class Branch extends AbstractOseeType<String> implements IAdaptable, IOse
* branches are excluded)
* @throws OseeCoreException
*/
+ @Override
public Collection<Branch> getAllChildBranches(boolean recurse) throws OseeCoreException {
Set<Branch> children = new HashSet<Branch>();
getChildBranches(children, recurse, new BranchFilter());
return children;
}
- public void getChildBranches(Collection<Branch> children, boolean recurse, BranchFilter filter) throws OseeCoreException {
+ @Override
+ public void getChildBranches(Collection<? extends ReadableBranch> children, boolean recurse, BranchFilter filter) throws OseeCoreException {
+ uncheckedGetChildBranches(children, recurse, filter);
+ }
+
+ @SuppressWarnings({"unchecked", "rawtypes"})
+ private void uncheckedGetChildBranches(Collection children, boolean recurse, BranchFilter filter) throws OseeCoreException {
for (Branch branch : getChildren()) {
if (filter.matches(branch)) {
children.add(branch);
@@ -217,6 +236,7 @@ public class Branch extends AbstractOseeType<String> implements IAdaptable, IOse
}
}
+ @Override
public Collection<Branch> getAncestors() throws OseeCoreException {
List<Branch> ancestors = new ArrayList<Branch>();
Branch branchCursor = this;
@@ -241,6 +261,7 @@ public class Branch extends AbstractOseeType<String> implements IAdaptable, IOse
return null;
}
+ @Override
public boolean isAncestorOf(IOseeBranch branch) throws OseeCoreException {
return getChildBranches(true).contains(branch);
}
diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/ReadableBranch.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/ReadableBranch.java
new file mode 100644
index 00000000000..af7eaeb46fd
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/ReadableBranch.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.model;
+
+import java.util.Collection;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
+import org.eclipse.osee.framework.core.data.Readable;
+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.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.cache.BranchFilter;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface ReadableBranch extends IOseeBranch, Readable {
+
+ int getId();
+
+ boolean isEditable();
+
+ BranchType getBranchType();
+
+ BranchState getBranchState();
+
+ BranchArchivedState getArchiveState();
+
+ Integer getAssociatedArtifactId() throws OseeCoreException;
+
+ TransactionRecord getBaseTransaction() throws OseeCoreException;
+
+ TransactionRecord getSourceTransaction() throws OseeCoreException;
+
+ ReadableBranch getParentBranch() throws OseeCoreException;
+
+ boolean hasParentBranch() throws OseeCoreException;
+
+ Collection<? extends ReadableBranch> getChildBranches() throws OseeCoreException;
+
+ Collection<? extends ReadableBranch> getChildBranches(boolean recurse) throws OseeCoreException;
+
+ Collection<? extends ReadableBranch> getAllChildBranches(boolean recurse) throws OseeCoreException;
+
+ void getChildBranches(Collection<? extends ReadableBranch> children, boolean recurse, BranchFilter filter) throws OseeCoreException;
+
+ Collection<? extends ReadableBranch> getAncestors() throws OseeCoreException;
+
+ boolean isAncestorOf(IOseeBranch branch) throws OseeCoreException;
+
+ String getShortName();
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/WriteableBranch.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/WriteableBranch.java
new file mode 100644
index 00000000000..c599e5774a2
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/WriteableBranch.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.model;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface WriteableBranch extends ReadableBranch {
+ // Place-holder
+}
diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/BranchFilter.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/BranchFilter.java
index 65b2d3f92cf..ea5967f6455 100644
--- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/BranchFilter.java
+++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/BranchFilter.java
@@ -14,8 +14,8 @@ 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.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.model.IBasicArtifact;
+import org.eclipse.osee.framework.core.model.ReadableBranch;
/**
* @author Ryan D. Brooks
@@ -45,7 +45,7 @@ public class BranchFilter {
this(BranchArchivedState.ALL, branchTypes);
}
- public boolean matches(Branch branch) throws OseeCoreException {
+ public boolean matches(ReadableBranch branch) throws OseeCoreException {
if (associatedArtifact != null && !branch.getAssociatedArtifactId().equals(associatedArtifact.getArtId())) {
return false;
}
diff --git a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/InternalTestSuite.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/InternalTestSuite.java
index def60ff36d9..e394c1e1496 100644
--- a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/InternalTestSuite.java
+++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/InternalTestSuite.java
@@ -11,6 +11,7 @@
package org.eclipse.osee.orcs.core.internal;
import org.eclipse.osee.orcs.core.internal.attribute.AttributeTestSuite;
+import org.eclipse.osee.orcs.core.internal.branch.BranchTestSuite;
import org.eclipse.osee.orcs.core.internal.relation.RelationTestSuite;
import org.eclipse.osee.orcs.core.internal.search.SearchTestSuite;
import org.junit.runner.RunWith;
@@ -20,7 +21,7 @@ import org.junit.runners.Suite;
* @author Roberto E. Escobar
*/
@RunWith(Suite.class)
-@Suite.SuiteClasses({AttributeTestSuite.class, RelationTestSuite.class, SearchTestSuite.class})
+@Suite.SuiteClasses({AttributeTestSuite.class, BranchTestSuite.class, RelationTestSuite.class, SearchTestSuite.class})
public class InternalTestSuite {
// Test Suite
}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore.test/src/org/eclipse/osee/framework/core/datastore/test/AllCoreDatastoreTestSuite.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/branch/BranchTestSuite.java
index 1a359ffabda..c9c45a85057 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore.test/src/org/eclipse/osee/framework/core/datastore/test/AllCoreDatastoreTestSuite.java
+++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/branch/BranchTestSuite.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
+ * Copyright (c) 2011 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
@@ -8,19 +8,17 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.test;
+package org.eclipse.osee.orcs.core.internal.branch;
-import org.eclipse.osee.framework.core.datastore.test.cache.CacheAccessorSuite;
+import org.eclipse.osee.orcs.core.internal.branch.provider.BranchProviderTestSuite;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@RunWith(Suite.class)
-@Suite.SuiteClasses({//
-CacheAccessorSuite.class, //
-})
+@Suite.SuiteClasses({BranchProviderTestSuite.class})
/**
- * @author Roberto E. Escobar
+ * @author John Misinco
*/
-public class AllCoreDatastoreTestSuite {
-
-}
+public class BranchTestSuite {
+ // tests provided above
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/purge/PurgeTestSuite.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/branch/provider/BranchProviderTestSuite.java
index 1ac8f6bd60e..f4b6489204f 100644
--- a/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/purge/PurgeTestSuite.java
+++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/branch/provider/BranchProviderTestSuite.java
@@ -8,16 +8,16 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.branch.management.test.purge;
+package org.eclipse.osee.orcs.core.internal.branch.provider;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@RunWith(Suite.class)
-@Suite.SuiteClasses({BranchOperationTest.class, DeletedBranchProviderTest.class, MultiBranchProviderTest.class})
+@Suite.SuiteClasses({PurgeBranchTest.class, DeletedBranchProviderTest.class, MultiBranchProviderTest.class})
/**
* @author John Misinco
*/
-public class PurgeTestSuite {
+public class BranchProviderTestSuite {
// tests provided above
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/purge/DeletedBranchProviderTest.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/branch/provider/DeletedBranchProviderTest.java
index aaee5519572..6c957659eae 100644
--- a/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/purge/DeletedBranchProviderTest.java
+++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/branch/provider/DeletedBranchProviderTest.java
@@ -8,12 +8,10 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.branch.management.test.purge;
+package org.eclipse.osee.orcs.core.internal.branch.provider;
import java.util.Collection;
import junit.framework.Assert;
-import org.eclipse.osee.framework.branch.management.purge.DeletedBranchProvider;
-import org.eclipse.osee.framework.branch.management.test.mocks.MockBranchProvider;
import org.eclipse.osee.framework.core.enums.BranchArchivedState;
import org.eclipse.osee.framework.core.enums.BranchState;
import org.eclipse.osee.framework.core.enums.BranchType;
diff --git a/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/mocks/MockBranchProvider.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/branch/provider/MockBranchProvider.java
index 20214484f6d..f8077612ff8 100644
--- a/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/mocks/MockBranchProvider.java
+++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/branch/provider/MockBranchProvider.java
@@ -8,11 +8,10 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.branch.management.test.mocks;
+package org.eclipse.osee.orcs.core.internal.branch.provider;
import java.util.ArrayList;
import java.util.Collection;
-import org.eclipse.osee.framework.branch.management.purge.IBranchesProvider;
import org.eclipse.osee.framework.core.enums.BranchState;
import org.eclipse.osee.framework.core.enums.BranchType;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
@@ -22,7 +21,7 @@ import org.eclipse.osee.framework.jdk.core.util.GUID;
/**
* @author John Misinco
*/
-public final class MockBranchProvider implements IBranchesProvider {
+public final class MockBranchProvider implements BranchProvider {
private final static String ROOT_BRANCH_NAME = "ROOT";
diff --git a/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/purge/MultiBranchProviderTest.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/branch/provider/MultiBranchProviderTest.java
index 8ec7c2cb1aa..b9a564d4a94 100644
--- a/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/purge/MultiBranchProviderTest.java
+++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/branch/provider/MultiBranchProviderTest.java
@@ -8,15 +8,13 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.branch.management.test.purge;
+package org.eclipse.osee.orcs.core.internal.branch.provider;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import junit.framework.Assert;
-import org.eclipse.osee.framework.branch.management.purge.MultiBranchProvider;
-import org.eclipse.osee.framework.branch.management.test.mocks.MockBranchProvider;
import org.eclipse.osee.framework.core.enums.BranchType;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.Branch;
diff --git a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/branch/provider/PurgeBranchTest.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/branch/provider/PurgeBranchTest.java
new file mode 100644
index 00000000000..137ab11206d
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/branch/provider/PurgeBranchTest.java
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.orcs.core.internal.branch.provider;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * @author John Misinco
+ */
+public final class PurgeBranchTest {
+
+ @Ignore
+ @Test
+ public void testPurgeBranch() throws Exception {
+ //
+ // runTest(false, false, false, true);
+ }
+ //
+ // @Test
+ // public void testBranchOperationException__nullFactory() throws Exception {
+ // runTest(true, false, false, false);
+ // }
+ //
+ // @Test
+ // public void testBranchOperationException__nullProvider() throws Exception {
+ // runTest(false, true, false, false);
+ // }
+ //
+ // @Test
+ // public void testBranchOperationException__nullLogger() throws Exception {
+ // runTest(false, false, true, false);
+ // }
+ //
+ // @Test
+ // public void testBranchOperationException__allNull() throws Exception {
+ // runTest(true, true, true, false);
+ // }
+ //
+ // private void runTest(boolean nullFactory, boolean nullProvider, boolean nullLogger, boolean expectedResult) throws Exception {
+ // MockBranchProvider mbp = new MockBranchProvider();
+ //
+ // if (nullProvider) {
+ // mbp = null;
+ // }
+ //
+ // Collection<Branch> branches = mbp.getBranches();
+ // Branch rootBranch = MockBranchProvider.getRootBranch(branches);
+ // BranchCache branchCache = createBranchCache();
+ // branchCache.cache(rootBranch);
+ //
+ // IOseeBranch toPurge = TokenFactory.createBranch(rootBranch.getGuid(), rootBranch.getName());
+ // MockBranchDataStore branchStore = new MockBranchDataStore();
+ //
+ // Callable<List<Branch>> callable =
+ // new PurgeBranchCallable(new MockLog(), new MockSessionContext(), branchStore, branchCache, toPurge, false);
+ // List<Branch> purged = callable.call();
+ //
+ // Assert.assertEquals(10, branchStore.getPurgeCount());
+ // Assert.assertTrue(verifyCallOrder(purged));
+ // }
+ //
+ // private static boolean verifyCallOrder(List<Branch> callOrder) throws OseeCoreException {
+ // boolean result = true;
+ // for (Branch cur : callOrder) {
+ // int idxCur = callOrder.indexOf(cur);
+ // Branch parent = cur.getParentBranch();
+ // if (parent != null) {
+ // int idxParent = callOrder.indexOf(parent);
+ // if (idxCur > idxParent) {
+ // result = false;
+ // break;
+ // }
+ // }
+ // }
+ // return result;
+ // }
+ //
+ // private static BranchCache createBranchCache() {
+ // return new BranchCache(new IOseeDataAccessor<String, Branch>() {
+ //
+ // @Override
+ // public void load(IOseeCache<String, Branch> cache) {
+ // //
+ // }
+ //
+ // @Override
+ // public void store(Collection<Branch> types) {
+ // //
+ // }
+ // });
+ // }
+ //
+ // private final class MockBranchDataStore implements BranchDataStore {
+ //
+ // private int purgeCount = 0;
+ //
+ // @Override
+ // public Callable<Branch> createBranch(String sessionId, CreateBranchData newBranchData) {
+ // return null;
+ // }
+ //
+ // @Override
+ // public Callable<Branch> purgeBranch(String sessionId, final Branch branch) {
+ // purgeCount++;
+ // return new Callable<Branch>() {
+ //
+ // @Override
+ // public Branch call() throws Exception {
+ // return branch;
+ // }
+ //
+ // };
+ // }
+ //
+ // @Override
+ // public Callable<TransactionRecord> commitBranch(String sessionId, Branch source, Branch destination) {
+ // return null;
+ // }
+ //
+ // @Override
+ // public Callable<?> compareBranch(String sessionId, TransactionRecord sourceTx, TransactionRecord destinationTx) {
+ // return null;
+ // }
+ //
+ // public int getPurgeCount() {
+ // return purgeCount;
+ // }
+ //
+ // }
+
+}
diff --git a/plugins/org.eclipse.osee.orcs.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.orcs.core/META-INF/MANIFEST.MF
index df69c36d8b0..c0317f7d161 100644
--- a/plugins/org.eclipse.osee.orcs.core/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.orcs.core/META-INF/MANIFEST.MF
@@ -13,6 +13,7 @@ Import-Package: com.google.common.collect;version="1.0.0",
org.eclipse.osee.framework.core.exception,
org.eclipse.osee.framework.core.model,
org.eclipse.osee.framework.core.model.cache,
+ org.eclipse.osee.framework.core.model.change,
org.eclipse.osee.framework.core.model.type,
org.eclipse.osee.framework.core.services,
org.eclipse.osee.framework.core.util,
@@ -22,6 +23,7 @@ Import-Package: com.google.common.collect;version="1.0.0",
org.eclipse.osee.orcs,
org.eclipse.osee.orcs.data,
org.eclipse.osee.orcs.search,
+ org.eclipse.osee.orcs.transaction,
org.eclipse.osee.orcs.utility
Export-Package: org.eclipse.osee.orcs.core,
org.eclipse.osee.orcs.core.ds,
diff --git a/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.api.xml b/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.api.xml
index 8d62ee49f94..4e705b5798e 100644
--- a/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.api.xml
+++ b/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.api.xml
@@ -10,4 +10,6 @@
<reference bind="setDataLoader" cardinality="1..1" interface="org.eclipse.osee.orcs.core.ds.DataLoader" name="DataLoader" policy="static"/>
<reference bind="setCacheService" cardinality="1..1" interface="org.eclipse.osee.framework.core.services.IOseeCachingService" name="IOseeCachingService" policy="static"/>
<reference bind="setDataStoreTypeCache" cardinality="1..1" interface="org.eclipse.osee.orcs.DataStoreTypeCache" name="DataStoreTypeCache" policy="static"/>
+ <reference bind="setBranchDataStore" cardinality="1..1" interface="org.eclipse.osee.orcs.core.ds.BranchDataStore" name="BranchDataStore" policy="static"/>
+ <reference bind="setDataStoreAdmin" cardinality="1..1" interface="org.eclipse.osee.orcs.core.ds.DataStoreAdmin" name="DataStoreAdmin" policy="static"/>
</scr:component>
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/BranchDataStore.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/BranchDataStore.java
new file mode 100644
index 00000000000..11019a4005f
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/BranchDataStore.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.orcs.core.ds;
+
+import java.util.List;
+import java.util.concurrent.Callable;
+import org.eclipse.osee.framework.core.data.IRelationTypeSide;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.model.TransactionRecord;
+import org.eclipse.osee.framework.core.model.change.ChangeItem;
+import org.eclipse.osee.orcs.data.CreateBranchData;
+import org.eclipse.osee.orcs.data.ReadableArtifact;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface BranchDataStore {
+
+ Callable<Branch> createBranch(String sessionId, CreateBranchData branchData);
+
+ Callable<Branch> purgeBranch(String sessionId, Branch branch);
+
+ Callable<TransactionRecord> commitBranch(String sessionId, ReadableArtifact committer, Branch source, Branch destination);
+
+ Callable<List<ChangeItem>> compareBranch(String sessionId, TransactionRecord sourceTx, TransactionRecord destinationTx);
+
+
+ Callable<Branch> deleteRelationTypeFromBranch(IOseeBranch branch, IRelationTypeSide relationType, int aArtId, int bArtId, int artUserId, String comment);
+}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/DataStoreAdmin.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/DataStoreAdmin.java
new file mode 100644
index 00000000000..8cbc7b9bfad
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/DataStoreAdmin.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.orcs.core.ds;
+
+import java.util.Map;
+import java.util.concurrent.Callable;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface DataStoreAdmin {
+
+ Callable<DataStoreInfo> createDataStore(String sessionId, Map<String, String> parameters);
+
+ Callable<DataStoreInfo> getDataStoreInfo(String sessionId);
+
+}
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/IOseeBranchServiceProvider.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/DataStoreConstants.java
index b6ce22d22d0..5c3c3dbe8f3 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/IOseeBranchServiceProvider.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/DataStoreConstants.java
@@ -8,15 +8,16 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.branch.management;
-
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
+package org.eclipse.osee.orcs.core.ds;
/**
- * @author Jeff C. Phillips
+ * @author Roberto E. Escobar
*/
-public interface IOseeBranchServiceProvider {
+public final class DataStoreConstants {
- public IOseeBranchService getBranchService() throws OseeCoreException;
+ private DataStoreConstants() {
+ // Constants class
+ }
+ public static final String DATASTORE_ID_KEY = "osee.db.guid";
}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore.test/src/org/eclipse/osee/framework/core/datastore/test/cache/CacheAccessorSuite.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/DataStoreInfo.java
index fbffa70f395..a21b7de5c31 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore.test/src/org/eclipse/osee/framework/core/datastore/test/cache/CacheAccessorSuite.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/DataStoreInfo.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Boeing.
+ * Copyright (c) 2012 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
@@ -8,16 +8,15 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.test.cache;
+package org.eclipse.osee.orcs.core.ds;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
+import java.util.Map;
/**
* @author Roberto E. Escobar
*/
-@RunWith(Suite.class)
-@Suite.SuiteClasses({DatabaseTransactionRecordAccessorTest.class})
-public class CacheAccessorSuite {
+public interface DataStoreInfo {
+
+ Map<String, String> getProperties();
}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsAdminImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsAdminImpl.java
new file mode 100644
index 00000000000..b01aac3fe5f
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsAdminImpl.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.orcs.core.internal;
+
+import java.util.Map;
+import java.util.concurrent.Callable;
+import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.OrcsAdmin;
+import org.eclipse.osee.orcs.OrcsMetaData;
+import org.eclipse.osee.orcs.core.ds.DataStoreAdmin;
+import org.eclipse.osee.orcs.core.internal.admin.CreateDatastoreCallable;
+import org.eclipse.osee.orcs.core.internal.admin.FetchDatastoreMetadataCallable;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class OrcsAdminImpl implements OrcsAdmin {
+
+ private final Log logger;
+ private final SessionContext sessionContext;
+ private final DataStoreAdmin dataStoreAdmin;
+
+ public OrcsAdminImpl(Log logger, SessionContext sessionContext, DataStoreAdmin dataStoreAdmin) {
+ this.logger = logger;
+ this.sessionContext = sessionContext;
+ this.dataStoreAdmin = dataStoreAdmin;
+ }
+
+ @Override
+ public Callable<OrcsMetaData> createDatastore(Map<String, String> parameters) {
+ return new CreateDatastoreCallable(logger, sessionContext, dataStoreAdmin, parameters);
+ }
+
+ @Override
+ public Callable<OrcsMetaData> createFetchOrcsMetaData() {
+ return new FetchDatastoreMetadataCallable(logger, sessionContext, dataStoreAdmin);
+ }
+}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsApiImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsApiImpl.java
index a2f3cc87c1b..b367dfee105 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsApiImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsApiImpl.java
@@ -17,8 +17,12 @@ import org.eclipse.osee.logger.Log;
import org.eclipse.osee.orcs.ApplicationContext;
import org.eclipse.osee.orcs.DataStoreTypeCache;
import org.eclipse.osee.orcs.Graph;
+import org.eclipse.osee.orcs.OrcsAdmin;
import org.eclipse.osee.orcs.OrcsApi;
+import org.eclipse.osee.orcs.OrcsBranch;
+import org.eclipse.osee.orcs.core.ds.BranchDataStore;
import org.eclipse.osee.orcs.core.ds.DataLoader;
+import org.eclipse.osee.orcs.core.ds.DataStoreAdmin;
import org.eclipse.osee.orcs.core.ds.QueryEngine;
import org.eclipse.osee.orcs.core.internal.artifact.ArtifactFactory;
import org.eclipse.osee.orcs.core.internal.attribute.AttributeClassResolver;
@@ -27,8 +31,10 @@ import org.eclipse.osee.orcs.core.internal.search.CallableQueryFactory;
import org.eclipse.osee.orcs.core.internal.search.CriteriaFactory;
import org.eclipse.osee.orcs.core.internal.search.QueryFactoryImpl;
import org.eclipse.osee.orcs.core.internal.session.SessionContextImpl;
+import org.eclipse.osee.orcs.core.internal.transaction.TransactionFactoryImpl;
import org.eclipse.osee.orcs.search.QueryFacade;
import org.eclipse.osee.orcs.search.QueryFactory;
+import org.eclipse.osee.orcs.transaction.TransactionFactory;
/**
* @author Roberto E. Escobar
@@ -45,6 +51,8 @@ public class OrcsApiImpl implements OrcsApi {
private OrcsObjectLoader objectLoader;
private CriteriaFactory criteriaFctry;
private CallableQueryFactory callableQueryFactory;
+ private BranchDataStore branchStore;
+ private DataStoreAdmin dataStoreAdmin;
public void setLogger(Log logger) {
this.logger = logger;
@@ -70,6 +78,14 @@ public class OrcsApiImpl implements OrcsApi {
this.dataStoreTypeCache = dataStoreTypeCache;
}
+ public void setBranchDataStore(BranchDataStore branchStore) {
+ this.branchStore = branchStore;
+ }
+
+ public void setDataStoreAdmin(DataStoreAdmin dataStoreAdmin) {
+ this.dataStoreAdmin = dataStoreAdmin;
+ }
+
public void start() {
ArtifactFactory artifactFactory = new ArtifactFactory(dataStoreTypeCache.getRelationTypeCache());
AttributeFactory attributeFactory =
@@ -78,7 +94,7 @@ public class OrcsApiImpl implements OrcsApi {
new OrcsObjectLoader(logger, dataLoader, artifactFactory, attributeFactory,
dataStoreTypeCache.getArtifactTypeCache(), cacheService.getBranchCache());
- criteriaFctry = new CriteriaFactory(getDataStoreTypeCache().getAttributeTypeCache());
+ criteriaFctry = new CriteriaFactory(dataStoreTypeCache.getAttributeTypeCache());
callableQueryFactory = new CallableQueryFactory(logger, queryEngine, objectLoader);
}
@@ -90,35 +106,49 @@ public class OrcsApiImpl implements OrcsApi {
@Override
public QueryFactory getQueryFactory(ApplicationContext context) {
- String sessionId = GUID.create(); // TODO context.getSessionId() attach to application context
- SessionContext sessionContext = getSessionContext(sessionId);
+ SessionContext sessionContext = getSessionContext(context);
return new QueryFactoryImpl(sessionContext, criteriaFctry, callableQueryFactory);
}
- private SessionContext getSessionContext(String sessionId) {
- // TODO get sessions from a session context cache
- return new SessionContextImpl(sessionId);
- }
-
@Override
public BranchCache getBranchCache() {
return cacheService.getBranchCache();
}
@Override
- public DataStoreTypeCache getDataStoreTypeCache() {
- return dataStoreTypeCache;
- }
-
- @Override
public QueryFacade getQueryFacade(ApplicationContext context) {
throw new UnsupportedOperationException();
}
@Override
public Graph getGraph(ApplicationContext context) {
- String sessionId = GUID.create(); // TODO context.getSessionId() attach to application context
- SessionContext sessionContext = getSessionContext(sessionId);
+ SessionContext sessionContext = getSessionContext(context);
return new GraphImpl(sessionContext, objectLoader, dataStoreTypeCache);
}
+
+ @Override
+ public OrcsBranch getBranchOps(ApplicationContext context) {
+ SessionContext sessionContext = getSessionContext(context);
+ return new OrcsBranchImpl(logger, sessionContext, branchStore, cacheService.getBranchCache(),
+ cacheService.getTransactionCache());
+ }
+
+ @Override
+ public TransactionFactory getTransactionFactory(ApplicationContext context) {
+ SessionContext sessionContext = getSessionContext(context);
+ return new TransactionFactoryImpl(logger, sessionContext, branchStore);
+ }
+
+ @Override
+ public OrcsAdmin getAdminOps(ApplicationContext context) {
+ SessionContext sessionContext = getSessionContext(context);
+ return new OrcsAdminImpl(logger, sessionContext, dataStoreAdmin);
+ }
+
+ private SessionContext getSessionContext(ApplicationContext context) {
+ // TODO get sessions from a session context cache
+ String sessionId = GUID.create(); // TODO context.getSessionId() attach to application context
+ return new SessionContextImpl(sessionId);
+ }
+
}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsBranchImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsBranchImpl.java
new file mode 100644
index 00000000000..ed6357d4f15
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsBranchImpl.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * 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.orcs.core.internal;
+
+import java.util.List;
+import java.util.concurrent.Callable;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
+import org.eclipse.osee.framework.core.data.ITransaction;
+import org.eclipse.osee.framework.core.enums.BranchState;
+import org.eclipse.osee.framework.core.enums.BranchType;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.ReadableBranch;
+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.TransactionCache;
+import org.eclipse.osee.framework.core.model.change.ChangeItem;
+import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.OrcsBranch;
+import org.eclipse.osee.orcs.core.ds.BranchDataStore;
+import org.eclipse.osee.orcs.core.internal.branch.ArchiveUnarchiveBranchCallable;
+import org.eclipse.osee.orcs.core.internal.branch.ChangeBranchStateCallable;
+import org.eclipse.osee.orcs.core.internal.branch.ChangeBranchTypeCallable;
+import org.eclipse.osee.orcs.core.internal.branch.CommitBranchCallable;
+import org.eclipse.osee.orcs.core.internal.branch.CompareBranchCallable;
+import org.eclipse.osee.orcs.core.internal.branch.CreateBranchCallable;
+import org.eclipse.osee.orcs.core.internal.branch.DeleteBranchCallable;
+import org.eclipse.osee.orcs.core.internal.branch.PurgeBranchCallable;
+import org.eclipse.osee.orcs.data.ArchiveOperation;
+import org.eclipse.osee.orcs.data.CreateBranchData;
+import org.eclipse.osee.orcs.data.ReadableArtifact;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class OrcsBranchImpl implements OrcsBranch {
+
+ private final Log logger;
+
+ private final SessionContext sessionContext;
+ private final BranchDataStore branchStore;
+ private final BranchCache branchCache;
+ private final TransactionCache txCache;
+
+ public OrcsBranchImpl(Log logger, SessionContext sessionContext, BranchDataStore branchStore, BranchCache branchCache, TransactionCache txCache) {
+ this.logger = logger;
+ this.sessionContext = sessionContext;
+ this.branchStore = branchStore;
+ this.branchCache = branchCache;
+ this.txCache = txCache;
+ }
+
+ @Override
+ public Callable<ReadableBranch> createBranch(CreateBranchData newBranchData) {
+ return new CreateBranchCallable(logger, sessionContext, branchStore, newBranchData);
+ }
+
+ @Override
+ public Callable<ReadableBranch> archiveUnarchiveBranch(IOseeBranch branch, ArchiveOperation archiveOp) {
+ return new ArchiveUnarchiveBranchCallable(logger, sessionContext, branchStore, branchCache, branch, archiveOp);
+ }
+
+ @Override
+ public Callable<ReadableBranch> deleteBranch(IOseeBranch branch) {
+ return new DeleteBranchCallable(logger, sessionContext, branchStore, branchCache, branch);
+ }
+
+ @Override
+ public Callable<List<ReadableBranch>> purgeBranch(IOseeBranch branch, boolean recurse) {
+ return new PurgeBranchCallable(logger, sessionContext, branchStore, branchCache, branch, recurse);
+ }
+
+ @Override
+ public Callable<TransactionRecord> commitBranch(ReadableArtifact committer, IOseeBranch source, IOseeBranch destination) {
+ return new CommitBranchCallable(logger, sessionContext, branchStore, branchCache, committer, source, destination);
+ }
+
+ @Override
+ public Callable<List<ChangeItem>> compareBranch(ITransaction sourceTx, ITransaction destinationTx) {
+ return new CompareBranchCallable(logger, sessionContext, branchStore, txCache, sourceTx, destinationTx);
+ }
+
+ @Override
+ public Callable<ReadableBranch> changeBranchState(IOseeBranch branch, BranchState newState) {
+ return new ChangeBranchStateCallable(logger, sessionContext, branchStore, branchCache, branch, newState);
+ }
+
+ @Override
+ public Callable<ReadableBranch> changeBranchType(IOseeBranch branch, BranchType branchType) {
+ return new ChangeBranchTypeCallable(logger, sessionContext, branchStore, branchCache, branch, branchType);
+ }
+
+ @Override
+ public ReadableBranch getBranchFromId(int id) throws OseeCoreException {
+ return branchCache.getById(id);
+ }
+}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/SystemPreferencesImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/SystemPreferencesImpl.java
index 83a533b3349..c99770ec2df 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/SystemPreferencesImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/SystemPreferencesImpl.java
@@ -15,6 +15,7 @@ import java.util.concurrent.ConcurrentHashMap;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.orcs.core.SystemPreferences;
+import org.eclipse.osee.orcs.core.ds.DataStoreConstants;
import org.eclipse.osee.orcs.core.ds.KeyValueDataAccessor;
/**
@@ -22,8 +23,6 @@ import org.eclipse.osee.orcs.core.ds.KeyValueDataAccessor;
*/
public class SystemPreferencesImpl implements SystemPreferences {
- private static final String DATASTORE_ID_KEY = "osee.db.guid";
-
private Map<String, String> cache;
private KeyValueDataAccessor accessor;
@@ -41,7 +40,7 @@ public class SystemPreferencesImpl implements SystemPreferences {
@Override
public String getSystemUuid() throws OseeCoreException {
- return getValue(DATASTORE_ID_KEY);
+ return getValue(DataStoreConstants.DATASTORE_ID_KEY);
}
@Override
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/admin/AbstractAdminCallable.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/admin/AbstractAdminCallable.java
new file mode 100644
index 00000000000..f4ff2ddf28b
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/admin/AbstractAdminCallable.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * 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.orcs.core.internal.admin;
+
+import java.util.concurrent.Callable;
+import org.eclipse.osee.executor.admin.CancellableCallable;
+import org.eclipse.osee.framework.core.util.Conditions;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.core.internal.SessionContext;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public abstract class AbstractAdminCallable<T> extends CancellableCallable<T> {
+
+ private final Log logger;
+ private final SessionContext sessionContext;
+ private Callable<?> innerWorker;
+
+ public AbstractAdminCallable(Log logger, SessionContext sessionContext) {
+ super();
+ this.logger = logger;
+ this.sessionContext = sessionContext;
+ }
+
+ protected Log getLogger() {
+ return logger;
+ }
+
+ protected SessionContext getSessionContext() {
+ return sessionContext;
+ }
+
+ @Override
+ public final T call() throws Exception {
+ long startTime = 0;
+ if (logger.isTraceEnabled()) {
+ startTime = System.currentTimeMillis();
+ }
+ T result;
+ try {
+ Conditions.checkNotNull(sessionContext, "sessionContext");
+ // Conditions.checkNotNull(branchStore, "branchDataStore");
+ result = innerCall();
+ } finally {
+ if (logger.isTraceEnabled()) {
+ logger.trace("Branch [%s] completed in [%s]", getClass().getSimpleName(), Lib.getElapseString(startTime));
+ }
+ }
+ return result;
+ }
+
+ protected abstract T innerCall() throws Exception;
+
+ protected <K> K callAndCheckForCancel(Callable<K> callable) throws Exception {
+ checkForCancelled();
+ setInnerWorker(callable);
+ K result = callable.call();
+ setInnerWorker(null);
+ return result;
+ }
+
+ private synchronized void setInnerWorker(Callable<?> callable) {
+ innerWorker = callable;
+ }
+
+ @Override
+ public void setCancel(boolean isCancelled) {
+ super.setCancel(isCancelled);
+ final Callable<?> inner = innerWorker;
+ if (inner != null) {
+ synchronized (inner) {
+ if (inner instanceof CancellableCallable) {
+ ((CancellableCallable<?>) inner).setCancel(isCancelled);
+ }
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/admin/CreateDatastoreCallable.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/admin/CreateDatastoreCallable.java
new file mode 100644
index 00000000000..3ce15995c1d
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/admin/CreateDatastoreCallable.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.orcs.core.internal.admin;
+
+import java.util.Map;
+import java.util.concurrent.Callable;
+import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.OrcsMetaData;
+import org.eclipse.osee.orcs.core.ds.DataStoreAdmin;
+import org.eclipse.osee.orcs.core.ds.DataStoreInfo;
+import org.eclipse.osee.orcs.core.internal.SessionContext;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class CreateDatastoreCallable extends AbstractAdminCallable<OrcsMetaData> {
+
+ private final DataStoreAdmin dataStoreAdmin;
+ private final Map<String, String> parameters;
+
+ public CreateDatastoreCallable(Log logger, SessionContext sessionContext, DataStoreAdmin dataStoreAdmin, Map<String, String> parameters) {
+ super(logger, sessionContext);
+ this.dataStoreAdmin = dataStoreAdmin;
+ this.parameters = parameters;
+ }
+
+ @Override
+ protected OrcsMetaData innerCall() throws Exception {
+ String sessionId = getSessionContext().getSessionId();
+ Callable<DataStoreInfo> callable = dataStoreAdmin.createDataStore(sessionId, parameters);
+ DataStoreInfo dataStoreInfo = callAndCheckForCancel(callable);
+
+ OrcsMetaData orcsMetaData = null;
+
+ return orcsMetaData;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/admin/FetchDatastoreMetadataCallable.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/admin/FetchDatastoreMetadataCallable.java
new file mode 100644
index 00000000000..e8091a153e1
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/admin/FetchDatastoreMetadataCallable.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.orcs.core.internal.admin;
+
+import java.util.concurrent.Callable;
+import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.OrcsMetaData;
+import org.eclipse.osee.orcs.core.ds.DataStoreAdmin;
+import org.eclipse.osee.orcs.core.ds.DataStoreInfo;
+import org.eclipse.osee.orcs.core.internal.SessionContext;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class FetchDatastoreMetadataCallable extends AbstractAdminCallable<OrcsMetaData> {
+
+ private final DataStoreAdmin dataStoreAdmin;
+
+ public FetchDatastoreMetadataCallable(Log logger, SessionContext sessionContext, DataStoreAdmin dataStoreAdmin) {
+ super(logger, sessionContext);
+ this.dataStoreAdmin = dataStoreAdmin;
+ }
+
+ @Override
+ protected OrcsMetaData innerCall() throws Exception {
+ String sessionId = getSessionContext().getSessionId();
+ Callable<DataStoreInfo> callable = dataStoreAdmin.getDataStoreInfo(sessionId);
+ DataStoreInfo dataStoreInfo = callAndCheckForCancel(callable);
+
+ OrcsMetaData orcsMetaData = null;
+
+ return orcsMetaData;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/AbstractBranchCallable.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/AbstractBranchCallable.java
new file mode 100644
index 00000000000..8682bc314eb
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/AbstractBranchCallable.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * 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.orcs.core.internal.branch;
+
+import java.util.concurrent.Callable;
+import org.eclipse.osee.executor.admin.CancellableCallable;
+import org.eclipse.osee.framework.core.util.Conditions;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.core.ds.BranchDataStore;
+import org.eclipse.osee.orcs.core.internal.SessionContext;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public abstract class AbstractBranchCallable<T> extends CancellableCallable<T> {
+
+ private final Log logger;
+ private final SessionContext sessionContext;
+ private final BranchDataStore branchStore;
+ private Callable<?> innerWorker;
+
+ public AbstractBranchCallable(Log logger, SessionContext sessionContext, BranchDataStore branchStore) {
+ super();
+ this.logger = logger;
+ this.sessionContext = sessionContext;
+ this.branchStore = branchStore;
+ }
+
+ protected Log getLogger() {
+ return logger;
+ }
+
+ protected SessionContext getSessionContext() {
+ return sessionContext;
+ }
+
+ protected BranchDataStore getBranchStore() {
+ return branchStore;
+ }
+
+ @Override
+ public final T call() throws Exception {
+ long startTime = 0;
+ if (logger.isTraceEnabled()) {
+ startTime = System.currentTimeMillis();
+ }
+ T result;
+ try {
+ Conditions.checkNotNull(sessionContext, "sessionContext");
+ Conditions.checkNotNull(branchStore, "branchDataStore");
+ result = innerCall();
+ } finally {
+ if (logger.isTraceEnabled()) {
+ logger.trace("Branch [%s] completed in [%s]", getClass().getSimpleName(), Lib.getElapseString(startTime));
+ }
+ }
+ return result;
+ }
+
+ protected abstract T innerCall() throws Exception;
+
+ protected <K> K callAndCheckForCancel(Callable<K> callable) throws Exception {
+ checkForCancelled();
+ setInnerWorker(callable);
+ K result = callable.call();
+ setInnerWorker(null);
+ return result;
+ }
+
+ private synchronized void setInnerWorker(Callable<?> callable) {
+ innerWorker = callable;
+ }
+
+ @Override
+ public void setCancel(boolean isCancelled) {
+ super.setCancel(isCancelled);
+ final Callable<?> inner = innerWorker;
+ if (inner != null) {
+ synchronized (inner) {
+ if (inner instanceof CancellableCallable) {
+ ((CancellableCallable<?>) inner).setCancel(isCancelled);
+ }
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/ArchiveUnarchiveBranchCallable.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/ArchiveUnarchiveBranchCallable.java
new file mode 100644
index 00000000000..5695fc41176
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/ArchiveUnarchiveBranchCallable.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.orcs.core.internal.branch;
+
+import org.eclipse.osee.framework.core.data.IOseeBranch;
+import org.eclipse.osee.framework.core.enums.BranchArchivedState;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.model.ReadableBranch;
+import org.eclipse.osee.framework.core.model.cache.BranchCache;
+import org.eclipse.osee.framework.core.util.Conditions;
+import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.core.ds.BranchDataStore;
+import org.eclipse.osee.orcs.core.internal.SessionContext;
+import org.eclipse.osee.orcs.data.ArchiveOperation;
+
+public class ArchiveUnarchiveBranchCallable extends AbstractBranchCallable<ReadableBranch> {
+
+ private final BranchCache cache;
+ private final IOseeBranch branchToken;
+ private final ArchiveOperation archiveOp;
+
+ public ArchiveUnarchiveBranchCallable(Log logger, SessionContext sessionContext, BranchDataStore branchStore, BranchCache cache, IOseeBranch branch, ArchiveOperation archiveOp) {
+ super(logger, sessionContext, branchStore);
+ this.cache = cache;
+ this.branchToken = branch;
+ this.archiveOp = archiveOp;
+ }
+
+ @Override
+ protected ReadableBranch innerCall() throws Exception {
+ Conditions.checkNotNull(branchToken, "branch");
+ Conditions.checkNotNull(archiveOp, "archiveOp");
+
+ Branch branch = cache.get(branchToken);
+ Conditions.checkNotNull(branch, "branch");
+
+ BranchArchivedState original = branch.getArchiveState();
+
+ try {
+ branch.setArchived(ArchiveOperation.ARCHIVE == archiveOp);
+ cache.storeItems(branch);
+ } catch (Exception ex) {
+ branch.setArchived(original.isArchived());
+ throw ex;
+ } finally {
+ // Event ?
+ }
+ return branch;
+ }
+}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/BranchUtil.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/BranchUtil.java
new file mode 100644
index 00000000000..677ef049e7b
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/BranchUtil.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.orcs.core.internal.branch;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+
+public class BranchUtil {
+
+ private BranchUtil() {
+ //Utility class
+ }
+
+ public static List<Branch> orderByParent(Collection<Branch> branches) throws OseeCoreException {
+ List<Branch> list = new ArrayList<Branch>(branches);
+ for (int i = 0; i < list.size(); i++) {
+ Branch cur = list.get(i);
+ Branch parent = cur.getParentBranch();
+
+ //this is the last element in the list
+ if (parent == null || !list.contains(parent)) {
+ Branch last = list.get(list.size() - 1);
+ list.set(i, last);
+ list.set(list.size() - 1, cur);
+ } else {
+ int parentIdx = list.indexOf(parent);
+ //need to swap
+ if (parentIdx < i) {
+ list.set(i, parent);
+ list.set(parentIdx, cur);
+ //reset i
+ i--;
+ }
+ }
+ }
+ return list;
+ }
+}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/ChangeBranchStateCallable.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/ChangeBranchStateCallable.java
new file mode 100644
index 00000000000..86632c0058e
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/ChangeBranchStateCallable.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.orcs.core.internal.branch;
+
+import org.eclipse.osee.framework.core.data.IOseeBranch;
+import org.eclipse.osee.framework.core.enums.BranchState;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.model.ReadableBranch;
+import org.eclipse.osee.framework.core.model.cache.BranchCache;
+import org.eclipse.osee.framework.core.util.Conditions;
+import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.core.ds.BranchDataStore;
+import org.eclipse.osee.orcs.core.internal.SessionContext;
+
+public class ChangeBranchStateCallable extends AbstractBranchCallable<ReadableBranch> {
+
+ private final BranchCache cache;
+ private final IOseeBranch branchToken;
+ private final BranchState branchState;
+
+ public ChangeBranchStateCallable(Log logger, SessionContext sessionContext, BranchDataStore branchStore, BranchCache cache, IOseeBranch branch, BranchState branchState) {
+ super(logger, sessionContext, branchStore);
+ this.cache = cache;
+ this.branchToken = branch;
+ this.branchState = branchState;
+ }
+
+ @Override
+ protected ReadableBranch innerCall() throws Exception {
+ Conditions.checkNotNull(branchToken, "branch");
+ Conditions.checkNotNull(branchState, "branchState");
+
+ Branch branch = cache.get(branchToken);
+ Conditions.checkNotNull(branch, "branch");
+
+ BranchState original = branch.getBranchState();
+
+ try {
+ branch.setBranchState(branchState);
+ cache.storeItems(branch);
+ } catch (Exception ex) {
+ branch.setBranchState(original);
+ throw ex;
+ } finally {
+ // TODO Event ?
+ }
+ return branch;
+ }
+}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/ChangeBranchTypeCallable.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/ChangeBranchTypeCallable.java
new file mode 100644
index 00000000000..64875563c12
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/ChangeBranchTypeCallable.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.orcs.core.internal.branch;
+
+import org.eclipse.osee.framework.core.data.IOseeBranch;
+import org.eclipse.osee.framework.core.enums.BranchType;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.model.ReadableBranch;
+import org.eclipse.osee.framework.core.model.cache.BranchCache;
+import org.eclipse.osee.framework.core.util.Conditions;
+import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.core.ds.BranchDataStore;
+import org.eclipse.osee.orcs.core.internal.SessionContext;
+
+public class ChangeBranchTypeCallable extends AbstractBranchCallable<ReadableBranch> {
+
+ private final BranchCache cache;
+ private final IOseeBranch branchToken;
+ private final BranchType branchType;
+
+ public ChangeBranchTypeCallable(Log logger, SessionContext sessionContext, BranchDataStore branchStore, BranchCache cache, IOseeBranch branch, BranchType branchType) {
+ super(logger, sessionContext, branchStore);
+ this.cache = cache;
+ this.branchToken = branch;
+ this.branchType = branchType;
+ }
+
+ @Override
+ protected ReadableBranch innerCall() throws Exception {
+ Conditions.checkNotNull(branchToken, "branch");
+ Conditions.checkNotNull(branchType, "branchType");
+
+ Branch branch = cache.get(branchToken);
+ Conditions.checkNotNull(branch, "branch");
+
+ BranchType original = branch.getBranchType();
+
+ try {
+ branch.setBranchType(branchType);
+ cache.storeItems(branch);
+ } catch (Exception ex) {
+ branch.setBranchType(original);
+ throw ex;
+ } finally {
+ // TODO Event ?
+ }
+ return branch;
+ }
+}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/CommitBranchCallable.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/CommitBranchCallable.java
new file mode 100644
index 00000000000..92ee3747669
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/CommitBranchCallable.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.orcs.core.internal.branch;
+
+import java.util.concurrent.Callable;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.model.TransactionRecord;
+import org.eclipse.osee.framework.core.model.cache.BranchCache;
+import org.eclipse.osee.framework.core.util.Conditions;
+import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.core.ds.BranchDataStore;
+import org.eclipse.osee.orcs.core.internal.SessionContext;
+import org.eclipse.osee.orcs.data.ReadableArtifact;
+
+public class CommitBranchCallable extends AbstractBranchCallable<TransactionRecord> {
+
+ private final BranchCache branchCache;
+ private final ReadableArtifact committer;
+ private final IOseeBranch source;
+ private final IOseeBranch destination;
+
+ public CommitBranchCallable(Log logger, SessionContext sessionContext, BranchDataStore branchStore, BranchCache branchCache, ReadableArtifact committer, IOseeBranch source, IOseeBranch destination) {
+ super(logger, sessionContext, branchStore);
+ this.branchCache = branchCache;
+ this.committer = committer;
+ this.source = source;
+ this.destination = destination;
+ }
+
+ private BranchCache getBranchCache() {
+ return branchCache;
+ }
+
+ @Override
+ protected TransactionRecord innerCall() throws Exception {
+ Conditions.checkNotNull(branchCache, "branchCache");
+ Conditions.checkNotNull(source, "sourceBranch");
+ Conditions.checkNotNull(destination, "destinationBranch");
+
+ Branch sourceBranch = getBranchCache().get(source);
+ Branch destinationBranch = getBranchCache().get(destination);
+
+ Conditions.checkNotNull(sourceBranch, "sourceBranch");
+ Conditions.checkNotNull(destinationBranch, "destinationBranch");
+
+ Callable<TransactionRecord> commitBranchCallable =
+ getBranchStore().commitBranch(getSessionContext().getSessionId(), committer, sourceBranch, destinationBranch);
+ return callAndCheckForCancel(commitBranchCallable);
+ }
+}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/CompareBranchCallable.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/CompareBranchCallable.java
new file mode 100644
index 00000000000..c07249257ef
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/CompareBranchCallable.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.orcs.core.internal.branch;
+
+import java.util.List;
+import java.util.concurrent.Callable;
+import org.eclipse.osee.framework.core.data.ITransaction;
+import org.eclipse.osee.framework.core.model.TransactionRecord;
+import org.eclipse.osee.framework.core.model.cache.TransactionCache;
+import org.eclipse.osee.framework.core.model.change.ChangeItem;
+import org.eclipse.osee.framework.core.util.Conditions;
+import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.core.ds.BranchDataStore;
+import org.eclipse.osee.orcs.core.internal.SessionContext;
+
+public class CompareBranchCallable extends AbstractBranchCallable<List<ChangeItem>> {
+
+ private final TransactionCache txCache;
+ private final ITransaction sourceTx;
+ private final ITransaction destinationTx;
+
+ public CompareBranchCallable(Log logger, SessionContext sessionContext, BranchDataStore branchStore, TransactionCache txCache, ITransaction sourceTx, ITransaction destinationTx) {
+ super(logger, sessionContext, branchStore);
+ this.txCache = txCache;
+ this.sourceTx = sourceTx;
+ this.destinationTx = destinationTx;
+ }
+
+ @Override
+ protected List<ChangeItem> innerCall() throws Exception {
+ Conditions.checkNotNull(sourceTx, "sourceTx");
+ Conditions.checkNotNull(destinationTx, "destinationTx");
+
+ TransactionRecord source = txCache.getOrLoad(sourceTx.getGuid());
+ TransactionRecord destination = txCache.getOrLoad(destinationTx.getGuid());
+
+ Conditions.checkNotNull(source, "sourceTx");
+ Conditions.checkNotNull(destination, "destinationTx");
+
+ Callable<List<ChangeItem>> callable =
+ getBranchStore().compareBranch(getSessionContext().getSessionId(), source, destination);
+ return callAndCheckForCancel(callable);
+
+ }
+}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/CreateBranchCallable.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/CreateBranchCallable.java
new file mode 100644
index 00000000000..3c2276d9669
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/CreateBranchCallable.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.orcs.core.internal.branch;
+
+import java.util.concurrent.Callable;
+import org.eclipse.osee.framework.core.data.ITransaction;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.model.ReadableBranch;
+import org.eclipse.osee.framework.core.util.Conditions;
+import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.core.ds.BranchDataStore;
+import org.eclipse.osee.orcs.core.internal.SessionContext;
+import org.eclipse.osee.orcs.data.CreateBranchData;
+
+public class CreateBranchCallable extends AbstractBranchCallable<ReadableBranch> {
+
+ private final CreateBranchData branchData;
+
+ public CreateBranchCallable(Log logger, SessionContext sessionContext, BranchDataStore branchStore, CreateBranchData branchData) {
+ super(logger, sessionContext, branchStore);
+ this.branchData = branchData;
+ }
+
+ @Override
+ protected ReadableBranch innerCall() throws Exception {
+ Conditions.checkNotNull(branchData, "branchData");
+
+ Conditions.checkNotNull(branchData.getGuid(), "branchGuid");
+ Conditions.checkNotNull(branchData.getName(), "branchName");
+ Conditions.checkNotNull(branchData.getBranchType(), "branchType");
+
+ ITransaction txData = branchData.getFromTransaction();
+ Conditions.checkNotNull(txData, "sourceTransaction");
+
+ Callable<Branch> callable = getBranchStore().createBranch(getSessionContext().getSessionId(), branchData);
+ return callAndCheckForCancel(callable);
+ }
+}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/DeleteBranchCallable.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/DeleteBranchCallable.java
new file mode 100644
index 00000000000..b348544f62e
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/DeleteBranchCallable.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.orcs.core.internal.branch;
+
+import org.eclipse.osee.framework.core.data.IOseeBranch;
+import org.eclipse.osee.framework.core.enums.BranchArchivedState;
+import org.eclipse.osee.framework.core.enums.BranchState;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.model.ReadableBranch;
+import org.eclipse.osee.framework.core.model.cache.BranchCache;
+import org.eclipse.osee.framework.core.util.Conditions;
+import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.core.ds.BranchDataStore;
+import org.eclipse.osee.orcs.core.internal.SessionContext;
+
+public class DeleteBranchCallable extends AbstractBranchCallable<ReadableBranch> {
+
+ private final BranchCache cache;
+ private final IOseeBranch toDelete;
+
+ public DeleteBranchCallable(Log logger, SessionContext sessionContext, BranchDataStore branchStore, BranchCache cache, IOseeBranch toDelete) {
+ super(logger, sessionContext, branchStore);
+ this.cache = cache;
+ this.toDelete = toDelete;
+ }
+
+ @Override
+ protected ReadableBranch innerCall() throws Exception {
+ Conditions.checkNotNull(cache, "branchCache");
+ Conditions.checkNotNull(toDelete, "toDelete");
+ Branch branch = cache.get(toDelete);
+
+ BranchState originalState = branch.getBranchState();
+ BranchArchivedState originalArchivedState = branch.getArchiveState();
+ try {
+ branch.setBranchState(BranchState.DELETED);
+ branch.setArchived(true);
+ cache.storeItems(branch);
+ } catch (Exception ex) {
+ branch.setBranchState(originalState);
+ branch.setArchived(originalArchivedState.isArchived());
+ throw ex;
+ } finally {
+ // OseeEventManager.kickBranchEvent(this, new BranchEvent(BranchEventType.Deleting, branch.getGuid()),
+ // branch.getId());
+ // TODO Event ?
+ }
+ return branch;
+ }
+}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/PurgeBranchCallable.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/PurgeBranchCallable.java
new file mode 100644
index 00000000000..d60d49eb654
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/PurgeBranchCallable.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.orcs.core.internal.branch;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.concurrent.Callable;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.model.ReadableBranch;
+import org.eclipse.osee.framework.core.model.cache.BranchCache;
+import org.eclipse.osee.framework.core.model.cache.BranchFilter;
+import org.eclipse.osee.framework.core.util.Conditions;
+import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.core.ds.BranchDataStore;
+import org.eclipse.osee.orcs.core.internal.SessionContext;
+import org.eclipse.osee.orcs.core.internal.branch.provider.BranchProvider;
+import org.eclipse.osee.orcs.core.internal.branch.provider.MultiBranchProvider;
+import org.eclipse.osee.orcs.core.internal.branch.provider.SingleBranchProvider;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class PurgeBranchCallable extends AbstractBranchCallable<List<ReadableBranch>> {
+
+ private final BranchCache branchCache;
+ private final IOseeBranch branchToken;
+ private final boolean isRecursive;
+
+ public PurgeBranchCallable(Log logger, SessionContext sessionContext, BranchDataStore branchStore, BranchCache branchCache, IOseeBranch branchToken, boolean isRecursive) {
+ super(logger, sessionContext, branchStore);
+ this.branchCache = branchCache;
+ this.branchToken = branchToken;
+ this.isRecursive = isRecursive;
+ }
+
+ private BranchProvider createProvider(Branch branch, boolean isRecursive) {
+ BranchProvider provider;
+ if (isRecursive) {
+ provider = new MultiBranchProvider(true, Collections.singleton(branch), new BranchFilter());
+ } else {
+ provider = new SingleBranchProvider(branch);
+ }
+ return provider;
+ }
+
+ @Override
+ protected List<ReadableBranch> innerCall() throws Exception {
+ Conditions.checkNotNull(branchCache, "branchCache");
+ Conditions.checkNotNull(branchToken, "branchToPurge");
+
+ Branch branch = branchCache.get(branchToken);
+
+ Conditions.checkNotNull(branch, "branchToPurge");
+
+ BranchProvider provider = createProvider(branch, isRecursive);
+
+ Collection<Branch> branches = provider.getBranches();
+ Conditions.checkNotNull(branches, "branchesToPurge");
+
+ List<ReadableBranch> purged = new LinkedList<ReadableBranch>();
+ List<Branch> orderedBranches = BranchUtil.orderByParent(branches);
+ for (Branch aBranch : orderedBranches) {
+ checkForCancelled();
+ Callable<Branch> callable = getBranchStore().purgeBranch(getSessionContext().getSessionId(), aBranch);
+ purged.add(callAndCheckForCancel(callable));
+ }
+ return purged;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/IBranchesProvider.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/provider/BranchProvider.java
index d8e8204baae..21540f601b9 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/IBranchesProvider.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/provider/BranchProvider.java
@@ -8,7 +8,7 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.branch.management.purge;
+package org.eclipse.osee.orcs.core.internal.branch.provider;
import java.util.Collection;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
@@ -17,6 +17,6 @@ import org.eclipse.osee.framework.core.model.Branch;
/**
* @author John Misinco
*/
-public interface IBranchesProvider {
+public interface BranchProvider {
Collection<Branch> getBranches() throws OseeCoreException;
}
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/DeletedBranchProvider.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/provider/DeletedBranchProvider.java
index 5eb712b1350..5455782430e 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/DeletedBranchProvider.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/provider/DeletedBranchProvider.java
@@ -8,7 +8,7 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.branch.management.purge;
+package org.eclipse.osee.orcs.core.internal.branch.provider;
import java.util.Collection;
import java.util.LinkedHashSet;
@@ -25,7 +25,7 @@ import org.eclipse.osee.framework.core.util.Conditions;
/**
* @author John Misinco
*/
-public final class DeletedBranchProvider implements IBranchesProvider {
+public final class DeletedBranchProvider implements BranchProvider {
private final BranchCache branchCache;
public DeletedBranchProvider(BranchCache branchCache) {
@@ -45,7 +45,6 @@ public final class DeletedBranchProvider implements IBranchesProvider {
for (Branch branch : branches) {
branch.getChildBranches(branchesToReturn, true, branchFilter);
}
-
return branchesToReturn;
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/MultiBranchProvider.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/provider/MultiBranchProvider.java
index 8892474ae93..b931d4d7f71 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/MultiBranchProvider.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/provider/MultiBranchProvider.java
@@ -8,7 +8,7 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.branch.management.purge;
+package org.eclipse.osee.orcs.core.internal.branch.provider;
import java.util.Collection;
import java.util.HashSet;
@@ -21,7 +21,7 @@ import org.eclipse.osee.framework.core.util.Conditions;
/**
* @author John Misinco
*/
-public class MultiBranchProvider implements IBranchesProvider {
+public class MultiBranchProvider implements BranchProvider {
private final boolean recursive;
private final Set<Branch> branches;
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/SingleBranchProvider.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/provider/SingleBranchProvider.java
index c709ee1cd48..2a256e03c1c 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/SingleBranchProvider.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/provider/SingleBranchProvider.java
@@ -8,7 +8,7 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.branch.management.purge;
+package org.eclipse.osee.orcs.core.internal.branch.provider;
import java.util.Collection;
import java.util.Collections;
@@ -17,7 +17,7 @@ import org.eclipse.osee.framework.core.model.Branch;
/**
* @author Ryan D. Brooks
*/
-public class SingleBranchProvider implements IBranchesProvider {
+public class SingleBranchProvider implements BranchProvider {
private final Branch branch;
public SingleBranchProvider(Branch branch) {
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/OrcsTransactionImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/OrcsTransactionImpl.java
new file mode 100644
index 00000000000..44b33d2fb30
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/OrcsTransactionImpl.java
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.orcs.core.internal.transaction;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.Callable;
+import org.eclipse.osee.executor.admin.CancellableCallable;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
+import org.eclipse.osee.framework.core.data.IRelationTypeSide;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.core.ds.BranchDataStore;
+import org.eclipse.osee.orcs.data.ReadableArtifact;
+import org.eclipse.osee.orcs.transaction.OrcsTransaction;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class OrcsTransactionImpl implements OrcsTransaction {
+
+ private final Log logger;
+ private final IOseeBranch branch;
+ private String txnComment;
+ private ReadableArtifact authorArtifact;
+ private final BranchDataStore dataStore;
+
+ private final List<Callable<?>> callables = new ArrayList<Callable<?>>();
+
+ public OrcsTransactionImpl(Log logger, BranchDataStore dataStore, IOseeBranch branch) {
+ super();
+ this.dataStore = dataStore;
+ this.logger = logger;
+ this.branch = branch;
+ }
+
+ public void setComment(String txnComment) {
+ this.txnComment = txnComment;
+ }
+
+ public void setAuthor(ReadableArtifact authorArtifact) {
+ this.authorArtifact = authorArtifact;
+ }
+
+ public ReadableArtifact getAuthor() {
+ return authorArtifact;
+ }
+
+ public String getComment() {
+ return txnComment;
+ }
+
+ private int getAuthorId() {
+ ReadableArtifact author = getAuthor();
+ int authorId = author != null ? author.getId() : -1;
+ return authorId;
+ }
+
+ @Override
+ public void deleteRelation(IRelationTypeSide relationType, int aArtId, int bArtId) {
+ callables.add(dataStore.deleteRelationTypeFromBranch(branch, relationType, aArtId, bArtId, getAuthorId(),
+ getComment()));
+ }
+
+ @Override
+ public Callable<?> build() {
+ return new CompositeCallable(logger, callables);
+ }
+
+ private static final class CompositeCallable extends CancellableCallable<Boolean> {
+
+ private final List<Callable<?>> callables;
+ private final Log logger;
+ private Callable<?> innerWorker;
+
+ public CompositeCallable(Log logger, List<Callable<?>> callables) {
+ super();
+ this.logger = logger;
+ this.callables = callables;
+ }
+
+ protected Log getLogger() {
+ return logger;
+ }
+
+ @Override
+ public final Boolean call() throws Exception {
+ long startTime = 0;
+ if (getLogger().isTraceEnabled()) {
+ startTime = System.currentTimeMillis();
+ }
+ try {
+ for (Callable<?> callable : callables) {
+ callAndCheckForCancel(callable);
+ }
+ } finally {
+ if (getLogger().isTraceEnabled()) {
+ getLogger().trace("Admin [%s] completed in [%s]", getClass().getSimpleName(),
+ Lib.getElapseString(startTime));
+ }
+ }
+ return Boolean.TRUE;
+ }
+
+ protected <K> K callAndCheckForCancel(Callable<K> callable) throws Exception {
+ checkForCancelled();
+ setInnerWorker(callable);
+ K result = callable.call();
+ setInnerWorker(null);
+ return result;
+ }
+
+ private synchronized void setInnerWorker(Callable<?> callable) {
+ innerWorker = callable;
+ }
+
+ @Override
+ public void setCancel(boolean isCancelled) {
+ super.setCancel(isCancelled);
+ final Callable<?> inner = innerWorker;
+ if (inner != null) {
+ synchronized (inner) {
+ if (inner instanceof CancellableCallable) {
+ ((CancellableCallable<?>) inner).setCancel(isCancelled);
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionFactoryImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionFactoryImpl.java
new file mode 100644
index 00000000000..bb0df87f3e3
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionFactoryImpl.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.orcs.core.internal.transaction;
+
+import org.eclipse.osee.framework.core.data.IOseeBranch;
+import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.core.ds.BranchDataStore;
+import org.eclipse.osee.orcs.core.internal.SessionContext;
+import org.eclipse.osee.orcs.data.ReadableArtifact;
+import org.eclipse.osee.orcs.transaction.OrcsTransaction;
+import org.eclipse.osee.orcs.transaction.TransactionFactory;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class TransactionFactoryImpl implements TransactionFactory {
+
+ private final Log logger;
+ private final SessionContext sessionContext;
+ private final BranchDataStore branchDataStore;
+
+ public TransactionFactoryImpl(Log logger, SessionContext sessionContext, BranchDataStore branchDataStore) {
+ this.logger = logger;
+ this.sessionContext = sessionContext;
+ this.branchDataStore = branchDataStore;
+ }
+
+ @Override
+ public OrcsTransaction createTransaction(IOseeBranch branch, String comment, ReadableArtifact userArtifact) {
+ OrcsTransactionImpl orcsTxn = new OrcsTransactionImpl(logger, branchDataStore, branch);
+ orcsTxn.setComment(comment);
+ orcsTxn.setAuthor(userArtifact);
+ return orcsTxn;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/change/ChangeTestSuite.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/ChangeTestSuite.java
index 48c9953837a..63076dc6a38 100644
--- a/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/change/ChangeTestSuite.java
+++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/ChangeTestSuite.java
@@ -8,18 +8,16 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.branch.management.test.change;
+package org.eclipse.osee.orcs.db.internal.change;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@RunWith(Suite.class)
-@Suite.SuiteClasses({//
-ComputeNetChangeTest.class, //
-})
+@Suite.SuiteClasses({ComputeNetChangeTest.class})
/**
* @author Roberto E. Escobar
*/
public class ChangeTestSuite {
-
+ // Test Suite
}
diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/ChangeTestUtility.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/ChangeTestUtility.java
new file mode 100644
index 00000000000..10a61647ab4
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/ChangeTestUtility.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * 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.orcs.db.internal.change;
+
+import org.eclipse.osee.framework.core.enums.ModificationType;
+import org.eclipse.osee.framework.core.model.change.ChangeItem;
+import org.eclipse.osee.framework.core.model.change.ChangeVersion;
+import org.junit.Assert;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public final class ChangeTestUtility {
+
+ private ChangeTestUtility() {
+ // Utility Class
+ }
+
+ public static ChangeVersion createChange(Long long1, ModificationType mod1) {
+ return new ChangeVersion(long1, mod1);
+ }
+
+ public static void checkChange(String message, ChangeVersion expected, ChangeVersion actual) {
+ Assert.assertEquals(message, expected.getGammaId(), actual.getGammaId());
+ Assert.assertEquals(message, expected.getModType(), actual.getModType());
+
+ Assert.assertEquals(message, expected.getValue(), actual.getValue());
+ }
+
+ public static void checkChange(ChangeVersion expected, ChangeVersion actual) {
+ checkChange(null, expected, actual);
+ }
+
+ public static ChangeItem createItem(int itemId, ChangeVersion base, ChangeVersion first, ChangeVersion current, ChangeVersion destination, ChangeVersion net) {
+ MockChangeItem change =
+ new MockChangeItem(itemId, itemId * 10, itemId * 100, current.getGammaId(), current.getModType());
+ if (base != null) {
+ change.getBaselineVersion().copy(base);
+ }
+ if (first != null) {
+ change.getFirstNonCurrentChange().copy(first);
+ }
+ if (destination != null) {
+ change.getDestinationVersion().copy(destination);
+ }
+ if (net != null) {
+ change.getNetChange().copy(net);
+ }
+ Assert.assertNotNull(change);
+ Assert.assertNotNull(change.getBaselineVersion());
+ Assert.assertNotNull(change.getFirstNonCurrentChange());
+ Assert.assertNotNull(change.getCurrentVersion());
+ Assert.assertNotNull(change.getDestinationVersion());
+ Assert.assertNotNull(change.getNetChange());
+ return change;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/change/ComputeNetChangeTest.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/ComputeNetChangeTest.java
index 620422e6e4b..501082ffe34 100644
--- a/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/change/ComputeNetChangeTest.java
+++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/ComputeNetChangeTest.java
@@ -8,7 +8,7 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.branch.management.test.change;
+package org.eclipse.osee.orcs.db.internal.change;
import static org.eclipse.osee.framework.core.enums.ModificationType.ARTIFACT_DELETED;
import static org.eclipse.osee.framework.core.enums.ModificationType.DELETED;
@@ -18,18 +18,16 @@ import static org.eclipse.osee.framework.core.enums.ModificationType.MODIFIED;
import static org.eclipse.osee.framework.core.enums.ModificationType.NEW;
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.osee.framework.branch.management.change.ComputeNetChangeOperation;
+import java.util.concurrent.Callable;
import org.eclipse.osee.framework.core.enums.ModificationType;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
import org.eclipse.osee.framework.core.model.change.ChangeItem;
import org.eclipse.osee.framework.core.model.change.ChangeVersion;
-import org.eclipse.osee.framework.core.model.mocks.ChangeTestUtility;
-import org.eclipse.osee.framework.core.test.mocks.Asserts;
import org.junit.Assert;
import org.junit.Test;
/**
- * Test Case for {@link ComputeNetChangeOperation}
+ * Test Case for {@link ComputeNetChangeCallable}
*
* @author Roberto E. Escobar
*/
@@ -94,13 +92,17 @@ public class ComputeNetChangeTest {
}
@Test
- public void testNetChange() {
+ public void testNetChange() throws Exception {
List<TestData> data = getTestData();
List<ChangeItem> items = new ArrayList<ChangeItem>();
for (TestData testData : data) {
items.add(testData.getItem());
}
- Asserts.testOperation(new ComputeNetChangeOperation(items), IStatus.OK);
+
+ Callable<List<ChangeItem>> callable = new ComputeNetChangeCallable(items);
+ List<ChangeItem> resultingItems = callable.call();
+
+ Assert.assertEquals(items, resultingItems);
for (int index = 0; index < data.size(); index++) {
TestData testData = data.get(index);
@@ -114,14 +116,15 @@ public class ComputeNetChangeTest {
}
}
- @Test
- public void testErrorStates() {
+ @Test(expected = OseeStateException.class)
+ public void testErrorStates() throws Exception {
List<ChangeItem> items = new ArrayList<ChangeItem>();
// Source to Non-Parent commit
items.add(ChangeTestUtility.createItem(3, entry(10L, MODIFIED), null, entry(11L, MODIFIED), null, null));
- Asserts.testOperation(new ComputeNetChangeOperation(items), IStatus.ERROR);
+ Callable<List<ChangeItem>> callable = new ComputeNetChangeCallable(items);
+ callable.call();
}
private static TestData createTest(int itemId, ChangeVersion base, ChangeVersion first, ChangeVersion current, ChangeVersion destination, ChangeVersion expected, boolean isRemoved) {
diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/MockChangeItem.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/MockChangeItem.java
new file mode 100644
index 00000000000..e04ebd81149
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/MockChangeItem.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * 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.orcs.db.internal.change;
+
+import org.eclipse.osee.framework.core.enums.ModificationType;
+import org.eclipse.osee.framework.core.model.change.ChangeItem;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class MockChangeItem extends ChangeItem {
+
+ public MockChangeItem(int itemId, int itemTypeId, int artId, long currentSourceGammaId, ModificationType currentSourceModType) {
+ super(itemId, itemTypeId, artId, currentSourceGammaId, currentSourceModType);
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.db/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.orcs.db/META-INF/MANIFEST.MF
index bbacd914dff..136be8b0fd9 100644
--- a/plugins/org.eclipse.osee.orcs.db/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.orcs.db/META-INF/MANIFEST.MF
@@ -6,13 +6,15 @@ Bundle-Version: 0.9.9.qualifier
Bundle-Vendor: Eclipse Open System Engineering Environment
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Service-Component: OSGI-INF/*.xml
-Import-Package: org.eclipse.osee.event,
+Import-Package: org.eclipse.osee.database.schema,
+ org.eclipse.osee.event,
org.eclipse.osee.executor.admin,
org.eclipse.osee.framework.core.data,
org.eclipse.osee.framework.core.enums,
org.eclipse.osee.framework.core.exception,
org.eclipse.osee.framework.core.model,
org.eclipse.osee.framework.core.model.cache,
+ org.eclipse.osee.framework.core.model.change,
org.eclipse.osee.framework.core.model.type,
org.eclipse.osee.framework.core.services,
org.eclipse.osee.framework.core.util,
@@ -21,6 +23,7 @@ Import-Package: org.eclipse.osee.event,
org.eclipse.osee.framework.jdk.core.type,
org.eclipse.osee.framework.jdk.core.util,
org.eclipse.osee.framework.jdk.core.util.io.xml,
+ org.eclipse.osee.framework.jdk.core.util.time,
org.eclipse.osee.framework.resource.management,
org.eclipse.osee.framework.resource.management.exception,
org.eclipse.osee.framework.resource.management.util,
@@ -31,6 +34,6 @@ Import-Package: org.eclipse.osee.event,
org.eclipse.osee.orcs.core.ds.criteria,
org.eclipse.osee.orcs.data,
org.eclipse.osee.orcs.search,
- org.osgi.framework;version="1.6.0"
+ org.osgi.framework
Bundle-ActivationPolicy: lazy
Require-Bundle: org.eclipse.core.runtime
diff --git a/plugins/org.eclipse.osee.orcs.db/OSGI-INF/branch.data.store.xml b/plugins/org.eclipse.osee.orcs.db/OSGI-INF/branch.data.store.xml
new file mode 100644
index 00000000000..28360800b0f
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.db/OSGI-INF/branch.data.store.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.osee.orcs.db.internal.branch.BranchDataStoreImpl">
+ <implementation class="org.eclipse.osee.orcs.db.internal.branch.BranchDataStoreImpl"/>
+ <service>
+ <provide interface="org.eclipse.osee.orcs.core.ds.BranchDataStore"/>
+ </service>
+ <reference bind="setLogger" cardinality="1..1" interface="org.eclipse.osee.logger.Log" name="Log" policy="static"/>
+ <reference bind="setDbService" cardinality="1..1" interface="org.eclipse.osee.framework.database.IOseeDatabaseService" name="IOseeDatabaseService" policy="static"/>
+ <reference bind="setCachingService" cardinality="1..1" interface="org.eclipse.osee.framework.core.services.IOseeCachingService" name="IOseeCachingService" policy="static"/>
+ <reference bind="setModelService" cardinality="1..1" interface="org.eclipse.osee.framework.core.services.IOseeModelFactoryService" name="IOseeModelFactoryService" policy="static"/>
+</scr:component>
diff --git a/plugins/org.eclipse.osee.orcs.db/OSGI-INF/data.store.admin.xml b/plugins/org.eclipse.osee.orcs.db/OSGI-INF/data.store.admin.xml
new file mode 100644
index 00000000000..c54b0e2e20f
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.db/OSGI-INF/data.store.admin.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.osee.orcs.db.internal.DataStoreAdminImpl">
+ <implementation class="org.eclipse.osee.orcs.db.internal.DataStoreAdminImpl"/>
+ <service>
+ <provide interface="org.eclipse.osee.orcs.core.ds.DataStoreAdmin"/>
+ </service>
+ <reference bind="setLogger" cardinality="1..1" interface="org.eclipse.osee.logger.Log" name="Log" policy="static"/>
+ <reference bind="setDbService" cardinality="1..1" interface="org.eclipse.osee.framework.database.IOseeDatabaseService" name="IOseeDatabaseService" policy="static"/>
+ <reference bind="setCacheService" cardinality="1..1" interface="org.eclipse.osee.framework.core.services.IOseeCachingService" name="IOseeCachingService" policy="static"/>
+ <reference bind="setBranchStore" cardinality="1..1" interface="org.eclipse.osee.orcs.core.ds.BranchDataStore" name="BranchDataStore" policy="static"/>
+ <reference bind="setSystemPreferences" cardinality="1..1" interface="org.eclipse.osee.orcs.core.SystemPreferences" name="SystemPreferences" policy="static"/>
+</scr:component>
diff --git a/plugins/org.eclipse.osee.orcs.db/OSGI-INF/osee.datastore.schema.resource.xml b/plugins/org.eclipse.osee.orcs.db/OSGI-INF/osee.datastore.schema.resource.xml
new file mode 100644
index 00000000000..bc7c61bb8eb
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.db/OSGI-INF/osee.datastore.schema.resource.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" enabled="true" name="org.eclipse.osee.orcs.db.internal.resource.OseeDatastoreSchemaResource">
+ <implementation
+ class="org.eclipse.osee.orcs.db.internal.resource.OseeDatastoreSchemaResource" />
+ <service>
+ <provide interface="org.eclipse.osee.database.schema.SchemaResource"/>
+ </service>
+</scr:component>
diff --git a/plugins/org.eclipse.osee.orcs.db/build.properties b/plugins/org.eclipse.osee.orcs.db/build.properties
index 938ccb26927..d1d6ed90773 100644
--- a/plugins/org.eclipse.osee.orcs.db/build.properties
+++ b/plugins/org.eclipse.osee.orcs.db/build.properties
@@ -1,8 +1,11 @@
-source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
- OSGI-INF/
+ OSGI-INF/,\
+ schema/,\
+ OSGI-INF/data.store.admin.xml,\
+ OSGI-INF/branch.data.store.xml
+source.. = src/
additional.bundles = org.eclipse.osee.framework.database,\
org.eclipse.osee.logger,\
org.eclipse.osee.orcs.core,\
@@ -12,4 +15,5 @@ additional.bundles = org.eclipse.osee.framework.database,\
org.eclipse.osee.framework.core.model,\
org.eclipse.osee.orcs,\
org.eclipse.osee.event,\
- org.eclipse.osee.executor.admin
+ org.eclipse.osee.executor.admin,\
+ org.eclipse.osee.database.schema
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/support/SKYNET.VERSIONING.SCHEMA.xml b/plugins/org.eclipse.osee.orcs.db/schema/SKYNET.VERSIONING.SCHEMA.xml
index 0c39834d368..0c39834d368 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/support/SKYNET.VERSIONING.SCHEMA.xml
+++ b/plugins/org.eclipse.osee.orcs.db/schema/SKYNET.VERSIONING.SCHEMA.xml
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/DataStoreAdminImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/DataStoreAdminImpl.java
new file mode 100644
index 00000000000..0c17fa69252
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/DataStoreAdminImpl.java
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * 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.orcs.db.internal;
+
+import java.util.Map;
+import java.util.concurrent.Callable;
+import org.eclipse.osee.database.schema.SchemaOptions;
+import org.eclipse.osee.database.schema.SchemaResourceProvider;
+import org.eclipse.osee.framework.core.services.IOseeCachingService;
+import org.eclipse.osee.framework.database.IOseeDatabaseService;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.core.SystemPreferences;
+import org.eclipse.osee.orcs.core.ds.BranchDataStore;
+import org.eclipse.osee.orcs.core.ds.DataStoreAdmin;
+import org.eclipse.osee.orcs.core.ds.DataStoreInfo;
+import org.eclipse.osee.orcs.db.internal.callable.InitializeDatastoreCallable;
+import org.eclipse.osee.orcs.db.internal.util.DynamicSchemaResourceProvider;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class DataStoreAdminImpl implements DataStoreAdmin {
+
+ private Log logger;
+ private IOseeDatabaseService dbService;
+ private IOseeCachingService cacheService;
+ private BranchDataStore branchStore;
+ private SystemPreferences preferences;
+
+ public void setLogger(Log logger) {
+ this.logger = logger;
+ }
+
+ public void setDbService(IOseeDatabaseService dbService) {
+ this.dbService = dbService;
+ }
+
+ public void setCacheService(IOseeCachingService cacheService) {
+ this.cacheService = cacheService;
+ }
+
+ public void setBranchStore(BranchDataStore branchStore) {
+ this.branchStore = branchStore;
+ }
+
+ public void setSystemPreferences(SystemPreferences preferences) {
+ this.preferences = preferences;
+ }
+
+ @Override
+ public Callable<DataStoreInfo> createDataStore(String sessionId, Map<String, String> parameters) {
+ String tableDataSpace = getOption(parameters, DataStoreConstants.SCHEMA_TABLE_DATA_NAMESPACE, "");
+ String indexDataSpace = getOption(parameters, DataStoreConstants.SCHEMA_INDEX_DATA_NAMESPACE, "");
+ boolean useFileSpecifiedSchemas =
+ getOption(parameters, DataStoreConstants.SCHEMA_USER_FILE_SPECIFIED_NAMESPACE, false);
+
+ SchemaResourceProvider schemaProvider = new DynamicSchemaResourceProvider(logger);
+
+ SchemaOptions options = new SchemaOptions(tableDataSpace, indexDataSpace, useFileSpecifiedSchemas);
+ return new InitializeDatastoreCallable(logger, dbService, cacheService, branchStore, preferences, schemaProvider,
+ options);
+ }
+
+ @Override
+ public Callable<DataStoreInfo> getDataStoreInfo(String sessionId) {
+ DataStoreInfo dataStoreInfo = null;
+ // StringWriter writer = new StringWriter();
+ // IOseeSchemaProvider schemaProvider = new OseeSchemaProvider();
+ // for (IOseeSchemaResource resource : schemaProvider.getSchemaResources()) {
+ // InputStream inputStream = null;
+ // try {
+ // inputStream = new BufferedInputStream(resource.getContent());
+ // writer.write(Lib.inputStreamToString(inputStream));
+ //
+ // }
+
+ return null;
+ }
+
+ private boolean getOption(Map<String, String> parameters, String key, boolean defaultValue) {
+ boolean toReturn = defaultValue;
+ String value = parameters.get(key);
+ if (Strings.isValid(value)) {
+ toReturn = Boolean.parseBoolean(value);
+ }
+ return toReturn;
+ }
+
+ private String getOption(Map<String, String> parameters, String key, String defaultValue) {
+ String toReturn = defaultValue;
+ String value = parameters.get(key);
+ if (Strings.isValid(value)) {
+ toReturn = value;
+ }
+ return toReturn;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/DataStoreConstants.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/DataStoreConstants.java
new file mode 100644
index 00000000000..ea25699e773
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/DataStoreConstants.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.orcs.db.internal;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public final class DataStoreConstants {
+
+ private DataStoreConstants() {
+ // Constants class
+ }
+
+ public static final String SCHEMA_TABLE_DATA_NAMESPACE = "schema.table.data.namespace";
+ public static final String SCHEMA_INDEX_DATA_NAMESPACE = "schema.index.data.namespace";
+ public static final String SCHEMA_USER_FILE_SPECIFIED_NAMESPACE = "schema.user.file.specified.schema.names";
+
+}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/DatabaseBranchAccessor.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/DatabaseBranchAccessor.java
index 6ecdfe375c5..b1619a5107b 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/DatabaseBranchAccessor.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/DatabaseBranchAccessor.java
@@ -40,7 +40,7 @@ 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.logger.Log;
-import org.eclipse.osee.orcs.db.internal.callable.StoreBranchCallable;
+import org.eclipse.osee.orcs.db.internal.callable.StoreBranchDatabaseCallable;
/**
* @author Roberto E. Escobar
@@ -200,8 +200,9 @@ public class DatabaseBranchAccessor implements IOseeDataAccessor<String, Branch>
@Override
public void store(Collection<Branch> branches) throws OseeCoreException {
- StoreBranchCallable task =
- new StoreBranchCallable(getDatabaseService(), getExecutorAdmin(), getEventService(), branches);
+ StoreBranchDatabaseCallable task =
+ new StoreBranchDatabaseCallable(getLogger(), getDatabaseService(), getExecutorAdmin(), getEventService(),
+ branches);
try {
Future<IStatus> future = getExecutorAdmin().schedule(task);
IStatus status = future.get();
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/change/DatabaseOseeConflictAccessor.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/DatabaseConflictAccessor.java
index c4ba7c977d2..27de85e666e 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/change/DatabaseOseeConflictAccessor.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/DatabaseConflictAccessor.java
@@ -9,7 +9,7 @@
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.branch.management.change;
+package org.eclipse.osee.orcs.db.internal.accessor;
import java.util.ArrayList;
import java.util.Collection;
@@ -20,13 +20,13 @@ import org.eclipse.osee.framework.core.enums.StorageState;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.MergeBranch;
import org.eclipse.osee.framework.database.IOseeDatabaseService;
-import org.eclipse.osee.framework.database.IOseeDatabaseServiceProvider;
import org.eclipse.osee.framework.database.core.IOseeStatement;
+import org.eclipse.osee.orcs.db.internal.conflict.Conflict;
/**
* @author Roberto E. Escobar
*/
-public class DatabaseOseeConflictAccessor {
+public class DatabaseConflictAccessor {
private static final String INSERT_CONFLICT =
"INSERT INTO osee_conflict (conflict_id, merge_branch_id, source_gamma_id, dest_gamma_id, status, conflict_type) VALUES (?,?,?,?,?,?)";
@@ -37,14 +37,14 @@ public class DatabaseOseeConflictAccessor {
private static final String SELECT_CONFLICTS = "SELECT * FROM osee_conflict WHERE merge_branch_id = ?";
- private final IOseeDatabaseServiceProvider databaseProvider;
+ private final IOseeDatabaseService dbService;
- public DatabaseOseeConflictAccessor(IOseeDatabaseServiceProvider databaseProvider) {
- this.databaseProvider = databaseProvider;
+ public DatabaseConflictAccessor(IOseeDatabaseService dbService) {
+ this.dbService = dbService;
}
- public IOseeDatabaseService getDatabaseService() throws OseeCoreException {
- return databaseProvider.getOseeDatabaseService();
+ public IOseeDatabaseService getDatabaseService() {
+ return dbService;
}
public void load(Collection<Conflict> conflicts, MergeBranch mergeBranch) throws OseeCoreException {
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/commit/UpdatePreviousTxCurrent.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/UpdatePreviousTxCurrent.java
index b490efdb9bd..ddb665622f9 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/commit/UpdatePreviousTxCurrent.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/UpdatePreviousTxCurrent.java
@@ -8,15 +8,14 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.branch.management.commit;
+package org.eclipse.osee.orcs.db.internal.accessor;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.osee.framework.core.enums.TxChange;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
+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;
@@ -28,35 +27,39 @@ import org.eclipse.osee.framework.database.core.OseeConnection;
public class UpdatePreviousTxCurrent {
private static final String UPDATE_TXS_NOT_CURRENT =
"update osee_txs SET tx_current = " + TxChange.NOT_CURRENT.getValue() + " where branch_id = ? AND gamma_id = ? and tx_current <> ? and transaction_id = ?";
+ private static final String SELECT_TXS_AND_GAMMAS =
+ "SELECT txs.transaction_id, txs.gamma_id FROM osee_join_id idj, %s item, osee_txs txs WHERE idj.query_id = ? and idj.id = item.%s AND item.gamma_id = txs.gamma_id AND txs.branch_id = ?";
+ private final IOseeDatabaseService dbService;
private final Branch branch;
private final OseeConnection connection;
private IdJoinQuery artifactJoin;
private IdJoinQuery attributeJoin;
private IdJoinQuery relationJoin;
- public UpdatePreviousTxCurrent(Branch branch, OseeConnection connection) {
+ public UpdatePreviousTxCurrent(IOseeDatabaseService dbService, Branch branch, OseeConnection connection) {
+ this.dbService = dbService;
this.branch = branch;
this.connection = connection;
}
- public void addAttribute(int attributeId) throws OseeDataStoreException {
+ public void addAttribute(int attributeId) {
if (attributeJoin == null) {
- attributeJoin = JoinUtility.createIdJoinQuery();
+ attributeJoin = JoinUtility.createIdJoinQuery(dbService);
}
attributeJoin.add(attributeId);
}
- public void addArtifact(int artifactId) throws OseeDataStoreException {
+ public void addArtifact(int artifactId) {
if (artifactJoin == null) {
- artifactJoin = JoinUtility.createIdJoinQuery();
+ artifactJoin = JoinUtility.createIdJoinQuery(dbService);
}
artifactJoin.add(artifactId);
}
- public void addRelation(int relationId) throws OseeDataStoreException {
+ public void addRelation(int relationId) {
if (relationJoin == null) {
- relationJoin = JoinUtility.createIdJoinQuery();
+ relationJoin = JoinUtility.createIdJoinQuery(dbService);
}
relationJoin.add(relationId);
}
@@ -76,11 +79,10 @@ public class UpdatePreviousTxCurrent {
}
private void updateNoLongerCurrentGammas(String tableName, String columnName, int queryId) throws OseeCoreException {
- List<Object[]> updateData = new ArrayList<Object[]>();
- IOseeStatement chStmt = ConnectionHandler.getStatement(connection);
- String query =
- "SELECT txs.transaction_id, txs.gamma_id FROM osee_join_id idj, " + tableName + " item, osee_txs txs WHERE idj.query_id = ? and idj.id = item." + columnName + " AND item.gamma_id = txs.gamma_id AND txs.branch_id = ?";
+ String query = String.format(SELECT_TXS_AND_GAMMAS, tableName, columnName);
+ List<Object[]> updateData = new ArrayList<Object[]>();
+ IOseeStatement chStmt = dbService.getStatement(connection);
try {
chStmt.runPreparedQuery(10000, query, queryId, branch.getId());
while (chStmt.next()) {
@@ -94,6 +96,6 @@ public class UpdatePreviousTxCurrent {
chStmt.close();
}
- ConnectionHandler.runBatchUpdate(connection, UPDATE_TXS_NOT_CURRENT, updateData);
+ dbService.runBatchUpdate(connection, UPDATE_TXS_NOT_CURRENT, updateData);
}
}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/branch/BranchDataStoreImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/branch/BranchDataStoreImpl.java
new file mode 100644
index 00000000000..33350d860bc
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/branch/BranchDataStoreImpl.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.orcs.db.internal.branch;
+
+import java.util.List;
+import java.util.concurrent.Callable;
+import org.eclipse.osee.framework.core.data.IRelationTypeSide;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.model.TransactionRecord;
+import org.eclipse.osee.framework.core.model.change.ChangeItem;
+import org.eclipse.osee.framework.core.services.IOseeCachingService;
+import org.eclipse.osee.framework.core.services.IOseeModelFactoryService;
+import org.eclipse.osee.framework.database.IOseeDatabaseService;
+import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.core.ds.BranchDataStore;
+import org.eclipse.osee.orcs.data.CreateBranchData;
+import org.eclipse.osee.orcs.data.ReadableArtifact;
+import org.eclipse.osee.orcs.db.internal.callable.CommitBranchDatabaseCallable;
+import org.eclipse.osee.orcs.db.internal.callable.CompareDatabaseCallable;
+import org.eclipse.osee.orcs.db.internal.callable.CreateBranchDatabaseCallable;
+import org.eclipse.osee.orcs.db.internal.callable.DeleteRelationDatabaseCallable;
+import org.eclipse.osee.orcs.db.internal.callable.PurgeBranchDatabaseCallable;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class BranchDataStoreImpl implements BranchDataStore {
+
+ private Log logger;
+ private IOseeDatabaseService dbService;
+ private IOseeCachingService cachingService;
+ private IOseeModelFactoryService modelFactory;
+
+ public void setLogger(Log logger) {
+ this.logger = logger;
+ }
+
+ public void setDbService(IOseeDatabaseService dbService) {
+ this.dbService = dbService;
+ }
+
+ public void setCachingService(IOseeCachingService cachingService) {
+ this.cachingService = cachingService;
+ }
+
+ public void setModelService(IOseeModelFactoryService modelFactory) {
+ this.modelFactory = modelFactory;
+ }
+
+ @Override
+ public Callable<Branch> createBranch(String sessionId, CreateBranchData branchData) {
+ return new CreateBranchDatabaseCallable(logger, dbService, cachingService.getBranchCache(),
+ cachingService.getTransactionCache(), modelFactory.getBranchFactory(), modelFactory.getTransactionFactory(),
+ branchData);
+ }
+
+ @Override
+ public Callable<TransactionRecord> commitBranch(String sessionId, ReadableArtifact committer, Branch source, Branch destination) {
+ return new CommitBranchDatabaseCallable(logger, dbService, cachingService.getBranchCache(),
+ cachingService.getTransactionCache(), modelFactory.getTransactionFactory(), committer, source, destination);
+ }
+
+ @Override
+ public Callable<Branch> purgeBranch(String sessionId, Branch branch) {
+ return new PurgeBranchDatabaseCallable(logger, dbService, cachingService.getBranchCache(), branch);
+ }
+
+ @Override
+ public Callable<List<ChangeItem>> compareBranch(String sessionId, TransactionRecord sourceTx, TransactionRecord destinationTx) {
+ return new CompareDatabaseCallable(logger, dbService, cachingService.getBranchCache(),
+ cachingService.getTransactionCache(), sourceTx, destinationTx);
+ }
+
+ @Override
+ public Callable<Branch> deleteRelationTypeFromBranch(IOseeBranch branch, IRelationTypeSide relationType, int aArtId, int bArtId, int artUserId, String comment) {
+ return new DeleteRelationDatabaseCallable(logger, dbService, identityService, cachingService.getBranchCache(),
+ branch, relationType, aArtId, bArtId, artUserId, comment);
+ }
+}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/branch/BranchUpdateEventImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/branch/BranchUpdateEventImpl.java
new file mode 100644
index 00000000000..abf0e9fe28b
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/branch/BranchUpdateEventImpl.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * 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.orcs.db.internal.branch;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class BranchUpdateEventImpl {
+
+ // 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.orcs.db/src/org/eclipse/osee/orcs/db/internal/branch/CreateDatabaseBranch.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/branch/CreateDatabaseBranch.java
new file mode 100644
index 00000000000..78949682920
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/branch/CreateDatabaseBranch.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * 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.orcs.db.internal.branch;
+
+import org.eclipse.osee.framework.core.enums.BranchType;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class CreateDatabaseBranch {
+ private final String branchName;
+ private final int parentBranchId;
+ private final int associatedArtifactId;
+
+ private final BranchType branchType;
+ private final int sourceTransactionId;
+ private final String branchGuid;
+
+ private final int authorId;
+
+ private final String creationComment;
+ private final int populateBaseTxFromAddressingQueryId;
+ private final int destinationBranchId;
+
+ public CreateDatabaseBranch(BranchType branchType, int sourceTransactionId, int parentBranchId, String branchGuid, String branchName, int associatedArtifactId, int authorId, String creationComment, int populateBaseTxFromAddressingQueryId, int destinationBranchId) {
+ this.parentBranchId = parentBranchId;
+ this.branchName = branchName;
+ this.associatedArtifactId = associatedArtifactId;
+ this.branchType = branchType;
+ this.sourceTransactionId = sourceTransactionId;
+ this.branchGuid = branchGuid;
+ this.authorId = authorId;
+ this.creationComment = creationComment;
+ this.populateBaseTxFromAddressingQueryId = populateBaseTxFromAddressingQueryId;
+ this.destinationBranchId = destinationBranchId;
+ }
+
+ public String getBranchName() {
+ return branchName;
+ }
+
+ public int getParentBranchId() {
+ return parentBranchId;
+ }
+
+ public int getAssociatedArtifactId() {
+ return associatedArtifactId;
+ }
+
+ public BranchType getBranchType() {
+ return branchType;
+ }
+
+ public int getSourceTransactionId() {
+ return sourceTransactionId;
+ }
+
+ public String getBranchGuid() {
+ return branchGuid;
+ }
+
+ public int getAuthorId() {
+ return authorId;
+ }
+
+ public String getCreationComment() {
+ return creationComment;
+ }
+
+ public int getPopulateBaseTxFromAddressingQueryId() {
+ return populateBaseTxFromAddressingQueryId;
+ }
+
+ public int getDestinationBranchId() {
+ return destinationBranchId;
+ }
+
+ @Override
+ public String toString() {
+ return "Branch [associatedArtifactId=" + associatedArtifactId + ", branchGuid=" + branchGuid + ", branchType=" + branchType + ", name=" + branchName + ", parentBranchId=" + parentBranchId + ", parentTransactionId=" + sourceTransactionId + "]";
+ }
+}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CommitBranchDatabaseCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CommitBranchDatabaseCallable.java
new file mode 100644
index 00000000000..3044cfc4492
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CommitBranchDatabaseCallable.java
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * 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.orcs.db.internal.callable;
+
+import java.util.List;
+import java.util.concurrent.Callable;
+import org.eclipse.osee.database.schema.DatabaseCallable;
+import org.eclipse.osee.executor.admin.CancellableCallable;
+import org.eclipse.osee.framework.core.enums.TransactionVersion;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.model.TransactionDelta;
+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.TransactionCache;
+import org.eclipse.osee.framework.core.model.change.ChangeItem;
+import org.eclipse.osee.framework.database.IOseeDatabaseService;
+import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.data.ReadableArtifact;
+import org.eclipse.osee.orcs.db.internal.change.ComputeNetChangeCallable;
+import org.eclipse.osee.orcs.db.internal.change.LoadDeltasBetweenBranches;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class CommitBranchDatabaseCallable extends DatabaseCallable<TransactionRecord> {
+
+ private final TransactionRecordFactory txFactory;
+ private final TransactionCache txCache;
+ private final BranchCache branchCache;
+ private final ReadableArtifact committer;
+ private final Branch source;
+ private final Branch destination;
+
+ public CommitBranchDatabaseCallable(Log logger, IOseeDatabaseService service, BranchCache branchCache, TransactionCache txCache, TransactionRecordFactory txFactory, ReadableArtifact committer, Branch source, Branch destination) {
+ super(logger, service);
+ this.branchCache = branchCache;
+ this.txCache = txCache;
+ this.txFactory = txFactory;
+ this.committer = committer;
+ this.source = source;
+ this.destination = destination;
+ }
+
+ private TransactionCache getTxCache() {
+ return txCache;
+ }
+
+ private BranchCache getBranchCache() {
+ return branchCache;
+ }
+
+ private TransactionRecordFactory getTxFactory() {
+ return txFactory;
+ }
+
+ private TransactionRecord getHeadTx(Branch branch) throws OseeCoreException {
+ return getTxCache().getTransaction(branch, TransactionVersion.HEAD);
+ }
+
+ private Branch getMergeBranch(Branch sourceBranch, Branch destinationBranch) throws OseeCoreException {
+ return getBranchCache().findMergeBranch(sourceBranch, destinationBranch);
+ }
+
+ private TransactionRecord getMergeTx(Branch mergeBranch) throws OseeCoreException {
+ return mergeBranch != null ? getTxCache().getTransaction(mergeBranch, TransactionVersion.HEAD) : null;
+ }
+
+ private int getUserArtId() {
+ return committer != null ? committer.getId() : -1;
+ }
+
+ private List<ChangeItem> callComputeChanges(TransactionDelta txDelta, TransactionRecord mergeTx) throws Exception {
+ Callable<List<ChangeItem>> loadChanges =
+ new LoadDeltasBetweenBranches(getLogger(), getDatabaseService(), txDelta, mergeTx);
+ List<ChangeItem> changes = callAndCheckForCancel(loadChanges);
+
+ Callable<List<ChangeItem>> computeChanges = new ComputeNetChangeCallable(changes);
+ return callAndCheckForCancel(computeChanges);
+ }
+
+ @Override
+ public TransactionRecord call() throws Exception {
+ TransactionRecord sourceTx = getHeadTx(source);
+ TransactionRecord destinationTx = getHeadTx(destination);
+
+ TransactionDelta txDelta = new TransactionDelta(sourceTx, destinationTx);
+
+ Branch mergeBranch = getMergeBranch(source, destination);
+ TransactionRecord mergeTx = getMergeTx(mergeBranch);
+
+ List<ChangeItem> changes = callComputeChanges(txDelta, mergeTx);
+
+ CancellableCallable<TransactionRecord> commitCallable =
+ new CommitBranchDatabaseTxCallable(getLogger(), getDatabaseService(), getBranchCache(), getUserArtId(),
+ source, destination, mergeBranch, changes, getTxFactory());
+ TransactionRecord commitTransaction = callAndCheckForCancel(commitCallable);
+
+ getTxCache().cache(commitTransaction);
+
+ return commitTransaction;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/commit/CommitDbOperation.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CommitBranchDatabaseTxCallable.java
index c1cc1abb791..2e44796b1cc 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/commit/CommitDbOperation.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CommitBranchDatabaseTxCallable.java
@@ -8,7 +8,7 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.branch.management.commit;
+package org.eclipse.osee.orcs.db.internal.callable;
import java.sql.Timestamp;
import java.util.ArrayList;
@@ -16,9 +16,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
-import java.util.logging.Level;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.branch.management.internal.Activator;
+import org.eclipse.osee.database.schema.DatabaseTxCallable;
import org.eclipse.osee.framework.core.enums.BranchState;
import org.eclipse.osee.framework.core.enums.ConflictStatus;
import org.eclipse.osee.framework.core.enums.ModificationType;
@@ -26,25 +24,24 @@ import org.eclipse.osee.framework.core.enums.TransactionDetailsType;
import org.eclipse.osee.framework.core.enums.TxChange;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeStateException;
-import org.eclipse.osee.framework.core.message.BranchCommitResponse;
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.change.ArtifactChangeItem;
import org.eclipse.osee.framework.core.model.change.AttributeChangeItem;
import org.eclipse.osee.framework.core.model.change.ChangeItem;
import org.eclipse.osee.framework.core.model.change.RelationChangeItem;
-import org.eclipse.osee.framework.core.services.IOseeModelFactoryServiceProvider;
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.jdk.core.util.time.GlobalTime;
-import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.db.internal.accessor.UpdatePreviousTxCurrent;
/**
* @author Ryan D. Brooks
*/
-public class CommitDbOperation extends AbstractDbTxOperation {
+public class CommitBranchDatabaseTxCallable extends DatabaseTxCallable<TransactionRecord> {
private static final String COMMIT_COMMENT = "Commit Branch ";
private static final String INSERT_COMMIT_TRANSACTION =
@@ -71,14 +68,13 @@ public class CommitDbOperation extends AbstractDbTxOperation {
private final Branch destinationBranch;
private final Branch mergeBranch;
private final List<ChangeItem> changes;
- private final BranchCommitResponse txHolder;
- private final IOseeModelFactoryServiceProvider modelFactory;
+ private final TransactionRecordFactory txFactory;
private OseeConnection connection;
private boolean success;
- public CommitDbOperation(IOseeDatabaseService databaseService, BranchCache branchCache, int userArtId, Branch sourceBranch, Branch destinationBranch, Branch mergeBranch, List<ChangeItem> changes, BranchCommitResponse txHolder, IOseeModelFactoryServiceProvider modelFactory) {
- super(databaseService, "Commit Database Operation", Activator.PLUGIN_ID);
+ public CommitBranchDatabaseTxCallable(Log logger, IOseeDatabaseService databaseService, BranchCache branchCache, int userArtId, Branch sourceBranch, Branch destinationBranch, Branch mergeBranch, List<ChangeItem> changes, TransactionRecordFactory txFactory) {
+ super(logger, databaseService, "Commit branch");
this.savedBranchStates = new HashMap<Branch, BranchState>();
this.branchCache = branchCache;
this.userArtId = userArtId;
@@ -86,8 +82,7 @@ public class CommitDbOperation extends AbstractDbTxOperation {
this.destinationBranch = destinationBranch;
this.mergeBranch = mergeBranch;
this.changes = changes;
- this.txHolder = txHolder;
- this.modelFactory = modelFactory;
+ this.txFactory = txFactory;
this.success = true;
savedBranchStates.put(sourceBranch, sourceBranch.getBranchState());
@@ -95,7 +90,7 @@ public class CommitDbOperation extends AbstractDbTxOperation {
}
@Override
- protected void doTxWork(IProgressMonitor monitor, OseeConnection connection) throws OseeCoreException {
+ protected TransactionRecord handleTxWork(OseeConnection connection) throws OseeCoreException {
BranchState storedBranchState;
this.connection = connection;
if (changes.isEmpty()) {
@@ -104,21 +99,21 @@ public class CommitDbOperation extends AbstractDbTxOperation {
storedBranchState = sourceBranch.getBranchState();
checkPreconditions();
+ TransactionRecord newTx = null;
try {
- txHolder.setTransaction(addCommitTransactionToDatabase(userArtId));
+ newTx = addCommitTransactionToDatabase(userArtId);
updatePreviousCurrentsOnDestinationBranch();
- insertCommitAddressing();
- updateMergeBranchCommitTx();
+ insertCommitAddressing(newTx);
+
+ getDatabaseService().runPreparedUpdate(connection, UPDATE_MERGE_COMMIT_TX, newTx.getId(),
+ sourceBranch.getId(), destinationBranch.getId());
+
manageBranchStates();
} catch (OseeCoreException ex) {
updateBranchState(storedBranchState);
throw ex;
}
- }
-
- private void updateMergeBranchCommitTx() throws OseeCoreException {
- getDatabaseService().runPreparedUpdate(connection, UPDATE_MERGE_COMMIT_TX, txHolder.getTransaction().getId(),
- sourceBranch.getId(), destinationBranch.getId());
+ return newTx;
}
public synchronized void checkPreconditions() throws OseeCoreException {
@@ -140,7 +135,8 @@ public class CommitDbOperation extends AbstractDbTxOperation {
}
private void updatePreviousCurrentsOnDestinationBranch() throws OseeCoreException {
- UpdatePreviousTxCurrent updater = new UpdatePreviousTxCurrent(destinationBranch, connection);
+ UpdatePreviousTxCurrent updater =
+ new UpdatePreviousTxCurrent(getDatabaseService(), destinationBranch, connection);
for (ChangeItem change : changes) {
if (change instanceof ArtifactChangeItem) {
updater.addArtifact(change.getItemId());
@@ -166,19 +162,18 @@ public class CommitDbOperation extends AbstractDbTxOperation {
TransactionDetailsType.NonBaselined.getId(), destinationBranch.getId(), newTransactionNumber, comment,
timestamp, userArtId, sourceBranch.getAssociatedArtifactId());
TransactionRecord record =
- modelFactory.getOseeFactoryService().getTransactionFactory().create(newTransactionNumber,
- destinationBranch.getId(), comment, timestamp, userArtId, sourceBranch.getAssociatedArtifactId(),
- TransactionDetailsType.NonBaselined);
+ txFactory.create(newTransactionNumber, destinationBranch.getId(), comment, timestamp, userArtId,
+ sourceBranch.getAssociatedArtifactId(), TransactionDetailsType.NonBaselined);
return record;
}
- private void insertCommitAddressing() throws OseeCoreException {
+ private void insertCommitAddressing(TransactionRecord newTx) throws OseeCoreException {
List<Object[]> insertData = new ArrayList<Object[]>();
for (ChangeItem change : changes) {
ModificationType modType = change.getNetChange().getModType();
insertData.add(new Object[] {
- txHolder.getTransaction().getId(),
+ newTx.getId(),
destinationBranch.getId(),
change.getNetChange().getGammaId(),
modType.getValue(),
@@ -203,7 +198,7 @@ public class CommitDbOperation extends AbstractDbTxOperation {
}
@Override
- protected void handleTxException(IProgressMonitor monitor, Exception ex) {
+ protected void handleTxException(Exception ex) {
success = false;
// Restore Original Branch States
try {
@@ -212,12 +207,12 @@ public class CommitDbOperation extends AbstractDbTxOperation {
}
branchCache.storeItems(savedBranchStates.keySet());
} catch (OseeCoreException ex1) {
- OseeLog.log(Activator.class, Level.SEVERE, ex1);
+ getLogger().error(ex1, "Error during branch commit of [%s] into [%s]", sourceBranch, destinationBranch);
}
}
@Override
- protected void handleTxFinally(IProgressMonitor monitor) throws OseeCoreException {
+ protected void handleTxFinally() throws OseeCoreException {
if (success) {
// update conflict status, if necessary
if (mergeBranch != null) {
@@ -226,4 +221,5 @@ public class CommitDbOperation extends AbstractDbTxOperation {
}
}
}
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CompareDatabaseCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CompareDatabaseCallable.java
new file mode 100644
index 00000000000..20ed8512efa
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CompareDatabaseCallable.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.orcs.db.internal.callable;
+
+import java.util.List;
+import java.util.concurrent.Callable;
+import org.eclipse.osee.database.schema.DatabaseCallable;
+import org.eclipse.osee.framework.core.enums.TransactionVersion;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.model.TransactionDelta;
+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.TransactionCache;
+import org.eclipse.osee.framework.core.model.change.ChangeItem;
+import org.eclipse.osee.framework.database.IOseeDatabaseService;
+import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.db.internal.change.AddArtifactChangeDataCallable;
+import org.eclipse.osee.orcs.db.internal.change.ComputeNetChangeCallable;
+import org.eclipse.osee.orcs.db.internal.change.LoadDeltasBetweenBranches;
+import org.eclipse.osee.orcs.db.internal.change.LoadDeltasBetweenTxsOnTheSameBranch;
+
+public class CompareDatabaseCallable extends DatabaseCallable<List<ChangeItem>> {
+
+ private final TransactionCache txCache;
+ private final BranchCache branchCache;
+ private final TransactionRecord sourceTx;
+ private final TransactionRecord destinationTx;
+
+ public CompareDatabaseCallable(Log logger, IOseeDatabaseService service, BranchCache branchCache, TransactionCache txCache, TransactionRecord sourceTx, TransactionRecord destinationTx) {
+ super(logger, service);
+ this.branchCache = branchCache;
+ this.txCache = txCache;
+ this.sourceTx = sourceTx;
+ this.destinationTx = destinationTx;
+ }
+
+ private TransactionCache getTxCache() {
+ return txCache;
+ }
+
+ private BranchCache getBranchCache() {
+ return branchCache;
+ }
+
+ @Override
+ public List<ChangeItem> call() throws Exception {
+ TransactionDelta txDelta = new TransactionDelta(sourceTx, destinationTx);
+
+ Callable<List<ChangeItem>> callable;
+ if (txDelta.areOnTheSameBranch()) {
+ callable = new LoadDeltasBetweenTxsOnTheSameBranch(getLogger(), getDatabaseService(), txDelta);
+ } else {
+ TransactionRecord mergeTx = getMergeTransaction(sourceTx, destinationTx);
+ callable = new LoadDeltasBetweenBranches(getLogger(), getDatabaseService(), txDelta, mergeTx);
+ }
+ List<ChangeItem> changes = callAndCheckForCancel(callable);
+
+ Callable<List<ChangeItem>> computeChanges = new ComputeNetChangeCallable(changes);
+ changes = callAndCheckForCancel(computeChanges);
+
+ Callable<List<ChangeItem>> addArtifactData = new AddArtifactChangeDataCallable(changes);
+ return callAndCheckForCancel(addArtifactData);
+ }
+
+ private TransactionRecord getMergeTransaction(TransactionRecord sourceTx, TransactionRecord destinationTx) throws OseeCoreException {
+ Branch mergeBranch = getBranchCache().findMergeBranch(sourceTx.getBranch(), destinationTx.getBranch());
+ return mergeBranch != null ? getTxCache().getTransaction(mergeBranch, TransactionVersion.HEAD) : null;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CreateBranchDatabaseCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CreateBranchDatabaseCallable.java
new file mode 100644
index 00000000000..9c95cb915a9
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CreateBranchDatabaseCallable.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * 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.orcs.db.internal.callable;
+
+import java.util.concurrent.Callable;
+import org.eclipse.osee.database.schema.DatabaseCallable;
+import org.eclipse.osee.framework.core.data.ITransaction;
+import org.eclipse.osee.framework.core.enums.BranchType;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.model.BranchFactory;
+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.TransactionCache;
+import org.eclipse.osee.framework.database.IOseeDatabaseService;
+import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.data.CreateBranchData;
+import org.eclipse.osee.orcs.data.ReadableArtifact;
+import org.eclipse.osee.orcs.db.internal.branch.CreateDatabaseBranch;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class CreateBranchDatabaseCallable extends DatabaseCallable<Branch> {
+
+ private static final int NULL_PARENT_BRANCH_ID = -1;
+ private static final int NULL_SOURCE_TRANSACTION_ID = -1;
+ private static final int NULL_ARTIFACT_ID = -1;
+
+ private final BranchCache branchCache;
+ private final TransactionCache txCache;
+ private final BranchFactory branchFactory;
+ private final TransactionRecordFactory txFactory;
+ private final CreateBranchData branchData;
+
+ public CreateBranchDatabaseCallable(Log logger, IOseeDatabaseService service, BranchCache branchCache, TransactionCache txCache, BranchFactory branchFactory, TransactionRecordFactory txFactory, CreateBranchData branchData) {
+ super(logger, service);
+ this.branchCache = branchCache;
+ this.txCache = txCache;
+ this.branchFactory = branchFactory;
+ this.txFactory = txFactory;
+ this.branchData = branchData;
+ }
+
+ private TransactionCache getTxCache() {
+ return txCache;
+ }
+
+ private BranchCache getBranchCache() {
+ return branchCache;
+ }
+
+ private int toArtId(ReadableArtifact artifact) {
+ int result = NULL_ARTIFACT_ID;
+ if (artifact != null) {
+ result = artifact.getId();
+ }
+ return result;
+ }
+
+ @Override
+ public Branch call() throws Exception {
+ String branchGuid = branchData.getGuid();
+ String branchName = branchData.getName();
+ BranchType branchType = branchData.getBranchType();
+ String creationComment = branchData.getCreationComment();
+ ITransaction txData = branchData.getFromTransaction();
+
+ ReadableArtifact authorArtifact = branchData.getUserArtifact();
+ int authorId = toArtId(authorArtifact);
+
+ ReadableArtifact associatedArtifact = branchData.getAssociatedArtifact();
+ int associatedArtifactId = toArtId(associatedArtifact);
+
+ int sourceTransactionId = NULL_SOURCE_TRANSACTION_ID;
+ int parentBranchId = NULL_PARENT_BRANCH_ID;
+ if (BranchType.SYSTEM_ROOT != branchType) {
+ TransactionRecord sourceTx = getTxCache().getOrLoad(txData.getGuid());
+ sourceTransactionId = sourceTx.getId();
+ parentBranchId = sourceTx.getBranchId();
+ }
+
+ int populateBaseTxFromAddressingQueryId = branchData.getPopulateBaseTxFromAddressingQueryId();
+ int destinationBranchId = branchData.getDestinationBranchId();
+
+ CreateDatabaseBranch createBranchData =
+ new CreateDatabaseBranch(branchType, sourceTransactionId, parentBranchId, branchGuid, branchName,
+ associatedArtifactId, authorId, creationComment, populateBaseTxFromAddressingQueryId, destinationBranchId);
+
+ Callable<Branch> callable =
+ new CreateBranchDatabaseTxCallable(getLogger(), getDatabaseService(), getBranchCache(), getTxCache(),
+ branchFactory, txFactory, createBranchData);
+ return callAndCheckForCancel(callable);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/creation/CreateBranchOperation.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CreateBranchDatabaseTxCallable.java
index b8b64643d5e..52c80e7bd97 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/creation/CreateBranchOperation.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CreateBranchDatabaseTxCallable.java
@@ -8,15 +8,13 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.branch.management.creation;
+package org.eclipse.osee.orcs.db.internal.callable;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.branch.management.internal.Activator;
+import org.eclipse.osee.database.schema.DatabaseTxCallable;
import org.eclipse.osee.framework.core.enums.BranchState;
import org.eclipse.osee.framework.core.enums.BranchType;
import org.eclipse.osee.framework.core.enums.ModificationType;
@@ -26,29 +24,25 @@ import org.eclipse.osee.framework.core.enums.TransactionDetailsType;
import org.eclipse.osee.framework.core.enums.TxChange;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeStateException;
-import org.eclipse.osee.framework.core.message.BranchCreationRequest;
-import org.eclipse.osee.framework.core.message.BranchCreationResponse;
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.TransactionRecordFactory;
import org.eclipse.osee.framework.core.model.cache.BranchCache;
import org.eclipse.osee.framework.core.model.cache.TransactionCache;
-import org.eclipse.osee.framework.core.services.IOseeCachingService;
-import org.eclipse.osee.framework.core.services.IOseeModelFactoryServiceProvider;
import org.eclipse.osee.framework.database.IOseeDatabaseService;
-import org.eclipse.osee.framework.database.core.AbstractDbTxOperation;
import org.eclipse.osee.framework.database.core.IOseeStatement;
import org.eclipse.osee.framework.database.core.OseeConnection;
import org.eclipse.osee.framework.jdk.core.util.GUID;
import org.eclipse.osee.framework.jdk.core.util.time.GlobalTime;
-import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.db.internal.branch.CreateDatabaseBranch;
/**
- * {@link CreateBranchOperationTest}
- *
* @author Roberto E. Escobar
*/
-public final class CreateBranchOperation extends AbstractDbTxOperation {
+public class CreateBranchDatabaseTxCallable extends DatabaseTxCallable<Branch> {
private static final String INSERT_TX_DETAILS =
"INSERT INTO osee_tx_details (branch_id, transaction_id, osee_comment, time, author, tx_type) VALUES (?,?,?,?,?,?)";
@@ -75,19 +69,21 @@ public final class CreateBranchOperation extends AbstractDbTxOperation {
private boolean wasSuccessful;
private int systemUserId;
- private final IOseeCachingService cachingService;
- private final IOseeModelFactoryServiceProvider factoryService;
- private final BranchCreationRequest request;
- private final BranchCreationResponse response;
+ private final BranchCache branchCache;
+ private final TransactionCache txCache;
+ private final BranchFactory branchFactory;
+ private final TransactionRecordFactory txFactory;
+ private final CreateDatabaseBranch newBranchData;
private Branch branch;
- public CreateBranchOperation(IOseeDatabaseService databaseService, IOseeModelFactoryServiceProvider factoryService, IOseeCachingService cachingService, BranchCreationRequest request, BranchCreationResponse response) {
- super(databaseService, String.format("Create Branch: [%s from %s]", request.getBranchName(),
- request.getParentBranchId()), Activator.PLUGIN_ID);
- this.cachingService = cachingService;
- this.factoryService = factoryService;
- this.request = request;
- this.response = response;
+ public CreateBranchDatabaseTxCallable(Log logger, IOseeDatabaseService databaseService, BranchCache branchCache, TransactionCache txCache, BranchFactory branchFactory, TransactionRecordFactory txFactory, CreateDatabaseBranch newBranchData) {
+ super(logger, databaseService, String.format("Create Branch: [%s from %s]", newBranchData.getBranchName(),
+ newBranchData.getParentBranchId()));
+ this.branchCache = branchCache;
+ this.txCache = txCache;
+ this.branchFactory = branchFactory;
+ this.txFactory = txFactory;
+ this.newBranchData = newBranchData;
this.wasSuccessful = false;
this.systemUserId = -1;
}
@@ -98,29 +94,30 @@ public final class CreateBranchOperation extends AbstractDbTxOperation {
systemUserId =
getDatabaseService().runPreparedQueryFetchObject(-1, USER_ID_QUERY, SystemUser.OseeSystem.getGuid());
} catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, Level.WARNING, "Unable to retrieve the system user");
+ getLogger().warn(ex, "Unable to retrieve the system user");
}
}
return systemUserId;
}
- public void checkPreconditions(IProgressMonitor monitor, Branch parentBranch, Branch destinationBranch) throws OseeCoreException {
- if (request.getBranchType().isMergeBranch()) {
+ public void checkPreconditions(Branch parentBranch, Branch destinationBranch) throws OseeCoreException {
+ if (newBranchData.getBranchType().isMergeBranch()) {
if (getDatabaseService().runPreparedQueryFetchObject(0, TEST_MERGE_BRANCH_EXISTENCE, parentBranch.getId(),
destinationBranch.getId()) > 0) {
throw new OseeStateException("Existing merge branch detected for [%s] and [%s]", parentBranch.getName(),
destinationBranch.getName());
}
- } else if (!request.getBranchType().isSystemRootBranch()) {
- int associatedArtifactId = request.getAssociatedArtifactId();
+ } else if (!newBranchData.getBranchType().isSystemRootBranch()) {
+ int associatedArtifactId = newBranchData.getAssociatedArtifactId();
int systemUserId = getSystemUserId();
if (associatedArtifactId > -1 && associatedArtifactId != systemUserId) {
int count =
getDatabaseService().runPreparedQueryFetchObject(0,
"SELECT (1) FROM osee_branch WHERE associated_art_id = ? AND branch_state NOT IN (?, ?)",
- request.getAssociatedArtifactId(), BranchState.DELETED.getValue(), BranchState.REBASELINED.getValue());
+ newBranchData.getAssociatedArtifactId(), BranchState.DELETED.getValue(),
+ BranchState.REBASELINED.getValue());
if (count > 0) {
- throw new OseeStateException("Existing branch creation detected for [%s]", request.getBranchName());
+ throw new OseeStateException("Existing branch creation detected for [%s]", newBranchData.getBranchName());
}
}
}
@@ -128,40 +125,37 @@ public final class CreateBranchOperation extends AbstractDbTxOperation {
@SuppressWarnings("unchecked")
@Override
- protected void doTxWork(IProgressMonitor monitor, OseeConnection connection) throws OseeCoreException {
- BranchCache branchCache = cachingService.getBranchCache();
- Branch parentBranch = branchCache.getById(request.getParentBranchId());
- Branch destinationBranch = branchCache.getById(request.getDestinationBranchId());
+ protected Branch handleTxWork(OseeConnection connection) throws OseeCoreException {
+ Branch parentBranch = branchCache.getById(newBranchData.getParentBranchId());
+ Branch destinationBranch = branchCache.getById(newBranchData.getDestinationBranchId());
passedPreConditions = false;
- checkPreconditions(monitor, parentBranch, destinationBranch);
+ checkPreconditions(parentBranch, destinationBranch);
passedPreConditions = true;
- TransactionCache txCache = cachingService.getTransactionCache();
-
- String guid = request.getBranchGuid();
+ String guid = newBranchData.getBranchGuid();
if (!GUID.isValid(guid)) {
guid = GUID.create();
}
branch =
- factoryService.getOseeFactoryService().getBranchFactory().create(guid, request.getBranchName(),
- request.getBranchType(), BranchState.CREATION_IN_PROGRESS, false);
+ branchFactory.create(guid, newBranchData.getBranchName(), newBranchData.getBranchType(),
+ BranchState.CREATION_IN_PROGRESS, false);
branch.setParentBranch(parentBranch);
- branch.setAssociatedArtifactId(request.getAssociatedArtifactId());
+ branch.setAssociatedArtifactId(newBranchData.getAssociatedArtifactId());
Timestamp timestamp = GlobalTime.GreenwichMeanTimestamp();
int nextTransactionId = getDatabaseService().getSequence().getNextTransactionId();
if (branch.getBranchType().isSystemRootBranch()) {
TransactionRecord systemTx =
- factoryService.getOseeFactoryService().getTransactionFactory().create(nextTransactionId, branch.getId(),
- request.getCreationComment(), timestamp, request.getAuthorId(), -1, TransactionDetailsType.Baselined);
+ txFactory.create(nextTransactionId, branch.getId(), newBranchData.getCreationComment(), timestamp,
+ newBranchData.getAuthorId(), -1, TransactionDetailsType.Baselined);
systemTx.setBranchCache(branchCache);
branch.setSourceTransaction(systemTx);
} else {
- branch.setSourceTransaction(txCache.getOrLoad(request.getSourceTransactionId()));
+ branch.setSourceTransaction(txCache.getOrLoad(newBranchData.getSourceTransactionId()));
}
if (branch.getBranchType().isMergeBranch()) {
@@ -173,11 +167,12 @@ public final class CreateBranchOperation extends AbstractDbTxOperation {
branchCache.storeItems(branch);
getDatabaseService().runPreparedUpdate(connection, INSERT_TX_DETAILS, branch.getId(), nextTransactionId,
- request.getCreationComment(), timestamp, request.getAuthorId(), TransactionDetailsType.Baselined.getId());
+ newBranchData.getCreationComment(), timestamp, newBranchData.getAuthorId(),
+ TransactionDetailsType.Baselined.getId());
TransactionRecord record =
- factoryService.getOseeFactoryService().getTransactionFactory().create(nextTransactionId, branch.getId(),
- request.getCreationComment(), timestamp, request.getAuthorId(), -1, TransactionDetailsType.Baselined);
+ txFactory.create(nextTransactionId, branch.getId(), newBranchData.getCreationComment(), timestamp,
+ newBranchData.getAuthorId(), -1, TransactionDetailsType.Baselined);
record.setBranchCache(branchCache);
if (branch.getBranchType().isSystemRootBranch()) {
@@ -185,47 +180,43 @@ public final class CreateBranchOperation extends AbstractDbTxOperation {
}
branch.setBaseTransaction(record);
txCache.cache(record);
- populateBaseTransaction(monitor, 0.30, connection, branch, request.getPopulateBaseTxFromAddressingQueryId());
+ populateBaseTransaction(0.30, connection, branch, newBranchData.getPopulateBaseTxFromAddressingQueryId());
- addMergeBranchEntry(monitor, 0.20, connection, branch, request.getDestinationBranchId());
+ addMergeBranchEntry(0.20, connection, branch, newBranchData.getDestinationBranchId());
wasSuccessful = true;
+ return branch;
}
@Override
- protected void handleTxException(IProgressMonitor monitor, Exception ex) {
+ protected void handleTxException(Exception ex) {
if (passedPreConditions) {
try {
- BranchCache branchCache = cachingService.getBranchCache();
branch.setStorageState(StorageState.PURGED);
branchCache.storeItems(branch);
} catch (OseeCoreException ex1) {
- OseeLog.log(Activator.class, Level.SEVERE, ex1);
+ getLogger().error(ex1, "Error during create branch [%s]", branch);
}
}
}
@Override
- protected void handleTxFinally(IProgressMonitor monitor) throws OseeCoreException {
+ protected void handleTxFinally() throws OseeCoreException {
if (wasSuccessful) {
- BranchCache branchCache = cachingService.getBranchCache();
branch.setBranchState(BranchState.CREATED);
branchCache.storeItems(branch);
- response.setBranchId(branch.getId());
}
- monitor.worked(calculateWork(0.10));
}
- private void addMergeBranchEntry(IProgressMonitor monitor, double workAmount, OseeConnection connection, Branch branch, int destinationBranchId) throws OseeCoreException {
+ private void addMergeBranchEntry(double workAmount, OseeConnection connection, Branch branch, int destinationBranchId) throws OseeCoreException {
if (branch.getBranchType().isMergeBranch()) {
int parentBranchId = branch.hasParentBranch() ? branch.getParentBranch().getId() : -1;
getDatabaseService().runPreparedUpdate(connection, MERGE_BRANCH_INSERT, parentBranchId,
- request.getDestinationBranchId(), branch.getId(), 0);
+ newBranchData.getDestinationBranchId(), branch.getId(), 0);
}
- checkForCancelledStatus(monitor);
- monitor.worked(calculateWork(workAmount));
+ checkForCancelled();
}
- private void populateBaseTransaction(IProgressMonitor monitor, double workAmount, OseeConnection connection, Branch branch, int populateBaseTxFromAddressingQueryId) throws OseeCoreException {
+ private void populateBaseTransaction(double workAmount, OseeConnection connection, Branch branch, int populateBaseTxFromAddressingQueryId) throws OseeCoreException {
if (branch.getBranchType() != BranchType.SYSTEM_ROOT) {
List<Object[]> data = new ArrayList<Object[]>();
HashSet<Integer> gammas = new HashSet<Integer>(100000);
@@ -234,35 +225,28 @@ public final class CreateBranchOperation extends AbstractDbTxOperation {
parentBranchId = branch.getParentBranch().getId();
}
int baseTxId = branch.getBaseTransaction().getId();
- String extraMessage = "";
if (populateBaseTxFromAddressingQueryId > 0) {
- populateAddressingToCopy(monitor, connection, data, baseTxId, gammas,
- SELECT_ATTRIBUTE_ADDRESSING_FROM_JOIN, parentBranchId, TxChange.NOT_CURRENT.getValue(),
- populateBaseTxFromAddressingQueryId);
- populateAddressingToCopy(monitor, connection, data, baseTxId, gammas, SELECT_ARTIFACT_ADDRESSING_FROM_JOIN,
+ populateAddressingToCopy(connection, data, baseTxId, gammas, SELECT_ATTRIBUTE_ADDRESSING_FROM_JOIN,
+ parentBranchId, TxChange.NOT_CURRENT.getValue(), populateBaseTxFromAddressingQueryId);
+ populateAddressingToCopy(connection, data, baseTxId, gammas, SELECT_ARTIFACT_ADDRESSING_FROM_JOIN,
parentBranchId, TxChange.NOT_CURRENT.getValue(), populateBaseTxFromAddressingQueryId);
-
- extraMessage = " by joining against query id";
} else {
- populateAddressingToCopy(monitor, connection, data, baseTxId, gammas, SELECT_ADDRESSING,
+ populateAddressingToCopy(connection, data, baseTxId, gammas, SELECT_ADDRESSING,
TxChange.NOT_CURRENT.getValue(), parentBranchId);
}
if (!data.isEmpty()) {
getDatabaseService().runBatchUpdate(connection, INSERT_ADDRESSING, data);
}
- monitor.setTaskName(String.format("Created branch [%s] with [%d] transactions%s", branch.getName(),
- data.size(), extraMessage));
}
- checkForCancelledStatus(monitor);
- monitor.worked(calculateWork(workAmount));
+ checkForCancelled();
}
- private void populateAddressingToCopy(IProgressMonitor monitor, OseeConnection connection, List<Object[]> data, int baseTxId, HashSet<Integer> gammas, String query, Object... parameters) throws OseeCoreException {
+ private void populateAddressingToCopy(OseeConnection connection, List<Object[]> data, int baseTxId, HashSet<Integer> gammas, String query, Object... parameters) throws OseeCoreException {
IOseeStatement chStmt = getDatabaseService().getStatement(connection);
try {
chStmt.runPreparedQuery(10000, query, parameters);
while (chStmt.next()) {
- checkForCancelledStatus(monitor);
+ checkForCancelled();
Integer gamma = chStmt.getInt("gamma_id");
if (!gammas.contains(gamma)) {
ModificationType modType = ModificationType.getMod(chStmt.getInt("mod_type"));
@@ -275,4 +259,5 @@ public final class CreateBranchOperation extends AbstractDbTxOperation {
chStmt.close();
}
}
+
}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/DeleteRelationDatabaseCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/DeleteRelationDatabaseCallable.java
new file mode 100644
index 00000000000..66cbc369d53
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/DeleteRelationDatabaseCallable.java
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * 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.orcs.db.internal.callable;
+
+import java.sql.Timestamp;
+import org.eclipse.osee.database.schema.DatabaseTxCallable;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
+import org.eclipse.osee.framework.core.data.IRelationTypeSide;
+import org.eclipse.osee.framework.core.enums.ModificationType;
+import org.eclipse.osee.framework.core.enums.TransactionDetailsType;
+import org.eclipse.osee.framework.core.enums.TxChange;
+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.cache.BranchCache;
+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.database.core.OseeConnection;
+import org.eclipse.osee.framework.jdk.core.type.Triplet;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.framework.jdk.core.util.time.GlobalTime;
+import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.db.internal.accessor.UpdatePreviousTxCurrent;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class DeleteRelationDatabaseCallable extends DatabaseTxCallable<Branch> {
+
+ private final static String SELECT_RELATION_LINK =
+ "select txs.gamma_id, rel.rel_link_id, txs.mod_type from osee_relation_link rel, osee_txs txs where rel.rel_link_type_id = ? and rel.a_art_id = ? and rel.b_art_id = ? and rel.gamma_id = txs.gamma_id and txs.branch_id = ? and txs.tx_current <> ? order by txs.tx_current";
+
+ private final static String INSERT_INTO_TX_DETAILS =
+ "insert into osee_tx_details (branch_id, transaction_id, osee_comment, time, author, tx_type) values (?,?,?,?,?,?)";
+
+ private final static String INSERT_INTO_TXS =
+ "insert into osee_txs (mod_type, tx_current, transaction_id, gamma_id, branch_id) values (?, ?, ?, ?, ?)";
+
+ private final IdentityService identityService;
+ private final BranchCache branchCache;
+ private final IOseeBranch branchToken;
+
+ private final int artUserId;
+ private final IRelationTypeSide relationType;
+ private final int aArtId;
+ private final int bArtId;
+ private final String comment;
+
+ public DeleteRelationDatabaseCallable(Log logger, IOseeDatabaseService databaseService, IdentityService identityService, BranchCache branchCache, IOseeBranch branchToken, IRelationTypeSide relationType, int aArtId, int bArtId, int artUserId, String comment) {
+ super(logger, databaseService, "Delete Relation");
+ this.identityService = identityService;
+ this.branchCache = branchCache;
+ this.branchToken = branchToken;
+
+ this.relationType = relationType;
+ this.aArtId = aArtId;
+ this.bArtId = bArtId;
+ this.artUserId = artUserId;
+ this.comment = comment;
+
+ }
+
+ @Override
+ protected Branch handleTxWork(OseeConnection connection) throws OseeCoreException {
+ Branch branch = branchCache.get(branchToken);
+ Triplet<Integer, Integer, Integer> relIdModTypeGammaId =
+ getRelationModAndGammaTxData(branch, relationType, aArtId, bArtId);
+
+ int modType = relIdModTypeGammaId.getSecond();
+ if (modType != ModificationType.ARTIFACT_DELETED.getValue() && modType != ModificationType.DELETED.getValue()) {
+ UpdatePreviousTxCurrent txc = new UpdatePreviousTxCurrent(getDatabaseService(), branch, connection);
+ txc.addRelation(relIdModTypeGammaId.getFirst());
+ txc.updateTxNotCurrents();
+
+ int currentGammaId = relIdModTypeGammaId.getThird();
+ createNewTxAddressing(connection, branch, comment, artUserId, currentGammaId);
+ } else {
+ // Already deleted - Do NOTHING
+ }
+ return branch;
+ }
+
+ private Triplet<Integer, Integer, Integer> getRelationModAndGammaTxData(Branch commonBranch, IRelationTypeSide relationType, int aArtId, int bArtId) throws OseeCoreException {
+ int relationTypeId = identityService.getLocalId(relationType);
+ IOseeStatement chStmt = getDatabaseService().getStatement();
+ try {
+ chStmt.runPreparedQuery(1, SELECT_RELATION_LINK, relationTypeId, aArtId, bArtId, commonBranch.getId(),
+ TxChange.NOT_CURRENT.getValue());
+ if (chStmt.next()) {
+ int relationId = chStmt.getInt("rel_link_id");
+ int modType = chStmt.getInt("mod_type");
+ int currentGammaId = chStmt.getInt("gamma_id");
+ return new Triplet<Integer, Integer, Integer>(relationId, modType, currentGammaId);
+ } else {
+ throw new OseeStateException(
+ "No existing relation (deleted or otherwise) was found for [%s] with aArtId:[%s] and bArtId:[%s].",
+ relationType, aArtId, bArtId);
+ }
+ } finally {
+ Lib.close(chStmt);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private void createNewTxAddressing(OseeConnection connection, Branch commonBranch, String comment, int userId, int currentGammaId) throws OseeCoreException {
+ int transactionId = getDatabaseService().getSequence().getNextTransactionId();
+
+ Timestamp timestamp = GlobalTime.GreenwichMeanTimestamp();
+ int txType = TransactionDetailsType.NonBaselined.getId();
+ getDatabaseService().runPreparedUpdate(connection, INSERT_INTO_TX_DETAILS, commonBranch.getId(), transactionId,
+ comment, timestamp, userId, txType);
+ getDatabaseService().runPreparedUpdate(connection, INSERT_INTO_TXS, ModificationType.DELETED.getValue(),
+ TxChange.DELETED.getValue(), transactionId, currentGammaId, commonBranch.getId());
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/InitializeDatastoreCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/InitializeDatastoreCallable.java
new file mode 100644
index 00000000000..149a1e68f50
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/InitializeDatastoreCallable.java
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ * 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.orcs.db.internal.callable;
+
+import java.io.File;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.concurrent.Callable;
+import org.eclipse.osee.database.schema.DatabaseCallable;
+import org.eclipse.osee.database.schema.InitializeSchemaCallable;
+import org.eclipse.osee.database.schema.SchemaOptions;
+import org.eclipse.osee.database.schema.SchemaResourceProvider;
+import org.eclipse.osee.framework.core.enums.BranchType;
+import org.eclipse.osee.framework.core.enums.CoreBranches;
+import org.eclipse.osee.framework.core.enums.PermissionEnum;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.services.IOseeCachingService;
+import org.eclipse.osee.framework.core.util.Conditions;
+import org.eclipse.osee.framework.database.IOseeDatabaseService;
+import org.eclipse.osee.framework.jdk.core.util.GUID;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.core.SystemPreferences;
+import org.eclipse.osee.orcs.core.ds.BranchDataStore;
+import org.eclipse.osee.orcs.core.ds.DataStoreConstants;
+import org.eclipse.osee.orcs.core.ds.DataStoreInfo;
+import org.eclipse.osee.orcs.data.CreateBranchData;
+import org.eclipse.osee.orcs.db.internal.resource.ResourceConstants;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class InitializeDatastoreCallable extends DatabaseCallable<DataStoreInfo> {
+
+ private static final String ADD_PERMISSION =
+ "INSERT INTO OSEE_PERMISSION (PERMISSION_ID, PERMISSION_NAME) VALUES (?,?)";
+
+ private final SystemPreferences preferences;
+ private final SchemaResourceProvider schemaProvider;
+ private final SchemaOptions options;
+ private final IOseeCachingService cacheService;
+ private final BranchDataStore branchStore;
+
+ public InitializeDatastoreCallable(Log logger, IOseeDatabaseService dbService, IOseeCachingService cacheService, BranchDataStore branchStore, SystemPreferences preferences, SchemaResourceProvider schemaProvider, SchemaOptions options) {
+ super(logger, dbService);
+ this.cacheService = cacheService;
+ this.branchStore = branchStore;
+ this.preferences = preferences;
+ this.schemaProvider = schemaProvider;
+ this.options = options;
+ }
+
+ @Override
+ public DataStoreInfo call() throws Exception {
+ Conditions.checkExpressionFailOnTrue(getDatabaseService().isProduction(),
+ "Error - attempting to initialize a production datastore.");
+
+ Callable<Object> callable =
+ new InitializeSchemaCallable(getLogger(), getDatabaseService(), schemaProvider, options);
+ callAndCheckForCancel(callable);
+
+ String attributeDataPath = ResourceConstants.getAttributeDataPath(preferences);
+ getLogger().info("Deleting application server binary data [%s]...", attributeDataPath);
+ Lib.deleteDir(new File(attributeDataPath));
+
+ preferences.putValue(DataStoreConstants.DATASTORE_ID_KEY, GUID.create());
+
+ addDefaultPermissions();
+
+ clearStateCaches();
+
+ // boolean doesSystemRootExist = cacheService.getBranchCache().existsByGuid(CoreBranches.SYSTEM_ROOT.getGuid());
+ // Conditions.checkExpressionFailOnTrue(doesSystemRootExist, "System Root branch already exists.");
+
+ CreateBranchData systemRootData = getSystemRootData();
+
+ // TODO tie in the session information
+ Callable<Branch> createSystemRoot = branchStore.createBranch("sessionId", systemRootData);
+ Branch systemRoot = callAndCheckForCancel(createSystemRoot);
+
+ DataStoreInfo dataStoreInfo = null;
+ return dataStoreInfo;
+
+ }
+
+ private CreateBranchData getSystemRootData() {
+ CreateBranchData data = new CreateBranchData();
+
+ data.setGuid(CoreBranches.SYSTEM_ROOT.getGuid());
+ data.setName(CoreBranches.SYSTEM_ROOT.getName());
+ data.setBranchType(BranchType.SYSTEM_ROOT);
+
+ String creationComment = String.format("%s Creation", CoreBranches.SYSTEM_ROOT.getName());
+ data.setCreationComment(creationComment);
+
+ data.setFromTransaction(null);
+
+ data.setPopulateBaseTxFromAddressingQueryId(-1);
+ data.setDestinationBranchId(-1);
+ return data;
+ }
+
+ private void clearStateCaches() throws OseeDataStoreException {
+ getDatabaseService().getSequence().clear();
+ cacheService.getIdentityService().clear();
+ // cachingService.clearAll();
+ }
+
+ private void addDefaultPermissions() throws OseeCoreException {
+ List<Object[]> data = new LinkedList<Object[]>();
+ for (PermissionEnum permission : PermissionEnum.values()) {
+ data.add(new Object[] {permission.getPermId(), permission.getName()});
+ }
+ getDatabaseService().runBatchUpdate(ADD_PERMISSION, data);
+ }
+}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/MoveBranchCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/MoveBranchDatabaseCallable.java
index 013fe3279c7..e73a83de94b 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/MoveBranchCallable.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/MoveBranchDatabaseCallable.java
@@ -11,18 +11,21 @@
package org.eclipse.osee.orcs.db.internal.callable;
import java.util.HashMap;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.osee.database.schema.DatabaseTxCallable;
import org.eclipse.osee.event.EventService;
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.OseeConnection;
+import org.eclipse.osee.logger.Log;
import org.eclipse.osee.orcs.OrcsConstants;
-import org.eclipse.osee.orcs.db.internal.util.DatabaseTxCallable;
/**
* @author Ryan D. Brooks
*/
-public class MoveBranchCallable extends DatabaseTxCallable {
+public class MoveBranchDatabaseCallable extends DatabaseTxCallable<IStatus> {
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 = ?";
@@ -33,8 +36,8 @@ public class MoveBranchCallable extends DatabaseTxCallable {
private final EventService eventService;
- public MoveBranchCallable(IOseeDatabaseService databaseService, EventService eventService, boolean archive, Branch branch) {
- super(databaseService, "Branch Move");
+ public MoveBranchDatabaseCallable(Log logger, IOseeDatabaseService databaseService, EventService eventService, boolean archive, Branch branch) {
+ super(logger, databaseService, "Branch Move");
this.eventService = eventService;
this.archive = archive;
this.branch = branch;
@@ -45,17 +48,21 @@ public class MoveBranchCallable extends DatabaseTxCallable {
}
@Override
- protected void handleTxWork(OseeConnection connection) throws OseeCoreException {
+ protected IStatus handleTxWork(OseeConnection connection) throws OseeCoreException {
String sourceTableName = archive ? "osee_txs" : "osee_txs_archived";
String destinationTableName = archive ? "osee_txs_archived" : "osee_txs";
+ checkForCancelled();
String sql = String.format(INSERT_ADDRESSING, destinationTableName, sourceTableName);
getDatabaseService().runPreparedUpdate(connection, sql, branch.getId());
+ checkForCancelled();
sql = String.format(DELETE_ADDRESSING, sourceTableName);
getDatabaseService().runPreparedUpdate(connection, sql, branch.getId());
+ checkForCancelled();
// TODO Populated Event Data
getEventService().postEvent(OrcsConstants.BRANCH_MOVE_EVENT, new HashMap<String, Object>());
+ return Status.OK_STATUS;
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/PurgeBranchDatabaseCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/PurgeBranchDatabaseCallable.java
new file mode 100644
index 00000000000..0fc7a1d1530
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/PurgeBranchDatabaseCallable.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * 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.orcs.db.internal.callable;
+
+import org.eclipse.osee.database.schema.DatabaseTxCallable;
+import org.eclipse.osee.framework.core.enums.StorageState;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.model.cache.BranchCache;
+import org.eclipse.osee.framework.database.IOseeDatabaseService;
+import org.eclipse.osee.framework.database.core.OseeConnection;
+import org.eclipse.osee.logger.Log;
+
+/**
+ * @author Megumi Telles
+ * @author Jeff C. Phillips
+ * @author Robert A. Fisher
+ * @author Ryan D. Brooks
+ */
+public class PurgeBranchDatabaseCallable extends DatabaseTxCallable<Branch> {
+ private static final String DELETE_FROM_BRANCH_TABLE = "DELETE FROM osee_branch WHERE branch_id = ?";
+ private static final String DELETE_FROM_MERGE =
+ "DELETE FROM osee_merge WHERE merge_branch_id = ? AND source_branch_id = ?";
+ private static final String DELETE_FROM_CONFLICT = "DELETE FROM osee_conflict WHERE merge_branch_id = ?";
+ private static final String DELETE_FROM_TX_DETAILS = "DELETE FROM osee_tx_details WHERE branch_id = ?";
+ private final String DELETE_ARTIFACT_ACL_FROM_BRANCH = "DELETE FROM OSEE_ARTIFACT_ACL WHERE branch_id =?";
+ private final String DELETE_BRANCH_ACL_FROM_BRANCH = "DELETE FROM OSEE_BRANCH_ACL WHERE branch_id =?";
+
+ private final Branch branch;
+ private final String sourceTableName;
+ private final BranchCache branchCache;
+
+ public PurgeBranchDatabaseCallable(Log logger, IOseeDatabaseService databaseService, BranchCache branchCache, Branch branch) {
+ super(logger, databaseService, String.format("Purge Branch: [(%s)-%s]", branch.getId(), branch.getShortName()));
+ this.branch = branch;
+ this.sourceTableName = branch.getArchiveState().isArchived() ? "osee_txs_archived" : "osee_txs";
+ this.branchCache = branchCache;
+ }
+
+ @Override
+ protected Branch handleTxWork(OseeConnection connection) throws OseeCoreException {
+ if (branch.getStorageState() != StorageState.PURGED) {
+ if (!branch.getAllChildBranches(false).isEmpty()) {
+ throw new OseeArgumentException(
+ "Unable to purge a branch containing children: branchGuid[%s] branchType[%s]", branch.getGuid(),
+ branch.getBranchType());
+ }
+
+ int branchId = branch.getId();
+ String sql = String.format("DELETE FROM %s WHERE branch_id = ?", sourceTableName);
+ purgeFromTable(connection, sql, 0.20, branchId);
+
+ purgeFromTable(connection, DELETE_FROM_TX_DETAILS, 0.09, branchId);
+ purgeFromTable(connection, DELETE_FROM_CONFLICT, 0.01, branchId);
+ purgeFromTable(connection, DELETE_FROM_MERGE, 0.01, branchId, branch.getParentBranch().getId());
+ purgeFromTable(connection, DELETE_FROM_BRANCH_TABLE, 0.01, branchId);
+
+ purgeAccessControlTables(branchId);
+
+ branch.setStorageState(StorageState.PURGED);
+ branchCache.storeItems(branch);
+ branch.internalRemovePurgedBranchFromParent();
+ }
+ return branch;
+ }
+
+ private void purgeAccessControlTables(int branchId) throws OseeCoreException {
+ getDatabaseService().runPreparedUpdate(DELETE_ARTIFACT_ACL_FROM_BRANCH, branchId);
+ checkForCancelled();
+ getDatabaseService().runPreparedUpdate(DELETE_BRANCH_ACL_FROM_BRANCH, branchId);
+ checkForCancelled();
+ }
+
+ private void purgeFromTable(OseeConnection connection, String sql, double percentage, Object... data) throws OseeCoreException {
+ checkForCancelled();
+ getDatabaseService().runPreparedUpdate(connection, sql, data);
+ }
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/StoreBranchCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/StoreBranchDatabaseCallable.java
index b88bfa0f76a..1f0a18ead09 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/StoreBranchCallable.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/StoreBranchDatabaseCallable.java
@@ -14,6 +14,9 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.osee.database.schema.DatabaseTxCallable;
import org.eclipse.osee.event.EventService;
import org.eclipse.osee.executor.admin.ExecutorAdmin;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
@@ -24,13 +27,13 @@ import org.eclipse.osee.framework.core.model.BranchField;
import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.database.IOseeDatabaseService;
import org.eclipse.osee.framework.database.core.OseeConnection;
+import org.eclipse.osee.logger.Log;
import org.eclipse.osee.orcs.OrcsConstants;
-import org.eclipse.osee.orcs.db.internal.util.DatabaseTxCallable;
/**
* @author Ryan D. Brooks
*/
-public class StoreBranchCallable extends DatabaseTxCallable {
+public class StoreBranchDatabaseCallable extends DatabaseTxCallable<IStatus> {
protected static final int NULL_PARENT_BRANCH_ID = -1;
private static final String INSERT_BRANCH =
@@ -45,8 +48,8 @@ public class StoreBranchCallable extends DatabaseTxCallable {
private final ExecutorAdmin executorAdmin;
private final EventService eventService;
- public StoreBranchCallable(IOseeDatabaseService dbService, ExecutorAdmin executorAdmin, EventService eventService, Collection<Branch> branches) {
- super(dbService, "Branch Archive Operation");
+ public StoreBranchDatabaseCallable(Log logger, IOseeDatabaseService dbService, ExecutorAdmin executorAdmin, EventService eventService, Collection<Branch> branches) {
+ super(logger, dbService, "Branch Archive Operation");
this.executorAdmin = executorAdmin;
this.eventService = eventService;
this.branches = branches;
@@ -61,7 +64,7 @@ public class StoreBranchCallable extends DatabaseTxCallable {
}
@Override
- public void handleTxWork(OseeConnection connection) throws OseeCoreException {
+ public IStatus handleTxWork(OseeConnection connection) throws OseeCoreException {
List<Object[]> insertData = new ArrayList<Object[]>();
List<Object[]> updateData = new ArrayList<Object[]>();
List<Object[]> deleteData = new ArrayList<Object[]>();
@@ -84,9 +87,9 @@ public class StoreBranchCallable extends DatabaseTxCallable {
}
}
if (branch.isFieldDirty(BranchField.BRANCH_ARCHIVED_STATE_FIELD_KEY)) {
- DatabaseTxCallable task =
- new MoveBranchCallable(getDatabaseService(), getEventService(), branch.getArchiveState().isArchived(),
- branch);
+ DatabaseTxCallable<?> task =
+ new MoveBranchDatabaseCallable(getLogger(), getDatabaseService(), getEventService(),
+ branch.getArchiveState().isArchived(), branch);
try {
getExecutorAdmin().schedule(task);
} catch (Exception ex) {
@@ -102,6 +105,7 @@ public class StoreBranchCallable extends DatabaseTxCallable {
branch.clearDirty();
}
getEventService().postEvent(OrcsConstants.BRANCH_CHANGE_EVENT, new HashMap<String, Object>());
+ return Status.OK_STATUS;
}
private Object[] toInsertValues(Branch branch) throws OseeCoreException {
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/internal/AddArtifactChangeData.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/AddArtifactChangeDataCallable.java
index 80c6eaa7aea..4d930f863da 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/internal/AddArtifactChangeData.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/AddArtifactChangeDataCallable.java
@@ -8,31 +8,29 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-
-package org.eclipse.osee.framework.branch.management.internal;
+package org.eclipse.osee.orcs.db.internal.change;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.executor.admin.CancellableCallable;
import org.eclipse.osee.framework.core.enums.ModificationType;
import org.eclipse.osee.framework.core.model.change.ArtifactChangeItem;
import org.eclipse.osee.framework.core.model.change.AttributeChangeItem;
import org.eclipse.osee.framework.core.model.change.ChangeItem;
import org.eclipse.osee.framework.core.model.change.ChangeItemUtil;
-import org.eclipse.osee.framework.core.operation.AbstractOperation;
-public class AddArtifactChangeData extends AbstractOperation {
+public class AddArtifactChangeDataCallable extends CancellableCallable<List<ChangeItem>> {
private final List<ChangeItem> changeItems;
- public AddArtifactChangeData(List<ChangeItem> changeItems) {
- super("Add Extra Artifact Change Data", Activator.PLUGIN_ID);
+ public AddArtifactChangeDataCallable(List<ChangeItem> changeItems) {
+ super();
this.changeItems = changeItems;
}
@Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
+ public List<ChangeItem> call() throws Exception {
Map<Integer, ArtifactChangeItem> artifactChanges = new HashMap<Integer, ArtifactChangeItem>();
for (ChangeItem item : changeItems) {
if (item instanceof ArtifactChangeItem) {
@@ -63,6 +61,7 @@ public class AddArtifactChangeData extends AbstractOperation {
}
}
changeItems.addAll(syntheticArtifactChanges.values());
+ return changeItems;
}
private void updateArtifactChangeItem(ArtifactChangeItem artifact, AttributeChangeItem attribute) {
@@ -88,4 +87,5 @@ public class AddArtifactChangeData extends AbstractOperation {
ex.printStackTrace();
}
}
+
}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/ArtifactChangeItemFactory.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/ArtifactChangeItemFactory.java
new file mode 100644
index 00000000000..e2f87d672fc
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/ArtifactChangeItemFactory.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.orcs.db.internal.change;
+
+import java.util.HashMap;
+import org.eclipse.osee.framework.core.enums.ModificationType;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.change.ArtifactChangeItem;
+import org.eclipse.osee.framework.core.model.change.ChangeItem;
+import org.eclipse.osee.framework.database.core.IOseeStatement;
+import org.eclipse.osee.orcs.db.internal.change.ChangeItemLoader.ChangeItemFactory;
+
+public final class ArtifactChangeItemFactory implements ChangeItemFactory {
+ private static final String SELECT_ARTIFACTS_BY_GAMMAS =
+ "select art_id, art_type_id, txj.gamma_id from osee_artifact id, osee_join_transaction txj where id.gamma_id = txj.gamma_id and txj.query_id = ?";
+
+ private final HashMap<Long, ModificationType> changeByGammaId;
+
+ public ArtifactChangeItemFactory(HashMap<Long, ModificationType> changeByGammaId) {
+ super();
+ this.changeByGammaId = changeByGammaId;
+ }
+
+ @Override
+ public String getLoadByGammaQuery() {
+ return SELECT_ARTIFACTS_BY_GAMMAS;
+ }
+
+ @Override
+ public ChangeItem createItem(IOseeStatement chStmt) throws OseeCoreException {
+ int artId = chStmt.getInt("art_id");
+ int artTypeId = chStmt.getInt("art_type_id");
+
+ long gammaId = chStmt.getLong("gamma_id");
+ ModificationType modType = changeByGammaId.get(gammaId);
+
+ return new ArtifactChangeItem(artId, artTypeId, gammaId, modType);
+ }
+
+ @Override
+ public String getItemIdColumnName() {
+ return "art_id";
+ }
+
+ @Override
+ public String getItemTableName() {
+ return "osee_artifact";
+ }
+
+ @Override
+ public String getItemValueColumnName() {
+ return null;
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/AttributeChangeItemFactory.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/AttributeChangeItemFactory.java
new file mode 100644
index 00000000000..2f68a597524
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/AttributeChangeItemFactory.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.orcs.db.internal.change;
+
+import java.util.HashMap;
+import org.eclipse.osee.framework.core.enums.ModificationType;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.change.AttributeChangeItem;
+import org.eclipse.osee.framework.core.model.change.ChangeItem;
+import org.eclipse.osee.framework.database.core.IOseeStatement;
+import org.eclipse.osee.orcs.db.internal.change.ChangeItemLoader.ChangeItemFactory;
+
+public final class AttributeChangeItemFactory implements ChangeItemFactory {
+ private static final String SELECT_ATTRIBUTES_BY_GAMMAS =
+ "select art_id, attr_id, value, attr_type_id, txj.gamma_id from osee_attribute id, osee_join_transaction txj where id.gamma_id = txj.gamma_id and txj.query_id = ?";
+
+ private final HashMap<Long, ModificationType> changeByGammaId;
+
+ public AttributeChangeItemFactory(HashMap<Long, ModificationType> changeByGammaId) {
+ super();
+ this.changeByGammaId = changeByGammaId;
+ }
+
+ @Override
+ public String getLoadByGammaQuery() {
+ return SELECT_ATTRIBUTES_BY_GAMMAS;
+ }
+
+ @Override
+ public ChangeItem createItem(IOseeStatement chStmt) throws OseeCoreException {
+ int attrId = chStmt.getInt("attr_id");
+ int attrTypeId = chStmt.getInt("attr_type_id");
+ int artId = chStmt.getInt("art_id");
+
+ long gammaId = chStmt.getLong("gamma_id");
+ ModificationType modType = changeByGammaId.get(gammaId);
+
+ String value = chStmt.getString("value");
+
+ return new AttributeChangeItem(attrId, attrTypeId, artId, gammaId, modType, value);
+ }
+
+ @Override
+ public String getItemIdColumnName() {
+ return "attr_id";
+ }
+
+ @Override
+ public String getItemTableName() {
+ return "osee_attribute";
+ }
+
+ @Override
+ public String getItemValueColumnName() {
+ return "value";
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/ChangeItemLoader.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/ChangeItemLoader.java
new file mode 100644
index 00000000000..94ef169bfca
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/ChangeItemLoader.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * 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.orcs.db.internal.change;
+
+import java.util.HashMap;
+import org.eclipse.osee.framework.core.enums.ModificationType;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.change.ChangeItem;
+import org.eclipse.osee.framework.database.IOseeDatabaseService;
+import org.eclipse.osee.framework.database.core.IOseeStatement;
+import org.eclipse.osee.framework.database.core.IdJoinQuery;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ChangeItemLoader {
+
+ private final IOseeDatabaseService dbService;
+ private final HashMap<Long, ModificationType> changeByGammaId;
+
+ public static interface ChangeItemFactory {
+
+ String getItemTableName();
+
+ String getItemIdColumnName();
+
+ String getItemValueColumnName();
+
+ String getLoadByGammaQuery();
+
+ ChangeItem createItem(IOseeStatement statement) throws OseeCoreException;
+ }
+
+ public ChangeItemLoader(IOseeDatabaseService dbService, HashMap<Long, ModificationType> changeByGammaId) {
+ this.dbService = dbService;
+ this.changeByGammaId = changeByGammaId;
+ }
+
+ public ChangeItemFactory createArtifactChangeItemFactory() {
+ return new ArtifactChangeItemFactory(changeByGammaId);
+ }
+
+ public ChangeItemFactory createAttributeChangeItemFactory() {
+ return new AttributeChangeItemFactory(changeByGammaId);
+ }
+
+ public ChangeItemFactory createRelationChangeItemFactory() {
+ return new RelationChangeItemFactory(changeByGammaId);
+ }
+
+ public void loadItemIdsBasedOnGammas(ChangeItemFactory factory, int queryId, HashMap<Integer, ChangeItem> changesByItemId, IdJoinQuery idJoin) throws OseeCoreException {
+ IOseeStatement chStmt = dbService.getStatement();
+ try {
+ chStmt.runPreparedQuery(10000, factory.getLoadByGammaQuery(), queryId);
+ while (chStmt.next()) {
+ ChangeItem item = factory.createItem(chStmt);
+ Integer itemId = item.getItemId();
+ changesByItemId.put(itemId, item);
+ idJoin.add(itemId);
+ }
+ } finally {
+ chStmt.close();
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/change/ComputeNetChangeOperation.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/ComputeNetChangeCallable.java
index ca5cfe1fd69..63b8b5afa4e 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/change/ComputeNetChangeOperation.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/ComputeNetChangeCallable.java
@@ -8,38 +8,34 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.branch.management.change;
+package org.eclipse.osee.orcs.db.internal.change;
-import java.util.Collection;
import java.util.Iterator;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.branch.management.internal.Activator;
+import java.util.List;
+import org.eclipse.osee.executor.admin.CancellableCallable;
import org.eclipse.osee.framework.core.enums.ModificationType;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeStateException;
import org.eclipse.osee.framework.core.model.change.ChangeItem;
import org.eclipse.osee.framework.core.model.change.ChangeItemUtil;
-import org.eclipse.osee.framework.core.operation.AbstractOperation;
/**
* @author Roberto E. Escobar
*/
-public class ComputeNetChangeOperation extends AbstractOperation {
- private final Collection<ChangeItem> changes;
+public class ComputeNetChangeCallable extends CancellableCallable<List<ChangeItem>> {
+ private final List<ChangeItem> changes;
- public ComputeNetChangeOperation(Collection<ChangeItem> changes) {
- super("Compute Net Change", Activator.PLUGIN_ID);
+ public ComputeNetChangeCallable(List<ChangeItem> changes) {
+ super();
this.changes = changes;
}
@Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
+ public List<ChangeItem> call() throws Exception {
if (!changes.isEmpty()) {
- double workPercentage = 1.0 / changes.size();
-
Iterator<ChangeItem> iterator = changes.iterator();
while (iterator.hasNext()) {
- checkForCancelledStatus(monitor);
+ checkForCancelled();
ChangeItem change = iterator.next();
if (ChangeItemUtil.isIgnoreCase(change)) {
iterator.remove();
@@ -59,11 +55,9 @@ public class ComputeNetChangeOperation extends AbstractOperation {
}
}
}
- monitor.worked(calculateWork(workPercentage));
}
- } else {
- monitor.worked(calculateWork(1.0));
}
+ return changes;
}
private ModificationType getNetModType(ChangeItem change) {
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/change/LoadDeltasBetweenBranches.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/LoadDeltasBetweenBranches.java
index dd7033c0060..3402993a01c 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/change/LoadDeltasBetweenBranches.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/LoadDeltasBetweenBranches.java
@@ -1,4 +1,5 @@
/*******************************************************************************
+ * Copyright (c) 2012 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
@@ -7,13 +8,13 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.branch.management.change;
+package org.eclipse.osee.orcs.db.internal.change;
import java.util.Collection;
import java.util.HashMap;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.branch.management.change.ChangeItemLoader.ChangeItemFactory;
-import org.eclipse.osee.framework.branch.management.internal.Activator;
+import java.util.LinkedList;
+import java.util.List;
+import org.eclipse.osee.database.schema.DatabaseCallable;
import org.eclipse.osee.framework.core.enums.ModificationType;
import org.eclipse.osee.framework.core.enums.TxChange;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
@@ -21,13 +22,14 @@ import org.eclipse.osee.framework.core.model.TransactionDelta;
import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.core.model.change.ChangeItem;
import org.eclipse.osee.framework.core.model.change.ChangeVersion;
-import org.eclipse.osee.framework.core.operation.AbstractOperation;
import org.eclipse.osee.framework.core.util.Conditions;
-import org.eclipse.osee.framework.database.IOseeDatabaseServiceProvider;
+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.database.core.TransactionJoinQuery;
+import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.db.internal.change.ChangeItemLoader.ChangeItemFactory;
/**
* @author Ryan D. Brooks
@@ -35,25 +37,21 @@ import org.eclipse.osee.framework.database.core.TransactionJoinQuery;
* @author Ryan Schmitt
* @author Jeff C. Phillips
*/
-public class LoadDeltasBetweenBranches extends AbstractOperation {
+public class LoadDeltasBetweenBranches extends DatabaseCallable<List<ChangeItem>> {
private static final String SELECT_SOURCE_BRANCH_CHANGES =
"select gamma_id, mod_type from osee_txs where branch_id = ? and tx_current <> ? and transaction_id <> ?";
private final HashMap<Long, ModificationType> changeByGammaId = new HashMap<Long, ModificationType>();
- private final Collection<ChangeItem> changeData;
private final TransactionDelta txDelta;
private final TransactionRecord mergeTransaction;
- private final IOseeDatabaseServiceProvider oseeDatabaseProvider;
private final ChangeItemLoader changeItemLoader;
- public LoadDeltasBetweenBranches(IOseeDatabaseServiceProvider oseeDatabaseProvider, TransactionDelta txDelta, TransactionRecord mergeTransaction, Collection<ChangeItem> changeData) {
- super("Load Change Data", Activator.PLUGIN_ID);
- this.oseeDatabaseProvider = oseeDatabaseProvider;
+ public LoadDeltasBetweenBranches(Log logger, IOseeDatabaseService dbService, TransactionDelta txDelta, TransactionRecord mergeTransaction) {
+ super(logger, dbService);
this.mergeTransaction = mergeTransaction;
this.txDelta = txDelta;
- this.changeData = changeData;
- this.changeItemLoader = new ChangeItemLoader(oseeDatabaseProvider, changeByGammaId);
+ this.changeItemLoader = new ChangeItemLoader(dbService, changeByGammaId);
}
private int getSourceBranchId() {
@@ -73,19 +71,21 @@ public class LoadDeltasBetweenBranches extends AbstractOperation {
}
@Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
+ public List<ChangeItem> call() throws Exception {
+ List<ChangeItem> changeData = new LinkedList<ChangeItem>();
+
Conditions.checkExpressionFailOnTrue(txDelta.areOnTheSameBranch(),
"Unable to compute deltas between transactions on the same branch [%s]", txDelta);
TransactionJoinQuery txJoin = JoinUtility.createTransactionJoinQuery();
- loadSourceBranchChanges(monitor, txJoin);
+ loadSourceBranchChanges(txJoin);
int txJoinId = txJoin.getQueryId();
try {
- loadByItemId(monitor, txJoinId, changeItemLoader.createArtifactChangeItemFactory());
- loadByItemId(monitor, txJoinId, changeItemLoader.createAttributeChangeItemFactory());
- loadByItemId(monitor, txJoinId, changeItemLoader.createRelationChangeItemFactory());
+ loadByItemId(changeData, txJoinId, changeItemLoader.createArtifactChangeItemFactory());
+ loadByItemId(changeData, txJoinId, changeItemLoader.createAttributeChangeItemFactory());
+ loadByItemId(changeData, txJoinId, changeItemLoader.createRelationChangeItemFactory());
} finally {
try {
txJoin.delete();
@@ -93,15 +93,16 @@ public class LoadDeltasBetweenBranches extends AbstractOperation {
changeByGammaId.clear();
}
}
+ return changeData;
}
- private void loadSourceBranchChanges(IProgressMonitor monitor, TransactionJoinQuery txJoin) throws OseeCoreException {
- IOseeStatement chStmt = oseeDatabaseProvider.getOseeDatabaseService().getStatement();
+ private void loadSourceBranchChanges(TransactionJoinQuery txJoin) throws OseeCoreException {
+ IOseeStatement chStmt = getDatabaseService().getStatement();
try {
chStmt.runPreparedQuery(10000, SELECT_SOURCE_BRANCH_CHANGES, getSourceBranchId(),
TxChange.NOT_CURRENT.getValue(), getSourceBaselineTransactionId());
while (chStmt.next()) {
- checkForCancelledStatus(monitor);
+ checkForCancelled();
Long gammaId = chStmt.getLong("gamma_id");
ModificationType modType = ModificationType.getMod(chStmt.getInt("mod_type"));
@@ -114,33 +115,33 @@ public class LoadDeltasBetweenBranches extends AbstractOperation {
}
}
- private void loadByItemId(IProgressMonitor monitor, int txJoinId, ChangeItemFactory factory) throws OseeCoreException {
+ private void loadByItemId(Collection<ChangeItem> changeData, int txJoinId, ChangeItemFactory factory) throws OseeCoreException {
HashMap<Integer, ChangeItem> changesByItemId = new HashMap<Integer, ChangeItem>();
IdJoinQuery idJoin = JoinUtility.createIdJoinQuery();
- changeItemLoader.loadItemIdsBasedOnGammas(monitor, factory, txJoinId, changesByItemId, idJoin);
+ changeItemLoader.loadItemIdsBasedOnGammas(factory, txJoinId, changesByItemId, idJoin);
idJoin.store();
if (hasMergeBranch()) {
- loadCurrentData(monitor, factory.getItemTableName(), factory.getItemIdColumnName(), idJoin, changesByItemId,
+ loadCurrentData(factory.getItemTableName(), factory.getItemIdColumnName(), idJoin, changesByItemId,
mergeTransaction);
}
- loadCurrentData(monitor, factory.getItemTableName(), factory.getItemIdColumnName(), idJoin, changesByItemId,
+ loadCurrentData(factory.getItemTableName(), factory.getItemIdColumnName(), idJoin, changesByItemId,
getCompareBranchHeadTx());
- loadNonCurrentSourceData(monitor, factory.getItemTableName(), factory.getItemIdColumnName(), idJoin,
- changesByItemId, factory.getItemValueColumnName());
+ loadNonCurrentSourceData(factory.getItemTableName(), factory.getItemIdColumnName(), idJoin, changesByItemId,
+ factory.getItemValueColumnName());
idJoin.delete();
changeData.addAll(changesByItemId.values());
}
- private void loadCurrentData(IProgressMonitor monitor, String tableName, String columnName, IdJoinQuery idJoin, HashMap<Integer, ChangeItem> changesByItemId, TransactionRecord transactionLimit) throws OseeCoreException {
- IOseeStatement chStmt = oseeDatabaseProvider.getOseeDatabaseService().getStatement();
+ private void loadCurrentData(String tableName, String columnName, IdJoinQuery idJoin, HashMap<Integer, ChangeItem> changesByItemId, TransactionRecord transactionLimit) throws OseeCoreException {
+ IOseeStatement chStmt = getDatabaseService().getStatement();
try {
String query = "select txs.gamma_id, txs.mod_type, item." + columnName + " from osee_join_id idj, " //
+ tableName + " item, osee_txs txs where idj.query_id = ? and idj.id = item." + columnName + //
@@ -150,7 +151,7 @@ public class LoadDeltasBetweenBranches extends AbstractOperation {
transactionLimit.getBranchId(), transactionLimit.getId());
while (chStmt.next()) {
- checkForCancelledStatus(monitor);
+ checkForCancelled();
Integer itemId = chStmt.getInt(columnName);
Long gammaId = chStmt.getLong("gamma_id");
@@ -169,8 +170,8 @@ public class LoadDeltasBetweenBranches extends AbstractOperation {
}
}
- private void loadNonCurrentSourceData(IProgressMonitor monitor, String tableName, String idColumnName, IdJoinQuery idJoin, HashMap<Integer, ChangeItem> changesByItemId, String columnValueName) throws OseeCoreException {
- IOseeStatement chStmt = oseeDatabaseProvider.getOseeDatabaseService().getStatement();
+ private void loadNonCurrentSourceData(String tableName, String idColumnName, IdJoinQuery idJoin, HashMap<Integer, ChangeItem> changesByItemId, String columnValueName) throws OseeCoreException {
+ IOseeStatement chStmt = getDatabaseService().getStatement();
String query;
try {
@@ -187,7 +188,7 @@ public class LoadDeltasBetweenBranches extends AbstractOperation {
int previousItemId = -1;
boolean isFirstSet = false;
while (chStmt.next()) {
- checkForCancelledStatus(monitor);
+ checkForCancelled();
int itemId = chStmt.getInt(idColumnName);
Integer transactionId = chStmt.getInt("transaction_id");
ModificationType modType = ModificationType.getMod(chStmt.getInt("mod_type"));
@@ -225,4 +226,5 @@ public class LoadDeltasBetweenBranches extends AbstractOperation {
versionedChange.setGammaId(gammaId);
}
}
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/change/LoadDeltasBetweenTxsOnTheSameBranch.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/LoadDeltasBetweenTxsOnTheSameBranch.java
index d6a74cb1cc3..fa07ad9ccb8 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/change/LoadDeltasBetweenTxsOnTheSameBranch.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/LoadDeltasBetweenTxsOnTheSameBranch.java
@@ -1,4 +1,5 @@
/*******************************************************************************
+ * Copyright (c) 2012 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
@@ -7,25 +8,26 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.branch.management.change;
+package org.eclipse.osee.orcs.db.internal.change;
import java.util.Collection;
import java.util.HashMap;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.branch.management.change.ChangeItemLoader.ChangeItemFactory;
-import org.eclipse.osee.framework.branch.management.internal.Activator;
+import java.util.LinkedList;
+import java.util.List;
+import org.eclipse.osee.database.schema.DatabaseCallable;
import org.eclipse.osee.framework.core.enums.ModificationType;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.TransactionDelta;
import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.core.model.change.ChangeItem;
-import org.eclipse.osee.framework.core.operation.AbstractOperation;
import org.eclipse.osee.framework.core.util.Conditions;
-import org.eclipse.osee.framework.database.IOseeDatabaseServiceProvider;
+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.database.core.TransactionJoinQuery;
+import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.db.internal.change.ChangeItemLoader.ChangeItemFactory;
/**
* @author Ryan D. Brooks
@@ -33,24 +35,20 @@ import org.eclipse.osee.framework.database.core.TransactionJoinQuery;
* @author Ryan Schmitt
* @author Jeff C. Phillips
*/
-public class LoadDeltasBetweenTxsOnTheSameBranch extends AbstractOperation {
+public class LoadDeltasBetweenTxsOnTheSameBranch extends DatabaseCallable<List<ChangeItem>> {
private static final String SELECT_CHANGES_AT_TRANSACTION =
"select gamma_id, mod_type from osee_txs where branch_id = ? and transaction_id = ?";
private final HashMap<Long, ModificationType> changeByGammaId = new HashMap<Long, ModificationType>();
- private final Collection<ChangeItem> changeData;
private final TransactionDelta txDelta;
- private final IOseeDatabaseServiceProvider oseeDatabaseProvider;
private final ChangeItemLoader changeItemLoader;
- public LoadDeltasBetweenTxsOnTheSameBranch(IOseeDatabaseServiceProvider oseeDatabaseProvider, TransactionDelta txDelta, Collection<ChangeItem> changeData) {
- super("Load Change Data", Activator.PLUGIN_ID);
- this.oseeDatabaseProvider = oseeDatabaseProvider;
+ public LoadDeltasBetweenTxsOnTheSameBranch(Log logger, IOseeDatabaseService dbService, TransactionDelta txDelta) {
+ super(logger, dbService);
this.txDelta = txDelta;
- this.changeData = changeData;
- this.changeItemLoader = new ChangeItemLoader(oseeDatabaseProvider, changeByGammaId);
+ this.changeItemLoader = new ChangeItemLoader(dbService, changeByGammaId);
}
private int getBranchId() {
@@ -66,19 +64,21 @@ public class LoadDeltasBetweenTxsOnTheSameBranch extends AbstractOperation {
}
@Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
+ public List<ChangeItem> call() throws Exception {
+ List<ChangeItem> changeData = new LinkedList<ChangeItem>();
+
Conditions.checkExpressionFailOnTrue(!txDelta.areOnTheSameBranch(),
"Unable to compute deltas between transactions on different branches [%s]", txDelta);
TransactionJoinQuery txJoin = JoinUtility.createTransactionJoinQuery();
- loadChangesAtEndTx(monitor, txJoin);
+ loadChangesAtEndTx(txJoin);
int txJoinId = txJoin.getQueryId();
try {
- loadByItemId(monitor, txJoinId, changeItemLoader.createArtifactChangeItemFactory());
- loadByItemId(monitor, txJoinId, changeItemLoader.createAttributeChangeItemFactory());
- loadByItemId(monitor, txJoinId, changeItemLoader.createRelationChangeItemFactory());
+ loadByItemId(changeData, txJoinId, changeItemLoader.createArtifactChangeItemFactory());
+ loadByItemId(changeData, txJoinId, changeItemLoader.createAttributeChangeItemFactory());
+ loadByItemId(changeData, txJoinId, changeItemLoader.createRelationChangeItemFactory());
} finally {
try {
txJoin.delete();
@@ -86,14 +86,15 @@ public class LoadDeltasBetweenTxsOnTheSameBranch extends AbstractOperation {
changeByGammaId.clear();
}
}
+ return changeData;
}
- private void loadChangesAtEndTx(IProgressMonitor monitor, TransactionJoinQuery txJoin) throws OseeCoreException {
- IOseeStatement chStmt = oseeDatabaseProvider.getOseeDatabaseService().getStatement();
+ private void loadChangesAtEndTx(TransactionJoinQuery txJoin) throws OseeCoreException {
+ IOseeStatement chStmt = getDatabaseService().getStatement();
try {
chStmt.runPreparedQuery(10000, SELECT_CHANGES_AT_TRANSACTION, getBranchId(), getEndTx().getId());
while (chStmt.next()) {
- checkForCancelledStatus(monitor);
+ checkForCancelled();
Long gammaId = chStmt.getLong("gamma_id");
ModificationType modType = ModificationType.getMod(chStmt.getInt("mod_type"));
@@ -106,25 +107,25 @@ public class LoadDeltasBetweenTxsOnTheSameBranch extends AbstractOperation {
}
}
- private void loadByItemId(IProgressMonitor monitor, int txJoinId, ChangeItemFactory factory) throws OseeCoreException {
+ private void loadByItemId(Collection<ChangeItem> changeData, int txJoinId, ChangeItemFactory factory) throws OseeCoreException {
HashMap<Integer, ChangeItem> changesByItemId = new HashMap<Integer, ChangeItem>();
IdJoinQuery idJoin = JoinUtility.createIdJoinQuery();
- changeItemLoader.loadItemIdsBasedOnGammas(monitor, factory, txJoinId, changesByItemId, idJoin);
+ changeItemLoader.loadItemIdsBasedOnGammas(factory, txJoinId, changesByItemId, idJoin);
idJoin.store();
- loadCurrentData(monitor, factory.getItemTableName(), factory.getItemIdColumnName(), idJoin.getQueryId(),
- changesByItemId, getStartTx());
+ loadCurrentData(factory.getItemTableName(), factory.getItemIdColumnName(), idJoin.getQueryId(), changesByItemId,
+ getStartTx());
idJoin.delete();
changeData.addAll(changesByItemId.values());
}
- private void loadCurrentData(IProgressMonitor monitor, String tableName, String columnName, int queryId, HashMap<Integer, ChangeItem> changesByItemId, TransactionRecord transactionLimit) throws OseeCoreException {
- IOseeStatement chStmt = oseeDatabaseProvider.getOseeDatabaseService().getStatement();
+ private void loadCurrentData(String tableName, String columnName, int queryId, HashMap<Integer, ChangeItem> changesByItemId, TransactionRecord transactionLimit) throws OseeCoreException {
+ IOseeStatement chStmt = getDatabaseService().getStatement();
try {
String query = "select txs.gamma_id, txs.mod_type, item." + columnName + " from osee_join_id idj, " //
+ tableName + " item, osee_txs txs where idj.query_id = ? and idj.id = item." + columnName + //
@@ -133,7 +134,7 @@ public class LoadDeltasBetweenTxsOnTheSameBranch extends AbstractOperation {
chStmt.runPreparedQuery(10000, query, queryId, transactionLimit.getBranchId(), transactionLimit.getId());
while (chStmt.next()) {
- checkForCancelledStatus(monitor);
+ checkForCancelled();
Integer itemId = chStmt.getInt(columnName);
Long gammaId = chStmt.getLong("gamma_id");
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/RelationChangeItemFactory.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/RelationChangeItemFactory.java
new file mode 100644
index 00000000000..c95fff991e1
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/RelationChangeItemFactory.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.orcs.db.internal.change;
+
+import java.util.HashMap;
+import org.eclipse.osee.framework.core.enums.ModificationType;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.change.ChangeItem;
+import org.eclipse.osee.framework.core.model.change.RelationChangeItem;
+import org.eclipse.osee.framework.database.core.IOseeStatement;
+import org.eclipse.osee.orcs.db.internal.change.ChangeItemLoader.ChangeItemFactory;
+
+public final class RelationChangeItemFactory implements ChangeItemFactory {
+ private static final String SELECT_RELATIONS_BY_GAMMAS =
+ "select a_art_id, b_art_id, rel_link_id, rel_link_type_id, rationale, txj.gamma_id from osee_relation_link id, osee_join_transaction txj where id.gamma_id = txj.gamma_id and txj.query_id = ?";
+
+ private final HashMap<Long, ModificationType> changeByGammaId;
+
+ public RelationChangeItemFactory(HashMap<Long, ModificationType> changeByGammaId) {
+ super();
+ this.changeByGammaId = changeByGammaId;
+ }
+
+ @Override
+ public String getLoadByGammaQuery() {
+ return SELECT_RELATIONS_BY_GAMMAS;
+ }
+
+ @Override
+ public ChangeItem createItem(IOseeStatement chStmt) throws OseeCoreException {
+ int relLinkId = chStmt.getInt("rel_link_id");
+ int relTypeId = chStmt.getInt("rel_link_type_id");
+
+ long gammaId = chStmt.getLong("gamma_id");
+ ModificationType modType = changeByGammaId.get(gammaId);
+
+ int aArtId = chStmt.getInt("a_art_id");
+ int bArtId = chStmt.getInt("b_art_id");
+ String rationale = chStmt.getString("rationale");
+
+ return new RelationChangeItem(relLinkId, relTypeId, gammaId, modType, aArtId, bArtId, rationale);
+ }
+
+ @Override
+ public String getItemIdColumnName() {
+ return "rel_link_id";
+ }
+
+ @Override
+ public String getItemTableName() {
+ return "osee_relation_link";
+ }
+
+ @Override
+ public String getItemValueColumnName() {
+ return "rationale";
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/change/ComputeConflictsOperation.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/conflict/ComputeConflictsCallable.java
index 7886cf89325..d2c80db4742 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/change/ComputeConflictsOperation.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/conflict/ComputeConflictsCallable.java
@@ -8,48 +8,42 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.branch.management.change;
+package org.eclipse.osee.orcs.db.internal.conflict;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.branch.management.internal.Activator;
+import org.eclipse.osee.executor.admin.CancellableCallable;
import org.eclipse.osee.framework.core.enums.ConflictStatus;
import org.eclipse.osee.framework.core.model.change.ChangeItem;
-import org.eclipse.osee.framework.core.operation.AbstractOperation;
/**
* @author Roberto E. Escobar
*/
-public class ComputeConflictsOperation extends AbstractOperation {
+public class ComputeConflictsCallable extends CancellableCallable<Object> {
private final Collection<ChangeItem> changes;
private final Map<ChangeItem, ConflictStatus> conflicts;
- public ComputeConflictsOperation(Collection<ChangeItem> changes, Map<ChangeItem, ConflictStatus> conflicts) {
- super("Compute Conflicts", Activator.PLUGIN_ID);
+ public ComputeConflictsCallable(Collection<ChangeItem> changes, Map<ChangeItem, ConflictStatus> conflicts) {
+ super();
this.changes = changes;
this.conflicts = conflicts;
}
@Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
+ public Object call() throws Exception {
if (!changes.isEmpty()) {
- double workPercentage = 1.0 / changes.size();
-
Iterator<ChangeItem> iterator = changes.iterator();
while (iterator.hasNext()) {
- checkForCancelledStatus(monitor);
+ checkForCancelled();
ChangeItem change = iterator.next();
ConflictStatus conflictStatus = getConflictStatus(change);
if (conflictStatus.isConflict()) {
conflicts.put(change, conflictStatus);
}
- monitor.worked(calculateWork(workPercentage));
}
- } else {
- monitor.worked(calculateWork(1.0));
}
+ return null;
}
private ConflictStatus getConflictStatus(ChangeItem change) {
@@ -58,12 +52,12 @@ public class ComputeConflictsOperation extends AbstractOperation {
// item changed on source and destination
if (change.getCurrentVersion().getGammaId() != change.getDestinationVersion().getGammaId()) {
-
+ //
}
// destination current gamma != source baseline gamma
if (change.getDestinationVersion().getGammaId() != change.getBaselineVersion().getGammaId()) {
-
+ //
}
}
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/change/Conflict.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/conflict/Conflict.java
index 9b5cc30a8e0..f7e8de1fe5e 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/change/Conflict.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/conflict/Conflict.java
@@ -8,7 +8,7 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.branch.management.change;
+package org.eclipse.osee.orcs.db.internal.conflict;
import org.eclipse.osee.framework.core.enums.ConflictStatus;
import org.eclipse.osee.framework.core.enums.ConflictType;
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/change/ConflictUtil.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/conflict/ConflictUtil.java
index db00e8600f1..7f22532f8d0 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/change/ConflictUtil.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/conflict/ConflictUtil.java
@@ -8,7 +8,7 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.branch.management.change;
+package org.eclipse.osee.orcs.db.internal.conflict;
import org.eclipse.osee.framework.core.enums.ConflictStatus;
import org.eclipse.osee.framework.core.enums.ConflictType;
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/proxy/MappedDataProxy.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/proxy/MappedDataProxy.java
index 37e6eedfc3c..f909f6c2a96 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/proxy/MappedDataProxy.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/proxy/MappedDataProxy.java
@@ -92,7 +92,7 @@ public class MappedDataProxy extends AbstractDataProxy implements CharacterDataP
}
@Override
- public void purge() throws OseeCoreException {
+ public void purge() {
// TODO
// try {
// if (isRemoteUriValid()) {
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/resource/AttributeProvider.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/resource/AttributeProvider.java
index 5dbe5c45fb5..c1247c3d088 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/resource/AttributeProvider.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/resource/AttributeProvider.java
@@ -51,8 +51,8 @@ public class AttributeProvider implements IResourceProvider {
}
public void start() throws OseeCoreException {
- binaryDataPath = preferences.getValue(ResourceConstants.BINARY_DATA_PATH);
- attributeDataPath = binaryDataPath + File.separator + ResourceConstants.RESOURCE_PROTOCOL + File.separator;
+ binaryDataPath = ResourceConstants.getBinaryDataPath(preferences);
+ attributeDataPath = ResourceConstants.getAttributeDataPath(preferences);
isInitialized = true;
}
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.orcs.db/src/org/eclipse/osee/orcs/db/internal/resource/OseeDatastoreSchemaResource.java
index f038cb9987c..ea253966f23 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/CoreOseeSchemaResource.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/resource/OseeDatastoreSchemaResource.java
@@ -8,25 +8,26 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.datastore.internal;
+package org.eclipse.osee.orcs.db.internal.resource;
+import java.io.BufferedInputStream;
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.database.schema.SchemaResource;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeExceptions;
import org.osgi.framework.Bundle;
+import org.osgi.framework.FrameworkUtil;
-public class CoreOseeSchemaResource implements IOseeSchemaResource {
+public class OseeDatastoreSchemaResource implements SchemaResource {
@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();
+ Bundle bundle = FrameworkUtil.getBundle(this.getClass());
+ URL url = bundle.getEntry("schema/SKYNET.VERSIONING.SCHEMA.xml");
+ inputStream = new BufferedInputStream(url.openStream());
} catch (Exception ex) {
OseeExceptions.wrapAndThrow(ex);
}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/resource/ResourceConstants.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/resource/ResourceConstants.java
index c6af35cd881..e32d66eb772 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/resource/ResourceConstants.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/resource/ResourceConstants.java
@@ -10,6 +10,10 @@
*******************************************************************************/
package org.eclipse.osee.orcs.db.internal.resource;
+import java.io.File;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.orcs.core.SystemPreferences;
+
/**
* @author Roberto E. Escobar
*/
@@ -22,4 +26,13 @@ public final class ResourceConstants {
public static final String RESOURCE_PROTOCOL = "attr";
public static final String BINARY_DATA_PATH = "osee.application.server.data";
+
+ public static String getAttributeDataPath(SystemPreferences preferences) throws OseeCoreException {
+ String binaryDataPath = getBinaryDataPath(preferences);
+ return binaryDataPath + File.separator + ResourceConstants.RESOURCE_PROTOCOL + File.separator;
+ }
+
+ public static String getBinaryDataPath(SystemPreferences preferences) throws OseeCoreException {
+ return preferences.getValue(ResourceConstants.BINARY_DATA_PATH);
+ }
}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/util/DataStoreInfoImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/util/DataStoreInfoImpl.java
new file mode 100644
index 00000000000..c4343144148
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/util/DataStoreInfoImpl.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.orcs.db.internal.util;
+
+import java.util.Map;
+import org.eclipse.osee.orcs.core.ds.DataStoreInfo;
+
+public class DataStoreInfoImpl implements DataStoreInfo {
+
+ @Override
+ public Map<String, String> getProperties() {
+ return null;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/util/DynamicSchemaResourceProvider.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/util/DynamicSchemaResourceProvider.java
new file mode 100644
index 00000000000..ddf3aa5abcb
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/util/DynamicSchemaResourceProvider.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.orcs.db.internal.util;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.osee.database.schema.SchemaResource;
+import org.eclipse.osee.database.schema.SchemaResourceProvider;
+import org.eclipse.osee.logger.Log;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class DynamicSchemaResourceProvider implements SchemaResourceProvider {
+
+ private final Log logger;
+
+ public DynamicSchemaResourceProvider(Log logger) {
+ super();
+ this.logger = logger;
+ }
+
+ @Override
+ public Collection<SchemaResource> getSchemaResources() {
+ List<SchemaResource> resources = new ArrayList<SchemaResource>();
+
+ Bundle bundle = FrameworkUtil.getBundle(this.getClass());
+ BundleContext context = bundle.getBundleContext();
+ try {
+ Collection<ServiceReference<SchemaResource>> references =
+ context.getServiceReferences(SchemaResource.class, null);
+
+ for (ServiceReference<SchemaResource> ref : references) {
+ SchemaResource resource = context.getService(ref);
+ resources.add(resource);
+ }
+
+ } catch (InvalidSyntaxException ex) {
+ logger.warn(ex.toString(), ex);
+ }
+
+ return resources;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.orcs.parent/pom.xml b/plugins/org.eclipse.osee.orcs.parent/pom.xml
index 68ca59febb2..d9ac981375b 100644
--- a/plugins/org.eclipse.osee.orcs.parent/pom.xml
+++ b/plugins/org.eclipse.osee.orcs.parent/pom.xml
@@ -23,6 +23,7 @@
<module>../../plugins/org.eclipse.osee.framework.database.test</module>
<module>../../plugins/org.eclipse.osee.database</module>
+ <module>../../plugins/org.eclipse.osee.database.schema</module>
<module>../../plugins/org.eclipse.osee.orcs</module>
<module>../../plugins/org.eclipse.osee.orcs.core</module>
@@ -439,19 +440,10 @@
<append>true</append>
</configuration>
</execution>
- <!-- <execution>
- <id>create-coverage-reports</id>
- <phase>verify</phase>
- <goals>
- <goal>report</goal>
- </goals>
- <configuration>
- <dataFile>${sonar.jacoco.reportPath}</dataFile>
- <includes>*.osee.*</includes>
- <outputDirectory>${coverage.reportPath}</outputDirectory>
- <outputEncoding>UTF-8</outputEncoding>
- </configuration>
- </execution>-->
+ <!-- <execution> <id>create-coverage-reports</id> <phase>verify</phase>
+ <goals> <goal>report</goal> </goals> <configuration> <dataFile>${sonar.jacoco.reportPath}</dataFile>
+ <includes>*.osee.*</includes> <outputDirectory>${coverage.reportPath}</outputDirectory>
+ <outputEncoding>UTF-8</outputEncoding> </configuration> </execution> -->
</executions>
</plugin>
</plugins>
diff --git a/plugins/org.eclipse.osee.orcs/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.orcs/META-INF/MANIFEST.MF
index 347cfa0ad49..8f412eb8d22 100644
--- a/plugins/org.eclipse.osee.orcs/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.orcs/META-INF/MANIFEST.MF
@@ -11,11 +11,13 @@ Import-Package: org.eclipse.osee.executor.admin,
org.eclipse.osee.framework.core.exception,
org.eclipse.osee.framework.core.model,
org.eclipse.osee.framework.core.model.cache,
+ org.eclipse.osee.framework.core.model.change,
org.eclipse.osee.framework.core.model.type,
org.eclipse.osee.framework.jdk.core.type,
org.eclipse.osee.framework.jdk.core.util
Export-Package: org.eclipse.osee.orcs,
org.eclipse.osee.orcs.data,
org.eclipse.osee.orcs.search,
+ org.eclipse.osee.orcs.transaction,
org.eclipse.osee.orcs.utility
Require-Bundle: org.eclipse.core.runtime
diff --git a/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/commit/BranchCommitServiceTest.java b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/OrcsAdmin.java
index 41c007f3519..89d6816e7e6 100644
--- a/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/commit/BranchCommitServiceTest.java
+++ b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/OrcsAdmin.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Boeing.
+ * Copyright (c) 2012 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
@@ -8,21 +8,18 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.branch.management.test.commit;
+package org.eclipse.osee.orcs;
-import org.junit.Ignore;
-import org.junit.Test;
+import java.util.Map;
+import java.util.concurrent.Callable;
/**
- * Test Case For {@link BranchCommitService}
- *
* @author Roberto E. Escobar
*/
-public class BranchCommitServiceTest {
+public interface OrcsAdmin {
+
+ Callable<OrcsMetaData> createFetchOrcsMetaData();
+
+ Callable<OrcsMetaData> createDatastore(Map<String, String> parameters);
- @Ignore
- @Test
- public void testTX() {
- // Add test
- }
}
diff --git a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/OrcsApi.java b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/OrcsApi.java
index fd7e1410ad8..91e06ec787c 100644
--- a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/OrcsApi.java
+++ b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/OrcsApi.java
@@ -13,6 +13,7 @@ package org.eclipse.osee.orcs;
import org.eclipse.osee.framework.core.model.cache.BranchCache;
import org.eclipse.osee.orcs.search.QueryFacade;
import org.eclipse.osee.orcs.search.QueryFactory;
+import org.eclipse.osee.orcs.transaction.TransactionFactory;
/**
* @author Andrew M. Finkbeiner
@@ -26,8 +27,13 @@ public interface OrcsApi {
Graph getGraph(ApplicationContext context);
- DataStoreTypeCache getDataStoreTypeCache();
+ OrcsBranch getBranchOps(ApplicationContext context);
+ OrcsAdmin getAdminOps(ApplicationContext context);
+
+ TransactionFactory getTransactionFactory(ApplicationContext context);
+
+ // TODO remove this call
BranchCache getBranchCache();
}
diff --git a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/OrcsBranch.java b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/OrcsBranch.java
new file mode 100644
index 00000000000..32cd07d0c78
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/OrcsBranch.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.orcs;
+
+import java.util.List;
+import java.util.concurrent.Callable;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
+import org.eclipse.osee.framework.core.data.ITransaction;
+import org.eclipse.osee.framework.core.enums.BranchState;
+import org.eclipse.osee.framework.core.enums.BranchType;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.ReadableBranch;
+import org.eclipse.osee.framework.core.model.TransactionRecord;
+import org.eclipse.osee.framework.core.model.change.ChangeItem;
+import org.eclipse.osee.orcs.data.ArchiveOperation;
+import org.eclipse.osee.orcs.data.CreateBranchData;
+import org.eclipse.osee.orcs.data.ReadableArtifact;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface OrcsBranch {
+
+ Callable<ReadableBranch> createBranch(CreateBranchData branchData);
+
+ Callable<ReadableBranch> archiveUnarchiveBranch(IOseeBranch branch, ArchiveOperation archiveOp);
+
+ Callable<ReadableBranch> deleteBranch(IOseeBranch branch);
+
+ Callable<List<ReadableBranch>> purgeBranch(IOseeBranch branch, boolean recurse);
+
+ Callable<TransactionRecord> commitBranch(ReadableArtifact committer, IOseeBranch source, IOseeBranch destination);
+
+ Callable<List<ChangeItem>> compareBranch(ITransaction sourceTx, ITransaction destinationTx);
+
+ Callable<ReadableBranch> changeBranchState(IOseeBranch branch, BranchState newState);
+
+ Callable<ReadableBranch> changeBranchType(IOseeBranch branch, BranchType branchType);
+
+ // For backwards compatibility - should be removed in the future or added to branchQuery
+ ReadableBranch getBranchFromId(int id) throws OseeCoreException;
+
+}
diff --git a/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/commit/CommitTestSuite.java b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/OrcsMetaData.java
index ad723ecfdb8..2d2487340f7 100644
--- a/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/commit/CommitTestSuite.java
+++ b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/OrcsMetaData.java
@@ -8,18 +8,11 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.branch.management.test.commit;
+package org.eclipse.osee.orcs;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses({//
-BranchCommitServiceTest.class //
-})
/**
* @author Roberto E. Escobar
*/
-public class CommitTestSuite {
+public interface OrcsMetaData {
//
}
diff --git a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/ArchiveOperation.java b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/ArchiveOperation.java
new file mode 100644
index 00000000000..6a29cba8f28
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/ArchiveOperation.java
@@ -0,0 +1,6 @@
+package org.eclipse.osee.orcs.data;
+
+public enum ArchiveOperation {
+ ARCHIVE,
+ UNARCHIVE;
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/CreateBranchData.java b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/CreateBranchData.java
new file mode 100644
index 00000000000..3f9a83ba937
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/CreateBranchData.java
@@ -0,0 +1,137 @@
+/*******************************************************************************
+ * 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.orcs.data;
+
+import org.eclipse.osee.framework.core.data.ITransaction;
+import org.eclipse.osee.framework.core.data.Identifiable;
+import org.eclipse.osee.framework.core.data.Identity;
+import org.eclipse.osee.framework.core.enums.BranchType;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class CreateBranchData implements Identifiable {
+
+ private String branchUuid;
+ private String branchName;
+ private BranchType branchType;
+ private String creationComment;
+ private ITransaction fromTransaction;
+ private ReadableArtifact associatedArtifact;
+ private ReadableArtifact userArtifact;
+
+ // Merge Branch Legacy Support
+ private int populateBaseTxFromAddressingQueryId;
+ private int destinationBranchId;
+
+ @Override
+ public String getGuid() {
+ return branchUuid;
+ }
+
+ public void setGuid(String branchUuid) {
+ this.branchUuid = branchUuid;
+ }
+
+ @Override
+ public String getName() {
+ return branchName;
+ }
+
+ public void setName(String branchName) {
+ this.branchName = branchName;
+ }
+
+ public BranchType getBranchType() {
+ return branchType;
+ }
+
+ public void setBranchType(BranchType branchType) {
+ this.branchType = branchType;
+ }
+
+ public String getCreationComment() {
+ return creationComment;
+ }
+
+ public void setCreationComment(String creationComment) {
+ this.creationComment = creationComment;
+ }
+
+ public ITransaction getFromTransaction() {
+ return fromTransaction;
+ }
+
+ public void setFromTransaction(ITransaction fromTransaction) {
+ this.fromTransaction = fromTransaction;
+ }
+
+ public ReadableArtifact getUserArtifact() {
+ return userArtifact;
+ }
+
+ public void setUserArtifact(ReadableArtifact userArtifact) {
+ this.userArtifact = userArtifact;
+ }
+
+ public ReadableArtifact getAssociatedArtifact() {
+ return associatedArtifact;
+ }
+
+ public void setAssociatedArtifact(ReadableArtifact associatedArtifact) {
+ this.associatedArtifact = associatedArtifact;
+ }
+
+ public int getPopulateBaseTxFromAddressingQueryId() {
+ return populateBaseTxFromAddressingQueryId;
+ }
+
+ public void setPopulateBaseTxFromAddressingQueryId(int populateBaseTxFromAddressingQueryId) {
+ this.populateBaseTxFromAddressingQueryId = populateBaseTxFromAddressingQueryId;
+ }
+
+ public int getDestinationBranchId() {
+ return destinationBranchId;
+ }
+
+ public void setDestinationBranchId(int destinationBranchId) {
+ this.destinationBranchId = destinationBranchId;
+ }
+
+ @Override
+ public int hashCode() {
+ return getGuid().hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof Identity) {
+ return getGuid().equals(((Identity<?>) obj).getGuid());
+ }
+ return false;
+ }
+
+ @Override
+ public boolean matches(Identity<?>... identities) {
+ for (Identity<?> identity : identities) {
+ if (equals(identity)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return "CreateBranchData [branchUuid=" + branchUuid + ", branchName=" + branchName + ", branchType=" + branchType + ", creationComment=" + creationComment + ", fromTransaction=" + fromTransaction + ", associatedArtifact=" + associatedArtifact + ", userArtifact=" + userArtifact + ", populateBaseTxFromAddressingQueryId=" + populateBaseTxFromAddressingQueryId + ", destinationBranchId=" + destinationBranchId + "]";
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/transaction/OrcsTransaction.java b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/transaction/OrcsTransaction.java
new file mode 100644
index 00000000000..ef5a65cd8e0
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/transaction/OrcsTransaction.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.orcs.transaction;
+
+import java.util.concurrent.Callable;
+import org.eclipse.osee.framework.core.data.IRelationTypeSide;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface OrcsTransaction {
+
+ // TODO define better API
+ void deleteRelation(IRelationTypeSide relationType, int aArtId, int bArtId);
+
+ Callable<?> build();
+}
diff --git a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/transaction/TransactionFactory.java b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/transaction/TransactionFactory.java
new file mode 100644
index 00000000000..b52f0808950
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/transaction/TransactionFactory.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.orcs.transaction;
+
+import org.eclipse.osee.framework.core.data.IOseeBranch;
+import org.eclipse.osee.orcs.data.ReadableArtifact;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface TransactionFactory {
+
+ OrcsTransaction createTransaction(IOseeBranch branch, String comment, ReadableArtifact authorArtifact);
+
+}
diff --git a/plugins/org.eclipse.osee.support.config/launchConfig/OSEE.X.Server.launch b/plugins/org.eclipse.osee.support.config/launchConfig/OSEE.X.Server.launch
index 0cf37e6ba76..9dba6db0e6f 100644
--- a/plugins/org.eclipse.osee.support.config/launchConfig/OSEE.X.Server.launch
+++ b/plugins/org.eclipse.osee.support.config/launchConfig/OSEE.X.Server.launch
@@ -18,11 +18,11 @@
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-XX:MaxPermSize=256m&#13;&#10;-Xmx1024m&#13;&#10;-Declipse.ignoreApp=true &#13;&#10;-Dosgi.noShutdown=true&#13;&#10;-Dorg.osgi.service.http.port=8089&#13;&#10;-Dosee.db.connection.id=h2&#13;&#10;-Dosee.db.embedded.server=0.0.0.0:8088&#13;&#10;-Dosee.log.default=INFO"/>
<stringAttribute key="pde.version" value="3.3"/>
-<booleanAttribute key="show_selected_only" value="false"/>
+<booleanAttribute key="show_selected_only" value="true"/>
<stringAttribute key="target_bundles" value="ch.qos.logback.classic@default:default,ch.qos.logback.core@default:default,ch.qos.logback.slf4j@default:false,com.google.collect@default:default,com.google.inject@default:default,com.ibm.icu@default:default,javax.activation@default:default,javax.mail.glassfish@default:default,javax.servlet@default:default,javax.xml@default:default,org.antlr.runtime@default:default,org.aopalliance@default:default,org.apache.commons.codec@default:default,org.apache.commons.httpclient@default:default,org.apache.commons.lang@default:default,org.apache.commons.logging@default:default,org.apache.log4j@default:default,org.apache.xerces@default:default,org.apache.xml.resolver@default:default,org.apache.xml.serializer@default:default,org.eclipse.ant.core@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.filesystem.win32.x86@default:false,org.eclipse.core.filesystem@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.net.win32.x86@default:false,org.eclipse.core.net@default:default,org.eclipse.core.resources.win32.x86@default:false,org.eclipse.core.resources@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.emf.common@default:default,org.eclipse.emf.compare.diff@default:default,org.eclipse.emf.compare.match@default:default,org.eclipse.emf.compare@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.emf.edit@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.ds@1:true,org.eclipse.equinox.event@default:default,org.eclipse.equinox.http.jetty@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.security.win32.x86@default:false,org.eclipse.equinox.security@default:default,org.eclipse.equinox.servletbridge.extensionbundle@default:false,org.eclipse.equinox.transforms.hook@default:false,org.eclipse.equinox.util@default:default,org.eclipse.equinox.weaving.hook@default:false,org.eclipse.osgi.services@default:default,org.eclipse.osgi.util@default:default,org.eclipse.osgi@-1:true,org.eclipse.team.core@default:default,org.eclipse.xtext.logging@default:false,org.eclipse.xtext.util@default:default,org.eclipse.xtext@default:default,org.h2@default:default,org.hamcrest.core@default:default,org.junit*4.8.2.v4_8_2_v20110321-1705@default:default,org.mortbay.jetty.server@default:default,org.mortbay.jetty.util@default:default,org.objectweb.asm@default:default,org.slf4j.api@default:default,org.slf4j.jcl@default:default"/>
<stringAttribute key="timestamp" value="1319577188755"/>
<booleanAttribute key="tracing" value="false"/>
<booleanAttribute key="useCustomFeatures" value="false"/>
<booleanAttribute key="useDefaultConfigArea" value="true"/>
-<stringAttribute key="workspace_bundles" value="com.sun.jersey@default:default,com.vaadin@default:default,javax.ws.rs@default:default,org.eclipse.osee.database@default:default,org.eclipse.osee.demo.db.connection@default:default,org.eclipse.osee.distributed@default:default,org.eclipse.osee.event.osgi@default:default,org.eclipse.osee.event@default:default,org.eclipse.osee.executor.admin@default:default,org.eclipse.osee.framework.core.dsl.integration.test@default:false,org.eclipse.osee.framework.core.dsl.integration@default:default,org.eclipse.osee.framework.core.dsl@default:default,org.eclipse.osee.framework.core.model.test@default:false,org.eclipse.osee.framework.core.model@default:default,org.eclipse.osee.framework.core.test@default:false,org.eclipse.osee.framework.core@default:default,org.eclipse.osee.framework.database.test@default:false,org.eclipse.osee.framework.database@default:default,org.eclipse.osee.framework.h2@default:default,org.eclipse.osee.framework.jdk.core.test@default:false,org.eclipse.osee.framework.jdk.core@default:default,org.eclipse.osee.framework.logging.test@default:false,org.eclipse.osee.framework.logging@default:default,org.eclipse.osee.framework.resource.management.test@default:false,org.eclipse.osee.framework.resource.management@default:default,org.eclipse.osee.logger.slf4j@default:default,org.eclipse.osee.logger@default:default,org.eclipse.osee.orcs.core.integration.test@default:false,org.eclipse.osee.orcs.core.test@default:false,org.eclipse.osee.orcs.core@default:default,org.eclipse.osee.orcs.db.mock@default:default,org.eclipse.osee.orcs.db.test@default:false,org.eclipse.osee.orcs.db@default:default,org.eclipse.osee.orcs.mock@default:default,org.eclipse.osee.orcs.rest@default:default,org.eclipse.osee.orcs@default:default,org.eclipse.osee.rest.admin@default:default,org.eclipse.osee.vaadin.themes@default:false,org.eclipse.osee.vaadin.widgets@default:default,org.eclipse.osee.vaadin@default:default,org.jvnet.mimepull@default:default"/>
+<stringAttribute key="workspace_bundles" value="com.sun.jersey@default:default,com.vaadin@default:default,javax.ws.rs@default:default,org.eclipse.osee.database.schema@default:default,org.eclipse.osee.database@default:default,org.eclipse.osee.demo.db.connection@default:default,org.eclipse.osee.distributed@default:default,org.eclipse.osee.event.osgi@default:default,org.eclipse.osee.event@default:default,org.eclipse.osee.executor.admin.test@default:default,org.eclipse.osee.executor.admin@default:default,org.eclipse.osee.framework.core.dsl.integration.test@default:false,org.eclipse.osee.framework.core.dsl.integration@default:default,org.eclipse.osee.framework.core.dsl@default:default,org.eclipse.osee.framework.core.model.test@default:false,org.eclipse.osee.framework.core.model@default:default,org.eclipse.osee.framework.core.test@default:false,org.eclipse.osee.framework.core@default:default,org.eclipse.osee.framework.database.test@default:false,org.eclipse.osee.framework.database@default:default,org.eclipse.osee.framework.h2@default:default,org.eclipse.osee.framework.jdk.core.test@default:false,org.eclipse.osee.framework.jdk.core@default:default,org.eclipse.osee.framework.logging.test@default:false,org.eclipse.osee.framework.logging@default:default,org.eclipse.osee.framework.resource.management.test@default:false,org.eclipse.osee.framework.resource.management@default:default,org.eclipse.osee.logback.config@default:default,org.eclipse.osee.logger.slf4j@default:default,org.eclipse.osee.logger@default:default,org.eclipse.osee.orcs.core.integration.test@default:false,org.eclipse.osee.orcs.core.test@default:false,org.eclipse.osee.orcs.core@default:default,org.eclipse.osee.orcs.db.mock@default:default,org.eclipse.osee.orcs.db.test@default:false,org.eclipse.osee.orcs.db@default:default,org.eclipse.osee.orcs.rest@default:default,org.eclipse.osee.orcs@default:default,org.eclipse.osee.rest.admin@default:default,org.eclipse.osee.vaadin.themes@default:false,org.eclipse.osee.vaadin.widgets@default:default,org.eclipse.osee.vaadin@default:default,org.jvnet.mimepull@default:default"/>
</launchConfiguration>

Back to the top