Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2005-11-29 05:46:20 +0000
committerslewis2005-11-29 05:46:20 +0000
commitb000bcb247df025c6f6e97f2e0432c9592d47e13 (patch)
treee706d5444cdd7f798509b7aa4a0b5b8d363980e1 /framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse
parent40ac183468bc7d5110f32c962c493fbc32f9750c (diff)
downloadorg.eclipse.ecf-b000bcb247df025c6f6e97f2e0432c9592d47e13.tar.gz
org.eclipse.ecf-b000bcb247df025c6f6e97f2e0432c9592d47e13.tar.xz
org.eclipse.ecf-b000bcb247df025c6f6e97f2e0432c9592d47e13.zip
Modified Map IServiceInfo.getProperties() method to IServiceProperties IServiceInfo.getServiceProperties(). Updated references in example code to Map methods to IServiceProperties methods rather than Map methods. Updated JmDNS provider implementation to support new IServiceProperties interface
Diffstat (limited to 'framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse')
-rw-r--r--framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/IServiceInfo.java4
-rw-r--r--framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/IServiceProperties.java42
-rw-r--r--framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/ServiceInfo.java8
-rw-r--r--framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/ServiceProperties.java53
4 files changed, 100 insertions, 7 deletions
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 5c7a608e5..ae5627ab1 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,8 +12,6 @@ package org.eclipse.ecf.discovery;
import java.net.InetAddress;
import java.net.URI;
import java.net.URISyntaxException;
-import java.util.Map;
-
import org.eclipse.ecf.core.identity.ServiceID;
/**
* Service information contrace. Defines the information associated
@@ -57,7 +55,7 @@ public interface IServiceInfo {
*
* @return Map the properties associated with this service
*/
- public Map getProperties();
+ public IServiceProperties getServiceProperties();
/**
* Returns true if this service info has been resolved by the service
* publisher, false if not.
diff --git a/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/IServiceProperties.java b/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/IServiceProperties.java
new file mode 100644
index 000000000..c2a6ffca9
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/IServiceProperties.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * 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.util.Enumeration;
+
+public interface IServiceProperties {
+ /**
+ * Get property names. This should return an Enumeration of String objects that identify all of the
+ * names in this IServiceProperties instance
+ * @return Enumeration of all service property names as Strings
+ */
+ public Enumeration getPropertyNames();
+ /**
+ * Get property name as String. Returns a valid String if there is a property of the given name.
+ * Returns null if there is no property by that name, or if the property has some other type than String.
+ * @param name the name of the property to return
+ * @return the property as a String
+ */
+ public String getPropertyString(String name);
+ /**
+ * Get property name as byte[]. Returns a non-null byte[] if there is a property of the given name.
+ * Returns null if there is no property by that name, or if the property has some other type than byte[].
+ * @param name the name of the property to return
+ * @return the property as a byte[]
+ */
+ public byte [] getPropertyBytes(String name);
+ /**
+ * Get property as an Object. Returns a non-null Object if there is a property of the given name.
+ * Returns null if there is no property by that name.
+ * @param name the name of the property to return
+ * @return the property as an Object
+ */
+ public Object getProperty(String name);
+}
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 750399c16..7079e2837 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
@@ -28,9 +28,9 @@ public class ServiceInfo implements IServiceInfo, Serializable {
int port;
int priority;
int weight;
- Map properties;
+ IServiceProperties properties;
- public ServiceInfo(InetAddress address, String type, int port, int priority, int weight, Map props) {
+ public ServiceInfo(InetAddress address, String type, int port, int priority, int weight, IServiceProperties props) {
this.addr = address;
this.serviceID = new ServiceID(type,null);
this.port = port;
@@ -38,7 +38,7 @@ public class ServiceInfo implements IServiceInfo, Serializable {
this.properties = props;
}
public ServiceInfo(InetAddress address, ServiceID id, int port,
- int priority, int weight, Map props) {
+ int priority, int weight, IServiceProperties props) {
this.addr = address;
this.serviceID = id;
this.port = port;
@@ -71,7 +71,7 @@ public class ServiceInfo implements IServiceInfo, Serializable {
return weight;
}
- public Map getProperties() {
+ public IServiceProperties getServiceProperties() {
return properties;
}
public boolean isResolved() {
diff --git a/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/ServiceProperties.java b/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/ServiceProperties.java
new file mode 100644
index 000000000..3c35c6108
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/ServiceProperties.java
@@ -0,0 +1,53 @@
+/**
+ *
+ */
+package org.eclipse.ecf.discovery;
+
+import java.util.Enumeration;
+import java.util.Properties;
+
+public class ServiceProperties implements IServiceProperties {
+
+ Properties props = new Properties();
+
+ public ServiceProperties() {
+ super();
+ props = new Properties();
+ }
+ public ServiceProperties(Properties props) {
+ super();
+ this.props = props;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.discovery.IServiceProperties#getPropertyNames()
+ */
+ public Enumeration getPropertyNames() {
+ return props.keys();
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.discovery.IServiceProperties#getPropertyString(java.lang.String)
+ */
+ public String getPropertyString(String name) {
+ Object val = props.get(name);
+ if (val instanceof String) {
+ return (String) val;
+ }
+ return null;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.discovery.IServiceProperties#getPropertyBytes(java.lang.String)
+ */
+ public byte[] getPropertyBytes(String name) {
+ Object val = props.get(name);
+ if (val instanceof byte []) {
+ return (byte[]) val;
+ }
+ return null;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.discovery.IServiceProperties#getProperty(java.lang.String)
+ */
+ public Object getProperty(String name) {
+ return props.get(name);
+ }
+}

Back to the top