felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From don...@apache.org
Subject svn commit: r567865 - in /felix/sandbox/donsez/mdns: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/felix/ src/main/java/org/apache/felix/sandbox/ src/main/java/org/apache/felix/sandbox/mdns/ src/...
Date Mon, 20 Aug 2007 22:39:07 GMT
Author: donsez
Date: Mon Aug 20 15:39:04 2007
New Revision: 567865

URL: http://svn.apache.org/viewvc?rev=567865&view=rev
Log:
Creation of the mDNS bundle. This bundle provides a service and a shell command to publish and retrieve service references with mDNS in a adhoc network.
It could be used to
* register web pages served by the Http Service Impl 
* register JMX service url served by the connectors and adapters of a OSGi-based JMX agent such as M-OSGi 
* expose OSGi service with remoting connector (SOAP, RMI, XML-RPC, ...) 

Added:
    felix/sandbox/donsez/mdns/
    felix/sandbox/donsez/mdns/pom.xml   (with props)
    felix/sandbox/donsez/mdns/src/
    felix/sandbox/donsez/mdns/src/main/
    felix/sandbox/donsez/mdns/src/main/java/
    felix/sandbox/donsez/mdns/src/main/java/org/
    felix/sandbox/donsez/mdns/src/main/java/org/apache/
    felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/
    felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/
    felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/
    felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/Constants.java   (with props)
    felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/MDnsService.java   (with props)
    felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/ServiceInfo.java   (with props)
    felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/impl/
    felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/impl/Activator.java   (with props)
    felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/impl/MDnsCmd.java   (with props)
    felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/impl/MDnsEventSender.java   (with props)
    felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/impl/MDnsServiceImpl.java   (with props)
    felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/impl/ServiceInfoImpl.java   (with props)
    felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/impl/ServiceTypeListFeeder.java   (with props)
    felix/sandbox/donsez/mdns/src/site/
    felix/sandbox/donsez/mdns/src/site/index.html   (with props)
    felix/sandbox/donsez/mdns/src/site/mdns.txt   (with props)
    felix/sandbox/donsez/mdns/src/site/screenshot/
    felix/sandbox/donsez/mdns/src/site/screenshot/Thumbs.db   (with props)
    felix/sandbox/donsez/mdns/src/site/screenshot/bonjourie.png   (with props)
    felix/sandbox/donsez/mdns/src/site/screenshot/dnssd-axis1.png   (with props)
    felix/sandbox/donsez/mdns/src/site/screenshot/dnssd-axis2.png   (with props)
    felix/sandbox/donsez/mdns/src/site/screenshot/dnssd-jmx.png   (with props)
    felix/sandbox/donsez/mdns/src/site/screenshot/ie-axis.png   (with props)
    felix/sandbox/donsez/mdns/src/site/screenshot/ie-jmx.png   (with props)
    felix/sandbox/donsez/mdns/src/site/screenshot/jmdnsbrowser.png   (with props)
    felix/sandbox/donsez/mdns/src/site/screenshot/jmdnsbrowser2.png   (with props)

Added: felix/sandbox/donsez/mdns/pom.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/mdns/pom.xml?rev=567865&view=auto
==============================================================================
--- felix/sandbox/donsez/mdns/pom.xml (added)
+++ felix/sandbox/donsez/mdns/pom.xml Mon Aug 20 15:39:04 2007
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <artifactId>felix</artifactId>
+    <groupId>org.apache.felix</groupId>
+    <version>1.0.0</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>org.apache.felix.sandbox.mdns</artifactId>
+  <packaging>bundle</packaging>
+  <name>mDNS</name>
+  <version>0.1.0-SNAPSHOT</version>
+  <description>${description}</description>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Export-Service>org.apache.felix.sandbox.mdns.MDnsService,org.apache.felix.shell.Command</Export-Service>
+            <Import-Package>org.osgi.framework;version=1.3,
+            	 org.osgi.util.tracker, org.osgi.service.event, org.apache.felix.shell</Import-Package>
+            <Export-Package>${pom.artifactId}</Export-Package>
+            <Private-Package>${pom.artifactId}.impl,,javax.jmdns</Private-Package>
+            <Bundle-Activator>${pom.artifactId}.impl.Activator</Bundle-Activator>
+          </instructions>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+    <dependency>
+      <groupId>${pom.groupId}</groupId>
+      <artifactId>org.osgi.core</artifactId>
+      <version>1.0.0</version>
+    </dependency>
+    <dependency>
+      <groupId>${pom.groupId}</groupId>
+      <artifactId>org.osgi.compendium</artifactId>
+      <version>0.9.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>${pom.groupId}</groupId>
+      <artifactId>org.apache.felix.shell</artifactId>
+      <version>1.0.0</version>
+    </dependency>
+    <dependency>
+      <!-- license is ASL2 -->
+      <groupId>jmdns</groupId>
+      <artifactId>jmdns</artifactId>
+      <version>1.0</version>
+    </dependency>
+  </dependencies>
+  <properties>
+    <repositoryLocation>http://www.apache.org/-donsez/dev/felix/sandbox/</repositoryLocation>
+    <description>provides a service and a shell command to publish and retrieve service references with mDNS in a ad-hoc network.</description>
+  </properties>
+</project>
+

Propchange: felix/sandbox/donsez/mdns/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/Constants.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/Constants.java?rev=567865&view=auto
==============================================================================
--- felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/Constants.java (added)
+++ felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/Constants.java Mon Aug 20 15:39:04 2007
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.sandbox.mdns;
+
+/**
+ * Constants
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public interface Constants {
+	
+	/**
+	 * topic names for event admin
+	 */
+	public final static String SERVICE_ADDED_TOPIC="mdns/service/ADDED";
+	public final static String SERVICE_REMOVED_TOPIC="mdns/service/REMOVED";
+	public final static String SERVICE_RESOLVED_TOPIC="mdns/service/RESOLVED";
+	public final static String SERVICE_TYPE_ADDED_TOPIC="mdns/type/ADDED";	
+}
+

