diff options
author | afinkbein | 2008-09-26 16:57:01 +0000 |
---|---|---|
committer | afinkbein | 2008-09-26 16:57:01 +0000 |
commit | 99c56bb34a285e7c4555e2f8a1098038be8ab350 (patch) | |
tree | 739d9929296c95834ff1437fdadb79661703d172 | |
parent | 66bf72c98c9d2862b625347f48ee30387b358462 (diff) | |
download | org.eclipse.osee-99c56bb34a285e7c4555e2f8a1098038be8ab350.tar.gz org.eclipse.osee-99c56bb34a285e7c4555e2f8a1098038be8ab350.tar.xz org.eclipse.osee-99c56bb34a285e7c4555e2f8a1098038be8ab350.zip |
41 files changed, 2044 insertions, 0 deletions
diff --git a/org.eclipse.osee.framework.messaging.event.skynet/.classpath b/org.eclipse.osee.framework.messaging.event.skynet/.classpath new file mode 100644 index 00000000000..02159672985 --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.osee.framework.messaging.event.skynet/.project b/org.eclipse.osee.framework.messaging.event.skynet/.project new file mode 100644 index 00000000000..978f420c584 --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.osee.framework.messaging.event.skynet</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/org.eclipse.osee.framework.messaging.event.skynet/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.osee.framework.messaging.event.skynet/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..a8020f2dc2e --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,12 @@ +#Fri Mar 28 14:00:57 GMT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/org.eclipse.osee.framework.messaging.event.skynet/META-INF/MANIFEST.MF b/org.eclipse.osee.framework.messaging.event.skynet/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..7f6584bbe79 --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/META-INF/MANIFEST.MF @@ -0,0 +1,21 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Skynet Event Service (Incubation) +Bundle-SymbolicName: org.eclipse.osee.framework.messaging.event.skynet;singleton:=true +Bundle-Version: 0.4.0.qualifier +Bundle-Activator: org.eclipse.osee.framework.messaging.event.skynet.SkynetEventPlugin +Require-Bundle: org.eclipse.core.runtime, + net.jini, + org.eclipse.osee.framework.jdk.core, + org.eclipse.osee.framework.jini, + org.eclipse.osee.framework.plugin.core, + org.eclipse.ui +Bundle-ActivationPolicy: lazy +Export-Package: org.eclipse.osee.framework.messaging.event.skynet, + org.eclipse.osee.framework.messaging.event.skynet.event, + org.eclipse.osee.framework.messaging.event.skynet.filter, + org.eclipse.osee.framework.messaging.event.skynet.service +Bundle-Description: Skynet Event Service - Skynet Cache Network Manager +Bundle-Vendor: Eclipse.org +Bundle-ClassPath: skynetEvent.jar +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 diff --git a/org.eclipse.osee.framework.messaging.event.skynet/build.properties b/org.eclipse.osee.framework.messaging.event.skynet/build.properties new file mode 100644 index 00000000000..afc89d080b3 --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/build.properties @@ -0,0 +1,6 @@ +source.skynetEvent.jar = src/
+output.skynetEvent.jar = bin/
+bin.includes = META-INF/,\
+ skynetEvent.jar,\
+ plugin.xml,\
+ src/
diff --git a/org.eclipse.osee.framework.messaging.event.skynet/plugin.xml b/org.eclipse.osee.framework.messaging.event.skynet/plugin.xml new file mode 100644 index 00000000000..b37257d9042 --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/plugin.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin>
+ <extension
+ point="org.eclipse.osee.framework.jini.JiniInterface">
+ <Interface classname="org.eclipse.osee.framework.messaging.event.skynet.ISkynetEventService"/>
+ <Interface classname="org.eclipse.osee.framework.messaging.event.skynet.ISkynetEvent"/>
+ <Interface classname="org.eclipse.osee.framework.messaging.event.skynet.ISkynetEventListener"/>
+ <Interface classname="org.eclipse.osee.framework.messaging.event.skynet.event.SkynetAttributeChange"/>
+ </extension>
+ <extension
+ point="org.eclipse.osee.framework.jini.JiniInterface">
+ <RegisterBundle/>
+ </extension>
+ <extension
+ id="EventService"
+ name="EventService"
+ point="org.eclipse.core.runtime.applications">
+ <application>
+ <run class="org.eclipse.osee.framework.messaging.event.skynet.service.SkynetEventServicePlatformRunnable"/>
+ </application>
+ </extension>
+ <extension
+ id="EventServiceProd"
+ point="org.eclipse.core.runtime.products">
+ <product
+ application="org.eclipse.osee.framework.messaging.event.skynet.EventService"
+ name="EventServiceProd"/>
+ </extension>
+
+</plugin>
diff --git a/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/ASkynetEventListener.java b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/ASkynetEventListener.java new file mode 100644 index 00000000000..193ee3ae62d --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/ASkynetEventListener.java @@ -0,0 +1,53 @@ +/******************************************************************************* + * 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.messaging.event.skynet; + +import java.rmi.RemoteException; + +/** + * Client callback base class. + * + * @author Robert A. Fisher + */ +public abstract class ASkynetEventListener implements ISkynetEventListener { + + private final Long uid; + + public ASkynetEventListener() { + this.uid = (long) (Math.random() * Long.MAX_VALUE); + } + + /** + * Since the listeners are hashed on the service side, it is necessary to force the equals and hashcode operators to + * work in a particular manner. + */ + @Override + public final boolean equals(Object obj) { + if (obj instanceof ASkynetEventListener) { + return ((ASkynetEventListener) obj).uid.equals(this.uid); + } + return false; + } + + @Override + public final int hashCode() { + return uid.hashCode(); + } + + /** + * Callback for the client to process remote skynet events. The array will contain a list of events to which this + * listener is subscribed. + * + * @throws RemoteException + */ + public abstract void onEvent(ISkynetEvent[] events) throws RemoteException; + +} diff --git a/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/ISkynetArtifactEvent.java b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/ISkynetArtifactEvent.java new file mode 100644 index 00000000000..01821d4e967 --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/ISkynetArtifactEvent.java @@ -0,0 +1,23 @@ +/******************************************************************************* + * 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.messaging.event.skynet; + +/** + * @author Robert A. Fisher + */ +public interface ISkynetArtifactEvent extends ISkynetEvent { + + public String getFactoryName(); + + public int getArtId(); + + public int getArtTypeId(); +} diff --git a/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/ISkynetEvent.java b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/ISkynetEvent.java new file mode 100644 index 00000000000..bc8809999cb --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/ISkynetEvent.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * 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.messaging.event.skynet; + +import java.io.Serializable; +import org.eclipse.osee.framework.messaging.event.skynet.event.NetworkSender; + +/** + * All Skynet events implement this interface. + * + * @author Robert A. Fisher + */ +@SuppressWarnings("unchecked") +public interface ISkynetEvent extends Serializable, Comparable { + public static final ISkynetEvent[] EMPTY_ARRAY = new ISkynetEvent[0]; + + public NetworkSender getNetworkSender(); +} diff --git a/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/ISkynetEventListener.java b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/ISkynetEventListener.java new file mode 100644 index 00000000000..7bfa3648914 --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/ISkynetEventListener.java @@ -0,0 +1,20 @@ +/******************************************************************************* + * 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.messaging.event.skynet; + +import java.io.Serializable; +import java.rmi.Remote; +import java.rmi.RemoteException; + +public interface ISkynetEventListener extends Remote, Serializable { + + public abstract void onEvent(ISkynetEvent[] events) throws RemoteException; +} diff --git a/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/ISkynetEventService.java b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/ISkynetEventService.java new file mode 100644 index 00000000000..f19328a13ca --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/ISkynetEventService.java @@ -0,0 +1,42 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.framework.messaging.event.skynet; + +import java.rmi.Remote; +import java.rmi.RemoteException; +import org.eclipse.osee.framework.messaging.event.skynet.filter.IEventFilter; + +public interface ISkynetEventService extends Remote { + + // TODO all calls to the server go here + /** + * Register to receive events based on filters. + * + * @param filters TODO + */ + public void register(ISkynetEventListener listener, IEventFilter... filters) throws RemoteException; + + /** + * Deregister to receive events based on filters. + * + * @param filters TODO + */ + public void deregister(ISkynetEventListener listener, IEventFilter... filters) throws RemoteException; + + /** + * Pass events to the service to be disemminated. + * + * @param events + */ + public void kick(ISkynetEvent[] events, ISkynetEventListener... except) throws RemoteException; + + public boolean isAlive() throws RemoteException; +}
\ No newline at end of file diff --git a/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/ISkynetRelationLinkEvent.java b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/ISkynetRelationLinkEvent.java new file mode 100644 index 00000000000..261e6c9e23f --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/ISkynetRelationLinkEvent.java @@ -0,0 +1,33 @@ +/******************************************************************************* + * 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.messaging.event.skynet; + +/** + * @author Robert A. Fisher + */ +public interface ISkynetRelationLinkEvent extends ISkynetEvent { + + public int getArtAId(); + + public int getArtATypeId(); + + public int getArtBId(); + + public int getArtBTypeId(); + + public Integer getRelId(); + + public Integer getGammaId(); + + public int getRelTypeId(); + + public int getBranchId(); +} diff --git a/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/Sample.java b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/Sample.java new file mode 100644 index 00000000000..a789cab3771 --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/Sample.java @@ -0,0 +1,97 @@ +/******************************************************************************* + * 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.messaging.event.skynet; + +import java.io.Serializable; +import java.rmi.RemoteException; +import java.util.Date; +import org.eclipse.osee.framework.jini.discovery.IServiceLookupListener; +import org.eclipse.osee.framework.jini.discovery.ServiceDataStore; +import org.eclipse.osee.framework.jini.util.OseeJini; +import net.jini.core.lookup.ServiceItem; + +public class Sample implements IServiceLookupListener, Serializable { + private static final long serialVersionUID = 8195127334711471268L; + + private ISkynetEventService ses; + private ASkynetEventListener listener; + + public Sample() { + super(); + + listener = new EventEchoer(); + + // TODO this may take a very long time ... like FOREVER ... perform timeout ~5s if it is an absolutely necessary service + // ServiceDataStore.getEclipseInstance(EclipseJiniClassloader.getInstance()).addListener(this, ISkynetEventService.class); + ServiceDataStore.getNonEclipseInstance().addListener(this, ISkynetEventService.class); + + for (;;) { + try { + Thread.sleep(5000); + System.out.print(new Date() + ":"); + if (ses == null) { + System.out.println("Service not connected"); + } else { + System.out.println("kick"); + try { + // ses.kick(new ISkynetEvent[]{new RemoteArtifactModifiedEvent(1, 2, 3, 4, "bob")}, listener); + } catch (Exception e) { + e.printStackTrace(); + ses = null; + } + } + } catch (InterruptedException e) { + break; + } + } + } + + public void serviceAdded(ServiceItem serviceItem) { + ses = (ISkynetEventService) serviceItem.service; + try { + ses.register((ISkynetEventListener) OseeJini.getRemoteReference(listener)); + } catch (RemoteException e) { + e.printStackTrace(); + } + } + + public void serviceChanged(ServiceItem serviceItem) { + // like when the Entry[] changes + System.out.println("***Service changed"); + serviceAdded(serviceItem); + } + + public void serviceRemoved(ServiceItem serviceItem) { + // Ensure the lookup server didn't just lose contact + // try { + // ses.someStupidCallLikeGetId(); + // } catch(RemoteException ex) { + ses = null; + // } + + } + + public static void main(String[] args) { + new Sample(); + } + + private class EventEchoer extends ASkynetEventListener { + private static final long serialVersionUID = 2251382843127874925L; + + @Override + public void onEvent(ISkynetEvent[] events) throws RemoteException { + System.out.println("Events received at " + new Date()); + + for (ISkynetEvent event : events) + System.out.println("\t" + event); + } + } +} diff --git a/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/SkynetEventPlugin.java b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/SkynetEventPlugin.java new file mode 100644 index 00000000000..d0efb50e3c1 --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/SkynetEventPlugin.java @@ -0,0 +1,34 @@ +/******************************************************************************* + * 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.messaging.event.skynet; + +import org.eclipse.osee.framework.plugin.core.OseeActivator; + +/** + * The main plugin class to be used in the desktop. + */ +public class SkynetEventPlugin extends OseeActivator { + + private static SkynetEventPlugin pluginInstance; // The shared instance. + public static final String PLUGIN_ID = "org.eclipse.osee.framework.messaging.event.skynet"; + + public SkynetEventPlugin() { + super(); + pluginInstance = this; + } + + /** + * Returns the shared instance. + */ + public static SkynetEventPlugin getInstance() { + return pluginInstance; + } +}
\ No newline at end of file diff --git a/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/ConfigurationModifiedEvent.java b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/ConfigurationModifiedEvent.java new file mode 100644 index 00000000000..66ee9ac3489 --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/ConfigurationModifiedEvent.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * 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.messaging.event.skynet.event; + +/** + * @author Robert A. Fisher + */ +public class ConfigurationModifiedEvent extends SkynetEventBase { + private static final long serialVersionUID = 4199206743701390599L; + + /** + * @param author + */ + public ConfigurationModifiedEvent(NetworkSender networkSender) { + super(networkSender); + } +} diff --git a/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkAccessControlArtifactsEvent.java b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkAccessControlArtifactsEvent.java new file mode 100644 index 00000000000..f94caae3ba9 --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkAccessControlArtifactsEvent.java @@ -0,0 +1,47 @@ +/*******************************************************************************
+ * 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.messaging.event.skynet.event;
+
+import java.util.Collection;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class NetworkAccessControlArtifactsEvent extends SkynetArtifactsEventBase {
+ private static final long serialVersionUID = -4325821466558180270L;
+ private final String accessControlModType;
+
+ /**
+ * @return the accessControlModType
+ */
+ public String getAccessControlModTypeName() {
+ return accessControlModType;
+ }
+
+ /**
+ * @param branchId
+ * @param artifactIds
+ * @param toArtifactTypeId
+ * @param author
+ */
+ public NetworkAccessControlArtifactsEvent(String accessControlModType, int branchId, Collection<Integer> artifactIds, Collection<Integer> artifactTypeIds, NetworkSender networkSender) {
+ super(branchId, artifactIds, artifactTypeIds, networkSender);
+ this.accessControlModType = accessControlModType;
+ }
+
+ /**
+ * @return Returns the serialVersionUID.
+ */
+ public static long getSerialVersionUID() {
+ return serialVersionUID;
+ }
+
+}
diff --git a/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactAddedEvent.java b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactAddedEvent.java new file mode 100644 index 00000000000..0544a91cf5d --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactAddedEvent.java @@ -0,0 +1,50 @@ +/******************************************************************************* + * 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.messaging.event.skynet.event; + +/** + * @author Robert A. Fisher + */ +public class NetworkArtifactAddedEvent extends SkynetArtifactEventBase { + private static final long serialVersionUID = -4325821466558180270L; + + /** + * @param branchId + * @param transactionId + * @param artId + * @param artTypeId + * @param author TODO + */ + public NetworkArtifactAddedEvent(int branchId, int transactionId, int artId, int artTypeId, String factoryName, NetworkSender networkSender) { + super(branchId, transactionId, artId, artTypeId, factoryName, networkSender); + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof NetworkArtifactAddedEvent) { + return (getArtId() == (((NetworkArtifactAddedEvent) obj).getArtId())); + } + return super.equals(obj); + } + + @Override + public int hashCode() { + return getArtId(); + } + + /** + * @return Returns the serialVersionUID. + */ + public static long getSerialVersionUID() { + return serialVersionUID; + } + +} diff --git a/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactChangeTypeEvent.java b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactChangeTypeEvent.java new file mode 100644 index 00000000000..633b2b900d7 --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactChangeTypeEvent.java @@ -0,0 +1,48 @@ +/*******************************************************************************
+ * 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.messaging.event.skynet.event;
+
+import java.util.Collection;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class NetworkArtifactChangeTypeEvent extends SkynetArtifactsEventBase {
+ private static final long serialVersionUID = -4325821466558180270L;
+
+ private final int toArtifactTypeId;
+
+ /**
+ * @return the toArtifactTypeId
+ */
+ public int getToArtifactTypeId() {
+ return toArtifactTypeId;
+ }
+
+ /**
+ * @param branchId
+ * @param artifactIds
+ * @param toArtifactTypeId
+ * @param author
+ */
+ public NetworkArtifactChangeTypeEvent(int branchId, Collection<Integer> artifactIds, Collection<Integer> artifactTypeIds, int toArtifactTypeId, NetworkSender networkSender) {
+ super(branchId, artifactIds, artifactTypeIds, networkSender);
+ this.toArtifactTypeId = toArtifactTypeId;
+ }
+
+ /**
+ * @return Returns the serialVersionUID.
+ */
+ public static long getSerialVersionUID() {
+ return serialVersionUID;
+ }
+
+}
diff --git a/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactDeletedEvent.java b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactDeletedEvent.java new file mode 100644 index 00000000000..be2e6e18258 --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactDeletedEvent.java @@ -0,0 +1,30 @@ +/******************************************************************************* + * 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.messaging.event.skynet.event; + +/** + * @author Robert A. Fisher + */ +public class NetworkArtifactDeletedEvent extends SkynetArtifactEventBase { + private static final long serialVersionUID = 568951803773151575L; + + /** + * @param branchId + * @param transactionId + * @param artId + * @param artTypeId + * @param author TODO + */ + public NetworkArtifactDeletedEvent(int branchId, int transactionId, int artId, int artTypeId, String factoryName, NetworkSender networkSender) { + super(branchId, transactionId, artId, artTypeId, factoryName, networkSender); + } + +} diff --git a/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactModifiedEvent.java b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactModifiedEvent.java new file mode 100644 index 00000000000..27bbc3df3c3 --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactModifiedEvent.java @@ -0,0 +1,61 @@ +/******************************************************************************* + * 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.messaging.event.skynet.event; + +import java.util.Collection; + +/** + * @author Robert A. Fisher + */ +public class NetworkArtifactModifiedEvent extends SkynetArtifactEventBase { + private static final long serialVersionUID = -4325821466558180270L; + private final Collection<SkynetAttributeChange> attributeValues; + + /** + * @param branchId + * @param transactionId + * @param artId + * @param artTypeId + * @param author TODO + */ + public NetworkArtifactModifiedEvent(int branchId, int transactionId, int artId, int artTypeId, String factoryName, Collection<SkynetAttributeChange> attributeValues, NetworkSender networkSender) { + super(branchId, transactionId, artId, artTypeId, factoryName, networkSender); + + this.attributeValues = attributeValues; + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof NetworkArtifactModifiedEvent) { + return (getArtId() == (((NetworkArtifactModifiedEvent) obj).getArtId())); + } + return super.equals(obj); + } + + @Override + public int hashCode() { + return getArtId(); + } + + /** + * @return Returns the serialVersionUID. + */ + public static long getSerialVersionUID() { + return serialVersionUID; + } + + /** + * @return Returns the attributeValues. + */ + public Collection<SkynetAttributeChange> getAttributeChanges() { + return attributeValues; + } +} diff --git a/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactPurgeEvent.java b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactPurgeEvent.java new file mode 100644 index 00000000000..2220d5f4615 --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactPurgeEvent.java @@ -0,0 +1,38 @@ +/*******************************************************************************
+ * 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.messaging.event.skynet.event;
+
+import java.util.Collection;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class NetworkArtifactPurgeEvent extends SkynetArtifactsEventBase {
+ private static final long serialVersionUID = -4325821466558180270L;
+
+ /**
+ * @param branchId
+ * @param artifactIds
+ * @param toArtifactTypeId
+ * @param author
+ */
+ public NetworkArtifactPurgeEvent(int branchId, Collection<Integer> artifactIds, Collection<Integer> artifactTypeIds, NetworkSender networkSender) {
+ super(branchId, artifactIds, artifactTypeIds, networkSender);
+ }
+
+ /**
+ * @return Returns the serialVersionUID.
+ */
+ public static long getSerialVersionUID() {
+ return serialVersionUID;
+ }
+
+}
diff --git a/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkBroadcastEvent.java b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkBroadcastEvent.java new file mode 100644 index 00000000000..a51867eb8aa --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkBroadcastEvent.java @@ -0,0 +1,55 @@ +/******************************************************************************* + * 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.messaging.event.skynet.event; + +/** + * @author Robert A. Fisher + */ +public class NetworkBroadcastEvent extends SkynetEventBase { + + private static final long serialVersionUID = 4199206432501390599L; + private String message; + private final String broadcastEventType; + private final String[] userIds; + + /** + * @return the broadcastEventType + */ + public String getBroadcastEventTypeName() { + return broadcastEventType; + } + + public NetworkBroadcastEvent(String broadcastEventType, String message, String[] userIds, NetworkSender networkSender) { + super(networkSender); + this.broadcastEventType = broadcastEventType; + this.message = message; + this.userIds = userIds; + } + + public NetworkBroadcastEvent(String broadcastEventType, String message, NetworkSender networkSender) { + this(broadcastEventType, message, new String[] {}, networkSender); + } + + /** + * @return the userIds + */ + public String[] getUserIds() { + return userIds; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} diff --git a/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkCommitBranchEvent.java b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkCommitBranchEvent.java new file mode 100644 index 00000000000..343a40b8473 --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkCommitBranchEvent.java @@ -0,0 +1,43 @@ +/******************************************************************************* + * 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.messaging.event.skynet.event; + + +/** + * Skynet messaging event; Should not be subscribed to by OSEE applications. + * + * @author Donald G. Dunne + */ +public class NetworkCommitBranchEvent extends SkynetEventBase { + private static final long serialVersionUID = 8339596149601667894L; + private final int branchId; + + /** + * @param branchId + * @param author + */ + public NetworkCommitBranchEvent(int branchId, NetworkSender networkSender) { + super(networkSender); + this.branchId = branchId; + } + + public int getBranchId() { + return branchId; + } + + /* (non-Javadoc) + * @see java.lang.Comparable#compareTo(T) + */ + public int compareTo(Object o) { + return 0; + } + +} diff --git a/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkDeletedBranchEvent.java b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkDeletedBranchEvent.java new file mode 100644 index 00000000000..9b1e23886b1 --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkDeletedBranchEvent.java @@ -0,0 +1,43 @@ +/******************************************************************************* + * 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.messaging.event.skynet.event; + +/** + * Skynet messaging event; Should not be subscribed to by OSEE applications. + * + * @author Jeff C. Phillips + */ +public class NetworkDeletedBranchEvent extends SkynetEventBase { + private static final long serialVersionUID = 4651718722048388742L; + private final int branchId; + + public NetworkDeletedBranchEvent(int branchId, NetworkSender networkSender) { + super(networkSender); + this.branchId = branchId; + } + + public int getTransactionId() { + return 0; + } + + public int getBranchId() { + return branchId; + } + + /* (non-Javadoc) + * @see java.lang.Comparable#compareTo(T) + */ + @Override + public int compareTo(Object o) { + return 0; + } + +} diff --git a/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkNewBranchEvent.java b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkNewBranchEvent.java new file mode 100644 index 00000000000..867a20dc96f --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkNewBranchEvent.java @@ -0,0 +1,40 @@ +/******************************************************************************* + * 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.messaging.event.skynet.event; + + +/** + * Skynet messaging event; Should not be subscribed to by OSEE applications. + * + * @author Jeff C. Phillips + */ +public class NetworkNewBranchEvent extends SkynetEventBase { + private static final long serialVersionUID = 8339596149601337894L; + private final int branchId; + + public NetworkNewBranchEvent(int branchId, NetworkSender networkSender) { + super(networkSender); + this.branchId = branchId; + } + + public int getBranchId() { + return branchId; + } + + /* (non-Javadoc) + * @see java.lang.Comparable#compareTo(T) + */ + @Override + public int compareTo(Object o) { + return 0; + } + +} diff --git a/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkNewRelationLinkEvent.java b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkNewRelationLinkEvent.java new file mode 100644 index 00000000000..8832a4b5056 --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkNewRelationLinkEvent.java @@ -0,0 +1,111 @@ +/******************************************************************************* + * 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.messaging.event.skynet.event; + +/** + * @author Donald G. Dunne + * @author Jeff C. Phillips + */ +public class NetworkNewRelationLinkEvent extends SkynetRelationLinkEventBase { + + private static final long serialVersionUID = -519877422249674503L; + + private final String rationale; + private String aGuid; + private String aHumanId; + private String bHumanId; + private String bGuid; + private final String descriptorName; + private final int aOrder; + private final int bOrder; + private final int relTypeId; + + /** + * @param branchId + * @param transactionId + * @param relId + * @param artAId + * @param artBId + * @param author + */ + + public NetworkNewRelationLinkEvent(int gammaId, int branchId, Integer relId, int artAId, int artATypeId, int artBId, int artBTypeId, String rationale, int aOrder, int bOrder, int relTypeId, String descriptorName, NetworkSender networkSender) { + super(relTypeId, gammaId, branchId, relId, artAId, artATypeId, artBId, artBTypeId, networkSender); + + this.rationale = rationale; + this.aOrder = aOrder; + this.bOrder = bOrder; + this.relTypeId = relTypeId; + this.descriptorName = descriptorName; + } + + /** + * @return Returns the aOrder. + */ + public int getAOrder() { + return aOrder; + } + + /** + * @return Returns the bOrder. + */ + public int getBOrder() { + return bOrder; + } + + /** + * @return Returns the rationale. + */ + public String getRationale() { + return rationale; + } + + /** + * @return Returns the relTypeId. + */ + @Override + public int getRelTypeId() { + return relTypeId; + } + + /** + * @return Returns the aGuid. + */ + public String getAGuid() { + return aGuid; + } + + /** + * @return Returns the bGuid. + */ + public String getBGuid() { + return bGuid; + } + + /** + * @return Returns the aHuamnId. + */ + public String getAHumanId() { + return aHumanId; + } + + /** + * @return Returns the bHumanId. + */ + public String getBHumanId() { + return bHumanId; + } + + public String getDescriptorName() { + return descriptorName; + } + +} diff --git a/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkRelationLinkDeletedEvent.java b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkRelationLinkDeletedEvent.java new file mode 100644 index 00000000000..0abaf1dc6dd --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkRelationLinkDeletedEvent.java @@ -0,0 +1,23 @@ +/******************************************************************************* + * 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.messaging.event.skynet.event; + +/** + * @author Donald G. Dunne + * @author Robert A. Fisher + */ +public class NetworkRelationLinkDeletedEvent extends SkynetRelationLinkEventBase { + private static final long serialVersionUID = -1451567913757261791L; + + public NetworkRelationLinkDeletedEvent(int relTypeId, int gammaId, int branchId, int relId, int artAId, int artATypeId, int artBId, int artBTypeId, NetworkSender networkSender) { + super(relTypeId, gammaId, branchId, relId, artAId, artATypeId, artBId, artBTypeId, networkSender); + } +} diff --git a/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkRelationLinkOrderModifiedEvent.java b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkRelationLinkOrderModifiedEvent.java new file mode 100644 index 00000000000..ada68614a56 --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkRelationLinkOrderModifiedEvent.java @@ -0,0 +1,75 @@ +/******************************************************************************* + * 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.messaging.event.skynet.event; + +/** + * @author Donald G. Dunne + * @author Robert A. Fisher + */ +public class NetworkRelationLinkOrderModifiedEvent extends SkynetRelationLinkEventBase { + private static final long serialVersionUID = 548299278567054333L; + + private final String rationale; + int aOrder; + int bOrder; + + /** + * @param branchId + * @param transactionId + * @param relId + * @param artAId + * @param artBId + * @param author + * @param relTypeId + */ + public NetworkRelationLinkOrderModifiedEvent(int gammaId, int branchId, int relId, int artAId, int artATypeId, int artBId, int artBTypeId, String rationale, int aOrder, int bOrder, NetworkSender networkSender, int relTypeId) { + super(relTypeId, gammaId, branchId, relId, artAId, artATypeId, artBId, artBTypeId, networkSender); + + this.rationale = rationale; + this.aOrder = aOrder; + this.bOrder = bOrder; + } + + /** + * @return Returns the aOrder. + */ + public int getAOrder() { + return aOrder; + } + + /** + * @return Returns the bOrder. + */ + public int getBOrder() { + return bOrder; + } + + /** + * @return Returns the rationale. + */ + public String getRationale() { + return rationale; + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof NetworkRelationLinkOrderModifiedEvent) { + return (getRelId() == (((NetworkRelationLinkOrderModifiedEvent) obj).getRelId())); + } + return super.equals(obj); + } + + @Override + public int hashCode() { + return getRelId(); + } + +} diff --git a/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkRelationLinkRationalModifiedEvent.java b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkRelationLinkRationalModifiedEvent.java new file mode 100644 index 00000000000..02b0739588f --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkRelationLinkRationalModifiedEvent.java @@ -0,0 +1,75 @@ +/******************************************************************************* + * 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.messaging.event.skynet.event; + +/** + * @author Donald G. Dunne + * @author Robert A. Fisher + */ +public class NetworkRelationLinkRationalModifiedEvent extends SkynetRelationLinkEventBase { + private static final long serialVersionUID = 548299278567054333L; + + private final String rationale; + int aOrder; + int bOrder; + + /** + * @param branchId + * @param transactionId + * @param relId + * @param artAId + * @param artBId + * @param author + * @param relTypeId + */ + public NetworkRelationLinkRationalModifiedEvent(int gammaId, int branchId, int relId, int artAId, int artATypeId, int artBId, int artBTypeId, String rationale, int aOrder, int bOrder, NetworkSender networkSender, int relTypeId) { + super(relTypeId, gammaId, branchId, relId, artAId, artATypeId, artBId, artBTypeId, networkSender); + + this.rationale = rationale; + this.aOrder = aOrder; + this.bOrder = bOrder; + } + + /** + * @return Returns the aOrder. + */ + public int getAOrder() { + return aOrder; + } + + /** + * @return Returns the bOrder. + */ + public int getBOrder() { + return bOrder; + } + + /** + * @return Returns the rationale. + */ + public String getRationale() { + return rationale; + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof NetworkRelationLinkRationalModifiedEvent) { + return (getRelId() == (((NetworkRelationLinkRationalModifiedEvent) obj).getRelId())); + } + return super.equals(obj); + } + + @Override + public int hashCode() { + return getRelId(); + } + +} diff --git a/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkRenameBranchEvent.java b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkRenameBranchEvent.java new file mode 100644 index 00000000000..130334daccb --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkRenameBranchEvent.java @@ -0,0 +1,82 @@ +/******************************************************************************* + * 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.messaging.event.skynet.event; + +/** + * Skynet messaging event; Should not be subscribed to by OSEE applications. + * + * @author Donald G. Dunne + */ +public class NetworkRenameBranchEvent extends SkynetEventBase { + private static final long serialVersionUID = 8339596149601997894L; + private int branchId; + private String branchName; + private String shortName; + + public NetworkRenameBranchEvent(int branchId, NetworkSender networkSender, String branchName, String shortName) { + super(networkSender); + this.branchId = branchId; + this.branchName = branchName; + this.shortName = shortName; + } + + public int getTransactionId() { + return 0; + } + + public int getBranchId() { + return branchId; + } + + /* (non-Javadoc) + * @see java.lang.Comparable#compareTo(T) + */ + @Override + public int compareTo(Object o) { + return 0; + } + + /** + * @return the branchName + */ + public String getBranchName() { + return branchName; + } + + /** + * @param branchName the branchName to set + */ + public void setBranchName(String branchName) { + this.branchName = branchName; + } + + /** + * @return the shortName + */ + public String getShortName() { + return shortName; + } + + /** + * @param shortName the shortName to set + */ + public void setShortName(String shortName) { + this.shortName = shortName; + } + + /** + * @param branchId the branchId to set + */ + public void setBranchId(int branchId) { + this.branchId = branchId; + } + +} diff --git a/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkSender.java b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkSender.java new file mode 100644 index 00000000000..52b897371b7 --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkSender.java @@ -0,0 +1,30 @@ +/*
+ * Created on Sep 13, 2008
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.framework.messaging.event.skynet.event;
+
+import java.io.Serializable;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class NetworkSender implements Serializable {
+
+ private static final long serialVersionUID = 1908598443523663604L;
+ public Object sourceObject;
+ public String sessionId;
+ public String machineName;
+ public String userId;
+ public String machineIp;
+
+ public NetworkSender(Object sourceObject, String sessionId, String machineName, String userId, String machineIp) {
+ this.sessionId = sessionId;
+ this.sourceObject = sourceObject;
+ this.machineName = machineName;
+ this.userId = userId;
+ this.machineIp = machineIp;
+ }
+
+}
diff --git a/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkTransactionDeletedEvent.java b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkTransactionDeletedEvent.java new file mode 100644 index 00000000000..2934e529d44 --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkTransactionDeletedEvent.java @@ -0,0 +1,33 @@ +/*
+ * Created on Sep 6, 2008
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.framework.messaging.event.skynet.event;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class NetworkTransactionDeletedEvent extends SkynetEventBase {
+
+ private static final long serialVersionUID = -2467438797592036593L;
+ private final int[] transactionIds;
+
+ /**
+ * @return the transactionIds
+ */
+ public int[] getTransactionIds() {
+ return transactionIds;
+ }
+
+ /**
+ * @param branchId
+ * @param transactionId
+ * @param author
+ */
+ public NetworkTransactionDeletedEvent(NetworkSender networkSender, int[] transactionIds) {
+ super(networkSender);
+ this.transactionIds = transactionIds;
+ }
+
+}
diff --git a/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/SkynetArtifactEventBase.java b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/SkynetArtifactEventBase.java new file mode 100644 index 00000000000..f7fb6816553 --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/SkynetArtifactEventBase.java @@ -0,0 +1,75 @@ +/******************************************************************************* + * 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.messaging.event.skynet.event; + +import org.eclipse.osee.framework.messaging.event.skynet.ISkynetArtifactEvent; + +/** + * @author Robert A. Fisher + */ +public class SkynetArtifactEventBase extends SkynetEventBase implements ISkynetArtifactEvent { + private static final long serialVersionUID = 7923550763258313718L; + + private final int artId; + private final int artTypeId; + private final String factoryName; + private final int transactionId; + private final int branchId; + + /** + * @param branchId + * @param transactionId + * @param artId + * @param artTypeId + * @param author TODO + */ + public SkynetArtifactEventBase(int branchId, int transactionId, int artId, int artTypeId, String factoryName, NetworkSender networkSender) { + super(networkSender); + this.branchId = branchId; + + this.artId = artId; + this.artTypeId = artTypeId; + this.factoryName = factoryName; + this.transactionId = transactionId; + } + + /** + * @return the branchId + */ + public int getBranchId() { + return branchId; + } + + /** + * @return Returns the transactionId. + */ + public int getTransactionId() { + return transactionId; + } + + /** + * @return Returns the artId. + */ + public int getArtId() { + return artId; + } + + /** + * @return Returns the artTypeId. + */ + public int getArtTypeId() { + return artTypeId; + } + + public String getFactoryName() { + return factoryName; + } +} diff --git a/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/SkynetArtifactsEventBase.java b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/SkynetArtifactsEventBase.java new file mode 100644 index 00000000000..fba08b6a395 --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/SkynetArtifactsEventBase.java @@ -0,0 +1,73 @@ +/******************************************************************************* + * 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.messaging.event.skynet.event; + +import java.util.Collection; +import org.eclipse.osee.framework.messaging.event.skynet.ISkynetEvent; + +/** + * @author Donald G. Dunne + */ +public abstract class SkynetArtifactsEventBase extends SkynetEventBase implements ISkynetEvent { + private static final long serialVersionUID = 7923550763258313718L; + + private final Collection<Integer> artifactTypeIds; + private final Collection<Integer> artifactIds; + private final int branchId; + + /** + * @param branchId + * @param artifactIds + * @param artifactTypeIds + * @param author + */ + public SkynetArtifactsEventBase(int branchId, Collection<Integer> artifactIds, Collection<Integer> artifactTypeIds, NetworkSender networkSender) { + super(networkSender); + this.branchId = branchId; + this.artifactIds = artifactIds; + this.artifactTypeIds = artifactTypeIds; + } + + /** + * @return the branchId + */ + public int getBranchId() { + return branchId; + } + + /** + * @return the artifactTypeIds + */ + public Collection<Integer> getArtifactTypeIds() { + return artifactTypeIds; + } + + /** + * @return the artifactIds + */ + public Collection<Integer> getArtifactIds() { + return artifactIds; + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof NetworkArtifactPurgeEvent) { + return artifactIds.hashCode() == ((NetworkArtifactPurgeEvent) obj).getArtifactIds().hashCode() && artifactTypeIds.hashCode() == ((NetworkArtifactPurgeEvent) obj).getArtifactTypeIds().hashCode(); + } + return super.equals(obj); + } + + @Override + public int hashCode() { + return artifactIds.hashCode() + artifactTypeIds.hashCode(); + } + +} diff --git a/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/SkynetAttributeChange.java b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/SkynetAttributeChange.java new file mode 100644 index 00000000000..c782c39febd --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/SkynetAttributeChange.java @@ -0,0 +1,73 @@ +/******************************************************************************* + * 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.messaging.event.skynet.event; + +/** + * @author Jeff C. Phillips + */ +public class SkynetAttributeChange implements SkynetChange { + private static final long serialVersionUID = 7269483275150734396L; + private final String name; + private final boolean deleted; + private final int attributeId; + private final int gammaId; + private final Object[] value; + + /** + * @return the deleted + */ + public boolean isDeleted() { + return deleted; + } + + /** + * @param name + * @param value + */ + public SkynetAttributeChange(String name, Object[] value, boolean deleted, int attributeId, int gammaId) { + super(); + this.name = name; + this.value = value; + this.deleted = deleted; + this.attributeId = attributeId; + this.gammaId = gammaId; + } + + @Override + public String toString() { + return name + "(" + attributeId + ")" + " => " + value; + } + + /** + * @return Returns the name. + */ + public String getName() { + return name; + } + + /** + * @return Returns the value. + */ + public Object[] getData() { + return value; + } + + public int getAttributeId() { + return attributeId; + } + + /** + * @return Returns the gammaId. + */ + public int getGammaId() { + return gammaId; + } +} diff --git a/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/SkynetChange.java b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/SkynetChange.java new file mode 100644 index 00000000000..9491277abbe --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/SkynetChange.java @@ -0,0 +1,20 @@ +/******************************************************************************* + * 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.messaging.event.skynet.event; + +import java.io.Serializable; + +/** + * @author Jeff C. Phillips + */ +public interface SkynetChange extends Serializable { + +} diff --git a/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/SkynetEventBase.java b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/SkynetEventBase.java new file mode 100644 index 00000000000..70c45b54f2d --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/SkynetEventBase.java @@ -0,0 +1,50 @@ +/******************************************************************************* + * 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.messaging.event.skynet.event; + +import org.eclipse.osee.framework.messaging.event.skynet.ISkynetEvent; + +/** + * @author Robert A. Fisher + */ +public class SkynetEventBase implements ISkynetEvent { + private static final long serialVersionUID = -5381855085551886510L; + + private final NetworkSender networkSender; + + /** + * @return the networkSender + */ + public NetworkSender getNetworkSender() { + return networkSender; + } + + /** + * @param branchId + * @param transactionId + * @param author + */ + public SkynetEventBase(NetworkSender networkSender) { + this.networkSender = networkSender; + } + + public int compareTo(Object o) { + + if (o instanceof NetworkArtifactDeletedEvent) { + return 1; + } else if (o instanceof SkynetArtifactEventBase) { + return 1; + } else { + return -1; + } + } + +} diff --git a/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/SkynetRelationLinkEventBase.java b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/SkynetRelationLinkEventBase.java new file mode 100644 index 00000000000..41ca9b3177e --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/SkynetRelationLinkEventBase.java @@ -0,0 +1,102 @@ +/******************************************************************************* + * 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.messaging.event.skynet.event; + +import org.eclipse.osee.framework.messaging.event.skynet.ISkynetRelationLinkEvent; + +/** + * @author Robert A. Fisher + */ +public class SkynetRelationLinkEventBase extends SkynetEventBase implements ISkynetRelationLinkEvent { + private static final long serialVersionUID = 154870900652138769L; + + private final Integer relId; + private final int relTypeId; + private final int artAId; + private final int artATypeId; + private final int artBId; + private final int artBTypeId; + private final int gammaId; + private final int branchId; + + /** + * @param branchId + * @param transactionId + * @param relId + * @param artAId + * @param artBId + * @param networkSender TODO + */ + public SkynetRelationLinkEventBase(int relTypeId, int gammaId, int branchId, Integer relId, int artAId, int artATypeId, int artBId, int artBTypeId, NetworkSender networkSender) { + super(networkSender); + this.branchId = branchId; + this.relId = relId; + this.artAId = artAId; + this.artATypeId = artATypeId; + this.artBId = artBId; + this.gammaId = gammaId; + this.relTypeId = relTypeId; + this.artBTypeId = artBTypeId; + } + + /** + * @return the branchId + */ + public int getBranchId() { + return branchId; + } + + /** + * @return the artATypeId + */ + public int getArtATypeId() { + return artATypeId; + } + + /** + * @return the artBTypeId + */ + public int getArtBTypeId() { + return artBTypeId; + } + + /** + * @return Returns the artAId. + */ + public int getArtAId() { + return artAId; + } + + /** + * @return Returns the artBId. + */ + public int getArtBId() { + return artBId; + } + + /** + * @return Returns the relId. + */ + public Integer getRelId() { + return relId; + } + + public Integer getGammaId() { + return gammaId; + } + + /** + * @return the relTypeId + */ + public int getRelTypeId() { + return relTypeId; + } +} diff --git a/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/filter/IEventFilter.java b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/filter/IEventFilter.java new file mode 100644 index 00000000000..015de98fca4 --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/filter/IEventFilter.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * 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.messaging.event.skynet.filter; + +import java.io.Serializable; +import org.eclipse.osee.framework.messaging.event.skynet.ISkynetEvent; + +/** + * @author Robert A. Fisher + */ +public interface IEventFilter extends Serializable { + + /** + * Determine if the event meets the requirement of this filter. + * + * @param event The event to inspect. + * @return boolean + */ + public boolean accepts(ISkynetEvent event); +} diff --git a/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/service/SkynetEventService.java b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/service/SkynetEventService.java new file mode 100644 index 00000000000..67980008024 --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/service/SkynetEventService.java @@ -0,0 +1,216 @@ +/******************************************************************************* + * 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.messaging.event.skynet.service; + +import java.rmi.RemoteException; +import java.util.Collection; +import java.util.Dictionary; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.concurrent.locks.ReadWriteLock; +import java.util.concurrent.locks.ReentrantReadWriteLock; +import java.util.logging.Level; +import java.util.logging.Logger; + +import net.jini.core.entry.Entry; +import net.jini.lookup.entry.Comment; +import net.jini.lookup.entry.Name; +import net.jini.lookup.entry.ServiceInfo; + +import org.eclipse.osee.framework.jdk.core.type.HashCollection; +import org.eclipse.osee.framework.jini.JiniClassServer; +import org.eclipse.osee.framework.jini.service.core.JiniService; +import org.eclipse.osee.framework.jini.service.core.SimpleFormattedEntry; +import org.eclipse.osee.framework.messaging.event.skynet.ISkynetEvent; +import org.eclipse.osee.framework.messaging.event.skynet.ISkynetEventListener; +import org.eclipse.osee.framework.messaging.event.skynet.ISkynetEventService; +import org.eclipse.osee.framework.messaging.event.skynet.SkynetEventPlugin; +import org.eclipse.osee.framework.messaging.event.skynet.filter.IEventFilter; +import org.eclipse.osee.framework.plugin.core.OseeActivator; +import org.eclipse.osee.framework.plugin.core.config.ConfigUtil; +import org.eclipse.osee.framework.plugin.core.server.BundleResourceFinder; + +/** + * Skynet Event Service handles event distribution to provide network assisted cache consistency for Skynet. + * + * @author Robert A. Fisher + */ +public class SkynetEventService extends JiniService implements ISkynetEventService { + private static final Logger logger = ConfigUtil.getConfigFactory().getLogger(SkynetEventService.class); + + private final HashCollection<IEventFilter, ISkynetEventListener> filteredListeners; + private final ReadWriteLock filteredListenersLock; + private final Collection<ISkynetEventListener> nonfilteredListeners; + private final ReadWriteLock nonfilteredListenersLock; + private static JiniClassServer jiniClassServer; + + protected SkynetEventService(String dbConfig) { + this.filteredListeners = new HashCollection<IEventFilter, ISkynetEventListener>(); + this.nonfilteredListeners = new LinkedList<ISkynetEventListener>(); + this.filteredListenersLock = new ReentrantReadWriteLock(); + this.nonfilteredListenersLock = new ReentrantReadWriteLock(); + try { + registerWithJini(dbConfig); + } catch (Exception ex) { + logger.log(Level.SEVERE, ex.toString(), ex); + } + } + + @SuppressWarnings("unchecked") + private void registerWithJini(String dbConfig) throws Exception { + jiniClassServer = JiniClassServer.getInstance(); + jiniClassServer.addResourceFinder(new BundleResourceFinder(new String[] { + "org.eclipse.osee.framework.messaging.event.skynet", "org.eclipse.osee.framework.jdk.core"})); + + Dictionary dictionary = null; + String name = "Skynet Event Service"; + String manufacturer = "Eclipse.org"; + String vendor = "Eclipse.org"; + String version = "0.0"; + String model = "SES"; + String serialNumber = "0.0"; + String description = "Skynet Event Service - Skynet Cache Network Manager"; + + OseeActivator plugin = SkynetEventPlugin.getInstance(); + if (plugin != null) { + dictionary = plugin.getBundle().getHeaders(); + } + + this.registerService(new Entry[] {new SimpleFormattedEntry("db", dbConfig), + new ServiceInfo(name, manufacturer, vendor, version, model, serialNumber), new Name(name), + new Comment(description)}, dictionary); + + System.out.println("....................Skynet Event Service(" + dbConfig + ") is Alive...................."); + this.stayAlive(); + } + + public void register(ISkynetEventListener listener, IEventFilter... filters) throws RemoteException { + + if (listener == null) { + System.out.println("the listener is null"); + return; + } + + if (filters.length == 0) { + nonfilteredListenersLock.writeLock().lock(); + try { + nonfilteredListeners.add(listener); + } finally { + nonfilteredListenersLock.writeLock().unlock(); + } + } else { + filteredListenersLock.writeLock().lock(); + try { + for (IEventFilter filter : filters) { + filteredListeners.put(filter, listener); + } + } finally { + filteredListenersLock.writeLock().unlock(); + } + } + } + + public void deregister(ISkynetEventListener listener, IEventFilter... filters) throws RemoteException { + if (filters.length == 0) { + nonfilteredListenersLock.writeLock().lock(); + try { + nonfilteredListeners.remove(listener); + } finally { + nonfilteredListenersLock.writeLock().unlock(); + } + } else { + filteredListenersLock.writeLock().lock(); + try { + for (IEventFilter filter : filters) { + filteredListeners.removeValue(filter, listener); + } + } finally { + filteredListenersLock.writeLock().unlock(); + } + } + } + + // TODO thread pool this guy + public void kick(final ISkynetEvent[] events, final ISkynetEventListener... except) throws RemoteException { + Thread thread = new Thread("kicker") { + + @Override + public void run() { + HashCollection<ISkynetEventListener, ISkynetEvent> eventSets = + new HashCollection<ISkynetEventListener, ISkynetEvent>(false, HashSet.class); + HashSet<ISkynetEventListener> exceptList = + new HashSet<ISkynetEventListener>((int) (except.length / .75f) + 1, .75f); + for (ISkynetEventListener listener : except) + exceptList.add(listener); + + nonfilteredListenersLock.readLock().lock(); + try { + // The non-filtered listeners will receive all events by definition + for (ISkynetEventListener listener : nonfilteredListeners) + for (ISkynetEvent event : events) + if (!exceptList.contains(listener)) eventSets.put(listener, event); + } finally { + nonfilteredListenersLock.readLock().unlock(); + } + + // Build sets according to the filters that the event matches + + filteredListenersLock.readLock().lock(); + try { + // Iterate all of the filters that have mappings to listeners + for (IEventFilter filter : filteredListeners.keySet()) + // Check each event against a particular filter + for (ISkynetEvent event : events) + if (filter.accepts(event)) + // When a filter accepts an event, the event to everyone listening for it + for (ISkynetEventListener listener : filteredListeners.getValues(filter)) + if (!exceptList.contains(listener)) eventSets.put(listener, event); + } finally { + filteredListenersLock.readLock().unlock(); + } + + // Kick all of the listeners with their set of events + for (ISkynetEventListener listener : eventSets.keySet()) + try { + + if (listener != null) listener.onEvent(eventSets.getValues(listener).toArray(ISkynetEvent.EMPTY_ARRAY)); + + } catch (Exception ex) { + + // TODO Remove from filteredListeners + + nonfilteredListeners.remove(listener); + logger.log(Level.SEVERE, ex.toString(), ex); + } + } + + }; + + thread.setPriority(Thread.MIN_PRIORITY); + thread.start(); + } + + public static void main(String[] args) { + if (args.length != 2) throw new IllegalArgumentException( + "Must supply the db name for the service, such as \"dbinstance:schema\""); + + new SkynetEventService(args[1]); + } + + public void kill() throws RemoteException { + this.deregisterService(); + this.commitSuicide(); + } + + public boolean isAlive() throws RemoteException { + return true; + } +}
\ No newline at end of file diff --git a/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/service/SkynetEventServicePlatformRunnable.java b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/service/SkynetEventServicePlatformRunnable.java new file mode 100644 index 00000000000..cf763c99412 --- /dev/null +++ b/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/service/SkynetEventServicePlatformRunnable.java @@ -0,0 +1,65 @@ +/******************************************************************************* + * 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.messaging.event.skynet.service; + +import java.rmi.RemoteException; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.eclipse.core.runtime.Platform; +import org.eclipse.equinox.app.IApplication; +import org.eclipse.equinox.app.IApplicationContext; +import org.eclipse.osee.framework.jdk.core.util.CmdLineArgs; +import org.eclipse.osee.framework.jdk.core.util.OseeProperties; +import org.eclipse.osee.framework.plugin.core.config.ConfigUtil; +import org.eclipse.osee.framework.plugin.core.config.HeadlessEclipseConfigurationFactory; + +/** + * @author Robert A. Fisher + */ +public class SkynetEventServicePlatformRunnable implements IApplication { + + private static final Logger logger = + ConfigUtil.getConfigFactory().getLogger(SkynetEventServicePlatformRunnable.class); + private SkynetEventService skynetEventService; + + public SkynetEventServicePlatformRunnable() { + super(); + skynetEventService = null; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext) + */ + public Object start(IApplicationContext context) throws Exception { + System.setProperty(OseeProperties.OSEE_CONFIG_FACTORY, HeadlessEclipseConfigurationFactory.class.getName()); + + CmdLineArgs commandArgs = new CmdLineArgs(Platform.getApplicationArgs()); + + String database = commandArgs.get("-database"); + skynetEventService = new SkynetEventService(database); + return EXIT_OK; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.equinox.app.IApplication#stop() + */ + public void stop() { + try { + skynetEventService.kill(); + } catch (RemoteException ex) { + logger.log(Level.SEVERE, ex.toString(), ex); + } + } +} |