Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'providers/bundles/org.eclipse.ecf.provider.jmdns')
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.jmdns/src/org/eclipse/ecf/provider/jmdns/container/JMDNSDiscoveryContainer.java28
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.jmdns/src/org/eclipse/ecf/provider/jmdns/container/JMDNSServiceInfo.java30
2 files changed, 19 insertions, 39 deletions
diff --git a/providers/bundles/org.eclipse.ecf.provider.jmdns/src/org/eclipse/ecf/provider/jmdns/container/JMDNSDiscoveryContainer.java b/providers/bundles/org.eclipse.ecf.provider.jmdns/src/org/eclipse/ecf/provider/jmdns/container/JMDNSDiscoveryContainer.java
index c347a806a..046b94e9e 100644
--- a/providers/bundles/org.eclipse.ecf.provider.jmdns/src/org/eclipse/ecf/provider/jmdns/container/JMDNSDiscoveryContainer.java
+++ b/providers/bundles/org.eclipse.ecf.provider.jmdns/src/org/eclipse/ecf/provider/jmdns/container/JMDNSDiscoveryContainer.java
@@ -13,6 +13,7 @@ package org.eclipse.ecf.provider.jmdns.container;
import java.io.IOException;
import java.io.InvalidObjectException;
import java.net.InetAddress;
+import java.net.URI;
import java.util.*;
import javax.jmdns.*;
import javax.jmdns.ServiceInfo;
@@ -30,6 +31,9 @@ import org.eclipse.ecf.internal.provider.jmdns.*;
import org.eclipse.ecf.provider.jmdns.identity.JMDNSNamespace;
public class JMDNSDiscoveryContainer extends AbstractDiscoveryContainerAdapter implements IDiscoveryService, ServiceListener, ServiceTypeListener {
+
+ private static final String SCHEME_PROPERTY = "jmdns.ptcl"; //$NON-NLS-1$
+
public static final int DEFAULT_REQUEST_TIMEOUT = 3000;
private static int instanceCount = 0;
@@ -360,17 +364,20 @@ public class JMDNSDiscoveryContainer extends AbstractDiscoveryContainerAdapter i
final int priority = serviceInfo.getPriority();
final int weight = serviceInfo.getWeight();
final Properties props = new Properties();
+ String uriProtocol = null;
for (final Enumeration e = serviceInfo.getPropertyNames(); e.hasMoreElements();) {
final String name = (String) e.nextElement();
- Object value = serviceInfo.getPropertyString(name);
- if (value == null)
- value = serviceInfo.getPropertyBytes(name);
- if (value != null)
- props.put(name, value);
+ if (name.equals(SCHEME_PROPERTY))
+ uriProtocol = serviceInfo.getPropertyString(name);
+ else {
+ Object value = serviceInfo.getPropertyString(name);
+ if (value == null)
+ value = serviceInfo.getPropertyBytes(name);
+ if (value != null)
+ props.put(name, value);
+ }
}
- final ServiceProperties svcProperties = new ServiceProperties(props);
- final IServiceInfo newInfo = new JMDNSServiceInfo(addr, sID, port, priority, weight, svcProperties);
- return newInfo;
+ return new org.eclipse.ecf.discovery.ServiceInfo(uriProtocol, addr.getHostAddress(), port, sID, priority, weight, new ServiceProperties(props));
}
private ServiceID createServiceID(String type, String name) {
@@ -399,7 +406,10 @@ public class JMDNSDiscoveryContainer extends AbstractDiscoveryContainerAdapter i
}
}
}
- final ServiceInfo si = new ServiceInfo(sID.getServiceTypeID().getInternal(), sID.getServiceName(), serviceInfo.getLocation().getPort(), serviceInfo.getPriority(), serviceInfo.getWeight(), props);
+ // Add URI scheme to props
+ URI location = serviceInfo.getLocation();
+ props.put(SCHEME_PROPERTY, location.getScheme());
+ final ServiceInfo si = new ServiceInfo(sID.getServiceTypeID().getInternal(), sID.getServiceName(), location.getPort(), serviceInfo.getPriority(), serviceInfo.getWeight(), props);
return si;
}
diff --git a/providers/bundles/org.eclipse.ecf.provider.jmdns/src/org/eclipse/ecf/provider/jmdns/container/JMDNSServiceInfo.java b/providers/bundles/org.eclipse.ecf.provider.jmdns/src/org/eclipse/ecf/provider/jmdns/container/JMDNSServiceInfo.java
deleted file mode 100644
index d970b13d8..000000000
--- a/providers/bundles/org.eclipse.ecf.provider.jmdns/src/org/eclipse/ecf/provider/jmdns/container/JMDNSServiceInfo.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/****************************************************************************
- * 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.provider.jmdns.container;
-
-import java.net.*;
-import org.eclipse.ecf.discovery.IServiceProperties;
-import org.eclipse.ecf.discovery.ServiceInfo;
-import org.eclipse.ecf.discovery.identity.ServiceID;
-import org.eclipse.ecf.provider.jmdns.identity.JMDNSNamespace;
-
-public class JMDNSServiceInfo extends ServiceInfo {
-
- private static final long serialVersionUID = -5229813165370975600L;
- public static final String PROP_PROTOCOL_NAME = "protocol"; //$NON-NLS-1$
- public static final String PROP_PATH_NAME = "path"; //$NON-NLS-1$
- public static final String SLASH = "/"; //$NON-NLS-1$
-
- public JMDNSServiceInfo(InetAddress address, ServiceID id, int port, int priority, int weight, IServiceProperties props) throws URISyntaxException {
- super(new URI(JMDNSNamespace.JMDNS_SCHEME, null, address.getHostAddress(), port, null, null, null), id, priority, weight, props);
- }
-
-}

Back to the top