diff --git a/discovery/org.eclipse.tm.discovery.engine/.classpath b/discovery/org.eclipse.tm.discovery.engine/.classpath
new file mode 100644
index 00000000000..cb28e3a63a2
--- /dev/null
+++ b/discovery/org.eclipse.tm.discovery.engine/.classpath
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/discovery/org.eclipse.tm.discovery.engine/.options b/discovery/org.eclipse.tm.discovery.engine/.options
new file mode 100644
index 00000000000..8b137891791
--- /dev/null
+++ b/discovery/org.eclipse.tm.discovery.engine/.options
@@ -0,0 +1 @@
+
diff --git a/discovery/org.eclipse.tm.discovery.engine/.project b/discovery/org.eclipse.tm.discovery.engine/.project
new file mode 100644
index 00000000000..45895d5a6e5
--- /dev/null
+++ b/discovery/org.eclipse.tm.discovery.engine/.project
@@ -0,0 +1,28 @@
+
+
+ org.eclipse.tm.discovery.engine
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.pde.ManifestBuilder
+
+
+
+
+ org.eclipse.pde.SchemaBuilder
+
+
+
+
+
+ org.eclipse.pde.PluginNature
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/discovery/org.eclipse.tm.discovery.engine/.settings/org.eclipse.core.resources.prefs b/discovery/org.eclipse.tm.discovery.engine/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 00000000000..a7aa88b0b6d
--- /dev/null
+++ b/discovery/org.eclipse.tm.discovery.engine/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,4 @@
+#Wed Jul 19 12:48:55 BST 2006
+eclipse.preferences.version=1
+encoding//src/org/eclipse/tm/discovery/engine/messages.properties=8859_1
+encoding//src/org/eclipse/tm/discovery/protocol/messages.properties=8859_1
diff --git a/discovery/org.eclipse.tm.discovery.engine/.settings/org.eclipse.jdt.core.prefs b/discovery/org.eclipse.tm.discovery.engine/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..e53962615bb
--- /dev/null
+++ b/discovery/org.eclipse.tm.discovery.engine/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,24 @@
+#Thu Jul 27 13:28:01 BST 2006
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=ignore
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=disabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
+org.eclipse.jdt.core.compiler.source=1.3
diff --git a/discovery/org.eclipse.tm.discovery.engine/.settings/org.eclipse.jdt.ui.prefs b/discovery/org.eclipse.tm.discovery.engine/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 00000000000..56c39c94603
--- /dev/null
+++ b/discovery/org.eclipse.tm.discovery.engine/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,4 @@
+#Thu Jul 27 13:27:17 BST 2006
+eclipse.preferences.version=1
+internal.default.compliance=default
+org.eclipse.jdt.ui.text.custom_code_templates=/**\r\n * @return the ${bare_field_name}\r\n *//**\r\n * @param ${param} the ${bare_field_name} to set\r\n *//**\r\n * ${tags}\r\n *//**\r\n * \r\n *//**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n *//**\r\n * \r\n *//**\r\n * ${tags}\r\n *//* (non-Javadoc)\r\n * ${see_to_overridden}\r\n *//**\r\n * ${tags}\r\n * ${see_to_target}\r\n */${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}\r\n\r\n\r\n\r\n// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();// ${todo} Auto-generated method stub\r\n${body_statement}${body_statement}\r\n// ${todo} Auto-generated constructor stubreturn ${field};${field} \= ${param};
diff --git a/discovery/org.eclipse.tm.discovery.engine/META-INF/MANIFEST.MF b/discovery/org.eclipse.tm.discovery.engine/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..1b91165ac1a
--- /dev/null
+++ b/discovery/org.eclipse.tm.discovery.engine/META-INF/MANIFEST.MF
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Service Discovery Engine Plug-in
+Bundle-SymbolicName: org.eclipse.tm.discovery.engine;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Activator: org.eclipse.tm.discovery.engine.Activator
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.emf.ecore.xmi,
+ org.eclipse.tm.discovery.model
+Eclipse-LazyStart: true
+Export-Package: org.eclipse.tm.discovery.engine,
+ org.eclipse.tm.discovery.protocol,
+ org.eclipse.tm.discovery.transport
+Import-Package: org.eclipse.tm.discovery.model,
+ org.eclipse.tm.discovery.model.util
+Bundle-Vendor: Symbian
diff --git a/discovery/org.eclipse.tm.discovery.engine/about.html b/discovery/org.eclipse.tm.discovery.engine/about.html
new file mode 100644
index 00000000000..928af38d499
--- /dev/null
+++ b/discovery/org.eclipse.tm.discovery.engine/about.html
@@ -0,0 +1,29 @@
+
+
About
+
+
+
+
+About This Content
+
+July 27, 2006
+License
+
+The Eclipse Foundation makes available all content in this plug-in
+("Content"). Unless otherwise indicated below, the Content is provided
+to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is
+available at http://www.eclipse.org/legal/epl-v10.html.
+For purposes of the EPL, "Program" will mean the Content.
+
+If you did not receive this Content directly from the Eclipse
+Foundation, the Content is being redistributed by another party
+("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the
+Redistributor's license that was provided with the Content. If no such
+license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any
+source code in the Content and such source code may be obtained at http://www.eclipse.org.
+
+
+
\ No newline at end of file
diff --git a/discovery/org.eclipse.tm.discovery.engine/build.properties b/discovery/org.eclipse.tm.discovery.engine/build.properties
new file mode 100644
index 00000000000..101ae799c1e
--- /dev/null
+++ b/discovery/org.eclipse.tm.discovery.engine/build.properties
@@ -0,0 +1,7 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html,\
+ plugin.xml
+src.includes = about.html
diff --git a/discovery/org.eclipse.tm.discovery.engine/plugin.xml b/discovery/org.eclipse.tm.discovery.engine/plugin.xml
new file mode 100644
index 00000000000..c8e743e725a
--- /dev/null
+++ b/discovery/org.eclipse.tm.discovery.engine/plugin.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/discovery/org.eclipse.tm.discovery.engine/schema/discoveryProtocol.exsd b/discovery/org.eclipse.tm.discovery.engine/schema/discoveryProtocol.exsd
new file mode 100644
index 00000000000..280e145e140
--- /dev/null
+++ b/discovery/org.eclipse.tm.discovery.engine/schema/discoveryProtocol.exsd
@@ -0,0 +1,118 @@
+
+
+
+
+
+
+
+
+ Extension point providing implementations of protocols for service discovery.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ [Enter the first release in which this extension point appears.]
+
+
+
+
+
+
+
+
+ [Enter extension point usage example here.]
+
+
+
+
+
+
+
+
+ [Enter API information here.]
+
+
+
+
+
+
+
+
+ [Enter information about supplied implementation of this extension point.]
+
+
+
+
+
+
+
+
+ Copyright (c) 2006 Symbian Software Ltd. 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:
+ Javier Montalvo Orús (Symbian) - initial API and implementation
+
+
+
+
diff --git a/discovery/org.eclipse.tm.discovery.engine/schema/discoveryTransport.exsd b/discovery/org.eclipse.tm.discovery.engine/schema/discoveryTransport.exsd
new file mode 100644
index 00000000000..3e1fb35ec51
--- /dev/null
+++ b/discovery/org.eclipse.tm.discovery.engine/schema/discoveryTransport.exsd
@@ -0,0 +1,118 @@
+
+
+
+
+
+
+
+
+ Extension point providing implementations of transports for service discovery.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ [Enter the first release in which this extension point appears.]
+
+
+
+
+
+
+
+
+ [Enter extension point usage example here.]
+
+
+
+
+
+
+
+
+ [Enter API information here.]
+
+
+
+
+
+
+
+
+ [Enter information about supplied implementation of this extension point.]
+
+
+
+
+
+
+
+
+ Copyright (c) 2006 Symbian Software Ltd. 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:
+ Javier Montalvo Orús (Symbian) - initial API and implementation
+
+
+
+
diff --git a/discovery/org.eclipse.tm.discovery.engine/src/org/eclipse/tm/discovery/engine/Activator.java b/discovery/org.eclipse.tm.discovery.engine/src/org/eclipse/tm/discovery/engine/Activator.java
new file mode 100644
index 00000000000..fc51024f530
--- /dev/null
+++ b/discovery/org.eclipse.tm.discovery.engine/src/org/eclipse/tm/discovery/engine/Activator.java
@@ -0,0 +1,60 @@
+/********************************************************************************
+ * Copyright (c) 2006 Symbian Software Ltd. 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:
+ * Javier Montalvo Orús (Symbian) - initial API and implementation
+ ********************************************************************************/
+
+package org.eclipse.tm.discovery.engine;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.rse.discovery.engine";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/discovery/org.eclipse.tm.discovery.engine/src/org/eclipse/tm/discovery/engine/Messages.java b/discovery/org.eclipse.tm.discovery.engine/src/org/eclipse/tm/discovery/engine/Messages.java
new file mode 100644
index 00000000000..f6ab2d83bbe
--- /dev/null
+++ b/discovery/org.eclipse.tm.discovery.engine/src/org/eclipse/tm/discovery/engine/Messages.java
@@ -0,0 +1,32 @@
+/********************************************************************************
+ * Copyright (c) 2006 Symbian Software Ltd. 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:
+ * Javier Montalvo Orús (Symbian) - initial API and implementation
+ ********************************************************************************/
+
+package org.eclipse.tm.discovery.engine;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class Messages {
+ private static final String BUNDLE_NAME = "org.eclipse.tm.discovery.engine.messages"; //$NON-NLS-1$
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+ .getBundle(BUNDLE_NAME);
+
+ private Messages() {
+ }
+
+ public static String getString(String key) {
+ try {
+ return RESOURCE_BUNDLE.getString(key);
+ } catch (MissingResourceException e) {
+ return '!' + key + '!';
+ }
+ }
+}
diff --git a/discovery/org.eclipse.tm.discovery.engine/src/org/eclipse/tm/discovery/engine/ServiceDiscoveryEngine.java b/discovery/org.eclipse.tm.discovery.engine/src/org/eclipse/tm/discovery/engine/ServiceDiscoveryEngine.java
new file mode 100644
index 00000000000..734de123a76
--- /dev/null
+++ b/discovery/org.eclipse.tm.discovery.engine/src/org/eclipse/tm/discovery/engine/ServiceDiscoveryEngine.java
@@ -0,0 +1,99 @@
+/********************************************************************************
+ * Copyright (c) 2006 Symbian Software Ltd. 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:
+ * Javier Montalvo Orús (Symbian) - initial API and implementation
+ ********************************************************************************/
+
+package org.eclipse.tm.discovery.engine;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.common.util.WrappedException;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.tm.discovery.model.ModelPackage;
+import org.eclipse.tm.discovery.model.util.ModelResourceFactoryImpl;
+import org.eclipse.tm.discovery.protocol.IProtocol;
+import org.eclipse.tm.discovery.transport.ITransport;
+
+/**
+ * Engine for service discovery.
+ * Instantiates the model that contains the discovered services information.
+ * Provides methods to launch a discovery job given an implementation of ITransport and IProtocol to populate the model.
+ *
+ * @see ITransport
+ * @see IProtocol
+ *
+ */
+
+public class ServiceDiscoveryEngine {
+
+ private static ServiceDiscoveryEngine SERVICE_DISCOVERY_ENGINE = null;
+
+ private final URI SERVICE_DISCOVERY_URI = URI.createFileURI(Messages.getString("ServiceDiscoveryEngine.DiscoveryModelFileURI")); //$NON-NLS-1$
+
+ private Resource resource;
+
+ /**
+ * Gets an instance of the service discovery engine
+ */
+ public static ServiceDiscoveryEngine getServiceDiscoveryEngine() {
+ if (SERVICE_DISCOVERY_ENGINE == null)
+ SERVICE_DISCOVERY_ENGINE = new ServiceDiscoveryEngine();
+
+ return SERVICE_DISCOVERY_ENGINE;
+ }
+
+ /*
+ * Private constructor of the ServiceDiscoveryEngine
+ */
+ private ServiceDiscoveryEngine() {
+
+ // get model
+ ResourceSet resourceSet = new ResourceSetImpl();
+
+ // Register the appropriate resource factory to handle all file
+ // extentions.
+ resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION, new ModelResourceFactoryImpl());
+
+ // Register the package to ensure it is available during loading.
+ resourceSet.getPackageRegistry().put(ModelPackage.eNS_URI,ModelPackage.eINSTANCE);
+
+ try {
+ resource = resourceSet.getResource(SERVICE_DISCOVERY_URI, true);
+ } catch (WrappedException e) {
+ resource = resourceSet.createResource(SERVICE_DISCOVERY_URI);
+ }
+ }
+
+ /**
+ * Gets the resource
+ *
+ * @return the static reference to the resource model
+ */
+
+ public Resource getResource() {
+ return resource;
+ }
+
+ /**
+ * Starts a service discovery job given an implementation of IProtocol and ITransport
+ *
+ * @param transport
+ * the selected transport
+ * @see ITransport
+ * @see IProtocol
+ */
+
+ public void doServiceDiscovery(String query, IProtocol protocol, ITransport transport)
+ {
+ protocol.getDiscoveryJob(query, resource,transport).schedule();
+ }
+
+
+
+}
diff --git a/discovery/org.eclipse.tm.discovery.engine/src/org/eclipse/tm/discovery/engine/messages.properties b/discovery/org.eclipse.tm.discovery.engine/src/org/eclipse/tm/discovery/engine/messages.properties
new file mode 100644
index 00000000000..380ab6187ab
--- /dev/null
+++ b/discovery/org.eclipse.tm.discovery.engine/src/org/eclipse/tm/discovery/engine/messages.properties
@@ -0,0 +1,11 @@
+##################################################################################
+# Copyright (c) 2006 Symbian Software Ltd. 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:
+# Javier Montalvo Orús (Symbian) - initial API and implementation
+##################################################################################
+
+ServiceDiscoveryEngine.DiscoveryModelFileURI=discoveryModel.xml
diff --git a/discovery/org.eclipse.tm.discovery.engine/src/org/eclipse/tm/discovery/protocol/IProtocol.java b/discovery/org.eclipse.tm.discovery.engine/src/org/eclipse/tm/discovery/protocol/IProtocol.java
new file mode 100644
index 00000000000..1d3da4cb8fa
--- /dev/null
+++ b/discovery/org.eclipse.tm.discovery.engine/src/org/eclipse/tm/discovery/protocol/IProtocol.java
@@ -0,0 +1,62 @@
+/********************************************************************************
+ * Copyright (c) 2006 Symbian Software Ltd. 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:
+ * Javier Montalvo Orús (Symbian) - initial API and implementation
+ ********************************************************************************/
+
+package org.eclipse.tm.discovery.protocol;
+
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.tm.discovery.transport.ITransport;
+
+/**
+ * Interface for service discovery protocol implementations.
+ * Standard protocols that can be implementated from this interface are:
+ *
+ * - DNS-SD (Zeroconf)
+ *
- Simple Service Discovery Protocol (SSDP)
+ *
- Service Location Protocol (SPL)
+ *
+ * As well as propietary/customised protocols
+ *
+ */
+public interface IProtocol {
+
+
+ /**
+ * Instantiates a Job to populate a model given an initial query, a resource containing the model to be populated and an ITranport implementation.
+ *
+ * @param query
+ * Initial query to be sent to the target. This initial query can be obtained from the getQueries() method.
+ *
+ * @param resource
+ * Resource containing the model to be populated with the results of the service discovery action.
+ *
+ * @param transport
+ * ITransport implementation of the transport to be used for the discovery action.
+ *
+ * @return
+ * Job containing the service discovery action.
+ *
+ * @see Job
+ * @see Resource
+ * @see ITransport
+ *
+ */
+ public abstract Job getDiscoveryJob(String query, Resource resource, ITransport transport);
+
+
+ /**
+ * Gets the list of recommended queries to start the service discovery process. This queries can be used in getDiscoveryJob().
+ *
+ * @return
+ * An array containing the recommended queries.
+ */
+ public abstract String[] getQueries();
+
+}
diff --git a/discovery/org.eclipse.tm.discovery.engine/src/org/eclipse/tm/discovery/protocol/ProtocolFactory.java b/discovery/org.eclipse.tm.discovery.engine/src/org/eclipse/tm/discovery/protocol/ProtocolFactory.java
new file mode 100644
index 00000000000..cc46e1cb919
--- /dev/null
+++ b/discovery/org.eclipse.tm.discovery.engine/src/org/eclipse/tm/discovery/protocol/ProtocolFactory.java
@@ -0,0 +1,114 @@
+/********************************************************************************
+ * Copyright (c) 2006 Symbian Software Ltd. 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:
+ * Javier Montalvo Orús (Symbian) - initial API and implementation
+ ********************************************************************************/
+
+package org.eclipse.tm.discovery.protocol;
+
+import java.util.Vector;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.Platform;
+
+/**
+ * Static factory to handle the protocol implementations.
+ */
+
+public class ProtocolFactory {
+
+
+ /*
+ * Extension point containing the protocol implementations available in the workbench
+ */
+ private static IExtensionPoint ep = Platform.getExtensionRegistry().getExtensionPoint("org.eclipse.tm.discovery.engine","discoveryProtocol"); //$NON-NLS-1$ //$NON-NLS-2$
+
+
+ /**
+ * Returns the available protocol names. This protocol names are registered in the field name of the extension point discoveryProtocol
+ *
+ * @return
+ * Array of available protocol names
+ */
+ public static String[] getProtocolList()
+ {
+ Vector protocols = new Vector();
+
+ IConfigurationElement[] ce = ep.getConfigurationElements();
+ for (int i = 0; i < ce.length; i++) {
+ String name = ce[i].getAttribute("name"); //$NON-NLS-1$
+ if(name!=null)
+ protocols.add(name);
+ }
+
+ String[] protocolsList = new String[protocols.size()];
+ protocols.copyInto(protocolsList);
+ return protocolsList;
+ }
+
+ /**
+ * Returns the recommended queries for the specified protocol
+ *
+ * @param protocolName
+ * Name of the protocol
+ * @return
+ * Array of recommended queries to be send using this protocol.
+ * @throws CoreException
+ */
+ public static String[] getQueryList(String protocolName) throws CoreException
+ {
+ IProtocol protocol = null;
+
+ IConfigurationElement[] ce = ep.getConfigurationElements();
+ for (int i = 0; i < ce.length; i++) {
+ String name = ce[i].getAttribute("name"); //$NON-NLS-1$
+ if(name!=null)
+ if(name.equalsIgnoreCase(protocolName))
+ {
+ protocol = (IProtocol)ce[i].createExecutableExtension("class"); //$NON-NLS-1$
+ }
+ }
+
+ String[] queries = protocol.getQueries();
+
+ if(queries==null)
+ queries = new String[]{};
+
+ return queries;
+
+ }
+
+ /**
+ * Gets the IProtocol implementation of a protocol given its name
+ *
+ * @param protocolName
+ * Name of the protocolo
+ * @return
+ * IProtocol implementation of the protocol matching the given name. Null if the protocol cannot be found.
+ * @throws CoreException
+ *
+ * @see IProtocol
+ */
+ public static IProtocol getProtocol(String protocolName) throws CoreException {
+
+ IProtocol protocol = null;
+
+ IConfigurationElement[] ce = ep.getConfigurationElements();
+ for (int i = 0; i < ce.length; i++) {
+ String name = ce[i].getAttribute("name"); //$NON-NLS-1$
+ if(name!=null)
+ if(name.equalsIgnoreCase(protocolName))
+ {
+ protocol = (IProtocol)ce[i].createExecutableExtension("class"); //$NON-NLS-1$
+ }
+ }
+ return protocol;
+ }
+
+}
diff --git a/discovery/org.eclipse.tm.discovery.engine/src/org/eclipse/tm/discovery/transport/ITransport.java b/discovery/org.eclipse.tm.discovery.engine/src/org/eclipse/tm/discovery/transport/ITransport.java
new file mode 100644
index 00000000000..15b422a922d
--- /dev/null
+++ b/discovery/org.eclipse.tm.discovery.engine/src/org/eclipse/tm/discovery/transport/ITransport.java
@@ -0,0 +1,60 @@
+/********************************************************************************
+ * Copyright (c) 2006 Symbian Software Ltd. 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:
+ * Javier Montalvo Orús (Symbian) - initial API and implementation
+ ********************************************************************************/
+
+package org.eclipse.tm.discovery.transport;
+
+import java.io.IOException;
+
+/**
+ * Interface for service discovery transports
+ *
+ */
+public interface ITransport {
+
+ /**
+ * Handles sending data
+ *
+ * @param data
+ * Data packet to be sent.
+ * @throws IOException
+ */
+ public abstract void send(byte[] packet) throws Exception;
+
+ /**
+ * Handles receiving data
+ *
+ * @param packet
+ * Packet to be filled with the reply data.
+ * @return
+ * Address of the replying device.
+ * @throws IOException
+ */
+ public abstract String receive(byte[] packet) throws Exception;
+
+
+ /**
+ * Sets the address of the target, depending on the implementation (IP, port...)
+ * @param address
+ * Address or identifier of the target.
+ * @throws Exception
+ *
+ */
+ public abstract void setTargetAddress(String address) throws Exception;
+
+ /**
+ * Sets the timeout for the transport implementation.
+ * @param timeOut
+ * The timeout in milliseconds
+ * @throws Exception
+ */
+ public abstract void setTimeOut(int timeOut) throws Exception;
+
+
+}
diff --git a/discovery/org.eclipse.tm.discovery.engine/src/org/eclipse/tm/discovery/transport/TransportFactory.java b/discovery/org.eclipse.tm.discovery.engine/src/org/eclipse/tm/discovery/transport/TransportFactory.java
new file mode 100644
index 00000000000..48ee0bda702
--- /dev/null
+++ b/discovery/org.eclipse.tm.discovery.engine/src/org/eclipse/tm/discovery/transport/TransportFactory.java
@@ -0,0 +1,85 @@
+/********************************************************************************
+ * Copyright (c) 2006 Symbian Software Ltd. 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:
+ * Javier Montalvo Orús (Symbian) - initial API and implementation
+ ********************************************************************************/
+
+package org.eclipse.tm.discovery.transport;
+
+import java.util.Vector;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.Platform;
+
+/**
+ * Factory for the remoste system connection.
+ */
+
+public class TransportFactory {
+
+ /*
+ * Extension point containing the transport implementations available in the workbench
+ */
+ private static IExtensionPoint ep = Platform.getExtensionRegistry().getExtensionPoint("org.eclipse.tm.discovery.engine","discoveryTransport"); //$NON-NLS-1$ //$NON-NLS-2$
+
+
+ /**
+ * Returns the available transport names. The transport names are registered in the field name of the extension point discoveryTransport
+ *
+ * @return
+ * Array of available transport names
+ */
+ public static String[] getTransportList()
+ {
+ Vector transports = new Vector();
+
+ IConfigurationElement[] ce = ep.getConfigurationElements();
+ for (int i = 0; i < ce.length; i++) {
+ String name = ce[i].getAttribute("name"); //$NON-NLS-1$
+ if(name!=null)
+ transports.add(name);
+ }
+
+ String[] transportsList = new String[transports.size()];
+ transports.copyInto(transportsList);
+ return transportsList;
+ }
+
+ /**
+ * Gets the ITransport implementation of a transport given its name
+ *
+ * @param transportName
+ * Name of the transport
+ * @param address
+ * Address of the target device
+ * @param timeOut
+ * Timeout in milliseconds
+ * @return
+ * ITranport implementation of the transport matching the given name. Null if the transport cannot be found.
+ * @throws Exception
+ */
+ public static ITransport getTransport(String transportName, String address, int timeOut) throws Exception {
+
+ ITransport transport = null;
+
+ IConfigurationElement[] ce = ep.getConfigurationElements();
+ for (int i = 0; i < ce.length; i++) {
+ String name = ce[i].getAttribute("name"); //$NON-NLS-1$
+ if(name!=null)
+ if(name.equalsIgnoreCase(transportName))
+ {
+ transport = (ITransport)ce[i].createExecutableExtension("class"); //$NON-NLS-1$
+ transport.setTargetAddress(address);
+ transport.setTimeOut(timeOut);
+
+ }
+ }
+ return transport;
+ }
+
+}