Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2008-01-20 05:30:06 +0000
committerslewis2008-01-20 05:30:06 +0000
commitf7adfdd66a641fea14d4c6509f73f9d64c140ef6 (patch)
tree489f5b672b979273e4c5dfb53559c3cde0e6fcf7 /framework/bundles/org.eclipse.ecf.discovery/src/org
parentcacf5606ea527addd9c180a8a79a91f467ab9868 (diff)
downloadorg.eclipse.ecf-f7adfdd66a641fea14d4c6509f73f9d64c140ef6.tar.gz
org.eclipse.ecf-f7adfdd66a641fea14d4c6509f73f9d64c140ef6.tar.xz
org.eclipse.ecf-f7adfdd66a641fea14d4c6509f73f9d64c140ef6.zip
Added method to IContainerServiceInfoAdapter, implementation in ServiceInfo class, and updated test code.
Diffstat (limited to 'framework/bundles/org.eclipse.ecf.discovery/src/org')
-rw-r--r--framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/IContainerServiceInfoAdapter.java24
-rw-r--r--framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/IDiscoveryContainerAdapter.java3
-rw-r--r--framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/ServiceInfo.java29
3 files changed, 45 insertions, 11 deletions
diff --git a/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/IContainerServiceInfoAdapter.java b/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/IContainerServiceInfoAdapter.java
index c8906cf0f..e8df6ba9b 100644
--- a/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/IContainerServiceInfoAdapter.java
+++ b/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/IContainerServiceInfoAdapter.java
@@ -11,6 +11,8 @@
package org.eclipse.ecf.discovery;
+import org.eclipse.ecf.core.IContainer;
+
/**
* Adapter for IServiceInfo instances.
*/
@@ -32,8 +34,9 @@ public interface IContainerServiceInfoAdapter {
* container.connect(targetID,null);
* </pre>
*
- * @return String targetID for use in connecting to the remote container. Will return <code>null</code>
- * if there is incomplete/absent information for the info.
+ * @return String for use in connecting to the remote container. The returned value should be
+ * of proper syntax to be used to create a targetID for passing to {@link IContainer#connect(org.eclipse.ecf.core.identity.ID, org.eclipse.ecf.core.security.IConnectContext)}.
+ * May return <code>null</code> if there is incomplete/absent information for the info.
*/
public String getConnectTarget();
@@ -44,7 +47,12 @@ public interface IContainerServiceInfoAdapter {
public Boolean connectRequiresPassword();
/**
- * Set the container properties.
+ * Set the container properties. This method sets an implicit connect target. On the receiver, calls to {@link #getConnectTarget()}
+ * will complete the URI in the following way
+ * <pre>
+ * <connectProtocol>://<IServiceInfo.getLocation().getAuthority()>/<connectPath>
+ * </pre>
+ * See {@link #getConnectTarget()}.
*
* @param containerFactoryName set the containerFactoryName for this info. May not be <code>null</code>.
* @param connectProtocol set the connectProtocol for the target. May not be <code>null</code>.
@@ -52,4 +60,14 @@ public interface IContainerServiceInfoAdapter {
* @param connectRequiresPassword set whether the target requires a password. May be <code>null</code>.
*/
public void setContainerProperties(String containerFactoryName, String connectProtocol, String connectPath, Boolean connectRequiresPassword);
+
+ /**
+ * Set the container properties. This method sets an explicit connectTarget. The given connectTarget is assumed
+ * to be complete (e.g. ecftcp://user@host:port/path). See {@link #getConnectTarget()}.
+ *
+ * @param containerFactoryName set the containerFactoryName for this info. May not be <code>null</code>.
+ * @param connectTarget set the connectProtocol for the target. May not be <code>null</code>.
+ * @param connectRequiresPassword set whether the target requires a password. May be <code>null</code>.
+ */
+ public void setContainerProperties(String containerFactoryName, String connectTarget, Boolean connectRequiresPassword);
}
diff --git a/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/IDiscoveryContainerAdapter.java b/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/IDiscoveryContainerAdapter.java
index b2705aef7..1e1c7c6f7 100644
--- a/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/IDiscoveryContainerAdapter.java
+++ b/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/IDiscoveryContainerAdapter.java
@@ -32,9 +32,10 @@ public interface IDiscoveryContainerAdapter extends IAdaptable {
/** ECF Service Property Names **/
public static final String CONTAINER_FACTORY_NAME_PROPERTY = "org.eclipse.ecf.containerFactoryName"; //$NON-NLS-1$
+ public static final String CONTAINER_CONNECT_TARGET = "org.eclipse.ecf.connectTarget"; //$NON-NLS-1$
public static final String CONTAINER_CONNECT_TARGET_PROTOCOL = "org.eclipse.ecf.connectTargetProtocol"; //$NON-NLS-1$
+ public static final String CONTAINER_CONNECT_TARGET_PATH = "org.eclipse.ecf.connectTargetPath"; //$NON-NLS-1$
public static final String CONTAINER_CONNECT_REQUIRES_PASSWORD = "org.eclipse.ecf.connectContextRequiresPassword"; //$NON-NLS-1$
- public static final String CONTAINER_CONNECT_PATH = "org.eclipse.ecf.connectTargetPath"; //$NON-NLS-1$
/**
* Add a service listener. The given listener will have its method called
diff --git a/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/ServiceInfo.java b/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/ServiceInfo.java
index 1a804e0b7..740359bb1 100644
--- a/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/ServiceInfo.java
+++ b/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/discovery/ServiceInfo.java
@@ -143,10 +143,13 @@ public class ServiceInfo implements IServiceInfo, Serializable, IContainerServic
public String getConnectTarget() {
if (uri == null || properties == null)
return null;
- String targetValue = properties.getPropertyString(IDiscoveryContainerAdapter.CONTAINER_CONNECT_TARGET_PROTOCOL);
- StringBuffer target = new StringBuffer(targetValue);
+ String connectTarget = properties.getPropertyString(IDiscoveryContainerAdapter.CONTAINER_CONNECT_TARGET);
+ if (connectTarget != null)
+ return connectTarget;
+ String t = properties.getPropertyString(IDiscoveryContainerAdapter.CONTAINER_CONNECT_TARGET_PROTOCOL);
+ StringBuffer target = new StringBuffer(t);
String auth = uri.getAuthority();
- String path = properties.getPropertyString(IDiscoveryContainerAdapter.CONTAINER_CONNECT_PATH);
+ String path = properties.getPropertyString(IDiscoveryContainerAdapter.CONTAINER_CONNECT_TARGET_PATH);
if (path == null)
path = "/"; //$NON-NLS-1$
target.append("://").append(auth).append("/").append(path); //$NON-NLS-1$ //$NON-NLS-2$
@@ -156,15 +159,15 @@ public class ServiceInfo implements IServiceInfo, Serializable, IContainerServic
/* (non-Javadoc)
* @see org.eclipse.ecf.discovery.IContainerServiceInfoAdapter#setContainerProperties(java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean)
*/
- public void setContainerProperties(String containerFactoryName, String connectProtocol, String connectPath, Boolean requiresPassword) {
+ public void setContainerProperties(String containerFactoryName, String connectProtocol, String connectPath, Boolean connectRequiresPassword) {
Assert.isNotNull(containerFactoryName);
properties.setPropertyString(IDiscoveryContainerAdapter.CONTAINER_FACTORY_NAME_PROPERTY, containerFactoryName);
Assert.isNotNull(connectProtocol);
properties.setPropertyString(IDiscoveryContainerAdapter.CONTAINER_CONNECT_TARGET_PROTOCOL, connectProtocol);
if (connectPath != null)
- properties.setPropertyString(IDiscoveryContainerAdapter.CONTAINER_CONNECT_PATH, connectPath);
- if (requiresPassword != null)
- properties.setPropertyString(IDiscoveryContainerAdapter.CONTAINER_CONNECT_REQUIRES_PASSWORD, requiresPassword.toString());
+ properties.setPropertyString(IDiscoveryContainerAdapter.CONTAINER_CONNECT_TARGET_PATH, connectPath);
+ if (connectRequiresPassword != null)
+ properties.setPropertyString(IDiscoveryContainerAdapter.CONTAINER_CONNECT_REQUIRES_PASSWORD, connectRequiresPassword.toString());
}
/* (non-Javadoc)
@@ -176,4 +179,16 @@ public class ServiceInfo implements IServiceInfo, Serializable, IContainerServic
return null;
return Boolean.valueOf(b);
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.discovery.IContainerServiceInfoAdapter#setContainerProperties(java.lang.String, java.lang.String, java.lang.Boolean)
+ */
+ public void setContainerProperties(String containerFactoryName, String connectTarget, Boolean connectRequiresPassword) {
+ Assert.isNotNull(containerFactoryName);
+ properties.setPropertyString(IDiscoveryContainerAdapter.CONTAINER_FACTORY_NAME_PROPERTY, containerFactoryName);
+ Assert.isNotNull(connectTarget);
+ properties.setPropertyString(IDiscoveryContainerAdapter.CONTAINER_CONNECT_TARGET, connectTarget);
+ if (connectRequiresPassword != null)
+ properties.setPropertyString(IDiscoveryContainerAdapter.CONTAINER_CONNECT_REQUIRES_PASSWORD, connectRequiresPassword.toString());
+ }
}

Back to the top