diff options
author | jphillips | 2009-08-13 15:38:41 +0000 |
---|---|---|
committer | jphillips | 2009-08-13 15:38:41 +0000 |
commit | 6184b86ff02cce70f22a52766846bb7a327148d9 (patch) | |
tree | cf8089575929e2f89cb35b9f0cf902423fa7c0e9 | |
parent | a616e85d83a9ec4b89e9df45b8ac539ad0af2723 (diff) | |
download | org.eclipse.osee-6184b86ff02cce70f22a52766846bb7a327148d9.tar.gz org.eclipse.osee-6184b86ff02cce70f22a52766846bb7a327148d9.tar.xz org.eclipse.osee-6184b86ff02cce70f22a52766846bb7a327148d9.zip |
6 files changed, 72 insertions, 4 deletions
diff --git a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java b/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java index 00d27a01559..748144edf8c 100644 --- a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java +++ b/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java @@ -479,7 +479,7 @@ public class BranchManager { throw new OseeCoreException("Commit failed - unable to commit into a non-editable branch");
}
runCommitExtPointActions(conflictManager.getSourceBranch());
- new CommitDbTx(conflictManager, archiveSourceBranch).execute();
+ Activator.getInstance().getCommitBranchService().commitBranch(conflictManager, archiveSourceBranch);
}
private static void runCommitExtPointActions(Branch branch) throws OseeCoreException {
diff --git a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/CommitDbTx.java b/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/CommitDbTx.java index 249d467c751..6d5ab188461 100644 --- a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/CommitDbTx.java +++ b/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/CommitDbTx.java @@ -129,7 +129,7 @@ public class CommitDbTx extends DbTransaction { // Store branches that are currently being committed
private static Set<Branch> branchesInCommit = new HashSet<Branch>();
- protected CommitDbTx(ConflictManagerExternal conflictManager, boolean archiveSourceBranch) throws OseeCoreException {
+ public CommitDbTx(ConflictManagerExternal conflictManager, boolean archiveSourceBranch) throws OseeCoreException {
this.savedBranchStates = new HashMap<Branch, BranchState>();
this.conflictManager = conflictManager;
this.destinationBranch = conflictManager.getDestinationBranch();
@@ -146,7 +146,7 @@ public class CommitDbTx extends DbTransaction { }
@Override
- protected void handleTxWork(OseeConnection connection) throws OseeCoreException {
+ public void handleTxWork(OseeConnection connection) throws OseeCoreException {
branchesInCommit.add(this.sourceBranch);
User userToBlame = UserManager.getUser();
diff --git a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/Activator.java b/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/Activator.java index 6cba7c81ae3..9e4a07a323d 100644 --- a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/Activator.java +++ b/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/Activator.java @@ -13,24 +13,52 @@ package org.eclipse.osee.framework.skynet.core.internal; import org.eclipse.osee.framework.core.client.ClientSessionManager; import org.eclipse.osee.framework.skynet.core.attribute.HttpAttributeTagger; import org.eclipse.osee.framework.skynet.core.event.RemoteEventManager; +import org.eclipse.osee.framework.skynet.core.serverCommit.ICommitService; +import org.eclipse.osee.framework.skynet.core.serverCommit.CommitService; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; +import org.osgi.util.tracker.ServiceTracker; /** * @author Ryan D. Brooks */ public class Activator implements BundleActivator { public static final String PLUGIN_ID = "org.eclipse.osee.framework.skynet.core"; + private ServiceRegistration serviceRegistration; + private ServiceTracker commitServiceTracker; + private static Activator instance; @Override public void start(BundleContext context) throws Exception { + instance = this; ClientSessionManager.class.getCanonicalName(); HttpAttributeTagger.getInstance(); + + serviceRegistration = context.registerService(ICommitService.class.getName(), new CommitService(), null); + + commitServiceTracker = new ServiceTracker(context, ICommitService.class.getName(), null); + commitServiceTracker.open(); } @Override public void stop(BundleContext context) throws Exception { HttpAttributeTagger.getInstance().deregisterFromEventManager(); RemoteEventManager.deregisterFromRemoteEventManager(); + + serviceRegistration.unregister(); + + commitServiceTracker.close(); + commitServiceTracker = null; + + instance = null; + } + + public static Activator getInstance(){ + return instance; + } + + public ICommitService getCommitBranchService() { + return (ICommitService) commitServiceTracker.getService(); } }
\ No newline at end of file diff --git a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ConflictManagerInternal.java b/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ConflictManagerInternal.java index e0b51455f68..df9d3c471f2 100644 --- a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ConflictManagerInternal.java +++ b/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ConflictManagerInternal.java @@ -129,7 +129,7 @@ public class ConflictManagerInternal { monitor = new EmptyMonitor();
}
int commitTransactionId = getCommitTransaction(sourceBranch, destinationBranch);
- if (commitTransactionId != 0) {
+ if (commitTransactionId != -1) {
try {
return getConflictsPerBranch(TransactionIdManager.getTransactionId(commitTransactionId), monitor);
} catch (TransactionDoesNotExist ex) {
diff --git a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/serverCommit/CommitService.java b/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/serverCommit/CommitService.java new file mode 100644 index 00000000000..e3669b4cd3c --- /dev/null +++ b/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/serverCommit/CommitService.java @@ -0,0 +1,22 @@ +/*
+ * Created on Aug 12, 2009
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.framework.skynet.core.serverCommit;
+
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.artifact.CommitDbTx;
+import org.eclipse.osee.framework.skynet.core.conflict.ConflictManagerExternal;
+
+/**
+ * @author Jeff C. Phillips
+ *
+ */
+public class CommitService implements ICommitService{
+
+ @Override
+ public void commitBranch(ConflictManagerExternal conflictManager, boolean archiveSourceBranch) throws OseeCoreException {
+ new CommitDbTx(conflictManager, archiveSourceBranch).execute();
+ }
+}
diff --git a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/serverCommit/ICommitService.java b/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/serverCommit/ICommitService.java new file mode 100644 index 00000000000..87747274c24 --- /dev/null +++ b/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/serverCommit/ICommitService.java @@ -0,0 +1,18 @@ +/*
+ * Created on Jul 31, 2009
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.framework.skynet.core.serverCommit;
+
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.conflict.ConflictManagerExternal;
+
+/**
+ * @author Jeff C. Phillips
+ *
+ */
+public interface ICommitService {
+
+ public void commitBranch(ConflictManagerExternal conflictManager, boolean archiveSourceBranch) throws OseeCoreException;
+}
|