diff options
Diffstat (limited to 'plugins')
91 files changed, 555 insertions, 715 deletions
diff --git a/plugins/org.eclipse.osee.ats.core.client/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ats.core.client/META-INF/MANIFEST.MF index bed4f34d054..a0e916f2663 100644 --- a/plugins/org.eclipse.osee.ats.core.client/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.ats.core.client/META-INF/MANIFEST.MF @@ -52,8 +52,6 @@ Import-Package: com.google.inject, org.eclipse.osee.framework.core.operation, org.eclipse.osee.framework.core.services, org.eclipse.osee.framework.core.util, - org.eclipse.osee.framework.database, - org.eclipse.osee.framework.database.core, org.eclipse.osee.framework.jdk.core.type, org.eclipse.osee.framework.jdk.core.util, org.eclipse.osee.framework.jdk.core.util.xml, @@ -77,6 +75,7 @@ Import-Package: com.google.inject, org.eclipse.osee.framework.ui.skynet.notify, org.eclipse.osee.framework.ui.skynet.util, org.eclipse.osee.jaxrs.client, + org.eclipse.osee.jdbc, org.osgi.framework Export-Package: org.eclipse.osee.ats.core.client, org.eclipse.osee.ats.core.client.access, diff --git a/plugins/org.eclipse.osee.ats.core.client/OSGI-INF/ats.client.service.xml b/plugins/org.eclipse.osee.ats.core.client/OSGI-INF/ats.client.service.xml index bc95a1bc459..8768a2729fd 100644 --- a/plugins/org.eclipse.osee.ats.core.client/OSGI-INF/ats.client.service.xml +++ b/plugins/org.eclipse.osee.ats.core.client/OSGI-INF/ats.client.service.xml @@ -8,5 +8,5 @@ <provide interface="org.eclipse.osee.ats.core.client.internal.IAtsWorkItemArtifactServiceProvider"/> </service> <reference bind="setAtsWorkDefinitionService" cardinality="1..1" interface="org.eclipse.osee.ats.api.workdef.IAtsWorkDefinitionService" name="IAtsWorkDefinitionService" policy="static"/> - <reference bind="setDatabaseService" cardinality="1..1" interface="org.eclipse.osee.framework.database.IOseeDatabaseService" name="IOseeDatabaseService" policy="static"/> + <reference bind="setJdbcService" cardinality="1..1" interface="org.eclipse.osee.jdbc.JdbcService" name="JdbcService" policy="static" target="(osgi.binding=skynet.jdbc.service)"/> </scr:component> diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/branch/internal/AtsBranchServiceImpl.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/branch/internal/AtsBranchServiceImpl.java index e09c751586f..8f3989a30de 100644 --- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/branch/internal/AtsBranchServiceImpl.java +++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/branch/internal/AtsBranchServiceImpl.java @@ -141,7 +141,8 @@ public class AtsBranchServiceImpl extends AbstractAtsBranchService { TransactionRecord txRecord = (TransactionRecord) transaction; result = txRecord.getBranch(); if (result == null) { - result = TransactionManager.getTransactionId(transaction.getGuid()).getBranch(); + Integer transactionId = transaction.getGuid(); + result = TransactionManager.getTransactionId(transactionId).getBranch(); } return result; } diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsClientImpl.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsClientImpl.java index 44b36c54c37..013e95afb31 100644 --- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsClientImpl.java +++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsClientImpl.java @@ -104,7 +104,6 @@ import org.eclipse.osee.framework.core.data.IArtifactType; import org.eclipse.osee.framework.core.enums.CoreAttributeTypes; import org.eclipse.osee.framework.core.exception.ArtifactDoesNotExist; import org.eclipse.osee.framework.core.util.XResultData; -import org.eclipse.osee.framework.database.IOseeDatabaseService; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.type.OseeStateException; import org.eclipse.osee.framework.jdk.core.util.Conditions; @@ -113,6 +112,7 @@ import org.eclipse.osee.framework.plugin.core.util.Jobs; import org.eclipse.osee.framework.skynet.core.artifact.Artifact; import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager; import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery; +import org.eclipse.osee.jdbc.JdbcService; /** * @author Donald G. Dunne @@ -147,7 +147,7 @@ public class AtsClientImpl implements IAtsClient { private IAtsLogFactory logFactory; private IAtsColumnUtilities columnUtilities; private IAtsUtilService utilService; - private IOseeDatabaseService dbService; + private JdbcService jdbcService; private IAtsWorkItemFactory workItemFactory; private IAtsConfigItemFactory configItemFactory; private ActionableItemManager actionableItemManager; @@ -155,8 +155,8 @@ public class AtsClientImpl implements IAtsClient { private IAtsProgramService programService; private IAtsTeamDefinitionService teamDefinitionService; - public void setDatabaseService(IOseeDatabaseService dbService) { - this.dbService = dbService; + public void setJdbcService(JdbcService jdbcService) { + this.jdbcService = jdbcService; } public void setAtsWorkDefinitionService(IAtsWorkDefinitionService workDefService) { @@ -220,7 +220,7 @@ public class AtsClientImpl implements IAtsClient { @Override public long getNext(String sequenceName) { - return dbService.getNextSequence(sequenceName); + return jdbcService.getClient().getNextSequence(sequenceName); } }; utilService = AtsCoreFactory.getUtilService(attributeResolverService); diff --git a/plugins/org.eclipse.osee.ats/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ats/META-INF/MANIFEST.MF index 70bdbfd96ff..a0f8709fd2f 100644 --- a/plugins/org.eclipse.osee.ats/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.ats/META-INF/MANIFEST.MF @@ -144,7 +144,6 @@ Import-Package: com.google.gson, org.eclipse.osee.framework.core.operation, org.eclipse.osee.framework.core.services, org.eclipse.osee.framework.core.util, - org.eclipse.osee.framework.database.core, org.eclipse.osee.framework.database.init, org.eclipse.osee.framework.jdk.core.type, org.eclipse.osee.framework.jdk.core.util, @@ -220,6 +219,7 @@ Import-Package: com.google.gson, org.eclipse.osee.framework.ui.swt, org.eclipse.osee.framework.ui.ws, org.eclipse.osee.jaxrs.client, + org.eclipse.osee.jdbc, org.eclipse.osee.orcs.rest.client, org.eclipse.osee.orcs.rest.model, org.eclipse.osee.orcs.rest.model.search.artifact, diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/ValidateAtsDatabase.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/ValidateAtsDatabase.java index df688158aa0..ccacf9ce1bc 100644 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/ValidateAtsDatabase.java +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/ValidateAtsDatabase.java @@ -66,7 +66,6 @@ import org.eclipse.osee.framework.core.exception.BranchDoesNotExist; import org.eclipse.osee.framework.core.model.Branch; import org.eclipse.osee.framework.core.model.type.AttributeType; import org.eclipse.osee.framework.core.util.XResultData; -import org.eclipse.osee.framework.database.core.IOseeStatement; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.Collections; import org.eclipse.osee.framework.jdk.core.util.DateUtil; @@ -91,6 +90,7 @@ import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateItem; import org.eclipse.osee.framework.ui.skynet.notify.OseeEmail; import org.eclipse.osee.framework.ui.skynet.results.XResultDataUI; import org.eclipse.osee.framework.ui.swt.Displays; +import org.eclipse.osee.jdbc.JdbcStatement; /** * @author Donald G. Dunne @@ -843,7 +843,7 @@ public class ValidateAtsDatabase extends WorldXNavigateItemAction { private static List<Integer> getCommonArtifactIds(XResultData xResultData) throws OseeCoreException { List<Integer> artIds = new ArrayList<Integer>(); xResultData.log(null, "getCommonArtifactIds - Started " + DateUtil.getMMDDYYHHMM()); - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { chStmt.runPreparedQuery(SELECT_COMMON_ART_IDS, new Object[] {AtsUtilCore.getAtsBranch().getUuid()}); while (chStmt.next()) { diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/PurgeUser.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/PurgeUser.java index 38a46bce12d..3e1e90c1b69 100644 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/PurgeUser.java +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/PurgeUser.java @@ -15,19 +15,19 @@ import java.util.Collection; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.osee.framework.core.util.XResultData; -import org.eclipse.osee.framework.database.core.OseeConnection; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.AHTML; import org.eclipse.osee.framework.skynet.core.User; import org.eclipse.osee.framework.skynet.core.artifact.Artifact; import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery; import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; -import org.eclipse.osee.framework.skynet.core.utility.DbTransaction; import org.eclipse.osee.framework.ui.plugin.util.AWorkbench; import org.eclipse.osee.framework.ui.skynet.blam.AbstractBlam; import org.eclipse.osee.framework.ui.skynet.blam.VariableMap; import org.eclipse.osee.framework.ui.skynet.results.XResultDataUI; import org.eclipse.osee.framework.ui.swt.Displays; +import org.eclipse.osee.jdbc.JdbcConnection; +import org.eclipse.osee.jdbc.JdbcTransaction; /** * @author Megumi Telles @@ -76,14 +76,15 @@ public class PurgeUser extends AbstractBlam { return; } //handle roll-backs and exception handling - new DbTransaction() { + ConnectionHandler.getJdbcClient().runTransaction(new JdbcTransaction() { + @Override - protected void handleTxWork(OseeConnection connection) throws OseeCoreException { + public void handleTxWork(JdbcConnection connection) { // start replacing all transactions, relations, etc. findAndUpdateAuthoredTransactions(connection, fromUser, toUser); findAndUpdateRelations(connection, fromUser, toUser); } - }.execute(); + }); // confirm deletion of artifact confirmDeletionOfArtifact(fromUser); // output results @@ -109,7 +110,7 @@ public class PurgeUser extends AbstractBlam { } } - private void findAndUpdateAuthoredTransactions(OseeConnection connection, final User fromUser, final User toUser) throws OseeCoreException { + private void findAndUpdateAuthoredTransactions(JdbcConnection connection, final User fromUser, final User toUser) throws OseeCoreException { numOfAuthoredTransactions = ConnectionHandler.runPreparedQueryFetchInt(defaultUpdateValue, GET_AUTHORED_TRANSACTIONS, new Object[] {fromUser.getArtId()}); @@ -119,12 +120,12 @@ public class PurgeUser extends AbstractBlam { fromUser.getArtId()}); } - private void findAndUpdateRelations(OseeConnection connection, final User fromUser, final User toUser) throws OseeCoreException { + private void findAndUpdateRelations(JdbcConnection connection, final User fromUser, final User toUser) throws OseeCoreException { updateRelationA(connection, fromUser, toUser); updateRelationB(connection, fromUser, toUser); } - private void updateRelationA(OseeConnection connection, final User fromUser, final User toUser) throws OseeCoreException { + private void updateRelationA(JdbcConnection connection, final User fromUser, final User toUser) throws OseeCoreException { numOfASideRelations = ConnectionHandler.runPreparedQueryFetchInt(defaultUpdateValue, GET_RELATIONS_ASIDE, new Object[] {fromUser.getArtId()}); @@ -134,7 +135,7 @@ public class PurgeUser extends AbstractBlam { fromUser.getArtId()}); } - private void updateRelationB(OseeConnection connection, final User fromUser, final User toUser) throws OseeCoreException { + private void updateRelationB(JdbcConnection connection, final User fromUser, final User toUser) throws OseeCoreException { numOfBSideRelations = ConnectionHandler.runPreparedQueryFetchInt(defaultUpdateValue, GET_RELATIONS_BSIDE, new Object[] {fromUser.getArtId()}); diff --git a/plugins/org.eclipse.osee.client.demo/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.client.demo/META-INF/MANIFEST.MF index 29c023a2b8d..74feed2c3d2 100644 --- a/plugins/org.eclipse.osee.client.demo/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.client.demo/META-INF/MANIFEST.MF @@ -14,7 +14,6 @@ Import-Package: org.eclipse.core.filesystem, org.eclipse.osee.framework.core.model, org.eclipse.osee.framework.core.operation, org.eclipse.osee.framework.core.util, - org.eclipse.osee.framework.database.core, org.eclipse.osee.framework.database.init, org.eclipse.osee.framework.jdk.core.type, org.eclipse.osee.framework.jdk.core.util, @@ -26,7 +25,8 @@ Import-Package: org.eclipse.core.filesystem, org.eclipse.osee.framework.skynet.core.importing.resolvers, org.eclipse.osee.framework.skynet.core.transaction, org.eclipse.osee.framework.skynet.core.utility, - org.eclipse.osee.framework.ui.skynet.Import + org.eclipse.osee.framework.ui.skynet.Import, + org.eclipse.osee.jdbc Export-Package: org.eclipse.osee.client.demo Require-Bundle: org.eclipse.core.runtime Bundle-ActivationPolicy: lazy diff --git a/plugins/org.eclipse.osee.client.integration.tests/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.client.integration.tests/META-INF/MANIFEST.MF index 9ca2f75d7fb..de4e20e05ea 100644 --- a/plugins/org.eclipse.osee.client.integration.tests/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.client.integration.tests/META-INF/MANIFEST.MF @@ -28,8 +28,6 @@ Import-Package: javax.ws.rs.client;version="2.0.0", org.eclipse.osee.framework.core.model.type, org.eclipse.osee.framework.core.operation, org.eclipse.osee.framework.core.util, - org.eclipse.osee.framework.database, - org.eclipse.osee.framework.database.core, org.eclipse.osee.framework.database.init, org.eclipse.osee.framework.jdk.core.type, org.eclipse.osee.framework.jdk.core.util, @@ -44,6 +42,7 @@ Import-Package: javax.ws.rs.client;version="2.0.0", org.eclipse.osee.framework.ui.plugin.util, org.eclipse.osee.framework.ui.swt, org.eclipse.osee.jaxrs.client, + org.eclipse.osee.jdbc, org.eclipse.osee.orcs.rest.client, org.eclipse.swt.graphics, org.osgi.framework diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ConflictDeletionTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ConflictDeletionTest.java index fd249b40c24..394310f1607 100644 --- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ConflictDeletionTest.java +++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ConflictDeletionTest.java @@ -25,7 +25,6 @@ import org.eclipse.osee.framework.core.enums.TxChange; import org.eclipse.osee.framework.core.exception.OseeDataStoreException; import org.eclipse.osee.framework.core.model.Branch; import org.eclipse.osee.framework.core.operation.IOperation; -import org.eclipse.osee.framework.database.core.IOseeStatement; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.logging.OseeLog; import org.eclipse.osee.framework.logging.SevereLoggingMonitor; @@ -34,6 +33,7 @@ import org.eclipse.osee.framework.skynet.core.artifact.Attribute; import org.eclipse.osee.framework.skynet.core.relation.RelationLink; import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; import org.eclipse.osee.framework.skynet.core.utility.PurgeTransactionOperationWithListener; +import org.eclipse.osee.jdbc.JdbcStatement; import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; @@ -112,7 +112,7 @@ public class ConflictDeletionTest { } } - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); //Let's check both through the API and the SQL to make sure the Artifact is internally deleted //and deleted in the Database, That we don't get some bad data case. @@ -297,7 +297,7 @@ public class ConflictDeletionTest { } private void checkAttribute(Artifact artifact, Attribute<?> attribute, int value) throws OseeCoreException { - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { chStmt.runPreparedQuery(CHECK_FOR_ZERO_TX_CURRENT_ATTRIBUTE, artifact.getFullBranch().getUuid(), artifact.getTransactionNumber(), attribute.getId()); @@ -323,7 +323,7 @@ public class ConflictDeletionTest { } public void checkRelation(Artifact artifact, RelationLink relation, int value) throws OseeCoreException { - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); assertTrue( "Relation should be deleted between Parent: " + relation.getAArtifactId() + " and child " + relation.getBArtifactId(), relation.isDeleted()); @@ -355,7 +355,7 @@ public class ConflictDeletionTest { } public static void dumpArtifact(Artifact artifact) throws OseeCoreException { - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { if (DEBUG) { System.out.println(" Artifact Dump : " + artifact.getName()); @@ -373,7 +373,7 @@ public class ConflictDeletionTest { } public static void dumpAttribute(Attribute<?> attribute) throws OseeDataStoreException, OseeCoreException { - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { if (DEBUG) { System.out.println(" Attribute Dump"); @@ -393,7 +393,7 @@ public class ConflictDeletionTest { } public static void dumpRelation(RelationLink relation, Artifact artifact) throws OseeCoreException { - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { if (DEBUG) { System.out.println(" Relation Dump"); diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ConflictTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ConflictTest.java index 1c3607b2c07..e605c542489 100644 --- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ConflictTest.java +++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ConflictTest.java @@ -24,7 +24,6 @@ import org.eclipse.osee.client.test.framework.OseeHousekeepingRule; import org.eclipse.osee.framework.core.enums.BranchState; import org.eclipse.osee.framework.core.enums.ConflictStatus; import org.eclipse.osee.framework.core.model.Branch; -import org.eclipse.osee.framework.database.core.IOseeStatement; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.Lib; import org.eclipse.osee.framework.logging.OseeLog; @@ -38,6 +37,7 @@ import org.eclipse.osee.framework.skynet.core.conflict.ConflictManagerExternal; import org.eclipse.osee.framework.skynet.core.conflict.RelationConflict; import org.eclipse.osee.framework.skynet.core.revision.ConflictManagerInternal; import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; +import org.eclipse.osee.jdbc.JdbcStatement; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.FixMethodOrder; @@ -228,7 +228,7 @@ public class ConflictTest { //@formatter:on private static void checkNoTxCurrent(String dataId, String dataTable) throws OseeCoreException { - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { String query = String.format(NO_TX_CURRENT_SET, dataId, dataTable, chStmt.getComplementSql(), dataId, dataTable); @@ -242,7 +242,7 @@ public class ConflictTest { } private static void checkMultipleTxCurrent(String dataId, String dataTable) throws OseeCoreException { - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { String query = String.format(MULTIPLE_TX_CURRENT_SET, dataId, dataId, dataTable, dataId); chStmt.runPreparedQuery(query); diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/RelationIntegrityCheckTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/RelationIntegrityCheckTest.java index f042c2ec559..51ef9dea817 100644 --- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/RelationIntegrityCheckTest.java +++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/RelationIntegrityCheckTest.java @@ -20,7 +20,6 @@ import org.eclipse.osee.framework.core.enums.CoreArtifactTypes; import org.eclipse.osee.framework.core.exception.OseeDataStoreException; import org.eclipse.osee.framework.core.model.Branch; import org.eclipse.osee.framework.core.operation.Operations; -import org.eclipse.osee.framework.database.core.IOseeStatement; import org.eclipse.osee.framework.jdk.core.type.DoubleKeyHashMap; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.skynet.core.artifact.Artifact; @@ -32,6 +31,7 @@ import org.eclipse.osee.framework.skynet.core.httpRequests.PurgeBranchHttpReques import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; import org.eclipse.osee.framework.ui.skynet.dbHealth.LocalRelationLink; import org.eclipse.osee.framework.ui.skynet.dbHealth.RelationIntegrityCheck; +import org.eclipse.osee.jdbc.JdbcStatement; import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -123,7 +123,7 @@ public class RelationIntegrityCheckTest { } private void runQuery(String sqlQuery) throws OseeDataStoreException, OseeCoreException { - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { chStmt.runPreparedQuery(sqlQuery); while (chStmt.next()) { diff --git a/plugins/org.eclipse.osee.client.parent/pom.xml b/plugins/org.eclipse.osee.client.parent/pom.xml index 454aae35417..f7e7fec0ea3 100644 --- a/plugins/org.eclipse.osee.client.parent/pom.xml +++ b/plugins/org.eclipse.osee.client.parent/pom.xml @@ -29,8 +29,6 @@ <!--<module>../../plugins/org.eclipse.osee.framework.core.dsl</module> --> <!--<module>../../plugins/org.eclipse.osee.framework.core.dsl.integration</module> --> - <module>../../plugins/org.eclipse.osee.framework.database</module> - <module>../../plugins/org.eclipse.osee.hsqldb</module> <module>../../plugins/org.eclipse.osee.framework.database.init</module> <module>../../plugins/org.eclipse.osee.framework.messaging.event.res</module> diff --git a/plugins/org.eclipse.osee.coverage/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.coverage/META-INF/MANIFEST.MF index 3cd11f0c209..0d1f1458cf1 100644 --- a/plugins/org.eclipse.osee.coverage/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.coverage/META-INF/MANIFEST.MF @@ -29,7 +29,6 @@ Import-Package: com.google.common.io;version="[11.0.0,15.0.0)", org.eclipse.osee.framework.core.operation, org.eclipse.osee.framework.core.threading, org.eclipse.osee.framework.core.util, - org.eclipse.osee.framework.database.core, org.eclipse.osee.framework.jdk.core.type, org.eclipse.osee.framework.jdk.core.util, org.eclipse.osee.framework.jdk.core.util.io, @@ -73,6 +72,7 @@ Import-Package: com.google.common.io;version="[11.0.0,15.0.0)", org.eclipse.osee.framework.ui.skynet.widgets.xnavigate, org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet, org.eclipse.osee.framework.ui.swt, + org.eclipse.osee.jdbc, org.eclipse.osee.vcast, org.eclipse.osee.vcast.model, org.eclipse.search.ui, diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/blam/TxCoveragePartitionsReportBlam.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/blam/TxCoveragePartitionsReportBlam.java index b6eef5ffce0..a225b6fcc38 100644 --- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/blam/TxCoveragePartitionsReportBlam.java +++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/blam/TxCoveragePartitionsReportBlam.java @@ -10,25 +10,24 @@ *******************************************************************************/ package org.eclipse.osee.coverage.blam; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; import java.io.IOException; import java.util.Arrays; import java.util.Collection; import java.util.logging.Level; -import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.nebula.widgets.xviewer.Activator; import org.eclipse.osee.coverage.store.CoverageArtifactTypes; import org.eclipse.osee.framework.core.data.IOseeBranch; import org.eclipse.osee.framework.core.operation.Operations; -import org.eclipse.osee.framework.database.core.IOseeStatement; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; 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.io.CharBackedInputStream; import org.eclipse.osee.framework.jdk.core.util.io.xml.ExcelXmlWriter; import org.eclipse.osee.framework.jdk.core.util.io.xml.ISheetWriter; import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.framework.plugin.core.util.AIFile; import org.eclipse.osee.framework.plugin.core.util.OseeData; import org.eclipse.osee.framework.skynet.core.artifact.Artifact; import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery; @@ -41,6 +40,7 @@ import org.eclipse.osee.framework.ui.skynet.widgets.XList.XListItem; import org.eclipse.osee.framework.ui.skynet.widgets.XModifiedListener; import org.eclipse.osee.framework.ui.skynet.widgets.XWidget; import org.eclipse.osee.framework.ui.skynet.widgets.util.SwtXWidgetRenderer; +import org.eclipse.osee.jdbc.JdbcStatement; import org.eclipse.swt.program.Program; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Listener; @@ -103,72 +103,67 @@ public class TxCoveragePartitionsReportBlam extends AbstractBlam { return; } - CharBackedInputStream charBak = new CharBackedInputStream(); - ISheetWriter excelWriter = new ExcelXmlWriter(charBak.getWriter()); - - excelWriter.startSheet("Tx_CvgPartitions", 4); - excelWriter.writeRow("TX ID", "TX Comment", "Partition", "TX Time"); - - monitor.beginTask("Creating TX Coverage Partitions Report", txIds.size()); - for (XListItem txItem : txIds) { - String txStr = txItem.toString(); - if (monitor.isCanceled()) { - return; - } - monitor.setTaskName(txStr); - monitor.worked(1); - - if (Strings.isValid(txStr)) { - String[] tokens = txStr.split(TASKITEMDELIM); - String txId = ""; - String txComment = ""; - String txTime = ""; - if (tokens.length >= 1) { - txId = tokens[0]; - } - if (tokens.length >= 2) { - txComment = tokens[1]; + File file = OseeData.getFile("CoveragePartitionByTxID_" + Lib.getDateTimeString() + ".xml"); + ISheetWriter excelWriter = new ExcelXmlWriter(new BufferedWriter(new FileWriter(file))); + try { + excelWriter.startSheet("Tx_CvgPartitions", 4); + excelWriter.writeRow("TX ID", "TX Comment", "Partition", "TX Time"); + + monitor.beginTask("Creating TX Coverage Partitions Report", txIds.size()); + for (XListItem txItem : txIds) { + String txStr = txItem.toString(); + if (monitor.isCanceled()) { + return; } - if (tokens.length >= 3) { - int lastTokenIndex = tokens.length - 1; - txTime = tokens[lastTokenIndex]; - } - IOseeStatement chStmt = null; - try { - chStmt = ConnectionHandler.getStatement(); - chStmt.runPreparedQuery(SELECT_ARTS_BY_BRANCH_AND_TX, branch.getUuid(), txId); - - while (chStmt.next()) { - int artId = chStmt.getInt("art_id"); - monitor.setTaskName(txStr + " " + artId); - Artifact art = ArtifactQuery.getArtifactFromId(artId, branch); - String partition = getCoveragePartitionType(art); - if (partition == null) { - // OseeLog.log(Activator.class, Level.INFO, - // "NON-Coverage modification found in transaction:" + txId); - partition = "NON-Coverage modification."; - } - excelWriter.writeRow(txId, txComment, partition, txTime); - if (!runGreedy) { - break; - } + monitor.setTaskName(txStr); + monitor.worked(1); + + if (Strings.isValid(txStr)) { + String[] tokens = txStr.split(TASKITEMDELIM); + String txId = ""; + String txComment = ""; + String txTime = ""; + if (tokens.length >= 1) { + txId = tokens[0]; } - } catch (OseeCoreException ex) { - OseeLog.log(Activator.class, Level.SEVERE, ex.toString(), ex); - } finally { - if (chStmt != null) { + if (tokens.length >= 2) { + txComment = tokens[1]; + } + if (tokens.length >= 3) { + int lastTokenIndex = tokens.length - 1; + txTime = tokens[lastTokenIndex]; + } + JdbcStatement chStmt = ConnectionHandler.getStatement(); + try { + chStmt.runPreparedQuery(SELECT_ARTS_BY_BRANCH_AND_TX, branch.getUuid(), txId); + + while (chStmt.next()) { + int artId = chStmt.getInt("art_id"); + monitor.setTaskName(txStr + " " + artId); + Artifact art = ArtifactQuery.getArtifactFromId(artId, branch); + String partition = getCoveragePartitionType(art); + if (partition == null) { + // OseeLog.log(Activator.class, Level.INFO, + // "NON-Coverage modification found in transaction:" + txId); + partition = "NON-Coverage modification."; + } + excelWriter.writeRow(txId, txComment, partition, txTime); + if (!runGreedy) { + break; + } + } + } catch (OseeCoreException ex) { + OseeLog.log(Activator.class, Level.SEVERE, ex.toString(), ex); + } finally { chStmt.close(); } } } + excelWriter.endSheet(); + } finally { + excelWriter.endWorkbook(); } - - excelWriter.endSheet(); - excelWriter.endWorkbook(); - - IFile iFile = OseeData.getIFile("CoveragePartitionByTxID_" + Lib.getDateTimeString() + ".xml"); - AIFile.writeToFile(iFile, charBak); - Program.launch(iFile.getLocation().toOSString()); + Program.launch(file.getAbsolutePath()); monitor.done(); } @@ -206,9 +201,8 @@ public class TxCoveragePartitionsReportBlam extends AbstractBlam { @Override protected void doWork(IProgressMonitor monitor) throws Exception { IOseeBranch branch = branchWidget.getData(); - IOseeStatement chStmt = null; + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { - chStmt = ConnectionHandler.getStatement(); chStmt.runPreparedQuery(SELECT_TXS_BY_BRANCH, branch.getUuid()); txIdListWidget.removeAll(); while (chStmt.next()) { @@ -218,9 +212,7 @@ public class TxCoveragePartitionsReportBlam extends AbstractBlam { } catch (OseeCoreException ex) { OseeLog.log(Activator.class, Level.SEVERE, ex.toString(), ex); } finally { - if (chStmt != null) { - chStmt.close(); - } + chStmt.close(); } } diff --git a/plugins/org.eclipse.osee.framework.access/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.access/META-INF/MANIFEST.MF index 2936edebcd5..ebe7d3e312c 100644 --- a/plugins/org.eclipse.osee.framework.access/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.framework.access/META-INF/MANIFEST.MF @@ -19,8 +19,6 @@ Import-Package: com.google.common.cache;version="[11.0.0,15.0.0)", org.eclipse.osee.framework.core.operation, org.eclipse.osee.framework.core.services, org.eclipse.osee.framework.core.util, - org.eclipse.osee.framework.database, - org.eclipse.osee.framework.database.core, org.eclipse.osee.framework.jdk.core.type, org.eclipse.osee.framework.jdk.core.util, org.eclipse.osee.framework.lifecycle, @@ -34,6 +32,7 @@ Import-Package: com.google.common.cache;version="[11.0.0,15.0.0)", org.eclipse.osee.framework.skynet.core.event.model, org.eclipse.osee.framework.skynet.core.relation, org.eclipse.osee.framework.skynet.core.utility, + org.eclipse.osee.jdbc, org.osgi.framework, org.osgi.util.tracker Bundle-ActivationPolicy: lazy diff --git a/plugins/org.eclipse.osee.framework.access/OSGI-INF/access.control.service.xml b/plugins/org.eclipse.osee.framework.access/OSGI-INF/access.control.service.xml index ee31194aaf3..64377c89bbb 100644 --- a/plugins/org.eclipse.osee.framework.access/OSGI-INF/access.control.service.xml +++ b/plugins/org.eclipse.osee.framework.access/OSGI-INF/access.control.service.xml @@ -4,7 +4,7 @@ <service> <provide interface="org.eclipse.osee.framework.core.services.IAccessControlService"/> </service> - <reference bind="setDbService" cardinality="1..1" interface="org.eclipse.osee.framework.database.IOseeDatabaseService" name="IOseeDatabaseService" policy="static"/> + <reference bind="setJdbcService" cardinality="1..1" interface="org.eclipse.osee.jdbc.JdbcService" name="JdbcService" policy="static" target="(osgi.binding=skynet.jdbc.service)"/> <reference bind="setCachingService" cardinality="1..1" interface="org.eclipse.osee.framework.core.services.IOseeCachingService" name="IOseeCachingService" policy="static"/> <reference bind="setEventService" cardinality="1..1" interface="org.eclipse.osee.framework.skynet.core.event.OseeEventService" name="OseeEventService" policy="static"/> <reference bind="setLifecycleService" cardinality="1..1" interface="org.eclipse.osee.framework.lifecycle.ILifecycleService" name="ILifecycleService" policy="static"/> diff --git a/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/AccessControlService.java b/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/AccessControlService.java index cec3c18af1c..f1335569e43 100644 --- a/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/AccessControlService.java +++ b/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/AccessControlService.java @@ -49,8 +49,6 @@ import org.eclipse.osee.framework.core.model.type.ArtifactType; import org.eclipse.osee.framework.core.operation.Operations; import org.eclipse.osee.framework.core.services.IAccessControlService; import org.eclipse.osee.framework.core.services.IOseeCachingService; -import org.eclipse.osee.framework.database.IOseeDatabaseService; -import org.eclipse.osee.framework.database.core.IOseeStatement; import org.eclipse.osee.framework.jdk.core.type.CompositeKeyHashMap; import org.eclipse.osee.framework.jdk.core.type.DoubleKeyHashMap; import org.eclipse.osee.framework.jdk.core.type.HashCollection; @@ -77,6 +75,8 @@ import org.eclipse.osee.framework.skynet.core.event.model.AccessControlEventType import org.eclipse.osee.framework.skynet.core.event.model.ArtifactEvent; import org.eclipse.osee.framework.skynet.core.event.model.Sender; import org.eclipse.osee.framework.skynet.core.utility.DbUtil; +import org.eclipse.osee.jdbc.JdbcClient; +import org.eclipse.osee.jdbc.JdbcStatement; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.FrameworkUtil; @@ -129,7 +129,7 @@ public class AccessControlService implements IAccessControlService { TimeUnit.HOURS).build(); private final IOseeCachingService cachingService; - private final IOseeDatabaseService databaseService; + private final JdbcClient jdbcClient; private final OseeEventService eventService; private IArtifactEventListener listener1; @@ -137,10 +137,10 @@ public class AccessControlService implements IAccessControlService { private final AtomicBoolean ensurePopulated = new AtomicBoolean(false); - public AccessControlService(IOseeDatabaseService databaseService, IOseeCachingService cachingService, OseeEventService eventService) { + public AccessControlService(JdbcClient jdbcClient, IOseeCachingService cachingService, OseeEventService eventService) { super(); - this.databaseService = databaseService; + this.jdbcClient = jdbcClient; this.cachingService = cachingService; this.eventService = eventService; } @@ -175,8 +175,8 @@ public class AccessControlService implements IAccessControlService { return cachingService.getBranchCache(); } - private IOseeDatabaseService getDatabaseService() { - return databaseService; + private JdbcClient getJdbcClient() { + return jdbcClient; } public void reloadCache() throws OseeCoreException { @@ -211,7 +211,7 @@ public class AccessControlService implements IAccessControlService { private void populateBranchAccessControlList() throws OseeCoreException { ensurePopulated(); - IOseeStatement chStmt = getDatabaseService().getStatement(); + JdbcStatement chStmt = getJdbcClient().getStatement(); try { chStmt.runPreparedQuery(GET_ALL_BRANCH_ACCESS_CONTROL_LIST); while (chStmt.next()) { @@ -236,7 +236,7 @@ public class AccessControlService implements IAccessControlService { private void populateArtifactAccessControlList() throws OseeCoreException { ensurePopulated(); - IOseeStatement chStmt = getDatabaseService().getStatement(); + JdbcStatement chStmt = getJdbcClient().getStatement(); try { chStmt.runPreparedQuery(GET_ALL_ARTIFACT_ACCESS_CONTROL_LIST); @@ -270,7 +270,7 @@ public class AccessControlService implements IAccessControlService { if (!groupToSubjectsCache.containsKey(groupId)) { Integer groupMember; - IOseeStatement chStmt = getDatabaseService().getStatement(); + JdbcStatement chStmt = getJdbcClient().getStatement(); try { chStmt.runPreparedQuery(USER_GROUP_MEMBERS, groupId, CoreRelationTypes.Users_User.getGuid()); @@ -489,7 +489,6 @@ public class AccessControlService implements IAccessControlService { } } - @SuppressWarnings("unchecked") public void persistPermission(AccessControlData data, boolean recurse) { ensurePopulated(); Artifact subject = data.getSubject(); @@ -503,10 +502,10 @@ public class AccessControlService implements IAccessControlService { ArtifactAccessObject artifactAccessObject = (ArtifactAccessObject) data.getObject(); if (data.isBirth()) { - getDatabaseService().runPreparedUpdate(INSERT_INTO_ARTIFACT_ACL, artifactAccessObject.getArtId(), + getJdbcClient().runPreparedUpdate(INSERT_INTO_ARTIFACT_ACL, artifactAccessObject.getArtId(), data.getPermission().getPermId(), data.getSubject().getArtId(), artifactAccessObject.getId()); } else { - getDatabaseService().runPreparedUpdate(UPDATE_ARTIFACT_ACL, data.getPermission().getPermId(), + getJdbcClient().runPreparedUpdate(UPDATE_ARTIFACT_ACL, data.getPermission().getPermId(), data.getSubject().getArtId(), artifactAccessObject.getArtId(), artifactAccessObject.getId()); } @@ -539,10 +538,10 @@ public class AccessControlService implements IAccessControlService { BranchAccessObject branchAccessObject = (BranchAccessObject) data.getObject(); if (data.isBirth()) { - getDatabaseService().runPreparedUpdate(INSERT_INTO_BRANCH_ACL, data.getPermission().getPermId(), + getJdbcClient().runPreparedUpdate(INSERT_INTO_BRANCH_ACL, data.getPermission().getPermId(), data.getSubject().getArtId(), branchAccessObject.getId()); } else { - getDatabaseService().runPreparedUpdate(UPDATE_BRANCH_ACL, data.getPermission().getPermId(), + getJdbcClient().runPreparedUpdate(UPDATE_BRANCH_ACL, data.getPermission().getPermId(), data.getSubject().getArtId(), branchAccessObject.getId()); } } @@ -721,8 +720,8 @@ public class AccessControlService implements IAccessControlService { @Override public void removePermissions(IOseeBranch branch) throws OseeCoreException { Branch theBranch = getBranchCache().get(branch); - getDatabaseService().runPreparedUpdate(DELETE_ARTIFACT_ACL_FROM_BRANCH, theBranch.getUuid()); - getDatabaseService().runPreparedUpdate(DELETE_BRANCH_ACL_FROM_BRANCH, theBranch.getUuid()); + getJdbcClient().runPreparedUpdate(DELETE_ARTIFACT_ACL_FROM_BRANCH, theBranch.getUuid()); + getJdbcClient().runPreparedUpdate(DELETE_BRANCH_ACL_FROM_BRANCH, theBranch.getUuid()); } public boolean hasLock(Artifact object) throws OseeCoreException { diff --git a/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/AccessControlServiceProxy.java b/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/AccessControlServiceProxy.java index 0bfbdd8b925..f6c26ef3773 100644 --- a/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/AccessControlServiceProxy.java +++ b/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/AccessControlServiceProxy.java @@ -21,13 +21,14 @@ import org.eclipse.osee.framework.core.model.IBasicArtifact; import org.eclipse.osee.framework.core.model.access.AccessDataQuery; import org.eclipse.osee.framework.core.services.IAccessControlService; import org.eclipse.osee.framework.core.services.IOseeCachingService; -import org.eclipse.osee.framework.database.IOseeDatabaseService; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.Conditions; import org.eclipse.osee.framework.lifecycle.ILifecycleService; import org.eclipse.osee.framework.logging.OseeLog; import org.eclipse.osee.framework.skynet.core.event.OseeEventService; import org.eclipse.osee.framework.skynet.core.event.listener.EventQosType; +import org.eclipse.osee.jdbc.JdbcClient; +import org.eclipse.osee.jdbc.JdbcService; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; @@ -40,7 +41,7 @@ public final class AccessControlServiceProxy implements IAccessControlService { private final List<ServiceReference<IAccessProvider>> pendingProviders = new CopyOnWriteArrayList<ServiceReference<IAccessProvider>>(); - private IOseeDatabaseService dbService; + private JdbcService jdbcService; private IOseeCachingService cachingService; private OseeEventService eventService; private ILifecycleService lifecycleService; @@ -49,8 +50,8 @@ public final class AccessControlServiceProxy implements IAccessControlService { private AccessEventListener accessEventListener; private Thread thread; - public void setDbService(IOseeDatabaseService dbService) { - this.dbService = dbService; + public void setJdbcService(JdbcService jdbcService) { + this.jdbcService = jdbcService; } public void setCachingService(IOseeCachingService cachingService) { @@ -134,7 +135,8 @@ public final class AccessControlServiceProxy implements IAccessControlService { } public void start() { - accessService = new AccessControlService(dbService, cachingService, eventService); + JdbcClient jdbcClient = jdbcService.getClient(); + accessService = new AccessControlService(jdbcClient, cachingService, eventService); accessEventListener = new AccessEventListener(accessService, new AccessControlCacheHandler()); if (eventService != null) { diff --git a/plugins/org.eclipse.osee.framework.core.client/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.core.client/META-INF/MANIFEST.MF index a217caff6f3..a809df69296 100644 --- a/plugins/org.eclipse.osee.framework.core.client/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.framework.core.client/META-INF/MANIFEST.MF @@ -12,7 +12,6 @@ Import-Package: org.eclipse.core.runtime, org.eclipse.osee.framework.core.enums, org.eclipse.osee.framework.core.exception, org.eclipse.osee.framework.core.util, - org.eclipse.osee.framework.database.core, org.eclipse.osee.framework.jdk.core.type, org.eclipse.osee.framework.jdk.core.util, org.eclipse.osee.framework.jdk.core.util.network, diff --git a/plugins/org.eclipse.osee.framework.core.client/OSGI-INF/client.database.provider.xml b/plugins/org.eclipse.osee.framework.core.client/OSGI-INF/client.database.provider.xml deleted file mode 100644 index bde54eca519..00000000000 --- a/plugins/org.eclipse.osee.framework.core.client/OSGI-INF/client.database.provider.xml +++ /dev/null @@ -1,7 +0,0 @@ -<?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.core.client.internal.ClientDatabaseProvider"> - <implementation class="org.eclipse.osee.framework.core.client.internal.ClientDatabaseProvider"/> - <service> - <provide interface="org.eclipse.osee.framework.database.core.IDatabaseInfoProvider"/> - </service> -</scr:component> diff --git a/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/internal/ClientDatabaseProvider.java b/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/internal/ClientDatabaseProvider.java deleted file mode 100644 index 64b509e20e6..00000000000 --- a/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/internal/ClientDatabaseProvider.java +++ /dev/null @@ -1,51 +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.client.internal; - -import java.util.logging.Level; -import org.eclipse.osee.framework.core.data.IDatabaseInfo; -import org.eclipse.osee.framework.core.exception.OseeAuthenticationRequiredException; -import org.eclipse.osee.framework.database.core.IDatabaseInfoProvider; -import org.eclipse.osee.framework.logging.BaseStatus; -import org.eclipse.osee.framework.logging.OseeLog; - -/** - * @author Roberto E. Escobar - */ -public class ClientDatabaseProvider implements IDatabaseInfoProvider { - - private static final String NAME = "Client Data Source"; - - @Override - public IDatabaseInfo getDatabaseInfo() throws OseeAuthenticationRequiredException { - IDatabaseInfo databaseInfo = null; - try { - databaseInfo = InternalClientSessionManager.getInstance().getDatabaseInfo(); - OseeLog.reportStatus(new BaseStatus(NAME, Level.INFO, "%s [%s as %s]", databaseInfo.getDriver(), - databaseInfo.getDatabaseName(), databaseInfo.getDatabaseLoginName())); - } catch (OseeAuthenticationRequiredException ex) { - OseeLog.reportStatus(new BaseStatus(NAME, Level.SEVERE, ex, "Error obtaining database connection.")); - throw ex; - } - return databaseInfo; - } - - @Override - public int getPriority() { - return -1; - } - - @Override - public String toString() { - return "Client Db Connection Info Provider (connection info provided by remote server)"; - } - -} diff --git a/plugins/org.eclipse.osee.framework.database.init/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.database.init/META-INF/MANIFEST.MF index dcd945eb7b4..a18251d60b1 100644 --- a/plugins/org.eclipse.osee.framework.database.init/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.framework.database.init/META-INF/MANIFEST.MF @@ -23,8 +23,6 @@ Import-Package: org.apache.commons.lang;version="2.4.0", 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.jdk.core.persistence, org.eclipse.osee.framework.jdk.core.text.change, org.eclipse.osee.framework.jdk.core.type, @@ -43,6 +41,7 @@ Import-Package: org.apache.commons.lang;version="2.4.0", org.eclipse.osee.framework.skynet.core.transaction, org.eclipse.osee.framework.skynet.core.types, org.eclipse.osee.framework.skynet.core.utility, + org.eclipse.osee.jdbc, org.osgi.framework, org.osgi.util.tracker Bundle-Vendor: Eclipse Open System Engineering Environment diff --git a/plugins/org.eclipse.osee.framework.database.init/src/org/eclipse/osee/framework/database/init/internal/DatabaseInitActivator.java b/plugins/org.eclipse.osee.framework.database.init/src/org/eclipse/osee/framework/database/init/internal/DatabaseInitActivator.java index d2423bb6b91..ae2360fea22 100644 --- a/plugins/org.eclipse.osee.framework.database.init/src/org/eclipse/osee/framework/database/init/internal/DatabaseInitActivator.java +++ b/plugins/org.eclipse.osee.framework.database.init/src/org/eclipse/osee/framework/database/init/internal/DatabaseInitActivator.java @@ -12,7 +12,8 @@ package org.eclipse.osee.framework.database.init.internal; import org.eclipse.osee.framework.core.services.IOseeCachingService; import org.eclipse.osee.framework.core.translation.IDataTranslationService; -import org.eclipse.osee.framework.database.IOseeDatabaseService; +import org.eclipse.osee.jdbc.JdbcClient; +import org.eclipse.osee.jdbc.JdbcService; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.util.tracker.ServiceTracker; @@ -24,7 +25,7 @@ public class DatabaseInitActivator implements BundleActivator { private ServiceTracker<IDataTranslationService, IDataTranslationService> serviceTracker; private ServiceTracker<IOseeCachingService, IOseeCachingService> serviceTracker2; - private ServiceTracker<IOseeDatabaseService, IOseeDatabaseService> serviceTracker3; + private ServiceTracker<JdbcService, JdbcService> serviceTracker3; @Override public void start(BundleContext context) throws Exception { @@ -38,8 +39,7 @@ public class DatabaseInitActivator implements BundleActivator { new ServiceTracker<IOseeCachingService, IOseeCachingService>(context, IOseeCachingService.class, null); serviceTracker2.open(true); - serviceTracker3 = - new ServiceTracker<IOseeDatabaseService, IOseeDatabaseService>(context, IOseeDatabaseService.class, null); + serviceTracker3 = new ServiceTracker<JdbcService, JdbcService>(context, JdbcService.class, null); serviceTracker3.open(true); } @@ -69,8 +69,9 @@ public class DatabaseInitActivator implements BundleActivator { return serviceTracker.getService(); } - public IOseeDatabaseService getDatabaseService() { - return serviceTracker3.getService(); + public JdbcClient getJdbcClient() { + JdbcService jdbcService = serviceTracker3.getService(); + return jdbcService.getClient(); } } diff --git a/plugins/org.eclipse.osee.framework.database.init/src/org/eclipse/osee/framework/database/init/internal/DbBootstrapTask.java b/plugins/org.eclipse.osee.framework.database.init/src/org/eclipse/osee/framework/database/init/internal/DbBootstrapTask.java index e8872f59638..b9d38262e33 100644 --- a/plugins/org.eclipse.osee.framework.database.init/src/org/eclipse/osee/framework/database/init/internal/DbBootstrapTask.java +++ b/plugins/org.eclipse.osee.framework.database.init/src/org/eclipse/osee/framework/database/init/internal/DbBootstrapTask.java @@ -28,13 +28,13 @@ import org.eclipse.osee.framework.core.services.IOseeCachingService; 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.database.IOseeDatabaseService; import org.eclipse.osee.framework.database.init.IDatabaseInitConfiguration; import org.eclipse.osee.framework.database.init.IDbInitializationTask; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.type.OseeStateException; import org.eclipse.osee.framework.jdk.core.util.Conditions; import org.eclipse.osee.framework.skynet.core.artifact.BranchManager; +import org.eclipse.osee.jdbc.JdbcClient; import org.osgi.framework.Bundle; import org.osgi.framework.BundleException; @@ -68,8 +68,8 @@ public class DbBootstrapTask implements IDbInitializationTask { IOseeCachingService service = DatabaseInitActivator.getInstance().getCachingService(); service.clearAll(); - IOseeDatabaseService databaseService = DatabaseInitActivator.getInstance().getDatabaseService(); - databaseService.invalidateSequences(); + JdbcClient jdbcClient = DatabaseInitActivator.getInstance().getJdbcClient(); + jdbcClient.invalidateSequences(); Branch systemRoot = BranchManager.getSystemRootBranch(); Conditions.checkNotNull(systemRoot, "System root was not created - "); diff --git a/plugins/org.eclipse.osee.framework.database.init/src/org/eclipse/osee/framework/database/init/internal/PostDatabaseInitialization.java b/plugins/org.eclipse.osee.framework.database.init/src/org/eclipse/osee/framework/database/init/internal/PostDatabaseInitialization.java index f66af36c769..15aadd4f95a 100644 --- a/plugins/org.eclipse.osee.framework.database.init/src/org/eclipse/osee/framework/database/init/internal/PostDatabaseInitialization.java +++ b/plugins/org.eclipse.osee.framework.database.init/src/org/eclipse/osee/framework/database/init/internal/PostDatabaseInitialization.java @@ -11,11 +11,11 @@ package org.eclipse.osee.framework.database.init.internal; import java.util.logging.Level; -import org.eclipse.osee.framework.database.core.SupportedDatabase; import org.eclipse.osee.framework.database.init.IDbInitializationTask; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; +import org.eclipse.osee.jdbc.JdbcClient; +import org.eclipse.osee.jdbc.JdbcDbType; /** * @author Roberto E. Escobar @@ -29,15 +29,17 @@ public class PostDatabaseInitialization implements IDbInitializationTask { @Override public void run() throws OseeCoreException { OseeLog.log(PostDatabaseInitialization.class, Level.INFO, "Running Post-Initialization Process..."); - SupportedDatabase supportedDb = SupportedDatabase.getDatabaseType(ConnectionHandler.getMetaData()); - switch (supportedDb) { + + JdbcClient jdbcClient = DatabaseInitActivator.getInstance().getJdbcClient(); + JdbcDbType dbType = jdbcClient.getDatabaseType(); + switch (dbType) { case postgresql: OseeLog.log(PostDatabaseInitialization.class, Level.INFO, "Vacuuming PostgreSQL"); - ConnectionHandler.runPreparedUpdate(POSTGRESQL_VACUUM_AND_STATS); + jdbcClient.runPreparedUpdate(POSTGRESQL_VACUUM_AND_STATS); break; case oracle: OseeLog.log(PostDatabaseInitialization.class, Level.INFO, "Gathering Oracle Statistics"); - ConnectionHandler.runPreparedUpdate(ORACLE_GATHER_STATS); + jdbcClient.runPreparedUpdate(ORACLE_GATHER_STATS); break; default: OseeLog.log(PostDatabaseInitialization.class, Level.INFO, "No - postdbinit process to run"); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.skynet.core/META-INF/MANIFEST.MF index f731529fbec..66025ebf5de 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.framework.skynet.core/META-INF/MANIFEST.MF @@ -9,7 +9,6 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.core.resources, net.jini, org.eclipse.osee.framework.jdk.core, - org.eclipse.osee.framework.database, org.eclipse.osee.framework.messaging.event.res, org.eclipse.osee.framework.messaging, org.eclipse.osee.framework.lifecycle, @@ -76,6 +75,7 @@ Import-Package: com.google.common.collect;version="[11.0.0,15.0.0]", org.eclipse.osee.framework.messaging.event.res, org.eclipse.osee.framework.plugin.core, org.eclipse.osee.framework.plugin.core.util, + org.eclipse.osee.jdbc, org.eclipse.osee.orcs.rest.client, org.eclipse.osee.orcs.rest.model.search.artifact Bundle-RequiredExecutionEnvironment: JavaSE-1.6 diff --git a/plugins/org.eclipse.osee.framework.skynet.core/OSGI-INF/osee.client.caching.service.xml b/plugins/org.eclipse.osee.framework.skynet.core/OSGI-INF/osee.client.caching.service.xml index a591baef8db..dfff7fbd066 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/OSGI-INF/osee.client.caching.service.xml +++ b/plugins/org.eclipse.osee.framework.skynet.core/OSGI-INF/osee.client.caching.service.xml @@ -5,5 +5,5 @@ <provide interface="org.eclipse.osee.framework.core.services.IOseeCachingService"/> </service> <reference bind="setModelFactory" cardinality="1..1" interface="org.eclipse.osee.framework.core.services.IOseeModelFactoryService" name="IOseeModelFactoryService" policy="static"/> - <reference bind="setDatabaseService" cardinality="1..1" interface="org.eclipse.osee.framework.database.IOseeDatabaseService" name="IOseeDatabaseService" policy="static"/> + <reference bind="setJdbcService" cardinality="1..1" interface="org.eclipse.osee.jdbc.JdbcService" name="JdbcService" policy="static" target="(osgi.binding=skynet.jdbc.service)"/> </scr:component> diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactLoader.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactLoader.java index f54e583be22..2c352f8aa6b 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactLoader.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactLoader.java @@ -29,7 +29,6 @@ import org.eclipse.osee.framework.core.enums.ModificationType; import org.eclipse.osee.framework.core.exception.OseeDataStoreException; import org.eclipse.osee.framework.core.model.Branch; import org.eclipse.osee.framework.core.model.TransactionRecord; -import org.eclipse.osee.framework.database.core.IOseeStatement; import org.eclipse.osee.framework.jdk.core.type.CompositeKeyHashMap; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.type.Pair; @@ -41,6 +40,7 @@ import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; import org.eclipse.osee.framework.skynet.core.utility.ArtifactJoinQuery; import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; import org.eclipse.osee.framework.skynet.core.utility.JoinUtility; +import org.eclipse.osee.jdbc.JdbcStatement; /** * @author Ryan D. Brooks @@ -195,8 +195,7 @@ public final class ArtifactLoader { sqlKey = OseeSql.LOAD_CURRENT_ARTIFACTS; } - IOseeStatement chStmt = ConnectionHandler.getStatement(); - + JdbcStatement chStmt = ConnectionHandler.getStatement(); String sql = null; try { sql = ServiceUtil.getSql(sqlKey); @@ -280,7 +279,7 @@ public final class ArtifactLoader { * Determines the artIds and branchUuids of artifacts to load based on sql and queryParameters */ private static List<Pair<Integer, Long>> selectArtifacts(String sql, Object[] queryParameters, int artifactCountEstimate) throws OseeCoreException { - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); long time = System.currentTimeMillis(); List<Pair<Integer, Long>> toLoad = new LinkedList<Pair<Integer, Long>>(); @@ -304,7 +303,7 @@ public final class ArtifactLoader { /** * This method is called only after the cache has been checked */ - private static Artifact retrieveShallowArtifact(IOseeStatement chStmt, LoadType reload, boolean historical) throws OseeCoreException { + private static Artifact retrieveShallowArtifact(JdbcStatement chStmt, LoadType reload, boolean historical) throws OseeCoreException { int artifactId = chStmt.getInt("art_id"); Branch branch = BranchManager.getBranch(chStmt.getLong("branch_id")); int transactionId = Artifact.TRANSACTION_SENTINEL; diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/AttributeLoader.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/AttributeLoader.java index 159557ff705..67b5b04f310 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/AttributeLoader.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/AttributeLoader.java @@ -20,7 +20,6 @@ import org.eclipse.osee.framework.core.data.IAttributeType; import org.eclipse.osee.framework.core.enums.DeletionFlag; import org.eclipse.osee.framework.core.enums.LoadLevel; import org.eclipse.osee.framework.core.enums.ModificationType; -import org.eclipse.osee.framework.database.core.IOseeStatement; import org.eclipse.osee.framework.jdk.core.type.CompositeKeyHashMap; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.Strings; @@ -31,6 +30,7 @@ import org.eclipse.osee.framework.skynet.core.attribute.EnumeratedAttribute; import org.eclipse.osee.framework.skynet.core.internal.OseeSql; import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; +import org.eclipse.osee.jdbc.JdbcStatement; /** * @author Ryan Schmitt @@ -42,7 +42,7 @@ public class AttributeLoader { return; } - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { String sql = getSql(allowDeletedArtifacts, loadLevel, historical); chStmt.runPreparedQuery(tempCache.size() * 8, sql, queryId); @@ -90,7 +90,7 @@ public class AttributeLoader { // do nothing } - public AttrData(IOseeStatement chStmt, boolean historical) throws OseeCoreException { + public AttrData(JdbcStatement chStmt, boolean historical) throws OseeCoreException { artifactId = chStmt.getInt("art_id"); branchUuid = chStmt.getLong("branch_id"); attrId = chStmt.getInt("attr_id"); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java index 4e87e51466d..55b5a7d1118 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java @@ -42,8 +42,6 @@ import org.eclipse.osee.framework.core.model.event.DefaultBasicGuidArtifact; import org.eclipse.osee.framework.core.operation.IOperation; import org.eclipse.osee.framework.core.operation.OperationBuilder; 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.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.Conditions; import org.eclipse.osee.framework.jdk.core.util.Lib; @@ -66,8 +64,10 @@ import org.eclipse.osee.framework.skynet.core.internal.Activator; import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager; import org.eclipse.osee.framework.skynet.core.utility.ArtifactJoinQuery; +import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; import org.eclipse.osee.framework.skynet.core.utility.JoinUtility; import org.eclipse.osee.framework.skynet.core.utility.OseeInfo; +import org.eclipse.osee.jdbc.JdbcStatement; /** * Provides access to all branches as well as support for creating branches of all types @@ -175,10 +175,8 @@ public class BranchManager { } private static void loadBranchToCache(Object uuid) { - IOseeDatabaseService databaseService = ServiceUtil.getOseeDatabaseService(); - IOseeStatement chStmt = null; + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { - chStmt = databaseService.getStatement(); chStmt.runPreparedQuery(1, SELECT_BRANCH, uuid); if (chStmt.next()) { long branchUuid = chStmt.getLong("branch_id"); @@ -201,7 +199,7 @@ public class BranchManager { created.setParentBranch(getBranch(parentBranchId)); } } finally { - Lib.close(chStmt); + chStmt.close(); } } @@ -394,8 +392,10 @@ public class BranchManager { if (mergeBranch == null) { mergeBranch = createMergeBranch(sourceBranch, destBranch, expectedArtIds); } else { - UpdateMergeBranch dbTransaction = new UpdateMergeBranch(mergeBranch, expectedArtIds, destBranch, sourceBranch); - dbTransaction.execute(); + UpdateMergeBranch op = + new UpdateMergeBranch(ConnectionHandler.getJdbcClient(), mergeBranch, expectedArtIds, destBranch, + sourceBranch); + Operations.executeWorkAndCheckStatus(op); } return mergeBranch; } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ChangeArtifactType.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ChangeArtifactType.java index 440fceed02d..e3484b4abd9 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ChangeArtifactType.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ChangeArtifactType.java @@ -35,8 +35,6 @@ import org.eclipse.osee.framework.core.exception.OseeExceptions; import org.eclipse.osee.framework.core.model.Branch; import org.eclipse.osee.framework.core.model.cache.BranchFilter; import org.eclipse.osee.framework.core.model.type.ArtifactType; -import org.eclipse.osee.framework.database.IOseeDatabaseService; -import org.eclipse.osee.framework.database.core.IOseeStatement; import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.logging.OseeLog; @@ -46,14 +44,15 @@ import org.eclipse.osee.framework.skynet.core.event.model.ArtifactEvent; import org.eclipse.osee.framework.skynet.core.event.model.EventBasicGuidArtifact; import org.eclipse.osee.framework.skynet.core.event.model.EventChangeTypeBasicGuidArtifact; import org.eclipse.osee.framework.skynet.core.internal.Activator; -import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; import org.eclipse.osee.framework.skynet.core.relation.RelationLink; import org.eclipse.osee.framework.skynet.core.relation.RelationManager; import org.eclipse.osee.framework.skynet.core.relation.RelationTypeManager; import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction; import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager; +import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; import org.eclipse.osee.framework.skynet.core.utility.IdJoinQuery; import org.eclipse.osee.framework.skynet.core.utility.JoinUtility; +import org.eclipse.osee.jdbc.JdbcStatement; /** * Changes the descriptor type of an artifact to the provided descriptor. @@ -132,9 +131,7 @@ public class ChangeArtifactType { IdJoinQuery artifactJoin = populateArtIdsInJoinIdTable(inputArtifacts); IdJoinQuery branchJoin = populateBranchIdsJoinIdTable(); IdJoinQuery gammaJoin = populateGammaIdsJoinIdTable(artifactJoin); - IOseeDatabaseService database = ServiceUtil.getOseeDatabaseService(); - IOseeStatement chStmt = database.getStatement(); - + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { chStmt.runPreparedQuery( "select branch_id, gamma_id from osee_join_id jid1, osee_join_id jid2, osee_txs txs where jid1.query_id = ? and jid2.query_id = ? and jid1.id = txs.gamma_id and jid2.id = txs.branch_id and txs.tx_current = ?", @@ -252,7 +249,7 @@ public class ChangeArtifactType { insertData.add(toUpdate(newArtifactType.getId(), artifact.getArtId())); } - ServiceUtil.getOseeDatabaseService().runBatchUpdate(UPDATE, insertData); + ConnectionHandler.getJdbcClient().runBatchUpdate(UPDATE, insertData); for (Artifact artifact : modifiedArtifacts) { artifact.setArtifactType(newArtifactType); @@ -265,9 +262,7 @@ public class ChangeArtifactType { } private IdJoinQuery populateArtIdsInJoinIdTable(Collection<? extends Artifact> inputArtifacts) throws OseeDataStoreException, OseeCoreException { - IOseeDatabaseService database = ServiceUtil.getOseeDatabaseService(); - IdJoinQuery artifactJoin = JoinUtility.createIdJoinQuery(database); - + IdJoinQuery artifactJoin = JoinUtility.createIdJoinQuery(); for (Artifact artifact : inputArtifacts) { artifactJoin.add(artifact.getArtId()); } @@ -278,8 +273,7 @@ public class ChangeArtifactType { } private IdJoinQuery populateBranchIdsJoinIdTable() throws OseeDataStoreException, OseeCoreException { - IOseeDatabaseService database = ServiceUtil.getOseeDatabaseService(); - IdJoinQuery branchJoin = JoinUtility.createIdJoinQuery(database); + IdJoinQuery branchJoin = JoinUtility.createIdJoinQuery(); // loop through all non-archieved non-deleted non-purged @@ -295,11 +289,8 @@ public class ChangeArtifactType { } private IdJoinQuery populateGammaIdsJoinIdTable(IdJoinQuery artIds) throws OseeDataStoreException, OseeCoreException { - IOseeDatabaseService database = ServiceUtil.getOseeDatabaseService(); - - IdJoinQuery gammaJoin = JoinUtility.createIdJoinQuery(database); - IOseeStatement chStmt = database.getStatement(); - + IdJoinQuery gammaJoin = JoinUtility.createIdJoinQuery(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { chStmt.runPreparedQuery( "select art_id, gamma_id from osee_artifact art, osee_join_id jid where jid.query_id = ? and jid.id = art.art_id", diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/PurgeArtifacts.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/PurgeArtifacts.java index 3c66f611302..51ad8a327ec 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/PurgeArtifacts.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/PurgeArtifacts.java @@ -18,8 +18,6 @@ import java.util.Set; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.osee.framework.core.enums.DeletionFlag; import org.eclipse.osee.framework.core.model.Branch; -import org.eclipse.osee.framework.database.core.IOseeStatement; -import org.eclipse.osee.framework.database.core.OseeConnection; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery; import org.eclipse.osee.framework.skynet.core.event.OseeEventManager; @@ -27,12 +25,14 @@ import org.eclipse.osee.framework.skynet.core.event.model.ArtifactEvent; import org.eclipse.osee.framework.skynet.core.event.model.EventBasicGuidArtifact; import org.eclipse.osee.framework.skynet.core.event.model.EventModType; import org.eclipse.osee.framework.skynet.core.internal.Activator; -import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; import org.eclipse.osee.framework.skynet.core.relation.RelationLink; import org.eclipse.osee.framework.skynet.core.utility.AbstractDbTxOperation; import org.eclipse.osee.framework.skynet.core.utility.ArtifactJoinQuery; +import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; import org.eclipse.osee.framework.skynet.core.utility.JoinUtility; import org.eclipse.osee.framework.skynet.core.utility.TransactionJoinQuery; +import org.eclipse.osee.jdbc.JdbcConnection; +import org.eclipse.osee.jdbc.JdbcStatement; /** * @author Ryan D. Brooks @@ -60,14 +60,14 @@ public class PurgeArtifacts extends AbstractDbTxOperation { } public PurgeArtifacts(Collection<? extends Artifact> artifactsToPurge, boolean recurseChildrenBranches) throws OseeCoreException { - super(ServiceUtil.getOseeDatabaseService(), "Purge Artifact", Activator.PLUGIN_ID); + super(ConnectionHandler.getJdbcClient(), "Purge Artifact", Activator.PLUGIN_ID); this.artifactsToPurge = new LinkedList<Artifact>(artifactsToPurge); this.success = false; this.recurseChildrenBranches = recurseChildrenBranches; } @Override - protected void doTxWork(IProgressMonitor monitor, OseeConnection connection) throws OseeCoreException { + protected void doTxWork(IProgressMonitor monitor, JdbcConnection connection) throws OseeCoreException { if (artifactsToPurge == null || artifactsToPurge.isEmpty()) { return; } @@ -81,7 +81,7 @@ public class PurgeArtifacts extends AbstractDbTxOperation { } artifactsToPurge.addAll(childreArtifactsToPurge); - ArtifactJoinQuery artJoin2 = JoinUtility.createArtifactJoinQuery(getDatabaseService()); + ArtifactJoinQuery artJoin2 = JoinUtility.createArtifactJoinQuery(getJdbcClient()); try { for (Artifact art : artifactsToPurge) { artJoin2.add(art.getArtId(), art.getFullBranch().getUuid()); @@ -90,7 +90,7 @@ public class PurgeArtifacts extends AbstractDbTxOperation { int queryId = artJoin2.getQueryId(); - TransactionJoinQuery txJoin = JoinUtility.createTransactionJoinQuery(getDatabaseService()); + TransactionJoinQuery txJoin = JoinUtility.createTransactionJoinQuery(getJdbcClient()); insertSelectItems(txJoin, connection, "osee_relation_link", "(aj.art_id = item.a_art_id OR aj.art_id = item.b_art_id)", queryId); @@ -99,9 +99,8 @@ public class PurgeArtifacts extends AbstractDbTxOperation { try { txJoin.store(connection); - getDatabaseService().runPreparedUpdate(connection, DELETE_FROM_TXS_USING_JOIN_TRANSACTION, - txJoin.getQueryId()); - getDatabaseService().runPreparedUpdate(connection, DELETE_FROM_TX_DETAILS_USING_JOIN_TRANSACTION, + getJdbcClient().runPreparedUpdate(connection, DELETE_FROM_TXS_USING_JOIN_TRANSACTION, txJoin.getQueryId()); + getJdbcClient().runPreparedUpdate(connection, DELETE_FROM_TX_DETAILS_USING_JOIN_TRANSACTION, txJoin.getQueryId()); } finally { txJoin.delete(connection); @@ -139,9 +138,9 @@ public class PurgeArtifacts extends AbstractDbTxOperation { } } - public void insertSelectItems(TransactionJoinQuery txJoin, OseeConnection connection, String tableName, String artifactJoinSql, int queryId) throws OseeCoreException { + public void insertSelectItems(TransactionJoinQuery txJoin, JdbcConnection connection, String tableName, String artifactJoinSql, int queryId) throws OseeCoreException { String query = String.format(SELECT_ITEM_GAMMAS, tableName, artifactJoinSql); - IOseeStatement chStmt = getDatabaseService().getStatement(connection); + JdbcStatement chStmt = getJdbcClient().getStatement(connection); try { chStmt.runPreparedQuery(query, queryId); while (chStmt.next()) { @@ -152,8 +151,8 @@ public class PurgeArtifacts extends AbstractDbTxOperation { } } - private void checkPurgeValid(OseeConnection connection) { - ArtifactJoinQuery artJoin = JoinUtility.createArtifactJoinQuery(getDatabaseService()); + private void checkPurgeValid(JdbcConnection connection) { + ArtifactJoinQuery artJoin = JoinUtility.createArtifactJoinQuery(getJdbcClient()); for (Artifact art : artifactsToPurge) { for (Branch branch : art.getFullBranch().getChildBranches(true)) { artJoin.add(art.getArtId(), branch.getUuid()); @@ -162,7 +161,7 @@ public class PurgeArtifacts extends AbstractDbTxOperation { if (!artJoin.isEmpty()) { try { artJoin.store(connection); - IOseeStatement chStmt = getDatabaseService().getStatement(connection); + JdbcStatement chStmt = getJdbcClient().getStatement(connection); try { chStmt.runPreparedQuery(COUNT_ARTIFACT_VIOLATIONS, artJoin.getQueryId()); boolean failed = false; diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/PurgeAttributes.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/PurgeAttributes.java index b951d809837..896bccaf0e5 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/PurgeAttributes.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/PurgeAttributes.java @@ -10,24 +10,24 @@ *******************************************************************************/ package org.eclipse.osee.framework.skynet.core.artifact; -import static org.eclipse.osee.framework.database.core.IOseeStatement.MAX_FETCH; import java.util.Collection; import java.util.HashSet; import java.util.Set; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.osee.framework.core.exception.OseeDataStoreException; -import org.eclipse.osee.framework.database.core.IOseeStatement; -import org.eclipse.osee.framework.database.core.OseeConnection; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.skynet.core.event.OseeEventManager; import org.eclipse.osee.framework.skynet.core.event.model.ArtifactEvent; import org.eclipse.osee.framework.skynet.core.event.model.EventBasicGuidArtifact; import org.eclipse.osee.framework.skynet.core.event.model.EventModType; import org.eclipse.osee.framework.skynet.core.internal.Activator; -import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; import org.eclipse.osee.framework.skynet.core.utility.AbstractDbTxOperation; +import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; import org.eclipse.osee.framework.skynet.core.utility.IdJoinQuery; import org.eclipse.osee.framework.skynet.core.utility.JoinUtility; +import org.eclipse.osee.jdbc.JdbcConnection; +import org.eclipse.osee.jdbc.JdbcConstants; +import org.eclipse.osee.jdbc.JdbcStatement; /** * @author Jeff C. Phillips @@ -47,16 +47,16 @@ public class PurgeAttributes extends AbstractDbTxOperation { private boolean success; public PurgeAttributes(Collection<Attribute<?>> attributesToPurge) throws OseeCoreException { - super(ServiceUtil.getOseeDatabaseService(), "Purge Attributes", Activator.PLUGIN_ID); + super(ConnectionHandler.getJdbcClient(), "Purge Attributes", Activator.PLUGIN_ID); this.attributesToPurge = attributesToPurge; } @Override - protected void doTxWork(IProgressMonitor monitor, OseeConnection connection) throws OseeCoreException { + protected void doTxWork(IProgressMonitor monitor, JdbcConnection connection) throws OseeCoreException { IdJoinQuery txsJoin = populateTxsJoinTable(); try { - getDatabaseService().runPreparedUpdate(connection, DELETE_TXS, txsJoin.getQueryId()); - getDatabaseService().runPreparedUpdate(connection, DELETE_ATTR, txsJoin.getQueryId()); + getJdbcClient().runPreparedUpdate(connection, DELETE_TXS, txsJoin.getQueryId()); + getJdbcClient().runPreparedUpdate(connection, DELETE_ATTR, txsJoin.getQueryId()); for (Attribute<?> attribute : attributesToPurge) { attribute.purge(); @@ -69,19 +69,19 @@ public class PurgeAttributes extends AbstractDbTxOperation { } private IdJoinQuery populateTxsJoinTable() throws OseeDataStoreException, OseeCoreException { - IdJoinQuery attributeJoin = JoinUtility.createIdJoinQuery(getDatabaseService()); + IdJoinQuery attributeJoin = JoinUtility.createIdJoinQuery(getJdbcClient()); for (Attribute<?> attribute : attributesToPurge) { attributeJoin.add(attribute.getId()); } - IdJoinQuery txsJoin = JoinUtility.createIdJoinQuery(getDatabaseService()); + IdJoinQuery txsJoin = JoinUtility.createIdJoinQuery(getJdbcClient()); try { attributeJoin.store(); - IOseeStatement chStmt = getDatabaseService().getStatement(); + JdbcStatement chStmt = getJdbcClient().getStatement(); try { - chStmt.runPreparedQuery(MAX_FETCH, SELECT_ATTR_GAMMAS, attributeJoin.getQueryId()); + chStmt.runPreparedQuery(JdbcConstants.JDBC__MAX_FETCH_SIZE, SELECT_ATTR_GAMMAS, attributeJoin.getQueryId()); while (chStmt.next()) { txsJoin.add(chStmt.getInt("gamma_id")); } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/RelationLoader.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/RelationLoader.java index c4fc3926786..452912e797e 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/RelationLoader.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/RelationLoader.java @@ -17,13 +17,13 @@ import org.eclipse.osee.framework.core.enums.LoadLevel; import org.eclipse.osee.framework.core.enums.ModificationType; import org.eclipse.osee.framework.core.model.Branch; import org.eclipse.osee.framework.core.model.type.RelationType; -import org.eclipse.osee.framework.database.core.IOseeStatement; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.skynet.core.internal.OseeSql; import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; import org.eclipse.osee.framework.skynet.core.relation.RelationManager; import org.eclipse.osee.framework.skynet.core.relation.RelationTypeManager; import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; +import org.eclipse.osee.jdbc.JdbcStatement; /** * @author Ryan Schmitt @@ -39,7 +39,7 @@ class RelationLoader { return; // TODO: someday we might have a use for historical relations, but not now } - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { String sqlQuery = ServiceUtil.getSql(OseeSql.LOAD_RELATIONS); chStmt.runPreparedQuery(artifacts.size() * 8, sqlQuery, joinQueryId); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/UpdateMergeBranch.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/UpdateMergeBranch.java index 5393a32edbe..c031d7f1ef0 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/UpdateMergeBranch.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/UpdateMergeBranch.java @@ -14,27 +14,29 @@ import static org.eclipse.osee.framework.core.enums.DeletionFlag.INCLUDE_DELETED import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; +import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.Platform; import org.eclipse.osee.framework.core.enums.ModificationType; import org.eclipse.osee.framework.core.enums.TxChange; import org.eclipse.osee.framework.core.model.Branch; -import org.eclipse.osee.framework.database.core.IOseeStatement; -import org.eclipse.osee.framework.database.core.OseeConnection; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.Collections; import org.eclipse.osee.framework.jdk.core.util.Lib; import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery; +import org.eclipse.osee.framework.skynet.core.internal.Activator; import org.eclipse.osee.framework.skynet.core.internal.OseeSql; import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; +import org.eclipse.osee.framework.skynet.core.utility.AbstractDbTxOperation; import org.eclipse.osee.framework.skynet.core.utility.ArtifactJoinQuery; -import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; -import org.eclipse.osee.framework.skynet.core.utility.DbTransaction; import org.eclipse.osee.framework.skynet.core.utility.JoinUtility; +import org.eclipse.osee.jdbc.JdbcClient; +import org.eclipse.osee.jdbc.JdbcConnection; +import org.eclipse.osee.jdbc.JdbcStatement; /** * @author Theron Virgin */ -public class UpdateMergeBranch extends DbTransaction { +public class UpdateMergeBranch extends AbstractDbTxOperation { private static final String TX_CURRENT_SETTINGS = "CASE" + // @@ -61,7 +63,8 @@ public class UpdateMergeBranch extends DbTransaction { private final Branch destBranch; private final Branch sourceBranch; - public UpdateMergeBranch(Branch mergeBranch, ArrayList<Integer> expectedArtIds, Branch destBranch, Branch sourceBranch) { + public UpdateMergeBranch(JdbcClient jdbcClient, Branch mergeBranch, ArrayList<Integer> expectedArtIds, Branch destBranch, Branch sourceBranch) { + super(jdbcClient, "Update Merge Branch", Activator.PLUGIN_ID); this.destBranch = destBranch; this.expectedArtIds = expectedArtIds; this.mergeBranch = mergeBranch; @@ -69,7 +72,7 @@ public class UpdateMergeBranch extends DbTransaction { } @Override - protected void handleTxWork(OseeConnection connection) throws OseeCoreException { + protected void doTxWork(IProgressMonitor monitor, JdbcConnection connection) throws OseeCoreException { Collection<Integer> allMergeBranchArtifacts = getAllMergeArtifacts(mergeBranch); long time = System.currentTimeMillis(); Collection<Integer> allMergeBranchArtifactsCopy = new HashSet<Integer>(allMergeBranchArtifacts); @@ -125,9 +128,9 @@ public class UpdateMergeBranch extends DbTransaction { int baselineTransaction = mergeBranch.getBaseTransaction().getId(); for (Artifact artifact : goodMergeBranchArtifacts) { numberAttrUpdated += - ConnectionHandler.runPreparedUpdate(connection, UPDATE_ARTIFACTS, baselineTransaction, - mergeBranch.getUuid(), artifact.getArtId(), sourceBranch.getUuid(), TxChange.NOT_CURRENT.getValue(), - mergeBranch.getUuid(), baselineTransaction); + getJdbcClient().runPreparedUpdate(connection, UPDATE_ARTIFACTS, baselineTransaction, mergeBranch.getUuid(), + artifact.getArtId(), sourceBranch.getUuid(), TxChange.NOT_CURRENT.getValue(), mergeBranch.getUuid(), + baselineTransaction); } if (DEBUG) { System.out.println(String.format(" Adding %d Attributes to Existing Artifacts took %s", @@ -155,12 +158,12 @@ public class UpdateMergeBranch extends DbTransaction { private final static String INSERT_ARTIFACT_GAMMAS = "INSERT INTO OSEE_TXS (transaction_id, gamma_id, mod_type, tx_current, branch_id) SELECT ?, arv1.gamma_id, txs1.mod_type, ?, ? FROM osee_artifact arv1, osee_txs txs1, osee_join_artifact ald1 WHERE txs1.branch_id = ? AND txs1.tx_current in (1,2) AND txs1.gamma_id = arv1.gamma_id AND arv1.art_id = ald1.art_id and ald1.query_id = ?"; - private void addArtifactsToBranch(OseeConnection connection, Branch sourceBranch, Branch destBranch, Branch mergeBranch, Collection<Integer> artIds) throws OseeCoreException { + private void addArtifactsToBranch(JdbcConnection connection, Branch sourceBranch, Branch destBranch, Branch mergeBranch, Collection<Integer> artIds) throws OseeCoreException { if (artIds == null || artIds.isEmpty()) { throw new IllegalArgumentException("Artifact IDs can not be null or empty"); } - ArtifactJoinQuery joinQuery = JoinUtility.createArtifactJoinQuery(); + ArtifactJoinQuery joinQuery = JoinUtility.createArtifactJoinQuery(getJdbcClient()); for (int artId : artIds) { joinQuery.add(artId, sourceBranch.getUuid()); } @@ -179,16 +182,16 @@ public class UpdateMergeBranch extends DbTransaction { } } - private static void insertGammas(OseeConnection connection, String sql, int baselineTransactionNumber, int queryId, Branch sourceBranch, Branch mergeBranch) throws OseeCoreException { - ConnectionHandler.runPreparedUpdate(connection, sql, baselineTransactionNumber, TxChange.CURRENT.getValue(), + private void insertGammas(JdbcConnection connection, String sql, int baselineTransactionNumber, int queryId, Branch sourceBranch, Branch mergeBranch) throws OseeCoreException { + getJdbcClient().runPreparedUpdate(connection, sql, baselineTransactionNumber, TxChange.CURRENT.getValue(), mergeBranch.getUuid(), sourceBranch.getUuid(), queryId); } - private static Collection<Integer> getAllMergeArtifacts(Branch branch) throws OseeCoreException { + private Collection<Integer> getAllMergeArtifacts(Branch branch) throws OseeCoreException { Collection<Integer> artSet = new HashSet<Integer>(); long time = System.currentTimeMillis(); - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = getJdbcClient().getStatement(); try { chStmt.runPreparedQuery(ServiceUtil.getSql(OseeSql.MERGE_GET_ARTIFACTS_FOR_BRANCH), branch.getUuid()); while (chStmt.next()) { @@ -236,13 +239,13 @@ public class UpdateMergeBranch extends DbTransaction { * from the database. It also removes all history associated with this artifact (i.e. all transactions and gamma ids * will also be removed from the database only for the branch it is on). */ - private static void purgeArtifactFromBranch(OseeConnection connection, Branch branch, int artId) throws OseeCoreException { + private void purgeArtifactFromBranch(JdbcConnection connection, Branch branch, int artId) throws OseeCoreException { long branchUuid = branch.getUuid(); //Remove from Baseline - ConnectionHandler.runPreparedUpdate(connection, PURGE_ATTRIBUTE_FROM_MERGE_BRANCH, branchUuid, artId); - ConnectionHandler.runPreparedUpdate(connection, PURGE_RELATION_FROM_MERGE_BRANCH, branchUuid, artId, artId); - ConnectionHandler.runPreparedUpdate(connection, PURGE_ARTIFACT_FROM_MERGE_BRANCH, branchUuid, artId); + getJdbcClient().runPreparedUpdate(connection, PURGE_ATTRIBUTE_FROM_MERGE_BRANCH, branchUuid, artId); + getJdbcClient().runPreparedUpdate(connection, PURGE_RELATION_FROM_MERGE_BRANCH, branchUuid, artId, artId); + getJdbcClient().runPreparedUpdate(connection, PURGE_ARTIFACT_FROM_MERGE_BRANCH, branchUuid, artId); } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/providers/DefaultAttributeDataProvider.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/providers/DefaultAttributeDataProvider.java index 2f13a38bd4c..e20fa3eab69 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/providers/DefaultAttributeDataProvider.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/providers/DefaultAttributeDataProvider.java @@ -13,12 +13,12 @@ package org.eclipse.osee.framework.skynet.core.attribute.providers; import java.io.ByteArrayInputStream; import java.io.IOException; import org.eclipse.osee.framework.core.exception.OseeExceptions; -import org.eclipse.osee.framework.database.IOseeDatabaseService; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.Lib; import org.eclipse.osee.framework.skynet.core.artifact.Attribute; import org.eclipse.osee.framework.skynet.core.attribute.AttributeResourceProcessor; import org.eclipse.osee.framework.skynet.core.attribute.utils.BinaryContentUtils; +import org.eclipse.osee.jdbc.JdbcConstants; /** * @author Roberto E. Escobar @@ -78,7 +78,7 @@ public class DefaultAttributeDataProvider extends AbstractAttributeDataProvider } private void storeValue(String value) throws OseeCoreException { - if (value != null && value.length() > IOseeDatabaseService.MAX_VARCHAR_LENGTH) { + if (value != null && value.length() > JdbcConstants.JDBC__MAX_VARCHAR_LENGTH) { try { byte[] compressed = Lib.compressStream(new ByteArrayInputStream(value.getBytes("UTF-8")), getInternalFileName()); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/conflict/ConflictStatusManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/conflict/ConflictStatusManager.java index 3bd43e5ed1b..86dac7bc151 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/conflict/ConflictStatusManager.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/conflict/ConflictStatusManager.java @@ -13,9 +13,9 @@ package org.eclipse.osee.framework.skynet.core.conflict; import org.eclipse.osee.framework.core.enums.ConflictStatus; import org.eclipse.osee.framework.core.enums.ConflictType; -import org.eclipse.osee.framework.database.core.IOseeStatement; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; +import org.eclipse.osee.jdbc.JdbcStatement; /** * @author Theron Virgin @@ -35,7 +35,7 @@ public class ConflictStatusManager { "UPDATE osee_txs SET gamma_id = ? where (transaction_id, gamma_id) = (SELECT tx.transaction_id, tx.gamma_id FROM osee_txs tx, osee_attribute atr WHERE tx.branch_id = ? AND tx.transaction_id = ? AND atr.gamma_id = tx.gamma_id AND atr.attr_id = ? )"; public static void setStatus(ConflictStatus status, int sourceGamma, int destGamma, long mergeBranchId) throws OseeCoreException { - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); //Gammas should be up to date so you can use them to get entry just update the status field. try { ConnectionHandler.runPreparedUpdate(MERGE_UPDATE_STATUS, status.getValue(), sourceGamma, destGamma, @@ -50,7 +50,7 @@ public class ConflictStatusManager { //add it with an unedited setting and return unedited //If gammas are out of date, update the gammas and down grade markedMerged to Edited - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { chStmt.runPreparedQuery(MERGE_ATTRIBUTE_STATUS, branchID, objectID, conflictType); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/ClientCachingServiceProxy.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/ClientCachingServiceProxy.java index 9b5865d9b6b..9bbb96bd115 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/ClientCachingServiceProxy.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/ClientCachingServiceProxy.java @@ -23,7 +23,6 @@ import org.eclipse.osee.framework.core.model.cache.RelationTypeCache; import org.eclipse.osee.framework.core.model.cache.TransactionCache; 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.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.skynet.core.internal.accessors.ClientArtifactTypeAccessor; import org.eclipse.osee.framework.skynet.core.internal.accessors.ClientAttributeTypeAccessor; @@ -31,6 +30,8 @@ import org.eclipse.osee.framework.skynet.core.internal.accessors.ClientOseeEnumT import org.eclipse.osee.framework.skynet.core.internal.accessors.ClientRelationTypeAccessor; import org.eclipse.osee.framework.skynet.core.internal.accessors.DatabaseBranchAccessor; import org.eclipse.osee.framework.skynet.core.internal.accessors.DatabaseTransactionRecordAccessor; +import org.eclipse.osee.jdbc.JdbcClient; +import org.eclipse.osee.jdbc.JdbcService; /** * @author Roberto E. Escobar @@ -38,7 +39,7 @@ import org.eclipse.osee.framework.skynet.core.internal.accessors.DatabaseTransac public class ClientCachingServiceProxy implements IOseeCachingService { private IOseeModelFactoryService modelFactory; - private IOseeDatabaseService dbService; + private JdbcService jdbcService; private IOseeCachingService proxiedService; @@ -46,8 +47,8 @@ public class ClientCachingServiceProxy implements IOseeCachingService { this.modelFactory = modelFactory; } - public void setDatabaseService(IOseeDatabaseService dbService) { - this.dbService = dbService; + public void setJdbcService(JdbcService jdbcService) { + this.jdbcService = jdbcService; } public void start() { @@ -115,14 +116,15 @@ public class ClientCachingServiceProxy implements IOseeCachingService { } private IOseeCachingService createService(IOseeModelFactoryService factory) { + JdbcClient jdbcClient = jdbcService.getClient(); TransactionCache transactionCache = new TransactionCache(); DatabaseBranchAccessor clientBranchAccessor = - new DatabaseBranchAccessor(dbService, transactionCache, factory.getBranchFactory()); + new DatabaseBranchAccessor(jdbcClient, transactionCache, factory.getBranchFactory()); BranchCache branchCache = new BranchCache(clientBranchAccessor, transactionCache); TransactionRecordFactory txFactory = factory.getTransactionFactory(); - transactionCache.setAccessor(new DatabaseTransactionRecordAccessor(dbService, branchCache, txFactory)); + transactionCache.setAccessor(new DatabaseTransactionRecordAccessor(jdbcClient, branchCache, txFactory)); OseeEnumTypeCache oseeEnumTypeCache = new OseeEnumTypeCache(new ClientOseeEnumTypeAccessor(factory.getOseeEnumTypeFactory())); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/OseeSql.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/OseeSql.java index ff8612a37d1..29bccfbbb61 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/OseeSql.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/OseeSql.java @@ -15,8 +15,8 @@ import java.util.Properties; import org.eclipse.osee.framework.core.enums.ConflictStatus; import org.eclipse.osee.framework.core.enums.ModificationType; import org.eclipse.osee.framework.core.enums.TxChange; -import org.eclipse.osee.framework.database.core.SupportedDatabase; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; +import org.eclipse.osee.jdbc.JdbcDbType; /** * @author Ryan D. Brooks @@ -82,7 +82,7 @@ public enum OseeSql { public static Properties getSqlProperties(DatabaseMetaData metaData) throws OseeCoreException { Properties sqlProperties = new Properties(); - boolean areHintsSupported = SupportedDatabase.areHintsSupported(metaData); + boolean areHintsSupported = JdbcDbType.areHintsSupported(metaData); for (OseeSql oseeSql : OseeSql.values()) { String sql; diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/ServiceUtil.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/ServiceUtil.java index 070b307c2c2..75bb75a15e7 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/ServiceUtil.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/ServiceUtil.java @@ -19,7 +19,6 @@ import org.eclipse.osee.framework.core.model.TransactionRecordFactory; import org.eclipse.osee.framework.core.services.IOseeCachingService; import org.eclipse.osee.framework.core.services.IOseeModelFactoryService; import org.eclipse.osee.framework.core.translation.IDataTranslationService; -import org.eclipse.osee.framework.database.IOseeDatabaseService; import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.Conditions; @@ -72,10 +71,6 @@ public final class ServiceUtil { return getService(IDataTranslationService.class); } - public static IOseeDatabaseService getOseeDatabaseService() throws OseeCoreException { - return getService(IOseeDatabaseService.class); - } - public static TransactionRecordFactory getTransactionFactory() throws OseeCoreException { IOseeModelFactoryService service = getService(IOseeModelFactoryService.class); return service != null ? service.getTransactionFactory() : null; diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/DatabaseBranchAccessor.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/DatabaseBranchAccessor.java index b2b6ea418a9..f548feca214 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/DatabaseBranchAccessor.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/DatabaseBranchAccessor.java @@ -23,8 +23,6 @@ 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.model.cache.TransactionCache; -import org.eclipse.osee.framework.database.IOseeDatabaseService; -import org.eclipse.osee.framework.database.core.IOseeStatement; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.type.OseeStateException; import org.eclipse.osee.framework.logging.OseeLog; @@ -32,6 +30,8 @@ import org.eclipse.osee.framework.skynet.core.event.OseeEventManager; import org.eclipse.osee.framework.skynet.core.event.model.BranchEvent; import org.eclipse.osee.framework.skynet.core.event.model.BranchEventType; import org.eclipse.osee.framework.skynet.core.internal.Activator; +import org.eclipse.osee.jdbc.JdbcClient; +import org.eclipse.osee.jdbc.JdbcStatement; /** * @author Roberto E. Escobar @@ -42,19 +42,19 @@ public class DatabaseBranchAccessor implements IOseeDataAccessor<Long, Branch> { private static final String SELECT_BRANCHES = "SELECT * FROM osee_branch"; private static final String SELECT_MERGE_BRANCHES = "SELECT * FROM osee_merge"; - private final IOseeDatabaseService dbService; + private final JdbcClient jdbcClient; private final TransactionCache txCache; private final BranchFactory branchFactory; - public DatabaseBranchAccessor(IOseeDatabaseService dbService, TransactionCache txCache, BranchFactory branchFactory) { - this.dbService = dbService; + public DatabaseBranchAccessor(JdbcClient jdbcClient, TransactionCache txCache, BranchFactory branchFactory) { + this.jdbcClient = jdbcClient; this.txCache = txCache; this.branchFactory = branchFactory; } - private IOseeDatabaseService getDatabaseService() { - return dbService; + private JdbcClient getJdbcClient() { + return jdbcClient; } @Override @@ -77,7 +77,7 @@ public class DatabaseBranchAccessor implements IOseeDataAccessor<Long, Branch> { } private void loadBranches(BranchCache cache, Map<Branch, Long> childToParent, Map<Branch, Integer> branchToBaseTx, Map<Branch, Integer> branchToSourceTx, Map<Branch, Integer> associatedArtifact) throws OseeCoreException { - IOseeStatement chStmt = getDatabaseService().getStatement(); + JdbcStatement chStmt = getJdbcClient().getStatement(); try { chStmt.runPreparedQuery(2000, SELECT_BRANCHES); while (chStmt.next()) { @@ -151,7 +151,7 @@ public class DatabaseBranchAccessor implements IOseeDataAccessor<Long, Branch> { } private void loadMergeBranches(BranchCache branchCache) throws OseeCoreException { - IOseeStatement chStmt = getDatabaseService().getStatement(); + JdbcStatement chStmt = getJdbcClient().getStatement(); try { chStmt.runPreparedQuery(1000, SELECT_MERGE_BRANCHES); while (chStmt.next()) { @@ -170,7 +170,7 @@ public class DatabaseBranchAccessor implements IOseeDataAccessor<Long, Branch> { @Override public void store(Collection<Branch> branches) throws OseeCoreException { - StoreBranchDatabaseCallable task = new StoreBranchDatabaseCallable(dbService, branches); + StoreBranchDatabaseCallable task = new StoreBranchDatabaseCallable(jdbcClient, branches); try { IStatus status = task.handleTxWork(); if (status.isOK()) { diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/DatabaseTransactionRecordAccessor.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/DatabaseTransactionRecordAccessor.java index 14118e480b2..ae403c639c8 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/DatabaseTransactionRecordAccessor.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/DatabaseTransactionRecordAccessor.java @@ -11,8 +11,6 @@ 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.jdk.core.type.MutableInteger; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.type.OseeStateException; @@ -20,6 +18,8 @@ import org.eclipse.osee.framework.skynet.core.internal.OseeSql; import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; import org.eclipse.osee.framework.skynet.core.utility.IdJoinQuery; import org.eclipse.osee.framework.skynet.core.utility.JoinUtility; +import org.eclipse.osee.jdbc.JdbcClient; +import org.eclipse.osee.jdbc.JdbcStatement; /** * @author Roberto E. Escobar @@ -43,12 +43,12 @@ public class DatabaseTransactionRecordAccessor implements ITransactionDataAccess 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 JdbcClient jdbcClient; private final BranchCache branchCache; private final TransactionRecordFactory factory; - public DatabaseTransactionRecordAccessor(IOseeDatabaseService oseeDatabaseService, BranchCache branchCache, TransactionRecordFactory factory) { - this.oseeDatabaseService = oseeDatabaseService; + public DatabaseTransactionRecordAccessor(JdbcClient jdbcClient, BranchCache branchCache, TransactionRecordFactory factory) { + this.jdbcClient = jdbcClient; this.branchCache = branchCache; this.factory = factory; } @@ -64,7 +64,7 @@ public class DatabaseTransactionRecordAccessor implements ITransactionDataAccess } ensureDependantCachePopulated(); if (transactionIds.size() > 1) { - IdJoinQuery joinQuery = JoinUtility.createIdJoinQuery(oseeDatabaseService); + IdJoinQuery joinQuery = JoinUtility.createIdJoinQuery(jdbcClient); try { for (Integer txNumber : transactionIds) { joinQuery.add(txNumber); @@ -104,7 +104,7 @@ public class DatabaseTransactionRecordAccessor implements ITransactionDataAccess loadFromTransaction(cache, expectedCount, numberLoaded, query, queryId); if (numberLoaded.getValue() != expectedCount) { - IOseeStatement chStmt = oseeDatabaseService.getStatement(); + JdbcStatement chStmt = jdbcClient.getStatement(); try { chStmt.runPreparedQuery(expectedCount, SELECT_NON_EXISTING_TRANSACTIONS_BY_QUERY_ID, queryId); while (chStmt.next()) { @@ -122,7 +122,7 @@ public class DatabaseTransactionRecordAccessor implements ITransactionDataAccess } private TransactionRecord loadFromTransaction(TransactionCache cache, int expectedCount, MutableInteger numberLoaded, String query, Object... parameters) throws OseeCoreException { - IOseeStatement chStmt = oseeDatabaseService.getStatement(); + JdbcStatement chStmt = jdbcClient.getStatement(); TransactionRecord record = null; int count = 0; try { @@ -164,13 +164,13 @@ public class DatabaseTransactionRecordAccessor implements ITransactionDataAccess @Override public TransactionRecord getOrLoadPriorTransaction(TransactionCache cache, int transactionNumber, long branchUuid) throws OseeCoreException { int priorTransactionId = - oseeDatabaseService.runPreparedQueryFetchObject(-1, GET_PRIOR_TRANSACTION, branchUuid, transactionNumber); + jdbcClient.runPreparedQueryFetchObject(-1, GET_PRIOR_TRANSACTION, branchUuid, transactionNumber); return cache.getOrLoad(priorTransactionId); } @Override public TransactionRecord getHeadTransaction(TransactionCache cache, Branch branch) throws OseeCoreException { String query = ServiceUtil.getSql(OseeSql.TX_GET_MAX_AS_LARGEST_TX); - return cache.getOrLoad(oseeDatabaseService.runPreparedQueryFetchObject(-1, query, branch.getUuid())); + return cache.getOrLoad(jdbcClient.runPreparedQueryFetchObject(-1, query, branch.getUuid())); } } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/MoveBranchDatabaseCallable.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/MoveBranchDatabaseCallable.java index d2aff7f1cb5..3b32d2e7658 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/MoveBranchDatabaseCallable.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/MoveBranchDatabaseCallable.java @@ -3,9 +3,9 @@ package org.eclipse.osee.framework.skynet.core.internal.accessors; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; 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.framework.jdk.core.type.OseeCoreException; +import org.eclipse.osee.jdbc.JdbcClient; +import org.eclipse.osee.jdbc.JdbcConnection; /** * @author Ryan D. Brooks @@ -18,25 +18,25 @@ public class MoveBranchDatabaseCallable { public static final String DELETE_ADDRESSING = "delete from %s where branch_id = ?"; private final boolean archive; private final Branch branch; - private final IOseeDatabaseService dbService; + private final JdbcClient jdbcClient; - public MoveBranchDatabaseCallable(IOseeDatabaseService databaseService, boolean archive, Branch branch) { - this.dbService = databaseService; + public MoveBranchDatabaseCallable(JdbcClient jdbcClient, boolean archive, Branch branch) { + this.jdbcClient = jdbcClient; this.archive = archive; this.branch = branch; } protected IStatus handleTxWork() throws OseeCoreException { - OseeConnection connection = dbService.getConnection(); + JdbcConnection connection = jdbcClient.getConnection(); try { String sourceTableName = archive ? "osee_txs" : "osee_txs_archived"; String destinationTableName = archive ? "osee_txs_archived" : "osee_txs"; String sql = String.format(INSERT_ADDRESSING, destinationTableName, sourceTableName); - dbService.runPreparedUpdate(connection, sql, branch.getUuid()); + jdbcClient.runPreparedUpdate(connection, sql, branch.getUuid()); sql = String.format(DELETE_ADDRESSING, sourceTableName); - dbService.runPreparedUpdate(connection, sql, branch.getUuid()); + jdbcClient.runPreparedUpdate(connection, sql, branch.getUuid()); } finally { connection.close(); } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/StoreBranchDatabaseCallable.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/StoreBranchDatabaseCallable.java index 078d960d6f1..9c1bdf3d7f4 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/StoreBranchDatabaseCallable.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/StoreBranchDatabaseCallable.java @@ -10,9 +10,9 @@ 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.database.IOseeDatabaseService; -import org.eclipse.osee.framework.database.core.OseeConnection; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; +import org.eclipse.osee.jdbc.JdbcClient; +import org.eclipse.osee.jdbc.JdbcConnection; /** * @author Ryan D. Brooks @@ -29,15 +29,15 @@ public class StoreBranchDatabaseCallable { private static final String DELETE_BRANCH = "DELETE FROM osee_branch WHERE branch_id = ?"; private final Collection<Branch> branches; - private final IOseeDatabaseService dbService; + private final JdbcClient jdbcClient; - public StoreBranchDatabaseCallable(IOseeDatabaseService dbService, Collection<Branch> branches) { + public StoreBranchDatabaseCallable(JdbcClient jdbcClient, Collection<Branch> branches) { this.branches = branches; - this.dbService = dbService; + this.jdbcClient = jdbcClient; } public IStatus handleTxWork() throws OseeCoreException { - OseeConnection connection = dbService.getConnection(); + JdbcConnection connection = jdbcClient.getConnection(); try { List<Object[]> insertData = new ArrayList<Object[]>(); List<Object[]> updateData = new ArrayList<Object[]>(); @@ -61,7 +61,7 @@ public class StoreBranchDatabaseCallable { } if (branch.isFieldDirty(BranchField.BRANCH_ARCHIVED_STATE_FIELD_KEY)) { MoveBranchDatabaseCallable task = - new MoveBranchDatabaseCallable(dbService, branch.getArchiveState().isArchived(), branch); + new MoveBranchDatabaseCallable(jdbcClient, branch.getArchiveState().isArchived(), branch); try { task.handleTxWork(); } catch (Exception ex) { @@ -69,9 +69,9 @@ public class StoreBranchDatabaseCallable { } } } - dbService.runBatchUpdate(connection, INSERT_BRANCH, insertData); - dbService.runBatchUpdate(connection, UPDATE_BRANCH, updateData); - dbService.runBatchUpdate(connection, DELETE_BRANCH, deleteData); + jdbcClient.runBatchUpdate(connection, INSERT_BRANCH, insertData); + jdbcClient.runBatchUpdate(connection, UPDATE_BRANCH, updateData); + jdbcClient.runBatchUpdate(connection, DELETE_BRANCH, deleteData); } finally { connection.close(); } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationManager.java index d41959c6b07..26ac02b34eb 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationManager.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationManager.java @@ -34,7 +34,6 @@ import org.eclipse.osee.framework.core.enums.RelationTypeMultiplicity; import org.eclipse.osee.framework.core.exception.ArtifactDoesNotExist; import org.eclipse.osee.framework.core.exception.MultipleArtifactsExist; import org.eclipse.osee.framework.core.model.type.RelationType; -import org.eclipse.osee.framework.database.core.IOseeStatement; import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.type.Pair; @@ -43,7 +42,6 @@ import org.eclipse.osee.framework.logging.OseeLog; import org.eclipse.osee.framework.skynet.core.artifact.Artifact; import org.eclipse.osee.framework.skynet.core.artifact.ArtifactCache; import org.eclipse.osee.framework.skynet.core.artifact.ArtifactPersistenceManager; -import org.eclipse.osee.framework.skynet.core.artifact.BranchManager; import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery; import org.eclipse.osee.framework.skynet.core.internal.Activator; import org.eclipse.osee.framework.skynet.core.relation.RelationLink.ArtifactLinker; @@ -53,6 +51,7 @@ import org.eclipse.osee.framework.skynet.core.relation.order.RelationSorterProvi import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction; import org.eclipse.osee.framework.skynet.core.types.IArtifact; import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; +import org.eclipse.osee.jdbc.JdbcStatement; /** * @author Ryan D. Brooks @@ -248,7 +247,7 @@ public class RelationManager { if (deletionFlag.areDeletedAllowed()) { Object[] formatArgs = relationType.getSide().isSideA() ? new Object[] {"a", "b"} : new Object[] {"b", "a"}; - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { String sql = String.format(GET_DELETED_ARTIFACT, formatArgs); chStmt.runPreparedQuery(sql, artifact.getFullBranch().getUuid(), relationType.getGuid(), artifact.getArtId()); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeManager.java index c371bce75b7..e8f63501766 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeManager.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeManager.java @@ -20,7 +20,6 @@ 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.operation.IOperation; -import org.eclipse.osee.framework.database.core.IOseeStatement; import org.eclipse.osee.framework.jdk.core.type.CompositeKeyHashMap; import org.eclipse.osee.framework.jdk.core.type.HashCollection; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; @@ -34,6 +33,7 @@ import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager; import org.eclipse.osee.framework.skynet.core.utility.ArtifactJoinQuery; import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; import org.eclipse.osee.framework.skynet.core.utility.JoinUtility; +import org.eclipse.osee.jdbc.JdbcStatement; /** * Public API class for access to change data from branches and transactionIds @@ -120,7 +120,7 @@ public final class ChangeManager { HashCollection<Artifact, TransactionRecord> transactionMap = new HashCollection<Artifact, TransactionRecord>(); try { joinQuery.store(); - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { chStmt.runPreparedQuery(joinQuery.size() * 2, ServiceUtil.getSql(OseeSql.CHANGE_TX_MODIFYING), joinQuery.getQueryId()); @@ -163,7 +163,7 @@ public final class ChangeManager { HashCollection<Artifact, Branch> branchMap = new HashCollection<Artifact, Branch>(); try { joinQuery.store(); - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { chStmt.runPreparedQuery(joinQuery.size() * 2, ServiceUtil.getSql(OseeSql.CHANGE_BRANCH_MODIFYING), joinQuery.getQueryId()); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ConflictManagerInternal.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ConflictManagerInternal.java index 68e350898da..0955edcfa63 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ConflictManagerInternal.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ConflictManagerInternal.java @@ -24,7 +24,6 @@ import org.eclipse.osee.framework.core.enums.ModificationType; import org.eclipse.osee.framework.core.exception.BranchMergeException; import org.eclipse.osee.framework.core.model.Branch; import org.eclipse.osee.framework.core.model.TransactionRecord; -import org.eclipse.osee.framework.database.core.IOseeStatement; import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.skynet.core.artifact.Artifact; @@ -41,6 +40,7 @@ import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager; import org.eclipse.osee.framework.skynet.core.utility.ArtifactJoinQuery; import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; import org.eclipse.osee.framework.skynet.core.utility.JoinUtility; +import org.eclipse.osee.jdbc.JdbcStatement; /** * @author Theron Virgin @@ -63,7 +63,7 @@ public class ConflictManagerInternal { monitor.beginTask(String.format("Loading Merge Manager for Transaction %d", commitTransaction.getId()), 100); monitor.subTask("Finding Database stored conflicts"); ArrayList<Conflict> conflicts = new ArrayList<Conflict>(); - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { chStmt.runPreparedQuery(ServiceUtil.getSql(OseeSql.CONFLICT_GET_HISTORICAL_ATTRIBUTES), commitTransaction.getId()); @@ -172,7 +172,7 @@ public class ConflictManagerInternal { monitor.subTask("Finding Artifact Version Conflicts"); - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { int commonTransactionNumber = transactionId != null ? transactionId.getId() : 0; long commonBranchId = transactionId != null ? transactionId.getBranchId() : 0; @@ -223,7 +223,7 @@ public class ConflictManagerInternal { private static void loadAttributeConflictsNew(Branch sourceBranch, Branch destinationBranch, TransactionRecord baselineTransaction, Collection<ConflictBuilder> conflictBuilders, Set<Integer> artIdSet, IProgressMonitor monitor, TransactionRecord transactionId) throws OseeCoreException { monitor.subTask("Finding the Attribute Conflicts"); - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); AttributeConflictBuilder attributeConflictBuilder; try { int commonTransactionNumber = transactionId != null ? transactionId.getId() : 0; @@ -320,7 +320,7 @@ public class ConflictManagerInternal { public static Collection<Long> getDestinationBranchesMerged(long sourceBranchId) throws OseeCoreException { List<Long> destinationBranches = new LinkedList<Long>(); - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { chStmt.runPreparedQuery(GET_DESTINATION_BRANCHES, sourceBranchId); while (chStmt.next()) { @@ -337,7 +337,7 @@ public class ConflictManagerInternal { private static int getCommitTransaction(Branch sourceBranch, Branch destBranch) throws OseeCoreException { int transactionId = 0; - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { if (sourceBranch != null && destBranch != null) { chStmt.runPreparedQuery(GET_MERGE_DATA, sourceBranch.getUuid(), destBranch.getUuid()); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/RevisionChangeLoader.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/RevisionChangeLoader.java index 75d7fdddbc9..fdd5df801fd 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/RevisionChangeLoader.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/RevisionChangeLoader.java @@ -23,7 +23,6 @@ import org.eclipse.osee.framework.core.data.IOseeBranch; import org.eclipse.osee.framework.core.enums.DeletionFlag; import org.eclipse.osee.framework.core.model.Branch; import org.eclipse.osee.framework.core.model.TransactionRecord; -import org.eclipse.osee.framework.database.core.IOseeStatement; import org.eclipse.osee.framework.jdk.core.type.CompositeKeyHashMap; import org.eclipse.osee.framework.jdk.core.type.HashCollection; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; @@ -45,6 +44,7 @@ import org.eclipse.osee.framework.skynet.core.revision.acquirer.AttributeChangeA import org.eclipse.osee.framework.skynet.core.revision.acquirer.RelationChangeAcquirer; import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager; import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; +import org.eclipse.osee.jdbc.JdbcStatement; /** * Acquires changes for either branches or transactions. @@ -95,7 +95,7 @@ public final class RevisionChangeLoader { } private void loadTransactions(Branch branch, Artifact artifact, TransactionRecord transactionId, Set<TransactionRecord> transactionIds) throws OseeCoreException { - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { chStmt.runPreparedQuery(ServiceUtil.getSql(OseeSql.LOAD_REVISION_HISTORY_TRANSACTION_ATTR), artifact.getArtId(), branch.getUuid(), transactionId.getId()); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/ArtifactChangeAcquirer.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/ArtifactChangeAcquirer.java index 7c0c41752f8..02dea81e7e3 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/ArtifactChangeAcquirer.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/ArtifactChangeAcquirer.java @@ -19,7 +19,6 @@ import org.eclipse.osee.framework.core.enums.ModificationType; 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.database.core.IOseeStatement; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.skynet.core.artifact.Artifact; import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager; @@ -29,6 +28,7 @@ import org.eclipse.osee.framework.skynet.core.internal.OseeSql; import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager; import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; +import org.eclipse.osee.jdbc.JdbcStatement; /** * @author Jeff C. Phillips @@ -49,7 +49,7 @@ public class ArtifactChangeAcquirer extends ChangeAcquirer { if (getMonitor() != null) { getMonitor().subTask("Gathering New or Deleted Artifacts"); } - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { if (hasBranch) { //Changes per a branch diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/AttributeChangeAcquirer.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/AttributeChangeAcquirer.java index bd9c860159c..25a6c0f5e19 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/AttributeChangeAcquirer.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/AttributeChangeAcquirer.java @@ -24,7 +24,6 @@ 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.type.AttributeType; -import org.eclipse.osee.framework.database.core.IOseeStatement; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.skynet.core.artifact.Artifact; import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager; @@ -38,6 +37,7 @@ import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager; import org.eclipse.osee.framework.skynet.core.utility.ArtifactJoinQuery; import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; import org.eclipse.osee.framework.skynet.core.utility.JoinUtility; +import org.eclipse.osee.jdbc.JdbcStatement; /** * @author Jeff C. Phillips @@ -53,7 +53,7 @@ public class AttributeChangeAcquirer extends ChangeAcquirer { Map<Integer, ChangeBuilder> attributesWasValueCache = new HashMap<Integer, ChangeBuilder>(); Map<Integer, ModificationType> artModTypes = new HashMap<Integer, ModificationType>(); Set<Integer> modifiedArtifacts = new HashSet<Integer>(); - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); boolean hasBranch = getSourceBranch() != null; long time = System.currentTimeMillis(); try { @@ -98,7 +98,7 @@ public class AttributeChangeAcquirer extends ChangeAcquirer { return getChangeBuilders(); } - private void loadIsValues(Branch sourceBranch, Set<Integer> artIds, ArrayList<ChangeBuilder> changeBuilders, Set<Integer> newAndDeletedArtifactIds, IProgressMonitor monitor, Map<Integer, ChangeBuilder> attributesWasValueCache, Map<Integer, ModificationType> artModTypes, Set<Integer> modifiedArtifacts, IOseeStatement chStmt, boolean hasBranch, long time, TransactionRecord fromTransactionId, TransactionRecord toTransactionId, boolean hasSpecificArtifact) throws OseeCoreException { + private void loadIsValues(Branch sourceBranch, Set<Integer> artIds, ArrayList<ChangeBuilder> changeBuilders, Set<Integer> newAndDeletedArtifactIds, IProgressMonitor monitor, Map<Integer, ChangeBuilder> attributesWasValueCache, Map<Integer, ModificationType> artModTypes, Set<Integer> modifiedArtifacts, JdbcStatement chStmt, boolean hasBranch, long time, TransactionRecord fromTransactionId, TransactionRecord toTransactionId, boolean hasSpecificArtifact) throws OseeCoreException { ModificationType artModType; AttributeChangeBuilder attributeChangeBuilder; @@ -182,7 +182,7 @@ public class AttributeChangeAcquirer extends ChangeAcquirer { } joinQuery.store(); - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { chStmt.runPreparedQuery(sql, sqlParamter, joinQuery.getQueryId()); int previousAttrId = -1; diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/RelationChangeAcquirer.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/RelationChangeAcquirer.java index 67d72d54a7f..1bc586cffb6 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/RelationChangeAcquirer.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/RelationChangeAcquirer.java @@ -17,7 +17,6 @@ import org.eclipse.osee.framework.core.enums.ModificationType; 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.database.core.IOseeStatement; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.skynet.core.artifact.Artifact; import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager; @@ -28,6 +27,7 @@ import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; import org.eclipse.osee.framework.skynet.core.relation.RelationTypeManager; import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager; import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; +import org.eclipse.osee.jdbc.JdbcStatement; /** * @author Jeff C. Phillips @@ -40,7 +40,7 @@ public class RelationChangeAcquirer extends ChangeAcquirer { @Override public ArrayList<ChangeBuilder> acquireChanges() throws OseeCoreException { - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); TransactionRecord fromTransactionId; TransactionRecord toTransactionId; diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/StoreSkynetTransactionOperation.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/StoreSkynetTransactionOperation.java index 7e18a2d0ed2..22f4997b49c 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/StoreSkynetTransactionOperation.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/StoreSkynetTransactionOperation.java @@ -25,13 +25,7 @@ import org.eclipse.osee.framework.core.enums.BranchState; import org.eclipse.osee.framework.core.enums.TxChange; import org.eclipse.osee.framework.core.model.Branch; import org.eclipse.osee.framework.core.model.TransactionRecord; -import org.eclipse.osee.framework.core.operation.AbstractOperation; import org.eclipse.osee.framework.core.operation.Operations; -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.IOseeStatement; -import org.eclipse.osee.framework.database.core.OseeConnection; import org.eclipse.osee.framework.jdk.core.type.HashCollection; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.logging.OseeLog; @@ -45,13 +39,17 @@ import org.eclipse.osee.framework.skynet.core.event.model.EventModifiedBasicGuid import org.eclipse.osee.framework.skynet.core.internal.Activator; import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; import org.eclipse.osee.framework.skynet.core.transaction.BaseTransactionData.InsertDataCollector; +import org.eclipse.osee.framework.skynet.core.utility.AbstractDbTxOperation; +import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; +import org.eclipse.osee.jdbc.JdbcConnection; +import org.eclipse.osee.jdbc.JdbcStatement; /** * @author Roberto E. Escobar * @author Ryan D. Brooks * @author Jeff C. Phillips */ -public final class StoreSkynetTransactionOperation extends AbstractOperation implements IDbTransactionWork, InsertDataCollector { +public final class StoreSkynetTransactionOperation extends AbstractDbTxOperation implements InsertDataCollector { private static final String UPDATE_TXS_NOT_CURRENT = "UPDATE osee_txs SET tx_current = " + TxChange.NOT_CURRENT.getValue() + " WHERE branch_id = ? AND transaction_id = ? AND gamma_id = ?"; @@ -65,10 +63,9 @@ public final class StoreSkynetTransactionOperation extends AbstractOperation imp private final Collection<Artifact> artifactReferences; private boolean executedWithException; - private IOseeDatabaseService dbService; public StoreSkynetTransactionOperation(String name, Branch branch, TransactionRecord transactionRecord, Collection<BaseTransactionData> txDatas, Collection<Artifact> artifactReferences) { - super(name, Activator.PLUGIN_ID); + super(ConnectionHandler.getJdbcClient(), name, Activator.PLUGIN_ID); this.branch = branch; this.transactionRecord = transactionRecord; this.txDatas = txDatas; @@ -92,13 +89,7 @@ public final class StoreSkynetTransactionOperation extends AbstractOperation imp } @Override - protected void doWork(IProgressMonitor monitor) throws Exception { - dbService = ServiceUtil.getOseeDatabaseService(); - DatabaseTransactions.execute(dbService, dbService.getConnection(), this); - } - - @Override - public void handleTxWork(OseeConnection connection) throws OseeCoreException { + protected void doTxWork(IProgressMonitor monitor, JdbcConnection connection) throws OseeCoreException { executedWithException = false; TransactionManager.internalPersist(connection, transactionRecord); if (!txDatas.isEmpty()) { @@ -111,7 +102,7 @@ public final class StoreSkynetTransactionOperation extends AbstractOperation imp } @Override - public void handleTxException(Exception ex) { + public void handleTxException(IProgressMonitor monitor, Exception ex) { executedWithException = true; for (BaseTransactionData transactionData : txDatas) { try { @@ -123,7 +114,7 @@ public final class StoreSkynetTransactionOperation extends AbstractOperation imp } @Override - public void handleTxFinally() throws OseeCoreException { + public void handleTxFinally(IProgressMonitor monitor) throws OseeCoreException { if (!executedWithException) { updateModifiedCachedObject(); tagGammas(); @@ -149,7 +140,7 @@ public final class StoreSkynetTransactionOperation extends AbstractOperation imp } } - private void executeTransactionDataItems(OseeConnection connection) throws OseeCoreException { + private void executeTransactionDataItems(JdbcConnection connection) throws OseeCoreException { List<Object[]> txNotCurrentData = new ArrayList<Object[]>(); for (BaseTransactionData transactionData : txDatas) { // Collect inserts for attribute, relation, artifact, and artifact version tables @@ -165,15 +156,15 @@ public final class StoreSkynetTransactionOperation extends AbstractOperation imp Collections.sort(keys); for (int priority : keys) { String sqlKey = dataInsertOrder.get(priority); - dbService.runBatchUpdate(connection, sqlKey, dataItemInserts.getValues(sqlKey)); + getJdbcClient().runBatchUpdate(connection, sqlKey, dataItemInserts.getValues(sqlKey)); } // Set stale tx currents in txs table - dbService.runBatchUpdate(connection, UPDATE_TXS_NOT_CURRENT, txNotCurrentData); + getJdbcClient().runBatchUpdate(connection, UPDATE_TXS_NOT_CURRENT, txNotCurrentData); } - private void fetchTxNotCurrent(OseeConnection connection, Branch branch, BaseTransactionData transactionData, List<Object[]> results) throws OseeCoreException { - IOseeStatement chStmt = dbService.getStatement(connection); + private void fetchTxNotCurrent(JdbcConnection connection, Branch branch, BaseTransactionData transactionData, List<Object[]> results) throws OseeCoreException { + JdbcStatement chStmt = getJdbcClient().getStatement(connection); try { String query = ServiceUtil.getSql(transactionData.getSelectTxNotCurrentSql()); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/TransactionManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/TransactionManager.java index 6ed3e8f5323..902c76165e2 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/TransactionManager.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/TransactionManager.java @@ -10,7 +10,6 @@ *******************************************************************************/ package org.eclipse.osee.framework.skynet.core.transaction; -import static org.eclipse.osee.framework.database.core.IOseeStatement.MAX_FETCH; import java.sql.Timestamp; import java.text.DateFormat; import java.util.ArrayList; @@ -27,8 +26,6 @@ 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.database.core.IOseeStatement; -import org.eclipse.osee.framework.database.core.OseeConnection; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.Conditions; import org.eclipse.osee.framework.jdk.core.util.GUID; @@ -39,6 +36,9 @@ import org.eclipse.osee.framework.skynet.core.internal.OseeSql; import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; import org.eclipse.osee.framework.skynet.core.types.IArtifact; import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; +import org.eclipse.osee.jdbc.JdbcConnection; +import org.eclipse.osee.jdbc.JdbcConstants; +import org.eclipse.osee.jdbc.JdbcStatement; /** * Manages a cache of <code>TransactionId</code>. @@ -81,7 +81,7 @@ public final class TransactionManager { public static List<TransactionRecord> getTransaction(String comment) throws OseeCoreException { ArrayList<TransactionRecord> transactions = new ArrayList<TransactionRecord>(); - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { chStmt.runPreparedQuery(SELECT_TRANSACTION_COMMENTS, comment); while (chStmt.next()) { @@ -111,10 +111,10 @@ public final class TransactionManager { public static List<TransactionRecord> getTransactionsForBranch(Branch branch) throws OseeCoreException { ArrayList<TransactionRecord> transactions = new ArrayList<TransactionRecord>(); - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { - chStmt.runPreparedQuery(MAX_FETCH, SELECT_TRANSACTIONS, branch.getUuid()); + chStmt.runPreparedQuery(JdbcConstants.JDBC__MAX_FETCH_SIZE, SELECT_TRANSACTIONS, branch.getUuid()); while (chStmt.next()) { transactions.add(getTransactionId(chStmt.getInt("transaction_id"), chStmt)); @@ -131,7 +131,7 @@ public final class TransactionManager { // happen in this client or as remote commit events come through if (transactionIds == null) { transactionIds = new ArrayList<TransactionRecord>(5); - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { chStmt.runPreparedQuery(SELECT_COMMIT_TRANSACTIONS, artifact.getArtId()); while (chStmt.next()) { @@ -179,7 +179,7 @@ public final class TransactionManager { return getTransactionId(transactionNumber); } - public static synchronized TransactionRecord createNextTransactionId(OseeConnection connection, Branch branch, User userToBlame, String comment) throws OseeCoreException { + public static synchronized TransactionRecord createNextTransactionId(JdbcConnection connection, Branch branch, User userToBlame, String comment) throws OseeCoreException { TransactionRecord transactionId = internalCreateTransactionRecord(branch, userToBlame, comment); internalPersist(connection, transactionId); return transactionId; @@ -204,7 +204,7 @@ public final class TransactionManager { return transactionId; } - public static synchronized void internalPersist(OseeConnection connection, TransactionRecord transactionRecord) throws OseeCoreException { + public static synchronized void internalPersist(JdbcConnection connection, TransactionRecord transactionRecord) throws OseeCoreException { ConnectionHandler.runPreparedUpdate(connection, INSERT_INTO_TRANSACTION_DETAIL, transactionRecord.getId(), transactionRecord.getComment(), transactionRecord.getTimeStamp(), transactionRecord.getAuthor(), transactionRecord.getBranchId(), transactionRecord.getTxType().getId()); @@ -217,7 +217,7 @@ public final class TransactionManager { TransactionRecord txRecord = null; - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { chStmt.runPreparedQuery(SELECT_BRANCH_TRANSACTION_BY_DATE, branchUuid, new Timestamp(maxDateExclusive.getTime())); @@ -240,7 +240,7 @@ public final class TransactionManager { return getTransactionId(transactionNumber, null); } - public static TransactionRecord getTransactionId(IOseeStatement chStmt) throws OseeCoreException { + public static TransactionRecord getTransactionId(JdbcStatement chStmt) throws OseeCoreException { return getTransactionId(chStmt.getInt("transaction_id"), chStmt); } @@ -252,7 +252,7 @@ public final class TransactionManager { } } - private synchronized static TransactionRecord getTransactionId(int txId, IOseeStatement chStmt) throws OseeCoreException { + private synchronized static TransactionRecord getTransactionId(int txId, JdbcStatement chStmt) throws OseeCoreException { TransactionCache txCache = getTransactionCache(); TransactionRecord transactionRecord = txCache.getById(txId); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/AbstractDbTxOperation.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/AbstractDbTxOperation.java index d01a52afc4e..a206285349f 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/AbstractDbTxOperation.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/AbstractDbTxOperation.java @@ -14,37 +14,37 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.osee.framework.core.operation.AbstractOperation; import org.eclipse.osee.framework.core.operation.NullOperationLogger; import org.eclipse.osee.framework.core.operation.OperationLogger; -import org.eclipse.osee.framework.database.IOseeDatabaseService; -import org.eclipse.osee.framework.database.core.OseeConnection; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; +import org.eclipse.osee.jdbc.JdbcClient; +import org.eclipse.osee.jdbc.JdbcConnection; +import org.eclipse.osee.jdbc.JdbcTransaction; /** * @author Roberto E. Escobar */ public abstract class AbstractDbTxOperation extends AbstractOperation { - private final IOseeDatabaseService databaseService; + private final JdbcClient jdbcClient; - public AbstractDbTxOperation(IOseeDatabaseService databaseService, String operationName, String pluginId) { - this(databaseService, operationName, pluginId, NullOperationLogger.getSingleton()); + public AbstractDbTxOperation(JdbcClient jdbcClient, String operationName, String pluginId) { + this(jdbcClient, operationName, pluginId, NullOperationLogger.getSingleton()); } - public AbstractDbTxOperation(IOseeDatabaseService databaseService, String operationName, String pluginId, OperationLogger logger) { + public AbstractDbTxOperation(JdbcClient jdbcClient, String operationName, String pluginId, OperationLogger logger) { super(operationName, pluginId, logger); - this.databaseService = databaseService; + this.jdbcClient = jdbcClient; } - protected IOseeDatabaseService getDatabaseService() { - return databaseService; + protected JdbcClient getJdbcClient() { + return jdbcClient; } @Override protected final void doWork(IProgressMonitor monitor) throws Exception { - Transaction transaction = new Transaction(monitor); - transaction.execute(); + getJdbcClient().runTransaction(new Transaction(monitor)); } - protected abstract void doTxWork(IProgressMonitor monitor, OseeConnection connection) throws OseeCoreException; + protected abstract void doTxWork(IProgressMonitor monitor, JdbcConnection connection) throws OseeCoreException; protected void handleTxException(IProgressMonitor monitor, Exception ex) { // default implementation @@ -55,7 +55,7 @@ public abstract class AbstractDbTxOperation extends AbstractOperation { // default implementation } - private final class Transaction extends DbTransaction { + private final class Transaction extends JdbcTransaction { private final IProgressMonitor monitor; private Transaction(IProgressMonitor monitor) { @@ -63,22 +63,17 @@ public abstract class AbstractDbTxOperation extends AbstractOperation { } @Override - protected String getTxName() { - return AbstractDbTxOperation.this.getName(); - } - - @Override - protected void handleTxWork(OseeConnection connection) throws OseeCoreException { + public void handleTxWork(JdbcConnection connection) { AbstractDbTxOperation.this.doTxWork(monitor, connection); } @Override - protected void handleTxException(Exception ex) { + public void handleTxException(Exception ex) { AbstractDbTxOperation.this.handleTxException(monitor, ex); } @Override - protected void handleTxFinally() throws OseeCoreException { + public void handleTxFinally() { AbstractDbTxOperation.this.handleTxFinally(monitor); } } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/AbstractJoinQuery.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/AbstractJoinQuery.java index 71154c11222..b1aad2a5930 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/AbstractJoinQuery.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/AbstractJoinQuery.java @@ -15,9 +15,9 @@ import java.util.Collection; import java.util.HashSet; import java.util.List; import java.util.Set; -import org.eclipse.osee.framework.database.core.OseeConnection; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.skynet.core.utility.DatabaseJoinAccessor.JoinItem; +import org.eclipse.osee.jdbc.JdbcConnection; /** * @author Roberto E. Escobar @@ -70,7 +70,7 @@ public abstract class AbstractJoinQuery { return wasStored; } - public void store(OseeConnection connection) throws OseeCoreException { + public void store(JdbcConnection connection) throws OseeCoreException { if (!this.wasStored) { List<Object[]> data = new ArrayList<Object[]>(); for (IJoinRow joinArray : entries) { @@ -93,7 +93,7 @@ public abstract class AbstractJoinQuery { return expiresIn; } - public int delete(OseeConnection connection) throws OseeCoreException { + public int delete(JdbcConnection connection) throws OseeCoreException { return joinAccessor.delete(connection, joinItem, getQueryId()); } @@ -105,7 +105,7 @@ public abstract class AbstractJoinQuery { return delete(null); } - public Collection<Integer> getAllQueryIds(OseeConnection connection) throws OseeCoreException { + public Collection<Integer> getAllQueryIds(JdbcConnection connection) throws OseeCoreException { return joinAccessor.getAllQueryIds(connection, joinItem); } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/ArtifactJoinQuery.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/ArtifactJoinQuery.java index d8ce27ded5e..4a5689d7075 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/ArtifactJoinQuery.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/ArtifactJoinQuery.java @@ -11,9 +11,8 @@ package org.eclipse.osee.framework.skynet.core.utility; import org.eclipse.osee.framework.core.exception.OseeDataStoreException; -import org.eclipse.osee.framework.database.core.SQL3DataType; -import org.eclipse.osee.framework.skynet.core.utility.AbstractJoinQuery.IJoinRow; import org.eclipse.osee.framework.skynet.core.utility.DatabaseJoinAccessor.JoinItem; +import org.eclipse.osee.jdbc.SQL3DataType; /** * @author Roberto E. Escobar diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/CharJoinQuery.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/CharJoinQuery.java index ab6acb848f3..cde86b41f7b 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/CharJoinQuery.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/CharJoinQuery.java @@ -10,7 +10,6 @@ *******************************************************************************/ package org.eclipse.osee.framework.skynet.core.utility; -import org.eclipse.osee.framework.skynet.core.utility.AbstractJoinQuery.IJoinRow; import org.eclipse.osee.framework.skynet.core.utility.DatabaseJoinAccessor.JoinItem; /** diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/ConnectionHandler.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/ConnectionHandler.java index 4bad26bb6d8..9cccb37c5ec 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/ConnectionHandler.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/ConnectionHandler.java @@ -10,14 +10,20 @@ *******************************************************************************/ package org.eclipse.osee.framework.skynet.core.utility; -import java.sql.DatabaseMetaData; +import java.util.Collection; import java.util.List; import org.eclipse.osee.framework.core.exception.OseeDataStoreException; -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.OseeCoreException; -import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; +import org.eclipse.osee.jdbc.JdbcClient; +import org.eclipse.osee.jdbc.JdbcConnection; +import org.eclipse.osee.jdbc.JdbcService; +import org.eclipse.osee.jdbc.JdbcStatement; +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; +import com.google.common.collect.Iterables; /** * Handles connection recovery in the event of database connection being lost @@ -26,16 +32,42 @@ import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; */ public final class ConnectionHandler { - protected static IOseeDatabaseService getDatabase() throws OseeDataStoreException { - return ServiceUtil.getOseeDatabaseService(); + private ConnectionHandler() { + // Utility class } - public static IOseeStatement getStatement() throws OseeDataStoreException { - return getDatabase().getStatement(); + private static JdbcService jdbcServiceInstance; + + public static JdbcClient getJdbcClient() { + if (jdbcServiceInstance == null) { + Bundle bundle = FrameworkUtil.getBundle(ConnectionHandler.class); + BundleContext context = bundle.getBundleContext(); + jdbcServiceInstance = findJdbcService(context); + } + return jdbcServiceInstance != null ? jdbcServiceInstance.getClient() : null; + } + + private static JdbcService findJdbcService(BundleContext context) { + JdbcService toReturn = null; + try { + Collection<ServiceReference<JdbcService>> references = + context.getServiceReferences(JdbcService.class, "(osgi.binding=skynet.jdbc.service)"); + ServiceReference<JdbcService> reference = Iterables.getFirst(references, null); + if (reference != null) { + toReturn = context.getService(reference); + } + } catch (InvalidSyntaxException ex) { + throw new OseeCoreException(ex, "Error finding JdbcService reference with osgi.binding=skynet.jdbc.service"); + } + return toReturn; } - public static IOseeStatement getStatement(OseeConnection connection) throws OseeDataStoreException { - return getDatabase().getStatement(connection); + public static JdbcStatement getStatement() throws OseeDataStoreException { + return getJdbcClient().getStatement(); + } + + public static JdbcStatement getStatement(JdbcConnection connection) throws OseeDataStoreException { + return getJdbcClient().getStatement(connection); } /** @@ -44,7 +76,7 @@ public final class ConnectionHandler { * @return number of records updated */ public static int runPreparedUpdate(String query, Object... data) throws OseeCoreException { - return getDatabase().runPreparedUpdate(query, data); + return getJdbcClient().runPreparedUpdate(query, data); } /** @@ -52,8 +84,8 @@ public final class ConnectionHandler { * * @return number of records updated */ - public static <O extends Object> int runBatchUpdate(String query, List<O[]> dataList) throws OseeCoreException { - return getDatabase().runBatchUpdate(query, dataList); + public static int runBatchUpdate(String query, List<Object[]> dataList) throws OseeCoreException { + return getJdbcClient().runBatchUpdate(query, dataList); } /** @@ -61,29 +93,20 @@ public final class ConnectionHandler { * * @return number of records updated */ - public static int runPreparedUpdate(OseeConnection connection, String query, Object... data) throws OseeCoreException { - return getDatabase().runPreparedUpdate(connection, query, data); + public static int runPreparedUpdate(JdbcConnection connection, String query, Object... data) throws OseeCoreException { + return getJdbcClient().runPreparedUpdate(connection, query, data); } public static int runPreparedQueryFetchInt(int defaultValue, String query, Object... data) throws OseeCoreException { - return getDatabase().runPreparedQueryFetchObject(defaultValue, query, data); + return getJdbcClient().runPreparedQueryFetchObject(defaultValue, query, data); } public static String runPreparedQueryFetchString(String defaultValue, String query, Object... data) throws OseeCoreException { - return getDatabase().runPreparedQueryFetchObject(defaultValue, query, data); - } - - public static DatabaseMetaData getMetaData() throws OseeCoreException { - OseeConnection connection = getDatabase().getConnection(); - try { - return connection.getMetaData(); - } finally { - connection.close(); - } + return getJdbcClient().runPreparedQueryFetchObject(defaultValue, query, data); } public static long getNextSequence(String sequenceName) { - return getDatabase().getNextSequence(sequenceName); + return getJdbcClient().getNextSequence(sequenceName); } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/DatabaseJoinAccessor.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/DatabaseJoinAccessor.java index 31a4f9f6b97..1e8785e2301 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/DatabaseJoinAccessor.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/DatabaseJoinAccessor.java @@ -13,10 +13,10 @@ package org.eclipse.osee.framework.skynet.core.utility; import java.util.ArrayList; import java.util.Collection; import java.util.List; -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.OseeCoreException; +import org.eclipse.osee.jdbc.JdbcClient; +import org.eclipse.osee.jdbc.JdbcConnection; +import org.eclipse.osee.jdbc.JdbcStatement; /** * @author Roberto E. Escobar @@ -29,7 +29,7 @@ public class DatabaseJoinAccessor implements IJoinAccessor { "INSERT INTO osee_join_artifact (query_id, art_id, branch_id, transaction_id) VALUES (?, ?, ?, ?)"; private static final String INSERT_INTO_JOIN_TRANSACTION = "INSERT INTO osee_join_transaction (query_id, gamma_id, transaction_id, branch_id) VALUES (?, ?, ?, ?)"; - + private static final String INSERT_INTO_JOIN_ID = "INSERT INTO osee_join_id (query_id, id) VALUES (?, ?)"; private static final String INSERT_INTO_JOIN_CHAR_ID = "INSERT INTO osee_join_char_id (query_id, id) VALUES (?, ?)"; @@ -72,35 +72,34 @@ public class DatabaseJoinAccessor implements IJoinAccessor { } } - private final IOseeDatabaseService databaseService; + private final JdbcClient jdbcClient; - public DatabaseJoinAccessor(IOseeDatabaseService databaseService) { + public DatabaseJoinAccessor(JdbcClient jdbcClient) { super(); - this.databaseService = databaseService; + this.jdbcClient = jdbcClient; } @Override - public int delete(OseeConnection connection, JoinItem joinItem, int queryId) throws OseeCoreException { + public int delete(JdbcConnection connection, JoinItem joinItem, int queryId) throws OseeCoreException { int updated = 0; if (queryId != -1) { - updated = databaseService.runPreparedUpdate(connection, joinItem.getDeleteSql(), queryId); - databaseService.runPreparedUpdate(connection, DELETE_FROM_JOIN_CLEANUP, queryId); + updated = jdbcClient.runPreparedUpdate(connection, joinItem.getDeleteSql(), queryId); + jdbcClient.runPreparedUpdate(connection, DELETE_FROM_JOIN_CLEANUP, queryId); } return updated; } - @SuppressWarnings("unchecked") @Override - public void store(OseeConnection connection, JoinItem joinItem, int queryId, List<Object[]> dataList, Long issuedAt, Long expiresIn) throws OseeCoreException { - databaseService.runPreparedUpdate(connection, INSERT_INTO_JOIN_CLEANUP, queryId, joinItem.getJoinTableName(), + public void store(JdbcConnection connection, JoinItem joinItem, int queryId, List<Object[]> dataList, Long issuedAt, Long expiresIn) throws OseeCoreException { + jdbcClient.runPreparedUpdate(connection, INSERT_INTO_JOIN_CLEANUP, queryId, joinItem.getJoinTableName(), issuedAt, expiresIn); - databaseService.runBatchUpdate(connection, joinItem.getInsertSql(), dataList); + jdbcClient.runBatchUpdate(connection, joinItem.getInsertSql(), dataList); } @Override - public Collection<Integer> getAllQueryIds(OseeConnection connection, JoinItem joinItem) throws OseeCoreException { + public Collection<Integer> getAllQueryIds(JdbcConnection connection, JoinItem joinItem) throws OseeCoreException { Collection<Integer> queryIds = new ArrayList<Integer>(); - IOseeStatement chStmt = databaseService.getStatement(connection); + JdbcStatement chStmt = jdbcClient.getStatement(connection); try { String query = String.format(SELECT_QUERY_IDS, joinItem.getJoinTableName()); chStmt.runPreparedQuery(query); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/DbTransaction.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/DbTransaction.java deleted file mode 100644 index 05b65361204..00000000000 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/DbTransaction.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.framework.skynet.core.utility; - -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.framework.jdk.core.type.OseeCoreException; -import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; - -/** - * This abstract class provides a uniform way of executing database transactions. It handles exceptions ensuring that - * transactions are processed in the correct order and roll-backs are performed whenever errors are detected. - * - * @author Roberto E. Escobar - */ -public abstract class DbTransaction { - - /** - * Gets the name of this transaction. This is provided mainly for logging purposes. - * - * @return String transaction class Name - */ - protected String getTxName() { - return this.getClass().getCanonicalName(); - } - - /** - * This template method calls {@link #handleTxWork} which is provided by child classes. This method handles - * roll-backs and exception handling to prevent transactions from being left in an incorrect state. - */ - public void execute() throws OseeCoreException { - IOseeDatabaseService dbService = ServiceUtil.getOseeDatabaseService(); - DatabaseTransactions.execute(dbService, dbService.getConnection(), new InternalTransactionWork()); - } - - /** - * Provides the transaction's work implementation. - */ - protected abstract void handleTxWork(OseeConnection connection) throws OseeCoreException; - - /** - * When an exception is detected during transaction processing, the exception is caught and passed to this method. - * This convenience method is provided so child classes have access to the exception. <br/> - * <b>Override to handle transaction exception</b> - */ - protected void handleTxException(Exception ex) { - // override to add additional code to exception handling - } - - /** - * This convenience method is provided in case child classes have a portion of code that needs to execute always at - * the end of the transaction, regardless of exceptions. <br/> - * <b>Override to add additional code to finally block</b> - * - * @throws OseeCoreException - */ - //OseeCoreException is thrown by inheriting class - protected void handleTxFinally() throws OseeCoreException { - // override to add additional code to finally - } - - private final class InternalTransactionWork implements IDbTransactionWork { - - @Override - public void handleTxException(Exception ex) { - DbTransaction.this.handleTxException(ex); - } - - @Override - public void handleTxFinally() throws OseeCoreException { - DbTransaction.this.handleTxFinally(); - } - - @Override - public void handleTxWork(OseeConnection connection) throws OseeCoreException { - DbTransaction.this.handleTxWork(connection); - } - - @Override - public String getName() { - return DbTransaction.this.getTxName(); - } - }; -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/IJoinAccessor.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/IJoinAccessor.java index 17894d974be..34c1e7645f2 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/IJoinAccessor.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/IJoinAccessor.java @@ -12,18 +12,18 @@ package org.eclipse.osee.framework.skynet.core.utility; import java.util.Collection; import java.util.List; -import org.eclipse.osee.framework.database.core.OseeConnection; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.skynet.core.utility.DatabaseJoinAccessor.JoinItem; +import org.eclipse.osee.jdbc.JdbcConnection; /** * @author Roberto E. Escobar */ public interface IJoinAccessor { - void store(OseeConnection connection, JoinItem joinItem, int queryId, List<Object[]> dataList, Long issuedAt, Long expiresIn) throws OseeCoreException; + void store(JdbcConnection connection, JoinItem joinItem, int queryId, List<Object[]> dataList, Long issuedAt, Long expiresIn) throws OseeCoreException; - int delete(OseeConnection connection, JoinItem joinItem, int queryId) throws OseeCoreException; + int delete(JdbcConnection connection, JoinItem joinItem, int queryId) throws OseeCoreException; - Collection<Integer> getAllQueryIds(OseeConnection connection, JoinItem joinItem) throws OseeCoreException; + Collection<Integer> getAllQueryIds(JdbcConnection connection, JoinItem joinItem) throws OseeCoreException; } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/IdJoinQuery.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/IdJoinQuery.java index 0653839c309..fa727dc7711 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/IdJoinQuery.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/IdJoinQuery.java @@ -10,7 +10,6 @@ *******************************************************************************/ package org.eclipse.osee.framework.skynet.core.utility; -import org.eclipse.osee.framework.skynet.core.utility.AbstractJoinQuery.IJoinRow; import org.eclipse.osee.framework.skynet.core.utility.DatabaseJoinAccessor.JoinItem; /** diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/InvalidTxCurrentsAndModTypes.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/InvalidTxCurrentsAndModTypes.java index 096820f1f9a..09d47221ae8 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/InvalidTxCurrentsAndModTypes.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/InvalidTxCurrentsAndModTypes.java @@ -10,7 +10,6 @@ *******************************************************************************/ package org.eclipse.osee.framework.skynet.core.utility; -import static org.eclipse.osee.framework.database.core.IOseeStatement.MAX_FETCH; import java.util.ArrayList; import java.util.List; import org.eclipse.core.runtime.IProgressMonitor; @@ -20,11 +19,11 @@ import org.eclipse.osee.framework.core.enums.TxChange; import org.eclipse.osee.framework.core.exception.OseeDataStoreException; import org.eclipse.osee.framework.core.operation.AbstractOperation; import org.eclipse.osee.framework.core.operation.OperationLogger; -import org.eclipse.osee.framework.database.IOseeDatabaseService; -import org.eclipse.osee.framework.database.core.IOseeStatement; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.skynet.core.internal.Activator; -import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; +import org.eclipse.osee.jdbc.JdbcClient; +import org.eclipse.osee.jdbc.JdbcConstants; +import org.eclipse.osee.jdbc.JdbcStatement; /** * @author Ryan D. Brooks @@ -46,33 +45,33 @@ public class InvalidTxCurrentsAndModTypes extends AbstractOperation { private final String columnName; private final boolean isFixOperationEnabled; private final String txsTableName; - private final IOseeDatabaseService dbService; + private final JdbcClient jdbcClient; public InvalidTxCurrentsAndModTypes(String operationName, String tableName, String columnName, OperationLogger logger, boolean isFixOperationEnabled, boolean archived) throws OseeDataStoreException { - this(ServiceUtil.getOseeDatabaseService(), operationName, tableName, columnName, logger, isFixOperationEnabled, + this(ConnectionHandler.getJdbcClient(), operationName, tableName, columnName, logger, isFixOperationEnabled, archived); } - public InvalidTxCurrentsAndModTypes(IOseeDatabaseService dbService, String operationName, String tableName, String columnName, OperationLogger logger, boolean isFixOperationEnabled, boolean archived) { + private InvalidTxCurrentsAndModTypes(JdbcClient jdbcClient, String operationName, String tableName, String columnName, OperationLogger logger, boolean isFixOperationEnabled, boolean archived) { super( "InvalidTxCurrentsAndModTypes " + operationName + tableName + " fix:" + isFixOperationEnabled + " archived:" + archived, Activator.PLUGIN_ID, logger); - this.dbService = dbService; + this.jdbcClient = jdbcClient; this.tableName = tableName; this.columnName = columnName; this.isFixOperationEnabled = isFixOperationEnabled; txsTableName = archived ? "_archived" : ""; } - private IOseeDatabaseService getDatabaseService() { - return dbService; + private JdbcClient getJdbcClient() { + return jdbcClient; } private void fixIssues(IProgressMonitor monitor) throws OseeCoreException { if (isFixOperationEnabled) { checkForCancelledStatus(monitor); - getDatabaseService().runBatchUpdate(String.format(DELETE_ADDRESS, txsTableName), purgeData); - getDatabaseService().runBatchUpdate(String.format(UPDATE_ADDRESS, txsTableName), currentData); + getJdbcClient().runBatchUpdate(String.format(DELETE_ADDRESS, txsTableName), purgeData); + getJdbcClient().runBatchUpdate(String.format(UPDATE_ADDRESS, txsTableName), currentData); } monitor.worked(calculateWork(0.1)); } @@ -178,10 +177,10 @@ public class InvalidTxCurrentsAndModTypes extends AbstractOperation { checkForCancelledStatus(monitor); - IOseeStatement chStmt = getDatabaseService().getStatement(); + JdbcStatement chStmt = getJdbcClient().getStatement(); String sql = String.format(SELECT_ADDRESSES, columnName, tableName, txsTableName, columnName); try { - chStmt.runPreparedQuery(MAX_FETCH, sql); + chStmt.runPreparedQuery(JdbcConstants.JDBC__MAX_FETCH_SIZE, sql); monitor.worked(calculateWork(0.40)); Address previousAddress = null; diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/JoinUtility.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/JoinUtility.java index c4c32036232..2c4572d6f95 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/JoinUtility.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/JoinUtility.java @@ -12,9 +12,8 @@ package org.eclipse.osee.framework.skynet.core.utility; import java.util.Random; import org.eclipse.osee.framework.core.exception.OseeDataStoreException; -import org.eclipse.osee.framework.database.IOseeDatabaseService; import org.eclipse.osee.framework.jdk.core.util.Strings; -import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; +import org.eclipse.osee.jdbc.JdbcClient; /** * @author Roberto E. Escobar @@ -38,81 +37,81 @@ public class JoinUtility { return random.nextInt(); } - private static IJoinAccessor createAccessor(IOseeDatabaseService service) { - return new DatabaseJoinAccessor(service); + private static IJoinAccessor createAccessor(JdbcClient jdbcClient) { + return new DatabaseJoinAccessor(jdbcClient); } - public static CharJoinQuery createCharJoinQuery(IOseeDatabaseService service) { - return createCharJoinQuery(service, null); + public static CharJoinQuery createCharJoinQuery(JdbcClient jdbcClient) { + return createCharJoinQuery(jdbcClient, null); } - public static CharJoinQuery createCharJoinQuery(IOseeDatabaseService service, Long expiresIn) { - Long actualExpiration = getExpiresIn(service, expiresIn, EXPIRATION_SECS__CHAR_JOIN_QUERY); - return new CharJoinQuery(createAccessor(service), actualExpiration, getNewQueryId()); + public static CharJoinQuery createCharJoinQuery(JdbcClient jdbcClient, Long expiresIn) { + Long actualExpiration = getExpiresIn(jdbcClient, expiresIn, EXPIRATION_SECS__CHAR_JOIN_QUERY); + return new CharJoinQuery(createAccessor(jdbcClient), actualExpiration, getNewQueryId()); } - public static IdJoinQuery createIdJoinQuery(IOseeDatabaseService service) { - return createIdJoinQuery(service, null); + public static IdJoinQuery createIdJoinQuery(JdbcClient jdbcClient) { + return createIdJoinQuery(jdbcClient, null); } - public static IdJoinQuery createIdJoinQuery(IOseeDatabaseService service, Long expiresIn) { - Long actualExpiration = getExpiresIn(service, expiresIn, EXPIRATION_SECS__ID_JOIN_QUERY); - return new IdJoinQuery(createAccessor(service), actualExpiration, getNewQueryId()); + public static IdJoinQuery createIdJoinQuery(JdbcClient jdbcClient, Long expiresIn) { + Long actualExpiration = getExpiresIn(jdbcClient, expiresIn, EXPIRATION_SECS__ID_JOIN_QUERY); + return new IdJoinQuery(createAccessor(jdbcClient), actualExpiration, getNewQueryId()); } - public static ArtifactJoinQuery createArtifactJoinQuery(IOseeDatabaseService service) { - return createArtifactJoinQuery(service, null); + public static ArtifactJoinQuery createArtifactJoinQuery(JdbcClient jdbcClient) { + return createArtifactJoinQuery(jdbcClient, null); } - public static ArtifactJoinQuery createArtifactJoinQuery(IOseeDatabaseService service, Long expiresIn) { - Long actualExpiration = getExpiresIn(service, expiresIn, EXPIRATION_SECS__ARTIFACT_JOIN_QUERY); - return new ArtifactJoinQuery(createAccessor(service), actualExpiration, getNewQueryId(), - getMaxArtifactJoinSize(service)); + public static ArtifactJoinQuery createArtifactJoinQuery(JdbcClient jdbcClient, Long expiresIn) { + Long actualExpiration = getExpiresIn(jdbcClient, expiresIn, EXPIRATION_SECS__ARTIFACT_JOIN_QUERY); + return new ArtifactJoinQuery(createAccessor(jdbcClient), actualExpiration, getNewQueryId(), + getMaxArtifactJoinSize(jdbcClient)); } - public static TransactionJoinQuery createTransactionJoinQuery(IOseeDatabaseService service) { - return createTransactionJoinQuery(service, null); + public static TransactionJoinQuery createTransactionJoinQuery(JdbcClient jdbcClient) { + return createTransactionJoinQuery(jdbcClient, null); } - public static TransactionJoinQuery createTransactionJoinQuery(IOseeDatabaseService service, Long expiresIn) { - Long actualExpiration = getExpiresIn(service, expiresIn, EXPIRATION_SECS__TX_JOIN_QUERY); - return new TransactionJoinQuery(createAccessor(service), actualExpiration, getNewQueryId()); + public static TransactionJoinQuery createTransactionJoinQuery(JdbcClient jdbcClient, Long expiresIn) { + Long actualExpiration = getExpiresIn(jdbcClient, expiresIn, EXPIRATION_SECS__TX_JOIN_QUERY); + return new TransactionJoinQuery(createAccessor(jdbcClient), actualExpiration, getNewQueryId()); } ////////////////// Static Legacy Calls ///////////////////////// - private static IOseeDatabaseService getDatabase() throws OseeDataStoreException { - return ServiceUtil.getOseeDatabaseService(); + private static JdbcClient getJdbcClient() throws OseeDataStoreException { + return ConnectionHandler.getJdbcClient(); } public static IdJoinQuery createIdJoinQuery() throws OseeDataStoreException { - return createIdJoinQuery(getDatabase()); + return createIdJoinQuery(getJdbcClient()); } public static ArtifactJoinQuery createArtifactJoinQuery() { - IOseeDatabaseService service = getDatabase(); - return createArtifactJoinQuery(service); + JdbcClient jdbcClient = getJdbcClient(); + return createArtifactJoinQuery(jdbcClient); } public static TransactionJoinQuery createTransactionJoinQuery() { - IOseeDatabaseService service = getDatabase(); - return createTransactionJoinQuery(service); + JdbcClient jdbcClient = getJdbcClient(); + return createTransactionJoinQuery(jdbcClient); } - private static int getMaxArtifactJoinSize(IOseeDatabaseService service) { + private static int getMaxArtifactJoinSize(JdbcClient jdbcClient) { int toReturn = Integer.MAX_VALUE; - String maxSize = OseeInfo.getValue(service, "artifact.join.max.size"); + String maxSize = OseeInfo.getValue(jdbcClient, "artifact.join.max.size"); if (Strings.isNumeric(maxSize)) { toReturn = Integer.parseInt(maxSize); } return toReturn; } - private static Long getExpiresIn(IOseeDatabaseService service, Long actual, String defaultKey) { + private static Long getExpiresIn(JdbcClient jdbcClient, Long actual, String defaultKey) { Long toReturn = DEFAULT_JOIN_EXPIRATION_SECONDS; if (actual != null) { toReturn = actual; } else { - String expiration = OseeInfo.getValue(service, defaultKey); + String expiration = OseeInfo.getValue(jdbcClient, defaultKey); if (Strings.isNumeric(expiration)) { toReturn = Long.parseLong(expiration); } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/OseeInfo.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/OseeInfo.java index 3366ec9fa06..8b97ba63124 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/OseeInfo.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/OseeInfo.java @@ -12,10 +12,9 @@ package org.eclipse.osee.framework.skynet.core.utility; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import org.eclipse.osee.framework.database.IOseeDatabaseService; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.type.Pair; -import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; +import org.eclipse.osee.jdbc.JdbcClient; /** * @author Donald G. Dunne @@ -37,18 +36,18 @@ public class OseeInfo { } public static String getValue(String key, Long maxStaleness) throws OseeCoreException { - return getValue(ServiceUtil.getOseeDatabaseService(), key, maxStaleness); + return getValue(ConnectionHandler.getJdbcClient(), key, maxStaleness); } - public static String getValue(IOseeDatabaseService service, String key) { - return getValue(service, key, (long) Integer.MAX_VALUE); + public static String getValue(JdbcClient jdbcClient, String key) { + return getValue(jdbcClient, key, (long) Integer.MAX_VALUE); } - public static String getValue(IOseeDatabaseService service, String key, Long maxStaleness) { + public static String getValue(JdbcClient jdbcClient, String key, Long maxStaleness) { Pair<Long, String> pair = cache.get(key); String value; if (pair == null || pair.getFirst() + maxStaleness < System.currentTimeMillis()) { - value = service.runPreparedQueryFetchObject("", GET_VALUE_SQL, key); + value = jdbcClient.runPreparedQueryFetchObject("", GET_VALUE_SQL, key); cacheValue(key, value); } else { value = pair.getSecond(); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/PurgeTransactionOperation.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/PurgeTransactionOperation.java index 154eb765ceb..e8ab7bf0f2a 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/PurgeTransactionOperation.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/PurgeTransactionOperation.java @@ -11,7 +11,6 @@ package org.eclipse.osee.framework.skynet.core.utility; -import static org.eclipse.osee.framework.database.core.IOseeStatement.MAX_FETCH; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -28,13 +27,14 @@ import org.eclipse.osee.framework.core.model.TransactionRecord; import org.eclipse.osee.framework.core.model.cache.BranchCache; import org.eclipse.osee.framework.core.operation.NullOperationLogger; import org.eclipse.osee.framework.core.operation.OperationLogger; -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.OseeArgumentException; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.Conditions; import org.eclipse.osee.framework.skynet.core.internal.Activator; +import org.eclipse.osee.jdbc.JdbcClient; +import org.eclipse.osee.jdbc.JdbcConnection; +import org.eclipse.osee.jdbc.JdbcConstants; +import org.eclipse.osee.jdbc.JdbcStatement; /** * @author Ryan D. Brooks @@ -67,15 +67,15 @@ public class PurgeTransactionOperation extends AbstractDbTxOperation { private final Set<PurgeTransactionListener> listeners = new CopyOnWriteArraySet<PurgeTransactionListener>(); private Collection<TransactionRecord> changedTransactions = new ArrayList<TransactionRecord>(); - public PurgeTransactionOperation(IOseeDatabaseService databaseService, BranchCache branchCache, OperationLogger logger, List<Integer> txIdsToDelete) { - super(databaseService, "Purge transactions " + txIdsToDelete, Activator.PLUGIN_ID, logger); + public PurgeTransactionOperation(JdbcClient jdbcClient, BranchCache branchCache, OperationLogger logger, List<Integer> txIdsToDelete) { + super(jdbcClient, "Purge transactions " + txIdsToDelete, Activator.PLUGIN_ID, logger); this.success = false; this.branchCache = branchCache; this.txIdsToDelete = txIdsToDelete; } - public PurgeTransactionOperation(IOseeDatabaseService databaseService, BranchCache branchCache, List<Integer> txIdsToDelete) { - this(databaseService, branchCache, NullOperationLogger.getSingleton(), txIdsToDelete); + public PurgeTransactionOperation(JdbcClient jdbcClient, BranchCache branchCache, List<Integer> txIdsToDelete) { + this(jdbcClient, branchCache, NullOperationLogger.getSingleton(), txIdsToDelete); } public void addListener(PurgeTransactionListener listener) { @@ -91,7 +91,7 @@ public class PurgeTransactionOperation extends AbstractDbTxOperation { } @Override - protected void doTxWork(IProgressMonitor monitor, OseeConnection connection) throws OseeCoreException { + protected void doTxWork(IProgressMonitor monitor, JdbcConnection connection) throws OseeCoreException { log(); monitor.beginTask("Purge Transaction(s)", txIdsToDelete.size() * 5); @@ -127,8 +127,8 @@ public class PurgeTransactionOperation extends AbstractDbTxOperation { monitor.worked(1); monitor.subTask("Remove Tx Rows"); - getDatabaseService().runBatchUpdate(connection, DELETE_TX_DETAILS, txsToDelete); - getDatabaseService().runBatchUpdate(connection, DELETE_TXS, txsToDelete); + getJdbcClient().runBatchUpdate(connection, DELETE_TX_DETAILS, txsToDelete); + getJdbcClient().runBatchUpdate(connection, DELETE_TXS, txsToDelete); monitor.worked(1); monitor.subTask("Updating Previous Tx to Current"); @@ -136,7 +136,7 @@ public class PurgeTransactionOperation extends AbstractDbTxOperation { computeNewTxCurrents(connection, updateData, "art_id", "osee_artifact", arts); computeNewTxCurrents(connection, updateData, "attr_id", "osee_attribute", attrs); computeNewTxCurrents(connection, updateData, "rel_link_id", "osee_relation_link", rels); - getDatabaseService().runBatchUpdate(connection, UPDATE_TX_CURRENT, updateData); + getJdbcClient().runBatchUpdate(connection, UPDATE_TX_CURRENT, updateData); monitor.worked(1); } monitor.done(); @@ -155,16 +155,16 @@ public class PurgeTransactionOperation extends AbstractDbTxOperation { changedTransactions = null; } - private void computeNewTxCurrents(OseeConnection connection, Collection<Object[]> updateData, String itemId, String tableName, Map<Long, IdJoinQuery> affected) throws OseeCoreException { + private void computeNewTxCurrents(JdbcConnection connection, Collection<Object[]> updateData, String itemId, String tableName, Map<Long, IdJoinQuery> affected) throws OseeCoreException { String query = String.format(FIND_NEW_TX_CURRENTS, tableName, itemId); for (Entry<Long, IdJoinQuery> entry : affected.entrySet()) { Long branchUuid = entry.getKey(); IdJoinQuery joinQuery = entry.getValue(); - IOseeStatement statement = getDatabaseService().getStatement(connection); + JdbcStatement statement = getJdbcClient().getStatement(connection); try { - statement.runPreparedQuery(MAX_FETCH, query, joinQuery.getQueryId(), branchUuid); + statement.runPreparedQuery(JdbcConstants.JDBC__MAX_FETCH_SIZE, query, joinQuery.getQueryId(), branchUuid); int previousItem = -1; while (statement.next()) { int currentItem = statement.getInt("item_id"); @@ -187,16 +187,16 @@ public class PurgeTransactionOperation extends AbstractDbTxOperation { } } - private Map<Long, IdJoinQuery> findAffectedItems(OseeConnection connection, String itemId, String itemTable, List<Object[]> bindDataList) throws OseeCoreException { + private Map<Long, IdJoinQuery> findAffectedItems(JdbcConnection connection, String itemId, String itemTable, List<Object[]> bindDataList) throws OseeCoreException { Map<Long, IdJoinQuery> items = new HashMap<Long, IdJoinQuery>(); - IOseeStatement statement = getDatabaseService().getStatement(connection); + JdbcStatement statement = getJdbcClient().getStatement(connection); try { for (Object[] bindData : bindDataList) { Long branchUuid = (Long) bindData[0]; String query = String.format(SELECT_AFFECTED_ITEMS, itemId, itemTable); - statement.runPreparedQuery(MAX_FETCH, query, bindData); - IdJoinQuery joinId = JoinUtility.createIdJoinQuery(getDatabaseService()); + statement.runPreparedQuery(JdbcConstants.JDBC__MAX_FETCH_SIZE, query, bindData); + IdJoinQuery joinId = JoinUtility.createIdJoinQuery(getJdbcClient()); items.put(branchUuid, joinId); while (statement.next()) { @@ -225,7 +225,7 @@ public class PurgeTransactionOperation extends AbstractDbTxOperation { return previousTransaction; } - private void setChildBranchBaselineTxs(OseeConnection connection, TransactionRecord toDeleteTransaction, TransactionRecord previousTransaction) throws OseeCoreException { + private void setChildBranchBaselineTxs(JdbcConnection connection, TransactionRecord toDeleteTransaction, TransactionRecord previousTransaction) throws OseeCoreException { List<Object[]> data = new ArrayList<Object[]>(); if (previousTransaction != null) { int toDeleteTransactionId = toDeleteTransaction.getId(); @@ -236,7 +236,7 @@ public class PurgeTransactionOperation extends AbstractDbTxOperation { "%" + toDeleteTransactionId}); } if (!data.isEmpty()) { - getDatabaseService().runBatchUpdate(connection, UPDATE_TXS_DETAILS_COMMENT, data); + getJdbcClient().runBatchUpdate(connection, UPDATE_TXS_DETAILS_COMMENT, data); } } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/PurgeTransactionOperationWithListener.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/PurgeTransactionOperationWithListener.java index ab6abe440a9..de5c79d616b 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/PurgeTransactionOperationWithListener.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/PurgeTransactionOperationWithListener.java @@ -43,7 +43,7 @@ public class PurgeTransactionOperationWithListener { public static IOperation getPurgeTransactionOperationById(List<Integer> txIdsToDelete) throws OseeCoreException { final PurgeTransactionOperation op = - new PurgeTransactionOperation(ServiceUtil.getOseeDatabaseService(), + new PurgeTransactionOperation(ConnectionHandler.getJdbcClient(), ServiceUtil.getOseeCacheService().getBranchCache(), txIdsToDelete); PurgeTransactionListener listener = new PurgeTransactionListener() { diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/PurgeUnusedBackingDataAndTransactions.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/PurgeUnusedBackingDataAndTransactions.java index c179834b2e5..d1f33eb4de8 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/PurgeUnusedBackingDataAndTransactions.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/PurgeUnusedBackingDataAndTransactions.java @@ -15,12 +15,11 @@ import java.util.List; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.osee.framework.core.exception.OseeDataStoreException; import org.eclipse.osee.framework.core.operation.OperationLogger; -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.OseeCoreException; import org.eclipse.osee.framework.skynet.core.internal.Activator; -import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; +import org.eclipse.osee.jdbc.JdbcClient; +import org.eclipse.osee.jdbc.JdbcConnection; +import org.eclipse.osee.jdbc.JdbcStatement; /** * Purge artifact, attribute, and relation versions that are not addressed or nonexistent and purge empty transactions @@ -45,17 +44,17 @@ public class PurgeUnusedBackingDataAndTransactions extends AbstractDbTxOperation "DELETE FROM osee_tx_details WHERE branch_id = ? and transaction_id = ?"; public PurgeUnusedBackingDataAndTransactions(OperationLogger logger) throws OseeDataStoreException { - this(ServiceUtil.getOseeDatabaseService(), logger); + this(ConnectionHandler.getJdbcClient(), logger); } - public PurgeUnusedBackingDataAndTransactions(IOseeDatabaseService dbService, OperationLogger logger) { - super(dbService, "Data with no TXS Addressing and empty transactions", Activator.PLUGIN_ID, logger); + private PurgeUnusedBackingDataAndTransactions(JdbcClient jdbcClient, OperationLogger logger) { + super(jdbcClient, "Data with no TXS Addressing and empty transactions", Activator.PLUGIN_ID, logger); } - private void processNotAddressedGammas(OseeConnection connection, String tableName) throws OseeCoreException { + private void processNotAddressedGammas(JdbcConnection connection, String tableName) throws OseeCoreException { List<Object[]> notAddressedGammas = new LinkedList<Object[]>(); - IOseeStatement chStmt = getDatabaseService().getStatement(connection); + JdbcStatement chStmt = getJdbcClient().getStatement(connection); try { String sql = String.format(NOT_ADDRESSESED_GAMMAS, tableName); chStmt.runPreparedQuery(sql); @@ -68,14 +67,14 @@ public class PurgeUnusedBackingDataAndTransactions extends AbstractDbTxOperation } if (!notAddressedGammas.isEmpty()) { - getDatabaseService().runBatchUpdate(connection, String.format(DELETE_GAMMAS, tableName), notAddressedGammas); + getJdbcClient().runBatchUpdate(connection, String.format(DELETE_GAMMAS, tableName), notAddressedGammas); } } - private void processAddressedButNonexistentGammas(OseeConnection connection, String tableName) throws OseeCoreException { + private void processAddressedButNonexistentGammas(JdbcConnection connection, String tableName) throws OseeCoreException { List<Object[]> nonexistentGammas = new LinkedList<Object[]>(); - IOseeStatement chStmt = getDatabaseService().getStatement(connection); + JdbcStatement chStmt = getJdbcClient().getStatement(connection); try { String sql = String.format(NONEXISTENT_GAMMAS, tableName); @@ -89,14 +88,14 @@ public class PurgeUnusedBackingDataAndTransactions extends AbstractDbTxOperation } if (!nonexistentGammas.isEmpty()) { - getDatabaseService().runBatchUpdate(connection, String.format(DELETE_GAMMAS, tableName), nonexistentGammas); + getJdbcClient().runBatchUpdate(connection, String.format(DELETE_GAMMAS, tableName), nonexistentGammas); } } - private void processEmptyTransactions(OseeConnection connection) throws OseeCoreException { + private void processEmptyTransactions(JdbcConnection connection) throws OseeCoreException { List<Object[]> emptyTransactions = new LinkedList<Object[]>(); - IOseeStatement chStmt = getDatabaseService().getStatement(connection); + JdbcStatement chStmt = getJdbcClient().getStatement(connection); try { chStmt.runPreparedQuery(EMPTY_TRANSACTIONS); while (chStmt.next()) { @@ -108,12 +107,12 @@ public class PurgeUnusedBackingDataAndTransactions extends AbstractDbTxOperation } if (!emptyTransactions.isEmpty()) { - getDatabaseService().runBatchUpdate(connection, DELETE_EMPTY_TRANSACTIONS, emptyTransactions); + getJdbcClient().runBatchUpdate(connection, DELETE_EMPTY_TRANSACTIONS, emptyTransactions); } } @Override - protected void doTxWork(IProgressMonitor monitor, OseeConnection connection) throws OseeCoreException { + protected void doTxWork(IProgressMonitor monitor, JdbcConnection connection) throws OseeCoreException { processNotAddressedGammas(connection, "osee_attribute"); processNotAddressedGammas(connection, "osee_artifact"); processNotAddressedGammas(connection, "osee_relation_link"); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/TransactionJoinQuery.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/TransactionJoinQuery.java index 13f61b23b2c..0ac477f2da8 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/TransactionJoinQuery.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/TransactionJoinQuery.java @@ -10,9 +10,8 @@ *******************************************************************************/ package org.eclipse.osee.framework.skynet.core.utility; -import org.eclipse.osee.framework.database.core.SQL3DataType; -import org.eclipse.osee.framework.skynet.core.utility.AbstractJoinQuery.IJoinRow; import org.eclipse.osee.framework.skynet.core.utility.DatabaseJoinAccessor.JoinItem; +import org.eclipse.osee.jdbc.SQL3DataType; /** * @author Roberto E. Escobar diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/word/WordUtil.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/word/WordUtil.java index 99e6bec8275..cd00a798ce6 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/word/WordUtil.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/word/WordUtil.java @@ -28,7 +28,6 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import org.eclipse.osee.framework.core.enums.CoreAttributeTypes; import org.eclipse.osee.framework.core.model.Branch; -import org.eclipse.osee.framework.database.core.IOseeStatement; import org.eclipse.osee.framework.jdk.core.text.change.ChangeSet; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.type.Pair; @@ -39,6 +38,7 @@ import org.eclipse.osee.framework.jdk.core.util.io.Streams; import org.eclipse.osee.framework.jdk.core.util.xml.Xml; import org.eclipse.osee.framework.skynet.core.artifact.Artifact; import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; +import org.eclipse.osee.jdbc.JdbcStatement; /** * Provides utility methods for parsing wordML. @@ -127,7 +127,7 @@ public class WordUtil { throw new IllegalArgumentException("branch can not be null"); } - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { chStmt.runPreparedQuery(SELECT_WORD_VALUES, artId, CoreAttributeTypes.WordTemplateContent.getGuid(), branch.getUuid()); diff --git a/plugins/org.eclipse.osee.framework.ui.branch.graph/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.ui.branch.graph/META-INF/MANIFEST.MF index 281b7347ab9..f867642dd75 100644 --- a/plugins/org.eclipse.osee.framework.ui.branch.graph/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.framework.ui.branch.graph/META-INF/MANIFEST.MF @@ -19,10 +19,10 @@ Import-Package: 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.database.core, org.eclipse.osee.framework.jdk.core.type, org.eclipse.osee.framework.jdk.core.util, org.eclipse.osee.framework.logging, - org.eclipse.osee.framework.ui.swt + org.eclipse.osee.framework.ui.swt, + org.eclipse.osee.jdbc Bundle-Activator: org.eclipse.osee.framework.ui.branch.graph.Activator Bundle-ActivationPolicy: lazy diff --git a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/GraphLoader.java b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/GraphLoader.java index 3f1ff8998ab..c2e5910c69f 100644 --- a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/GraphLoader.java +++ b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/GraphLoader.java @@ -14,7 +14,6 @@ import java.util.ArrayList; import java.util.List; import java.util.logging.Level; import org.eclipse.osee.framework.core.model.Branch; -import org.eclipse.osee.framework.database.core.IOseeStatement; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.logging.OseeLog; import org.eclipse.osee.framework.skynet.core.artifact.BranchManager; @@ -23,6 +22,7 @@ import org.eclipse.osee.framework.skynet.core.utility.IdJoinQuery; import org.eclipse.osee.framework.skynet.core.utility.JoinUtility; import org.eclipse.osee.framework.ui.branch.graph.Activator; import org.eclipse.osee.framework.ui.branch.graph.operation.IProgressListener; +import org.eclipse.osee.jdbc.JdbcStatement; /** * @author Roberto E. Escobar @@ -142,7 +142,7 @@ public class GraphLoader { private static List<TxData> getTxData(int queryId) throws OseeCoreException { List<TxData> txDatas = new ArrayList<TxData>(); - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { chStmt.runPreparedQuery(GET_TRANSACTION_DATA, queryId); while (chStmt.next()) { diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.ui.data.model.editor/META-INF/MANIFEST.MF index 38938636fc7..f2f1d64006f 100644 --- a/plugins/org.eclipse.osee.framework.ui.data.model.editor/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/META-INF/MANIFEST.MF @@ -23,7 +23,6 @@ Import-Package: org.eclipse.osee.framework.core.client, org.eclipse.osee.framework.core.exception, org.eclipse.osee.framework.core.model, org.eclipse.osee.framework.core.model.type, - org.eclipse.osee.framework.database.core, org.eclipse.osee.framework.jdk.core.type, org.eclipse.osee.framework.jdk.core.util, org.eclipse.osee.framework.jdk.core.util.io.xml, @@ -40,4 +39,5 @@ Import-Package: org.eclipse.osee.framework.core.client, org.eclipse.osee.framework.ui.plugin, org.eclipse.osee.framework.ui.plugin.util, org.eclipse.osee.framework.ui.plugin.views.property, - org.eclipse.osee.framework.ui.swt + org.eclipse.osee.framework.ui.swt, + org.eclipse.osee.jdbc diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/wizard/ODMExportOutputPage.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/wizard/ODMExportOutputPage.java index b4a828c271a..cc654a59563 100644 --- a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/wizard/ODMExportOutputPage.java +++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/wizard/ODMExportOutputPage.java @@ -20,6 +20,8 @@ import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; import org.eclipse.osee.framework.ui.data.model.editor.internal.Activator; import org.eclipse.osee.framework.ui.data.model.editor.wizard.FileOrFolderSelectPanel.ButtonType; import org.eclipse.osee.framework.ui.swt.StackedViewer; +import org.eclipse.osee.jdbc.JdbcClient; +import org.eclipse.osee.jdbc.JdbcConnection; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; @@ -192,8 +194,11 @@ public class ODMExportOutputPage extends WizardPage { private Button createDataStoreButton(Composite parent) { Button dataStoreButton = new Button(parent, SWT.CHECK); String message = null; + + JdbcClient jdbcClient = ConnectionHandler.getJdbcClient(); + JdbcConnection connection = jdbcClient.getConnection(); try { - DatabaseMetaData meta = ConnectionHandler.getMetaData(); + DatabaseMetaData meta = connection.getMetaData(); String product = meta.getDatabaseProductName(); int majorVersion = meta.getDatabaseMajorVersion(); int minorVersion = meta.getDatabaseMinorVersion(); @@ -204,6 +209,8 @@ public class ODMExportOutputPage extends WizardPage { } catch (Exception ex) { OseeLog.log(Activator.class, Level.WARNING, ex); message = "Data Store"; + } finally { + connection.close(); } dataStoreButton.setText(String.format("%s", message)); return dataStoreButton; diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/wizard/ODMImportPage.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/wizard/ODMImportPage.java index 3ba882d9c45..de887e5582f 100644 --- a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/wizard/ODMImportPage.java +++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/wizard/ODMImportPage.java @@ -19,6 +19,8 @@ import org.eclipse.osee.framework.logging.OseeLog; import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; import org.eclipse.osee.framework.ui.data.model.editor.internal.Activator; import org.eclipse.osee.framework.ui.swt.StackedViewer; +import org.eclipse.osee.jdbc.JdbcClient; +import org.eclipse.osee.jdbc.JdbcConnection; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; @@ -123,8 +125,11 @@ public class ODMImportPage extends WizardPage { private Button createDataStoreButton(Composite parent) { Button dataStoreButton = new Button(parent, SWT.CHECK); String message = null; + + JdbcClient jdbcClient = ConnectionHandler.getJdbcClient(); + JdbcConnection connection = jdbcClient.getConnection(); try { - DatabaseMetaData meta = ConnectionHandler.getMetaData(); + DatabaseMetaData meta = connection.getMetaData(); String product = meta.getDatabaseProductName(); int majorVersion = meta.getDatabaseMajorVersion(); int minorVersion = meta.getDatabaseMinorVersion(); @@ -135,6 +140,8 @@ public class ODMImportPage extends WizardPage { } catch (Exception ex) { OseeLog.log(Activator.class, Level.WARNING, ex); message = "Data Store"; + } finally { + connection.close(); } dataStoreButton.setText(String.format("%s", message)); return dataStoreButton; diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF index 45bb03f365d..9332cafd19f 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF @@ -91,8 +91,6 @@ Import-Package: com.google.common.base;version="[11.0.0,15.0.0)", org.eclipse.osee.framework.core.ops, org.eclipse.osee.framework.core.services, org.eclipse.osee.framework.core.util, - org.eclipse.osee.framework.database, - org.eclipse.osee.framework.database.core, org.eclipse.osee.framework.help.ui, org.eclipse.osee.framework.jdk.core.text.change, org.eclipse.osee.framework.jdk.core.type, @@ -137,6 +135,7 @@ Import-Package: com.google.common.base;version="[11.0.0,15.0.0)", org.eclipse.osee.framework.ui.swt.styledText, org.eclipse.osee.framework.ui.ws, org.eclipse.osee.jaxrs.client, + org.eclipse.osee.jdbc, org.eclipse.osee.orcs.rest.client, org.eclipse.search.ui, org.eclipse.search.ui.text, diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/action/WasIsCompareEditorAction.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/action/WasIsCompareEditorAction.java index a1b080587fa..179b3a0f1fb 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/action/WasIsCompareEditorAction.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/action/WasIsCompareEditorAction.java @@ -21,7 +21,6 @@ import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.osee.framework.core.client.OseeClientProperties; import org.eclipse.osee.framework.core.model.TransactionRecord; -import org.eclipse.osee.framework.database.core.IOseeStatement; import org.eclipse.osee.framework.jdk.core.util.Strings; import org.eclipse.osee.framework.logging.OseeLevel; import org.eclipse.osee.framework.logging.OseeLog; @@ -37,6 +36,7 @@ import org.eclipse.osee.framework.ui.skynet.compare.CompareItem; import org.eclipse.osee.framework.ui.swt.ImageManager; import org.eclipse.osee.jaxrs.client.JaxRsClient; import org.eclipse.osee.jaxrs.client.JaxRsExceptions; +import org.eclipse.osee.jdbc.JdbcStatement; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchPart; @@ -108,7 +108,7 @@ public class WasIsCompareEditorAction extends Action { private Integer getPreviousTransaction(long branchUuid, int attrId, int transactionId) { Integer previousTransaction = 0; boolean found = false; - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { chStmt.runPreparedQuery(ATTRIBUTE_TRANSACTIONS_QUERY_DESC, attrId, branchUuid); while (chStmt.next()) { diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/CreateBranchGuidToUuidArtifactBlam.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/CreateBranchGuidToUuidArtifactBlam.java index 6b929f43861..56cb409a6f0 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/CreateBranchGuidToUuidArtifactBlam.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/CreateBranchGuidToUuidArtifactBlam.java @@ -16,11 +16,11 @@ import org.eclipse.core.runtime.IProgressMonitor; 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.database.core.IOseeStatement; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.skynet.core.artifact.Artifact; import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery; import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; +import org.eclipse.osee.jdbc.JdbcStatement; /** * @author John Misinco @@ -46,7 +46,7 @@ public class CreateBranchGuidToUuidArtifactBlam extends AbstractBlam { @Override public void runOperation(VariableMap variableMap, IProgressMonitor monitor) throws Exception { - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); StringBuilder sb = new StringBuilder(); try { chStmt.runPreparedQuery("select branch_guid, branch_id from osee_branch"); diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/FixTemplateContentArtifacts.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/FixTemplateContentArtifacts.java index 68d4f8da9e1..e37e330ff10 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/FixTemplateContentArtifacts.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/FixTemplateContentArtifacts.java @@ -36,7 +36,6 @@ import org.eclipse.osee.framework.core.exception.OseeExceptions; import org.eclipse.osee.framework.core.model.Branch; import org.eclipse.osee.framework.core.util.HttpProcessor; import org.eclipse.osee.framework.core.util.HttpProcessor.AcquireResult; -import org.eclipse.osee.framework.database.core.IOseeStatement; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.Lib; import org.eclipse.osee.framework.jdk.core.util.Strings; @@ -49,6 +48,7 @@ import org.eclipse.osee.framework.ui.skynet.internal.Activator; import org.eclipse.osee.framework.ui.skynet.widgets.XModifiedListener; import org.eclipse.osee.framework.ui.skynet.widgets.XWidget; import org.eclipse.osee.framework.ui.skynet.widgets.util.SwtXWidgetRenderer; +import org.eclipse.osee.jdbc.JdbcStatement; import org.eclipse.ui.forms.widgets.FormToolkit; import org.w3c.dom.Element; @@ -91,7 +91,7 @@ public class FixTemplateContentArtifacts extends AbstractBlam { @Override public void runOperation(VariableMap variableMap, IProgressMonitor monitor) throws Exception { - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { monitor.setTaskName("Performing query"); diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/AbstractWordAttributeHealthOperation.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/AbstractWordAttributeHealthOperation.java index 7b49998ea0f..b863262ec0d 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/AbstractWordAttributeHealthOperation.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/AbstractWordAttributeHealthOperation.java @@ -35,7 +35,6 @@ import org.eclipse.osee.framework.core.operation.AbstractOperation; import org.eclipse.osee.framework.core.operation.IOperation; import org.eclipse.osee.framework.core.util.HttpProcessor; import org.eclipse.osee.framework.core.util.HttpProcessor.AcquireResult; -import org.eclipse.osee.framework.database.core.IOseeStatement; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.AHTML; import org.eclipse.osee.framework.jdk.core.util.Lib; @@ -43,6 +42,7 @@ import org.eclipse.osee.framework.jdk.core.util.Strings; import org.eclipse.osee.framework.plugin.core.util.OseeData; import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; import org.eclipse.osee.framework.ui.skynet.internal.Activator; +import org.eclipse.osee.jdbc.JdbcStatement; /** * @author Roberto E. Escobar @@ -154,7 +154,7 @@ public abstract class AbstractWordAttributeHealthOperation extends DatabaseHealt private List<AttrData> loadAttributeData(IProgressMonitor monitor, IAttributeType attributeType) throws OseeCoreException { List<AttrData> attrData = new ArrayList<AttrData>(); - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { chStmt.runPreparedQuery(GET_ATTRS, attributeType.getGuid()); while (chStmt.next()) { diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/ArtifactIdWithoutVersionsCheck.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/ArtifactIdWithoutVersionsCheck.java index f4bb1b685c7..b0167735cab 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/ArtifactIdWithoutVersionsCheck.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/ArtifactIdWithoutVersionsCheck.java @@ -16,10 +16,10 @@ import java.util.HashSet; import java.util.List; import java.util.Set; import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.osee.framework.database.core.IOseeStatement; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.AHTML; import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; +import org.eclipse.osee.jdbc.JdbcStatement; /** * @author Roberto E. Escobar @@ -97,7 +97,7 @@ public class ArtifactIdWithoutVersionsCheck extends DatabaseHealthOperation { private Set<Integer> getInvalidEntries(IProgressMonitor monitor, Set<Integer> allInvalidArtIds, String query, boolean hasItemId) throws OseeCoreException { Set<Integer> toReturn = new HashSet<Integer>(); - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { chStmt.runPreparedQuery(query); while (chStmt.next()) { diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/AttributeBackingDataCheck.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/AttributeBackingDataCheck.java index 638045e93f8..e09af69112c 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/AttributeBackingDataCheck.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/AttributeBackingDataCheck.java @@ -23,12 +23,12 @@ import org.eclipse.osee.framework.core.client.server.HttpUrlBuilderClient; import org.eclipse.osee.framework.core.data.OseeServerContext; import org.eclipse.osee.framework.core.util.HttpProcessor; import org.eclipse.osee.framework.core.util.HttpProcessor.AcquireResult; -import org.eclipse.osee.framework.database.core.IOseeStatement; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.AHTML; import org.eclipse.osee.framework.jdk.core.util.Lib; import org.eclipse.osee.framework.jdk.core.util.Strings; import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; +import org.eclipse.osee.jdbc.JdbcStatement; /** * @author Roberto E. Escobar @@ -77,7 +77,7 @@ public class AttributeBackingDataCheck extends DatabaseHealthOperation { private List<AttrData> getInvalidAttributeData(SubMonitor subMonitor) throws OseeCoreException { List<AttrData> data = new ArrayList<AttrData>(); - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { chStmt.runPreparedQuery(READ_VALID_ATTRIBUTES); while (chStmt.next()) { diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/AuthorIdCheck.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/AuthorIdCheck.java index a8e5ab26073..c3194b89b93 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/AuthorIdCheck.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/AuthorIdCheck.java @@ -15,7 +15,6 @@ import java.util.Set; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.osee.framework.core.enums.SystemUser; import org.eclipse.osee.framework.core.util.XResultData; -import org.eclipse.osee.framework.database.core.IOseeStatement; import org.eclipse.osee.framework.jdk.core.util.AHTML; import org.eclipse.osee.framework.skynet.core.UserManager; import org.eclipse.osee.framework.skynet.core.artifact.Artifact; @@ -23,6 +22,7 @@ import org.eclipse.osee.framework.skynet.core.artifact.BranchManager; import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery; import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; import org.eclipse.osee.framework.ui.skynet.results.XResultDataUI; +import org.eclipse.osee.jdbc.JdbcStatement; /** * @author Donald G. Dunne @@ -55,7 +55,7 @@ public class AuthorIdCheck extends DatabaseHealthOperation { rd.addRaw(AHTML.addHeaderRowMultiColumnTable(columnHeaders)); Set<Integer> authors = new HashSet<Integer>(); - IOseeStatement chStmt1 = ConnectionHandler.getStatement(); + JdbcStatement chStmt1 = ConnectionHandler.getStatement(); try { chStmt1.runPreparedQuery(GET_AUTHOR_IDS); while (chStmt1.next()) { diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/BranchStateHealthCheck.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/BranchStateHealthCheck.java index 8fbfa79a6a7..6d9590aab58 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/BranchStateHealthCheck.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/BranchStateHealthCheck.java @@ -20,11 +20,11 @@ import java.util.Map; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.osee.framework.core.enums.BranchState; import org.eclipse.osee.framework.core.enums.BranchType; -import org.eclipse.osee.framework.database.core.IOseeStatement; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.AHTML; import org.eclipse.osee.framework.jdk.core.util.Strings; import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; +import org.eclipse.osee.jdbc.JdbcStatement; /** * @author Roberto E. Escobar @@ -169,7 +169,7 @@ public class BranchStateHealthCheck extends DatabaseHealthOperation { private Collection<BranchData> getAllBranchData() throws OseeCoreException { Map<Long, BranchData> data = new HashMap<Long, BranchData>(); - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { chStmt.runPreparedQuery("select * from osee_branch"); while (chStmt.next()) { diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/CommitTransactions.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/CommitTransactions.java index 66270240144..fb234f8b1c3 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/CommitTransactions.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/CommitTransactions.java @@ -11,9 +11,9 @@ package org.eclipse.osee.framework.ui.skynet.dbHealth; import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.osee.framework.database.core.IOseeStatement; import org.eclipse.osee.framework.jdk.core.util.Strings; import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; +import org.eclipse.osee.jdbc.JdbcStatement; /** * Updates commit transactions so new and then modified objects will be committed with a mod type of new. This BLAM @@ -44,7 +44,7 @@ public class CommitTransactions extends DatabaseHealthOperation { if (isFixOperationEnabled()) { checkForCancelledStatus(monitor); - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { chStmt.runPreparedQuery(GET_COMMIT_TRANSACTIONS, new Object[0]); diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/ItemsDeletedWithNoOtherModification.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/ItemsDeletedWithNoOtherModification.java index 44358c9ff56..f3c294d4439 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/ItemsDeletedWithNoOtherModification.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/ItemsDeletedWithNoOtherModification.java @@ -20,12 +20,12 @@ import org.eclipse.osee.framework.core.enums.BranchType; import org.eclipse.osee.framework.core.enums.ModificationType; import org.eclipse.osee.framework.core.enums.TxChange; import org.eclipse.osee.framework.core.util.XResultData; -import org.eclipse.osee.framework.database.core.IOseeStatement; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.AHTML; import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; import org.eclipse.osee.framework.ui.skynet.results.XResultDataUI; import org.eclipse.osee.framework.ui.skynet.results.html.XResultPage.Manipulations; +import org.eclipse.osee.jdbc.JdbcStatement; /** * @author Theron Virgin @@ -74,7 +74,7 @@ public class ItemsDeletedWithNoOtherModification extends DatabaseHealthOperation } private void loadData(String sql, TxChange txChange, ModificationType modificationType) throws OseeCoreException { - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { chStmt.runPreparedQuery(sql, txChange.getValue(), modificationType.getValue(), modificationType.getValue()); while (chStmt.next()) { diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/RelationIntegrityCheck.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/RelationIntegrityCheck.java index 9a8d9f00957..01d8e6af629 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/RelationIntegrityCheck.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/RelationIntegrityCheck.java @@ -19,13 +19,13 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.osee.framework.core.enums.ModificationType; import org.eclipse.osee.framework.core.enums.TxChange; import org.eclipse.osee.framework.core.util.XResultData; -import org.eclipse.osee.framework.database.core.IOseeStatement; import org.eclipse.osee.framework.jdk.core.type.DoubleKeyHashMap; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.AHTML; import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; import org.eclipse.osee.framework.ui.skynet.results.XResultDataUI; import org.eclipse.osee.framework.ui.skynet.results.html.XResultPage.Manipulations; +import org.eclipse.osee.jdbc.JdbcStatement; /** * {@link RelationIntegrityCheckTest } @@ -308,7 +308,7 @@ public class RelationIntegrityCheck extends DatabaseHealthOperation { private void loadData(String description, String sql, boolean forDelete) throws OseeCoreException { monitor.subTask(description); - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); DoubleKeyHashMap<Integer, Integer, LocalRelationLink> map = forDelete ? deleteMap : updateMap; try { chStmt.runPreparedQuery(sql); diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/RepeatEnumerationAttributeValues.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/RepeatEnumerationAttributeValues.java index c6c1d7781dc..cb18aedd860 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/RepeatEnumerationAttributeValues.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/RepeatEnumerationAttributeValues.java @@ -20,7 +20,6 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.osee.framework.core.enums.TxChange; import org.eclipse.osee.framework.core.model.Branch; import org.eclipse.osee.framework.core.model.type.AttributeType; -import org.eclipse.osee.framework.database.core.IOseeStatement; import org.eclipse.osee.framework.jdk.core.type.HashCollection; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.type.OseeStateException; @@ -32,6 +31,7 @@ import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager; import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction; import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager; import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; +import org.eclipse.osee.jdbc.JdbcStatement; /** * @author Ryan D. Brooks @@ -125,7 +125,7 @@ public class RepeatEnumerationAttributeValues extends DatabaseHealthOperation { private Set<AttrData> getRepeatEnumeratedAttrs(IProgressMonitor monitor, Branch branch) throws OseeCoreException { Set<AttrData> attrData = new HashSet<AttrData>(); - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { chStmt.runPreparedQuery(FIND_REPEAT_ENUMS, branch.getUuid(), branch.getUuid()); while (chStmt.next()) { diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/DataSourceDetails.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/DataSourceDetails.java index 328ca2e5f2b..d259d531aac 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/DataSourceDetails.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/DataSourceDetails.java @@ -13,13 +13,13 @@ package org.eclipse.osee.framework.ui.skynet.preferences; import java.text.DateFormat; import org.eclipse.jface.preference.PreferencePage; import org.eclipse.osee.framework.core.client.ClientSessionManager; -import org.eclipse.osee.framework.database.core.IOseeStatement; import org.eclipse.osee.framework.jdk.core.util.AHTML; import org.eclipse.osee.framework.jdk.core.util.Lib; import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; import org.eclipse.osee.framework.skynet.core.utility.OseeInfo; import org.eclipse.osee.framework.ui.skynet.internal.Activator; import org.eclipse.osee.framework.ui.swt.Displays; +import org.eclipse.osee.jdbc.JdbcStatement; import org.eclipse.swt.SWT; import org.eclipse.swt.browser.Browser; import org.eclipse.swt.layout.FillLayout; @@ -115,7 +115,7 @@ public class DataSourceDetails extends PreferencePage implements IWorkbenchPrefe StringBuilder builder = new StringBuilder(); builder.append("<table class=\"oseeTable\" width=\"100%\">"); builder.append(AHTML.addHeaderRowMultiColumnTable(new String[] {"Source Id", "Exported On", "Imported On"})); - IOseeStatement chStmt = null; + JdbcStatement chStmt = null; try { chStmt = ConnectionHandler.getStatement(); chStmt.runPreparedQuery("select * from osee_import_source"); diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/ArtifactGuis.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/ArtifactGuis.java index 323c0166f41..9ee57fa0f11 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/ArtifactGuis.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/ArtifactGuis.java @@ -16,7 +16,6 @@ import java.util.Set; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.osee.framework.core.enums.BranchType; import org.eclipse.osee.framework.core.model.Branch; -import org.eclipse.osee.framework.database.core.IOseeStatement; import org.eclipse.osee.framework.jdk.core.type.MutableBoolean; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.Conditions; @@ -25,6 +24,7 @@ import org.eclipse.osee.framework.skynet.core.artifact.Attribute; import org.eclipse.osee.framework.skynet.core.artifact.BranchManager; import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; import org.eclipse.osee.framework.ui.swt.Displays; +import org.eclipse.osee.jdbc.JdbcStatement; public final class ArtifactGuis { @@ -85,7 +85,7 @@ public final class ArtifactGuis { // Can only be on other branches if it has already been saved if (artifact.isInDb()) { - IOseeStatement chStmt = ConnectionHandler.getStatement(); + JdbcStatement chStmt = ConnectionHandler.getStatement(); try { Branch branch = artifact.getFullBranch(); chStmt.runPreparedQuery(OTHER_EDIT_SQL, artifact.getArtId(), branch.getUuid(), |