Propchange: felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/Constants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/MDnsService.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/MDnsService.java?rev=567865&view=auto
==============================================================================
--- felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/MDnsService.java (added)
+++ felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/MDnsService.java Mon Aug 20 15:39:04 2007
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.sandbox.mdns;
+
+import java.io.IOException;
+
+import org.osgi.framework.InvalidSyntaxException;
+
+/**
+ * Service interface
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public interface MDnsService {
+	
+    /**
+     * Returns a list of service infos of the specified type.
+     *
+     * @param type Service type name, such as <code>_http._tcp.local.</code>.
+     * @return An array of service instance names.
+     */
+    public ServiceInfo[] list(String type);
+
+
+    /**
+     * Returns a list of service infos of the specified type.
+     *
+     * @param type Service type name, such as <code>_http._tcp.local.</code>.
+     * @param filter LDAP filter on the service properties
+     * @return An array of service instance names.
+     * @throws InvalidSyntaxException 
+     */
+    public ServiceInfo[] list(String type, String filter) throws InvalidSyntaxException;
+    
+    
+    /**
+     * Get service information. If the information is not cached, the method
+     * will block until updated information is received.
+     * <p>
+     * Usage note: Do not call this method from the AWT event dispatcher thread.
+     * You will make the user interface unresponsive.
+     *
+     * @param type fully qualified service type, such as <code>_http._tcp.local.</code> .
+     * @param name unqualified service name, such as <code>foobar</code> .
+     * @return null if the service information cannot be obtained
+     */
+    public ServiceInfo getServiceInfo(String type, String name);
+    
+    /**
+     * Get service information. If the information is not cached, the method
+     * will block for the given timeout until updated information is received.
+     * <p>
+     * Usage note: If you call this method from the AWT event dispatcher thread,
+     * use a small timeout, or you will make the user interface unresponsive.
+     *
+     * @param type full qualified service type, such as <code>_http._tcp.local.</code> .
+     * @param name unqualified service name, such as <code>foobar</code> .
+     * @param timeout timeout in milliseconds
+     * @return null if the service information cannot be obtained
+     */
+    public ServiceInfo getServiceInfo(String type, String name, int timeout);
+    
+    /**
+     * Register a service. The service is registered for access by other jmdns clients.
+     * The name of the service may be changed to make it unique.
+     */
+    public void registerService(ServiceInfo info) throws IOException;
+    
+    /**
+     * Unregister a service. The service should have been registered.
+     */
+    public void unregisterService(ServiceInfo info);
+    
+    /**
+     * Unregister all services.
+     */
+    public void unregisterAllServices();
+    
+    /**
+     * Register a service type. If this service type was not already known,
+     * all service listeners will be notified of the new service type. Service types
+     * are automatically registered as they are discovered.
+     */
+    public void registerServiceType(String type);
+}
+

Propchange: felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/MDnsService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/ServiceInfo.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/ServiceInfo.java?rev=567865&view=auto
==============================================================================
--- felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/ServiceInfo.java (added)
+++ felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/ServiceInfo.java Mon Aug 20 15:39:04 2007
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.sandbox.mdns;
+
+import java.net.InetAddress;
+import java.util.Enumeration;
+
+/**
+ * This interface provides an access to mDNS service info. It is used to wrap the javax.jmdns.ServiceInfo class
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public interface ServiceInfo {
+
+    /**
+     * Fully qualified service type name, such as <code>_http._tcp.local.</code> .
+     */
+    public String getType();
+    
+    /**
+     * Unqualified service instance name, such as <code>foobar</code> .
+     */
+    public String getName();
+        
+    /**
+     * Fully qualified service name, such as <code>foobar._http._tcp.local.</code> .
+     */
+    public String getQualifiedName();
+    
+    /**
+     * Get the name of the server.
+     */
+    public String getServer();
+    
+    /**
+     * Get the host address of the service (ie X.X.X.X).
+     */
+    public String getHostAddress();
+    
+    public InetAddress getAddress();
+    
+    /**
+     * Get the InetAddress of the service.
+     */
+    public InetAddress getInetAddress();
+
+    /**
+     * Get the port for the service.
+     */
+    public int getPort();
+    
+    /**
+     * Get the priority of the service.
+     */
+    public int getPriority();
+    
+    /**
+     * Get the weight of the service.
+     */
+    public int getWeight();
+    
+    /**
+     * Get the text for the service as raw bytes.
+     */
+    public byte[] getTextBytes();
+    
+    /**
+     * Get the text for the service. This will interpret the text bytes
+     * as a UTF8 encoded string. Will return null if the bytes are not
+     * a valid UTF8 encoded string.
+     */
+    public String getTextString();
+    
+    /**
+     * Get the URL for this service. An http URL is created by
+     * combining the address, port, and path properties.
+     */
+    public String getURL();
+    
+    /**
+     * Get the URL for this service. An URL is created by
+     * combining the protocol, address, port, and path properties.
+     */
+    public String getURL(String protocol);
+    
+    /**
+     * Get a property of the service. This involves decoding the
+     * text bytes into a property list. Returns null if the property
+     * is not found or the text data could not be decoded correctly.
+     */
+    public byte[] getPropertyBytes(String name);
+    
+    /**
+     * Get a property of the service. This involves decoding the
+     * text bytes into a property list. Returns null if the property
+     * is not found, the text data could not be decoded correctly, or
+     * the resulting bytes are not a valid UTF8 string.
+     */
+    public String getPropertyString(String name);
+    
+    /**
+     * Enumeration of the property names.
+     */
+    public Enumeration getPropertyNames();    
+}

