Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2015-12-04 04:01:50 +0000
committerRyan D. Brooks2015-12-04 04:01:50 +0000
commitf69b41f693def40b45c7cfb7d783cc5d72579a0d (patch)
treeb5583201683da5cdaa230cb41666673f902e221e
parent493a52845a6717b3a74f8541476d0aa18dfabced (diff)
downloadorg.eclipse.osee-f69b41f693def40b45c7cfb7d783cc5d72579a0d.tar.gz
org.eclipse.osee-f69b41f693def40b45c7cfb7d783cc5d72579a0d.tar.xz
org.eclipse.osee-f69b41f693def40b45c7cfb7d783cc5d72579a0d.zip
feature[ats_ATS184131]: Performance Rpt - Handle WorkPackage Event
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/util/AtsEvents.java25
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/util/IAtsStoreService.java3
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/Activator.java1
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsClientImpl.java2
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsStoreService.java11
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/ev/AtsEarnedValueImpl.java10
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsObjects.java15
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsUtilCore.java8
-rw-r--r--plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsStoreServiceImpl.java3
-rw-r--r--plugins/org.eclipse.osee.ats/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAEditorArtifactEventManager.java21
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/internal/Activator.java8
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/AtsWorkItemEventHandler.java48
-rw-r--r--plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/CompositeKeyHashMap.java20
-rw-r--r--plugins/org.eclipse.osee.framework.messaging.event.res/src/org/eclipse/osee/framework/messaging/event/res/RemoteTopicEvent1.java59
-rw-r--r--plugins/org.eclipse.osee.framework.messaging.event.res/src/org/eclipse/osee/framework/messaging/event/res/internal/OseeCoreModelEventServiceProxy.java1
-rw-r--r--plugins/org.eclipse.osee.framework.messaging.event.res/src/org/eclipse/osee/framework/messaging/event/res/internal/ResMessages.java2
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/OSGI-INF/event.admin.xml6
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactCache.java12
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactKey.java4
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/cache/ActiveArtifactCache.java55
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/FrameworkEventUtil.java18
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/OseeEventManager.java8
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/TopicEvent.java61
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/OseeEventServiceImpl.java8
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/event/TopicEventAdmin.java41
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/event/handlers/TopicLocalEventHandler.java43
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/event/handlers/TopicRemoteEventHandler.java32
30 files changed, 501 insertions, 33 deletions
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/util/AtsEvents.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/util/AtsEvents.java
new file mode 100644
index 0000000000..eb17aae144
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/util/AtsEvents.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2015 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.ats.api.util;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsEvents {
+
+ public static final String WORK_ITEM_MODIFIED = "ats/workitem/modified";
+ public static final String WORK_ITEM_UUDS = "workItemUuids";
+
+ private AtsEvents() {
+ // utility class
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/util/IAtsStoreService.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/util/IAtsStoreService.java
index 5595ff1ce2..8e30138f13 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/util/IAtsStoreService.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/util/IAtsStoreService.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.ats.api.util;
+import java.util.Collection;
import java.util.List;
import org.eclipse.osee.ats.api.IAtsObject;
import org.eclipse.osee.ats.api.IAtsWorkItem;
@@ -21,7 +22,7 @@ public interface IAtsStoreService {
IAtsChangeSet createAtsChangeSet(String comment);
- List<IAtsWorkItem> reload(List<IAtsWorkItem> inWorkWorkflows);
+ List<IAtsWorkItem> reload(Collection<IAtsWorkItem> workItems);
boolean isDeleted(IAtsObject atsObject);
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 69c2556ea9..b5f1a5c08b 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
@@ -71,7 +71,8 @@ Import-Package: com.google.common.cache,
org.eclipse.osee.logger,
org.eclipse.osee.orcs.rest.client,
org.eclipse.osee.orcs.search,
- org.osgi.framework
+ org.osgi.framework,
+ org.osgi.service.event
Export-Package: org.eclipse.osee.ats.core.client,
org.eclipse.osee.ats.core.client.access,
org.eclipse.osee.ats.core.client.action,
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/Activator.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/Activator.java
index adea10e5b4..11b94e7dbd 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/Activator.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/Activator.java
@@ -19,7 +19,6 @@ public class Activator implements BundleActivator {
@Override
public void start(BundleContext bundleContext) throws Exception {
- //
}
@Override
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 f8079804e2..c2145b880a 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
@@ -256,7 +256,7 @@ public class AtsClientImpl extends AtsCoreServiceImpl implements IAtsClient {
atsLogFactory = AtsCoreFactory.newLogFactory();
atsStateFactory = AtsCoreFactory.newStateFactory(getServices(), atsLogFactory);
- atsStoreService = new AtsStoreService();
+ atsStoreService = new AtsStoreService(workItemFactory);
actionableItemManager = new ActionableItemManager(getConfig(), attributeResolverService, atsStoreService);
sequenceProvider = new ISequenceProvider() {
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsStoreService.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsStoreService.java
index a490766aae..813d95eb9a 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsStoreService.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsStoreService.java
@@ -11,12 +11,14 @@
package org.eclipse.osee.ats.core.client.internal;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.eclipse.osee.ats.api.IAtsObject;
import org.eclipse.osee.ats.api.IAtsWorkItem;
+import org.eclipse.osee.ats.api.team.IAtsWorkItemFactory;
import org.eclipse.osee.ats.api.user.IAtsUser;
import org.eclipse.osee.ats.api.util.IAtsChangeSet;
import org.eclipse.osee.ats.api.util.IAtsStoreService;
@@ -30,6 +32,11 @@ import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
*/
public class AtsStoreService implements IAtsStoreService {
private static Map<String, Long> guidToUuid;
+ private final IAtsWorkItemFactory workItemFactory;
+
+ public AtsStoreService(IAtsWorkItemFactory workItemFactory) {
+ this.workItemFactory = workItemFactory;
+ }
@Override
public IAtsChangeSet createAtsChangeSet(String comment, IAtsUser user) {
@@ -42,7 +49,7 @@ public class AtsStoreService implements IAtsStoreService {
}
@Override
- public List<IAtsWorkItem> reload(List<IAtsWorkItem> workItems) {
+ public List<IAtsWorkItem> reload(Collection<IAtsWorkItem> workItems) {
List<IAtsWorkItem> results = new ArrayList<>();
try {
List<Artifact> artifacts = new LinkedList<Artifact>();
@@ -53,7 +60,7 @@ public class AtsStoreService implements IAtsStoreService {
}
for (Artifact art : ArtifactQuery.reloadArtifacts(artifacts)) {
if (!art.isDeleted()) {
- IAtsWorkItem workItem = AtsClientService.get().getWorkItemFactory().getWorkItem(art);
+ IAtsWorkItem workItem = workItemFactory.getWorkItem(art);
if (workItem != null) {
results.add(workItem);
}
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/ev/AtsEarnedValueImpl.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/ev/AtsEarnedValueImpl.java
index 1e89ae5298..521fdba7fd 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/ev/AtsEarnedValueImpl.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/ev/AtsEarnedValueImpl.java
@@ -25,10 +25,12 @@ import org.eclipse.osee.ats.api.ev.IAtsWorkPackage;
import org.eclipse.osee.ats.api.ev.JaxWorkPackageData;
import org.eclipse.osee.ats.api.insertion.IAtsInsertionActivity;
import org.eclipse.osee.ats.api.review.IAtsAbstractReview;
+import org.eclipse.osee.ats.api.util.AtsEvents;
import org.eclipse.osee.ats.api.workflow.IAtsTeamWorkflow;
import org.eclipse.osee.ats.core.client.ev.WorkPackageArtifact;
import org.eclipse.osee.ats.core.client.internal.AtsClientService;
import org.eclipse.osee.ats.core.client.workflow.AbstractWorkflowArtifact;
+import org.eclipse.osee.ats.core.util.AtsObjects;
import org.eclipse.osee.ats.core.util.AtsUtilCore;
import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -37,6 +39,8 @@ import org.eclipse.osee.framework.jdk.core.util.Strings;
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.attribute.AttributeTypeManager;
+import org.eclipse.osee.framework.skynet.core.event.OseeEventManager;
+import org.eclipse.osee.framework.skynet.core.event.model.TopicEvent;
/**
* @author Donald G. Dunne
@@ -138,7 +142,11 @@ public class AtsEarnedValueImpl implements IAtsEarnedValueService {
workPackageEp.setWorkPackage(workPackage.getUuid(), data);
}
- // TBD OseeEventManager.kickPersistEvent(getClass(), artifactEvent);
+ TopicEvent event =
+ new TopicEvent(AtsEvents.WORK_ITEM_MODIFIED, AtsEvents.WORK_ITEM_UUDS, AtsObjects.toUuidsString(";", workItems));
+ OseeEventManager.kickTopicEvent(getClass(), event);
+
+ AtsClientService.get().getStoreService().reload(workItems);
}
@Override
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsObjects.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsObjects.java
index 0834af6d7c..7bb335bbd9 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsObjects.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsObjects.java
@@ -23,6 +23,10 @@ import org.eclipse.osee.framework.jdk.core.util.Collections;
*/
public class AtsObjects {
+ public static String toUuidsString(String separator, Collection<? extends IAtsObject> atsObjects) {
+ return Collections.toString(separator, toUuids(atsObjects));
+ }
+
public static List<Long> toUuids(Collection<? extends IAtsObject> atsObjects) {
List<Long> uuids = new ArrayList<>(atsObjects.size());
for (IAtsObject atsObject : atsObjects) {
@@ -82,4 +86,15 @@ public class AtsObjects {
return Collections.toString(", ", guids);
}
+ /**
+ * @param semicolon delimited list of uuids
+ */
+ public static Collection<Long> uuidsToLong(String separator, String uuidsList) {
+ List<Long> uuids = new ArrayList<>();
+ for (String uuid : uuidsList.split(separator)) {
+ uuids.add(Long.valueOf(uuid));
+ }
+ return uuids;
+ }
+
}
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsUtilCore.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsUtilCore.java
index f2a38f0efd..8b65a02b95 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsUtilCore.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsUtilCore.java
@@ -12,7 +12,9 @@ package org.eclipse.osee.ats.core.util;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Dictionary;
import java.util.HashMap;
+import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
@@ -149,4 +151,10 @@ public class AtsUtilCore {
public static Long getUuidFromGuid(String guid) {
return guidToUuidMap.get(guid);
}
+
+ public static Dictionary<String, ?> hashTable(String key, String value) {
+ Hashtable<String, String> table = new Hashtable<>();
+ table.put(key, value);
+ return table;
+ }
}
diff --git a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsStoreServiceImpl.java b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsStoreServiceImpl.java
index fe88314dcf..fc14f3a528 100644
--- a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsStoreServiceImpl.java
+++ b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsStoreServiceImpl.java
@@ -11,6 +11,7 @@
package org.eclipse.osee.ats.impl.internal.util;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -61,7 +62,7 @@ public class AtsStoreServiceImpl implements IAtsStoreService {
}
@Override
- public List<IAtsWorkItem> reload(List<IAtsWorkItem> inWorkWorkflows) {
+ public List<IAtsWorkItem> reload(Collection<IAtsWorkItem> inWorkWorkflows) {
List<IAtsWorkItem> workItems = new ArrayList<>(inWorkWorkflows.size());
List<String> guids = AtsObjects.toGuids(inWorkWorkflows);
Iterator<ArtifactReadable> arts =
diff --git a/plugins/org.eclipse.osee.ats/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ats/META-INF/MANIFEST.MF
index c6a90c4fbf..6742b84072 100644
--- a/plugins/org.eclipse.osee.ats/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.ats/META-INF/MANIFEST.MF
@@ -216,5 +216,6 @@ Import-Package: com.google.common.cache,
org.eclipse.xtext.resource,
org.eclipse.zest.core.viewers,
org.eclipse.zest.core.widgets,
- org.json
+ org.json,
+ org.osgi.service.event
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAEditorArtifactEventManager.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAEditorArtifactEventManager.java
index 84132f44a4..a35a7c5810 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAEditorArtifactEventManager.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAEditorArtifactEventManager.java
@@ -49,7 +49,7 @@ import org.eclipse.osee.framework.ui.swt.Displays;
*/
public class SMAEditorArtifactEventManager implements IArtifactEventListener {
- List<ISMAEditorEventHandler> handlers = new CopyOnWriteArrayList<>();
+ static List<ISMAEditorEventHandler> handlers = new CopyOnWriteArrayList<>();
static SMAEditorArtifactEventManager instance = new SMAEditorArtifactEventManager();
private SMAEditorArtifactEventManager() {
@@ -57,12 +57,12 @@ public class SMAEditorArtifactEventManager implements IArtifactEventListener {
}
public static void add(ISMAEditorEventHandler iWorldEventHandler) {
- instance.handlers.add(iWorldEventHandler);
+ SMAEditorArtifactEventManager.handlers.add(iWorldEventHandler);
}
public static void remove(ISMAEditorEventHandler iWorldEventHandler) {
if (instance != null) {
- instance.handlers.remove(iWorldEventHandler);
+ SMAEditorArtifactEventManager.handlers.remove(iWorldEventHandler);
}
}
@@ -295,4 +295,19 @@ public class SMAEditorArtifactEventManager implements IArtifactEventListener {
return false;
}
+ public static boolean isLoaded(Artifact artifact) {
+ for (ISMAEditorEventHandler handler : handlers) {
+ try {
+ if (!handler.isDisposed()) {
+ if (artifact.equals(handler.getSMAEditor().getArtifactFromEditorInput())) {
+ return true;
+ }
+ }
+ } catch (Exception ex) {
+ OseeLog.logf(Activator.class, Level.SEVERE, ex, "Error processing event handler for - %s", handler);
+ }
+ }
+ return false;
+ }
+
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/internal/Activator.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/internal/Activator.java
index a280d5d130..8ea8e7cf3c 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/internal/Activator.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/internal/Activator.java
@@ -10,8 +10,13 @@
*******************************************************************************/
package org.eclipse.osee.ats.internal;
+import org.eclipse.osee.ats.api.util.AtsEvents;
+import org.eclipse.osee.ats.core.util.AtsUtilCore;
+import org.eclipse.osee.ats.workflow.AtsWorkItemEventHandler;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
+import org.osgi.service.event.EventConstants;
+import org.osgi.service.event.EventHandler;
/**
* @author Donald G. Dunne
@@ -21,7 +26,8 @@ public class Activator implements BundleActivator {
@Override
public void start(final BundleContext context) {
- //
+ context.registerService(EventHandler.class.getName(), new AtsWorkItemEventHandler(),
+ AtsUtilCore.hashTable(EventConstants.EVENT_TOPIC, AtsEvents.WORK_ITEM_MODIFIED));
}
@Override
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/AtsWorkItemEventHandler.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/AtsWorkItemEventHandler.java
new file mode 100644
index 0000000000..8178697774
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/AtsWorkItemEventHandler.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2015 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.ats.workflow;
+
+import org.eclipse.osee.ats.api.util.AtsEvents;
+import org.eclipse.osee.ats.core.util.AtsObjects;
+import org.eclipse.osee.ats.core.util.AtsUtilCore;
+import org.eclipse.osee.ats.editor.SMAEditorArtifactEventManager;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.ArtifactCache;
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventHandler;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsWorkItemEventHandler implements EventHandler {
+
+ @Override
+ public void handleEvent(Event event) {
+ try {
+ if (event.getTopic().equals(AtsEvents.WORK_ITEM_MODIFIED)) {
+ for (Long workItemUuid : AtsObjects.uuidsToLong(";",
+ (String) event.getProperty(AtsEvents.WORK_ITEM_UUDS))) {
+ Artifact artifact = ArtifactCache.getActive(workItemUuid, AtsUtilCore.getAtsBranch().getUuid());
+ if (artifact != null) {
+ if (SMAEditorArtifactEventManager.isLoaded(artifact)) {
+ artifact.reloadAttributesAndRelations();
+ } else {
+ ArtifactCache.deCache(artifact);
+ }
+ }
+ }
+ }
+ } catch (Exception ex) {
+ // do nothing
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/CompositeKeyHashMap.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/CompositeKeyHashMap.java
index f88fa8a8e4..ff9ea7af33 100644
--- a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/CompositeKeyHashMap.java
+++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/CompositeKeyHashMap.java
@@ -23,7 +23,7 @@ import java.util.concurrent.ConcurrentHashMap;
/**
* A hash map implementation that uses two objects to form a single composite key. The thread safety of this class is
* determined by the isThreadSafe of its constructors.
- *
+ *
* @author Ken J. Aguilar
*/
public class CompositeKeyHashMap<KeyOne, KeyTwo, Value> implements Map<Pair<KeyOne, KeyTwo>, Value> {
@@ -60,7 +60,7 @@ public class CompositeKeyHashMap<KeyOne, KeyTwo, Value> implements Map<Pair<KeyO
/**
* Use this method to determine if any puts(keyOne, anything) have occurred
- *
+ *
* @return whether the map contains the key keyOne
*/
@Override
@@ -78,7 +78,7 @@ public class CompositeKeyHashMap<KeyOne, KeyTwo, Value> implements Map<Pair<KeyO
/**
* determines if at least one of the compound keys are mapped to this value
- *
+ *
* @return whether the map contains this value
*/
@Override
@@ -91,9 +91,14 @@ public class CompositeKeyHashMap<KeyOne, KeyTwo, Value> implements Map<Pair<KeyO
return map.entrySet();
}
+ @SuppressWarnings("unchecked")
@Override
public Value get(Object key) {
- throw new UnsupportedOperationException("use getValues() instead");
+ List<Value> values = getValues((KeyOne) key);
+ if (values != null && !values.isEmpty()) {
+ return values.iterator().next();
+ }
+ return null;
}
public Map<KeyTwo, Value> getKeyedValues(KeyOne key1) {
@@ -164,9 +169,14 @@ public class CompositeKeyHashMap<KeyOne, KeyTwo, Value> implements Map<Pair<KeyO
}
}
+ @SuppressWarnings("unchecked")
@Override
public Value remove(Object key) {
- throw new UnsupportedOperationException("use removeValues() instead");
+ Collection<Value> values = removeValues((KeyOne) key);
+ if (values != null && !values.isEmpty()) {
+ return values.iterator().next();
+ }
+ return null;
}
/**
diff --git a/plugins/org.eclipse.osee.framework.messaging.event.res/src/org/eclipse/osee/framework/messaging/event/res/RemoteTopicEvent1.java b/plugins/org.eclipse.osee.framework.messaging.event.res/src/org/eclipse/osee/framework/messaging/event/res/RemoteTopicEvent1.java
new file mode 100644
index 0000000000..4ad25e0122
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.messaging.event.res/src/org/eclipse/osee/framework/messaging/event/res/RemoteTopicEvent1.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2015 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.messaging.event.res;
+
+import java.util.HashMap;
+import java.util.Map;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.osee.framework.messaging.event.res.msgs.RemoteNetworkSender1;
+
+/**
+ * @author Donald G. Dunne
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "RemoteTopicEvent1", propOrder = {"topic", "properties", "networkSender"})
+public class RemoteTopicEvent1 extends RemoteEvent {
+
+ @XmlElement(required = true)
+ protected String topic;
+ protected Map<String, String> properties = new HashMap<>();
+ @XmlElement(required = true)
+ protected RemoteNetworkSender1 networkSender;
+
+ @Override
+ public RemoteNetworkSender1 getNetworkSender() {
+ return networkSender;
+ }
+
+ public void setNetworkSender(RemoteNetworkSender1 value) {
+ this.networkSender = value;
+ }
+
+ public String getTopic() {
+ return topic;
+ }
+
+ public void setTopic(String topic) {
+ this.topic = topic;
+ }
+
+ public Map<String, String> getProperties() {
+ return properties;
+ }
+
+ public void setProperties(Map<String, String> properties) {
+ this.properties = properties;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.messaging.event.res/src/org/eclipse/osee/framework/messaging/event/res/internal/OseeCoreModelEventServiceProxy.java b/plugins/org.eclipse.osee.framework.messaging.event.res/src/org/eclipse/osee/framework/messaging/event/res/internal/OseeCoreModelEventServiceProxy.java
index 39ef8a1933..cb46573d53 100644
--- a/plugins/org.eclipse.osee.framework.messaging.event.res/src/org/eclipse/osee/framework/messaging/event/res/internal/OseeCoreModelEventServiceProxy.java
+++ b/plugins/org.eclipse.osee.framework.messaging.event.res/src/org/eclipse/osee/framework/messaging/event/res/internal/OseeCoreModelEventServiceProxy.java
@@ -43,6 +43,7 @@ public class OseeCoreModelEventServiceProxy implements IOseeCoreModelEventServic
eventMessageConfig.put(ResMessages.RemoteBranchEvent1, Boolean.TRUE);
eventMessageConfig.put(ResMessages.RemoteBroadcastEvent1, Boolean.TRUE);
eventMessageConfig.put(ResMessages.RemotePersistEvent1, Boolean.FALSE);
+ eventMessageConfig.put(ResMessages.RemoteTopicEvent1, Boolean.FALSE);
eventMessageConfig.put(ResMessages.RemoteTransactionEvent1, Boolean.TRUE);
proxiedService = new OseeCoreModelEventServiceImpl(messageService, eventMessageConfig);
diff --git a/plugins/org.eclipse.osee.framework.messaging.event.res/src/org/eclipse/osee/framework/messaging/event/res/internal/ResMessages.java b/plugins/org.eclipse.osee.framework.messaging.event.res/src/org/eclipse/osee/framework/messaging/event/res/internal/ResMessages.java
index 9200dc090b..40d9584b14 100644
--- a/plugins/org.eclipse.osee.framework.messaging.event.res/src/org/eclipse/osee/framework/messaging/event/res/internal/ResMessages.java
+++ b/plugins/org.eclipse.osee.framework.messaging.event.res/src/org/eclipse/osee/framework/messaging/event/res/internal/ResMessages.java
@@ -12,6 +12,7 @@ package org.eclipse.osee.framework.messaging.event.res.internal;
import org.eclipse.osee.framework.messaging.MessageID;
import org.eclipse.osee.framework.messaging.event.res.RemoteEvent;
+import org.eclipse.osee.framework.messaging.event.res.RemoteTopicEvent1;
import org.eclipse.osee.framework.messaging.event.res.msgs.RemoteAccessControlEvent1;
import org.eclipse.osee.framework.messaging.event.res.msgs.RemoteBranchEvent1;
import org.eclipse.osee.framework.messaging.event.res.msgs.RemoteBroadcastEvent1;
@@ -22,6 +23,7 @@ public enum ResMessages implements MessageID {
RemoteBranchEvent1(true, "Aylfa1wlKXIbX2gOrVgA", "topic:org.eclipse.osee.coverage.msgs.RemoteBranchEvent1", RemoteBranchEvent1.class, false),
RemoteBroadcastEvent1(true, "Aylfa1y3ZBSIGbVU3JgA", "topic:org.eclipse.osee.coverage.msgs.RemoteBroadcastEvent1", RemoteBroadcastEvent1.class, false),
RemotePersistEvent1(true, "AISIbRj0KGBv62x2pMAA", "topic:org.eclipse.osee.coverage.msgs.RemotePersistEvent1", RemotePersistEvent1.class, false),
+ RemoteTopicEvent1(true, "ARqNVjHQVAGmszjGOhwA", "topic:org.eclipse.osee.coverage.msgs.RemoteTopicEvent1", RemoteTopicEvent1.class, false),
RemoteTransactionEvent1(true, "AAn_QHkqUhz3vJKwp8QA", "topic:org.eclipse.osee.coverage.msgs.RemoteTransactionEvent1", RemoteTransactionEvent1.class, false),
RemoteAccessControlEvent1(true, "AFRkIhdPkwExx96ioXgA", "topic:org.eclipse.osee.coverage.msgs.RemoteAccessControlEvent1", RemoteAccessControlEvent1.class, false);
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 62d7aa0666..24b921f927 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
@@ -91,7 +91,8 @@ Import-Package: com.google.common.collect;version="15.0.0",
org.eclipse.osee.orcs.rest.client,
org.eclipse.osee.orcs.rest.model,
org.eclipse.osee.orcs.rest.model.search.artifact,
- org.eclipse.osee.orcs.transaction
+ org.eclipse.osee.orcs.transaction,
+ org.osgi.service.event
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Service-Component: OSGI-INF/*.xml
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/OSGI-INF/event.admin.xml b/plugins/org.eclipse.osee.framework.skynet.core/OSGI-INF/event.admin.xml
new file mode 100644
index 0000000000..0e40e7653a
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core/OSGI-INF/event.admin.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
+ immediate="true">
+<implementation class= "org.eclipse.osee.framework.skynet.core.internal.event.TopicEventAdmin"/>
+<reference bind="setEventAdmin" interface="org.osgi.service.event.EventAdmin"/>
+</scr:component>
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactCache.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactCache.java
index 9f7c8fc262..abebab2dce 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactCache.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactCache.java
@@ -56,7 +56,7 @@ public final class ArtifactCache {
* De-caches all artifacts from <code>HISTORICAL_CACHE</code> and <code>ACTIVE_CACHE</code> for a specific branch.
* This method is usually called by a purge operation or at the end of a unit test/suite.
* </p>
- *
+ *
* @param branch of which artifacts (all) will be de-cache'ed.
*/
public static void deCache(IOseeBranch branch) {
@@ -184,7 +184,7 @@ public final class ArtifactCache {
/**
* Return single active artifact stored by text and branch or null if none.
- *
+ *
* @throws OseeStateException if more than one artifact stored.
*/
public static Artifact getByTextId(String key, IOseeBranch branch) throws OseeCoreException {
@@ -216,4 +216,12 @@ public final class ArtifactCache {
return artifacts;
}
+ public static void deCache(Long uuid, Long branchUuid) {
+ ACTIVE_CACHE.deCache(uuid, branchUuid);
+ }
+
+ public static Artifact getActive(Long uuid, Long branchUuid) {
+ return ACTIVE_CACHE.getById(uuid.intValue(), branchUuid);
+ }
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactKey.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactKey.java
index 96a74bd463..5ad232cac6 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactKey.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactKey.java
@@ -68,4 +68,8 @@ public final class ArtifactKey {
}
return true;
}
+
+ public IOseeBranch getBranch() {
+ return branch;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/cache/ActiveArtifactCache.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/cache/ActiveArtifactCache.java
index 378cca5111..719af9e411 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/cache/ActiveArtifactCache.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/cache/ActiveArtifactCache.java
@@ -13,14 +13,17 @@ package org.eclipse.osee.framework.skynet.core.artifact.cache;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IOseeBranch;
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.OseeStateException;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.artifact.ArtifactKey;
@@ -30,19 +33,25 @@ import org.eclipse.osee.framework.skynet.core.artifact.ArtifactKey;
public class ActiveArtifactCache extends AbstractArtifactCache {
private final CompositeKeyHashMap<IArtifactType, ArtifactKey, Object> byArtifactTypeCache;
- private final CompositeKeyHashMap<String, IOseeBranch, Set<Object>> keyedArtifactCache;
+ private final CompositeKeyHashMap<String, Long, Set<Object>> keyedArtifactCache;
+ private final Map<Long, ArtifactKey> uuidToArtifactKey;
+ private final CompositeKeyHashMap<Long, Long, String> uuidBranchUuidToGuid;
public ActiveArtifactCache(int initialCapacity) {
super(initialCapacity);
byArtifactTypeCache = new CompositeKeyHashMap<>(initialCapacity, true);
-
keyedArtifactCache = new CompositeKeyHashMap<>(200, true);
+ uuidToArtifactKey = new HashMap<>(200);
+ uuidBranchUuidToGuid = new CompositeKeyHashMap<>(200, true);
}
@Override
public Object cache(Artifact artifact) {
Object object = super.cache(artifact);
- byArtifactTypeCache.put(artifact.getArtifactType(), new ArtifactKey(artifact), object);
+ ArtifactKey artifactKey = new ArtifactKey(artifact);
+ byArtifactTypeCache.put(artifact.getArtifactType(), artifactKey, object);
+ uuidToArtifactKey.put(artifact.getUuid(), artifactKey);
+ uuidBranchUuidToGuid.put(artifact.getUuid(), artifact.getBranchId(), artifact.getGuid());
return object;
}
@@ -50,6 +59,12 @@ public class ActiveArtifactCache extends AbstractArtifactCache {
public void deCache(Artifact artifact) {
super.deCache(artifact);
byArtifactTypeCache.removeAndGet(artifact.getArtifactType(), new ArtifactKey(artifact));
+ List<String> guid = uuidBranchUuidToGuid.getValues(artifact.getUuid());
+ if (guid != null && !guid.isEmpty()) {
+ keyedArtifactCache.remove(guid.iterator().next(), artifact.getBranch().getUuid());
+ }
+ uuidToArtifactKey.remove(artifact.getUuid());
+ uuidBranchUuidToGuid.remove(artifact.getUuid());
}
@Override
@@ -69,6 +84,10 @@ public class ActiveArtifactCache extends AbstractArtifactCache {
return asArtifact(getObjectByGuid(artGuid, branchUuid));
}
+ public Artifact getByUuid(Long uuid, Long branchUuid) {
+ return asArtifact(getObjectById(uuid.intValue(), branchUuid));
+ }
+
public List<Artifact> getByType(IArtifactType artifactType) {
List<Artifact> items = new ArrayList<>();
Collection<Object> cachedItems = byArtifactTypeCache.getValues(artifactType);
@@ -85,21 +104,21 @@ public class ActiveArtifactCache extends AbstractArtifactCache {
public void deCacheByText(String text, IOseeBranch branch, Artifact artifact) {
super.deCache(artifact);
- Set<Object> objects = keyedArtifactCache.get(text, branch);
+ Set<Object> objects = keyedArtifactCache.get(text, branch.getUuid());
objects.remove(artifact);
}
/**
* Return single artifact stored by text and branch or null if none.
- *
+ *
* @throws OseeStateException if more than one artifact stored.
*/
public Artifact getByText(String text, IOseeBranch branch) throws OseeCoreException {
- Set<Object> objects = keyedArtifactCache.get(text, branch);
+ Set<Object> objects = keyedArtifactCache.get(text, branch.getUuid());
if (objects != null) {
if (objects.size() > 1) {
- throw new OseeStateException(String.format("Expected only one value for [%s]; found [%d]", text,
- objects.size()));
+ throw new OseeStateException(
+ String.format("Expected only one value for [%s]; found [%d]", text, objects.size()));
} else if (objects.size() == 1) {
return asArtifact(objects.iterator().next());
}
@@ -108,7 +127,7 @@ public class ActiveArtifactCache extends AbstractArtifactCache {
}
public Collection<Artifact> getListByText(String text, IOseeBranch branch) {
- Set<Object> objects = keyedArtifactCache.get(text, branch);
+ Set<Object> objects = keyedArtifactCache.get(text, branch.getUuid());
if (objects == null) {
return Collections.emptyList();
}
@@ -121,10 +140,10 @@ public class ActiveArtifactCache extends AbstractArtifactCache {
*/
public Artifact cacheByText(String key, Artifact artifact) {
cache(artifact);
- Set<Object> objects = keyedArtifactCache.get(key, artifact.getBranch());
+ Set<Object> objects = keyedArtifactCache.get(key, artifact.getBranch().getUuid());
if (objects == null) {
objects = new HashSet<>();
- keyedArtifactCache.put(key, artifact.getBranch(), objects);
+ keyedArtifactCache.put(key, artifact.getBranch().getUuid(), objects);
}
if (objects.contains(artifact)) {
return artifact;
@@ -141,4 +160,18 @@ public class ActiveArtifactCache extends AbstractArtifactCache {
builder.append(String.format("ByText: [%s]\n", keyedArtifactCache.size()));
return builder.toString();
}
+
+ public void deCache(Long uuid, Long branchUuid) {
+ ArtifactKey artifactKey = uuidToArtifactKey.get(uuid);
+ if (artifactKey != null) {
+ IOseeBranch branch = artifactKey.getBranch();
+ keyedArtifactCache.remove(uuid, branch);
+ }
+ String guid = uuidBranchUuidToGuid.get(uuid, branchUuid);
+ if (Strings.isValid(guid)) {
+ keyedArtifactCache.removeAndGet(guid, branchUuid);
+ }
+ uuidToArtifactKey.remove(uuid);
+ uuidBranchUuidToGuid.remove(uuid, branchUuid);
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/FrameworkEventUtil.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/FrameworkEventUtil.java
index ecb44f4296..5dd96b034f 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/FrameworkEventUtil.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/FrameworkEventUtil.java
@@ -19,6 +19,8 @@ import org.eclipse.osee.framework.core.model.event.DefaultBasicUuidRelationReord
import org.eclipse.osee.framework.core.model.event.RelationOrderModType;
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.messaging.event.res.RemoteEvent;
+import org.eclipse.osee.framework.messaging.event.res.RemoteTopicEvent1;
import org.eclipse.osee.framework.messaging.event.res.msgs.RemoteAccessControlEvent1;
import org.eclipse.osee.framework.messaging.event.res.msgs.RemoteAttributeChange1;
import org.eclipse.osee.framework.messaging.event.res.msgs.RemoteBasicGuidArtifact1;
@@ -42,6 +44,7 @@ import org.eclipse.osee.framework.skynet.core.event.model.EventChangeTypeBasicGu
import org.eclipse.osee.framework.skynet.core.event.model.EventModType;
import org.eclipse.osee.framework.skynet.core.event.model.EventModifiedBasicGuidArtifact;
import org.eclipse.osee.framework.skynet.core.event.model.NetworkSender;
+import org.eclipse.osee.framework.skynet.core.event.model.TopicEvent;
import org.eclipse.osee.framework.skynet.core.event.model.TransactionChange;
import org.eclipse.osee.framework.skynet.core.event.model.TransactionEvent;
import org.eclipse.osee.framework.skynet.core.event.model.TransactionEventType;
@@ -369,4 +372,19 @@ public final class FrameworkEventUtil {
networkSender.setClientVersion(localSender.clientVersion);
return networkSender;
}
+
+ public static RemoteEvent getRemoteTopicEvent(TopicEvent event) {
+ RemoteTopicEvent1 remEvent = new RemoteTopicEvent1();
+ remEvent.setNetworkSender(getRemoteNetworkSender(event.getNetworkSender()));
+ remEvent.getProperties().putAll(event.getProperties());
+ remEvent.setTopic(event.getTopic());
+ return remEvent;
+ }
+
+ public static TopicEvent getTopicEvent(RemoteTopicEvent1 remoteEvent) {
+ TopicEvent event = new TopicEvent(remoteEvent.getTopic());
+ event.getProperties().putAll(remoteEvent.getProperties());
+ event.setNetworkSender(getNetworkSender(remoteEvent.getNetworkSender()));
+ return event;
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/OseeEventManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/OseeEventManager.java
index c677e42de7..09ef8993fd 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/OseeEventManager.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/OseeEventManager.java
@@ -31,6 +31,7 @@ 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.event.model.RemoteEventServiceEventType;
import org.eclipse.osee.framework.skynet.core.event.model.Sender;
+import org.eclipse.osee.framework.skynet.core.event.model.TopicEvent;
import org.eclipse.osee.framework.skynet.core.event.model.TransactionEvent;
import org.eclipse.osee.framework.skynet.core.internal.Activator;
import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil;
@@ -39,7 +40,7 @@ import org.eclipse.osee.framework.skynet.core.internal.event.EventListenerRegist
/**
* Front end to OSEE events. Provides ability to add and remove different event listeners as well as the ability to kick
* framework events.
- *
+ *
* @author Donald G. Dunne
*/
public final class OseeEventManager {
@@ -124,6 +125,11 @@ public final class OseeEventManager {
}
// Kick LOCAL and REMOTE transaction event
+ public static void kickTopicEvent(Object source, TopicEvent artifactEvent) throws OseeCoreException {
+ getEventService().send(source, artifactEvent);
+ }
+
+ // Kick LOCAL and REMOTE transaction event
public static void kickPersistEvent(Object source, ArtifactEvent artifactEvent) throws OseeCoreException {
getEventService().send(source, artifactEvent);
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/TopicEvent.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/TopicEvent.java
new file mode 100644
index 0000000000..dd0a5147f8
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/TopicEvent.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2015 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.event.model;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class TopicEvent implements FrameworkEvent, HasNetworkSender {
+
+ private String topic;
+ private final Map<String, String> properties;
+ private NetworkSender networkSender;
+
+ public TopicEvent(String topic) {
+ this.topic = topic;
+ properties = new HashMap<>();
+ }
+
+ public TopicEvent(String topic, String key, String value) {
+ this(topic);
+ properties.put(key, value);
+ }
+
+ public String getTopic() {
+ return topic;
+ }
+
+ public void setTopic(String topic) {
+ this.topic = topic;
+ }
+
+ public void put(String key, String value) {
+ properties.put(key, value);
+ }
+
+ @Override
+ public NetworkSender getNetworkSender() {
+ return networkSender;
+ }
+
+ @Override
+ public void setNetworkSender(NetworkSender networkSender) {
+ this.networkSender = networkSender;
+ }
+
+ public Map<String, String> getProperties() {
+ return properties;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/OseeEventServiceImpl.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/OseeEventServiceImpl.java
index 3b2d44c6b4..9dbd31cadc 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/OseeEventServiceImpl.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/OseeEventServiceImpl.java
@@ -21,6 +21,7 @@ import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.messaging.event.res.IOseeCoreModelEventService;
import org.eclipse.osee.framework.messaging.event.res.RemoteEvent;
+import org.eclipse.osee.framework.messaging.event.res.RemoteTopicEvent1;
import org.eclipse.osee.framework.messaging.event.res.msgs.RemoteAccessControlEvent1;
import org.eclipse.osee.framework.messaging.event.res.msgs.RemoteBranchEvent1;
import org.eclipse.osee.framework.messaging.event.res.msgs.RemoteBroadcastEvent1;
@@ -37,12 +38,14 @@ import org.eclipse.osee.framework.skynet.core.event.model.BranchEvent;
import org.eclipse.osee.framework.skynet.core.event.model.FrameworkEvent;
import org.eclipse.osee.framework.skynet.core.event.model.RemoteEventServiceEventType;
import org.eclipse.osee.framework.skynet.core.event.model.Sender;
+import org.eclipse.osee.framework.skynet.core.event.model.TopicEvent;
import org.eclipse.osee.framework.skynet.core.event.model.TransactionEvent;
import org.eclipse.osee.framework.skynet.core.internal.event.ConnectionListenerImpl;
import org.eclipse.osee.framework.skynet.core.internal.event.EventHandlers;
import org.eclipse.osee.framework.skynet.core.internal.event.EventListenerRegistry;
import org.eclipse.osee.framework.skynet.core.internal.event.EventTransport;
import org.eclipse.osee.framework.skynet.core.internal.event.OseeEventThreadFactory;
+import org.eclipse.osee.framework.skynet.core.internal.event.TopicEventAdmin;
import org.eclipse.osee.framework.skynet.core.internal.event.handlers.AccessControlEventHandler;
import org.eclipse.osee.framework.skynet.core.internal.event.handlers.AccessControlRemoteEventHandler;
import org.eclipse.osee.framework.skynet.core.internal.event.handlers.ArtifactEventHandler;
@@ -50,6 +53,8 @@ import org.eclipse.osee.framework.skynet.core.internal.event.handlers.ArtifactRe
import org.eclipse.osee.framework.skynet.core.internal.event.handlers.BranchEventHandler;
import org.eclipse.osee.framework.skynet.core.internal.event.handlers.BranchRemoteEventHandler;
import org.eclipse.osee.framework.skynet.core.internal.event.handlers.RemoteServiceEventHandler;
+import org.eclipse.osee.framework.skynet.core.internal.event.handlers.TopicLocalEventHandler;
+import org.eclipse.osee.framework.skynet.core.internal.event.handlers.TopicRemoteEventHandler;
import org.eclipse.osee.framework.skynet.core.internal.event.handlers.TransactionEventHandler;
import org.eclipse.osee.framework.skynet.core.internal.event.handlers.TransactionRemoteEventHandler;
import org.osgi.framework.Bundle;
@@ -137,6 +142,7 @@ public class OseeEventServiceImpl implements OseeEventService {
registerEventHandlers(handlers);
executor = createExecutor("Osee Client Events");
+ listeners.addListener(EventQosType.PRIORITY, new TopicEventAdmin());
eventTransport = new EventTransport(preferences, handlers, listeners, executor, messagingService);
connectionStatus = new ConnectionListenerImpl(preferences, eventTransport);
@@ -202,11 +208,13 @@ public class OseeEventServiceImpl implements OseeEventService {
handlers.addLocalHandler(BranchEvent.class, new BranchEventHandler());
handlers.addLocalHandler(RemoteEventServiceEventType.class, new RemoteServiceEventHandler());
handlers.addLocalHandler(TransactionEvent.class, new TransactionEventHandler());
+ handlers.addLocalHandler(TopicEvent.class, new TopicLocalEventHandler());
handlers.addRemoteHandler(RemoteAccessControlEvent1.class, new AccessControlRemoteEventHandler());
handlers.addRemoteHandler(RemotePersistEvent1.class, new ArtifactRemoteEventHandler());
handlers.addRemoteHandler(RemoteBranchEvent1.class, new BranchRemoteEventHandler());
handlers.addRemoteHandler(RemoteTransactionEvent1.class, new TransactionRemoteEventHandler());
+ handlers.addRemoteHandler(RemoteTopicEvent1.class, new TopicRemoteEventHandler());
}
private void deregisterEventHandlers(EventHandlers handlers) {
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/event/TopicEventAdmin.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/event/TopicEventAdmin.java
new file mode 100644
index 0000000000..ed8d0fb3e6
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/event/TopicEventAdmin.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2015 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.internal.event;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.osee.framework.skynet.core.event.listener.IEventListener;
+import org.eclipse.osee.framework.skynet.core.event.model.Sender;
+import org.eclipse.osee.framework.skynet.core.event.model.TopicEvent;
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventAdmin;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class TopicEventAdmin implements IEventListener {
+
+ public static EventAdmin eventAdmin;
+
+ public void setEventAdmin(EventAdmin eventAdmin) {
+ TopicEventAdmin.eventAdmin = eventAdmin;
+ }
+
+ public void handleTopicEvent(TopicEvent event, Sender sender) {
+ if (eventAdmin != null) {
+ Map<String, String> properties = new HashMap<>();
+ properties.putAll(event.getProperties());
+ Event sendEvent = new Event(event.getTopic(), properties);
+ eventAdmin.postEvent(sendEvent);
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/event/handlers/TopicLocalEventHandler.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/event/handlers/TopicLocalEventHandler.java
new file mode 100644
index 0000000000..d78c60bceb
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/event/handlers/TopicLocalEventHandler.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2015 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.internal.event.handlers;
+
+import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.event.EventUtil;
+import org.eclipse.osee.framework.skynet.core.event.FrameworkEventUtil;
+import org.eclipse.osee.framework.skynet.core.event.model.Sender;
+import org.eclipse.osee.framework.skynet.core.event.model.TopicEvent;
+import org.eclipse.osee.framework.skynet.core.internal.event.EventHandlerLocal;
+import org.eclipse.osee.framework.skynet.core.internal.event.TopicEventAdmin;
+import org.eclipse.osee.framework.skynet.core.internal.event.Transport;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class TopicLocalEventHandler implements EventHandlerLocal<TopicEventAdmin, TopicEvent> {
+
+ @Override
+ public void handle(TopicEventAdmin listener, Sender sender, TopicEvent event) {
+ EventUtil.eventLog(String.format("IEM: handleTopicEvent [%s]", event));
+ listener.handleTopicEvent(event, sender);
+ }
+
+ @Override
+ public void send(Transport transport, Sender sender, TopicEvent event) throws OseeCoreException {
+ if (transport.isDispatchToLocalAllowed(sender)) {
+ transport.sendLocal(sender, event);
+ }
+ if (sender.isLocal()) {
+ transport.sendRemote(FrameworkEventUtil.getRemoteTopicEvent(event));
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/event/handlers/TopicRemoteEventHandler.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/event/handlers/TopicRemoteEventHandler.java
new file mode 100644
index 0000000000..0888ba3960
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/event/handlers/TopicRemoteEventHandler.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2015 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.internal.event.handlers;
+
+import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.messaging.event.res.RemoteTopicEvent1;
+import org.eclipse.osee.framework.skynet.core.event.FrameworkEventUtil;
+import org.eclipse.osee.framework.skynet.core.event.model.Sender;
+import org.eclipse.osee.framework.skynet.core.event.model.TopicEvent;
+import org.eclipse.osee.framework.skynet.core.internal.event.EventHandlerRemote;
+import org.eclipse.osee.framework.skynet.core.internal.event.Transport;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class TopicRemoteEventHandler implements EventHandlerRemote<RemoteTopicEvent1> {
+
+ @Override
+ public void handle(Transport transport, Sender sender, RemoteTopicEvent1 remoteEvent) throws OseeCoreException {
+ TopicEvent event = FrameworkEventUtil.getTopicEvent(remoteEvent);
+ transport.send(sender, event);
+ }
+
+}

Back to the top