diff options
Diffstat (limited to 'plugins/org.eclipse.osee.framework.messaging')
50 files changed, 2988 insertions, 2988 deletions
diff --git a/plugins/org.eclipse.osee.framework.messaging/.classpath b/plugins/org.eclipse.osee.framework.messaging/.classpath index 9a39368d975..0c22b5d7e6d 100644 --- a/plugins/org.eclipse.osee.framework.messaging/.classpath +++ b/plugins/org.eclipse.osee.framework.messaging/.classpath @@ -1,8 +1,8 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="src-gen"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="src" path="src-gen"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/plugins/org.eclipse.osee.framework.messaging/.project b/plugins/org.eclipse.osee.framework.messaging/.project index d527f69a23c..35f666cb6e6 100644 --- a/plugins/org.eclipse.osee.framework.messaging/.project +++ b/plugins/org.eclipse.osee.framework.messaging/.project @@ -1,28 +1,28 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.osee.framework.messaging</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>
+<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.osee.framework.messaging</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/plugins/org.eclipse.osee.framework.messaging/build.properties b/plugins/org.eclipse.osee.framework.messaging/build.properties index 8abae5a87e1..b3415af20a4 100644 --- a/plugins/org.eclipse.osee.framework.messaging/build.properties +++ b/plugins/org.eclipse.osee.framework.messaging/build.properties @@ -1,12 +1,12 @@ -source.. = src/,\
- src-gen/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- customBuildCallbacks.xml,\
- msgSchemas/,\
- build.properties
-customBuildCallbacks = customBuildCallbacks.xml
-customBuildCallbacks.failonerror = true
-customBuildCallbacks.inheritall = true
-custom = true
+source.. = src/,\ + src-gen/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + customBuildCallbacks.xml,\ + msgSchemas/,\ + build.properties +customBuildCallbacks = customBuildCallbacks.xml +customBuildCallbacks.failonerror = true +customBuildCallbacks.inheritall = true +custom = true diff --git a/plugins/org.eclipse.osee.framework.messaging/src-gen/org/eclipse/osee/framework/messaging/services/messages/ObjectFactory.java b/plugins/org.eclipse.osee.framework.messaging/src-gen/org/eclipse/osee/framework/messaging/services/messages/ObjectFactory.java index 54bda16ca2e..4bc61ca7b6b 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src-gen/org/eclipse/osee/framework/messaging/services/messages/ObjectFactory.java +++ b/plugins/org.eclipse.osee.framework.messaging/src-gen/org/eclipse/osee/framework/messaging/services/messages/ObjectFactory.java @@ -1,94 +1,94 @@ -//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2010.03.30 at 03:47:04 PM MST
-//
-
-
-package org.eclipse.osee.framework.messaging.services.messages;
-
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.annotation.XmlElementDecl;
-import javax.xml.bind.annotation.XmlRegistry;
-import javax.xml.namespace.QName;
-
-
-/**
- * This object contains factory methods for each
- * Java content interface and Java element interface
- * generated in the org.eclipse.osee.framework.messaging.services.messages package.
- * <p>An ObjectFactory allows you to programatically
- * construct new instances of the Java representation
- * for XML content. The Java representation of XML
- * content can consist of schema derived interfaces
- * and classes representing the binding of schema
- * type definitions, element declarations and model
- * groups. Factory methods for each of these are
- * provided in this class.
- *
- */
-@XmlRegistry
-public class ObjectFactory {
-
- private final static QName _ServiceHealth_QNAME = new QName("", "ServiceHealth");
- private final static QName _ServiceHealthRequest_QNAME = new QName("", "ServiceHealthRequest");
-
- /**
- * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.eclipse.osee.framework.messaging.services.messages
- *
- */
- public ObjectFactory() {
- }
-
- /**
- * Create an instance of {@link ServiceHealthRequest }
- *
- */
- public ServiceHealthRequest createServiceHealthRequest() {
- return new ServiceHealthRequest();
- }
-
- /**
- * Create an instance of {@link ServiceHealth }
- *
- */
- public ServiceHealth createServiceHealth() {
- return new ServiceHealth();
- }
-
- /**
- * Create an instance of {@link ServiceDescriptionPair }
- *
- */
- public ServiceDescriptionPair createServiceDescriptionPair() {
- return new ServiceDescriptionPair();
- }
-
- /**
- * Create an instance of {@link Synch }
- *
- */
- public Synch createSynch() {
- return new Synch();
- }
-
- /**
- * Create an instance of {@link JAXBElement }{@code <}{@link ServiceHealth }{@code >}}
- *
- */
- @XmlElementDecl(namespace = "", name = "ServiceHealth")
- public JAXBElement<ServiceHealth> createServiceHealth(ServiceHealth value) {
- return new JAXBElement<ServiceHealth>(_ServiceHealth_QNAME, ServiceHealth.class, null, value);
- }
-
- /**
- * Create an instance of {@link JAXBElement }{@code <}{@link ServiceHealthRequest }{@code >}}
- *
- */
- @XmlElementDecl(namespace = "", name = "ServiceHealthRequest")
- public JAXBElement<ServiceHealthRequest> createServiceHealthRequest(ServiceHealthRequest value) {
- return new JAXBElement<ServiceHealthRequest>(_ServiceHealthRequest_QNAME, ServiceHealthRequest.class, null, value);
- }
-
-}
+// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2010.03.30 at 03:47:04 PM MST +// + + +package org.eclipse.osee.framework.messaging.services.messages; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the org.eclipse.osee.framework.messaging.services.messages package. + * <p>An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _ServiceHealth_QNAME = new QName("", "ServiceHealth"); + private final static QName _ServiceHealthRequest_QNAME = new QName("", "ServiceHealthRequest"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.eclipse.osee.framework.messaging.services.messages + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link ServiceHealthRequest } + * + */ + public ServiceHealthRequest createServiceHealthRequest() { + return new ServiceHealthRequest(); + } + + /** + * Create an instance of {@link ServiceHealth } + * + */ + public ServiceHealth createServiceHealth() { + return new ServiceHealth(); + } + + /** + * Create an instance of {@link ServiceDescriptionPair } + * + */ + public ServiceDescriptionPair createServiceDescriptionPair() { + return new ServiceDescriptionPair(); + } + + /** + * Create an instance of {@link Synch } + * + */ + public Synch createSynch() { + return new Synch(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ServiceHealth }{@code >}} + * + */ + @XmlElementDecl(namespace = "", name = "ServiceHealth") + public JAXBElement<ServiceHealth> createServiceHealth(ServiceHealth value) { + return new JAXBElement<ServiceHealth>(_ServiceHealth_QNAME, ServiceHealth.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ServiceHealthRequest }{@code >}} + * + */ + @XmlElementDecl(namespace = "", name = "ServiceHealthRequest") + public JAXBElement<ServiceHealthRequest> createServiceHealthRequest(ServiceHealthRequest value) { + return new JAXBElement<ServiceHealthRequest>(_ServiceHealthRequest_QNAME, ServiceHealthRequest.class, null, value); + } + +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src-gen/org/eclipse/osee/framework/messaging/services/messages/ServiceDescriptionPair.java b/plugins/org.eclipse.osee.framework.messaging/src-gen/org/eclipse/osee/framework/messaging/services/messages/ServiceDescriptionPair.java index 4ea533fe027..1b77dbbaa15 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src-gen/org/eclipse/osee/framework/messaging/services/messages/ServiceDescriptionPair.java +++ b/plugins/org.eclipse.osee.framework.messaging/src-gen/org/eclipse/osee/framework/messaging/services/messages/ServiceDescriptionPair.java @@ -1,97 +1,97 @@ -//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2010.03.30 at 03:47:04 PM MST
-//
-
-
-package org.eclipse.osee.framework.messaging.services.messages;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for ServiceDescriptionPair complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType name="ServiceDescriptionPair">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "ServiceDescriptionPair", propOrder = {
- "name",
- "value"
-})
-public class ServiceDescriptionPair {
-
- @XmlElement(required = true)
- protected String name;
- @XmlElement(required = true)
- protected String value;
-
- /**
- * Gets the value of the name property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getName() {
- return name;
- }
-
- /**
- * Sets the value of the name property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setName(String value) {
- this.name = value;
- }
-
- /**
- * Gets the value of the value property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getValue() {
- return value;
- }
-
- /**
- * Sets the value of the value property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setValue(String value) {
- this.value = value;
- }
-
-}
+// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2010.03.30 at 03:47:04 PM MST +// + + +package org.eclipse.osee.framework.messaging.services.messages; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for ServiceDescriptionPair complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="ServiceDescriptionPair"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ServiceDescriptionPair", propOrder = { + "name", + "value" +}) +public class ServiceDescriptionPair { + + @XmlElement(required = true) + protected String name; + @XmlElement(required = true) + protected String value; + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getValue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setValue(String value) { + this.value = value; + } + +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src-gen/org/eclipse/osee/framework/messaging/services/messages/ServiceHealth.java b/plugins/org.eclipse.osee.framework.messaging/src-gen/org/eclipse/osee/framework/messaging/services/messages/ServiceHealth.java index eb544dd0a35..6b55f93e4c4 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src-gen/org/eclipse/osee/framework/messaging/services/messages/ServiceHealth.java +++ b/plugins/org.eclipse.osee.framework.messaging/src-gen/org/eclipse/osee/framework/messaging/services/messages/ServiceHealth.java @@ -1,226 +1,226 @@ -//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2010.03.30 at 03:47:04 PM MST
-//
-
-
-package org.eclipse.osee.framework.messaging.services.messages;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for ServiceHealth complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType name="ServiceHealth">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="serviceName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="serviceVersion" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="serviceUniqueId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="brokerURI" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="refreshRateInSeconds" type="{http://www.w3.org/2001/XMLSchema}int"/>
- * <element name="stopping" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
- * <element name="serviceDescription" type="{}ServiceDescriptionPair" maxOccurs="unbounded"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "ServiceHealth", propOrder = {
- "serviceName",
- "serviceVersion",
- "serviceUniqueId",
- "brokerURI",
- "refreshRateInSeconds",
- "stopping",
- "serviceDescription"
-})
-public class ServiceHealth {
-
- @XmlElement(required = true)
- protected String serviceName;
- @XmlElement(required = true)
- protected String serviceVersion;
- @XmlElement(required = true)
- protected String serviceUniqueId;
- @XmlElement(required = true)
- protected String brokerURI;
- protected int refreshRateInSeconds;
- protected boolean stopping;
- @XmlElement(required = true)
- protected List<ServiceDescriptionPair> serviceDescription;
-
- /**
- * Gets the value of the serviceName property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getServiceName() {
- return serviceName;
- }
-
- /**
- * Sets the value of the serviceName property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setServiceName(String value) {
- this.serviceName = value;
- }
-
- /**
- * Gets the value of the serviceVersion property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getServiceVersion() {
- return serviceVersion;
- }
-
- /**
- * Sets the value of the serviceVersion property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setServiceVersion(String value) {
- this.serviceVersion = value;
- }
-
- /**
- * Gets the value of the serviceUniqueId property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getServiceUniqueId() {
- return serviceUniqueId;
- }
-
- /**
- * Sets the value of the serviceUniqueId property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setServiceUniqueId(String value) {
- this.serviceUniqueId = value;
- }
-
- /**
- * Gets the value of the brokerURI property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getBrokerURI() {
- return brokerURI;
- }
-
- /**
- * Sets the value of the brokerURI property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setBrokerURI(String value) {
- this.brokerURI = value;
- }
-
- /**
- * Gets the value of the refreshRateInSeconds property.
- *
- */
- public int getRefreshRateInSeconds() {
- return refreshRateInSeconds;
- }
-
- /**
- * Sets the value of the refreshRateInSeconds property.
- *
- */
- public void setRefreshRateInSeconds(int value) {
- this.refreshRateInSeconds = value;
- }
-
- /**
- * Gets the value of the stopping property.
- *
- */
- public boolean isStopping() {
- return stopping;
- }
-
- /**
- * Sets the value of the stopping property.
- *
- */
- public void setStopping(boolean value) {
- this.stopping = value;
- }
-
- /**
- * Gets the value of the serviceDescription property.
- *
- * <p>
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a <CODE>set</CODE> method for the serviceDescription property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- * <pre>
- * getServiceDescription().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link ServiceDescriptionPair }
- *
- *
- */
- public List<ServiceDescriptionPair> getServiceDescription() {
- if (serviceDescription == null) {
- serviceDescription = new ArrayList<ServiceDescriptionPair>();
- }
- return this.serviceDescription;
- }
-
-}
+// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2010.03.30 at 03:47:04 PM MST +// + + +package org.eclipse.osee.framework.messaging.services.messages; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for ServiceHealth complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="ServiceHealth"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="serviceName" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="serviceVersion" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="serviceUniqueId" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="brokerURI" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="refreshRateInSeconds" type="{http://www.w3.org/2001/XMLSchema}int"/> + * <element name="stopping" type="{http://www.w3.org/2001/XMLSchema}boolean"/> + * <element name="serviceDescription" type="{}ServiceDescriptionPair" maxOccurs="unbounded"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ServiceHealth", propOrder = { + "serviceName", + "serviceVersion", + "serviceUniqueId", + "brokerURI", + "refreshRateInSeconds", + "stopping", + "serviceDescription" +}) +public class ServiceHealth { + + @XmlElement(required = true) + protected String serviceName; + @XmlElement(required = true) + protected String serviceVersion; + @XmlElement(required = true) + protected String serviceUniqueId; + @XmlElement(required = true) + protected String brokerURI; + protected int refreshRateInSeconds; + protected boolean stopping; + @XmlElement(required = true) + protected List<ServiceDescriptionPair> serviceDescription; + + /** + * Gets the value of the serviceName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getServiceName() { + return serviceName; + } + + /** + * Sets the value of the serviceName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setServiceName(String value) { + this.serviceName = value; + } + + /** + * Gets the value of the serviceVersion property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getServiceVersion() { + return serviceVersion; + } + + /** + * Sets the value of the serviceVersion property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setServiceVersion(String value) { + this.serviceVersion = value; + } + + /** + * Gets the value of the serviceUniqueId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getServiceUniqueId() { + return serviceUniqueId; + } + + /** + * Sets the value of the serviceUniqueId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setServiceUniqueId(String value) { + this.serviceUniqueId = value; + } + + /** + * Gets the value of the brokerURI property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getBrokerURI() { + return brokerURI; + } + + /** + * Sets the value of the brokerURI property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setBrokerURI(String value) { + this.brokerURI = value; + } + + /** + * Gets the value of the refreshRateInSeconds property. + * + */ + public int getRefreshRateInSeconds() { + return refreshRateInSeconds; + } + + /** + * Sets the value of the refreshRateInSeconds property. + * + */ + public void setRefreshRateInSeconds(int value) { + this.refreshRateInSeconds = value; + } + + /** + * Gets the value of the stopping property. + * + */ + public boolean isStopping() { + return stopping; + } + + /** + * Sets the value of the stopping property. + * + */ + public void setStopping(boolean value) { + this.stopping = value; + } + + /** + * Gets the value of the serviceDescription property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the serviceDescription property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getServiceDescription().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link ServiceDescriptionPair } + * + * + */ + public List<ServiceDescriptionPair> getServiceDescription() { + if (serviceDescription == null) { + serviceDescription = new ArrayList<ServiceDescriptionPair>(); + } + return this.serviceDescription; + } + +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src-gen/org/eclipse/osee/framework/messaging/services/messages/ServiceHealthRequest.java b/plugins/org.eclipse.osee.framework.messaging/src-gen/org/eclipse/osee/framework/messaging/services/messages/ServiceHealthRequest.java index e21fc1ab493..5c773e50601 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src-gen/org/eclipse/osee/framework/messaging/services/messages/ServiceHealthRequest.java +++ b/plugins/org.eclipse.osee.framework.messaging/src-gen/org/eclipse/osee/framework/messaging/services/messages/ServiceHealthRequest.java @@ -1,132 +1,132 @@ -//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2010.03.30 at 03:47:04 PM MST
-//
-
-
-package org.eclipse.osee.framework.messaging.services.messages;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for ServiceHealthRequest complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType name="ServiceHealthRequest">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="serviceName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="serviceVersion" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="serviceDescription" type="{}ServiceDescriptionPair" maxOccurs="unbounded"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "ServiceHealthRequest", propOrder = {
- "serviceName",
- "serviceVersion",
- "serviceDescription"
-})
-public class ServiceHealthRequest {
-
- @XmlElement(required = true)
- protected String serviceName;
- @XmlElement(required = true)
- protected String serviceVersion;
- @XmlElement(required = true)
- protected List<ServiceDescriptionPair> serviceDescription;
-
- /**
- * Gets the value of the serviceName property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getServiceName() {
- return serviceName;
- }
-
- /**
- * Sets the value of the serviceName property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setServiceName(String value) {
- this.serviceName = value;
- }
-
- /**
- * Gets the value of the serviceVersion property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getServiceVersion() {
- return serviceVersion;
- }
-
- /**
- * Sets the value of the serviceVersion property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setServiceVersion(String value) {
- this.serviceVersion = value;
- }
-
- /**
- * Gets the value of the serviceDescription property.
- *
- * <p>
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a <CODE>set</CODE> method for the serviceDescription property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- * <pre>
- * getServiceDescription().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link ServiceDescriptionPair }
- *
- *
- */
- public List<ServiceDescriptionPair> getServiceDescription() {
- if (serviceDescription == null) {
- serviceDescription = new ArrayList<ServiceDescriptionPair>();
- }
- return this.serviceDescription;
- }
-
-}
+// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2010.03.30 at 03:47:04 PM MST +// + + +package org.eclipse.osee.framework.messaging.services.messages; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for ServiceHealthRequest complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="ServiceHealthRequest"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="serviceName" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="serviceVersion" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="serviceDescription" type="{}ServiceDescriptionPair" maxOccurs="unbounded"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ServiceHealthRequest", propOrder = { + "serviceName", + "serviceVersion", + "serviceDescription" +}) +public class ServiceHealthRequest { + + @XmlElement(required = true) + protected String serviceName; + @XmlElement(required = true) + protected String serviceVersion; + @XmlElement(required = true) + protected List<ServiceDescriptionPair> serviceDescription; + + /** + * Gets the value of the serviceName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getServiceName() { + return serviceName; + } + + /** + * Sets the value of the serviceName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setServiceName(String value) { + this.serviceName = value; + } + + /** + * Gets the value of the serviceVersion property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getServiceVersion() { + return serviceVersion; + } + + /** + * Sets the value of the serviceVersion property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setServiceVersion(String value) { + this.serviceVersion = value; + } + + /** + * Gets the value of the serviceDescription property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the serviceDescription property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getServiceDescription().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link ServiceDescriptionPair } + * + * + */ + public List<ServiceDescriptionPair> getServiceDescription() { + if (serviceDescription == null) { + serviceDescription = new ArrayList<ServiceDescriptionPair>(); + } + return this.serviceDescription; + } + +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src-gen/org/eclipse/osee/framework/messaging/services/messages/Synch.java b/plugins/org.eclipse.osee.framework.messaging/src-gen/org/eclipse/osee/framework/messaging/services/messages/Synch.java index 48d1ee2b2b5..9e8659674ee 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src-gen/org/eclipse/osee/framework/messaging/services/messages/Synch.java +++ b/plugins/org.eclipse.osee.framework.messaging/src-gen/org/eclipse/osee/framework/messaging/services/messages/Synch.java @@ -1,97 +1,97 @@ -//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2010.03.30 at 03:47:04 PM MST
-//
-
-
-package org.eclipse.osee.framework.messaging.services.messages;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for Synch complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType name="Synch">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="topic" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="data" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "Synch", propOrder = {
- "topic",
- "data"
-})
-public class Synch {
-
- @XmlElement(required = true)
- protected String topic;
- @XmlElement(required = true)
- protected String data;
-
- /**
- * Gets the value of the topic property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getTopic() {
- return topic;
- }
-
- /**
- * Sets the value of the topic property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setTopic(String value) {
- this.topic = value;
- }
-
- /**
- * Gets the value of the data property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getData() {
- return data;
- }
-
- /**
- * Sets the value of the data property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setData(String value) {
- this.data = value;
- }
-
-}
+// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2010.03.30 at 03:47:04 PM MST +// + + +package org.eclipse.osee.framework.messaging.services.messages; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for Synch complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="Synch"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="topic" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="data" type="{http://www.w3.org/2001/XMLSchema}string"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "Synch", propOrder = { + "topic", + "data" +}) +public class Synch { + + @XmlElement(required = true) + protected String topic; + @XmlElement(required = true) + protected String data; + + /** + * Gets the value of the topic property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTopic() { + return topic; + } + + /** + * Sets the value of the topic property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTopic(String value) { + this.topic = value; + } + + /** + * Gets the value of the data property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getData() { + return data; + } + + /** + * Sets the value of the data property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setData(String value) { + this.data = value; + } + +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/ConnectionListener.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/ConnectionListener.java index 197924aac6b..df187a6656e 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/ConnectionListener.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/ConnectionListener.java @@ -8,14 +8,14 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging;
-
-
-/**
- * @author Andrew M. Finkbeiner
- *
- */
-public interface ConnectionListener {
- void connected(ConnectionNode node);
- void notConnected(ConnectionNode node);
-}
+package org.eclipse.osee.framework.messaging; + + +/** + * @author Andrew M. Finkbeiner + * + */ +public interface ConnectionListener { + void connected(ConnectionNode node); + void notConnected(ConnectionNode node); +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/ConnectionNode.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/ConnectionNode.java index ad9a9f684ba..fcca38bb1b6 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/ConnectionNode.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/ConnectionNode.java @@ -8,95 +8,95 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging;
-
-import java.util.Properties;
-
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-
-/**
- * @author Roberto E. Escobar
- */
-public interface ConnectionNode {
-
- /**
- * Subscribes listener to updates to message/s with the given id.
- * @param messageId
- * @param listener
- * @param statusCallback Used to relay the status of the subscribe command ( success, failure, etc). Can not be null.
- */
- void subscribe(MessageID messageId, OseeMessagingListener listener, final OseeMessagingStatusCallback statusCallback);
-
- /**
- * Subscribes listener to updates to message/s with the given id.
- * @param messageId
- * @param listener
- * @param selector A string conforming to the SQL 92 syntax used for extra filtering of subscriptions
- * @param statusCallback Used to relay the status of the subscribe command ( success, failure, etc). Can not be null.
- */
- void subscribe(MessageID messageId, OseeMessagingListener listener, String selector, final OseeMessagingStatusCallback statusCallback);
-
- /**
- * Subscribes listener to updates to message/s with the given id. A default status
- * handler will be used to log failures.
- * @param messageId
- * @param listener
- */
- void subscribe(MessageID messageId, OseeMessagingListener listener);
-
- /**
- * Unsubscribes listener from updates for message with id equal to messageId.
- * @param messageId
- * @param listener
- * @param statusCallback Used to relay the status of the unsubscribe ( success, failure, etc). Can not be null.
- */
- void unsubscribe(MessageID messageId, OseeMessagingListener listener, final OseeMessagingStatusCallback statusCallback);
-
- /**
- * Unsubscribes listener from updates for message with id equal to messageId. A default status
- * handler will be used to log failures.
- * @param messageId
- * @param listener
- */
- void unsubscribe(MessageID messageId, OseeMessagingListener listener);
-
- boolean subscribeToReply(MessageID messageId, OseeMessagingListener listener);
- boolean unsubscribteToReply(MessageID messageId, OseeMessagingListener listener);
-
- /**
- * Sends given message.
- * @param messageId
- * @param message
- * @param statusCallback Used to relay the status of the sending of the message ( success, failure, etc). Can not be null.
- * @throws OseeCoreException
- */
- void send(MessageID messageId, Object message, final OseeMessagingStatusCallback statusCallback) throws OseeCoreException;
-
- /**
- * Attaches the properties provided to the message before sending.
- * @param messageId
- * @param message
- * @param properties Set of properties to be attached to the message.
- * @param statusCallback Used to relay the status of the sending of the message ( success, failure, etc). Can not be null.
- * @throws OseeCoreException
- */
- void send(MessageID messageId, Object message, Properties properties, OseeMessagingStatusCallback statusCallback) throws OseeCoreException;
-
- /**
- * Sends given message. Uses default status handler to log failures in sending given message.
- * @param messageId
- * @param message
- * @throws OseeCoreException
- */
- void send(MessageID messageId, Object message) throws OseeCoreException;
-
- void addConnectionListener(ConnectionListener connectionListener);
- void removeConnectionListener(ConnectionListener connectionListener);
-
- void stop();
-
- String getSummary();
- String getSubscribers();
- String getSenders();
-
-}
+package org.eclipse.osee.framework.messaging; + +import java.util.Properties; + +import org.eclipse.osee.framework.core.exception.OseeCoreException; + +/** + * @author Roberto E. Escobar + */ +public interface ConnectionNode { + + /** + * Subscribes listener to updates to message/s with the given id. + * @param messageId + * @param listener + * @param statusCallback Used to relay the status of the subscribe command ( success, failure, etc). Can not be null. + */ + void subscribe(MessageID messageId, OseeMessagingListener listener, final OseeMessagingStatusCallback statusCallback); + + /** + * Subscribes listener to updates to message/s with the given id. + * @param messageId + * @param listener + * @param selector A string conforming to the SQL 92 syntax used for extra filtering of subscriptions + * @param statusCallback Used to relay the status of the subscribe command ( success, failure, etc). Can not be null. + */ + void subscribe(MessageID messageId, OseeMessagingListener listener, String selector, final OseeMessagingStatusCallback statusCallback); + + /** + * Subscribes listener to updates to message/s with the given id. A default status + * handler will be used to log failures. + * @param messageId + * @param listener + */ + void subscribe(MessageID messageId, OseeMessagingListener listener); + + /** + * Unsubscribes listener from updates for message with id equal to messageId. + * @param messageId + * @param listener + * @param statusCallback Used to relay the status of the unsubscribe ( success, failure, etc). Can not be null. + */ + void unsubscribe(MessageID messageId, OseeMessagingListener listener, final OseeMessagingStatusCallback statusCallback); + + /** + * Unsubscribes listener from updates for message with id equal to messageId. A default status + * handler will be used to log failures. + * @param messageId + * @param listener + */ + void unsubscribe(MessageID messageId, OseeMessagingListener listener); + + boolean subscribeToReply(MessageID messageId, OseeMessagingListener listener); + boolean unsubscribteToReply(MessageID messageId, OseeMessagingListener listener); + + /** + * Sends given message. + * @param messageId + * @param message + * @param statusCallback Used to relay the status of the sending of the message ( success, failure, etc). Can not be null. + * @throws OseeCoreException + */ + void send(MessageID messageId, Object message, final OseeMessagingStatusCallback statusCallback) throws OseeCoreException; + + /** + * Attaches the properties provided to the message before sending. + * @param messageId + * @param message + * @param properties Set of properties to be attached to the message. + * @param statusCallback Used to relay the status of the sending of the message ( success, failure, etc). Can not be null. + * @throws OseeCoreException + */ + void send(MessageID messageId, Object message, Properties properties, OseeMessagingStatusCallback statusCallback) throws OseeCoreException; + + /** + * Sends given message. Uses default status handler to log failures in sending given message. + * @param messageId + * @param message + * @throws OseeCoreException + */ + void send(MessageID messageId, Object message) throws OseeCoreException; + + void addConnectionListener(ConnectionListener connectionListener); + void removeConnectionListener(ConnectionListener connectionListener); + + void stop(); + + String getSummary(); + String getSubscribers(); + String getSenders(); + +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/ConnectionNodeFactory.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/ConnectionNodeFactory.java index 1123b6a5538..79cc90c2a17 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/ConnectionNodeFactory.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/ConnectionNodeFactory.java @@ -8,14 +8,14 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging;
-
-
-/**
- * @author Roberto E. Escobar
- */
-public interface ConnectionNodeFactory {
-
- ConnectionNode create(NodeInfo nodeInfo);
-
-}
+package org.eclipse.osee.framework.messaging; + + +/** + * @author Roberto E. Escobar + */ +public interface ConnectionNodeFactory { + + ConnectionNode create(NodeInfo nodeInfo); + +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/ConnectionNodeFailoverSupport.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/ConnectionNodeFailoverSupport.java index f4c9b914a2d..f9e8099a636 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/ConnectionNodeFailoverSupport.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/ConnectionNodeFailoverSupport.java @@ -8,15 +8,15 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging;
-
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-
-/**
- * @author Andrew M. Finkbeiner
- *
- */
-public interface ConnectionNodeFailoverSupport extends ConnectionNode {
- boolean isConnected();
- public void start() throws OseeCoreException;
-}
+package org.eclipse.osee.framework.messaging; + +import org.eclipse.osee.framework.core.exception.OseeCoreException; + +/** + * @author Andrew M. Finkbeiner + * + */ +public interface ConnectionNodeFailoverSupport extends ConnectionNode { + boolean isConnected(); + public void start() throws OseeCoreException; +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/EndpointSend.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/EndpointSend.java index c83d9683cdb..1c2dbe5ceb6 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/EndpointSend.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/EndpointSend.java @@ -1,22 +1,22 @@ -/*******************************************************************************
- * 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;
-
-import java.util.Properties;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-public interface EndpointSend {
- public void start(Properties properties);
-
- public void send(Message message, ExceptionHandler exceptionHandler);
-}
+/******************************************************************************* + * 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; + +import java.util.Properties; + +/** + * @author Andrew M. Finkbeiner + */ +public interface EndpointSend { + public void start(Properties properties); + + public void send(Message message, ExceptionHandler exceptionHandler); +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/MessageID.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/MessageID.java index e5caa9fd6ae..f6807a089a0 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/MessageID.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/MessageID.java @@ -8,17 +8,17 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging;
-
-import org.eclipse.osee.framework.core.data.Named;
-
-/**
- * @author Andrew M. Finkbeiner
- *
- */
-public interface MessageID extends Named {
- Class<?> getSerializationClass();
- boolean isReplyRequired();
- boolean isTopic();
- String getId();
-}
+package org.eclipse.osee.framework.messaging; + +import org.eclipse.osee.framework.core.data.Named; + +/** + * @author Andrew M. Finkbeiner + * + */ +public interface MessageID extends Named { + Class<?> getSerializationClass(); + boolean isReplyRequired(); + boolean isTopic(); + String getId(); +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/MessageService.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/MessageService.java index 1cbb1745583..d8e6ad2c1ac 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/MessageService.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/MessageService.java @@ -8,25 +8,25 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging;
-
-import java.util.Collection;
-
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-
-/**
- * @author Roberto E. Escobar
- */
-public interface MessageService {
-
- ConnectionNode getDefault() throws OseeCoreException;
-
- ConnectionNode get(NodeInfo nodeInfo) throws OseeCoreException;
-
- Collection<NodeInfo> getAvailableConnections();
-
- int size();
-
- boolean isEmpty();
-
-}
+package org.eclipse.osee.framework.messaging; + +import java.util.Collection; + +import org.eclipse.osee.framework.core.exception.OseeCoreException; + +/** + * @author Roberto E. Escobar + */ +public interface MessageService { + + ConnectionNode getDefault() throws OseeCoreException; + + ConnectionNode get(NodeInfo nodeInfo) throws OseeCoreException; + + Collection<NodeInfo> getAvailableConnections(); + + int size(); + + boolean isEmpty(); + +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/MessageServiceProvider.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/MessageServiceProvider.java index 8763d9448d0..7b8cd0fe205 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/MessageServiceProvider.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/MessageServiceProvider.java @@ -8,15 +8,15 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging;
-
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-
-/**
- * @author Roberto E. Escobar
- */
-public interface MessageServiceProvider {
-
- MessageService getMessageService() throws OseeCoreException;
-
-}
+package org.eclipse.osee.framework.messaging; + +import org.eclipse.osee.framework.core.exception.OseeCoreException; + +/** + * @author Roberto E. Escobar + */ +public interface MessageServiceProvider { + + MessageService getMessageService() throws OseeCoreException; + +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/MessagingTracker.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/MessagingTracker.java index c6b31cbc51a..1761618ee51 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/MessagingTracker.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/MessagingTracker.java @@ -8,20 +8,20 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging;
-
-
-import org.eclipse.osee.framework.messaging.internal.Activator;
-import org.osgi.util.tracker.ServiceTracker;
-
-/**
- * @author Andrew M. Finkbeiner
- *
- */
-public class MessagingTracker extends ServiceTracker {
-
- public MessagingTracker() {
- super(Activator.getInstance().getContext(), OseeMessaging.class.getName(), null);
- }
-
-}
+package org.eclipse.osee.framework.messaging; + + +import org.eclipse.osee.framework.messaging.internal.Activator; +import org.osgi.util.tracker.ServiceTracker; + +/** + * @author Andrew M. Finkbeiner + * + */ +public class MessagingTracker extends ServiceTracker { + + public MessagingTracker() { + super(Activator.getInstance().getContext(), OseeMessaging.class.getName(), null); + } + +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/NodeInfo.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/NodeInfo.java index fb199695b09..3b2ca18fe49 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/NodeInfo.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/NodeInfo.java @@ -8,77 +8,77 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging;
-
-import java.io.Serializable;
-import java.net.URI;
-
-
-/**
- * @author Roberto E. Escobar
- */
-public class NodeInfo implements Serializable {
-
- private final URI uri;
- private final String name;
- private String nameWithColon;
-
- public NodeInfo(String name, URI uri) {
- this.uri = uri;
- this.name = name;
- nameWithColon = name + ":";
- }
-
- public URI getUri() {
- return uri;
- }
-
- @Override
- public String toString() {
- return name + ":" + uri;
- }
-
- public String getComponentName() {
- return name;
- }
-
- public String getComponentNameForRoutes() {
- return nameWithColon;
- }
-
- public boolean isVMComponent() {
- return getComponentName().equals(Component.VM.getComponentName());
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + ((uri == null) ? 0 : uri.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- NodeInfo other = (NodeInfo) obj;
- if (name == null) {
- if (other.name != null)
- return false;
- } else if (!name.equals(other.name))
- return false;
- if (uri == null) {
- if (other.uri != null)
- return false;
- } else if (!uri.equals(other.uri))
- return false;
- return true;
- }
-
-}
+package org.eclipse.osee.framework.messaging; + +import java.io.Serializable; +import java.net.URI; + + +/** + * @author Roberto E. Escobar + */ +public class NodeInfo implements Serializable { + + private final URI uri; + private final String name; + private String nameWithColon; + + public NodeInfo(String name, URI uri) { + this.uri = uri; + this.name = name; + nameWithColon = name + ":"; + } + + public URI getUri() { + return uri; + } + + @Override + public String toString() { + return name + ":" + uri; + } + + public String getComponentName() { + return name; + } + + public String getComponentNameForRoutes() { + return nameWithColon; + } + + public boolean isVMComponent() { + return getComponentName().equals(Component.VM.getComponentName()); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((name == null) ? 0 : name.hashCode()); + result = prime * result + ((uri == null) ? 0 : uri.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + NodeInfo other = (NodeInfo) obj; + if (name == null) { + if (other.name != null) + return false; + } else if (!name.equals(other.name)) + return false; + if (uri == null) { + if (other.uri != null) + return false; + } else if (!uri.equals(other.uri)) + return false; + return true; + } + +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/OseeMessagingStatusCallback.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/OseeMessagingStatusCallback.java index 80ccc465fca..5f6b0ca634d 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/OseeMessagingStatusCallback.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/OseeMessagingStatusCallback.java @@ -8,14 +8,14 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging;
-
-
-/**
- * @author Andrew M. Finkbeiner
- *
- */
-public interface OseeMessagingStatusCallback {
- void success();
- void fail(Throwable th);
-}
+package org.eclipse.osee.framework.messaging; + + +/** + * @author Andrew M. Finkbeiner + * + */ +public interface OseeMessagingStatusCallback { + void success(); + void fail(Throwable th); +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/ReplyConnection.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/ReplyConnection.java index 80f0d2306ad..0549545a146 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/ReplyConnection.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/ReplyConnection.java @@ -8,15 +8,15 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging;
-
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-
-/**
- * @author Andrew M. Finkbeiner
- *
- */
-public interface ReplyConnection {
- public boolean isReplyRequested();
- public void send(Object body, Class<?> clazz, final OseeMessagingStatusCallback statusCallback) throws OseeCoreException;
-}
+package org.eclipse.osee.framework.messaging; + +import org.eclipse.osee.framework.core.exception.OseeCoreException; + +/** + * @author Andrew M. Finkbeiner + * + */ +public interface ReplyConnection { + public boolean isReplyRequested(); + public void send(Object body, Class<?> clazz, final OseeMessagingStatusCallback statusCallback) throws OseeCoreException; +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/SystemTopic.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/SystemTopic.java index bbbcfab8af6..1227c41f1e7 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/SystemTopic.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/SystemTopic.java @@ -8,44 +8,44 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging;
-
-/**
- * @author Roberto E. Escobar
- */
-public enum SystemTopic implements MessageID {
-
- JMS_HEALTH_STATUS("jms.health.status"),
- KILL_TEST_JMS_BROKER("jms.kill.broker");
-
- private String name;
-
- SystemTopic(String name) {
- this.name = name;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public Class<?> getSerializationClass() {
- return null;
- }
-
- @Override
- public boolean isReplyRequired() {
- return false;
- }
-
- @Override
- public String getId() {
- return name;
- }
-
- @Override
- public boolean isTopic() {
- return true;
- }
-}
+package org.eclipse.osee.framework.messaging; + +/** + * @author Roberto E. Escobar + */ +public enum SystemTopic implements MessageID { + + JMS_HEALTH_STATUS("jms.health.status"), + KILL_TEST_JMS_BROKER("jms.kill.broker"); + + private String name; + + SystemTopic(String name) { + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public Class<?> getSerializationClass() { + return null; + } + + @Override + public boolean isReplyRequired() { + return false; + } + + @Override + public String getId() { + return name; + } + + @Override + public boolean isTopic() { + return true; + } +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/definitions/PropertyStoreMessage.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/definitions/PropertyStoreMessage.java index 4ceab0e4935..a93a176000c 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/definitions/PropertyStoreMessage.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/definitions/PropertyStoreMessage.java @@ -8,50 +8,50 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging.definitions;
-
+package org.eclipse.osee.framework.messaging.definitions; + import java.io.Serializable; import org.eclipse.osee.framework.jdk.core.type.PropertyStore; import org.eclipse.osee.framework.messaging.Message; import org.eclipse.osee.framework.messaging.Source; import org.eclipse.osee.framework.messaging.id.MessageId; -
-/**
- * @author Michael P. Masterson
- */
-public class PropertyStoreMessage implements Message, Serializable {
-
- private static final long serialVersionUID = -8736301654726742145L;
-
- private MessageId messageId;
- private Source source;
- private PropertyStore store;
-
- public PropertyStoreMessage(MessageId messageId, Source source)
- {
- this.messageId = messageId;
- this.source = source;
- this.store = new PropertyStore("org.eclipse.osee.framework.messaging.definitions.PropertyStoreMessage");
+ +/** + * @author Michael P. Masterson + */ +public class PropertyStoreMessage implements Message, Serializable { + + private static final long serialVersionUID = -8736301654726742145L; + + private MessageId messageId; + private Source source; + private PropertyStore store; + + public PropertyStoreMessage(MessageId messageId, Source source) + { + this.messageId = messageId; + this.source = source; + this.store = new PropertyStore("org.eclipse.osee.framework.messaging.definitions.PropertyStoreMessage"); } @Override public String toString() { return String.format("PropertyStoreMessage\t[MessageId: %s]\t[source: %s]", messageId, source); - }
-
- @Override
- public MessageId getId() {
- return messageId;
- }
-
- @Override
- public Source getSource() {
- return source;
- }
-
- public PropertyStore getStore() {
- return store;
- }
-
-}
+ } + + @Override + public MessageId getId() { + return messageId; + } + + @Override + public Source getSource() { + return source; + } + + public PropertyStore getStore() { + return store; + } + +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/Activator.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/Activator.java index 6ece0850c65..f9ed1c01d22 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/Activator.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/Activator.java @@ -1,82 +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.internal;
-
-import org.eclipse.osee.framework.messaging.MessageService;
-import org.eclipse.osee.framework.messaging.MessagingGateway;
-import org.eclipse.osee.framework.messaging.internal.old.MessagingGatewayImpl;
-import org.eclipse.osee.framework.messaging.services.internal.ServiceLookupAndRegistrarLifeCycle;
-import org.eclipse.osee.framework.plugin.core.util.ExportClassLoader;
-import org.eclipse.osgi.framework.console.CommandProvider;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-public class Activator implements BundleActivator {
- private static Activator me;
- private BundleContext context;
-
- private ServiceRegistration msgServiceRegistration;
- private MessageServiceProviderImpl messageServiceProviderImpl;
- private ServiceLookupAndRegistrarLifeCycle serviceLookupAndRegistrarLifeCycle;
- // old
- private ServiceRegistration registration;
- private MessagingGatewayImpl messaging;
- private ServiceRegistration msgCommandProvider;
-
-
-
- public void start(BundleContext context) throws Exception {
- this.context = context;
- me = this;
- serviceLookupAndRegistrarLifeCycle = new ServiceLookupAndRegistrarLifeCycle(context, ExportClassLoader.getInstance());
- serviceLookupAndRegistrarLifeCycle.open(true);
-
- messageServiceProviderImpl = new MessageServiceProviderImpl(ExportClassLoader.getInstance());
- messageServiceProviderImpl.start();
- msgServiceRegistration = context.registerService(MessageService.class.getName(), messageServiceProviderImpl.getMessageService(), null);
-
- msgCommandProvider = context.registerService(CommandProvider.class.getName(), new MessageServiceConsole(messageServiceProviderImpl.getMessageService()), null);
- //old
- messaging = new MessagingGatewayImpl();
- registration = context.registerService(MessagingGateway.class.getName(), messaging, null);
- }
-
- public void stop(BundleContext context) throws Exception {
- me = null;
- this.context = null;
-
- if (msgServiceRegistration != null) {
- msgServiceRegistration.unregister();
- }
- messageServiceProviderImpl.stop();
- msgCommandProvider.unregister();
- //old
- if (registration != null) {
- registration.unregister();
- }
-
- if (messaging != null) {
- messaging.dispose();
- }
- }
-
- public static Activator getInstance() {
- return me;
- }
-
- public BundleContext getContext() {
- return context;
- }
-}
+/******************************************************************************* + * 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.internal; + +import org.eclipse.osee.framework.messaging.MessageService; +import org.eclipse.osee.framework.messaging.MessagingGateway; +import org.eclipse.osee.framework.messaging.internal.old.MessagingGatewayImpl; +import org.eclipse.osee.framework.messaging.services.internal.ServiceLookupAndRegistrarLifeCycle; +import org.eclipse.osee.framework.plugin.core.util.ExportClassLoader; +import org.eclipse.osgi.framework.console.CommandProvider; +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + +/** + * @author Andrew M. Finkbeiner + */ +public class Activator implements BundleActivator { + private static Activator me; + private BundleContext context; + + private ServiceRegistration msgServiceRegistration; + private MessageServiceProviderImpl messageServiceProviderImpl; + private ServiceLookupAndRegistrarLifeCycle serviceLookupAndRegistrarLifeCycle; + // old + private ServiceRegistration registration; + private MessagingGatewayImpl messaging; + private ServiceRegistration msgCommandProvider; + + + + public void start(BundleContext context) throws Exception { + this.context = context; + me = this; + serviceLookupAndRegistrarLifeCycle = new ServiceLookupAndRegistrarLifeCycle(context, ExportClassLoader.getInstance()); + serviceLookupAndRegistrarLifeCycle.open(true); + + messageServiceProviderImpl = new MessageServiceProviderImpl(ExportClassLoader.getInstance()); + messageServiceProviderImpl.start(); + msgServiceRegistration = context.registerService(MessageService.class.getName(), messageServiceProviderImpl.getMessageService(), null); + + msgCommandProvider = context.registerService(CommandProvider.class.getName(), new MessageServiceConsole(messageServiceProviderImpl.getMessageService()), null); + //old + messaging = new MessagingGatewayImpl(); + registration = context.registerService(MessagingGateway.class.getName(), messaging, null); + } + + public void stop(BundleContext context) throws Exception { + me = null; + this.context = null; + + if (msgServiceRegistration != null) { + msgServiceRegistration.unregister(); + } + messageServiceProviderImpl.stop(); + msgCommandProvider.unregister(); + //old + if (registration != null) { + registration.unregister(); + } + + if (messaging != null) { + messaging.dispose(); + } + } + + public static Activator getInstance() { + return me; + } + + public BundleContext getContext() { + return context; + } +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/FailoverConnectionNode.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/FailoverConnectionNode.java index c34678e9e58..0fb552264fd 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/FailoverConnectionNode.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/FailoverConnectionNode.java @@ -8,278 +8,278 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging.internal;
-
-import java.util.List;
-import java.util.Properties;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.TimeUnit;
-import java.util.logging.Level;
-
-import javax.jms.JMSException;
-
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.messaging.ConnectionListener;
-import org.eclipse.osee.framework.messaging.ConnectionNode;
-import org.eclipse.osee.framework.messaging.ConnectionNodeFailoverSupport;
-import org.eclipse.osee.framework.messaging.MessageID;
-import org.eclipse.osee.framework.messaging.OseeMessagingListener;
-import org.eclipse.osee.framework.messaging.OseeMessagingStatusCallback;
-import org.eclipse.osee.framework.messaging.internal.activemq.OseeExceptionListener;
-import org.eclipse.osee.framework.messaging.services.internal.OseeMessagingStatusImpl;
-
-/**
- * @author Andrew M. Finkbeiner This is written using ActiveMQ as the use case. So it will only retry connection and it will keep
- * all subscribes so that when a valid connection is made it will do all of the requested subscriptions.
- */
-public class FailoverConnectionNode implements ConnectionNode, Runnable {
-
- private ConnectionNodeFailoverSupport connectionNode;
- private List<SavedSubscribe> savedSubscribes;
- private List<ConnectionListener> connectionListeners;
- private ScheduledExecutorService scheduledExecutor;
- private boolean lastConnectedState = false;
- private OseeExceptionListener exceptionListener;
-private ScheduledFuture<?> itemToCancel;
-
- public FailoverConnectionNode(ConnectionNodeFailoverSupport connectionNode, ScheduledExecutorService scheduledExecutor, OseeExceptionListener exceptionListener) {
- this.connectionNode = connectionNode;
- this.exceptionListener = exceptionListener;
- exceptionListener.setListener(this);
- savedSubscribes = new CopyOnWriteArrayList<SavedSubscribe>();
- connectionListeners = new CopyOnWriteArrayList<ConnectionListener>();
- this.scheduledExecutor = scheduledExecutor;
- itemToCancel = this.scheduledExecutor.scheduleAtFixedRate(this, 60, 15, TimeUnit.SECONDS);
- }
-
- @Override
- public void send(MessageID messageId, Object message, OseeMessagingStatusCallback statusCallback) throws OseeCoreException {
- send(messageId, message, null, statusCallback);
- }
-
-
- @Override
- public void send(MessageID messageId, Object message, Properties properties, OseeMessagingStatusCallback statusCallback) throws OseeCoreException {
- attemptSmartConnect();
- if(lastConnectedState){
- try{
- connectionNode.send(messageId, message, properties, statusCallback);
- } catch (OseeCoreException ex){
- stop();
- run();
- connectionNode.send(messageId, message, properties, statusCallback);
- }
- }
- }
-
- @Override
- public void send(MessageID messageId, Object message) throws OseeCoreException {
- String errorMessage = String.format("Error sending message(%s)", messageId.getId());
- OseeMessagingStatusImpl defaultErrorHandler = new OseeMessagingStatusImpl(errorMessage, getClass());
- this.send(messageId, message, defaultErrorHandler);
- }
-
- private void attemptSmartConnect() {
- if(!lastConnectedState){
- run();
- }
- }
-
- @Override
- public void stop() {
- itemToCancel.cancel(false);
- connectionNode.stop();
- }
-
- @Override
- public void subscribe(MessageID messageId, OseeMessagingListener listener, OseeMessagingStatusCallback statusCallback) {
- savedSubscribes.add(new SavedSubscribe(messageId, listener, statusCallback));
- attemptSmartConnect();
- connectionNode.subscribe(messageId, listener, statusCallback);
- }
-
- @Override
- public void subscribe(MessageID messageId, OseeMessagingListener listener, String selector, OseeMessagingStatusCallback statusCallback) {
- savedSubscribes.add(new SavedSubscribe(messageId, listener, statusCallback));
- attemptSmartConnect();
- connectionNode.subscribe(messageId, listener, selector, statusCallback);
- }
-
- @Override
- public void subscribe(MessageID messageId, OseeMessagingListener listener) {
- String errorMessage = String.format("Error subscribing message(%s)", messageId.getId());
- OseeMessagingStatusImpl defaultErrorHandler = new OseeMessagingStatusImpl(errorMessage, getClass());
- this.subscribe(messageId, listener, defaultErrorHandler);
- }
-
- @Override
- public boolean subscribeToReply(MessageID messageId, OseeMessagingListener listener) {
- return connectionNode.subscribeToReply(messageId, listener);
- }
-
-
- @Override
- public void unsubscribe(MessageID messageId, OseeMessagingListener listener) {
- String errorMessage = String.format("Error unsubscribing message(%s)", messageId.getId());
- OseeMessagingStatusImpl defaultErrorHandler = new OseeMessagingStatusImpl(errorMessage, getClass());
- this.unsubscribe(messageId, listener, defaultErrorHandler);
- }
-
- @Override
- public void unsubscribe(MessageID messageId, OseeMessagingListener listener, OseeMessagingStatusCallback statusCallback) {
- savedSubscribes.remove(new SavedSubscribe(messageId, listener, statusCallback));
- connectionNode.unsubscribe(messageId, listener, statusCallback);
- }
-
- @Override
- public boolean unsubscribteToReply(MessageID messageId, OseeMessagingListener listener) {
- connectionNode.unsubscribteToReply(messageId, listener);
- return false;
- }
-
- public void addConnectionListener(ConnectionListener connectionListener) {
- connectionListeners.add(connectionListener);
- if (lastConnectedState) {
- connectionListener.connected(this);
- } else {
- connectionListener.notConnected(this);
- }
- }
-
- public void removeConnectionListener(ConnectionListener connectionListener) {
- connectionListeners.remove(connectionListener);
- }
-
- private void subscribeToMessages() {
- for (SavedSubscribe subscribe : savedSubscribes) {
- if(subscribe.selector == null){
- connectionNode.subscribe(subscribe.messageId, subscribe.listener, subscribe.statusCallback);
- } else {
- connectionNode.subscribe(subscribe.messageId, subscribe.listener, subscribe.selector, subscribe.statusCallback);
- }
- }
- }
-
- private class SavedSubscribe {
- MessageID messageId;
- OseeMessagingListener listener;
- OseeMessagingStatusCallback statusCallback;
- String selector;
-
- public SavedSubscribe(MessageID messageId, OseeMessagingListener listener, String selector, OseeMessagingStatusCallback statusCallback) {
- this.messageId = messageId;
- this.listener = listener;
- this.statusCallback = statusCallback;
- this.selector = selector;
- }
-
- public SavedSubscribe(MessageID messageId, OseeMessagingListener listener, OseeMessagingStatusCallback statusCallback) {
- this.messageId = messageId;
- this.listener = listener;
- this.statusCallback = statusCallback;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + getOuterType().hashCode();
- result = prime * result + ((listener == null) ? 0 : listener.hashCode());
- result = prime * result + ((messageId == null) ? 0 : messageId.hashCode());
- result = prime * result + ((statusCallback == null) ? 0 : statusCallback.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null) return false;
- if (getClass() != obj.getClass()) return false;
- SavedSubscribe other = (SavedSubscribe) obj;
- if (!getOuterType().equals(other.getOuterType())) return false;
- if (listener == null) {
- if (other.listener != null) return false;
- } else if (!listener.equals(other.listener)) return false;
- if (messageId == null) {
- if (other.messageId != null) return false;
- } else if (!messageId.equals(other.messageId)) return false;
- if (statusCallback == null) {
- if (other.statusCallback != null) return false;
- } else if (!statusCallback.equals(other.statusCallback)) return false;
- return true;
- }
-
- private FailoverConnectionNode getOuterType() {
- return FailoverConnectionNode.this;
- }
-
- }
-
- @Override
- public void run() {
- if (connectionNode.isConnected()) {
- connected();
- } else {
- try {
- connectionNode.start();
- subscribeToMessages();
- if(connectionNode.isConnected()){
- connected();
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(FailoverConnectionNode.class, Level.FINE, ex);
- notConnected();
- }
- }
- }
-
- private synchronized void connected() {
- if (!lastConnectedState) {
- lastConnectedState = true;
- notifyConnectionListenersConnected();
- }
-
- }
-
- private void notifyConnectionListenersConnected() {
- for (ConnectionListener listener : connectionListeners) {
- listener.connected(this);
- }
- }
-
- private synchronized void notConnected() {
- if (lastConnectedState) {
- notifyConnectionListenersNotConnected();
- }
- lastConnectedState = false;
- }
-
- private void notifyConnectionListenersNotConnected() {
- for (ConnectionListener listener : connectionListeners) {
- listener.notConnected(this);
- }
- }
-
- @Override
- public String getSenders() {
- return connectionNode.getSenders();
- }
-
- @Override
- public String getSubscribers() {
- return connectionNode.getSubscribers();
- }
-
- @Override
- public String getSummary() {
- return connectionNode.getSummary();
- }
-
- public void onException(JMSException ex) {
- connectionNode.stop();
- run();
- }
-}
+package org.eclipse.osee.framework.messaging.internal; + +import java.util.List; +import java.util.Properties; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; +import java.util.logging.Level; + +import javax.jms.JMSException; + +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.logging.OseeLog; +import org.eclipse.osee.framework.messaging.ConnectionListener; +import org.eclipse.osee.framework.messaging.ConnectionNode; +import org.eclipse.osee.framework.messaging.ConnectionNodeFailoverSupport; +import org.eclipse.osee.framework.messaging.MessageID; +import org.eclipse.osee.framework.messaging.OseeMessagingListener; +import org.eclipse.osee.framework.messaging.OseeMessagingStatusCallback; +import org.eclipse.osee.framework.messaging.internal.activemq.OseeExceptionListener; +import org.eclipse.osee.framework.messaging.services.internal.OseeMessagingStatusImpl; + +/** + * @author Andrew M. Finkbeiner This is written using ActiveMQ as the use case. So it will only retry connection and it will keep + * all subscribes so that when a valid connection is made it will do all of the requested subscriptions. + */ +public class FailoverConnectionNode implements ConnectionNode, Runnable { + + private ConnectionNodeFailoverSupport connectionNode; + private List<SavedSubscribe> savedSubscribes; + private List<ConnectionListener> connectionListeners; + private ScheduledExecutorService scheduledExecutor; + private boolean lastConnectedState = false; + private OseeExceptionListener exceptionListener; +private ScheduledFuture<?> itemToCancel; + + public FailoverConnectionNode(ConnectionNodeFailoverSupport connectionNode, ScheduledExecutorService scheduledExecutor, OseeExceptionListener exceptionListener) { + this.connectionNode = connectionNode; + this.exceptionListener = exceptionListener; + exceptionListener.setListener(this); + savedSubscribes = new CopyOnWriteArrayList<SavedSubscribe>(); + connectionListeners = new CopyOnWriteArrayList<ConnectionListener>(); + this.scheduledExecutor = scheduledExecutor; + itemToCancel = this.scheduledExecutor.scheduleAtFixedRate(this, 60, 15, TimeUnit.SECONDS); + } + + @Override + public void send(MessageID messageId, Object message, OseeMessagingStatusCallback statusCallback) throws OseeCoreException { + send(messageId, message, null, statusCallback); + } + + + @Override + public void send(MessageID messageId, Object message, Properties properties, OseeMessagingStatusCallback statusCallback) throws OseeCoreException { + attemptSmartConnect(); + if(lastConnectedState){ + try{ + connectionNode.send(messageId, message, properties, statusCallback); + } catch (OseeCoreException ex){ + stop(); + run(); + connectionNode.send(messageId, message, properties, statusCallback); + } + } + } + + @Override + public void send(MessageID messageId, Object message) throws OseeCoreException { + String errorMessage = String.format("Error sending message(%s)", messageId.getId()); + OseeMessagingStatusImpl defaultErrorHandler = new OseeMessagingStatusImpl(errorMessage, getClass()); + this.send(messageId, message, defaultErrorHandler); + } + + private void attemptSmartConnect() { + if(!lastConnectedState){ + run(); + } + } + + @Override + public void stop() { + itemToCancel.cancel(false); + connectionNode.stop(); + } + + @Override + public void subscribe(MessageID messageId, OseeMessagingListener listener, OseeMessagingStatusCallback statusCallback) { + savedSubscribes.add(new SavedSubscribe(messageId, listener, statusCallback)); + attemptSmartConnect(); + connectionNode.subscribe(messageId, listener, statusCallback); + } + + @Override + public void subscribe(MessageID messageId, OseeMessagingListener listener, String selector, OseeMessagingStatusCallback statusCallback) { + savedSubscribes.add(new SavedSubscribe(messageId, listener, statusCallback)); + attemptSmartConnect(); + connectionNode.subscribe(messageId, listener, selector, statusCallback); + } + + @Override + public void subscribe(MessageID messageId, OseeMessagingListener listener) { + String errorMessage = String.format("Error subscribing message(%s)", messageId.getId()); + OseeMessagingStatusImpl defaultErrorHandler = new OseeMessagingStatusImpl(errorMessage, getClass()); + this.subscribe(messageId, listener, defaultErrorHandler); + } + + @Override + public boolean subscribeToReply(MessageID messageId, OseeMessagingListener listener) { + return connectionNode.subscribeToReply(messageId, listener); + } + + + @Override + public void unsubscribe(MessageID messageId, OseeMessagingListener listener) { + String errorMessage = String.format("Error unsubscribing message(%s)", messageId.getId()); + OseeMessagingStatusImpl defaultErrorHandler = new OseeMessagingStatusImpl(errorMessage, getClass()); + this.unsubscribe(messageId, listener, defaultErrorHandler); + } + + @Override + public void unsubscribe(MessageID messageId, OseeMessagingListener listener, OseeMessagingStatusCallback statusCallback) { + savedSubscribes.remove(new SavedSubscribe(messageId, listener, statusCallback)); + connectionNode.unsubscribe(messageId, listener, statusCallback); + } + + @Override + public boolean unsubscribteToReply(MessageID messageId, OseeMessagingListener listener) { + connectionNode.unsubscribteToReply(messageId, listener); + return false; + } + + public void addConnectionListener(ConnectionListener connectionListener) { + connectionListeners.add(connectionListener); + if (lastConnectedState) { + connectionListener.connected(this); + } else { + connectionListener.notConnected(this); + } + } + + public void removeConnectionListener(ConnectionListener connectionListener) { + connectionListeners.remove(connectionListener); + } + + private void subscribeToMessages() { + for (SavedSubscribe subscribe : savedSubscribes) { + if(subscribe.selector == null){ + connectionNode.subscribe(subscribe.messageId, subscribe.listener, subscribe.statusCallback); + } else { + connectionNode.subscribe(subscribe.messageId, subscribe.listener, subscribe.selector, subscribe.statusCallback); + } + } + } + + private class SavedSubscribe { + MessageID messageId; + OseeMessagingListener listener; + OseeMessagingStatusCallback statusCallback; + String selector; + + public SavedSubscribe(MessageID messageId, OseeMessagingListener listener, String selector, OseeMessagingStatusCallback statusCallback) { + this.messageId = messageId; + this.listener = listener; + this.statusCallback = statusCallback; + this.selector = selector; + } + + public SavedSubscribe(MessageID messageId, OseeMessagingListener listener, OseeMessagingStatusCallback statusCallback) { + this.messageId = messageId; + this.listener = listener; + this.statusCallback = statusCallback; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + getOuterType().hashCode(); + result = prime * result + ((listener == null) ? 0 : listener.hashCode()); + result = prime * result + ((messageId == null) ? 0 : messageId.hashCode()); + result = prime * result + ((statusCallback == null) ? 0 : statusCallback.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; + SavedSubscribe other = (SavedSubscribe) obj; + if (!getOuterType().equals(other.getOuterType())) return false; + if (listener == null) { + if (other.listener != null) return false; + } else if (!listener.equals(other.listener)) return false; + if (messageId == null) { + if (other.messageId != null) return false; + } else if (!messageId.equals(other.messageId)) return false; + if (statusCallback == null) { + if (other.statusCallback != null) return false; + } else if (!statusCallback.equals(other.statusCallback)) return false; + return true; + } + + private FailoverConnectionNode getOuterType() { + return FailoverConnectionNode.this; + } + + } + + @Override + public void run() { + if (connectionNode.isConnected()) { + connected(); + } else { + try { + connectionNode.start(); + subscribeToMessages(); + if(connectionNode.isConnected()){ + connected(); + } + } catch (OseeCoreException ex) { + OseeLog.log(FailoverConnectionNode.class, Level.FINE, ex); + notConnected(); + } + } + } + + private synchronized void connected() { + if (!lastConnectedState) { + lastConnectedState = true; + notifyConnectionListenersConnected(); + } + + } + + private void notifyConnectionListenersConnected() { + for (ConnectionListener listener : connectionListeners) { + listener.connected(this); + } + } + + private synchronized void notConnected() { + if (lastConnectedState) { + notifyConnectionListenersNotConnected(); + } + lastConnectedState = false; + } + + private void notifyConnectionListenersNotConnected() { + for (ConnectionListener listener : connectionListeners) { + listener.notConnected(this); + } + } + + @Override + public String getSenders() { + return connectionNode.getSenders(); + } + + @Override + public String getSubscribers() { + return connectionNode.getSubscribers(); + } + + @Override + public String getSummary() { + return connectionNode.getSummary(); + } + + public void onException(JMSException ex) { + connectionNode.stop(); + run(); + } +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/JAXBUtil.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/JAXBUtil.java index 544bd3e13eb..f3599890145 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/JAXBUtil.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/JAXBUtil.java @@ -8,48 +8,48 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging.internal;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-
-import javax.xml.bind.JAXB;
-import javax.xml.transform.stream.StreamSource;
-
-import org.eclipse.osee.framework.messaging.OseeMessagingListener;
-
-/**
- * @author Andrew M. Finkbeiner
- *
- */
-public class JAXBUtil {
-
- public static void marshal(Object obj, OutputStream stream){
- JAXB.marshal(obj, stream);
- }
-
- public static String marshal(Object obj) throws UnsupportedEncodingException{
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- marshal(obj, os);
- return new String(os.toByteArray(), "UTF-8");
- }
-
- public static Object unmarshal(String str, Class<?> clazz) throws UnsupportedEncodingException{
- ByteArrayInputStream is = new ByteArrayInputStream(str.getBytes("UTF-8"));
- return JAXB.unmarshal(new StreamSource(is), clazz);
- }
-
- public static Object unmarshal(Object body, OseeMessagingListener listener) throws UnsupportedEncodingException{
- Class<?> pojoType = listener.getClazz();
- Object messageBody;
- if (pojoType == null) {
- messageBody = body;
- } else {
- messageBody = JAXBUtil.unmarshal(body.toString(), pojoType);
- }
- return messageBody;
- }
-
-}
+package org.eclipse.osee.framework.messaging.internal; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.OutputStream; +import java.io.UnsupportedEncodingException; + +import javax.xml.bind.JAXB; +import javax.xml.transform.stream.StreamSource; + +import org.eclipse.osee.framework.messaging.OseeMessagingListener; + +/** + * @author Andrew M. Finkbeiner + * + */ +public class JAXBUtil { + + public static void marshal(Object obj, OutputStream stream){ + JAXB.marshal(obj, stream); + } + + public static String marshal(Object obj) throws UnsupportedEncodingException{ + ByteArrayOutputStream os = new ByteArrayOutputStream(); + marshal(obj, os); + return new String(os.toByteArray(), "UTF-8"); + } + + public static Object unmarshal(String str, Class<?> clazz) throws UnsupportedEncodingException{ + ByteArrayInputStream is = new ByteArrayInputStream(str.getBytes("UTF-8")); + return JAXB.unmarshal(new StreamSource(is), clazz); + } + + public static Object unmarshal(Object body, OseeMessagingListener listener) throws UnsupportedEncodingException{ + Class<?> pojoType = listener.getClazz(); + Object messageBody; + if (pojoType == null) { + messageBody = body; + } else { + messageBody = JAXBUtil.unmarshal(body.toString(), pojoType); + } + return messageBody; + } + +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/MessageServiceConsole.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/MessageServiceConsole.java index 019d1ad97c5..cec54b89263 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/MessageServiceConsole.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/MessageServiceConsole.java @@ -8,38 +8,38 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging.internal;
-
-import org.eclipse.osee.framework.messaging.ConnectionNode;
-import org.eclipse.osee.framework.messaging.MessageService;
-import org.eclipse.osee.framework.messaging.NodeInfo;
-import org.eclipse.osgi.framework.console.CommandInterpreter;
-import org.eclipse.osgi.framework.console.CommandProvider;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-public class MessageServiceConsole implements CommandProvider {
-
- private MessageService messageService;
-
- MessageServiceConsole(MessageService messageService) {
- this.messageService = messageService;
- }
-
- public void _printSummary(CommandInterpreter ci) throws Exception {
- for (NodeInfo info : messageService.getAvailableConnections()) {
- ConnectionNode node = messageService.get(info);
- ci.println(node.getSummary());
- }
- }
-
- @Override
- public String getHelp() {
- StringBuilder sb = new StringBuilder();
- sb.append("---Message Service Commands---\n");
- sb.append("\tprintSummary - prints a Summary of all ConnectionNodes.\n");
- return sb.toString();
- }
-
-}
+package org.eclipse.osee.framework.messaging.internal; + +import org.eclipse.osee.framework.messaging.ConnectionNode; +import org.eclipse.osee.framework.messaging.MessageService; +import org.eclipse.osee.framework.messaging.NodeInfo; +import org.eclipse.osgi.framework.console.CommandInterpreter; +import org.eclipse.osgi.framework.console.CommandProvider; + +/** + * @author Andrew M. Finkbeiner + */ +public class MessageServiceConsole implements CommandProvider { + + private MessageService messageService; + + MessageServiceConsole(MessageService messageService) { + this.messageService = messageService; + } + + public void _printSummary(CommandInterpreter ci) throws Exception { + for (NodeInfo info : messageService.getAvailableConnections()) { + ConnectionNode node = messageService.get(info); + ci.println(node.getSummary()); + } + } + + @Override + public String getHelp() { + StringBuilder sb = new StringBuilder(); + sb.append("---Message Service Commands---\n"); + sb.append("\tprintSummary - prints a Summary of all ConnectionNodes.\n"); + return sb.toString(); + } + +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/MessageServiceImpl.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/MessageServiceImpl.java index 8a6a6f22724..ce756e8cd9d 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/MessageServiceImpl.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/MessageServiceImpl.java @@ -8,88 +8,88 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging.internal;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-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.ConnectionNode;
-import org.eclipse.osee.framework.messaging.ConnectionNodeFactory;
-import org.eclipse.osee.framework.messaging.MessageService;
-import org.eclipse.osee.framework.messaging.NodeInfo;
-
-/**
- * @author Roberto E. Escobar
- */
-public class MessageServiceImpl implements MessageService {
- private static final String VM_URI = "vm://localhost?broker.persistent=false";
-
- private final NodeInfo defaultNode;
- private final Map<NodeInfo, ConnectionNode> connectionNodes;
- private final ConnectionNodeFactory factory;
-
- public MessageServiceImpl(ConnectionNodeFactory factory) {
- this.connectionNodes = new ConcurrentHashMap<NodeInfo, ConnectionNode>();
- this.factory = factory;
- defaultNode = new NodeInfo("osee-jms", getDefaultURI());
- }
-
- private URI getDefaultURI() {
- URI defaultURI = null;
- String uri = System.getProperty("osee.broker.primary.uri");
- if (uri == null) {
- uri = VM_URI;
- }
- try {
- defaultURI = new URI(uri);
- } catch (URISyntaxException ex) {
- try {
- defaultURI = new URI(VM_URI);
- } catch (URISyntaxException ex1) {
- OseeLog.log(MessageServiceImpl.class, Level.SEVERE, ex1);
- }
- }
- OseeLog.log(Activator.class, Level.FINER, String.format("Default URI for message Service [%s]", defaultURI.toASCIIString()));
- return defaultURI;
- }
-
- @Override
- public ConnectionNode getDefault() throws OseeCoreException {
- return get(defaultNode);
- }
-
- public Collection<NodeInfo> getAvailableConnections() {
- return new ArrayList<NodeInfo>(connectionNodes.keySet());
- }
-
- public int size() {
- return connectionNodes.size();
- }
-
- public boolean isEmpty() {
- return connectionNodes.isEmpty();
- }
-
- public ConnectionNode get(NodeInfo nodeInfo) throws OseeCoreException {
- ConnectionNode node = connectionNodes.get(nodeInfo);
- if (node == null) {
- OseeLog.log(Activator.class, Level.FINEST, String.format("going to create a new Connection Node for [%s]", nodeInfo.toString()));
- node = factory.create(nodeInfo);
- connectionNodes.put(nodeInfo, (ConnectionNode)node);
- OseeLog.log(Activator.class, Level.FINE, String.format("Created a new Connection Node for [%s]", nodeInfo.toString()));
- }
- return node;
- }
-
- void stop() {
- for(ConnectionNode node:connectionNodes.values()){
- node.stop();
- }
- }
-}
+package org.eclipse.osee.framework.messaging.internal; + +import java.net.URI; +import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +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.ConnectionNode; +import org.eclipse.osee.framework.messaging.ConnectionNodeFactory; +import org.eclipse.osee.framework.messaging.MessageService; +import org.eclipse.osee.framework.messaging.NodeInfo; + +/** + * @author Roberto E. Escobar + */ +public class MessageServiceImpl implements MessageService { + private static final String VM_URI = "vm://localhost?broker.persistent=false"; + + private final NodeInfo defaultNode; + private final Map<NodeInfo, ConnectionNode> connectionNodes; + private final ConnectionNodeFactory factory; + + public MessageServiceImpl(ConnectionNodeFactory factory) { + this.connectionNodes = new ConcurrentHashMap<NodeInfo, ConnectionNode>(); + this.factory = factory; + defaultNode = new NodeInfo("osee-jms", getDefaultURI()); + } + + private URI getDefaultURI() { + URI defaultURI = null; + String uri = System.getProperty("osee.broker.primary.uri"); + if (uri == null) { + uri = VM_URI; + } + try { + defaultURI = new URI(uri); + } catch (URISyntaxException ex) { + try { + defaultURI = new URI(VM_URI); + } catch (URISyntaxException ex1) { + OseeLog.log(MessageServiceImpl.class, Level.SEVERE, ex1); + } + } + OseeLog.log(Activator.class, Level.FINER, String.format("Default URI for message Service [%s]", defaultURI.toASCIIString())); + return defaultURI; + } + + @Override + public ConnectionNode getDefault() throws OseeCoreException { + return get(defaultNode); + } + + public Collection<NodeInfo> getAvailableConnections() { + return new ArrayList<NodeInfo>(connectionNodes.keySet()); + } + + public int size() { + return connectionNodes.size(); + } + + public boolean isEmpty() { + return connectionNodes.isEmpty(); + } + + public ConnectionNode get(NodeInfo nodeInfo) throws OseeCoreException { + ConnectionNode node = connectionNodes.get(nodeInfo); + if (node == null) { + OseeLog.log(Activator.class, Level.FINEST, String.format("going to create a new Connection Node for [%s]", nodeInfo.toString())); + node = factory.create(nodeInfo); + connectionNodes.put(nodeInfo, (ConnectionNode)node); + OseeLog.log(Activator.class, Level.FINE, String.format("Created a new Connection Node for [%s]", nodeInfo.toString())); + } + return node; + } + + void stop() { + for(ConnectionNode node:connectionNodes.values()){ + node.stop(); + } + } +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/MessageServiceProviderImpl.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/MessageServiceProviderImpl.java index 037e1c5f468..642a5e62cd5 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/MessageServiceProviderImpl.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/MessageServiceProviderImpl.java @@ -8,41 +8,41 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging.internal;
-
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.messaging.MessageService;
-import org.eclipse.osee.framework.messaging.MessageServiceProvider;
-import org.eclipse.osee.framework.messaging.internal.activemq.ConnectionNodeFactoryImpl;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-public class MessageServiceProviderImpl implements MessageServiceProvider {
-
- private MessageServiceImpl messageService;
- private ExecutorService executor;
- private ClassLoader contextClassLoader;
-
- MessageServiceProviderImpl(ClassLoader contextClassLoader) {
- this.contextClassLoader = contextClassLoader;
- }
-
- public void start() throws Exception {
-// Thread.currentThread().setContextClassLoader(contextClassLoader);
- executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
- messageService = new MessageServiceImpl(new ConnectionNodeFactoryImpl("1.0", Integer.toString(hashCode()), executor));
- }
-
- public void stop() throws Exception {
- messageService.stop();
- executor.shutdown();
- }
-
- @Override
- public MessageService getMessageService() throws OseeCoreException {
- return messageService;
- }
-}
+package org.eclipse.osee.framework.messaging.internal; + +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.messaging.MessageService; +import org.eclipse.osee.framework.messaging.MessageServiceProvider; +import org.eclipse.osee.framework.messaging.internal.activemq.ConnectionNodeFactoryImpl; + +/** + * @author Andrew M. Finkbeiner + */ +public class MessageServiceProviderImpl implements MessageServiceProvider { + + private MessageServiceImpl messageService; + private ExecutorService executor; + private ClassLoader contextClassLoader; + + MessageServiceProviderImpl(ClassLoader contextClassLoader) { + this.contextClassLoader = contextClassLoader; + } + + public void start() throws Exception { +// Thread.currentThread().setContextClassLoader(contextClassLoader); + executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()); + messageService = new MessageServiceImpl(new ConnectionNodeFactoryImpl("1.0", Integer.toString(hashCode()), executor)); + } + + public void stop() throws Exception { + messageService.stop(); + executor.shutdown(); + } + + @Override + public MessageService getMessageService() throws OseeCoreException { + return messageService; + } +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/activemq/ActiveMqUtil.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/activemq/ActiveMqUtil.java index 113e5519b89..aff0e2a5e55 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/activemq/ActiveMqUtil.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/activemq/ActiveMqUtil.java @@ -8,78 +8,78 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging.internal.activemq;
-
-import java.io.Serializable;
-import java.io.UnsupportedEncodingException;
-
-import javax.jms.BytesMessage;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.ObjectMessage;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeExceptions;
-import org.eclipse.osee.framework.messaging.internal.JAXBUtil;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-class ActiveMqUtil {
-
- ActiveMqUtil(){
-
- }
-
- Object translateMessage(Message message, Class<?> clazz) throws OseeCoreException, JMSException {
- Object messageBody = message;
- if (message instanceof TextMessage) {
- String text = ((TextMessage) message).getText();
- if (clazz != null) {
- try {
- messageBody = JAXBUtil.unmarshal(text, clazz);
- } catch (UnsupportedEncodingException ex) {
- OseeExceptions.wrapAndThrow(ex);
- }
- } else {
- messageBody = text;
- }
- } else if(message instanceof BytesMessage){
- int length = (int)((BytesMessage)message).getBodyLength();
- byte[] bytes = new byte[length];
- ((BytesMessage)message).readBytes(bytes);
- messageBody = bytes;
- } else if(message instanceof ObjectMessage){
- messageBody = ((ObjectMessage)message).getObject();
- }
- return messageBody;
- }
-
- Message createMessage(Session session, Class<?> clazz, Object body) throws OseeCoreException, JMSException {
- body = tryToGetSerialized(clazz, body);
- if (body instanceof String) {
- return session.createTextMessage((String) body);
- } else if (body instanceof byte[]) {
- BytesMessage byteMessage = session.createBytesMessage();
- byteMessage.writeBytes((byte[]) body);
- return byteMessage;
- } else if (body instanceof Serializable){
- return session.createObjectMessage((Serializable)body);
- } else {
- throw new OseeCoreException(String.format("Unsupported java type [%s]", body.getClass().getName()));
- }
- }
-
- private Object tryToGetSerialized(Class<?> clazz, Object body) throws OseeCoreException {
- if (clazz != null) {
- try {
- return JAXBUtil.marshal(body);
- } catch (UnsupportedEncodingException ex) {
- OseeExceptions.wrapAndThrow(ex);
- }
- }
- return body;
- }
-}
+package org.eclipse.osee.framework.messaging.internal.activemq; + +import java.io.Serializable; +import java.io.UnsupportedEncodingException; + +import javax.jms.BytesMessage; +import javax.jms.JMSException; +import javax.jms.Message; +import javax.jms.ObjectMessage; +import javax.jms.Session; +import javax.jms.TextMessage; + +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.core.exception.OseeExceptions; +import org.eclipse.osee.framework.messaging.internal.JAXBUtil; + +/** + * @author Andrew M. Finkbeiner + */ +class ActiveMqUtil { + + ActiveMqUtil(){ + + } + + Object translateMessage(Message message, Class<?> clazz) throws OseeCoreException, JMSException { + Object messageBody = message; + if (message instanceof TextMessage) { + String text = ((TextMessage) message).getText(); + if (clazz != null) { + try { + messageBody = JAXBUtil.unmarshal(text, clazz); + } catch (UnsupportedEncodingException ex) { + OseeExceptions.wrapAndThrow(ex); + } + } else { + messageBody = text; + } + } else if(message instanceof BytesMessage){ + int length = (int)((BytesMessage)message).getBodyLength(); + byte[] bytes = new byte[length]; + ((BytesMessage)message).readBytes(bytes); + messageBody = bytes; + } else if(message instanceof ObjectMessage){ + messageBody = ((ObjectMessage)message).getObject(); + } + return messageBody; + } + + Message createMessage(Session session, Class<?> clazz, Object body) throws OseeCoreException, JMSException { + body = tryToGetSerialized(clazz, body); + if (body instanceof String) { + return session.createTextMessage((String) body); + } else if (body instanceof byte[]) { + BytesMessage byteMessage = session.createBytesMessage(); + byteMessage.writeBytes((byte[]) body); + return byteMessage; + } else if (body instanceof Serializable){ + return session.createObjectMessage((Serializable)body); + } else { + throw new OseeCoreException(String.format("Unsupported java type [%s]", body.getClass().getName())); + } + } + + private Object tryToGetSerialized(Class<?> clazz, Object body) throws OseeCoreException { + if (clazz != null) { + try { + return JAXBUtil.marshal(body); + } catch (UnsupportedEncodingException ex) { + OseeExceptions.wrapAndThrow(ex); + } + } + return body; + } +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/activemq/ConnectionNodeActiveMq.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/activemq/ConnectionNodeActiveMq.java index 89414e8124c..7e51609cb2a 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/activemq/ConnectionNodeActiveMq.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/activemq/ConnectionNodeActiveMq.java @@ -8,393 +8,393 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging.internal.activemq;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Properties;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ExecutorService;
-import java.util.logging.Level;
-
-import javax.jms.Connection;
-import javax.jms.DeliveryMode;
-import javax.jms.ExceptionListener;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TemporaryTopic;
-import javax.jms.Topic;
-
-import org.apache.activemq.ActiveMQConnectionFactory;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeWrappedException;
-import org.eclipse.osee.framework.jdk.core.type.CompositeKeyHashMap;
-import org.eclipse.osee.framework.jdk.core.type.Pair;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.messaging.ConnectionListener;
-import org.eclipse.osee.framework.messaging.ConnectionNodeFailoverSupport;
-import org.eclipse.osee.framework.messaging.MessageID;
-import org.eclipse.osee.framework.messaging.NodeInfo;
-import org.eclipse.osee.framework.messaging.OseeMessagingListener;
-import org.eclipse.osee.framework.messaging.OseeMessagingStatusCallback;
-import org.eclipse.osee.framework.messaging.internal.Activator;
-import org.eclipse.osee.framework.messaging.services.internal.OseeMessagingStatusImpl;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-class ConnectionNodeActiveMq implements ConnectionNodeFailoverSupport, MessageListener {
-
- // private String version;
- // private String sourceId;
- private NodeInfo nodeInfo;
- // private ExecutorService executor;
- private Connection connection;
- private Session session;
- private TemporaryTopic temporaryTopic;
- private MessageConsumer replyToConsumer;
- private Map<String, OseeMessagingListener> replyListeners;
- private CompositeKeyHashMap<String, MessageConsumer, OseeMessagingListener> regularListeners;
- private boolean started = false;
-
- private ConcurrentHashMap<String, Topic> topicCache;
- private ConcurrentHashMap<Topic, MessageProducer> messageProducerCache;
- private final ExceptionListener exceptionListener;
-
- private MessageProducer replyProducer;
- private ActiveMqUtil activeMqUtil;
-
- public ConnectionNodeActiveMq(String version, String sourceId, NodeInfo nodeInfo, ExecutorService executor, ExceptionListener exceptionListener) {
- this.nodeInfo = nodeInfo;
- this.exceptionListener = exceptionListener;
- activeMqUtil = new ActiveMqUtil();
- topicCache = new ConcurrentHashMap<String, Topic>();
- messageProducerCache = new ConcurrentHashMap<Topic, MessageProducer>();
- regularListeners = new CompositeKeyHashMap<String, MessageConsumer, OseeMessagingListener>(64, true);
- replyListeners = new ConcurrentHashMap<String, OseeMessagingListener>();
- }
-
- public synchronized void start() throws OseeCoreException {
- if (started) {
- return;
- }
- try {
- String uri = nodeInfo.getUri().toASCIIString();
- ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(ActiveMQConnectionFactory.DEFAULT_USER, ActiveMQConnectionFactory.DEFAULT_PASSWORD, uri);
- connection = factory.createConnection();
- connection.setExceptionListener(exceptionListener);
- session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
- temporaryTopic = session.createTemporaryTopic();
- replyToConsumer = session.createConsumer(temporaryTopic);
- replyToConsumer.setMessageListener(this);
- replyProducer = session.createProducer(null);
- connection.start();
- started = true;
- } catch (Throwable ex) {
- throw new OseeWrappedException(ex);
- }
- }
-
- @Override
- public void send(MessageID topic, Object body) throws OseeCoreException {
- String errorMessage = String.format("Error sending message(%s)", topic.getId());
- OseeMessagingStatusImpl defaultErrorHandler = new OseeMessagingStatusImpl(errorMessage, getClass());
- this.send(topic, body, defaultErrorHandler);
- }
-
- @Override
- public synchronized void send(MessageID messageId, Object message, OseeMessagingStatusCallback statusCallback) throws OseeCoreException {
- send(messageId, message, null, statusCallback);
- }
-
- @Override
- public synchronized void send(MessageID messageId, Object message, Properties properties, OseeMessagingStatusCallback statusCallback) throws OseeCoreException {
- try {
- if (messageId.isTopic()) {
- try{
- sendInternal(messageId, message, properties, statusCallback);
- } catch (JMSException ex){
- removeProducerFromCache(messageId);
- sendInternal(messageId, message, properties, statusCallback);
- }
- // OseeLog.log(Activator.class, Level.FINE, String.format("Sending message %s - %s", topic.getName(), topic.getGuid()));
- statusCallback.success();
- }
- } catch (JMSException ex) {
- statusCallback.fail(ex);
- throw new OseeWrappedException(ex);
- } catch (NullPointerException ex) {
- statusCallback.fail(ex);
- throw new OseeWrappedException(ex);
- }
- }
-
- private synchronized void sendInternal(MessageID messageId, Object message, Properties properties, OseeMessagingStatusCallback statusCallback) throws JMSException, OseeCoreException {
- Topic destination = getOrCreateTopic(messageId);
- MessageProducer producer = getOrCreateProducer(destination);
- Message msg = activeMqUtil.createMessage(session, messageId.getSerializationClass(), message);
- if (messageId.isReplyRequired()) {
- msg.setJMSReplyTo(temporaryTopic);
- }
- if(properties != null){
- for(Entry<Object, Object> entry:properties.entrySet()){
- if(entry.getValue() instanceof Integer){
- msg.setIntProperty(entry.getKey().toString(), (Integer)entry.getValue());
- } if(entry.getValue() instanceof Boolean){
- msg.setBooleanProperty(entry.getKey().toString(), (Boolean)entry.getValue());
- } if(entry.getValue() instanceof Byte){
- msg.setByteProperty(entry.getKey().toString(), (Byte)entry.getValue());
- } if(entry.getValue() instanceof Double){
- msg.setDoubleProperty(entry.getKey().toString(), (Double)entry.getValue());
- } if(entry.getValue() instanceof Float){
- msg.setFloatProperty(entry.getKey().toString(), (Float)entry.getValue());
- } if(entry.getValue() instanceof Long){
- msg.setLongProperty(entry.getKey().toString(), (Long)entry.getValue());
- } if(entry.getValue() instanceof String){
- msg.setStringProperty(entry.getKey().toString(), (String)entry.getValue());
- } if(entry.getValue() instanceof Short){
- msg.setShortProperty(entry.getKey().toString(), (Short)entry.getValue());
- } else {
- msg.setObjectProperty(entry.getKey().toString(), entry.getValue());
- }
- }
- }
- producer.send(msg);
-// OseeLog.log(Activator.class, Level.FINE, String.format("Sending message %s - %s", topic.getName(), topic.getGuid()));
- statusCallback.success();
- }
-
- @Override
- public synchronized void subscribe(MessageID messageId, OseeMessagingListener listener, OseeMessagingStatusCallback statusCallback) {
- Topic destination;
- try {
- if (isConnectedThrow()) {
- destination = getOrCreateTopic(messageId);
- MessageConsumer consumer = session.createConsumer(destination);
- consumer.setMessageListener(new ActiveMqMessageListenerWrapper(activeMqUtil, replyProducer, session, listener));
- regularListeners.put(messageId.getId(), consumer, listener);
- statusCallback.success();
- } else {
- statusCallback.fail(new OseeCoreException("This connection is not started."));
- }
- } catch (JMSException ex) {
- statusCallback.fail(ex);
- } catch (NullPointerException ex) {
- statusCallback.fail(ex);
- }
- }
-
- @Override
- public void subscribe(MessageID messageId, OseeMessagingListener listener, String selector, OseeMessagingStatusCallback statusCallback) {
- Topic destination;
- try {
- if (isConnectedThrow()) {
- destination = getOrCreateTopic(messageId);
- MessageConsumer consumer = session.createConsumer(destination, selector);
- consumer.setMessageListener(new ActiveMqMessageListenerWrapper(activeMqUtil, replyProducer, session, listener));
- regularListeners.put(messageId.getId(), consumer, listener);
- statusCallback.success();
- } else {
- statusCallback.fail(new OseeCoreException("This connection is not started."));
- }
- } catch (JMSException ex) {
- statusCallback.fail(ex);
- } catch (NullPointerException ex) {
- statusCallback.fail(ex);
- }
- }
-
- @Override
- public void subscribe(MessageID messageId, OseeMessagingListener listener) {
- String errorMessage = String.format("Error subscribing message(%s)", messageId.getId());
- OseeMessagingStatusImpl defaultErrorHandler = new OseeMessagingStatusImpl(errorMessage, getClass());
- this.subscribe(messageId, listener, defaultErrorHandler);
- }
-
- private Topic getOrCreateTopic(MessageID messageId) throws JMSException {
- Topic topic = topicCache.get(messageId.getId());
- if (topic == null) {
- topic = session.createTopic(messageId.getId());
- topicCache.put(messageId.getId(), topic);
- }
- return topic;
- }
-
- private MessageProducer getOrCreateProducer(Topic destination) throws JMSException {
- MessageProducer producer = messageProducerCache.get(destination);
- if (producer == null) {
- producer = session.createProducer(destination);
- producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
- messageProducerCache.put(destination, producer);
- }
- return producer;
- }
-
- private void removeProducerFromCache(MessageID topic) throws JMSException{
- Topic destination = getOrCreateTopic(topic);
- messageProducerCache.remove(destination);
- }
-
- @Override
- public boolean subscribeToReply(MessageID messageId, OseeMessagingListener listener) {
- replyListeners.put(messageId.getId(), listener);
- return true;
- }
-
- @Override
- public void unsubscribe(MessageID messageId, OseeMessagingListener listener) {
- String errorMessage = String.format("Error unsubscribing message(%s)", messageId.getId());
- OseeMessagingStatusImpl defaultErrorHandler = new OseeMessagingStatusImpl(errorMessage, getClass());
- this.unsubscribe(messageId, listener, defaultErrorHandler);
- }
-
- @Override
- public void unsubscribe(MessageID messageId, OseeMessagingListener listener, OseeMessagingStatusCallback statusCallback) {
- Map<MessageConsumer, OseeMessagingListener> listeners = regularListeners.getKeyedValues(messageId.getId());
- List<MessageConsumer> consumersToRemove = new ArrayList<MessageConsumer>();
- if (listeners != null) {
- try{
- for(Entry<MessageConsumer, OseeMessagingListener> entry:listeners.entrySet()){
- if(entry.getValue().equals(listener)){
- entry.getKey().setMessageListener(null);
- consumersToRemove.add(entry.getKey());
- }
- }
- for(MessageConsumer messageConsumer: consumersToRemove){
- messageConsumer.setMessageListener(null);
- messageConsumer.close();
- }
- }catch (JMSException ex) {
- statusCallback.fail(ex);
- }
- }
- statusCallback.success();
- }
-
- @Override
- public boolean unsubscribteToReply(MessageID messageId, OseeMessagingListener listener) {
- replyListeners.remove(messageId.getId());
- return true;
- }
-
- @Override
- public void onMessage(Message jmsMessage) {
- try {
- String correlationId = jmsMessage.getJMSCorrelationID();
- if (correlationId != null) {
- OseeMessagingListener listener = replyListeners.get(correlationId);
- if (listener != null) {
- listener.process(activeMqUtil.translateMessage(jmsMessage, listener.getClazz()), new HashMap<String, Object>(), new ReplyConnectionActiveMqImpl());
- }
- }
- } catch (JMSException ex) {
- OseeLog.log(ConnectionNodeActiveMq.class, Level.SEVERE, ex);
- } catch (OseeCoreException ex) {
- OseeLog.log(ConnectionNodeActiveMq.class, Level.SEVERE, ex);
- }
- OseeLog.log(Activator.class, Level.FINE, String.format("recieved reply message %s", jmsMessage.toString()));
- }
-
- @Override
- public synchronized void stop() {
- topicCache.clear();
- messageProducerCache.clear();
- regularListeners.clear();
- try {
- if (session != null) {
- session.close();
- session = null;
- }
- } catch (JMSException ex) {
- OseeLog.log(ConnectionNodeActiveMq.class, Level.SEVERE, ex);
- }
- try {
- if (connection != null) {
- connection.close();
- connection = null;
- }
- } catch (JMSException ex) {
- OseeLog.log(ConnectionNodeActiveMq.class, Level.SEVERE, ex);
- }
- }
-
- @Override
- public synchronized boolean isConnected() {
- try {
- return isConnectedThrow();
- } catch (JMSException ex) {
- started = false;
- return false;
- }
- }
-
- private synchronized boolean isConnectedThrow() throws JMSException {
- if (connection == null || started == false) {
- return false;
- }
- connection.getMetaData();
- session.createProducer(session.createTopic("mytest"));
- return true;
- }
-
- @Override
- public void addConnectionListener(ConnectionListener connectionListener) {
- }
-
- @Override
- public void removeConnectionListener(ConnectionListener connectionListener) {
- }
-
-
- @Override
- public String getSenders() {
- StringBuilder sb = new StringBuilder();
- for(Entry<Topic, MessageProducer> entry:this.messageProducerCache.entrySet()){
- try {
- sb.append(String.format("Topic [%s] \n", entry.getKey().getTopicName()));
- sb.append(String.format("\tProducer Destination [%s]\n", entry.getValue().getDestination().toString()));
- } catch (JMSException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- }
- return sb.toString();
- }
-
- @Override
- public String getSubscribers() {
- StringBuilder sb = new StringBuilder();
- for(Pair<String, MessageConsumer> entry:this.regularListeners.keySet()){
- try {
- sb.append(String.format("Topic [%s] \n", entry.getFirst()));
- sb.append(String.format("\tConsumer Selector [%s]\n", entry.getSecond().getMessageSelector()));
- MessageListener listener = entry.getSecond().getMessageListener();
- if(listener instanceof ActiveMqMessageListenerWrapper){
- sb.append("\tConsumer Listeners:\n");
- sb.append(String.format("\t\t%s\n", ((ActiveMqMessageListenerWrapper)listener).getListener().toString()));
- }
- } catch (JMSException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- }
- return sb.toString();
- }
-
- @Override
- public String getSummary() {
- StringBuilder sb = new StringBuilder();
- sb.append(nodeInfo.toString());
- sb.append("\n");
- sb.append(String.format("\tisStarted[%b]\n", started));
- sb.append(getSenders());
- sb.append(getSubscribers());
- return sb.toString();
- }
-
-}
+package org.eclipse.osee.framework.messaging.internal.activemq; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Properties; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutorService; +import java.util.logging.Level; + +import javax.jms.Connection; +import javax.jms.DeliveryMode; +import javax.jms.ExceptionListener; +import javax.jms.JMSException; +import javax.jms.Message; +import javax.jms.MessageConsumer; +import javax.jms.MessageListener; +import javax.jms.MessageProducer; +import javax.jms.Session; +import javax.jms.TemporaryTopic; +import javax.jms.Topic; + +import org.apache.activemq.ActiveMQConnectionFactory; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.core.exception.OseeWrappedException; +import org.eclipse.osee.framework.jdk.core.type.CompositeKeyHashMap; +import org.eclipse.osee.framework.jdk.core.type.Pair; +import org.eclipse.osee.framework.logging.OseeLog; +import org.eclipse.osee.framework.messaging.ConnectionListener; +import org.eclipse.osee.framework.messaging.ConnectionNodeFailoverSupport; +import org.eclipse.osee.framework.messaging.MessageID; +import org.eclipse.osee.framework.messaging.NodeInfo; +import org.eclipse.osee.framework.messaging.OseeMessagingListener; +import org.eclipse.osee.framework.messaging.OseeMessagingStatusCallback; +import org.eclipse.osee.framework.messaging.internal.Activator; +import org.eclipse.osee.framework.messaging.services.internal.OseeMessagingStatusImpl; + +/** + * @author Andrew M. Finkbeiner + */ +class ConnectionNodeActiveMq implements ConnectionNodeFailoverSupport, MessageListener { + + // private String version; + // private String sourceId; + private NodeInfo nodeInfo; + // private ExecutorService executor; + private Connection connection; + private Session session; + private TemporaryTopic temporaryTopic; + private MessageConsumer replyToConsumer; + private Map<String, OseeMessagingListener> replyListeners; + private CompositeKeyHashMap<String, MessageConsumer, OseeMessagingListener> regularListeners; + private boolean started = false; + + private ConcurrentHashMap<String, Topic> topicCache; + private ConcurrentHashMap<Topic, MessageProducer> messageProducerCache; + private final ExceptionListener exceptionListener; + + private MessageProducer replyProducer; + private ActiveMqUtil activeMqUtil; + + public ConnectionNodeActiveMq(String version, String sourceId, NodeInfo nodeInfo, ExecutorService executor, ExceptionListener exceptionListener) { + this.nodeInfo = nodeInfo; + this.exceptionListener = exceptionListener; + activeMqUtil = new ActiveMqUtil(); + topicCache = new ConcurrentHashMap<String, Topic>(); + messageProducerCache = new ConcurrentHashMap<Topic, MessageProducer>(); + regularListeners = new CompositeKeyHashMap<String, MessageConsumer, OseeMessagingListener>(64, true); + replyListeners = new ConcurrentHashMap<String, OseeMessagingListener>(); + } + + public synchronized void start() throws OseeCoreException { + if (started) { + return; + } + try { + String uri = nodeInfo.getUri().toASCIIString(); + ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(ActiveMQConnectionFactory.DEFAULT_USER, ActiveMQConnectionFactory.DEFAULT_PASSWORD, uri); + connection = factory.createConnection(); + connection.setExceptionListener(exceptionListener); + session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE); + temporaryTopic = session.createTemporaryTopic(); + replyToConsumer = session.createConsumer(temporaryTopic); + replyToConsumer.setMessageListener(this); + replyProducer = session.createProducer(null); + connection.start(); + started = true; + } catch (Throwable ex) { + throw new OseeWrappedException(ex); + } + } + + @Override + public void send(MessageID topic, Object body) throws OseeCoreException { + String errorMessage = String.format("Error sending message(%s)", topic.getId()); + OseeMessagingStatusImpl defaultErrorHandler = new OseeMessagingStatusImpl(errorMessage, getClass()); + this.send(topic, body, defaultErrorHandler); + } + + @Override + public synchronized void send(MessageID messageId, Object message, OseeMessagingStatusCallback statusCallback) throws OseeCoreException { + send(messageId, message, null, statusCallback); + } + + @Override + public synchronized void send(MessageID messageId, Object message, Properties properties, OseeMessagingStatusCallback statusCallback) throws OseeCoreException { + try { + if (messageId.isTopic()) { + try{ + sendInternal(messageId, message, properties, statusCallback); + } catch (JMSException ex){ + removeProducerFromCache(messageId); + sendInternal(messageId, message, properties, statusCallback); + } + // OseeLog.log(Activator.class, Level.FINE, String.format("Sending message %s - %s", topic.getName(), topic.getGuid())); + statusCallback.success(); + } + } catch (JMSException ex) { + statusCallback.fail(ex); + throw new OseeWrappedException(ex); + } catch (NullPointerException ex) { + statusCallback.fail(ex); + throw new OseeWrappedException(ex); + } + } + + private synchronized void sendInternal(MessageID messageId, Object message, Properties properties, OseeMessagingStatusCallback statusCallback) throws JMSException, OseeCoreException { + Topic destination = getOrCreateTopic(messageId); + MessageProducer producer = getOrCreateProducer(destination); + Message msg = activeMqUtil.createMessage(session, messageId.getSerializationClass(), message); + if (messageId.isReplyRequired()) { + msg.setJMSReplyTo(temporaryTopic); + } + if(properties != null){ + for(Entry<Object, Object> entry:properties.entrySet()){ + if(entry.getValue() instanceof Integer){ + msg.setIntProperty(entry.getKey().toString(), (Integer)entry.getValue()); + } if(entry.getValue() instanceof Boolean){ + msg.setBooleanProperty(entry.getKey().toString(), (Boolean)entry.getValue()); + } if(entry.getValue() instanceof Byte){ + msg.setByteProperty(entry.getKey().toString(), (Byte)entry.getValue()); + } if(entry.getValue() instanceof Double){ + msg.setDoubleProperty(entry.getKey().toString(), (Double)entry.getValue()); + } if(entry.getValue() instanceof Float){ + msg.setFloatProperty(entry.getKey().toString(), (Float)entry.getValue()); + } if(entry.getValue() instanceof Long){ + msg.setLongProperty(entry.getKey().toString(), (Long)entry.getValue()); + } if(entry.getValue() instanceof String){ + msg.setStringProperty(entry.getKey().toString(), (String)entry.getValue()); + } if(entry.getValue() instanceof Short){ + msg.setShortProperty(entry.getKey().toString(), (Short)entry.getValue()); + } else { + msg.setObjectProperty(entry.getKey().toString(), entry.getValue()); + } + } + } + producer.send(msg); +// OseeLog.log(Activator.class, Level.FINE, String.format("Sending message %s - %s", topic.getName(), topic.getGuid())); + statusCallback.success(); + } + + @Override + public synchronized void subscribe(MessageID messageId, OseeMessagingListener listener, OseeMessagingStatusCallback statusCallback) { + Topic destination; + try { + if (isConnectedThrow()) { + destination = getOrCreateTopic(messageId); + MessageConsumer consumer = session.createConsumer(destination); + consumer.setMessageListener(new ActiveMqMessageListenerWrapper(activeMqUtil, replyProducer, session, listener)); + regularListeners.put(messageId.getId(), consumer, listener); + statusCallback.success(); + } else { + statusCallback.fail(new OseeCoreException("This connection is not started.")); + } + } catch (JMSException ex) { + statusCallback.fail(ex); + } catch (NullPointerException ex) { + statusCallback.fail(ex); + } + } + + @Override + public void subscribe(MessageID messageId, OseeMessagingListener listener, String selector, OseeMessagingStatusCallback statusCallback) { + Topic destination; + try { + if (isConnectedThrow()) { + destination = getOrCreateTopic(messageId); + MessageConsumer consumer = session.createConsumer(destination, selector); + consumer.setMessageListener(new ActiveMqMessageListenerWrapper(activeMqUtil, replyProducer, session, listener)); + regularListeners.put(messageId.getId(), consumer, listener); + statusCallback.success(); + } else { + statusCallback.fail(new OseeCoreException("This connection is not started.")); + } + } catch (JMSException ex) { + statusCallback.fail(ex); + } catch (NullPointerException ex) { + statusCallback.fail(ex); + } + } + + @Override + public void subscribe(MessageID messageId, OseeMessagingListener listener) { + String errorMessage = String.format("Error subscribing message(%s)", messageId.getId()); + OseeMessagingStatusImpl defaultErrorHandler = new OseeMessagingStatusImpl(errorMessage, getClass()); + this.subscribe(messageId, listener, defaultErrorHandler); + } + + private Topic getOrCreateTopic(MessageID messageId) throws JMSException { + Topic topic = topicCache.get(messageId.getId()); + if (topic == null) { + topic = session.createTopic(messageId.getId()); + topicCache.put(messageId.getId(), topic); + } + return topic; + } + + private MessageProducer getOrCreateProducer(Topic destination) throws JMSException { + MessageProducer producer = messageProducerCache.get(destination); + if (producer == null) { + producer = session.createProducer(destination); + producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); + messageProducerCache.put(destination, producer); + } + return producer; + } + + private void removeProducerFromCache(MessageID topic) throws JMSException{ + Topic destination = getOrCreateTopic(topic); + messageProducerCache.remove(destination); + } + + @Override + public boolean subscribeToReply(MessageID messageId, OseeMessagingListener listener) { + replyListeners.put(messageId.getId(), listener); + return true; + } + + @Override + public void unsubscribe(MessageID messageId, OseeMessagingListener listener) { + String errorMessage = String.format("Error unsubscribing message(%s)", messageId.getId()); + OseeMessagingStatusImpl defaultErrorHandler = new OseeMessagingStatusImpl(errorMessage, getClass()); + this.unsubscribe(messageId, listener, defaultErrorHandler); + } + + @Override + public void unsubscribe(MessageID messageId, OseeMessagingListener listener, OseeMessagingStatusCallback statusCallback) { + Map<MessageConsumer, OseeMessagingListener> listeners = regularListeners.getKeyedValues(messageId.getId()); + List<MessageConsumer> consumersToRemove = new ArrayList<MessageConsumer>(); + if (listeners != null) { + try{ + for(Entry<MessageConsumer, OseeMessagingListener> entry:listeners.entrySet()){ + if(entry.getValue().equals(listener)){ + entry.getKey().setMessageListener(null); + consumersToRemove.add(entry.getKey()); + } + } + for(MessageConsumer messageConsumer: consumersToRemove){ + messageConsumer.setMessageListener(null); + messageConsumer.close(); + } + }catch (JMSException ex) { + statusCallback.fail(ex); + } + } + statusCallback.success(); + } + + @Override + public boolean unsubscribteToReply(MessageID messageId, OseeMessagingListener listener) { + replyListeners.remove(messageId.getId()); + return true; + } + + @Override + public void onMessage(Message jmsMessage) { + try { + String correlationId = jmsMessage.getJMSCorrelationID(); + if (correlationId != null) { + OseeMessagingListener listener = replyListeners.get(correlationId); + if (listener != null) { + listener.process(activeMqUtil.translateMessage(jmsMessage, listener.getClazz()), new HashMap<String, Object>(), new ReplyConnectionActiveMqImpl()); + } + } + } catch (JMSException ex) { + OseeLog.log(ConnectionNodeActiveMq.class, Level.SEVERE, ex); + } catch (OseeCoreException ex) { + OseeLog.log(ConnectionNodeActiveMq.class, Level.SEVERE, ex); + } + OseeLog.log(Activator.class, Level.FINE, String.format("recieved reply message %s", jmsMessage.toString())); + } + + @Override + public synchronized void stop() { + topicCache.clear(); + messageProducerCache.clear(); + regularListeners.clear(); + try { + if (session != null) { + session.close(); + session = null; + } + } catch (JMSException ex) { + OseeLog.log(ConnectionNodeActiveMq.class, Level.SEVERE, ex); + } + try { + if (connection != null) { + connection.close(); + connection = null; + } + } catch (JMSException ex) { + OseeLog.log(ConnectionNodeActiveMq.class, Level.SEVERE, ex); + } + } + + @Override + public synchronized boolean isConnected() { + try { + return isConnectedThrow(); + } catch (JMSException ex) { + started = false; + return false; + } + } + + private synchronized boolean isConnectedThrow() throws JMSException { + if (connection == null || started == false) { + return false; + } + connection.getMetaData(); + session.createProducer(session.createTopic("mytest")); + return true; + } + + @Override + public void addConnectionListener(ConnectionListener connectionListener) { + } + + @Override + public void removeConnectionListener(ConnectionListener connectionListener) { + } + + + @Override + public String getSenders() { + StringBuilder sb = new StringBuilder(); + for(Entry<Topic, MessageProducer> entry:this.messageProducerCache.entrySet()){ + try { + sb.append(String.format("Topic [%s] \n", entry.getKey().getTopicName())); + sb.append(String.format("\tProducer Destination [%s]\n", entry.getValue().getDestination().toString())); + } catch (JMSException ex) { + OseeLog.log(Activator.class, Level.SEVERE, ex); + } + } + return sb.toString(); + } + + @Override + public String getSubscribers() { + StringBuilder sb = new StringBuilder(); + for(Pair<String, MessageConsumer> entry:this.regularListeners.keySet()){ + try { + sb.append(String.format("Topic [%s] \n", entry.getFirst())); + sb.append(String.format("\tConsumer Selector [%s]\n", entry.getSecond().getMessageSelector())); + MessageListener listener = entry.getSecond().getMessageListener(); + if(listener instanceof ActiveMqMessageListenerWrapper){ + sb.append("\tConsumer Listeners:\n"); + sb.append(String.format("\t\t%s\n", ((ActiveMqMessageListenerWrapper)listener).getListener().toString())); + } + } catch (JMSException ex) { + OseeLog.log(Activator.class, Level.SEVERE, ex); + } + } + return sb.toString(); + } + + @Override + public String getSummary() { + StringBuilder sb = new StringBuilder(); + sb.append(nodeInfo.toString()); + sb.append("\n"); + sb.append(String.format("\tisStarted[%b]\n", started)); + sb.append(getSenders()); + sb.append(getSubscribers()); + return sb.toString(); + } + +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/activemq/ConnectionNodeFactoryImpl.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/activemq/ConnectionNodeFactoryImpl.java index 2553b183d63..21076789483 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/activemq/ConnectionNodeFactoryImpl.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/activemq/ConnectionNodeFactoryImpl.java @@ -8,50 +8,50 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging.internal.activemq;
-
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-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.ConnectionNode;
-import org.eclipse.osee.framework.messaging.ConnectionNodeFactory;
-import org.eclipse.osee.framework.messaging.NodeInfo;
-import org.eclipse.osee.framework.messaging.internal.Activator;
-import org.eclipse.osee.framework.messaging.internal.FailoverConnectionNode;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ConnectionNodeFactoryImpl implements ConnectionNodeFactory {
-
- private final ExecutorService executor;
- private final ScheduledExecutorService scheduledExecutor;
- private final String version;
- private final String sourceId;
-
- public ConnectionNodeFactoryImpl(String version, String sourceId, ExecutorService executor) {
- this.version = version;
- this.sourceId = sourceId;
- this.executor = executor;
- this.scheduledExecutor = Executors.newSingleThreadScheduledExecutor();
- }
-
- @Override
- public synchronized ConnectionNode create(NodeInfo nodeInfo) {
- OseeExceptionListener exceptionListener = new OseeExceptionListener();
- final ConnectionNodeActiveMq node = new ConnectionNodeActiveMq(version, sourceId, nodeInfo, executor, exceptionListener);
- OseeLog.log(Activator.class, Level.FINEST, "Going to start a connection node.");
- try {
- node.start();
- } catch (OseeCoreException ex) {
- OseeLog.log(ConnectionNodeFactoryImpl.class, Level.SEVERE, ex);
- }
- OseeLog.log(Activator.class, Level.FINE, "Started a connection node.");
- return new FailoverConnectionNode(node, scheduledExecutor, exceptionListener);
- }
-
-}
+package org.eclipse.osee.framework.messaging.internal.activemq; + +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +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.ConnectionNode; +import org.eclipse.osee.framework.messaging.ConnectionNodeFactory; +import org.eclipse.osee.framework.messaging.NodeInfo; +import org.eclipse.osee.framework.messaging.internal.Activator; +import org.eclipse.osee.framework.messaging.internal.FailoverConnectionNode; + +/** + * @author Roberto E. Escobar + */ +public class ConnectionNodeFactoryImpl implements ConnectionNodeFactory { + + private final ExecutorService executor; + private final ScheduledExecutorService scheduledExecutor; + private final String version; + private final String sourceId; + + public ConnectionNodeFactoryImpl(String version, String sourceId, ExecutorService executor) { + this.version = version; + this.sourceId = sourceId; + this.executor = executor; + this.scheduledExecutor = Executors.newSingleThreadScheduledExecutor(); + } + + @Override + public synchronized ConnectionNode create(NodeInfo nodeInfo) { + OseeExceptionListener exceptionListener = new OseeExceptionListener(); + final ConnectionNodeActiveMq node = new ConnectionNodeActiveMq(version, sourceId, nodeInfo, executor, exceptionListener); + OseeLog.log(Activator.class, Level.FINEST, "Going to start a connection node."); + try { + node.start(); + } catch (OseeCoreException ex) { + OseeLog.log(ConnectionNodeFactoryImpl.class, Level.SEVERE, ex); + } + OseeLog.log(Activator.class, Level.FINE, "Started a connection node."); + return new FailoverConnectionNode(node, scheduledExecutor, exceptionListener); + } + +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/activemq/OseeExceptionListener.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/activemq/OseeExceptionListener.java index 141dadfab94..bcc272644a8 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/activemq/OseeExceptionListener.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/activemq/OseeExceptionListener.java @@ -8,30 +8,30 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging.internal.activemq;
-
-import javax.jms.ExceptionListener;
-import javax.jms.JMSException;
-
-import org.eclipse.osee.framework.messaging.internal.FailoverConnectionNode;
-
-/**
- * @author Andrew M. Finkbeiner
- *
- */
-public class OseeExceptionListener implements ExceptionListener {
-
- private FailoverConnectionNode failoverConnectionNode;
-
- @Override
- public void onException(JMSException ex) {
- if(failoverConnectionNode != null){
- failoverConnectionNode.onException(ex);
- }
- }
-
- public void setListener(FailoverConnectionNode failoverConnectionNode) {
- this.failoverConnectionNode = failoverConnectionNode;
- }
-
-}
+package org.eclipse.osee.framework.messaging.internal.activemq; + +import javax.jms.ExceptionListener; +import javax.jms.JMSException; + +import org.eclipse.osee.framework.messaging.internal.FailoverConnectionNode; + +/** + * @author Andrew M. Finkbeiner + * + */ +public class OseeExceptionListener implements ExceptionListener { + + private FailoverConnectionNode failoverConnectionNode; + + @Override + public void onException(JMSException ex) { + if(failoverConnectionNode != null){ + failoverConnectionNode.onException(ex); + } + } + + public void setListener(FailoverConnectionNode failoverConnectionNode) { + this.failoverConnectionNode = failoverConnectionNode; + } + +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/activemq/ReplyConnectionActiveMqImpl.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/activemq/ReplyConnectionActiveMqImpl.java index 840772ff45d..f89f4550479 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/activemq/ReplyConnectionActiveMqImpl.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/activemq/ReplyConnectionActiveMqImpl.java @@ -8,64 +8,64 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging.internal.activemq;
-
-import java.util.logging.Level;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeWrappedException;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.messaging.OseeMessagingStatusCallback;
-import org.eclipse.osee.framework.messaging.ReplyConnection;
-import org.eclipse.osee.framework.messaging.internal.Activator;
-
-
-/**
- * @author Andrew M. Finkbeiner
- *
- */
-class ReplyConnectionActiveMqImpl implements ReplyConnection {
-
- private final boolean isReplyRequested;
- private MessageProducer producer;
- private Destination destReply;
- private String correlationId;
- private Session session;
- private ActiveMqUtil activeMqUtil;
-
- ReplyConnectionActiveMqImpl(ActiveMqUtil activeMqUtil, Session session, MessageProducer producer, Destination destReply, String correlationId) {
- isReplyRequested = true;
- this.producer = producer;
- this.destReply = destReply;
- this.correlationId = correlationId;
- this.session = session;
- this.activeMqUtil = activeMqUtil;
- }
-
- ReplyConnectionActiveMqImpl() {
- isReplyRequested = false;
- }
-
- @Override
- public boolean isReplyRequested() {
- return isReplyRequested;
- }
-
- @Override
- public void send(Object body, Class<?> clazz, OseeMessagingStatusCallback statusCallback) throws OseeCoreException {
- try {
- Message message = activeMqUtil.createMessage(session, clazz, body);
- message.setJMSCorrelationID(correlationId);
- producer.send(destReply, message);
- OseeLog.log(Activator.class, Level.INFO, String.format("Sending Reply Message %s", message.toString()));
- } catch (JMSException ex) {
- statusCallback.fail(ex);
- throw new OseeWrappedException(ex);
- }
- }
-
-}
+package org.eclipse.osee.framework.messaging.internal.activemq; + +import java.util.logging.Level; +import javax.jms.Destination; +import javax.jms.JMSException; +import javax.jms.Message; +import javax.jms.MessageProducer; +import javax.jms.Session; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.core.exception.OseeWrappedException; +import org.eclipse.osee.framework.logging.OseeLog; +import org.eclipse.osee.framework.messaging.OseeMessagingStatusCallback; +import org.eclipse.osee.framework.messaging.ReplyConnection; +import org.eclipse.osee.framework.messaging.internal.Activator; + + +/** + * @author Andrew M. Finkbeiner + * + */ +class ReplyConnectionActiveMqImpl implements ReplyConnection { + + private final boolean isReplyRequested; + private MessageProducer producer; + private Destination destReply; + private String correlationId; + private Session session; + private ActiveMqUtil activeMqUtil; + + ReplyConnectionActiveMqImpl(ActiveMqUtil activeMqUtil, Session session, MessageProducer producer, Destination destReply, String correlationId) { + isReplyRequested = true; + this.producer = producer; + this.destReply = destReply; + this.correlationId = correlationId; + this.session = session; + this.activeMqUtil = activeMqUtil; + } + + ReplyConnectionActiveMqImpl() { + isReplyRequested = false; + } + + @Override + public boolean isReplyRequested() { + return isReplyRequested; + } + + @Override + public void send(Object body, Class<?> clazz, OseeMessagingStatusCallback statusCallback) throws OseeCoreException { + try { + Message message = activeMqUtil.createMessage(session, clazz, body); + message.setJMSCorrelationID(correlationId); + producer.send(destReply, message); + OseeLog.log(Activator.class, Level.INFO, String.format("Sending Reply Message %s", message.toString())); + } catch (JMSException ex) { + statusCallback.fail(ex); + throw new OseeWrappedException(ex); + } + } + +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/olderFiles.txt b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/olderFiles.txt index 7ed3153fa07..87c42468da4 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/olderFiles.txt +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/olderFiles.txt @@ -1,11 +1,11 @@ -We'll want these to be gone eventually
-
-EndpointReceive.java
-EndpointSend.java
-ExceptionHandler.java
-Message.java
-MessagingGateway.java
-ReceiveListener.java
-SendListener.java
-Source.java
+We'll want these to be gone eventually + +EndpointReceive.java +EndpointSend.java +ExceptionHandler.java +Message.java +MessagingGateway.java +ReceiveListener.java +SendListener.java +Source.java UriSource.java
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/BaseMessages.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/BaseMessages.java index 9076a244519..0a22a46914f 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/BaseMessages.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/BaseMessages.java @@ -8,58 +8,58 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging.services;
-
-import org.eclipse.osee.framework.messaging.MessageID;
-import org.eclipse.osee.framework.messaging.services.messages.ServiceHealth;
-import org.eclipse.osee.framework.messaging.services.messages.ServiceHealthRequest;
-import org.eclipse.osee.framework.messaging.services.messages.Synch;
-
-/**
- * @author Andrew M. Finkbeiner
- *
- */
-public enum BaseMessages implements MessageID {
- ServiceHealth(true, "ABjyjamBQRvvAGcWpRQA", "osee.message.core.ServiceHealth", ServiceHealth.class, false),
- ServiceHealthRequest(true, "ABkAHOSFQ3VUZcfzsAgA", "osee.message.core.ServiceHealthRequest", ServiceHealthRequest.class, true),
- Synch(true, "ABkweOSFQ3yuZcfzsAgA", "osee.message.core.ServiceHealthRequest", Synch.class, true);
-
- private String name;
- private Class<?> clazz;
- boolean isReplyRequired;
- private boolean isTopic;
- private String guid;
-
- BaseMessages(boolean isTopic, String guid, String name, Class<?> clazz, boolean isReplyRequired){
- this.guid = guid;
- this.name = name;
- this.clazz = clazz;
- this.isReplyRequired = isReplyRequired;
- this.isTopic = isTopic;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public Class<?> getSerializationClass() {
- return clazz;
- }
-
- @Override
- public boolean isReplyRequired() {
- return isReplyRequired;
- }
-
- @Override
- public boolean isTopic(){
- return isTopic;
- }
-
- @Override
- public String getId() {
- return guid;
- }
-}
+package org.eclipse.osee.framework.messaging.services; + +import org.eclipse.osee.framework.messaging.MessageID; +import org.eclipse.osee.framework.messaging.services.messages.ServiceHealth; +import org.eclipse.osee.framework.messaging.services.messages.ServiceHealthRequest; +import org.eclipse.osee.framework.messaging.services.messages.Synch; + +/** + * @author Andrew M. Finkbeiner + * + */ +public enum BaseMessages implements MessageID { + ServiceHealth(true, "ABjyjamBQRvvAGcWpRQA", "osee.message.core.ServiceHealth", ServiceHealth.class, false), + ServiceHealthRequest(true, "ABkAHOSFQ3VUZcfzsAgA", "osee.message.core.ServiceHealthRequest", ServiceHealthRequest.class, true), + Synch(true, "ABkweOSFQ3yuZcfzsAgA", "osee.message.core.ServiceHealthRequest", Synch.class, true); + + private String name; + private Class<?> clazz; + boolean isReplyRequired; + private boolean isTopic; + private String guid; + + BaseMessages(boolean isTopic, String guid, String name, Class<?> clazz, boolean isReplyRequired){ + this.guid = guid; + this.name = name; + this.clazz = clazz; + this.isReplyRequired = isReplyRequired; + this.isTopic = isTopic; + } + + @Override + public String getName() { + return name; + } + + @Override + public Class<?> getSerializationClass() { + return clazz; + } + + @Override + public boolean isReplyRequired() { + return isReplyRequired; + } + + @Override + public boolean isTopic(){ + return isTopic; + } + + @Override + public String getId() { + return guid; + } +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/RegisteredServiceReference.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/RegisteredServiceReference.java index a80e5be993c..673be47ee7f 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/RegisteredServiceReference.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/RegisteredServiceReference.java @@ -8,12 +8,12 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging.services;
-
-/**
- * @author Andrew M. Finkbeiner
- *
- */
-public interface RegisteredServiceReference {
- void update();
-}
+package org.eclipse.osee.framework.messaging.services; + +/** + * @author Andrew M. Finkbeiner + * + */ +public interface RegisteredServiceReference { + void update(); +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/RemoteServiceLookup.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/RemoteServiceLookup.java index e28a068e814..12a514b6ba7 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/RemoteServiceLookup.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/RemoteServiceLookup.java @@ -8,16 +8,16 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging.services;
-
-/**
- * @author Andrew M. Finkbeiner
- *
- */
-public interface RemoteServiceLookup {
- void start();
- void stop();
- void sendOutRequestsForServiceHealth();
- void register(String serviceId, String serviceVersion, ServiceNotification notification);
- boolean unregister(String serviceId, String serviceVersion, ServiceNotification notification);
-}
+package org.eclipse.osee.framework.messaging.services; + +/** + * @author Andrew M. Finkbeiner + * + */ +public interface RemoteServiceLookup { + void start(); + void stop(); + void sendOutRequestsForServiceHealth(); + void register(String serviceId, String serviceVersion, ServiceNotification notification); + boolean unregister(String serviceId, String serviceVersion, ServiceNotification notification); +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/RemoteServiceRegistrar.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/RemoteServiceRegistrar.java index 1257ac804c0..d0852d7b2b3 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/RemoteServiceRegistrar.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/RemoteServiceRegistrar.java @@ -8,17 +8,17 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging.services;
-
-import java.net.URI;
-
-/**
- * @author Andrew M. Finkbeiner
- *
- */
-public interface RemoteServiceRegistrar {
- void start();
- void stop();
- RegisteredServiceReference registerService(String serviceName, String serviceVersion, String serviceUniqueId, URI broker, ServiceInfoPopulator infoPopulator, int refreshRateInSeconds);
- boolean unregisterService(String serviceName, String serviceVersion, String serviceUniqueId);
-}
+package org.eclipse.osee.framework.messaging.services; + +import java.net.URI; + +/** + * @author Andrew M. Finkbeiner + * + */ +public interface RemoteServiceRegistrar { + void start(); + void stop(); + RegisteredServiceReference registerService(String serviceName, String serviceVersion, String serviceUniqueId, URI broker, ServiceInfoPopulator infoPopulator, int refreshRateInSeconds); + boolean unregisterService(String serviceName, String serviceVersion, String serviceUniqueId); +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/ServiceInfoPopulator.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/ServiceInfoPopulator.java index 6c5c4d25e45..cbf1b0788ee 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/ServiceInfoPopulator.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/ServiceInfoPopulator.java @@ -8,16 +8,16 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging.services;
-
-import java.util.List;
-
-import org.eclipse.osee.framework.messaging.services.messages.ServiceDescriptionPair;
-
-/**
- * @author Andrew M. Finkbeiner
- *
- */
-public interface ServiceInfoPopulator {
- void updateServiceInfo(List<ServiceDescriptionPair> serviceDescription);
-}
+package org.eclipse.osee.framework.messaging.services; + +import java.util.List; + +import org.eclipse.osee.framework.messaging.services.messages.ServiceDescriptionPair; + +/** + * @author Andrew M. Finkbeiner + * + */ +public interface ServiceInfoPopulator { + void updateServiceInfo(List<ServiceDescriptionPair> serviceDescription); +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/ServiceNotification.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/ServiceNotification.java index 386024c4933..b1e182aecae 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/ServiceNotification.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/ServiceNotification.java @@ -8,15 +8,15 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging.services;
-
-import org.eclipse.osee.framework.messaging.services.messages.ServiceHealth;
-
-/**
- * @author Andrew M. Finkbeiner
- *
- */
-public interface ServiceNotification {
- void onServiceUpdate(ServiceHealth serviceHealth);
- void onServiceGone(ServiceHealth serviceHealth);
-}
+package org.eclipse.osee.framework.messaging.services; + +import org.eclipse.osee.framework.messaging.services.messages.ServiceHealth; + +/** + * @author Andrew M. Finkbeiner + * + */ +public interface ServiceNotification { + void onServiceUpdate(ServiceHealth serviceHealth); + void onServiceGone(ServiceHealth serviceHealth); +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/HealthRequestListener.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/HealthRequestListener.java index 751717a2390..b6eb362f0b7 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/HealthRequestListener.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/HealthRequestListener.java @@ -8,43 +8,43 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging.services.internal;
-
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.osee.framework.jdk.core.type.CompositeKeyHashMap;
-import org.eclipse.osee.framework.messaging.OseeMessagingListener;
-import org.eclipse.osee.framework.messaging.ReplyConnection;
-import org.eclipse.osee.framework.messaging.services.messages.ServiceHealthRequest;
-
-/**
- * @author Andrew M. Finkbeiner
- *
- */
-public class HealthRequestListener extends OseeMessagingListener {
- private CompositeKeyHashMap<String, String, List<UpdateStatus>> mapForReplys;
-
- public HealthRequestListener(
- CompositeKeyHashMap<String, String, List<UpdateStatus>> mapForReplys) {
- super(ServiceHealthRequest.class);
- this.mapForReplys = mapForReplys;
- }
-
- @Override
- public void process(Object message, Map<String, Object> headers,
- ReplyConnection replyConnection) {
- if (replyConnection.isReplyRequested()) {
- ServiceHealthRequest request = (ServiceHealthRequest)message;
- List<UpdateStatus> updates = mapForReplys.get(request.getServiceName(), request.getServiceVersion());
- if(updates != null){
- for(UpdateStatus update:updates){
- if(update != null){
- update.run();
- }
- }
- }
- }
- }
-
-}
+package org.eclipse.osee.framework.messaging.services.internal; + +import java.util.List; +import java.util.Map; + +import org.eclipse.osee.framework.jdk.core.type.CompositeKeyHashMap; +import org.eclipse.osee.framework.messaging.OseeMessagingListener; +import org.eclipse.osee.framework.messaging.ReplyConnection; +import org.eclipse.osee.framework.messaging.services.messages.ServiceHealthRequest; + +/** + * @author Andrew M. Finkbeiner + * + */ +public class HealthRequestListener extends OseeMessagingListener { + private CompositeKeyHashMap<String, String, List<UpdateStatus>> mapForReplys; + + public HealthRequestListener( + CompositeKeyHashMap<String, String, List<UpdateStatus>> mapForReplys) { + super(ServiceHealthRequest.class); + this.mapForReplys = mapForReplys; + } + + @Override + public void process(Object message, Map<String, Object> headers, + ReplyConnection replyConnection) { + if (replyConnection.isReplyRequested()) { + ServiceHealthRequest request = (ServiceHealthRequest)message; + List<UpdateStatus> updates = mapForReplys.get(request.getServiceName(), request.getServiceVersion()); + if(updates != null){ + for(UpdateStatus update:updates){ + if(update != null){ + update.run(); + } + } + } + } + } + +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/HealthServiceListener.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/HealthServiceListener.java index ec35457d72c..79210799740 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/HealthServiceListener.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/HealthServiceListener.java @@ -8,62 +8,62 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging.services.internal;
-
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import org.eclipse.osee.framework.jdk.core.type.CompositeKeyHashMap;
-import org.eclipse.osee.framework.messaging.OseeMessagingListener;
-import org.eclipse.osee.framework.messaging.ReplyConnection;
-import org.eclipse.osee.framework.messaging.services.ServiceNotification;
-import org.eclipse.osee.framework.messaging.services.messages.ServiceHealth;
-
-/**
- * @author Andrew M. Finkbeiner
- *
- */
-class HealthServiceListener extends OseeMessagingListener {
-
- private static final int WIGGLE_ROOM = 20000;
-
- private CompositeKeyHashMap<String/* serviceName */, String /* serviceVersion */, Map<String /* serviceUniqueId */,ServiceHealthPlusTimeout>> map;
- private CompositeKeyHashMap<String/* serviceName */, String /* serviceVersion */, List<ServiceNotification>> callbacks;
-
- HealthServiceListener(CompositeKeyHashMap<String, String, Map<String, ServiceHealthPlusTimeout>> map, CompositeKeyHashMap<String, String, List<ServiceNotification>> callbacks){
- super(ServiceHealth.class);
- this.map = map;
- this.callbacks = callbacks;
- }
-
- @Override
- public void process(Object message, Map<String, Object> headers,
- ReplyConnection replyConnection) {
- ServiceHealth health = (ServiceHealth)message;
-
- if(health.isStopping()){
- List<ServiceNotification> itemsToNotify = callbacks.get(health.getServiceName(), health.getServiceVersion());
- if(itemsToNotify != null){
- for(ServiceNotification notification :itemsToNotify){
- notification.onServiceGone(health);
- }
- }
- } else {
- Map<String, ServiceHealthPlusTimeout> idMap = map.get(health.getServiceName(), health.getServiceVersion());
- if(idMap == null){
- idMap = new ConcurrentHashMap<String, ServiceHealthPlusTimeout>();
- map.put(health.getServiceName(), health.getServiceVersion(), idMap);
- }
- long shouldHaveRenewedTime = System.currentTimeMillis() + (health.getRefreshRateInSeconds()*1000) + WIGGLE_ROOM;
- idMap.put(health.getServiceUniqueId(), new ServiceHealthPlusTimeout(health, shouldHaveRenewedTime));
-
- List<ServiceNotification> itemsToNotify = callbacks.get(health.getServiceName(), health.getServiceVersion());
- if(itemsToNotify != null){
- for(ServiceNotification notification :itemsToNotify){
- notification.onServiceUpdate(health);
- }
- }
- }
- }
-
-}
+package org.eclipse.osee.framework.messaging.services.internal; + +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import org.eclipse.osee.framework.jdk.core.type.CompositeKeyHashMap; +import org.eclipse.osee.framework.messaging.OseeMessagingListener; +import org.eclipse.osee.framework.messaging.ReplyConnection; +import org.eclipse.osee.framework.messaging.services.ServiceNotification; +import org.eclipse.osee.framework.messaging.services.messages.ServiceHealth; + +/** + * @author Andrew M. Finkbeiner + * + */ +class HealthServiceListener extends OseeMessagingListener { + + private static final int WIGGLE_ROOM = 20000; + + private CompositeKeyHashMap<String/* serviceName */, String /* serviceVersion */, Map<String /* serviceUniqueId */,ServiceHealthPlusTimeout>> map; + private CompositeKeyHashMap<String/* serviceName */, String /* serviceVersion */, List<ServiceNotification>> callbacks; + + HealthServiceListener(CompositeKeyHashMap<String, String, Map<String, ServiceHealthPlusTimeout>> map, CompositeKeyHashMap<String, String, List<ServiceNotification>> callbacks){ + super(ServiceHealth.class); + this.map = map; + this.callbacks = callbacks; + } + + @Override + public void process(Object message, Map<String, Object> headers, + ReplyConnection replyConnection) { + ServiceHealth health = (ServiceHealth)message; + + if(health.isStopping()){ + List<ServiceNotification> itemsToNotify = callbacks.get(health.getServiceName(), health.getServiceVersion()); + if(itemsToNotify != null){ + for(ServiceNotification notification :itemsToNotify){ + notification.onServiceGone(health); + } + } + } else { + Map<String, ServiceHealthPlusTimeout> idMap = map.get(health.getServiceName(), health.getServiceVersion()); + if(idMap == null){ + idMap = new ConcurrentHashMap<String, ServiceHealthPlusTimeout>(); + map.put(health.getServiceName(), health.getServiceVersion(), idMap); + } + long shouldHaveRenewedTime = System.currentTimeMillis() + (health.getRefreshRateInSeconds()*1000) + WIGGLE_ROOM; + idMap.put(health.getServiceUniqueId(), new ServiceHealthPlusTimeout(health, shouldHaveRenewedTime)); + + List<ServiceNotification> itemsToNotify = callbacks.get(health.getServiceName(), health.getServiceVersion()); + if(itemsToNotify != null){ + for(ServiceNotification notification :itemsToNotify){ + notification.onServiceUpdate(health); + } + } + } + } + +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/MonitorTimedOutServices.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/MonitorTimedOutServices.java index 8d9146093fd..ca59a9ea4bc 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/MonitorTimedOutServices.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/MonitorTimedOutServices.java @@ -8,71 +8,71 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging.services.internal;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.Map.Entry;
-import org.eclipse.osee.framework.jdk.core.type.CompositeKeyHashMap;
-import org.eclipse.osee.framework.jdk.core.type.Pair;
-import org.eclipse.osee.framework.messaging.services.ServiceNotification;
-
-/**
- * @author Andrew M. Finkbeiner
- *
- */
-class MonitorTimedOutServices implements Runnable {
-
- private CompositeKeyHashMap<String, String, Map<String, ServiceHealthPlusTimeout>> map;
- private CompositeKeyHashMap<String, String, List<ServiceNotification>> callbacks;
-
- public MonitorTimedOutServices(
- CompositeKeyHashMap<String, String, Map<String, ServiceHealthPlusTimeout>> map, CompositeKeyHashMap<String, String, List<ServiceNotification>> callbacks) {
- this.map = map;
- this.callbacks = callbacks;
- }
-
- @Override
- public void run() {
- List<ThreeItems> toRemove = new ArrayList<ThreeItems>();
- long currentSystemTime = System.currentTimeMillis();
- Set<Pair<String, String>> keySet = map.keySet();
- for(Pair<String, String> pair:keySet){
- Map<String, ServiceHealthPlusTimeout> items = map.get(pair.getFirst(), pair.getSecond());
- for(Entry<String, ServiceHealthPlusTimeout> key:items.entrySet()){
- if(key.getValue().isTimedOut(currentSystemTime)){
- toRemove.add(new ThreeItems(pair.getFirst(), pair.getSecond(), key.getKey()));
- List<ServiceNotification> list = callbacks.get(pair.getFirst(), pair.getSecond());
- for(ServiceNotification notify:list){
- notify.onServiceGone(key.getValue().getServiceHealth());
- }
- }
- }
- }
- for(ThreeItems item:toRemove){
- Map<String, ServiceHealthPlusTimeout> innerMap = map.get(item.first, item.second);
- innerMap.remove(item.key);
- System.out.println(item.key);
- if(innerMap.isEmpty()){
- map.remove(item.first, item.second);
- System.out.println("removed " + item.first + item.second);
- }
- }
- }
-
- private static class ThreeItems {
-
- String first;
- String second;
- String key;
-
- ThreeItems(String first, String second, String key){
- this.first = first;
- this.second = second;
- this.key = key;
- }
- }
-
-}
+package org.eclipse.osee.framework.messaging.services.internal; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Map.Entry; +import org.eclipse.osee.framework.jdk.core.type.CompositeKeyHashMap; +import org.eclipse.osee.framework.jdk.core.type.Pair; +import org.eclipse.osee.framework.messaging.services.ServiceNotification; + +/** + * @author Andrew M. Finkbeiner + * + */ +class MonitorTimedOutServices implements Runnable { + + private CompositeKeyHashMap<String, String, Map<String, ServiceHealthPlusTimeout>> map; + private CompositeKeyHashMap<String, String, List<ServiceNotification>> callbacks; + + public MonitorTimedOutServices( + CompositeKeyHashMap<String, String, Map<String, ServiceHealthPlusTimeout>> map, CompositeKeyHashMap<String, String, List<ServiceNotification>> callbacks) { + this.map = map; + this.callbacks = callbacks; + } + + @Override + public void run() { + List<ThreeItems> toRemove = new ArrayList<ThreeItems>(); + long currentSystemTime = System.currentTimeMillis(); + Set<Pair<String, String>> keySet = map.keySet(); + for(Pair<String, String> pair:keySet){ + Map<String, ServiceHealthPlusTimeout> items = map.get(pair.getFirst(), pair.getSecond()); + for(Entry<String, ServiceHealthPlusTimeout> key:items.entrySet()){ + if(key.getValue().isTimedOut(currentSystemTime)){ + toRemove.add(new ThreeItems(pair.getFirst(), pair.getSecond(), key.getKey())); + List<ServiceNotification> list = callbacks.get(pair.getFirst(), pair.getSecond()); + for(ServiceNotification notify:list){ + notify.onServiceGone(key.getValue().getServiceHealth()); + } + } + } + } + for(ThreeItems item:toRemove){ + Map<String, ServiceHealthPlusTimeout> innerMap = map.get(item.first, item.second); + innerMap.remove(item.key); + System.out.println(item.key); + if(innerMap.isEmpty()){ + map.remove(item.first, item.second); + System.out.println("removed " + item.first + item.second); + } + } + } + + private static class ThreeItems { + + String first; + String second; + String key; + + ThreeItems(String first, String second, String key){ + this.first = first; + this.second = second; + this.key = key; + } + } + +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/OseeMessagingStatusImpl.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/OseeMessagingStatusImpl.java index 42f5fb39621..6effedf9fb8 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/OseeMessagingStatusImpl.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/OseeMessagingStatusImpl.java @@ -8,35 +8,35 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging.services.internal;
-
-import java.util.logging.Level;
-
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.messaging.OseeMessagingStatusCallback;
-
-/**
- * @author Andrew M. Finkbeiner
- *
- */
-public class OseeMessagingStatusImpl implements OseeMessagingStatusCallback {
-
- private String failureMessage;
- private Class<?> clazz;
-
- public OseeMessagingStatusImpl(String failureMessage, Class<?> clazz){
- this.failureMessage = failureMessage;
- this.clazz = clazz;
- }
-
- @Override
- public void fail(Throwable th) {
- th.printStackTrace();
- OseeLog.log(clazz, Level.SEVERE, failureMessage, th);
- }
-
- @Override
- public void success() {
- }
-
-}
+package org.eclipse.osee.framework.messaging.services.internal; + +import java.util.logging.Level; + +import org.eclipse.osee.framework.logging.OseeLog; +import org.eclipse.osee.framework.messaging.OseeMessagingStatusCallback; + +/** + * @author Andrew M. Finkbeiner + * + */ +public class OseeMessagingStatusImpl implements OseeMessagingStatusCallback { + + private String failureMessage; + private Class<?> clazz; + + public OseeMessagingStatusImpl(String failureMessage, Class<?> clazz){ + this.failureMessage = failureMessage; + this.clazz = clazz; + } + + @Override + public void fail(Throwable th) { + th.printStackTrace(); + OseeLog.log(clazz, Level.SEVERE, failureMessage, th); + } + + @Override + public void success() { + } + +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/RemoteServiceLookupImpl.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/RemoteServiceLookupImpl.java index 0950c3b68c1..b4143c422c0 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/RemoteServiceLookupImpl.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/RemoteServiceLookupImpl.java @@ -8,121 +8,121 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging.services.internal;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-import java.util.logging.Level;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.type.CompositeKeyHashMap;
-import org.eclipse.osee.framework.jdk.core.type.Pair;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.messaging.ConnectionNode;
-import org.eclipse.osee.framework.messaging.services.BaseMessages;
-import org.eclipse.osee.framework.messaging.services.RemoteServiceLookup;
-import org.eclipse.osee.framework.messaging.services.ServiceNotification;
-import org.eclipse.osee.framework.messaging.services.messages.ServiceHealthRequest;
-
-/**
- * @author Andrew M. Finkbeiner
- *
- */
-public class RemoteServiceLookupImpl implements RemoteServiceLookup {
-
- private ConnectionNode connectionNode;
- private CompositeKeyHashMap<String, String, Map<String, ServiceHealthPlusTimeout>> map;
- private CompositeKeyHashMap<String, String, List<ServiceNotification>> callbacks;
- private HealthServiceListener healthServiceListener;
-
- public RemoteServiceLookupImpl(ConnectionNode node, ScheduledExecutorService executor) {
- this.connectionNode = node;
- map = new CompositeKeyHashMap<String, String, Map<String, ServiceHealthPlusTimeout>>(25, true);
- callbacks = new CompositeKeyHashMap<String, String, List<ServiceNotification>>(
- 25, true);
- healthServiceListener = new HealthServiceListener(map, callbacks);
- connectionNode.subscribeToReply(BaseMessages.ServiceHealthRequest,
- healthServiceListener);
- executor.scheduleAtFixedRate(new MonitorTimedOutServices(map, callbacks), 30, 30, TimeUnit.SECONDS);
- }
-
- public void start(){
- connectionNode.subscribe(BaseMessages.ServiceHealth,
- healthServiceListener,
- new OseeMessagingStatusImpl("Failed to subscribe to " + BaseMessages.ServiceHealth.getName(),
- RemoteServiceLookupImpl.class));
-
- }
-
- public void stop(){
- connectionNode.unsubscribe(BaseMessages.ServiceHealth,
- healthServiceListener,
- new OseeMessagingStatusImpl("Failed to subscribe to " + BaseMessages.ServiceHealth.getName(),
- RemoteServiceLookupImpl.class));
- }
-
-
- @Override
- public void register(String serviceName, String serviceVersion,
- ServiceNotification notification) {
- addListener(serviceName, serviceVersion, notification);
- Map<String, ServiceHealthPlusTimeout> healthMap = map.get(serviceName, serviceVersion);
- if (healthMap != null) {
- for(ServiceHealthPlusTimeout serviceHealth:healthMap.values()){
- notification.onServiceUpdate(serviceHealth.getServiceHealth());
- }
- } else {
- sendOutRequest(serviceName, serviceVersion);
- }
- }
-
- public void sendOutRequestsForServiceHealth(){
- Set<Pair<String, String>> pairs = callbacks.keySet();
- for(Pair<String, String> pair:pairs){
- sendOutRequest(pair.getFirst(), pair.getSecond());
- }
- }
-
- private void sendOutRequest(String serviceName, String serviceVersion){
- ServiceHealthRequest request = new ServiceHealthRequest();
- request.setServiceName(serviceName);
- request.setServiceVersion(serviceVersion);
- try {
- connectionNode.send(BaseMessages.ServiceHealthRequest, request, new OseeMessagingStatusImpl(String.format("Failed to send Health Request for %s [%s]", serviceName, serviceVersion), RemoteServiceLookup.class));
- } catch (OseeCoreException ex) {
- OseeLog.log(RemoteServiceLookupImpl.class, Level.SEVERE, ex);
- }
- }
-
- private void addListener(String serviceName, String serviceVersion,
- ServiceNotification notification) {
- List<ServiceNotification> itemsToNotify = callbacks.get(serviceName,
- serviceVersion);
- if (itemsToNotify == null) {
- itemsToNotify = new CopyOnWriteArrayList<ServiceNotification>();
- callbacks.put(serviceName, serviceVersion, itemsToNotify);
- }
- itemsToNotify.add(notification);
- }
-
- @Override
- public boolean unregister(String serviceName,
- String serviceVersion, ServiceNotification notification) {
- return removeListener(serviceName, serviceVersion, notification);
- }
-
- private boolean removeListener(String serviceName,
- String serviceVersion, ServiceNotification notification) {
- List<ServiceNotification> itemsToNotify = callbacks.get(serviceName,
- serviceVersion);
- boolean removed = false;
- if (itemsToNotify != null) {
- removed = itemsToNotify.remove(notification);
- }
- return removed;
- }
-
-}
+package org.eclipse.osee.framework.messaging.services.internal; + +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; +import java.util.logging.Level; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.jdk.core.type.CompositeKeyHashMap; +import org.eclipse.osee.framework.jdk.core.type.Pair; +import org.eclipse.osee.framework.logging.OseeLog; +import org.eclipse.osee.framework.messaging.ConnectionNode; +import org.eclipse.osee.framework.messaging.services.BaseMessages; +import org.eclipse.osee.framework.messaging.services.RemoteServiceLookup; +import org.eclipse.osee.framework.messaging.services.ServiceNotification; +import org.eclipse.osee.framework.messaging.services.messages.ServiceHealthRequest; + +/** + * @author Andrew M. Finkbeiner + * + */ +public class RemoteServiceLookupImpl implements RemoteServiceLookup { + + private ConnectionNode connectionNode; + private CompositeKeyHashMap<String, String, Map<String, ServiceHealthPlusTimeout>> map; + private CompositeKeyHashMap<String, String, List<ServiceNotification>> callbacks; + private HealthServiceListener healthServiceListener; + + public RemoteServiceLookupImpl(ConnectionNode node, ScheduledExecutorService executor) { + this.connectionNode = node; + map = new CompositeKeyHashMap<String, String, Map<String, ServiceHealthPlusTimeout>>(25, true); + callbacks = new CompositeKeyHashMap<String, String, List<ServiceNotification>>( + 25, true); + healthServiceListener = new HealthServiceListener(map, callbacks); + connectionNode.subscribeToReply(BaseMessages.ServiceHealthRequest, + healthServiceListener); + executor.scheduleAtFixedRate(new MonitorTimedOutServices(map, callbacks), 30, 30, TimeUnit.SECONDS); + } + + public void start(){ + connectionNode.subscribe(BaseMessages.ServiceHealth, + healthServiceListener, + new OseeMessagingStatusImpl("Failed to subscribe to " + BaseMessages.ServiceHealth.getName(), + RemoteServiceLookupImpl.class)); + + } + + public void stop(){ + connectionNode.unsubscribe(BaseMessages.ServiceHealth, + healthServiceListener, + new OseeMessagingStatusImpl("Failed to subscribe to " + BaseMessages.ServiceHealth.getName(), + RemoteServiceLookupImpl.class)); + } + + + @Override + public void register(String serviceName, String serviceVersion, + ServiceNotification notification) { + addListener(serviceName, serviceVersion, notification); + Map<String, ServiceHealthPlusTimeout> healthMap = map.get(serviceName, serviceVersion); + if (healthMap != null) { + for(ServiceHealthPlusTimeout serviceHealth:healthMap.values()){ + notification.onServiceUpdate(serviceHealth.getServiceHealth()); + } + } else { + sendOutRequest(serviceName, serviceVersion); + } + } + + public void sendOutRequestsForServiceHealth(){ + Set<Pair<String, String>> pairs = callbacks.keySet(); + for(Pair<String, String> pair:pairs){ + sendOutRequest(pair.getFirst(), pair.getSecond()); + } + } + + private void sendOutRequest(String serviceName, String serviceVersion){ + ServiceHealthRequest request = new ServiceHealthRequest(); + request.setServiceName(serviceName); + request.setServiceVersion(serviceVersion); + try { + connectionNode.send(BaseMessages.ServiceHealthRequest, request, new OseeMessagingStatusImpl(String.format("Failed to send Health Request for %s [%s]", serviceName, serviceVersion), RemoteServiceLookup.class)); + } catch (OseeCoreException ex) { + OseeLog.log(RemoteServiceLookupImpl.class, Level.SEVERE, ex); + } + } + + private void addListener(String serviceName, String serviceVersion, + ServiceNotification notification) { + List<ServiceNotification> itemsToNotify = callbacks.get(serviceName, + serviceVersion); + if (itemsToNotify == null) { + itemsToNotify = new CopyOnWriteArrayList<ServiceNotification>(); + callbacks.put(serviceName, serviceVersion, itemsToNotify); + } + itemsToNotify.add(notification); + } + + @Override + public boolean unregister(String serviceName, + String serviceVersion, ServiceNotification notification) { + return removeListener(serviceName, serviceVersion, notification); + } + + private boolean removeListener(String serviceName, + String serviceVersion, ServiceNotification notification) { + List<ServiceNotification> itemsToNotify = callbacks.get(serviceName, + serviceVersion); + boolean removed = false; + if (itemsToNotify != null) { + removed = itemsToNotify.remove(notification); + } + return removed; + } + +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/RemoteServiceRegistrarImpl.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/RemoteServiceRegistrarImpl.java index 8e7554cca87..085e65fe2b7 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/RemoteServiceRegistrarImpl.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/RemoteServiceRegistrarImpl.java @@ -8,108 +8,108 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging.services.internal;
-
-import java.net.URI;
-import java.util.List;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.TimeUnit;
-
-import org.eclipse.osee.framework.jdk.core.type.CompositeKeyHashMap;
-import org.eclipse.osee.framework.messaging.ConnectionNode;
-import org.eclipse.osee.framework.messaging.services.BaseMessages;
-import org.eclipse.osee.framework.messaging.services.RegisteredServiceReference;
-import org.eclipse.osee.framework.messaging.services.RemoteServiceRegistrar;
-import org.eclipse.osee.framework.messaging.services.ServiceInfoPopulator;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-public class RemoteServiceRegistrarImpl implements RemoteServiceRegistrar {
-
- private ConnectionNode connectionNode;
- private ConcurrentHashMap<String, ScheduledFuture<?>> map;
- private ConcurrentHashMap<String, UpdateStatus> mapOfUpdateStatus;
- private CompositeKeyHashMap<String, String, List<UpdateStatus>> mapForReplys;
- private ScheduledExecutorService executor;
- private HealthRequestListener healthRequestListener;
-
- public RemoteServiceRegistrarImpl(ConnectionNode node, ScheduledExecutorService executor) {
- this.connectionNode = node;
- this.executor = executor;
- mapOfUpdateStatus = new ConcurrentHashMap<String, UpdateStatus>();
- map = new ConcurrentHashMap<String, ScheduledFuture<?>>();
- mapForReplys = new CompositeKeyHashMap<String, String, List<UpdateStatus>>(8, true);
- healthRequestListener = new HealthRequestListener(mapForReplys);
- }
-
- public void start() {
- connectionNode.subscribe(BaseMessages.ServiceHealthRequest, healthRequestListener, new OseeMessagingStatusImpl("Failed to subscribe to " + BaseMessages.ServiceHealthRequest.getName(), RemoteServiceRegistrarImpl.class));
- }
-
- public void stop() {
- connectionNode.unsubscribe(BaseMessages.ServiceHealthRequest, healthRequestListener, new OseeMessagingStatusImpl("Failed to subscribe to " + BaseMessages.ServiceHealthRequest.getName(), RemoteServiceRegistrarImpl.class));
- }
-
- @Override
- public RegisteredServiceReference registerService(String serviceName, String serviceVersion, String serviceUniqueId, URI broker, ServiceInfoPopulator infoPopulator, int refreshRateInSeconds) {
- String key = getKey(serviceName, serviceVersion, serviceUniqueId);
- if (!mapOfUpdateStatus.containsKey(key)) {
- UpdateStatus updateStatus = new UpdateStatus(this.connectionNode, serviceName, serviceVersion, serviceUniqueId, broker, refreshRateInSeconds, infoPopulator);
- ScheduledFuture<?> scheduled = executor.scheduleAtFixedRate(updateStatus, 0, refreshRateInSeconds, TimeUnit.SECONDS);
- map.put(key, scheduled);
- mapOfUpdateStatus.put(key, updateStatus);
- addToReplyMap(serviceName, serviceVersion, updateStatus);
- }
- return new ServiceReferenceImp(mapOfUpdateStatus.get(key));
- }
-
- private String getKey(String serviceName, String serviceVersion, String serviceUniqueId){
- return serviceName + serviceVersion + serviceUniqueId;
- }
-
- @Override
- public boolean unregisterService(String serviceName, String serviceVersion, String serviceUniqueId) {
- String key = getKey(serviceName, serviceVersion, serviceUniqueId);
-
- UpdateStatus updateStatus = mapOfUpdateStatus.remove(key);
- if(updateStatus != null){
- updateStatus.close();
- removeFromReplyMap(serviceName, serviceVersion, updateStatus);
- }
-
- ScheduledFuture<?> scheduled = map.remove(key);
- if (scheduled == null) {
- return false;
- } else {
- return scheduled.cancel(false);
- }
- }
-
- public void addToReplyMap(String serviceName, String serviceVersion, UpdateStatus updateForReply) {
- List<UpdateStatus> list = mapForReplys.get(serviceName, serviceVersion);
- if (list == null) {
- list = new CopyOnWriteArrayList<UpdateStatus>();
- mapForReplys.put(serviceName, serviceVersion, list);
- }
- list.add(updateForReply);
- }
-
- public boolean removeFromReplyMap(String serviceName, String serviceVersion, UpdateStatus updateForReply) {
- List<UpdateStatus> list = mapForReplys.get(serviceName, serviceVersion);
- if (list != null) {
- return list.remove(updateForReply);
- }
- return false;
- }
-
- void updateService(String key) {
- UpdateStatus update = mapOfUpdateStatus.get(key);
- if(update != null){
- update.run();
- }
- }
-}
+package org.eclipse.osee.framework.messaging.services.internal; + +import java.net.URI; +import java.util.List; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; + +import org.eclipse.osee.framework.jdk.core.type.CompositeKeyHashMap; +import org.eclipse.osee.framework.messaging.ConnectionNode; +import org.eclipse.osee.framework.messaging.services.BaseMessages; +import org.eclipse.osee.framework.messaging.services.RegisteredServiceReference; +import org.eclipse.osee.framework.messaging.services.RemoteServiceRegistrar; +import org.eclipse.osee.framework.messaging.services.ServiceInfoPopulator; + +/** + * @author Andrew M. Finkbeiner + */ +public class RemoteServiceRegistrarImpl implements RemoteServiceRegistrar { + + private ConnectionNode connectionNode; + private ConcurrentHashMap<String, ScheduledFuture<?>> map; + private ConcurrentHashMap<String, UpdateStatus> mapOfUpdateStatus; + private CompositeKeyHashMap<String, String, List<UpdateStatus>> mapForReplys; + private ScheduledExecutorService executor; + private HealthRequestListener healthRequestListener; + + public RemoteServiceRegistrarImpl(ConnectionNode node, ScheduledExecutorService executor) { + this.connectionNode = node; + this.executor = executor; + mapOfUpdateStatus = new ConcurrentHashMap<String, UpdateStatus>(); + map = new ConcurrentHashMap<String, ScheduledFuture<?>>(); + mapForReplys = new CompositeKeyHashMap<String, String, List<UpdateStatus>>(8, true); + healthRequestListener = new HealthRequestListener(mapForReplys); + } + + public void start() { + connectionNode.subscribe(BaseMessages.ServiceHealthRequest, healthRequestListener, new OseeMessagingStatusImpl("Failed to subscribe to " + BaseMessages.ServiceHealthRequest.getName(), RemoteServiceRegistrarImpl.class)); + } + + public void stop() { + connectionNode.unsubscribe(BaseMessages.ServiceHealthRequest, healthRequestListener, new OseeMessagingStatusImpl("Failed to subscribe to " + BaseMessages.ServiceHealthRequest.getName(), RemoteServiceRegistrarImpl.class)); + } + + @Override + public RegisteredServiceReference registerService(String serviceName, String serviceVersion, String serviceUniqueId, URI broker, ServiceInfoPopulator infoPopulator, int refreshRateInSeconds) { + String key = getKey(serviceName, serviceVersion, serviceUniqueId); + if (!mapOfUpdateStatus.containsKey(key)) { + UpdateStatus updateStatus = new UpdateStatus(this.connectionNode, serviceName, serviceVersion, serviceUniqueId, broker, refreshRateInSeconds, infoPopulator); + ScheduledFuture<?> scheduled = executor.scheduleAtFixedRate(updateStatus, 0, refreshRateInSeconds, TimeUnit.SECONDS); + map.put(key, scheduled); + mapOfUpdateStatus.put(key, updateStatus); + addToReplyMap(serviceName, serviceVersion, updateStatus); + } + return new ServiceReferenceImp(mapOfUpdateStatus.get(key)); + } + + private String getKey(String serviceName, String serviceVersion, String serviceUniqueId){ + return serviceName + serviceVersion + serviceUniqueId; + } + + @Override + public boolean unregisterService(String serviceName, String serviceVersion, String serviceUniqueId) { + String key = getKey(serviceName, serviceVersion, serviceUniqueId); + + UpdateStatus updateStatus = mapOfUpdateStatus.remove(key); + if(updateStatus != null){ + updateStatus.close(); + removeFromReplyMap(serviceName, serviceVersion, updateStatus); + } + + ScheduledFuture<?> scheduled = map.remove(key); + if (scheduled == null) { + return false; + } else { + return scheduled.cancel(false); + } + } + + public void addToReplyMap(String serviceName, String serviceVersion, UpdateStatus updateForReply) { + List<UpdateStatus> list = mapForReplys.get(serviceName, serviceVersion); + if (list == null) { + list = new CopyOnWriteArrayList<UpdateStatus>(); + mapForReplys.put(serviceName, serviceVersion, list); + } + list.add(updateForReply); + } + + public boolean removeFromReplyMap(String serviceName, String serviceVersion, UpdateStatus updateForReply) { + List<UpdateStatus> list = mapForReplys.get(serviceName, serviceVersion); + if (list != null) { + return list.remove(updateForReply); + } + return false; + } + + void updateService(String key) { + UpdateStatus update = mapOfUpdateStatus.get(key); + if(update != null){ + update.run(); + } + } +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/ServiceHealthPlusTimeout.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/ServiceHealthPlusTimeout.java index e55380bc58c..1e19b566c55 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/ServiceHealthPlusTimeout.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/ServiceHealthPlusTimeout.java @@ -8,31 +8,31 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging.services.internal;
-
-import org.eclipse.osee.framework.messaging.services.messages.ServiceHealth;
-
-/**
- * @author Andrew M. Finkbeiner
- *
- */
-public class ServiceHealthPlusTimeout {
-
- private ServiceHealth health;
- private long shouldHaveRenewedTime;
-
- public ServiceHealthPlusTimeout(ServiceHealth health,
- long shouldHaveRenewedTime) {
- this.health = health;
- this.shouldHaveRenewedTime = shouldHaveRenewedTime;
- }
-
- public boolean isTimedOut(long currentSystemTime){
- return (currentSystemTime > shouldHaveRenewedTime);
- }
-
- public ServiceHealth getServiceHealth(){
- return health;
- }
-
-}
+package org.eclipse.osee.framework.messaging.services.internal; + +import org.eclipse.osee.framework.messaging.services.messages.ServiceHealth; + +/** + * @author Andrew M. Finkbeiner + * + */ +public class ServiceHealthPlusTimeout { + + private ServiceHealth health; + private long shouldHaveRenewedTime; + + public ServiceHealthPlusTimeout(ServiceHealth health, + long shouldHaveRenewedTime) { + this.health = health; + this.shouldHaveRenewedTime = shouldHaveRenewedTime; + } + + public boolean isTimedOut(long currentSystemTime){ + return (currentSystemTime > shouldHaveRenewedTime); + } + + public ServiceHealth getServiceHealth(){ + return health; + } + +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/ServiceLookupAndRegistrarLifeCycle.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/ServiceLookupAndRegistrarLifeCycle.java index 661dbed5ff6..0af6148064d 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/ServiceLookupAndRegistrarLifeCycle.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/ServiceLookupAndRegistrarLifeCycle.java @@ -8,100 +8,100 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging.services.internal;
-
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-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.MessageService;
-import org.eclipse.osee.framework.messaging.internal.Activator;
-import org.eclipse.osee.framework.messaging.services.RemoteServiceLookup;
-import org.eclipse.osee.framework.messaging.services.RemoteServiceRegistrar;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.util.tracker.ServiceTracker;
-
-/**
- * @author Andrew M. Finkbeiner
- *
- */
-public class ServiceLookupAndRegistrarLifeCycle extends ServiceTracker {
-
- private RemoteServiceRegistrar registrar;
- private ServiceRegistration lookupRegistration;
- private ServiceRegistration registrarRegistration;
- private ClassLoader contextClassLoader;
- private RemoteServiceLookupImpl lookup;
- /**
- * @param context
- * @param filter
- * @param customizer
- */
- public ServiceLookupAndRegistrarLifeCycle(BundleContext context, ClassLoader contextClassLoader) {
- super(context, MessageService.class.getName(), null);
- this.contextClassLoader = contextClassLoader;
- }
-
- @Override
- public Object addingService(ServiceReference reference) {
- OseeLog.log(Activator.class, Level.INFO, String.format("Found %s service.", MessageService.class.getName()));
- OseeLog.log(Activator.class, Level.FINEST, String.format("GOING TO GET THE REF"));
- MessageService messageService = (MessageService) context.getService(reference);
- OseeLog.log(Activator.class, Level.FINEST, String.format("got the service ref"));
- ScheduledExecutorService executor = Executors.newScheduledThreadPool(2);
- OseeLog.log(Activator.class, Level.FINEST, String.format("got exec"));
- try{
- OseeLog.log(Activator.class, Level.FINEST, String.format("set context classloader"));
- Thread.currentThread().setContextClassLoader(contextClassLoader);
- OseeLog.log(Activator.class, Level.FINEST, String.format("done set context classloader"));
- registrar = new RemoteServiceRegistrarImpl(messageService.getDefault(), executor);
- OseeLog.log(Activator.class, Level.FINEST, String.format("Getting ready to start %s.", RemoteServiceRegistrarImpl.class.getName()));
- registrar.start();
- OseeLog.log(Activator.class, Level.FINEST, String.format("started %s.", RemoteServiceRegistrarImpl.class.getName()));
- lookup = new RemoteServiceLookupImpl(messageService.getDefault(), executor);
- OseeLog.log(Activator.class, Level.FINEST, String.format("Getting ready to start %s.", RemoteServiceLookupImpl.class.getName()));
- lookup.start();
- OseeLog.log(Activator.class, Level.FINEST, String.format("started %s.", RemoteServiceLookupImpl.class.getName()));
-
- lookupRegistration = context.registerService(RemoteServiceLookup.class.getName(), lookup, null);
- OseeLog.log(Activator.class, Level.INFO, String.format("Registered %s.", RemoteServiceLookup.class.getName()));
- registrarRegistration = context.registerService(RemoteServiceRegistrar.class.getName(), registrar, null);
- OseeLog.log(Activator.class, Level.INFO, String.format("Registered %s.", RemoteServiceRegistrar.class.getName()));
- } catch (OseeCoreException ex){
- OseeLog.log(ServiceLookupAndRegistrarLifeCycle.class, Level.SEVERE, ex);
- }
- return super.addingService(reference);
- }
-
- @Override
- public void removedService(ServiceReference reference, Object service) {
- commonShutdown();
- super.removedService(reference, service);
- }
-
- @Override
- public void close() {
- commonShutdown();
- super.close();
- }
-
- private void commonShutdown(){
- if(lookupRegistration != null){
- lookupRegistration.unregister();
- lookupRegistration = null;
- lookup.stop();
- }
- if(registrarRegistration != null){
- registrarRegistration.unregister();
- registrarRegistration = null;
- registrar.stop();
- }
-
- }
-
-
-}
+package org.eclipse.osee.framework.messaging.services.internal; + +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +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.MessageService; +import org.eclipse.osee.framework.messaging.internal.Activator; +import org.eclipse.osee.framework.messaging.services.RemoteServiceLookup; +import org.eclipse.osee.framework.messaging.services.RemoteServiceRegistrar; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; +import org.osgi.framework.ServiceRegistration; +import org.osgi.util.tracker.ServiceTracker; + +/** + * @author Andrew M. Finkbeiner + * + */ +public class ServiceLookupAndRegistrarLifeCycle extends ServiceTracker { + + private RemoteServiceRegistrar registrar; + private ServiceRegistration lookupRegistration; + private ServiceRegistration registrarRegistration; + private ClassLoader contextClassLoader; + private RemoteServiceLookupImpl lookup; + /** + * @param context + * @param filter + * @param customizer + */ + public ServiceLookupAndRegistrarLifeCycle(BundleContext context, ClassLoader contextClassLoader) { + super(context, MessageService.class.getName(), null); + this.contextClassLoader = contextClassLoader; + } + + @Override + public Object addingService(ServiceReference reference) { + OseeLog.log(Activator.class, Level.INFO, String.format("Found %s service.", MessageService.class.getName())); + OseeLog.log(Activator.class, Level.FINEST, String.format("GOING TO GET THE REF")); + MessageService messageService = (MessageService) context.getService(reference); + OseeLog.log(Activator.class, Level.FINEST, String.format("got the service ref")); + ScheduledExecutorService executor = Executors.newScheduledThreadPool(2); + OseeLog.log(Activator.class, Level.FINEST, String.format("got exec")); + try{ + OseeLog.log(Activator.class, Level.FINEST, String.format("set context classloader")); + Thread.currentThread().setContextClassLoader(contextClassLoader); + OseeLog.log(Activator.class, Level.FINEST, String.format("done set context classloader")); + registrar = new RemoteServiceRegistrarImpl(messageService.getDefault(), executor); + OseeLog.log(Activator.class, Level.FINEST, String.format("Getting ready to start %s.", RemoteServiceRegistrarImpl.class.getName())); + registrar.start(); + OseeLog.log(Activator.class, Level.FINEST, String.format("started %s.", RemoteServiceRegistrarImpl.class.getName())); + lookup = new RemoteServiceLookupImpl(messageService.getDefault(), executor); + OseeLog.log(Activator.class, Level.FINEST, String.format("Getting ready to start %s.", RemoteServiceLookupImpl.class.getName())); + lookup.start(); + OseeLog.log(Activator.class, Level.FINEST, String.format("started %s.", RemoteServiceLookupImpl.class.getName())); + + lookupRegistration = context.registerService(RemoteServiceLookup.class.getName(), lookup, null); + OseeLog.log(Activator.class, Level.INFO, String.format("Registered %s.", RemoteServiceLookup.class.getName())); + registrarRegistration = context.registerService(RemoteServiceRegistrar.class.getName(), registrar, null); + OseeLog.log(Activator.class, Level.INFO, String.format("Registered %s.", RemoteServiceRegistrar.class.getName())); + } catch (OseeCoreException ex){ + OseeLog.log(ServiceLookupAndRegistrarLifeCycle.class, Level.SEVERE, ex); + } + return super.addingService(reference); + } + + @Override + public void removedService(ServiceReference reference, Object service) { + commonShutdown(); + super.removedService(reference, service); + } + + @Override + public void close() { + commonShutdown(); + super.close(); + } + + private void commonShutdown(){ + if(lookupRegistration != null){ + lookupRegistration.unregister(); + lookupRegistration = null; + lookup.stop(); + } + if(registrarRegistration != null){ + registrarRegistration.unregister(); + registrarRegistration = null; + registrar.stop(); + } + + } + + +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/ServiceReferenceImp.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/ServiceReferenceImp.java index da85f115d4e..e6c6806721b 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/ServiceReferenceImp.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/ServiceReferenceImp.java @@ -8,25 +8,25 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging.services.internal;
-
-import org.eclipse.osee.framework.messaging.services.RegisteredServiceReference;
-
-/**
- * @author Andrew M. Finkbeiner
- *
- */
-class ServiceReferenceImp implements RegisteredServiceReference {
-
- UpdateStatus updateStatus;
-
- ServiceReferenceImp(UpdateStatus updateStatus){
- this.updateStatus = updateStatus;
- }
-
- @Override
- public void update() {
- updateStatus.run();
- }
-
-}
+package org.eclipse.osee.framework.messaging.services.internal; + +import org.eclipse.osee.framework.messaging.services.RegisteredServiceReference; + +/** + * @author Andrew M. Finkbeiner + * + */ +class ServiceReferenceImp implements RegisteredServiceReference { + + UpdateStatus updateStatus; + + ServiceReferenceImp(UpdateStatus updateStatus){ + this.updateStatus = updateStatus; + } + + @Override + public void update() { + updateStatus.run(); + } + +} diff --git a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/UpdateStatus.java b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/UpdateStatus.java index 87961ed4c05..08ad188d3f1 100644 --- a/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/UpdateStatus.java +++ b/plugins/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/UpdateStatus.java @@ -8,55 +8,55 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.messaging.services.internal;
-
-import java.net.URI;
-import java.util.logging.Level;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.messaging.ConnectionNode;
-import org.eclipse.osee.framework.messaging.services.BaseMessages;
-import org.eclipse.osee.framework.messaging.services.ServiceInfoPopulator;
-import org.eclipse.osee.framework.messaging.services.messages.ServiceHealth;
-
-/**
- * @author Andrew M. Finkbeiner
- *
- */
-public class UpdateStatus implements Runnable {
-
- private ConnectionNode connectionNode;
- private ServiceInfoPopulator infoPopulator;
- private ServiceHealth health;
- private String errorMsg;
-
- UpdateStatus(ConnectionNode connectionNode, String serviceName, String serviceVersion, String serviceUniqueId, URI broker, int refreshRateInSeconds, ServiceInfoPopulator infoPopulator){
- this.connectionNode = connectionNode;
- health = new ServiceHealth();
- health.setBrokerURI(broker.toASCIIString());
- health.setServiceName(serviceName);
- health.setServiceVersion(serviceVersion);
- health.setServiceUniqueId(serviceUniqueId);
- health.setRefreshRateInSeconds(refreshRateInSeconds);
- health.setStopping(false);
- errorMsg = String.format("Failed to send %s to %s v[%s][%s]", BaseMessages.ServiceHealth.getName(), health.getServiceName(),
- health.getServiceVersion(), health.getServiceUniqueId());
- this.infoPopulator = infoPopulator;
- }
-
- @Override
- public synchronized void run() {
- try {
- health.getServiceDescription().clear();
- infoPopulator.updateServiceInfo(health.getServiceDescription());
- connectionNode.send(BaseMessages.ServiceHealth, health, new OseeMessagingStatusImpl(errorMsg, UpdateStatus.class));
- } catch (Exception ex) {
- OseeLog.log(UpdateStatus.class, Level.SEVERE, ex);
- }
- }
-
- public synchronized void close() {
- health.setStopping(true);
- run();
- }
-
-}
+package org.eclipse.osee.framework.messaging.services.internal; + +import java.net.URI; +import java.util.logging.Level; +import org.eclipse.osee.framework.logging.OseeLog; +import org.eclipse.osee.framework.messaging.ConnectionNode; +import org.eclipse.osee.framework.messaging.services.BaseMessages; +import org.eclipse.osee.framework.messaging.services.ServiceInfoPopulator; +import org.eclipse.osee.framework.messaging.services.messages.ServiceHealth; + +/** + * @author Andrew M. Finkbeiner + * + */ +public class UpdateStatus implements Runnable { + + private ConnectionNode connectionNode; + private ServiceInfoPopulator infoPopulator; + private ServiceHealth health; + private String errorMsg; + + UpdateStatus(ConnectionNode connectionNode, String serviceName, String serviceVersion, String serviceUniqueId, URI broker, int refreshRateInSeconds, ServiceInfoPopulator infoPopulator){ + this.connectionNode = connectionNode; + health = new ServiceHealth(); + health.setBrokerURI(broker.toASCIIString()); + health.setServiceName(serviceName); + health.setServiceVersion(serviceVersion); + health.setServiceUniqueId(serviceUniqueId); + health.setRefreshRateInSeconds(refreshRateInSeconds); + health.setStopping(false); + errorMsg = String.format("Failed to send %s to %s v[%s][%s]", BaseMessages.ServiceHealth.getName(), health.getServiceName(), + health.getServiceVersion(), health.getServiceUniqueId()); + this.infoPopulator = infoPopulator; + } + + @Override + public synchronized void run() { + try { + health.getServiceDescription().clear(); + infoPopulator.updateServiceInfo(health.getServiceDescription()); + connectionNode.send(BaseMessages.ServiceHealth, health, new OseeMessagingStatusImpl(errorMsg, UpdateStatus.class)); + } catch (Exception ex) { + OseeLog.log(UpdateStatus.class, Level.SEVERE, ex); + } + } + + public synchronized void close() { + health.setStopping(true); + run(); + } + +} |