diff options
author | ddunne | 2010-04-07 15:46:59 +0000 |
---|---|---|
committer | ddunne | 2010-04-07 15:46:59 +0000 |
commit | 6432c06c8d9194c36e448d6a70279d9037746fcf (patch) | |
tree | e4a20520575f44f606b8e1924fe938b04a1fc064 | |
parent | 36b5b69f6b9be61f719e8186f9ba4a3dc5937bd0 (diff) | |
download | org.eclipse.osee-6432c06c8d9194c36e448d6a70279d9037746fcf.tar.gz org.eclipse.osee-6432c06c8d9194c36e448d6a70279d9037746fcf.tar.xz org.eclipse.osee-6432c06c8d9194c36e448d6a70279d9037746fcf.zip |
coverage events
13 files changed, 230 insertions, 43 deletions
diff --git a/plugins/org.eclipse.osee.framework.messaging.event.res/src/org/eclipse/osee/framework/messaging/event/res/event/NetworkArtifactModifiedEvent.java b/plugins/org.eclipse.osee.framework.messaging.event.res/src/org/eclipse/osee/framework/messaging/event/res/event/NetworkArtifactModifiedEvent.java index c0e4b00fd34..d5acddaab46 100644 --- a/plugins/org.eclipse.osee.framework.messaging.event.res/src/org/eclipse/osee/framework/messaging/event/res/event/NetworkArtifactModifiedEvent.java +++ b/plugins/org.eclipse.osee.framework.messaging.event.res/src/org/eclipse/osee/framework/messaging/event/res/event/NetworkArtifactModifiedEvent.java @@ -26,11 +26,6 @@ public class NetworkArtifactModifiedEvent extends FrameworkArtifactEventBase { this.attributeChanges = attributeChanges; } - public NetworkArtifactModifiedEvent(NetworkArtifactModifiedEvent base) { - super(base); - this.attributeChanges = base.getAttributeChanges(); - } - public Collection<AttributeChange> getAttributeChanges() { return attributeChanges; } diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/event/ArtifactEventManagerTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/event/ArtifactEventManagerTest.java index 5b7b003d898..c59a025e356 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/event/ArtifactEventManagerTest.java +++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/event/ArtifactEventManagerTest.java @@ -40,7 +40,8 @@ public class ArtifactEventManagerTest { final Set<EventBasicGuidArtifact> resultEventArtifacts = new HashSet<EventBasicGuidArtifact>();
public static Sender resultSender = null;
public static List<String> ignoreLogging =
- Arrays.asList("OEM: TransactionEvent Loopback enabled", "OEM: kickArtifactReloadEvent Loopback enabled");
+ Arrays.asList("OEM: TransactionEvent Loopback enabled", "OEM: kickArtifactReloadEvent Loopback enabled",
+ "OEM2: TransactionEvent Loopback enabled", "OEM2: kickArtifactReloadEvent Loopback enabled");
public class ArtifactEventListener implements IArtifactListener {
@Override
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 eef293d9f88..5efc9c7c122 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 @@ -12,7 +12,8 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.osee.framework.jini,
org.eclipse.osee.framework.jdk.core,
org.eclipse.osee.framework.messaging.event.skynet,
- org.eclipse.osee.framework.database
+ org.eclipse.osee.framework.database,
+ org.eclipse.osee.framework.messaging.event.res;bundle-version="0.9.4"
Export-Package: org.eclipse.osee.framework.skynet.core,
org.eclipse.osee.framework.skynet.core.access,
org.eclipse.osee.framework.skynet.core.artifact,
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 049ee46a8a2..2ee938cc4a3 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 @@ -14,6 +14,7 @@ import java.util.ArrayList; import java.util.Collection;
import java.util.List;
import org.eclipse.osee.framework.core.data.IArtifactType;
+import org.eclipse.osee.framework.core.data.IBasicGuidArtifact;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.exception.OseeArgumentException;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
@@ -137,6 +138,11 @@ public final class ArtifactCache { return HISTORICAL_CACHE.getByGuid(guid, transactionNumber);
}
+ public static Artifact getActive(IBasicGuidArtifact basicGuidArtifact) throws OseeCoreException {
+ return ACTIVE_CACHE.getByGuid(basicGuidArtifact.getGuid(),
+ BranchManager.getBranchByGuid(basicGuidArtifact.getBranchGuid()));
+ }
+
public static Artifact getActive(Integer artId, Branch branch) {
return getActive(artId, branch.getId());
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/InternalEventManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/InternalEventManager.java index a437596e5fe..9bb5295adc8 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/InternalEventManager.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/InternalEventManager.java @@ -78,7 +78,7 @@ public class InternalEventManager { // 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.
- public static final boolean enableRemoteEventLoopback = false;
+ private static boolean enableRemoteEventLoopback = false;
private static final boolean DEBUG = true;
@@ -814,4 +814,12 @@ public class InternalEventManager { OseeLog.log(Activator.class, Level.INFO, ex);
}
}
+
+ public static boolean isEnableRemoteEventLoopback() {
+ return enableRemoteEventLoopback;
+ }
+
+ public static void setEnableRemoteEventLoopback(boolean enableRemoteEventLoopback) {
+ InternalEventManager.enableRemoteEventLoopback = enableRemoteEventLoopback;
+ }
}
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 index 0f5e41be5c8..63080348692 100644 --- 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 @@ -9,6 +9,7 @@ import java.util.ArrayList; import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
+import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
@@ -19,6 +20,7 @@ import java.util.logging.Level; import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.messaging.event.res.IFrameworkEvent;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.event.artifact.ArtifactEventManager;
import org.eclipse.osee.framework.skynet.core.event.artifact.EventBasicGuidArtifact;
import org.eclipse.osee.framework.skynet.core.event.artifact.EventModType;
@@ -56,6 +58,39 @@ public class InternalEventManager2 { 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<EventBasicGuidArtifact> artifactChanges = new HashSet<EventBasicGuidArtifact>();
+ 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<EventBasicGuidArtifact> artifactChanges) throws OseeCoreException {
if (isDisableEvents()) {
@@ -107,7 +142,7 @@ public class InternalEventManager2 { }
// Kick LOCAL and REMOTE TransactionEvent
- static void kickTransactionEvent(final Sender sender, final Set<EventBasicGuidArtifact> artifactChanges) {
+ static void kickTransactionEvent(final Sender sender, final Collection<EventBasicGuidArtifact> artifactChanges) {
if (isDisableEvents()) {
return;
}
@@ -121,7 +156,7 @@ public class InternalEventManager2 { OseeLog.log(
InternalEventManager.class,
Level.WARNING,
- "OEM2:TransactionEvent Loopback enabled" + (sender.isLocal() ? " - Ignoring Local Kick" : " - Kicking Local from Loopback"));
+ "OEM2: TransactionEvent Loopback enabled" + (sender.isLocal() ? " - Ignoring Local Kick" : " - Kicking Local from Loopback"));
}
// Kick LOCAL
@@ -142,7 +177,7 @@ public class InternalEventManager2 { execute(runnable);
}
- private static List<IFrameworkEvent> generateNetworkFrameworkEvents(Sender sender, Set<EventBasicGuidArtifact> artifactChanges) {
+ private static List<IFrameworkEvent> generateNetworkFrameworkEvents(Sender sender, Collection<EventBasicGuidArtifact> artifactChanges) {
List<IFrameworkEvent> events = new ArrayList<IFrameworkEvent>();
for (EventBasicGuidArtifact artifactChange : artifactChanges) {
events.add(generateNetworkSkynetArtifactEvent(artifactChange, sender));
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 61515055a42..2472fe81c75 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 @@ -158,6 +158,7 @@ public class OseeEventManager { return;
}
InternalEventManager.kickArtifactReloadEvent(getSender(source), artifacts);
+ InternalEventManager2.kickArtifactReloadEvent(getSender(source), artifacts);
}
/**
@@ -183,6 +184,7 @@ public class OseeEventManager { // Turn off all event processing including LOCAL and REMOTE
public static void setDisableEvents(boolean disableEvents) {
InternalEventManager.setDisableEvents(disableEvents);
+ InternalEventManager2.setDisableEvents(disableEvents);
}
// Return report showing all listeners registered
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/RemoteEventManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/RemoteEventManager.java index c19f916328d..a5d429de966 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/RemoteEventManager.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/RemoteEventManager.java @@ -163,7 +163,7 @@ public class RemoteEventManager { * 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.
*/
- if (InternalEventManager.enableRemoteEventLoopback) {
+ if (InternalEventManager.isEnableRemoteEventLoopback()) {
OseeLog.log(Activator.class, Level.INFO, "REM: Loopback enabled - Returning events as Remote event.");
Thread thread = new Thread() {
@Override
@@ -516,7 +516,7 @@ public class RemoteEventManager { xModifiedEvents.add(new ArtifactModifiedEvent(sender, ArtifactModType.Changed, unloadedArtifact));
} else if (!artifact.isHistorical()) {
for (SkynetAttributeChange skynetAttributeChange : ((NetworkArtifactModifiedEvent) event).getAttributeChanges()) {
- if (!InternalEventManager.enableRemoteEventLoopback) {
+ if (!InternalEventManager.isEnableRemoteEventLoopback()) {
try {
Attribute<?> attribute =
artifact.getAttributeById(skynetAttributeChange.getAttributeId(), true);
@@ -585,10 +585,7 @@ public class RemoteEventManager { UnloadedArtifact unloadedArtifact = new UnloadedArtifact(branchId, artId, artTypeId);
xModifiedEvents.add(new ArtifactModifiedEvent(sender, ArtifactModType.Deleted, unloadedArtifact));
} else if (!artifact.isHistorical()) {
- if (!InternalEventManager.enableRemoteEventLoopback) {
- ArtifactCache.deCache(artifact);
- artifact.internalSetDeleted();
- }
+ internalHandleRemoteArtifactDeleted(artifact);
xModifiedEvents.add(new ArtifactModifiedEvent(sender, ArtifactModType.Deleted, artifact,
((NetworkArtifactDeletedEvent) event).getTransactionId(),
@@ -600,10 +597,6 @@ public class RemoteEventManager { }
}
- /**
- * @param event
- * @param newTransactionId
- */
private static void updateRelations(Sender sender, ISkynetRelationLinkEvent event, Collection<ArtifactTransactionModifiedEvent> xModifiedEvents) {
if (event == null) {
return;
@@ -668,4 +661,24 @@ public class RemoteEventManager { }
}
}
+
+ public static void internalHandleRemoteArtifactModified(Artifact artifact) throws OseeCoreException {
+ if (artifact == null) {
+ return;
+ }
+ // TODO move processing of artifact modified to here
+ }
+
+ public static void internalHandleRemoteArtifactDeleted(Artifact artifact) throws OseeCoreException {
+ if (artifact == null) {
+ return;
+ }
+ if (!artifact.isHistorical()) {
+ if (!InternalEventManager.isEnableRemoteEventLoopback()) {
+ ArtifactCache.deCache(artifact);
+ artifact.internalSetDeleted();
+ }
+ }
+ }
+
}
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 index 59026fb36c8..3629456e059 100644 --- 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 @@ -11,17 +11,32 @@ package org.eclipse.osee.framework.skynet.core.event;
import java.rmi.RemoteException;
+import java.util.ArrayList;
import java.util.Collection;
+import java.util.List;
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.data.DefaultBasicGuidArtifact;
+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.IFrameworkEvent;
import org.eclipse.osee.framework.messaging.event.res.IFrameworkEventListener;
+import org.eclipse.osee.framework.messaging.event.res.event.NetworkArtifactAddedEvent;
+import org.eclipse.osee.framework.messaging.event.res.event.NetworkArtifactChangeTypeEvent;
+import org.eclipse.osee.framework.messaging.event.res.event.NetworkArtifactDeletedEvent;
+import org.eclipse.osee.framework.messaging.event.res.event.NetworkArtifactModifiedEvent;
+import org.eclipse.osee.framework.messaging.event.res.event.NetworkArtifactPurgeEvent;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.ArtifactCache;
+import org.eclipse.osee.framework.skynet.core.event.artifact.EventBasicGuidArtifact;
+import org.eclipse.osee.framework.skynet.core.event.artifact.EventModType;
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.RelationManager;
/**
* Manages remote events from the SkynetEventService.
@@ -34,16 +49,117 @@ public class RemoteEventManager2 { private RemoteEventManager2() {
super();
- clientEventListener = new IFrameworkEventListener() {
+ clientEventListener = new ClientEventListener();
+ }
- private static final long serialVersionUID = 1L;
+ private static class ClientEventListener implements IFrameworkEventListener {
- @Override
- public void onEvent(IFrameworkEvent[] events) throws RemoteException {
- System.err.println("process incoming events");
- }
- };
- }
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void onEvent(final IFrameworkEvent[] events) throws RemoteException {
+ final List<EventBasicGuidArtifact> artifactChanges = new ArrayList<EventBasicGuidArtifact>();
+ Job job = new Job("Receive Event2") {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+
+ Sender lastArtifactRelationModChangeSender = null;
+ for (IFrameworkEvent 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 NetworkArtifactAddedEvent) {
+ try {
+ artifactChanges.addAll(EventBasicGuidArtifact.get(EventModType.Added,
+ ((NetworkArtifactAddedEvent) event).getDefaultBasicGuidArtifacts()));
+ lastArtifactRelationModChangeSender = sender;
+ } 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);
+ }
+ }
+ }
+
+ if (artifactChanges.size() > 0) {
+ /*
+ * Since transaction events are a collection of ArtifactModfied and RelationModified
+ * events, create a new Sender based on the last sender for these events.
+ */
+ Sender transactionSender =
+ new Sender("RemoteEventManager", lastArtifactRelationModChangeSender.getOseeSession());
+ InternalEventManager2.kickTransactionEvent(transactionSender, artifactChanges);
+ }
+
+ return Status.OK_STATUS;
+ }
+ };
+ job.setSystem(true);
+ job.setUser(false);
+ job.schedule();
+ }
+ };
public static void deregisterFromRemoteEventManager() {
}
@@ -53,9 +169,17 @@ public class RemoteEventManager2 { }
public static boolean isConnected() {
- return false;
+ // 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 IFrameworkEvent... events) {
if (isConnected()) {
Job job = new Job("Send Event2") {
@@ -68,16 +192,9 @@ public class RemoteEventManager2 { job.schedule();
}
- /*
- * This 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.
- */
- if (InternalEventManager.enableRemoteEventLoopback) {
- OseeLog.log(Activator.class, Level.INFO, "REM: Loopback enabled - Returning events as Remote event.");
+
+ 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() {
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 bfcf9f90b92..ebafb54f638 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 @@ -36,6 +36,12 @@ public class Sender { networkSender.userId, networkSender.machineIp, networkSender.port, networkSender.clientVersion, "n/a"));
}
+ public Sender(org.eclipse.osee.framework.messaging.event.res.event.NetworkSender networkSender) {
+ this(networkSender.getSourceObject(), new OseeClientSession(networkSender.getSessionId(),
+ networkSender.getMachineName(), networkSender.getUserId(), networkSender.getMachineIp(), new Integer(
+ networkSender.getPort()).intValue(), networkSender.getClientVersion(), "n/a"));
+ }
+
public Sender(Object sourceObject) throws OseeAuthenticationRequiredException {
this.sourceObject = InternalEventManager.getObjectSafeName(sourceObject);
this.oseeSession = ClientSessionManager.getSession();
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/artifact/ArtifactEventManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/artifact/ArtifactEventManager.java index f29e3133a67..039f26824f6 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/artifact/ArtifactEventManager.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/artifact/ArtifactEventManager.java @@ -8,7 +8,6 @@ package org.eclipse.osee.framework.skynet.core.event.artifact; import java.util.Collection;
import java.util.Collections;
import java.util.List;
-import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
import org.eclipse.osee.framework.skynet.core.event.IEventListener;
import org.eclipse.osee.framework.skynet.core.event.Sender;
@@ -46,7 +45,7 @@ public class ArtifactEventManager { return event instanceof IArtifactListener || (event instanceof FilteredEventListener && ((FilteredEventListener) event).isOfType(IArtifactListener.class));
}
- public static void processArtifactChanges(Sender sender, Set<EventBasicGuidArtifact> artifactChanges) {
+ public static void processArtifactChanges(Sender sender, Collection<EventBasicGuidArtifact> artifactChanges) {
for (IEventListener listener : listeners) {
IArtifactListener artifactListener = null;
Collection<IEventFilter> eventFilters = null;
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/artifact/EventBasicGuidArtifact.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/artifact/EventBasicGuidArtifact.java index c8fe3e7e47d..9d546ca5c23 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/artifact/EventBasicGuidArtifact.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/artifact/EventBasicGuidArtifact.java @@ -44,7 +44,7 @@ public class EventBasicGuidArtifact extends DefaultBasicGuidArtifact { return eventModType;
}
- public static Set<EventBasicGuidArtifact> get(EventModType eventModType, Collection<IBasicGuidArtifact> basicGuidArtifacts) throws OseeCoreException {
+ public static Set<EventBasicGuidArtifact> get(EventModType eventModType, Collection<? extends IBasicGuidArtifact> basicGuidArtifacts) throws OseeCoreException {
if (eventModType == EventModType.ChangeType) throw new OseeArgumentException("Can't be used for ChangeType");
Set<EventBasicGuidArtifact> eventArts = new HashSet<EventBasicGuidArtifact>();
for (IBasicGuidArtifact guidArt : basicGuidArtifacts) {
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/DbUtil.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/DbUtil.java index 23b950a6187..9a4ce4a9f17 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/DbUtil.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/DbUtil.java @@ -14,6 +14,7 @@ import java.util.Collection; import java.util.Map; import org.eclipse.osee.framework.core.exception.OseeDataStoreException; import org.eclipse.osee.framework.database.core.ConnectionHandler; +import org.eclipse.osee.framework.skynet.core.event.OseeEventManager; /** * @author Donald G. Dunne @@ -37,5 +38,8 @@ public class DbUtil { public static void setDbInit(boolean isInDbInit) { DbUtil.isInDbInit = isInDbInit; + if (isInDbInit) { + OseeEventManager.setDisableEvents(true); + } } } |