Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjphillips2010-06-23 14:50:43 -0400
committerjphillips2010-06-23 14:50:43 -0400
commitfcfef933daaaf771adc60aff5bd56d8adc2ccf8d (patch)
tree332867c4cd46432809f34fd58495de9a755f8f74 /plugins/org.eclipse.osee.framework.lifecycle
parenta036ded9b8f854c8f8cd43269cd76f309a04cdc4 (diff)
downloadorg.eclipse.osee-fcfef933daaaf771adc60aff5bd56d8adc2ccf8d.tar.gz
org.eclipse.osee-fcfef933daaaf771adc60aff5bd56d8adc2ccf8d.tar.xz
org.eclipse.osee-fcfef933daaaf771adc60aff5bd56d8adc2ccf8d.zip
Commit lifecycle implementation with skynetTransaction
Diffstat (limited to 'plugins/org.eclipse.osee.framework.lifecycle')
-rw-r--r--plugins/org.eclipse.osee.framework.lifecycle/META-INF/MANIFEST.MF6
-rw-r--r--plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/AbstractLifecycleOperation.java4
-rw-r--r--plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/AbstractLifecyclePoint.java2
-rw-r--r--plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/AbstractLifecycleVisitor.java2
-rw-r--r--plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/Activator.java9
-rw-r--r--plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/ChangeMgmtChkPoint.java42
-rw-r--r--plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/ChangeMgmtHandler.java72
-rw-r--r--plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/ILifecycleService.java (renamed from plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/LifecycleService.java)2
-rw-r--r--plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/ILifecycleServiceProvider.java15
-rw-r--r--plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/LifecycleServiceImpl.java5
10 files changed, 151 insertions, 8 deletions
diff --git a/plugins/org.eclipse.osee.framework.lifecycle/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.lifecycle/META-INF/MANIFEST.MF
index 02a88e069cd..71b8331cbae 100644
--- a/plugins/org.eclipse.osee.framework.lifecycle/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.framework.lifecycle/META-INF/MANIFEST.MF
@@ -8,9 +8,13 @@ Bundle-Vendor: Eclipse.org
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: org.eclipse.core.runtime;version="3.4.0",
org.eclipse.osee.framework.core.exception,
+ 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.jdk.core.type,
- org.osgi.framework;version="1.3.0"
+ org.osgi.framework;version="1.3.0",
+ org.osgi.util.tracker
Eclipse-ExtensibleAPI: true
Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.osee.framework.lifecycle
diff --git a/plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/AbstractLifecycleOperation.java b/plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/AbstractLifecycleOperation.java
index 97d18037d7a..b4ea6925882 100644
--- a/plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/AbstractLifecycleOperation.java
+++ b/plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/AbstractLifecycleOperation.java
@@ -21,10 +21,10 @@ import org.eclipse.osee.framework.lifecycle.internal.OperationPointId;
*/
public abstract class AbstractLifecycleOperation extends AbstractOperation {
- private final LifecycleService service;
+ private final ILifecycleService service;
private final AbstractLifecyclePoint<?> lifecyclepoint;
- public AbstractLifecycleOperation(LifecycleService service, AbstractLifecyclePoint<?> lifecyclePoint, String operationName, String pluginId) {
+ public AbstractLifecycleOperation(ILifecycleService service, AbstractLifecyclePoint<?> lifecyclePoint, String operationName, String pluginId) {
super(operationName, pluginId);
this.service = service;
this.lifecyclepoint = lifecyclePoint;
diff --git a/plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/AbstractLifecyclePoint.java b/plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/AbstractLifecyclePoint.java
index d4263a81495..243d273ec37 100644
--- a/plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/AbstractLifecyclePoint.java
+++ b/plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/AbstractLifecyclePoint.java
@@ -25,7 +25,7 @@ public abstract class AbstractLifecyclePoint<H extends LifecycleOpHandler> exten
}
/**
- * Should only be called by {@link LifecycleService}.
+ * Should only be called by {@link ILifecycleService}.
*/
@Override
final protected IStatus dispatch(IProgressMonitor monitor, H handler, String sourceId) {
diff --git a/plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/AbstractLifecycleVisitor.java b/plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/AbstractLifecycleVisitor.java
index d0c409266de..6644cf8469c 100644
--- a/plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/AbstractLifecycleVisitor.java
+++ b/plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/AbstractLifecycleVisitor.java
@@ -44,7 +44,7 @@ public abstract class AbstractLifecycleVisitor<H extends LifecycleHandler> {
public abstract Type<H> getAssociatedType();
/**
- * Should only be called by {@link LifecycleService}.
+ * Should only be called by {@link ILifecycleService}.
*/
protected abstract IStatus dispatch(IProgressMonitor monitor, H handler, String sourceId);
diff --git a/plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/Activator.java b/plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/Activator.java
index df27a2acfc0..d7db4f16331 100644
--- a/plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/Activator.java
+++ b/plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/Activator.java
@@ -12,18 +12,25 @@ package org.eclipse.osee.framework.lifecycle;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
/**
* @author Roberto E. Escobar
* @author Jeff C. Phillips
*/
public class Activator implements BundleActivator {
+ public static final String PLUGIN_ID = "org.eclipse.osee.framework.lifecycle";
+ private ServiceRegistration service;
+
+ public Activator() {
+ }
/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
+ service = context.registerService(ILifecycleService.class.getName(), new LifecycleServiceImpl(), null);
}
/*
@@ -31,6 +38,6 @@ public class Activator implements BundleActivator {
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
+ service.unregister();
}
-
}
diff --git a/plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/ChangeMgmtChkPoint.java b/plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/ChangeMgmtChkPoint.java
new file mode 100644
index 00000000000..0a368f392a1
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/ChangeMgmtChkPoint.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * 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.lifecycle;
+
+import java.util.Collection;
+import org.eclipse.osee.framework.core.model.IBasicArtifact;
+
+/**
+ * @author Roberto E. Escobar
+ * @author Jeff C. Phillips
+ */
+public class ChangeMgmtChkPoint extends AbstractLifecyclePoint<ChangeMgmtHandler> {
+
+ public static final Type<ChangeMgmtHandler> TYPE = new Type<ChangeMgmtHandler>();
+ private final IBasicArtifact<?> userArtifact;
+ private final Collection<IBasicArtifact<?>> artsToCheck;
+
+ public ChangeMgmtChkPoint(IBasicArtifact<?> userArtifact, Collection<IBasicArtifact<?>> artsToCheck) {
+ super();
+ this.userArtifact = userArtifact;
+ this.artsToCheck = artsToCheck;
+ }
+
+ @Override
+ protected void initializeHandlerData(ChangeMgmtHandler handler) {
+ handler.setData(userArtifact, artsToCheck);
+ }
+
+ @Override
+ public Type<ChangeMgmtHandler> getAssociatedType() {
+ return TYPE;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/ChangeMgmtHandler.java b/plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/ChangeMgmtHandler.java
new file mode 100644
index 00000000000..7e3867246e8
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/ChangeMgmtHandler.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * 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.lifecycle;
+
+import java.util.Collection;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.osee.framework.core.model.IBasicArtifact;
+
+/**
+ * @author Roberto E. Escobar
+ * @author Jeff C. Phillips
+ */
+public class ChangeMgmtHandler implements LifecycleOpHandler {
+ private final IStatus status = Status.OK_STATUS;
+
+ public static interface IAccessDataProvider {
+ public boolean canEdit(IBasicArtifact<?> user, IBasicArtifact<?> artTcheck);
+ }
+
+ private class AccessDataProvider implements IAccessDataProvider {
+ public boolean canEdit(IBasicArtifact<?> user, IBasicArtifact<?> artTcheck) {
+ return true;
+ }
+ }
+
+ private IBasicArtifact<?> userArtifact;
+ private Collection<IBasicArtifact<?>> artsToCheck;
+ private final AccessDataProvider dataProvider;
+
+ public ChangeMgmtHandler() {
+ this.dataProvider = new AccessDataProvider();
+ }
+
+ public void setData(IBasicArtifact<?> userArtifact, Collection<IBasicArtifact<?>> artsToCheck) {
+ this.userArtifact = userArtifact;
+ this.artsToCheck = artsToCheck;
+ }
+
+ @Override
+ public IStatus onCheck(IProgressMonitor monitor) {
+ IStatus statusToReturn = status;
+
+ for (IBasicArtifact<?> artifactToChk : artsToCheck) {
+ if (!dataProvider.canEdit(userArtifact, artifactToChk)) {
+ statusToReturn = new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Error");
+ break;
+ }
+ }
+ return statusToReturn;
+ }
+
+ @Override
+ public IStatus onPostCondition(IProgressMonitor monitor) {
+ return status;
+ }
+
+ @Override
+ public IStatus onPreCondition(IProgressMonitor monitor) {
+ return status;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/LifecycleService.java b/plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/ILifecycleService.java
index 0f2b3e505ae..073742d5396 100644
--- a/plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/LifecycleService.java
+++ b/plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/ILifecycleService.java
@@ -19,7 +19,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
-public interface LifecycleService {
+public interface ILifecycleService {
public <H extends LifecycleHandler> void addHandler(AbstractLifecycleVisitor.Type<H> type, final H handler) throws OseeCoreException;
diff --git a/plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/ILifecycleServiceProvider.java b/plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/ILifecycleServiceProvider.java
new file mode 100644
index 00000000000..03bf01e49bc
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/ILifecycleServiceProvider.java
@@ -0,0 +1,15 @@
+/*
+ * Created on Jun 21, 2010
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.framework.lifecycle;
+
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public interface ILifecycleServiceProvider {
+ public ILifecycleService getLifecycleServices() throws OseeCoreException;
+}
diff --git a/plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/LifecycleServiceImpl.java b/plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/LifecycleServiceImpl.java
index 19e7e95688c..eb3c2913494 100644
--- a/plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/LifecycleServiceImpl.java
+++ b/plugins/org.eclipse.osee.framework.lifecycle/src/org/eclipse/osee/framework/lifecycle/LifecycleServiceImpl.java
@@ -22,10 +22,11 @@ import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.util.Conditions;
import org.eclipse.osee.framework.jdk.core.type.HashCollection;
-public class LifecycleServiceImpl implements LifecycleService {
+public class LifecycleServiceImpl implements ILifecycleService {
private final HashCollection<AbstractLifecycleVisitor.Type<?>, LifecycleHandler> handlersByType =
new HashCollection<AbstractLifecycleVisitor.Type<?>, LifecycleHandler>();
+ private final HashCollection<String, LifecycleHandler> handlersById = new HashCollection<String, LifecycleHandler>();
public LifecycleServiceImpl() {
}
@@ -63,6 +64,8 @@ public class LifecycleServiceImpl implements LifecycleService {
Conditions.checkNotNull(type, "handler type");
Conditions.checkNotNull(handler, "handler");
handlersByType.put(type, handler);
+
+ handlersById.put("", handler);
}
public <H extends LifecycleHandler> void removeHandler(AbstractLifecycleVisitor.Type<H> type, final H handler) throws OseeCoreException {

Back to the top