Propchange: felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/ServiceInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/impl/Activator.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/impl/Activator.java?rev=567865&view=auto
==============================================================================
--- felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/impl/Activator.java (added)
+++ felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/impl/Activator.java Mon Aug 20 15:39:04 2007
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.sandbox.mdns.impl;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+/**
+ * Activator of the bundles
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class Activator implements BundleActivator {
+	
+	MDnsCmd m_mDnsCmd;
+	MDnsServiceImpl m_jmDNSImpl;
+	
+	/**
+	 * @see org.osgi.framework.BundleActivator#start(BundleContext)
+	 */
+	public void start(BundleContext context) throws Exception {
+		
+		String debug=context.getProperty("jmdns.debug");
+		if(debug!=null){
+			// must be done be JmDns instanciation
+			System.setProperty("jmdns.debug",debug);
+		}
+		
+		m_jmDNSImpl=new MDnsServiceImpl();
+		m_jmDNSImpl.start(context);
+		
+		m_mDnsCmd=new MDnsCmd(m_jmDNSImpl.getJmDNS());
+		m_mDnsCmd.start(context);
+	}
+
+	/**
+	 * @see org.osgi.framework.BundleActivator#stop(BundleContext)
+	 */
+	public void stop(BundleContext context) throws Exception {
+		if(m_mDnsCmd!=null) m_mDnsCmd.stop(context);
+		if(m_jmDNSImpl!=null) m_jmDNSImpl.stop(context);
+	}
+}
\ No newline at end of file

Propchange: felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/impl/Activator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/impl/MDnsCmd.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/impl/MDnsCmd.java?rev=567865&view=auto
==============================================================================
--- felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/impl/MDnsCmd.java (added)
+++ felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/impl/MDnsCmd.java Mon Aug 20 15:39:04 2007
@@ -0,0 +1,262 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.sandbox.mdns.impl;
+
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.Dictionary;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import javax.jmdns.JmDNS;
+import javax.jmdns.ServiceEvent;
+import javax.jmdns.ServiceInfo;
+import javax.jmdns.ServiceListener;
+import javax.jmdns.ServiceTypeListener;
+
+import org.apache.felix.shell.Command;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * Command for the Felix shell
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class MDnsCmd implements Command, BundleActivator {
+
+	private static final String HELP_OPTION = "help";
+	private static final String SERVICES_OPTION = "services";
+	private static final String TYPES_OPTION = "types";
+	private static final String INFO_OPTION = "info";
+	private static final String SETDEBUG_OPTION = "setdebug";
+	private static final String REGISTER_OPTION = "register";
+	private static final String UNREGISTER_OPTION = "unregister";
+	private static final String BROWSER_OPTION = "browser";
+
+	private ServiceRegistration m_serviceRegistration;
+	private JmDNS m_jmDNS;
+	private Set m_serviceTypes;
+		
+	private ServiceTypeListener m_serviceTypeListFeeder;
+	
+	public MDnsCmd(JmDNS jmDNS) {
+		this.m_jmDNS=jmDNS;
+	}
+	
+	/**
+	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+	 */
+	public void start(BundleContext bundleContext) throws Exception {
+		m_serviceTypes=new HashSet();
+		m_serviceTypeListFeeder=new ServiceTypeListFeeder(m_serviceTypes);
+		m_jmDNS.addServiceTypeListener(m_serviceTypeListFeeder);
+
+		Dictionary properties = null;
+		m_serviceRegistration=bundleContext.registerService(Command.class.getName(), this, properties);
+	}
+
+	/**
+	 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+	 */
+	public void stop(BundleContext bundleContext) throws Exception {
+		m_serviceRegistration.unregister();
+
+		m_jmDNS.removeServiceTypeListener(m_serviceTypeListFeeder);
+	}
+
+	
+	public String getName() {
+		return "mdns";
+	}
+
+	public String getUsage() {
+		return "mdns [help]";
+	}
+
+	public String getShortDescription() {
+		return "interact with a mDNS registry";
+	}
+
+	private void printUsage(PrintStream out) {
+		out.println("mdns "+ HELP_OPTION 	+ "\t- Show this help message.");
+		out.println("mdns "+ TYPES_OPTION		+ "\t- list the service m_serviceTypes.");
+		out.println("mdns "+ SERVICES_OPTION		+ " <type>\t- list the services.");
+		out.println("mdns "+ INFO_OPTION		+ "\t- mDNS information.");
+		out.println("mdns "+ REGISTER_OPTION		+ " <type> <name> <port> <text>\t- register a service.");
+		out.println("mdns "+ REGISTER_OPTION		+ " <type> <name> <port> <priority> <weight> <key=value;key=value;...>\t- register a service.");
+		out.println("mdns "+ UNREGISTER_OPTION		+ " all \t- register all the services.");
+		out.println("mdns "+ BROWSER_OPTION		+ "\t- open a gui browser.");
+		out.println("mdns "+ SETDEBUG_OPTION		+ "\t<levelnumber> - set/get the debug level for mDNS.");
+		return;
+	}
+
+	public void execute(String s, PrintStream out, PrintStream err) {
+		StringTokenizer st = new StringTokenizer(s, " ");
+
+		// Ignore the command name.
+		st.nextToken();
+
+		if(st.countTokens()<1){
+			printUsage(out);
+			return;
+		}
+			
+		String option = st.nextToken();
+
+		if (option.equals(HELP_OPTION)) {
+				printUsage(out);
+		} else if (option.equals(TYPES_OPTION)) {
+            Iterator iterator=m_serviceTypes.iterator();
+            while(iterator.hasNext())
+            	out.println(iterator.next());
+		} else if (option.equals(SERVICES_OPTION)) {
+			if(st.countTokens()!=1){
+				printUsage(err);
+				return;
+			}
+			String type=st.nextToken();
+            ServiceInfo[] infos = m_jmDNS.list(type);
+            if(infos!=null)
+            	for (int i=0; i < infos.length; i++) {
+            		out.println(infos[i]);
+            	}
+
+		} else if (option.equals(REGISTER_OPTION)) {
+			ServiceInfo info;
+			if(st.countTokens()==4){
+	            info = new ServiceInfo(
+	            		st.nextToken(), // type
+	            		st.nextToken(), // name
+	            		Integer.parseInt(st.nextToken()), // port
+	            		st.nextToken()	// text
+					);
+			}else if(st.countTokens()==6){
+        		String type=st.nextToken(); // type
+        		String name=st.nextToken(); // name
+				int port=Integer.parseInt(st.nextToken());
+                int weight=Integer.parseInt(st.nextToken());
+                int priority=Integer.parseInt(st.nextToken());
+        		String propStr=st.nextToken();
+        		StringTokenizer st2=new StringTokenizer(propStr,";");
+				Hashtable hashtable=new Hashtable();
+        		while(st2.hasMoreTokens()){
+        			StringTokenizer st3=new StringTokenizer(st2.nextToken(),"=");
+        			hashtable.put(st3.nextToken(),st3.nextToken());
+        		}
+		        info = new ServiceInfo(type,name,port,weight,priority,hashtable);
+			} else {
+				printUsage(err);
+				return;
+			}
+
+            try {
+				m_jmDNS.registerService(info);
+			} catch (IOException e) {
+				e.printStackTrace(err);
+			}
+		} else if (option.equals(UNREGISTER_OPTION)) {
+			if(st.countTokens()!=1){
+				printUsage(err);
+				return;
+			}
+			String all=st.nextToken();
+			if(!all.equals("all")){
+				printUsage(err);
+				return;
+			}
+            m_jmDNS.unregisterAllServices();
+		} else if (option.equals(INFO_OPTION)) {
+            out.println(m_jmDNS.toString());
+            
+		} else if (option.equals(BROWSER_OPTION)) {
+			
+//			 try {
+//				new PublicBrowser(m_jmDNS);
+//				//new Thread(new BrowserRunnable()).start();
+//			} catch (IOException e) {
+//				e.printStackTrace();
+//			}
+			// TODO
+			err.println("com.strangeberry.jmdns.tools.Browser must be patched to be public");
+		} else if (option.equals(SETDEBUG_OPTION)) {
+			String levelNumberStr;
+			if(st.countTokens()==1){
+				levelNumberStr=System.getProperty("jmdns.debug");
+				out.println(levelNumberStr==null ? "no setted debug level" : levelNumberStr);
+			} else {
+				levelNumberStr=st.nextToken();
+				System.setProperty("jmdns.debug", levelNumberStr);
+			}
+			return;
+		} else {
+			printUsage(err);
+			return;
+		}
+	}
+
+	/* class BrowserRunnable implements Runnable {
+
+		/**
+		 * @see java.lang.Runnable#run()
+		 *
+		public void run() {
+			try {
+				new Browser(m_jmDNS);
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+			// System.out.println("mDNS browser exited.");
+		}
+		
+	}*/
+	
+	private boolean debug = false;
+	final protected void trace(String msg) {
+		if (debug) {
+			System.err.println(getClass().getName() + ":" + msg);
+		}
+	}
+	
+
+    class MyServiceListener implements ServiceListener {
+        public void serviceAdded(ServiceEvent event) {
+            System.out.println("Service added   : " + event.getName()+"."+event.getType());
+        }
+        public void serviceRemoved(ServiceEvent event) {
+            System.out.println("Service removed : " + event.getName()+"."+event.getType());
+        }
+        public void serviceResolved(ServiceEvent event) {
+            System.out.println("Service resolved: " + event.getInfo());
+        }
+    }
+    
+    class MyServiceTypeListener implements ServiceTypeListener {
+        
+        public void serviceTypeAdded(ServiceEvent event) {
+            System.out.println("Service type added: " +event.getType());
+        }
+    }
+}
+
+

