The following schema fragment specifies the expected content contained within this class.
- *
- *
artifacts;
-
- /**
- * Gets the value of the artifacts property.
- *
- *
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a set
method for the artifacts property.
- *
- *
- * For example, to add a new item, do as follows:
- *
- * getArtifacts().add(newItem);
- *
- *
- *
- *
- * Objects of the following type(s) are allowed in the list
- * {@link DefaultBasicGuidArtifact }
- *
- *
- */
- public List getArtifacts() {
- if (artifacts == null) {
- artifacts = new ArrayList();
- }
- return this.artifacts;
- }
-
-}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java
index 9ff7d71e63a..5bb5775a80b 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java
@@ -32,6 +32,7 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.osee.framework.core.data.DefaultBasicGuidArtifact;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IAttributeType;
+import org.eclipse.osee.framework.core.data.IBasicGuidArtifact;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.data.IRelationSorterId;
import org.eclipse.osee.framework.core.data.Identity;
@@ -94,7 +95,7 @@ import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager;
import org.eclipse.osee.framework.skynet.core.types.IArtifact;
import org.osgi.framework.Bundle;
-public class Artifact implements IArtifact, IAdaptable, Comparable, Named, Identity {
+public class Artifact implements IArtifact, IAdaptable, Comparable, Named, Identity, IBasicGuidArtifact {
public static final String UNNAMED = "Unnamed";
public static final String BEFORE_GUID_STRING = "/BeforeGUID/PrePend";
public static final String AFTER_GUID_STRING = "/AfterGUID";
@@ -1934,4 +1935,14 @@ public class Artifact implements IArtifact, IAdaptable, Comparable, Na
public DefaultBasicGuidArtifact getBasicGuidArtifact() {
return new DefaultBasicGuidArtifact(getBranch().getGuid(), getArtifactType().getGuid(), getGuid());
}
+
+ @Override
+ public String getArtTypeGuid() {
+ return getArtifactType().getGuid();
+ }
+
+ @Override
+ public String getBranchGuid() {
+ return getBranch().getGuid();
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTransactionData.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTransactionData.java
index 30b1bc950e6..c0fa3c61e84 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTransactionData.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTransactionData.java
@@ -11,7 +11,6 @@
package org.eclipse.osee.framework.skynet.core.artifact;
import java.util.Collection;
-import java.util.Set;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
import org.eclipse.osee.framework.core.model.TransactionRecord;
@@ -20,8 +19,7 @@ import org.eclipse.osee.framework.database.core.OseeSql;
import org.eclipse.osee.framework.skynet.core.event.ArtifactModifiedEvent;
import org.eclipse.osee.framework.skynet.core.event.ArtifactTransactionModifiedEvent;
import org.eclipse.osee.framework.skynet.core.event.Sender;
-import org.eclipse.osee.framework.skynet.core.event2.artifact.EventBasicGuidArtifact;
-import org.eclipse.osee.framework.skynet.core.event2.artifact.EventModType;
+import org.eclipse.osee.framework.skynet.core.event.msgs.TransactionEvent;
import org.eclipse.osee.framework.skynet.core.transaction.BaseTransactionData;
import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
@@ -75,25 +73,22 @@ public class ArtifactTransactionData extends BaseTransactionData {
}
@Override
- protected void internalAddToEvents(Collection events, Set artifactChanges) throws OseeCoreException {
+ protected void internalAddToEvents(Collection events, TransactionEvent transactionEvent) throws OseeCoreException {
ArtifactModType artifactModType;
- EventModType eventModType;
switch (getModificationType()) {
case MODIFIED:
artifactModType = ArtifactModType.Changed;
- eventModType = EventModType.Modified;
break;
case DELETED:
artifactModType = ArtifactModType.Deleted;
- eventModType = EventModType.Deleted;
+ transactionEvent.getDeleted().add(artifact.getBasicGuidArtifact());
break;
default:
artifactModType = ArtifactModType.Added;
- eventModType = EventModType.Added;
+ transactionEvent.getAdded().add(artifact.getBasicGuidArtifact());
break;
}
events.add(new ArtifactModifiedEvent(new Sender(this.getClass().getName()), artifactModType, artifact,
artifact.getTransactionNumber(), artifact.getDirtySkynetAttributeChanges()));
- artifactChanges.add(new EventBasicGuidArtifact(eventModType, artifact));
}
}
\ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTransactionData.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTransactionData.java
index 7987d198bbb..7c3c5166491 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTransactionData.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTransactionData.java
@@ -11,7 +11,6 @@
package org.eclipse.osee.framework.skynet.core.attribute;
import java.util.Collection;
-import java.util.Set;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
import org.eclipse.osee.framework.core.exception.OseeExceptions;
@@ -25,7 +24,7 @@ import org.eclipse.osee.framework.skynet.core.artifact.Attribute;
import org.eclipse.osee.framework.skynet.core.artifact.StaticIdManager;
import org.eclipse.osee.framework.skynet.core.attribute.utils.AttributeURL;
import org.eclipse.osee.framework.skynet.core.event.ArtifactTransactionModifiedEvent;
-import org.eclipse.osee.framework.skynet.core.event2.artifact.EventBasicGuidArtifact;
+import org.eclipse.osee.framework.skynet.core.event.msgs.TransactionEvent;
import org.eclipse.osee.framework.skynet.core.transaction.BaseTransactionData;
import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
@@ -137,6 +136,6 @@ public class AttributeTransactionData extends BaseTransactionData {
}
@Override
- protected void internalAddToEvents(Collection events, Set artifactChanges) throws OseeCoreException {
+ protected void internalAddToEvents(Collection events, TransactionEvent transactionEvent) throws OseeCoreException {
}
}
\ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/InternalEventManager2.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/InternalEventManager2.java
new file mode 100644
index 00000000000..006ce85a4db
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/InternalEventManager2.java
@@ -0,0 +1,253 @@
+/*
+ * Created on Apr 5, 2010
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.framework.skynet.core.event;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ThreadFactory;
+import java.util.logging.Level;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.event.msgs.TransactionEvent;
+import org.eclipse.osee.framework.skynet.core.event2.FrameworkEventUtil;
+import org.eclipse.osee.framework.skynet.core.event2.artifact.ArtifactEventManager;
+import org.eclipse.osee.framework.skynet.core.event2.artifact.EventBasicGuidArtifact;
+import org.eclipse.osee.framework.skynet.core.internal.Activator;
+import org.eclipse.osee.framework.ui.plugin.event.UnloadedArtifact;
+
+/**
+ * Internal implementation of OSEE Event Manager that should only be accessed from RemoteEventManager and
+ * OseeEventManager classes.
+ *
+ * @author Donald G. Dunne
+ */
+public class InternalEventManager2 {
+
+ private static final List priorityListeners = new CopyOnWriteArrayList();
+ private static final List listeners = new CopyOnWriteArrayList();
+ public static final Collection EMPTY_UNLOADED_ARTIFACTS = Collections.emptyList();
+ private static boolean disableEvents = false;
+ private static final boolean DEBUG =
+ "TRUE".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.osee.framework.skynet.core/debug/Events"));
+
+ private static final ThreadFactory threadFactory = new OseeEventThreadFactory("Osee Events2");
+ private static final ExecutorService executorService =
+ Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors(), threadFactory);
+
+ // This will disable all Local TransactionEvents and enable loopback routing of Remote TransactionEvents back
+ // through the RemoteEventService as if they came from another client. This is for testing purposes only and
+ // should be reset to false before release.
+ private static boolean enableRemoteEventLoopback = false;
+
+ private static void execute(Runnable runnable) {
+ executorService.submit(runnable);
+ }
+
+ // Kick LOCAL ArtifactReloadEvent
+ static void kickArtifactReloadEvent(final Sender sender, final Set artifactChanges) {
+ if (isDisableEvents()) {
+ return;
+ }
+ eventLog("OEM: kickArtifactReloadEvent #Reloads: " + artifactChanges.size() + " - " + sender);
+ Runnable runnable = new Runnable() {
+ public void run() {
+ try {
+ // Log if this is a loopback and what is happening
+ if (enableRemoteEventLoopback) {
+ OseeLog.log(
+ InternalEventManager.class,
+ Level.WARNING,
+ "OEM2: kickArtifactReloadEvent Loopback enabled" + (sender.isLocal() ? " - Ignoring Local Kick" : " - Kicking Local from Loopback"));
+ }
+
+ // Kick LOCAL
+ if (!enableRemoteEventLoopback) {
+ ArtifactEventManager.processArtifactChanges(sender, artifactChanges);
+ }
+ } catch (Exception ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ }
+ }
+ };
+ execute(runnable);
+ }
+
+ // Kick LOCAL and REMOTE purged event depending on sender
+ static void kickArtifactsPurgedEvent(final Sender sender, final Set artifactChanges) throws OseeCoreException {
+ if (isDisableEvents()) {
+ return;
+ }
+ eventLog("OEM2:kickArtifactsPurgedEvent " + sender + " - " + artifactChanges);
+ Runnable runnable = new Runnable() {
+ public void run() {
+ // Kick LOCAL
+ ArtifactEventManager.processArtifactChanges(sender, artifactChanges);
+
+ // Kick REMOTE (If source was Local and this was not a default branch changed event
+ try {
+ if (sender.isLocal()) {
+ RemoteEventManager2.kick(FrameworkEventUtil.getRemotePurgedArtifactsEvent(sender.getNetworkSender2(),
+ artifactChanges));
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ }
+ }
+ };
+ execute(runnable);
+ }
+
+ // // Kick LOCAL and REMOTE artifact change type depending on sender
+ // static void kickArtifactsChangeTypeEvent(final Sender sender, final Set artifactChanges, final String toArtifactTypeGuid) throws OseeCoreException {
+ // if (isDisableEvents()) {
+ // return;
+ // }
+ // eventLog("OEM2:kickArtifactsChangeTypeEvent " + sender + " - " + artifactChanges);
+ // Runnable runnable = new Runnable() {
+ // public void run() {
+ // // Kick LOCAL
+ // ArtifactEventManager.processArtifactChanges(sender, artifactChanges);
+ //
+ // // Kick REMOTE (If source was Local and this was not a default branch changed event
+ // try {
+ // if (sender.isLocal()) {
+ // RemoteEventManager2.kick(new org.eclipse.osee.framework.messaging.event.res.event.NetworkArtifactChangeTypeEvent(
+ // toArtifactTypeGuid, artifactChanges, sender.getNetworkSenderRes()));
+ // }
+ // } catch (OseeCoreException ex) {
+ // OseeLog.log(Activator.class, Level.SEVERE, ex);
+ // }
+ // }
+ // };
+ // execute(runnable);
+ // }
+
+ // Kick LOCAL and REMOTE TransactionEvent
+ static void kickTransactionEvent(final Sender sender, final TransactionEvent transEvent) {
+ if (isDisableEvents()) {
+ return;
+ }
+ eventLog("OEM2:kickTransactionEvent [" + transEvent + "] - " + sender);
+ Runnable runnable = new Runnable() {
+ public void run() {
+ // Roll-up change information
+ try {
+ // Log if this is a loopback and what is happening
+ if (enableRemoteEventLoopback) {
+ OseeLog.log(
+ InternalEventManager.class,
+ Level.WARNING,
+ "OEM2: TransactionEvent Loopback enabled" + (sender.isLocal() ? " - Ignoring Local Kick" : " - Kicking Local from Loopback"));
+ }
+
+ // Kick LOCAL
+ if (!enableRemoteEventLoopback || enableRemoteEventLoopback && sender.isRemote()) {
+ ArtifactEventManager.processArtifactChanges(sender, transEvent);
+ }
+
+ // Kick REMOTE (If source was Local and this was not a default branch changed event
+ if (sender.isLocal()) {
+ RemoteEventManager2.kick(FrameworkEventUtil.getRemoteTransactionEvent(transEvent));
+ }
+ } catch (Exception ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ }
+ }
+ };
+ execute(runnable);
+ }
+
+ /**
+ * Add a priority listener. This should only be done for caches where they need to be updated before all other
+ * listeners are called.
+ */
+ static void addPriorityListener(IEventListener listener) {
+ if (listener == null) {
+ throw new IllegalArgumentException("listener can not be null");
+ }
+ if (!priorityListeners.contains(listener)) {
+ priorityListeners.add(listener);
+ }
+ eventLog("OEM2:addPriorityListener (" + priorityListeners.size() + ") " + listener);
+ }
+
+ static void addListener(IEventListener listener) {
+ if (listener == null) {
+ throw new IllegalArgumentException("listener can not be null");
+ }
+ if (!listeners.contains(listener)) {
+ listeners.add(listener);
+ }
+ eventLog("OEM2:addListener (" + listeners.size() + ") " + listener);
+ }
+
+ static void removeListeners(IEventListener listener) {
+ eventLog("OEM2:removeListener: (" + listeners.size() + ") " + listener);
+ listeners.remove(listener);
+ priorityListeners.remove(listener);
+ }
+
+ // This method clears all listeners. Should only be used for testing purposes.
+ public static void removeAllListeners() {
+ listeners.clear();
+ priorityListeners.clear();
+ }
+
+ public static String getObjectSafeName(Object object) {
+ try {
+ return object.toString();
+ } catch (Exception ex) {
+ return object.getClass().getSimpleName() + " - exception on toString: " + ex.getLocalizedMessage();
+ }
+ }
+
+ static boolean isDisableEvents() {
+ return disableEvents;
+ }
+
+ public static void setDisableEvents(boolean disableEvents) {
+ InternalEventManager2.disableEvents = disableEvents;
+ }
+
+ static String getListenerReport() {
+ List listenerStrs = new ArrayList();
+ for (IEventListener listener : priorityListeners) {
+ listenerStrs.add("Priority: " + getObjectSafeName(listener));
+ }
+ for (IEventListener listener : listeners) {
+ listenerStrs.add(getObjectSafeName(listener));
+ }
+ String[] listArr = listenerStrs.toArray(new String[listenerStrs.size()]);
+ Arrays.sort(listArr);
+ return org.eclipse.osee.framework.jdk.core.util.Collections.toString("\n", (Object[]) listArr);
+ }
+
+ public static void eventLog(String output) {
+ try {
+ if (DEBUG) {
+ OseeLog.log(InternalEventManager.class, Level.INFO, output);
+ }
+ } catch (Exception ex) {
+ OseeLog.log(Activator.class, Level.INFO, ex);
+ }
+ }
+
+ public static boolean isEnableRemoteEventLoopback() {
+ return enableRemoteEventLoopback;
+ }
+
+ public static void setEnableRemoteEventLoopback(boolean enableRemoteEventLoopback) {
+ InternalEventManager2.enableRemoteEventLoopback = enableRemoteEventLoopback;
+ }
+}
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 5eaa02e9f78..6c68973854c 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
@@ -19,8 +19,9 @@ import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.jdk.core.util.OseeProperties;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.artifact.ArtifactModType;
-import org.eclipse.osee.framework.skynet.core.event2.InternalEventManager2;
+import org.eclipse.osee.framework.skynet.core.event.msgs.TransactionEvent;
import org.eclipse.osee.framework.skynet.core.event2.artifact.EventBasicGuidArtifact;
+import org.eclipse.osee.framework.skynet.core.event2.artifact.EventModType;
import org.eclipse.osee.framework.skynet.core.relation.RelationEventType;
import org.eclipse.osee.framework.skynet.core.relation.RelationLink;
import org.eclipse.osee.framework.skynet.core.utility.LoadedArtifacts;
@@ -123,7 +124,7 @@ public class OseeEventManager {
return;
}
InternalEventManager.kickArtifactsPurgedEvent(getSender(source), loadedArtifacts);
- // InternalEventManager2.kickArtifactsPurgedEvent(getSender(source), artifactChanges);
+ InternalEventManager2.kickArtifactsPurgedEvent(getSender(source), artifactChanges);
}
// Kick LOCAL and REMOTE artifact change type depending on sender
@@ -145,21 +146,23 @@ public class OseeEventManager {
}
// Kick LOCAL and REMOTE transaction event
- public static void kickTransactionEvent(Object source, Collection xModifiedEvents, Set artifactChanges) throws OseeAuthenticationRequiredException {
+ public static void kickTransactionEvent(Object source, Collection xModifiedEvents, TransactionEvent transactionEvent) throws OseeAuthenticationRequiredException {
if (isDisableEvents()) {
return;
}
InternalEventManager.kickTransactionEvent(getSender(source), xModifiedEvents);
- // InternalEventManager2.kickTransactionEvent(getSender(source), artifactChanges);
+ transactionEvent.setNetworkSender(getSender(source).getNetworkSender2());
+ InternalEventManager2.kickTransactionEvent(getSender(source), transactionEvent);
}
// Kick LOCAL transaction event
- public static void kickArtifactReloadEvent(Object source, Collection extends Artifact> artifacts) throws OseeAuthenticationRequiredException {
+ public static void kickArtifactReloadEvent(Object source, Collection extends Artifact> artifacts) throws OseeCoreException {
if (isDisableEvents()) {
return;
}
InternalEventManager.kickArtifactReloadEvent(getSender(source), artifacts);
- // InternalEventManager2.kickArtifactReloadEvent(getSender(source), artifacts);
+ InternalEventManager2.kickArtifactReloadEvent(getSender(source), EventBasicGuidArtifact.get(
+ EventModType.Reloaded, artifacts));
}
/**
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/RemoteEventManager2.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/RemoteEventManager2.java
new file mode 100644
index 00000000000..dd666367686
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/RemoteEventManager2.java
@@ -0,0 +1,197 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.skynet.core.event;
+
+import java.rmi.RemoteException;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.logging.Level;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.osee.framework.core.exception.OseeAuthenticationRequiredException;
+import org.eclipse.osee.framework.jdk.core.util.GUID;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.messaging.event.res.IFrameworkEventListener;
+import org.eclipse.osee.framework.messaging.event.res.RemoteEvent;
+import org.eclipse.osee.framework.messaging.event.res.msgs.RemoteBasicGuidArtifact1;
+import org.eclipse.osee.framework.messaging.event.res.msgs.RemotePurgedArtifactsEvent1;
+import org.eclipse.osee.framework.messaging.event.res.msgs.RemoteTransactionEvent1;
+import org.eclipse.osee.framework.skynet.core.event.msgs.TransactionEvent;
+import org.eclipse.osee.framework.skynet.core.event2.FrameworkEventUtil;
+import org.eclipse.osee.framework.skynet.core.event2.artifact.EventBasicGuidArtifact;
+import org.eclipse.osee.framework.skynet.core.event2.artifact.EventModType;
+import org.eclipse.osee.framework.skynet.core.internal.Activator;
+
+/**
+ * Manages remote events from the SkynetEventService.
+ *
+ * @author Donald G Dunne
+ */
+public class RemoteEventManager2 {
+ private static final RemoteEventManager2 instance = new RemoteEventManager2();
+ private final IFrameworkEventListener clientEventListener;
+
+ private RemoteEventManager2() {
+ super();
+ clientEventListener = new ClientEventListener();
+ }
+
+ private static class ClientEventListener implements IFrameworkEventListener {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void onEvent(final RemoteEvent[] events) throws RemoteException {
+ Job job = new Job("Receive Event2") {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+
+ for (RemoteEvent event : events) {
+
+ Sender sender = null;
+ try {
+ sender = new Sender(event.getNetworkSender());
+ // If the sender's sessionId is the same as this client, then this event was
+ // created in this client and returned by remote event manager; ignore and continue
+ if (sender.isLocal()) {
+ continue;
+ }
+ } catch (OseeAuthenticationRequiredException ex1) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex1);
+ continue;
+ }
+
+ if (event instanceof RemoteTransactionEvent1) {
+ try {
+ RemoteTransactionEvent1 event1 = (RemoteTransactionEvent1) event;
+ TransactionEvent transEvent = FrameworkEventUtil.getTransactionEvent(event1);
+ InternalEventManager2.kickTransactionEvent(sender, transEvent);
+ // TODO process transaction event by updating artifact/relation caches
+ } catch (Exception ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ }
+ } else if (event instanceof RemotePurgedArtifactsEvent1) {
+ try {
+ RemotePurgedArtifactsEvent1 event1 = (RemotePurgedArtifactsEvent1) event;
+ Set artifactChanges = new HashSet();
+ for (RemoteBasicGuidArtifact1 guidArt : event1.getArtifacts()) {
+ artifactChanges.add(new EventBasicGuidArtifact(EventModType.Purged,
+ FrameworkEventUtil.getBasicGuidArtifact(guidArt)));
+ }
+ // TODO process transaction event by updating artifact/relation caches
+ InternalEventManager2.kickArtifactsPurgedEvent(sender, artifactChanges);
+ } catch (Exception ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ }
+ }
+ // } else if (event instanceof NetworkArtifactChangeTypeEvent) {
+ // try {
+ // // TODO do work here to reload change type artifact if loaded
+ // InternalEventManager2.kickArtifactsChangeTypeEvent(sender, EventBasicGuidArtifact.get(
+ // EventModType.ChangeType,
+ // ((NetworkArtifactChangeTypeEvent) event).getDefaultBasicGuidArtifacts()),
+ // ((NetworkArtifactChangeTypeEvent) event).getToArtTypeGuid());
+ // } catch (Exception ex) {
+ // OseeLog.log(Activator.class, Level.SEVERE, ex);
+ // }
+ // } else if (event instanceof NetworkArtifactPurgeEvent) {
+ // try {
+ // for (DefaultBasicGuidArtifact guidArt : ((NetworkArtifactPurgeEvent) event).getDefaultBasicGuidArtifacts()) {
+ // Artifact artifact = ArtifactCache.getActive(guidArt);
+ // if (artifact != null) {
+ // //This is because applications may still have a reference to the artifact
+ // for (RelationLink link : RelationManager.getRelationsAll(artifact.getArtId(),
+ // artifact.getBranch().getId(), false)) {
+ // link.internalRemoteEventDelete();
+ // }
+ // ArtifactCache.deCache(artifact);
+ // artifact.internalSetDeleted();
+ // }
+ // }
+ // InternalEventManager2.kickArtifactsPurgedEvent(sender, EventBasicGuidArtifact.get(
+ // EventModType.Purged, ((NetworkArtifactPurgeEvent) event).getDefaultBasicGuidArtifacts()));
+ // } catch (Exception ex) {
+ // OseeLog.log(Activator.class, Level.SEVERE, ex);
+ // }
+ // }
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ job.setSystem(true);
+ job.setUser(false);
+ job.schedule();
+ }
+ };
+
+ public static void deregisterFromRemoteEventManager() {
+ }
+
+ public static void kick(RemoteEvent remoteEvent) {
+ kick(Collections.singleton(remoteEvent));
+ }
+
+ public static void kick(Collection events) {
+ kick(events.toArray(new RemoteEvent[events.size()]));
+ }
+
+ public static boolean isConnected() {
+ // TODO return if connected to event service
+ return true;
+ }
+
+ /**
+ * InternalEventManager.enableRemoteEventLoopback will enable a testing loopback that will take the kicked remote
+ * events and loop them back as if they came from an external client. It will allow for the testing of the OEM -> REM
+ * -> OEM processing. In addition, this onEvent is put in a non-display thread which will test that all handling by
+ * applications is properly handled by doing all processing and then kicking off display-thread when need to update
+ * ui. SessionId needs to be modified so this client doesn't think the events came from itself.
+ */
+ public static void kick(final RemoteEvent... events) {
+ if (isConnected()) {
+ Job job = new Job("Send Event2") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ System.err.println("Do Work here");
+ return Status.OK_STATUS;
+ }
+ };
+
+ job.schedule();
+ }
+
+ if (InternalEventManager2.isEnableRemoteEventLoopback()) {
+ OseeLog.log(Activator.class, Level.INFO, "REM2: Loopback enabled - Returning events as Remote event.");
+ Thread thread = new Thread() {
+ @Override
+ public void run() {
+ try {
+ String newSessionId = GUID.create();
+ for (RemoteEvent event : events) {
+ event.getNetworkSender().setSessionId(newSessionId);
+ }
+ instance.clientEventListener.onEvent(events);
+ } catch (RemoteException ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+
+ }
+ }
+ };
+ thread.start();
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/Sender.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/Sender.java
index 6c9114b9c49..6d26824c947 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/Sender.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/Sender.java
@@ -88,6 +88,19 @@ public class Sender {
oseeSession.getUserId(), oseeSession.getMachineIp(), oseeSession.getPort(), oseeSession.getVersion());
}
+ public org.eclipse.osee.framework.skynet.core.event.msgs.NetworkSender getNetworkSender2() {
+ org.eclipse.osee.framework.skynet.core.event.msgs.NetworkSender sender =
+ new org.eclipse.osee.framework.skynet.core.event.msgs.NetworkSender();
+ sender.setSourceObject(sourceObject);
+ sender.setSessionId(oseeSession.getId());
+ sender.setMachineName(oseeSession.getMachineName());
+ sender.setUserId(oseeSession.getUserId());
+ sender.setMachineIp(oseeSession.getMachineIp());
+ sender.setPort(oseeSession.getPort());
+ sender.setClientVersion(oseeSession.getVersion());
+ return sender;
+ }
+
public RemoteNetworkSender1 getNetworkSenderRes() {
RemoteNetworkSender1 sender = new RemoteNetworkSender1();
sender.setSourceObject(sourceObject);
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/FrameworkEventUtil.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/FrameworkEventUtil.java
index 7f3473b7ccd..f60b27dadac 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/FrameworkEventUtil.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/FrameworkEventUtil.java
@@ -5,16 +5,19 @@
*/
package org.eclipse.osee.framework.skynet.core.event2;
+import java.util.Set;
import org.eclipse.osee.framework.core.data.DefaultBasicGuidArtifact;
import org.eclipse.osee.framework.messaging.event.res.msgs.RemoteAttributeChange1;
import org.eclipse.osee.framework.messaging.event.res.msgs.RemoteBasicGuidArtifact1;
import org.eclipse.osee.framework.messaging.event.res.msgs.RemoteBasicModifiedGuidArtifact1;
import org.eclipse.osee.framework.messaging.event.res.msgs.RemoteNetworkSender1;
+import org.eclipse.osee.framework.messaging.event.res.msgs.RemotePurgedArtifactsEvent1;
import org.eclipse.osee.framework.messaging.event.res.msgs.RemoteTransactionEvent1;
import org.eclipse.osee.framework.skynet.core.event.msgs.AttributeChange;
import org.eclipse.osee.framework.skynet.core.event.msgs.BasicModifiedGuidArtifact;
import org.eclipse.osee.framework.skynet.core.event.msgs.NetworkSender;
import org.eclipse.osee.framework.skynet.core.event.msgs.TransactionEvent;
+import org.eclipse.osee.framework.skynet.core.event2.artifact.EventBasicGuidArtifact;
/**
* @author Donald G. Dunne
@@ -71,6 +74,15 @@ public class FrameworkEventUtil {
return remoteGuidArt;
}
+ public static RemotePurgedArtifactsEvent1 getRemotePurgedArtifactsEvent(NetworkSender networkSender, Set artifactChanges) {
+ RemotePurgedArtifactsEvent1 event = new RemotePurgedArtifactsEvent1();
+ event.setNetworkSender(getRemoteNetworkSender(networkSender));
+ for (EventBasicGuidArtifact guidArt : artifactChanges) {
+ event.getArtifacts().add(getRemoteBasicGuidArtifact(guidArt.getBasicGuidArtifact()));
+ }
+ return event;
+ }
+
public static BasicModifiedGuidArtifact getBasicModifiedGuidArtifact(RemoteBasicModifiedGuidArtifact1 remGuidArt) {
BasicModifiedGuidArtifact guidArt = new BasicModifiedGuidArtifact();
guidArt.setArtGuid(remGuidArt.getArtGuid());
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/InternalEventManager2.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/InternalEventManager2.java
deleted file mode 100644
index 5a46f26f066..00000000000
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/InternalEventManager2.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * Created on Apr 5, 2010
- *
- * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
- */
-package org.eclipse.osee.framework.skynet.core.event2;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ThreadFactory;
-import java.util.logging.Level;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.event.IEventListener;
-import org.eclipse.osee.framework.skynet.core.event.InternalEventManager;
-import org.eclipse.osee.framework.skynet.core.event.OseeEventThreadFactory;
-import org.eclipse.osee.framework.skynet.core.event.Sender;
-import org.eclipse.osee.framework.skynet.core.event.msgs.TransactionEvent;
-import org.eclipse.osee.framework.skynet.core.event2.artifact.ArtifactEventManager;
-import org.eclipse.osee.framework.skynet.core.internal.Activator;
-import org.eclipse.osee.framework.ui.plugin.event.UnloadedArtifact;
-
-/**
- * Internal implementation of OSEE Event Manager that should only be accessed from RemoteEventManager and
- * OseeEventManager classes.
- *
- * @author Donald G. Dunne
- */
-public class InternalEventManager2 {
-
- private static final List priorityListeners = new CopyOnWriteArrayList();
- private static final List listeners = new CopyOnWriteArrayList();
- public static final Collection EMPTY_UNLOADED_ARTIFACTS = Collections.emptyList();
- private static boolean disableEvents = false;
- private static final boolean DEBUG =
- "TRUE".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.osee.framework.skynet.core/debug/Events"));
-
- private static final ThreadFactory threadFactory = new OseeEventThreadFactory("Osee Events2");
- private static final ExecutorService executorService =
- Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors(), threadFactory);
-
- // This will disable all Local TransactionEvents and enable loopback routing of Remote TransactionEvents back
- // through the RemoteEventService as if they came from another client. This is for testing purposes only and
- // should be reset to false before release.
- private static boolean enableRemoteEventLoopback = false;
-
- private static void execute(Runnable runnable) {
- executorService.submit(runnable);
- }
-
- // // Kick LOCAL ArtifactReloadEvent
- // static void kickArtifactReloadEvent(final Sender sender, final Collection extends Artifact> artifacts) {
- // if (isDisableEvents()) {
- // return;
- // }
- // eventLog("OEM: kickArtifactReloadEvent #Reloads: " + artifacts.size() + " - " + sender);
- // Runnable runnable = new Runnable() {
- // public void run() {
- // try {
- // // Log if this is a loopback and what is happening
- // if (enableRemoteEventLoopback) {
- // OseeLog.log(
- // InternalEventManager.class,
- // Level.WARNING,
- // "OEM2: kickArtifactReloadEvent Loopback enabled" + (sender.isLocal() ? " - Ignoring Local Kick" : " - Kicking Local from Loopback"));
- // }
- //
- // // Kick LOCAL
- // if (!enableRemoteEventLoopback) {
- // Set artifactChanges = new HashSet();
- // for (Artifact artifact : artifacts) {
- // artifactChanges.add(new EventBasicGuidArtifact(EventModType.Reloaded, artifact));
- // }
- // ArtifactEventManager.processArtifactChanges(sender, artifactChanges);
- // }
- // } catch (Exception ex) {
- // OseeLog.log(Activator.class, Level.SEVERE, ex);
- // }
- // }
- // };
- // execute(runnable);
- // }
-
- // Kick LOCAL and REMOTE purged event depending on sender
- // static void kickArtifactsPurgedEvent(final Sender sender, final Set artifactChanges) throws OseeCoreException {
- // if (isDisableEvents()) {
- // return;
- // }
- // eventLog("OEM2:kickArtifactsPurgedEvent " + sender + " - " + artifactChanges);
- // Runnable runnable = new Runnable() {
- // public void run() {
- // // Kick LOCAL
- // ArtifactEventManager.processArtifactChanges(sender, artifactChanges);
- //
- // // Kick REMOTE (If source was Local and this was not a default branch changed event
- // try {
- // if (sender.isLocal()) {
- // RemoteEventManager2.kick(new org.eclipse.osee.framework.messaging.event.res.event.NetworkArtifactPurgeEvent(
- // artifactChanges, sender.getNetworkSenderRes()));
- // }
- // } catch (OseeCoreException ex) {
- // OseeLog.log(Activator.class, Level.SEVERE, ex);
- // }
- // }
- // };
- // execute(runnable);
- // }
- //
- // // Kick LOCAL and REMOTE artifact change type depending on sender
- // static void kickArtifactsChangeTypeEvent(final Sender sender, final Set artifactChanges, final String toArtifactTypeGuid) throws OseeCoreException {
- // if (isDisableEvents()) {
- // return;
- // }
- // eventLog("OEM2:kickArtifactsChangeTypeEvent " + sender + " - " + artifactChanges);
- // Runnable runnable = new Runnable() {
- // public void run() {
- // // Kick LOCAL
- // ArtifactEventManager.processArtifactChanges(sender, artifactChanges);
- //
- // // Kick REMOTE (If source was Local and this was not a default branch changed event
- // try {
- // if (sender.isLocal()) {
- // RemoteEventManager2.kick(new org.eclipse.osee.framework.messaging.event.res.event.NetworkArtifactChangeTypeEvent(
- // toArtifactTypeGuid, artifactChanges, sender.getNetworkSenderRes()));
- // }
- // } catch (OseeCoreException ex) {
- // OseeLog.log(Activator.class, Level.SEVERE, ex);
- // }
- // }
- // };
- // execute(runnable);
- // }
-
- // Kick LOCAL and REMOTE TransactionEvent
- static void kickTransactionEvent(final Sender sender, final TransactionEvent transEvent) {
- if (isDisableEvents()) {
- return;
- }
- eventLog("OEM2:kickTransactionEvent [" + transEvent + "] - " + sender);
- Runnable runnable = new Runnable() {
- public void run() {
- // Roll-up change information
- try {
- // Log if this is a loopback and what is happening
- if (enableRemoteEventLoopback) {
- OseeLog.log(
- InternalEventManager.class,
- Level.WARNING,
- "OEM2: TransactionEvent Loopback enabled" + (sender.isLocal() ? " - Ignoring Local Kick" : " - Kicking Local from Loopback"));
- }
-
- // Kick LOCAL
- if (!enableRemoteEventLoopback || enableRemoteEventLoopback && sender.isRemote()) {
- ArtifactEventManager.processArtifactChanges(sender, transEvent);
- }
-
- // Kick REMOTE (If source was Local and this was not a default branch changed event
- if (sender.isLocal()) {
- RemoteEventManager2.kick(FrameworkEventUtil.getRemoteTransactionEvent(transEvent));
- }
- } catch (Exception ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- }
- };
- execute(runnable);
- }
-
- /**
- * Add a priority listener. This should only be done for caches where they need to be updated before all other
- * listeners are called.
- */
- static void addPriorityListener(IEventListener listener) {
- if (listener == null) {
- throw new IllegalArgumentException("listener can not be null");
- }
- if (!priorityListeners.contains(listener)) {
- priorityListeners.add(listener);
- }
- eventLog("OEM2:addPriorityListener (" + priorityListeners.size() + ") " + listener);
- }
-
- static void addListener(IEventListener listener) {
- if (listener == null) {
- throw new IllegalArgumentException("listener can not be null");
- }
- if (!listeners.contains(listener)) {
- listeners.add(listener);
- }
- eventLog("OEM2:addListener (" + listeners.size() + ") " + listener);
- }
-
- static void removeListeners(IEventListener listener) {
- eventLog("OEM2:removeListener: (" + listeners.size() + ") " + listener);
- listeners.remove(listener);
- priorityListeners.remove(listener);
- }
-
- // This method clears all listeners. Should only be used for testing purposes.
- public static void removeAllListeners() {
- listeners.clear();
- priorityListeners.clear();
- }
-
- public static String getObjectSafeName(Object object) {
- try {
- return object.toString();
- } catch (Exception ex) {
- return object.getClass().getSimpleName() + " - exception on toString: " + ex.getLocalizedMessage();
- }
- }
-
- static boolean isDisableEvents() {
- return disableEvents;
- }
-
- public static void setDisableEvents(boolean disableEvents) {
- InternalEventManager2.disableEvents = disableEvents;
- }
-
- static String getListenerReport() {
- List listenerStrs = new ArrayList();
- for (IEventListener listener : priorityListeners) {
- listenerStrs.add("Priority: " + getObjectSafeName(listener));
- }
- for (IEventListener listener : listeners) {
- listenerStrs.add(getObjectSafeName(listener));
- }
- String[] listArr = listenerStrs.toArray(new String[listenerStrs.size()]);
- Arrays.sort(listArr);
- return org.eclipse.osee.framework.jdk.core.util.Collections.toString("\n", (Object[]) listArr);
- }
-
- public static void eventLog(String output) {
- try {
- if (DEBUG) {
- OseeLog.log(InternalEventManager.class, Level.INFO, output);
- }
- } catch (Exception ex) {
- OseeLog.log(Activator.class, Level.INFO, ex);
- }
- }
-
- public static boolean isEnableRemoteEventLoopback() {
- return enableRemoteEventLoopback;
- }
-
- public static void setEnableRemoteEventLoopback(boolean enableRemoteEventLoopback) {
- InternalEventManager2.enableRemoteEventLoopback = enableRemoteEventLoopback;
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/RemoteEventManager2.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/RemoteEventManager2.java
deleted file mode 100644
index 45f5e870e01..00000000000
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/RemoteEventManager2.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.skynet.core.event2;
-
-import java.rmi.RemoteException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.logging.Level;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.osee.framework.core.exception.OseeAuthenticationRequiredException;
-import org.eclipse.osee.framework.jdk.core.util.GUID;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.messaging.event.res.IFrameworkEventListener;
-import org.eclipse.osee.framework.messaging.event.res.RemoteEvent;
-import org.eclipse.osee.framework.messaging.event.res.msgs.RemoteTransactionEvent1;
-import org.eclipse.osee.framework.skynet.core.event.Sender;
-import org.eclipse.osee.framework.skynet.core.event.msgs.TransactionEvent;
-import org.eclipse.osee.framework.skynet.core.internal.Activator;
-
-/**
- * Manages remote events from the SkynetEventService.
- *
- * @author Donald G Dunne
- */
-public class RemoteEventManager2 {
- private static final RemoteEventManager2 instance = new RemoteEventManager2();
- private final IFrameworkEventListener clientEventListener;
-
- private RemoteEventManager2() {
- super();
- clientEventListener = new ClientEventListener();
- }
-
- private static class ClientEventListener implements IFrameworkEventListener {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public void onEvent(final RemoteEvent[] events) throws RemoteException {
- Job job = new Job("Receive Event2") {
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
-
- for (RemoteEvent event : events) {
-
- Sender sender = null;
- try {
- sender = new Sender(event.getNetworkSender());
- // If the sender's sessionId is the same as this client, then this event was
- // created in this client and returned by remote event manager; ignore and continue
- if (sender.isLocal()) {
- continue;
- }
- } catch (OseeAuthenticationRequiredException ex1) {
- OseeLog.log(Activator.class, Level.SEVERE, ex1);
- continue;
- }
-
- if (event instanceof RemoteTransactionEvent1) {
- try {
- RemoteTransactionEvent1 event1 = (RemoteTransactionEvent1) event;
- TransactionEvent transEvent = FrameworkEventUtil.getTransactionEvent(event1);
- InternalEventManager2.kickTransactionEvent(sender, transEvent);
- } catch (Exception ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- }
- // else if (event instanceof NetworkArtifactDeletedEvent) {
- // try {
- // for (DefaultBasicGuidArtifact guidArt : ((NetworkArtifactDeletedEvent) event).getDefaultBasicGuidArtifacts()) {
- // artifactChanges.add(new EventBasicGuidArtifact(EventModType.Deleted, guidArt));
- // Artifact cacheArtifact = ArtifactCache.getActive(guidArt);
- // RemoteEventManager.internalHandleRemoteArtifactDeleted(cacheArtifact);
- // }
- // lastArtifactRelationModChangeSender = sender;
- // } catch (Exception ex) {
- // OseeLog.log(Activator.class, Level.SEVERE, ex);
- // }
- // } else if (event instanceof NetworkArtifactModifiedEvent) {
- // try {
- // for (DefaultBasicGuidArtifact guidArt : ((NetworkArtifactModifiedEvent) event).getDefaultBasicGuidArtifacts()) {
- // artifactChanges.add(new EventBasicGuidArtifact(EventModType.Modified, guidArt));
- // Artifact cacheArtifact = ArtifactCache.getActive(guidArt);
- // RemoteEventManager.internalHandleRemoteArtifactModified(cacheArtifact);
- // }
- // lastArtifactRelationModChangeSender = sender;
- // } catch (Exception ex) {
- // OseeLog.log(Activator.class, Level.SEVERE, ex);
- // }
- // } else if (event instanceof NetworkArtifactChangeTypeEvent) {
- // try {
- // // TODO do work here to reload change type artifact if loaded
- // InternalEventManager2.kickArtifactsChangeTypeEvent(sender, EventBasicGuidArtifact.get(
- // EventModType.ChangeType,
- // ((NetworkArtifactChangeTypeEvent) event).getDefaultBasicGuidArtifacts()),
- // ((NetworkArtifactChangeTypeEvent) event).getToArtTypeGuid());
- // } catch (Exception ex) {
- // OseeLog.log(Activator.class, Level.SEVERE, ex);
- // }
- // } else if (event instanceof NetworkArtifactPurgeEvent) {
- // try {
- // for (DefaultBasicGuidArtifact guidArt : ((NetworkArtifactPurgeEvent) event).getDefaultBasicGuidArtifacts()) {
- // Artifact artifact = ArtifactCache.getActive(guidArt);
- // if (artifact != null) {
- // //This is because applications may still have a reference to the artifact
- // for (RelationLink link : RelationManager.getRelationsAll(artifact.getArtId(),
- // artifact.getBranch().getId(), false)) {
- // link.internalRemoteEventDelete();
- // }
- // ArtifactCache.deCache(artifact);
- // artifact.internalSetDeleted();
- // }
- // }
- // InternalEventManager2.kickArtifactsPurgedEvent(sender, EventBasicGuidArtifact.get(
- // EventModType.Purged, ((NetworkArtifactPurgeEvent) event).getDefaultBasicGuidArtifacts()));
- // } catch (Exception ex) {
- // OseeLog.log(Activator.class, Level.SEVERE, ex);
- // }
- // }
- }
- return Status.OK_STATUS;
- }
- };
- job.setSystem(true);
- job.setUser(false);
- job.schedule();
- }
- };
-
- public static void deregisterFromRemoteEventManager() {
- }
-
- public static void kick(RemoteEvent remoteEvent) {
- kick(Collections.singleton(remoteEvent));
- }
-
- public static void kick(Collection events) {
- kick(events.toArray(new RemoteEvent[events.size()]));
- }
-
- public static boolean isConnected() {
- // TODO return if connected to event service
- return true;
- }
-
- /**
- * InternalEventManager.enableRemoteEventLoopback will enable a testing loopback that will take the kicked remote
- * events and loop them back as if they came from an external client. It will allow for the testing of the OEM -> REM
- * -> OEM processing. In addition, this onEvent is put in a non-display thread which will test that all handling by
- * applications is properly handled by doing all processing and then kicking off display-thread when need to update
- * ui. SessionId needs to be modified so this client doesn't think the events came from itself.
- */
- public static void kick(final RemoteEvent... events) {
- if (isConnected()) {
- Job job = new Job("Send Event2") {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- System.err.println("Do Work here");
- return Status.OK_STATUS;
- }
- };
-
- job.schedule();
- }
-
- if (InternalEventManager2.isEnableRemoteEventLoopback()) {
- OseeLog.log(Activator.class, Level.INFO, "REM2: Loopback enabled - Returning events as Remote event.");
- Thread thread = new Thread() {
- @Override
- public void run() {
- try {
- String newSessionId = GUID.create();
- for (RemoteEvent event : events) {
- event.getNetworkSender().setSessionId(newSessionId);
- }
- instance.clientEventListener.onEvent(events);
- } catch (RemoteException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
-
- }
- }
- };
- thread.start();
- }
- }
-
-}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/artifact/EventBasicGuidArtifact.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/artifact/EventBasicGuidArtifact.java
index c085e0a4be1..826105bf110 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/artifact/EventBasicGuidArtifact.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/artifact/EventBasicGuidArtifact.java
@@ -64,6 +64,10 @@ public class EventBasicGuidArtifact extends DefaultBasicGuidArtifact {
return eventArts;
}
+ public DefaultBasicGuidArtifact getBasicGuidArtifact() {
+ return new DefaultBasicGuidArtifact(getBranchGuid(), getArtTypeGuid(), getGuid());
+ }
+
@Override
public int hashCode() {
final int prime = 31;
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationTransactionData.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationTransactionData.java
index 9e1ede4d51a..451ba726d83 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationTransactionData.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationTransactionData.java
@@ -11,7 +11,6 @@
package org.eclipse.osee.framework.skynet.core.relation;
import java.util.Collection;
-import java.util.Set;
import org.eclipse.osee.framework.core.enums.ModificationType;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
@@ -21,7 +20,7 @@ import org.eclipse.osee.framework.database.core.OseeSql;
import org.eclipse.osee.framework.skynet.core.event.ArtifactTransactionModifiedEvent;
import org.eclipse.osee.framework.skynet.core.event.RelationModifiedEvent;
import org.eclipse.osee.framework.skynet.core.event.Sender;
-import org.eclipse.osee.framework.skynet.core.event2.artifact.EventBasicGuidArtifact;
+import org.eclipse.osee.framework.skynet.core.event.msgs.TransactionEvent;
import org.eclipse.osee.framework.skynet.core.transaction.BaseTransactionData;
import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
@@ -81,7 +80,7 @@ public class RelationTransactionData extends BaseTransactionData {
}
@Override
- protected void internalAddToEvents(Collection events, Set artifactChanges) throws OseeCoreException {
+ protected void internalAddToEvents(Collection events, TransactionEvent transactionEvent) throws OseeCoreException {
RelationEventType relationEventType =
getModificationType().isDeleted() ? RelationEventType.Deleted : RelationEventType.Added;
events.add(new RelationModifiedEvent(new Sender(this.getClass().getName()), relationEventType, relation,
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/BaseTransactionData.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/BaseTransactionData.java
index e8bae052a6f..d8d17fe533c 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/BaseTransactionData.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/BaseTransactionData.java
@@ -11,14 +11,13 @@
package org.eclipse.osee.framework.skynet.core.transaction;
import java.util.Collection;
-import java.util.Set;
import org.eclipse.osee.framework.core.enums.ModificationType;
import org.eclipse.osee.framework.core.enums.TxChange;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.database.core.OseeSql;
import org.eclipse.osee.framework.skynet.core.event.ArtifactTransactionModifiedEvent;
-import org.eclipse.osee.framework.skynet.core.event2.artifact.EventBasicGuidArtifact;
+import org.eclipse.osee.framework.skynet.core.event.msgs.TransactionEvent;
/**
* @author Jeff C. Phillips
@@ -119,6 +118,8 @@ public abstract class BaseTransactionData {
/**
* Should not be called by application. This should only be called once after the transaction has been committed.
+ *
+ * @param transactionEvent TODO
*/
- protected abstract void internalAddToEvents(Collection events, Set artifactChanges) throws OseeCoreException;
+ protected abstract void internalAddToEvents(Collection events, TransactionEvent transactionEvent) throws OseeCoreException;
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/SkynetTransaction.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/SkynetTransaction.java
index 06eed2eb800..3ad7bc4de75 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/SkynetTransaction.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/SkynetTransaction.java
@@ -49,8 +49,9 @@ import org.eclipse.osee.framework.skynet.core.event.ArtifactModifiedEvent;
import org.eclipse.osee.framework.skynet.core.event.ArtifactTransactionModifiedEvent;
import org.eclipse.osee.framework.skynet.core.event.OseeEventManager;
import org.eclipse.osee.framework.skynet.core.event.Sender;
-import org.eclipse.osee.framework.skynet.core.event2.artifact.EventBasicGuidArtifact;
-import org.eclipse.osee.framework.skynet.core.event2.artifact.EventModifiedBasicGuidArtifact;
+import org.eclipse.osee.framework.skynet.core.event.msgs.AttributeChange;
+import org.eclipse.osee.framework.skynet.core.event.msgs.BasicModifiedGuidArtifact;
+import org.eclipse.osee.framework.skynet.core.event.msgs.TransactionEvent;
import org.eclipse.osee.framework.skynet.core.internal.Activator;
import org.eclipse.osee.framework.skynet.core.relation.RelationLink;
import org.eclipse.osee.framework.skynet.core.relation.RelationTransactionData;
@@ -377,7 +378,7 @@ public class SkynetTransaction extends DbTransaction {
private void updateModifiedCachedObject() throws OseeCoreException {
Collection xModifiedEvents = new ArrayList();
- Set artifactChanges = new HashSet();
+ TransactionEvent transactionEvent = new TransactionEvent();
// Update all transaction items before collecting events
for (BaseTransactionData transactionData : transactionDataItems.values()) {
@@ -386,7 +387,7 @@ public class SkynetTransaction extends DbTransaction {
// Collect events before clearing any dirty flags
for (BaseTransactionData transactionData : transactionDataItems.values()) {
- transactionData.internalAddToEvents(xModifiedEvents, artifactChanges);
+ transactionData.internalAddToEvents(xModifiedEvents, transactionEvent);
}
for (Artifact artifact : artifactReferences) {
@@ -394,8 +395,14 @@ public class SkynetTransaction extends DbTransaction {
xModifiedEvents.add(new ArtifactModifiedEvent(new Sender(this.getClass().getName()),
ArtifactModType.Changed, artifact, artifact.getTransactionNumber(),
artifact.getDirtySkynetAttributeChanges()));
- artifactChanges.add(new EventModifiedBasicGuidArtifact(artifact,
- artifact.getDirtyFrameworkAttributeChanges()));
+ BasicModifiedGuidArtifact basicModifiedGuidArtifact = new BasicModifiedGuidArtifact();
+ basicModifiedGuidArtifact.setBranchGuid(artifact.getBranch().getGuid());
+ basicModifiedGuidArtifact.setArtTypeGuid(artifact.getArtifactType().getGuid());
+ basicModifiedGuidArtifact.setArtGuid(artifact.getGuid());
+ for (AttributeChange attributeChange : artifact.getDirtyFrameworkAttributeChanges()) {
+ basicModifiedGuidArtifact.getAttributes().add(attributeChange);
+ }
+ transactionEvent.getModified().add(basicModifiedGuidArtifact);
}
}
// Clear all dirty flags
@@ -404,7 +411,7 @@ public class SkynetTransaction extends DbTransaction {
}
if (xModifiedEvents.size() > 0) {
- OseeEventManager.kickTransactionEvent(this, xModifiedEvents, artifactChanges);
+ OseeEventManager.kickTransactionEvent(this, xModifiedEvents, transactionEvent);
xModifiedEvents.clear();
}
}
diff --git a/plugins/org.eclipse.osee.support.test/src/org/eclipse/osee/support/test/MasterTestSuite_TestDbTests.java b/plugins/org.eclipse.osee.support.test/src/org/eclipse/osee/support/test/MasterTestSuite_TestDbTests.java
index 53b403eca76..3966b3b29e3 100644
--- a/plugins/org.eclipse.osee.support.test/src/org/eclipse/osee/support/test/MasterTestSuite_TestDbTests.java
+++ b/plugins/org.eclipse.osee.support.test/src/org/eclipse/osee/support/test/MasterTestSuite_TestDbTests.java
@@ -14,6 +14,7 @@ import static org.junit.Assert.assertTrue;
import org.eclipse.osee.ats.test.AtsTest_TestDb_Suite;
import org.eclipse.osee.framework.core.client.ClientSessionManager;
import org.eclipse.osee.framework.messaging.event.res.test.FrameworkRes_TestDb_Suite;
+import org.eclipse.osee.framework.skynet.core.test.FrameworkCore_TestDb_Suite;
import org.eclipse.osee.framework.skynet.core.test.cases.ArtifactQueryTestDemo;
import org.eclipse.osee.framework.ui.skynet.test.FrameworkUi_TestDb_Suite;
import org.eclipse.osee.support.test.util.TestUtil;
@@ -23,8 +24,8 @@ import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@RunWith(Suite.class)
-@Suite.SuiteClasses( {FrameworkRes_TestDb_Suite.class, ArtifactQueryTestDemo.class, AtsTest_TestDb_Suite.class,
- FrameworkUi_TestDb_Suite.class})
+@Suite.SuiteClasses( {FrameworkRes_TestDb_Suite.class, FrameworkCore_TestDb_Suite.class, ArtifactQueryTestDemo.class,
+ AtsTest_TestDb_Suite.class, FrameworkUi_TestDb_Suite.class})
/**
* This Test Suite is to run against a postgres database with ATS Developer as the DbInit.
*
--
cgit v1.2.3