Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrbrooks2010-09-24 02:42:17 +0000
committerRyan D. Brooks2010-09-24 02:42:17 +0000
commit8885710c96fd5a85058b3103cfd081169dfeea76 (patch)
tree89ee31e3336b77d248a20ad1f64d4850857704a1 /plugins/org.eclipse.osee.framework.branch.management/src
parent47b4411c167982b9818e5f337a46ab02ad5f5708 (diff)
downloadorg.eclipse.osee-8885710c96fd5a85058b3103cfd081169dfeea76.tar.gz
org.eclipse.osee-8885710c96fd5a85058b3103cfd081169dfeea76.tar.xz
org.eclipse.osee-8885710c96fd5a85058b3103cfd081169dfeea76.zip
refactor: Make service accessor methods in server admin Activator static
Diffstat (limited to 'plugins/org.eclipse.osee.framework.branch.management/src')
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/commit/CommitDbOperation.java6
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/creation/CreateBranchOperation.java21
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/internal/OseeBranchService.java10
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/PurgeBranchOperation.java30
4 files changed, 32 insertions, 35 deletions
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/commit/CommitDbOperation.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/commit/CommitDbOperation.java
index 854f60a0978..c3ccc3e748a 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/commit/CommitDbOperation.java
+++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/commit/CommitDbOperation.java
@@ -35,7 +35,7 @@ import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.core.model.cache.BranchCache;
import org.eclipse.osee.framework.core.services.IOseeModelFactoryServiceProvider;
-import org.eclipse.osee.framework.database.IOseeDatabaseServiceProvider;
+import org.eclipse.osee.framework.database.IOseeDatabaseService;
import org.eclipse.osee.framework.database.core.AbstractDbTxOperation;
import org.eclipse.osee.framework.database.core.OseeConnection;
import org.eclipse.osee.framework.jdk.core.util.time.GlobalTime;
@@ -77,8 +77,8 @@ public class CommitDbOperation extends AbstractDbTxOperation {
private OseeConnection connection;
private boolean success;
- public CommitDbOperation(IOseeDatabaseServiceProvider databaseProvider, BranchCache branchCache, int userArtId, Branch sourceBranch, Branch destinationBranch, Branch mergeBranch, List<ChangeItem> changes, BranchCommitResponse txHolder, IOseeModelFactoryServiceProvider modelFactory) {
- super(databaseProvider, "Commit Database Operation", Activator.PLUGIN_ID);
+ public CommitDbOperation(IOseeDatabaseService databaseService, BranchCache branchCache, int userArtId, Branch sourceBranch, Branch destinationBranch, Branch mergeBranch, List<ChangeItem> changes, BranchCommitResponse txHolder, IOseeModelFactoryServiceProvider modelFactory) {
+ super(databaseService, "Commit Database Operation", Activator.PLUGIN_ID);
this.savedBranchStates = new HashMap<Branch, BranchState>();
this.branchCache = branchCache;
this.userArtId = userArtId;
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/creation/CreateBranchOperation.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/creation/CreateBranchOperation.java
index cfe63bea499..44cf8743648 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/creation/CreateBranchOperation.java
+++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/creation/CreateBranchOperation.java
@@ -33,9 +33,9 @@ import org.eclipse.osee.framework.core.model.MergeBranch;
import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.core.model.cache.BranchCache;
import org.eclipse.osee.framework.core.model.cache.TransactionCache;
-import org.eclipse.osee.framework.core.services.IOseeCachingServiceProvider;
+import org.eclipse.osee.framework.core.services.IOseeCachingService;
import org.eclipse.osee.framework.core.services.IOseeModelFactoryServiceProvider;
-import org.eclipse.osee.framework.database.IOseeDatabaseServiceProvider;
+import org.eclipse.osee.framework.database.IOseeDatabaseService;
import org.eclipse.osee.framework.database.core.AbstractDbTxOperation;
import org.eclipse.osee.framework.database.core.IOseeStatement;
import org.eclipse.osee.framework.database.core.OseeConnection;
@@ -74,16 +74,15 @@ public class CreateBranchOperation extends AbstractDbTxOperation {
private boolean wasSuccessful;
private int systemUserId;
- private final IOseeCachingServiceProvider cachingService;
+ private final IOseeCachingService cachingService;
private final IOseeModelFactoryServiceProvider factoryService;
private final BranchCreationRequest request;
private final BranchCreationResponse response;
private Branch branch;
- public CreateBranchOperation(IOseeDatabaseServiceProvider provider, IOseeModelFactoryServiceProvider factoryService, IOseeCachingServiceProvider cachingService, BranchCreationRequest request, BranchCreationResponse response) {
- super(provider,
- String.format("Create Branch: [%s from %s]", request.getBranchName(), request.getParentBranchId()),
- Activator.PLUGIN_ID);
+ public CreateBranchOperation(IOseeDatabaseService databaseService, IOseeModelFactoryServiceProvider factoryService, IOseeCachingService cachingService, BranchCreationRequest request, BranchCreationResponse response) {
+ super(databaseService, String.format("Create Branch: [%s from %s]", request.getBranchName(),
+ request.getParentBranchId()), Activator.PLUGIN_ID);
this.cachingService = cachingService;
this.factoryService = factoryService;
this.request = request;
@@ -129,7 +128,7 @@ public class CreateBranchOperation extends AbstractDbTxOperation {
@SuppressWarnings("unchecked")
@Override
protected void doTxWork(IProgressMonitor monitor, OseeConnection connection) throws OseeCoreException {
- BranchCache branchCache = cachingService.getOseeCachingService().getBranchCache();
+ BranchCache branchCache = cachingService.getBranchCache();
Branch parentBranch = branchCache.getById(request.getParentBranchId());
Branch destinationBranch = branchCache.getById(request.getDestinationBranchId());
@@ -137,7 +136,7 @@ public class CreateBranchOperation extends AbstractDbTxOperation {
checkPreconditions(monitor, parentBranch, destinationBranch);
passedPreConditions = true;
- TransactionCache txCache = cachingService.getOseeCachingService().getTransactionCache();
+ TransactionCache txCache = cachingService.getTransactionCache();
String guid = request.getBranchGuid();
if (!GUID.isValid(guid)) {
@@ -194,7 +193,7 @@ public class CreateBranchOperation extends AbstractDbTxOperation {
protected void handleTxException(IProgressMonitor monitor, Exception ex) {
if (passedPreConditions) {
try {
- BranchCache branchCache = cachingService.getOseeCachingService().getBranchCache();
+ BranchCache branchCache = cachingService.getBranchCache();
branch.setStorageState(StorageState.PURGED);
branchCache.storeItems(branch);
} catch (OseeCoreException ex1) {
@@ -206,7 +205,7 @@ public class CreateBranchOperation extends AbstractDbTxOperation {
@Override
protected void handleTxFinally(IProgressMonitor monitor) throws OseeCoreException {
if (wasSuccessful) {
- BranchCache branchCache = cachingService.getOseeCachingService().getBranchCache();
+ BranchCache branchCache = cachingService.getBranchCache();
branch.setBranchState(BranchState.CREATED);
branchCache.storeItems(branch);
response.setBranchId(branch.getId());
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/internal/OseeBranchService.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/internal/OseeBranchService.java
index 8ed1ba844ad..556f00c020d 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/internal/OseeBranchService.java
+++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/internal/OseeBranchService.java
@@ -91,8 +91,8 @@ public class OseeBranchService implements IOseeBranchService {
List<IOperation> ops = new ArrayList<IOperation>();
ops.add(new LoadDeltasBetweenBranches(oseeDatabaseProvider, txDelta, mergeTx, changes));
ops.add(new ComputeNetChangeOperation(changes));
- ops.add(new CommitDbOperation(oseeDatabaseProvider, branchCache, userId, sourceBranch, destinationBranch,
- mergeBranch, changes, response, modelFactory));
+ ops.add(new CommitDbOperation(oseeDatabaseProvider.getOseeDatabaseService(), branchCache, userId, sourceBranch,
+ destinationBranch, mergeBranch, changes, response, modelFactory));
String opName =
String.format("Commit: [%s]->[%s]", sourceBranch.getShortName(), destinationBranch.getShortName());
@@ -110,7 +110,8 @@ public class OseeBranchService implements IOseeBranchService {
@Override
public IOperation createBranch(IProgressMonitor monitor, BranchCreationRequest request, BranchCreationResponse response) throws OseeCoreException {
- return new CreateBranchOperation(oseeDatabaseProvider, modelFactory, cachingService, request, response);
+ return new CreateBranchOperation(oseeDatabaseProvider.getOseeDatabaseService(), modelFactory,
+ cachingService.getOseeCachingService(), request, response);
}
@Override
@@ -145,7 +146,8 @@ public class OseeBranchService implements IOseeBranchService {
@Override
public IOperation purge(IProgressMonitor monitor, PurgeBranchRequest request) throws OseeCoreException {
BranchCache branchCache = cachingService.getOseeCachingService().getBranchCache();
- return new PurgeBranchOperation(branchCache.getById(request.getBranchId()), cachingService, oseeDatabaseProvider);
+ return new PurgeBranchOperation(branchCache.getById(request.getBranchId()), cachingService,
+ oseeDatabaseProvider.getOseeDatabaseService());
}
@Override
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/PurgeBranchOperation.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/PurgeBranchOperation.java
index 45bd443f625..267fb70a673 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/PurgeBranchOperation.java
+++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/PurgeBranchOperation.java
@@ -21,7 +21,7 @@ import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.model.cache.BranchCache;
import org.eclipse.osee.framework.core.services.IOseeCachingServiceProvider;
-import org.eclipse.osee.framework.database.IOseeDatabaseServiceProvider;
+import org.eclipse.osee.framework.database.IOseeDatabaseService;
import org.eclipse.osee.framework.database.core.AbstractDbTxOperation;
import org.eclipse.osee.framework.database.core.IOseeStatement;
import org.eclipse.osee.framework.database.core.OseeConnection;
@@ -61,32 +61,28 @@ public class PurgeBranchOperation extends AbstractDbTxOperation {
private IProgressMonitor monitor;
private String sourceTableName;
private final IOseeCachingServiceProvider cachingService;
- private final IOseeDatabaseServiceProvider oseeDatabaseProvider;
+ private final IOseeDatabaseService databaseService;
- public PurgeBranchOperation(Branch branch, IOseeCachingServiceProvider cachingService, IOseeDatabaseServiceProvider oseeDatabaseProvider) {
- super(oseeDatabaseProvider, String.format("Purge Branch: [(%s)-%s]", branch.getId(), branch.getShortName()),
+ public PurgeBranchOperation(Branch branch, IOseeCachingServiceProvider cachingService, IOseeDatabaseService databaseService) {
+ super(databaseService, String.format("Purge Branch: [(%s)-%s]", branch.getId(), branch.getShortName()),
Activator.PLUGIN_ID);
this.branch = branch;
this.sourceTableName = branch.getArchiveState().isArchived() ? "osee_txs_archived" : "osee_txs";
this.cachingService = cachingService;
- this.oseeDatabaseProvider = oseeDatabaseProvider;
+ this.databaseService = databaseService;
}
@Override
protected void doTxWork(IProgressMonitor monitor, OseeConnection connection) throws OseeCoreException {
this.connection = connection;
this.monitor = monitor;
- int numberOfChildren =
- oseeDatabaseProvider.getOseeDatabaseService().runPreparedQueryFetchObject(0, COUNT_CHILD_BRANCHES,
- branch.getId());
+ int numberOfChildren = databaseService.runPreparedQueryFetchObject(0, COUNT_CHILD_BRANCHES, branch.getId());
if (numberOfChildren > 0) {
- throw new OseeArgumentException("Unable to purge a branch containing children: branchId[%s]",
- branch.getId());
+ throw new OseeArgumentException("Unable to purge a branch containing children: branchId[%s]", branch.getId());
}
boolean isAddressingArchived =
- oseeDatabaseProvider.getOseeDatabaseService().runPreparedQueryFetchObject(0, TEST_TXS,
- branch.getBaseTransaction().getId()) == 0;
+ databaseService.runPreparedQueryFetchObject(0, TEST_TXS, branch.getBaseTransaction().getId()) == 0;
if (isAddressingArchived) {
sourceTableName = "osee_txs_archived";
} else {
@@ -118,7 +114,7 @@ public class PurgeBranchOperation extends AbstractDbTxOperation {
monitor.setTaskName(String.format("Purge from %s", tableName));
checkForCancelledStatus(monitor);
String sql = String.format(PURGE_GAMMAS, tableName);
- oseeDatabaseProvider.getOseeDatabaseService().runBatchUpdate(connection, sql, deleteableGammas);
+ databaseService.runBatchUpdate(connection, sql, deleteableGammas);
}
monitor.worked(calculateWork(percentage));
}
@@ -126,12 +122,12 @@ public class PurgeBranchOperation extends AbstractDbTxOperation {
private void purgeFromTable(String tableName, String sql, double percentage, Object... data) throws OseeCoreException {
monitor.setTaskName(String.format("Purge from %s", tableName));
checkForCancelledStatus(monitor);
- oseeDatabaseProvider.getOseeDatabaseService().runPreparedUpdate(connection, sql, data);
+ databaseService.runPreparedUpdate(connection, sql, data);
monitor.worked(calculateWork(percentage));
}
private void findDeleteableGammas(String sql, double percentage) throws OseeCoreException {
- IOseeStatement chStmt = oseeDatabaseProvider.getOseeDatabaseService().getStatement(connection);
+ IOseeStatement chStmt = databaseService.getStatement(connection);
try {
chStmt.runPreparedQuery(10000, sql, branch.getId(), branch.getBaseTransaction().getId());
while (chStmt.next()) {
@@ -145,7 +141,7 @@ public class PurgeBranchOperation extends AbstractDbTxOperation {
private void purgeAddressing(double percentage) throws OseeCoreException {
monitor.setTaskName("Purge txs addressing");
- IOseeStatement chStmt = oseeDatabaseProvider.getOseeDatabaseService().getStatement(connection);
+ IOseeStatement chStmt = databaseService.getStatement(connection);
List<Object[]> addressing = new ArrayList<Object[]>();
String sql = String.format(SELECT_ADDRESSING_BY_BRANCH, sourceTableName);
@@ -159,7 +155,7 @@ public class PurgeBranchOperation extends AbstractDbTxOperation {
}
sql = String.format("delete from %s where transaction_id = ? and gamma_id = ?", sourceTableName);
- oseeDatabaseProvider.getOseeDatabaseService().runBatchUpdate(connection, sql, addressing);
+ databaseService.runBatchUpdate(connection, sql, addressing);
monitor.worked(calculateWork(percentage));
}
} \ No newline at end of file

Back to the top