Propchange: felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/impl/MDnsCmd.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/impl/MDnsEventSender.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/impl/MDnsEventSender.java?rev=567865&view=auto
==============================================================================
--- felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/impl/MDnsEventSender.java (added)
+++ felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/impl/MDnsEventSender.java Mon Aug 20 15:39:04 2007
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.sandbox.mdns.impl;
+
+import java.util.Dictionary;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.jmdns.JmDNS;
+import javax.jmdns.ServiceEvent;
+
+import org.apache.felix.sandbox.mdns.Constants;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventAdmin;
+import org.osgi.util.tracker.ServiceTracker;
+
+
+/**
+ * This class converts javax.jmdns.ServiceEvent in org.osgi.service.event.Event objects and sends them
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class MDnsEventSender implements javax.jmdns.ServiceListener, javax.jmdns.ServiceTypeListener, BundleActivator {
+
+	private ServiceTracker serviceTracker;
+	private JmDNS jmDNS;
+	private Set types;
+	
+	public MDnsEventSender(JmDNS jmDNS) {
+		this.jmDNS=jmDNS;
+	}
+
+	/**
+	 * @see javax.jmdns.ServiceListener#serviceAdded(javax.jmdns.ServiceEvent)
+	 */
+	public void serviceAdded(ServiceEvent serviceEvent) {
+		EventAdmin eventAdmin=(EventAdmin) serviceTracker.getService();
+		if (eventAdmin != null) {
+			Dictionary properties=new Hashtable();
+			properties.put("serviceInfo", serviceEvent.getInfo());
+			eventAdmin.sendEvent(new Event(Constants.SERVICE_ADDED_TOPIC,properties));
+		}
+	}
+
+	/**
+	 * @see javax.jmdns.ServiceListener#serviceRemoved(javax.jmdns.ServiceEvent)
+	 */
+	public void serviceRemoved(ServiceEvent serviceEvent) {
+		EventAdmin eventAdmin=(EventAdmin) serviceTracker.getService();
+		if (eventAdmin != null) {
+			Dictionary properties=new Hashtable();
+			properties.put("serviceInfo", serviceEvent.getInfo());
+			eventAdmin.sendEvent(new Event(Constants.SERVICE_ADDED_TOPIC,properties));
+		}
+	}
+
+	/**
+	 * @see javax.jmdns.ServiceListener#serviceResolved(javax.jmdns.ServiceEvent)
+	 */
+	public void serviceResolved(ServiceEvent serviceEvent) {
+		EventAdmin eventAdmin=(EventAdmin) serviceTracker.getService();
+		if (eventAdmin != null) {
+			Dictionary properties=new Hashtable();
+			properties.put("serviceInfo", serviceEvent.getInfo());
+			eventAdmin.sendEvent(new Event(Constants.SERVICE_ADDED_TOPIC,properties));
+		}
+	}
+
+	/**
+	 * @see javax.jmdns.ServiceTypeListener#serviceTypeAdded(javax.jmdns.ServiceEvent)
+	 */
+	public void serviceTypeAdded(ServiceEvent serviceEvent) {
+		EventAdmin eventAdmin=(EventAdmin) serviceTracker.getService();
+		if (eventAdmin != null) {
+			String type=serviceEvent.getType();
+			if(type==null) return; 
+
+			Dictionary properties=new Hashtable();
+			properties.put("serviceType", type);
+			eventAdmin.sendEvent(new Event(Constants.SERVICE_ADDED_TOPIC,properties));
+
+			types.add(type);
+			jmDNS.addServiceListener(type, this);
+		}
+	}
+
+	public void start(BundleContext bundleContext) throws Exception {
+		serviceTracker=new ServiceTracker(bundleContext,EventAdmin.class.getName(),null);
+		serviceTracker.open();
+		
+		types=new HashSet();
+		jmDNS.addServiceTypeListener(this);		
+	}
+
+	public void stop(BundleContext bundleContext) throws Exception {
+		serviceTracker.close();
+		
+		jmDNS.removeServiceTypeListener(this);
+		
+        Iterator iterator=types.iterator();
+        while(iterator.hasNext())
+        	jmDNS.removeServiceListener((String)iterator.next(),this);	
+	}
+}
\ No newline at end of file

