Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2006-10-20 03:08:40 +0000
committerslewis2006-10-20 03:08:40 +0000
commitc78cfd77fd74a199ce23169df8d8d6602402ca1e (patch)
treee7d362231460b266312b49a9d5891856d4afa96e /framework/bundles/org.eclipse.ecf.discovery/src
parentd471978483432d3c0d34f40848be8b2c2a1881df (diff)
downloadorg.eclipse.ecf-c78cfd77fd74a199ce23169df8d8d6602402ca1e.tar.gz
org.eclipse.ecf-c78cfd77fd74a199ce23169df8d8d6602402ca1e.tar.xz
org.eclipse.ecf-c78cfd77fd74a199ce23169df8d8d6602402ca1e.zip
Fix for bug #160968 'add removeListener' interfaces where necessary. Also moved ServiceID
Diffstat (limited to 'framework/bundles/org.eclipse.ecf.discovery/src')
-rw-r--r--framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/IDiscoveryContainer.java1
-rw-r--r--framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/IServiceInfo.java1
-rw-r--r--framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/ServiceID.java92
-rw-r--r--framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/ServiceInfo.java1
4 files changed, 92 insertions, 3 deletions
diff --git a/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/IDiscoveryContainer.java b/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/IDiscoveryContainer.java
index 6f0254525..ffeaf30b7 100644
--- a/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/IDiscoveryContainer.java
+++ b/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/IDiscoveryContainer.java
@@ -11,7 +11,6 @@ package org.eclipse.ecf.discovery;
import java.io.IOException;
-import org.eclipse.ecf.core.identity.ServiceID;
/**
* Adapter interface for shared object containers that support lookup and discovery.
diff --git a/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/IServiceInfo.java b/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/IServiceInfo.java
index ae5627ab1..11649b621 100644
--- a/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/IServiceInfo.java
+++ b/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/IServiceInfo.java
@@ -12,7 +12,6 @@ package org.eclipse.ecf.discovery;
import java.net.InetAddress;
import java.net.URI;
import java.net.URISyntaxException;
-import org.eclipse.ecf.core.identity.ServiceID;
/**
* Service information contrace. Defines the information associated
* with a remotely discoverable service
diff --git a/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/ServiceID.java b/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/ServiceID.java
new file mode 100644
index 000000000..ff888f20a
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/ServiceID.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2004 Composent, Inc. and others. 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: Composent, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.ecf.discovery;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.eclipse.ecf.core.identity.BaseID;
+import org.eclipse.ecf.core.identity.Namespace;
+
+public class ServiceID extends BaseID {
+ private static final long serialVersionUID = 1L;
+ protected String type;
+ protected String name;
+
+ protected ServiceID(Namespace namespace, String type, String name) {
+ super(namespace);
+ if (type == null)
+ throw new NullPointerException("ServiceID type cannot be null");
+ this.type = type;
+ this.name = name;
+ }
+
+ public ServiceID(String type, String name) {
+ this.name = name;
+ this.type = type;
+ }
+
+ protected String getFullyQualifiedName() {
+ if (name == null)
+ return type;
+ else
+ return type + name;
+ }
+
+ protected int namespaceCompareTo(BaseID o) {
+ if (o instanceof ServiceID) {
+ ServiceID other = (ServiceID) o;
+ String typename = other.getFullyQualifiedName();
+ return getFullyQualifiedName().compareTo(typename);
+ } else {
+ return 1;
+ }
+ }
+
+ protected boolean namespaceEquals(BaseID o) {
+ if (o == null)
+ return false;
+ if (o instanceof ServiceID) {
+ ServiceID other = (ServiceID) o;
+ if (other.getName().equals(getName())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected String namespaceGetName() {
+ return getFullyQualifiedName();
+ }
+
+ protected int namespaceHashCode() {
+ return getFullyQualifiedName().hashCode();
+ }
+
+ protected URI namespaceToURI() throws URISyntaxException {
+ throw new URISyntaxException(
+ "cannot create URI from service id with name " + getName(),
+ getName());
+ }
+
+ public String getServiceType() {
+ return type;
+ }
+
+ public String getServiceName() {
+ return name;
+ }
+
+ public String toString() {
+ StringBuffer buf = new StringBuffer("ServiceID[");
+ buf.append("type=").append(type).append(";name=").append(name).append(
+ ";full=" + getFullyQualifiedName()).append("]");
+ return buf.toString();
+ }
+}
diff --git a/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/ServiceInfo.java b/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/ServiceInfo.java
index 2812d2f5f..998120740 100644
--- a/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/ServiceInfo.java
+++ b/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/ServiceInfo.java
@@ -14,7 +14,6 @@ import java.net.InetAddress;
import java.net.URI;
import java.net.URISyntaxException;
-import org.eclipse.ecf.core.identity.ServiceID;
/**
* Information provided by discovery protocol about a remote service

Back to the top