Propchange: felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/impl/MDnsEventSender.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/impl/MDnsServiceImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/impl/MDnsServiceImpl.java?rev=567865&view=auto
==============================================================================
--- felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/impl/MDnsServiceImpl.java (added)
+++ felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/impl/MDnsServiceImpl.java Mon Aug 20 15:39:04 2007
@@ -0,0 +1,217 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.sandbox.mdns.impl;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.util.ArrayList;
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.List;
+
+import org.apache.felix.sandbox.mdns.MDnsService;
+import org.apache.felix.sandbox.mdns.ServiceInfo;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Filter;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceRegistration;
+
+
+/**
+ * Implementation of the service
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class MDnsServiceImpl implements MDnsService {
+
+	private javax.jmdns.JmDNS m_jmDNS;
+
+	private BundleContext m_bundleContext;
+
+	private ServiceRegistration m_serviceRegistration;
+
+	private MDnsEventSender m_mDnsEventSender;
+
+	/**
+	 * @see org.osgi.framework.BundleActivator#start(BundleContext)
+	 */
+
+	public void start(BundleContext context) throws Exception {
+		m_bundleContext = context;
+		m_jmDNS = new javax.jmdns.JmDNS(InetAddress.getLocalHost());
+		m_mDnsEventSender=new MDnsEventSender(m_jmDNS);
+		m_mDnsEventSender.start(context);
+
+		Dictionary properties = null;
+		m_serviceRegistration = m_bundleContext.registerService(MDnsService.class
+				.getName(), this, properties);
+	}
+
+	/**
+	 * @see org.osgi.framework.BundleActivator#stop(BundleContext)
+	 */
+	public void stop(BundleContext context) throws Exception {
+		if(m_serviceRegistration!=null) m_serviceRegistration.unregister();
+		if(m_mDnsEventSender!=null) m_mDnsEventSender.stop(context);
+		if(m_jmDNS!=null) m_jmDNS.close();
+	}
+
+	javax.jmdns.JmDNS getJmDNS() {
+		return m_jmDNS;
+	}
+
+	
+	
+	
+	private ServiceInfo[] delegate(javax.jmdns.ServiceInfo[] serviceInfos){
+		ServiceInfo[] si=new ServiceInfo[serviceInfos.length];
+		for(int i=0;i<serviceInfos.length;i++)
+			si[i]=new ServiceInfoImpl(serviceInfos[i]);
+		return si;
+	}	
+	
+	/**
+	 * @see org.apache.felix.sandbox.mdns.MDnsService#list(java.lang.String)
+	 */
+	public ServiceInfo[] list(String type) {
+		javax.jmdns.ServiceInfo[] serviceInfos=m_jmDNS.list(type);
+		return serviceInfos==null ? null : delegate(serviceInfos);
+	}
+
+	/**
+	 * @see org.apache.felix.sandbox.mdns.MDnsService#getServiceInfo(java.lang.String,
+	 *      java.lang.String)
+	 */
+	public ServiceInfo getServiceInfo(String type, String name) {
+		javax.jmdns.ServiceInfo serviceInfo=m_jmDNS.getServiceInfo(type, name);
+		return serviceInfo==null ? null : new ServiceInfoImpl(serviceInfo);
+	}
+
+	/**
+	 * @see org.apache.felix.sandbox.mdns.MDnsService#getServiceInfo(java.lang.String,
+	 *      java.lang.String, int)
+	 */
+	public ServiceInfo getServiceInfo(String type, String name, int timeout) {
+		javax.jmdns.ServiceInfo serviceInfo=m_jmDNS.getServiceInfo(type, name,timeout);
+		return serviceInfo==null ? null : new ServiceInfoImpl(serviceInfo);
+	}
+
+	// This method converts the delegate service info in jmDNS one	
+	static javax.jmdns.ServiceInfo convert(ServiceInfo info){
+		
+		Hashtable props=new Hashtable();
+		Enumeration enumeration=info.getPropertyNames();
+		while(enumeration.hasMoreElements()){
+			String name=(String)enumeration.nextElement();
+			props.put(name,info.getPropertyBytes(name));	
+		}
+		
+		return new javax.jmdns.ServiceInfo(info.getType(),info.getName(),info.getPort(),info.getWeight(),info.getPriority(),props);
+
+	}
+	
+	/**
+	 * @see org.apache.felix.sandbox.mdns.MDnsService#registerService(javax.jmdns.ServiceInfo)
+	 */
+	public void registerService(ServiceInfo info) throws IOException {
+		m_jmDNS.registerService(convert(info));
+	}
+
+	/**
+	 * @see org.apache.felix.sandbox.mdns.MDnsService#unregisterService(javax.jmdns.ServiceInfo)
+	 */
+	public void unregisterService(ServiceInfo info) {
+		m_jmDNS.unregisterService(convert(info));
+	}
+
+	/**
+	 * @see org.apache.felix.sandbox.mdns.MDnsService#unregisterAllServices()
+	 */
+	public void unregisterAllServices() {
+		m_jmDNS.unregisterAllServices();
+	}
+
+	/**
+	 * @see org.apache.felix.sandbox.mdns.MDnsService#registerServiceType(java.lang.String)
+	 */
+	public void registerServiceType(String type) {
+		m_jmDNS.registerServiceType(type);
+	}
+
+	public ServiceInfo[] list(String type, String filterstr) throws InvalidSyntaxException {
+		Filter filter=m_bundleContext.createFilter(filterstr);
+		ServiceInfo[] serviceInfos=list(type);
+		List results=new ArrayList();
+		for(int i=0;i<serviceInfos.length;i++) {
+			if(filter.match(new ServiceInfoWrapper(serviceInfos[i]))) {
+				results.add(serviceInfos[i]);
+			}
+		}
+		int s=results.size();
+		return s==0 ? null : (ServiceInfo[])results.toArray(new ServiceInfo[s]);
+	}
+	
+	class ServiceInfoWrapper extends Dictionary {
+
+		private ServiceInfo serviceInfo;
+
+		ServiceInfoWrapper(ServiceInfo serviceInfo){
+			this.serviceInfo=serviceInfo;
+		}
+		
+		public int size() {
+			int cpt=0;
+			Enumeration enumeration=serviceInfo.getPropertyNames();
+			while(enumeration.hasMoreElements()){
+				cpt++; enumeration.nextElement();
+			}
+			return cpt;
+		}
+
+		public boolean isEmpty() {
+			return !serviceInfo.getPropertyNames().hasMoreElements();
+		}
+
+		public Enumeration keys() {
+			return serviceInfo.getPropertyNames();
+		}
+
+		public Enumeration elements() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public Object get(Object key) {
+			return serviceInfo.getPropertyString((String)key);
+		}
+
+		public Object put(Object arg0, Object arg1) {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public Object remove(Object key) {
+			// TODO Auto-generated method stub
+			return null;
+		}		
+	}
+	
+}
+

Propchange: felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/impl/MDnsServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/impl/ServiceInfoImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/impl/ServiceInfoImpl.java?rev=567865&view=auto
==============================================================================
--- felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/impl/ServiceInfoImpl.java (added)
+++ felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/impl/ServiceInfoImpl.java Mon Aug 20 15:39:04 2007
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.sandbox.mdns.impl;
+
+import java.net.InetAddress;
+import java.util.Enumeration;
+
+import javax.jmdns.ServiceInfo;
+
+
+/**
+ * This class wraps the javax.jmdns.ServiceInfo class
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class ServiceInfoImpl implements org.apache.felix.sandbox.mdns.ServiceInfo {
+
+	private ServiceInfo serviceInfo;
+
+	public ServiceInfoImpl(ServiceInfo serviceInfo){
+		this.serviceInfo=serviceInfo;
+	}
+	
+	public String getType() {
+		return serviceInfo.getType();
+	}
+
+	public String getName() {
+		return serviceInfo.getName();
+	}
+
+	public String getQualifiedName() {
+		return serviceInfo.getQualifiedName();
+	}
+
+	public String getServer() {
+		return serviceInfo.getServer();
+	}
+
+	public String getHostAddress() {
+		return serviceInfo.getHostAddress();
+	}
+
+	public InetAddress getAddress() {
+		return serviceInfo.getAddress();
+	}
+
+	public InetAddress getInetAddress() {
+		return serviceInfo.getInetAddress();
+	}
+
+	public int getPort() {
+		return serviceInfo.getPort();
+	}
+
+	public int getPriority() {
+		return serviceInfo.getPriority();
+	}
+
+	public int getWeight() {
+		return serviceInfo.getWeight();
+	}
+
+	public byte[] getTextBytes() {
+		return serviceInfo.getTextBytes();
+	}
+
+	public String getTextString() {
+		return serviceInfo.getTextString();
+	}
+
+	public String getURL() {
+		return serviceInfo.getURL();
+	}
+
+	public String getURL(String protocol) {
+		return serviceInfo.getURL(protocol);
+	}
+
+	public byte[] getPropertyBytes(String name) {
+		return serviceInfo.getPropertyBytes(name);
+	}
+
+	public String getPropertyString(String name) {
+		return serviceInfo.getPropertyString(name);
+	}
+
+	public Enumeration getPropertyNames() {
+		return serviceInfo.getPropertyNames();
+	}
+}

Propchange: felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/impl/ServiceInfoImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/impl/ServiceTypeListFeeder.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/impl/ServiceTypeListFeeder.java?rev=567865&view=auto
==============================================================================
--- felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/impl/ServiceTypeListFeeder.java (added)
+++ felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/impl/ServiceTypeListFeeder.java Mon Aug 20 15:39:04 2007
@@ -0,0 +1,22 @@
+package org.apache.felix.sandbox.mdns.impl;
+
+import java.util.Set;
+
+import javax.jmdns.ServiceEvent;
+import javax.jmdns.ServiceTypeListener;
+
+public class ServiceTypeListFeeder implements ServiceTypeListener {
+		
+		private Set types;
+		
+		ServiceTypeListFeeder(Set types){
+			this.types=types;
+		}
+		
+		/**
+		 * @see javax.jmdns.ServiceTypeListener#serviceTypeAdded(javax.jmdns.ServiceEvent)
+		 */
+		public void serviceTypeAdded(ServiceEvent serviceEvent) {
+			types.add(serviceEvent.getType());
+		}
+}

Propchange: felix/sandbox/donsez/mdns/src/main/java/org/apache/felix/sandbox/mdns/impl/ServiceTypeListFeeder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/mdns/src/site/index.html
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/mdns/src/site/index.html?rev=567865&view=auto
==============================================================================
--- felix/sandbox/donsez/mdns/src/site/index.html (added)
+++ felix/sandbox/donsez/mdns/src/site/index.html Mon Aug 20 15:39:04 2007
@@ -0,0 +1,150 @@
+<html>
+<head>
+<title>JmDNS</title>
+</head>
+<body>
+
+<!-- Start of Felix Bundle Documentation -->
+<hr width="100%" size="2">
+<h1><i><a name="mdns"></a><font color="#0000aa">JmDNS</font></i></h1>
+
+<p>
+<b>Description</b><br>
+This bundle provides a service and a shell command to publish and retrieve references with mDNS.
+<br>For more details on how to use this bundle, refer to the /doc/readme.html file embedded in the bundle jarfile.<br>
+</p>
+
+<p>
+<b>Contributors</b><br>
+<a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+<br>
+</p>
+
+<p>
+<b>License</b><br>
+<a href="http://www.apache.org/licenses/LICENSE-2.0.html">ASL2</a><br>
+</p>
+
+<p>
+<b>Services</b><br>
+<ul>
+	<li>org.apache.felix.sandbox.mdns.MDnsService</li>
+	<li>org.apache.felix.shell.Command</li>
+</ul>
+</p>
+
+<p>
+<b>Properties</b><br>
+The bundle property <code>mdns.debug</code> is the debug level of the JmDns registry.
+(default : 0)
+</p>
+
+<p><b>Requirements</b><br>
+<ul>
+None
+</ul>
+</p>
+
+<!-- End of Felix Bundle Documentation -->
+
+<hr width="100%" size="2">
+
+<!-- Start of extra information  -->
+
+<p>
+<b>Build</b><br>
+<ol>
+<li>build with Maven : <code>mvn clean install</code></li>
+</ol>
+</p>
+
+<p>
+<b>Usage</b><br>
+run commands in this script <a href='dnssd.txt'>dnssd.txt</a>
+
+Options of the <code>mdns</code> command are:
+<pre>
+mdns help       - Show this help message.
+mdns types       - list the service types.
+mdns services &lt;type&gt; - list the services.
+mdns info       - mDNS information.
+mdns register &lt;type&gt; &lt;name&gt; &lt;port&gt; &lt;text&gt;    - register a service.
+mdns register &lt;type&gt; &lt;name&gt; &lt;port&gt; &lt;priority&gt; &lt;weight&gt; &lt;key=value;key=value;...&gt; - register a service.
+mdns unregister all  - register all the services.
+mdns browser    - open a gui browser (DISABLED since the mdns:mdns:1.0 must be patched).	
+</pre>
+</p>
+
+<p>
+<b>Usage</b><br>
+<ul>
+		<li>register web pages served by the Http Service Impl</li>
+		<li>register JMX service url served by the connectors and adapters of a OSGi-based JMX agent such as M-OSGi</li>
+		<li>expose OSGi service with remoting connector (SOAP, RMI, XML-RPC, ...)</li>
+</ul>
+</p>
+
+<p>
+<b>Screnshoots</b><br>
+
+<center>
+	<img src='screenshot/mdnsbrowser.png' alt='JmDNS Browser'>	
+</center>
+
+<center>
+	<img src='screenshot/bonjourie.png' alt='Apple Bonjour in MS IE'>	
+</center>
+
+<center>
+	<img src='screenshot/dnssd-axis1.png' alt='JmDNS Browser with a Axis Ethernet WebCam'>	
+</center>
+
+<center>
+	<img src='screenshot/dnssd-axis2.png' alt='JmDNS Browser with a Axis Ethernet WebCam'>	
+</center>
+
+<center>
+	<img src='screenshot/ie-axis.png' alt='Bonjour IE with a Axis Ethernet WebCam'>	
+</center>
+
+<center>
+	<img src='screenshot/dnssd-jmx.png' alt='JmDNS Browser with a Jmx RMI Connector'>	
+</center>
+
+<center>
+	<img src='screenshot/ie-jmx.png' alt='Bonjour IE with a JMX HTTP/HTML Adaptor'>	
+</center>
+
+</p>
+
+
+<p>
+<b>Tested gateways (testers are welcome)</b><br>
+<ul>
+<li>Oscar under Windows 2000/XP</li>
+<li>Felix under Windows 2000/XP and Linux</li>
+</ul>
+</p>
+
+<p>
+<b>TODOLIST (contributions are welcome)</b><br>
+<ul>
+<li>fix problem with WiFi interface</li>
+<li>browse similar to http://developer.apple.com/documentation/Java/Reference/DNSServiceDiscovery_JavaRef/index.html</li>
+</ul>
+</p>
+
+<p>
+<b>Links</b>
+<ul>
+<li>Karl Pauls and Richard S. Hall, <i>Eureka - A Resource Discovery Service for
+Component Deployment</i>, <a href="http://www.inf.fu-berlin.de/inst/ag-ss/papers/eureka_cd_20040520.sxw.pdf">http://www.inf.fu-berlin.de/inst/ag-ss/papers/eureka_cd_20040520.sxw.pdf</a></li>
+<li>Fen Zhu; Mutka, M.W.; Ni, L.M., <i>Service Discovery in Pervasive Computing Environments</i>
+IEEE Pervasive Computing, Volume 4, Issue 4, Oct.-Dec. 2005 Page(s): 81 - 90, Digital Object Identifier   10.1109/MPRV.2005.87
+<br>Summary: Pervasive computing environments pose unique service discovery challenges, especially with regard to integrating computing devices with people and their ambient environments. Extremely dynamic environments and computing resources and security issues...
+</li>
+</ul>
+</p>
+	
+</body>
+</html>

Propchange: felix/sandbox/donsez/mdns/src/site/index.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/mdns/src/site/mdns.txt
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/mdns/src/site/mdns.txt?rev=567865&view=auto
==============================================================================
--- felix/sandbox/donsez/mdns/src/site/mdns.txt (added)
+++ felix/sandbox/donsez/mdns/src/site/mdns.txt Mon Aug 20 15:39:04 2007
@@ -0,0 +1,54 @@
+rem This script illustrates the JmDNS bundle
+rem DNS-SD or mDNS or Apple' RendezVous/Bonjour is the same service location protocol based on DNS for adhoc networks 
+rem (c) Apache Felix Team, 2007
+
+start file:C:\Docume~1\Donsez\.m2\repository\org\apache\felix\org.apache.felix.sandbox.urlhandler.maven\0.1.0-SNAPSHOT\org.apache.felix.sandbox.urlhandler.maven-0.1.0-SNAPSHOT.jar
+
+rem Browse with a Apple'Bonjour browser (the IE plugin for instance)
+
+services
+
+start mvn:org.apache.felix:org.apache.felix.sandbox.mdns
+
+start mvn:org.apache.felix:org.osgi.core
+start mvn:org.apache.felix:javax.servlet
+start mvn:org.apache.felix:org.osgi.compendium
+start mvn:org.apache.felix:org.apache.felix.eventadmin
+start mvn:org.apache.felix:org.apache.felix.eventadmin.cmd
+eventadmin subscribe mdns/*
+
+
+mdns types
+mdns services _http._tcp.local.
+mdns register _http._tcp.local. GatewayAdminOn80 80 0 0 path=/admin;tic=tac;foo=bar
+mdns register _http._tcp.local. GatewayAdminOn8080 8080 0 0 path=/admin;tic=tac;foo=bar
+mdns register _http._tcp.local. Google(by_redirection) 8080 0 0 path=/redirect?url=http://www.google.com
+mdns services _http._tcp.local.
+mdns types
+mdns info
+# mdns browser
+mdns types
+
+rem for Use DNS-SD with the Apache Felix M-OSGi
+mdns register _http._tcp.local. HTMLJMXAdaptorOn8000 8000 0 0 path=/
+mdns services _http._tcp.local.
+rem locate connectors by DNS-SD
+mdns register _jmx._tcp.local. JMXConnectorOn1999 1999 0 0 servicejmx=rmi:///jndi/rmi://;path=/server
+mdns register _jmx._tcp.local. JMXConnectorOn9999 9999 0 0 servicejmx=rmi:///jndi/rmi://;path=/server
+mdns register _jmx._tcp.local. JMXConnectorOn7777 7777 0 0 servicejmx=rmi:///jndi/iiop://;path=/server
+mdns types
+mdns services _jmx._tcp.local.
+
+start mvn:org.apache.felix:javax.servlet
+start mvn:org.apache.felix:org.apache.felix.http.jetty
+start mvn:org.apache.felix:org.apache.felix.http.webadmin
+
+rem browser the http://localhost:80/admin
+
+rem for JOnAS JEE cluster instance discovery
+mdns register _http._tcp.local. JOnASAdmin 9000 0 0 path=/jonasAdmin
+
+rem in replacement of JOnAS discovery service
+rem service:jmx:rmi:///jndi/rmi://host:1099/jrmpconnector_jonas
+mdns register _jmx._tcp.local. JOnASJMXConnectorOn1099 1099 0 0 servicejmx=rmi:///jndi/rmi://;path=/jrmpconnector_jonas
+mdns register _jonas._tcp.local. JOnASJMXConnectorOn1099 1099 0 0 servicejmx=rmi:///jndi/rmi://;path=/jrmpconnector_jonas

Propchange: felix/sandbox/donsez/mdns/src/site/mdns.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/mdns/src/site/screenshot/Thumbs.db
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/mdns/src/site/screenshot/Thumbs.db?rev=567865&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/donsez/mdns/src/site/screenshot/Thumbs.db
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: felix/sandbox/donsez/mdns/src/site/screenshot/bonjourie.png
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/mdns/src/site/screenshot/bonjourie.png?rev=567865&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/donsez/mdns/src/site/screenshot/bonjourie.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: felix/sandbox/donsez/mdns/src/site/screenshot/dnssd-axis1.png
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/mdns/src/site/screenshot/dnssd-axis1.png?rev=567865&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/donsez/mdns/src/site/screenshot/dnssd-axis1.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: felix/sandbox/donsez/mdns/src/site/screenshot/dnssd-axis2.png
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/mdns/src/site/screenshot/dnssd-axis2.png?rev=567865&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/donsez/mdns/src/site/screenshot/dnssd-axis2.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: felix/sandbox/donsez/mdns/src/site/screenshot/dnssd-jmx.png
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/mdns/src/site/screenshot/dnssd-jmx.png?rev=567865&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/donsez/mdns/src/site/screenshot/dnssd-jmx.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: felix/sandbox/donsez/mdns/src/site/screenshot/ie-axis.png
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/mdns/src/site/screenshot/ie-axis.png?rev=567865&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/donsez/mdns/src/site/screenshot/ie-axis.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: felix/sandbox/donsez/mdns/src/site/screenshot/ie-jmx.png
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/mdns/src/site/screenshot/ie-jmx.png?rev=567865&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/donsez/mdns/src/site/screenshot/ie-jmx.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: felix/sandbox/donsez/mdns/src/site/screenshot/jmdnsbrowser.png
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/mdns/src/site/screenshot/jmdnsbrowser.png?rev=567865&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/donsez/mdns/src/site/screenshot/jmdnsbrowser.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: felix/sandbox/donsez/mdns/src/site/screenshot/jmdnsbrowser2.png
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/mdns/src/site/screenshot/jmdnsbrowser2.png?rev=567865&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/donsez/mdns/src/site/screenshot/jmdnsbrowser2.png
------------------------------------------------------------------------------
    svn:mime-type = image/png



Mime
View raw message