Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkuppe2008-10-19 22:17:14 +0000
committermkuppe2008-10-19 22:17:14 +0000
commit694c9fc420f13187c4ae0a44c7c19b8f54b66d87 (patch)
tree5d1fa22caf85e0bfac47dafb8b4821c732c35cd4
parentcf2180461c82e5281de2968a728a3d238ab77562 (diff)
downloadorg.eclipse.ecf-694c9fc420f13187c4ae0a44c7c19b8f54b66d87.tar.gz
org.eclipse.ecf-694c9fc420f13187c4ae0a44c7c19b8f54b66d87.tar.xz
org.eclipse.ecf-694c9fc420f13187c4ae0a44c7c19b8f54b66d87.zip
251331: [Discovery][jSLP] Add ServiceURL.getHost() returning URI user-info part
https://bugs.eclipse.org/bugs/show_bug.cgi?id=251331
-rw-r--r--protocols/bundles/ch.ethz.iks.slp/META-INF/MANIFEST.MF2
-rw-r--r--protocols/bundles/ch.ethz.iks.slp/pom.xml400
-rw-r--r--protocols/bundles/ch.ethz.iks.slp/runtimeTests/pom.xml110
-rw-r--r--protocols/bundles/ch.ethz.iks.slp/src/main/java/ch/ethz/iks/slp/ServiceURL.java770
-rw-r--r--protocols/bundles/ch.ethz.iks.slp/src/site/xdoc/index.xml84
-rw-r--r--protocols/bundles/ch.ethz.iks.slp/src/test/java/ch/ethz/iks/slp/impl/ServiceURLTest.java250
-rw-r--r--protocols/bundles/ch.ethz.iks.slp/test/init.xargs12
7 files changed, 837 insertions, 791 deletions
diff --git a/protocols/bundles/ch.ethz.iks.slp/META-INF/MANIFEST.MF b/protocols/bundles/ch.ethz.iks.slp/META-INF/MANIFEST.MF
index 865bbde9d..a62c85afd 100644
--- a/protocols/bundles/ch.ethz.iks.slp/META-INF/MANIFEST.MF
+++ b/protocols/bundles/ch.ethz.iks.slp/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-Name: jslp-osgi
Bundle-SymbolicName: ch.ethz.iks.slp
-Bundle-Version: 1.0.0.qualifier
+Bundle-Version: 1.1.0.qualifier
Export-Package: ch.ethz.iks.slp
Bundle-Activator: ch.ethz.iks.slp.impl.Activator
Bundle-Vendor: Jan S. Rellermeyer, IKS, ETH Zurich
diff --git a/protocols/bundles/ch.ethz.iks.slp/pom.xml b/protocols/bundles/ch.ethz.iks.slp/pom.xml
index 0f7950c3b..bace8a8b9 100644
--- a/protocols/bundles/ch.ethz.iks.slp/pom.xml
+++ b/protocols/bundles/ch.ethz.iks.slp/pom.xml
@@ -1,201 +1,201 @@
-<project>
- <modelVersion>4.0.0</modelVersion>
- <name>jSLP-OSGi</name>
- <groupId>ch.ethz.iks.slp</groupId>
- <artifactId>jslp-osgi</artifactId>
- <version>1.0.0.RC5</version>
- <packaging>bundle</packaging>
-
- <url>http://jslp.sourceforge.net</url>
-
- <organization>
- <name>IKS, ETH Zurich</name>
- <url>http://www.iks.inf.ethz.ch</url>
- </organization>
-
- <developers>
- <developer>
- <id>rjan</id>
- <name>Jan S. Rellermeyer</name>
- <email>rellermeyer_at_inf.ethz.ch</email>
- <url>http://people.inf.ethz.ch/rjan</url>
- <organization>IKS, ETH Zurich</organization>
- <organizationUrl>http://www.iks.inf.ethz.ch</organizationUrl>
- <roles>
- <role>Project creator</role>
- <role>Researcher</role>
- </roles>
- <timezone>+1</timezone>
- </developer>
- <developer>
- <id>lemmster</id>
- <name>Markus Alexander Kuppe</name>
- <email>jslp.sf.net_at_lemmster.de</email>
- <url>http://www.lemmster.de</url>
- <organization>Versant GmbH</organization>
- <organizationUrl>http://www.versant.com</organizationUrl>
- <roles>
- <role>Developer</role>
- </roles>
- <timezone>+1</timezone>
- </developer>
- </developers>
-
- <licenses>
- <license>
- <name>BSD license</name>
- <distribution>repo</distribution>
- <url>src/main/resources/LICENSE.txt</url>
- </license>
- </licenses>
-
- <scm>
- <connection>scm:svn:https://jslp.svn.sourceforge.net/svnroot/jslp</connection>
- <developerConnection>scm:svn:rjan@https://jslp.svn.sourceforge.net/svnroot/jslp</developerConnection>
- <url>http://jslp.svn.sourceforge.net/jslp</url>
- </scm>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <version>1.2</version>
- <executions>
- <execution>
- <phase>integration-test</phase>
- <configuration>
- <tasks>
- <echo message="Compiling the unit test environment..."/>
- <mkdir dir="runtimeTests/target"/>
- <condition property="maven.executable" value="mvn.bat">
- <os family="windows" />
- </condition>
- <property name="maven.executable" value="mvn" />
- <exec dir="runtimeTests" executable="${maven.executable}">
- <arg line="package"/>
- </exec>
- <delete dir="test/storage" quiet="true"/>
- <java fork="true" classname="ch.ethz.iks.concierge.framework.Framework" failonerror="true" resultproperty="testresult">
- <classpath>
- <pathelement location="${maven.dependency.ch.ethz.iks.concierge.concierge.jar.path}"/>
- <pathelement location="${maven.dependency.junit.junit.jar.path}"/>
- </classpath>
- <jvmarg value="-Dxargs=test/init.xargs"/>
- <jvmarg value="-Dnet.slp.port=10427"/>
- </java>
- <delete dir="test/storage" quiet="true"/>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.2</source>
- <target>1.1</target>
- <optimize>true</optimize>
- <debug>false</debug>
- </configuration>
- </plugin>
- <!-- http://felix.apache.org/site/maven-bundle-plugin-bnd.html -->
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Include-Resource>{maven-resources}, {maven-dependencies}, target/classes</Include-Resource>
- <Bundle-Version>${pom.version}</Bundle-Version>
- <Bundle-Name>jslp-osgi</Bundle-Name>
- <Bundle-SymbolicName>ch.ethz.iks.slp</Bundle-SymbolicName>
- <_include>~META-INF/MANIFEST.MF</_include>
- <!-- BND just produces Bundle-ManifestVersion: 2 headers which we don't want -->
- <_removeheaders>Bundle-ManifestVersion</_removeheaders>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- </resource>
- </resources>
- </build>
-
- <reporting>
- <plugins>
- <plugin>
- <artifactId>maven-site-plugin</artifactId>
- <configuration>
- <templateFile>maven-site-jslp.vm</templateFile>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <excludePackageNames>ch.ethz.iks.slp.impl,org.osgi.service.log</excludePackageNames>
- </configuration>
- </plugin>
- </plugins>
- </reporting>
-
- <dependencies>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi</artifactId>
- <version>3.0</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.0.4</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>ch.ethz.iks.concierge</groupId>
- <artifactId>concierge</artifactId>
- <version>1.0_RC2</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <repositories>
- <repository>
- <id>iks-repository</id>
- <name>ETH Zurich IKS Repository</name>
- <url>http://www.flowsgi.inf.ethz.ch/repository/maven2/</url>
- </repository>
- </repositories>
- <pluginRepositories>
- <pluginRepository>
- <id>iks-repository</id>
- <name>ETH Zurich IKS Repository</name>
- <url>http://www.flowsgi.inf.ethz.ch/repository/maven2/</url>
- </pluginRepository>
- </pluginRepositories>
-
- <distributionManagement>
- <site>
- <id>sourceforge-site</id>
- <url>scp://shell.sourceforge.net/home/groups/j/js/jslp/htdocs/</url>
- </site>
- <repository>
- <id>iks-snapshots</id>
- <name>ETH Zurich IKS Snapshots</name>
- <url>scp://flowsgi.inf.ethz.ch/repository/maven2</url>
- </repository>
- </distributionManagement>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <name>jSLP-OSGi</name>
+ <groupId>ch.ethz.iks.slp</groupId>
+ <artifactId>jslp-osgi</artifactId>
+ <version>1.1.0.RC1</version>
+ <packaging>bundle</packaging>
+
+ <url>http://jslp.sourceforge.net</url>
+
+ <organization>
+ <name>IKS, ETH Zurich</name>
+ <url>http://www.iks.inf.ethz.ch</url>
+ </organization>
+
+ <developers>
+ <developer>
+ <id>rjan</id>
+ <name>Jan S. Rellermeyer</name>
+ <email>rellermeyer_at_inf.ethz.ch</email>
+ <url>http://people.inf.ethz.ch/rjan</url>
+ <organization>IKS, ETH Zurich</organization>
+ <organizationUrl>http://www.iks.inf.ethz.ch</organizationUrl>
+ <roles>
+ <role>Project creator</role>
+ <role>Researcher</role>
+ </roles>
+ <timezone>+1</timezone>
+ </developer>
+ <developer>
+ <id>lemmster</id>
+ <name>Markus Alexander Kuppe</name>
+ <email>jslp.sf.net_at_lemmster.de</email>
+ <url>http://www.lemmster.de</url>
+ <organization>Versant GmbH</organization>
+ <organizationUrl>http://www.versant.com</organizationUrl>
+ <roles>
+ <role>Developer</role>
+ </roles>
+ <timezone>+1</timezone>
+ </developer>
+ </developers>
+
+ <licenses>
+ <license>
+ <name>BSD license</name>
+ <distribution>repo</distribution>
+ <url>src/main/resources/LICENSE.txt</url>
+ </license>
+ </licenses>
+
+ <scm>
+ <connection>scm:svn:https://jslp.svn.sourceforge.net/svnroot/jslp</connection>
+ <developerConnection>scm:svn:rjan@https://jslp.svn.sourceforge.net/svnroot/jslp</developerConnection>
+ <url>http://jslp.svn.sourceforge.net/jslp</url>
+ </scm>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.2</version>
+ <executions>
+ <execution>
+ <phase>integration-test</phase>
+ <configuration>
+ <tasks>
+ <echo message="Compiling the unit test environment..."/>
+ <mkdir dir="runtimeTests/target"/>
+ <condition property="maven.executable" value="mvn.bat">
+ <os family="windows" />
+ </condition>
+ <property name="maven.executable" value="mvn" />
+ <exec dir="runtimeTests" executable="${maven.executable}">
+ <arg line="package"/>
+ </exec>
+ <delete dir="test/storage" quiet="true"/>
+ <java fork="true" classname="ch.ethz.iks.concierge.framework.Framework" failonerror="true" resultproperty="testresult">
+ <classpath>
+ <pathelement location="${maven.dependency.ch.ethz.iks.concierge.concierge.jar.path}"/>
+ <pathelement location="${maven.dependency.junit.junit.jar.path}"/>
+ </classpath>
+ <jvmarg value="-Dxargs=test/init.xargs"/>
+ <jvmarg value="-Dnet.slp.port=10427"/>
+ </java>
+ <delete dir="test/storage" quiet="true"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.2</source>
+ <target>1.1</target>
+ <optimize>true</optimize>
+ <debug>false</debug>
+ </configuration>
+ </plugin>
+ <!-- http://felix.apache.org/site/maven-bundle-plugin-bnd.html -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Include-Resource>{maven-resources}, {maven-dependencies}, target/classes</Include-Resource>
+ <Bundle-Version>${pom.version}</Bundle-Version>
+ <Bundle-Name>jslp-osgi</Bundle-Name>
+ <Bundle-SymbolicName>ch.ethz.iks.slp</Bundle-SymbolicName>
+ <_include>~META-INF/MANIFEST.MF</_include>
+ <!-- BND just produces Bundle-ManifestVersion: 2 headers which we don't want -->
+ <_removeheaders>Bundle-ManifestVersion</_removeheaders>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
+ </resources>
+ </build>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <artifactId>maven-site-plugin</artifactId>
+ <configuration>
+ <templateFile>maven-site-jslp.vm</templateFile>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <excludePackageNames>ch.ethz.iks.slp.impl,org.osgi.service.log</excludePackageNames>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi</artifactId>
+ <version>3.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.0.4</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>ch.ethz.iks.concierge</groupId>
+ <artifactId>concierge</artifactId>
+ <version>1.0_RC2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <repositories>
+ <repository>
+ <id>iks-repository</id>
+ <name>ETH Zurich IKS Repository</name>
+ <url>http://www.flowsgi.inf.ethz.ch/repository/maven2/</url>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>iks-repository</id>
+ <name>ETH Zurich IKS Repository</name>
+ <url>http://www.flowsgi.inf.ethz.ch/repository/maven2/</url>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <distributionManagement>
+ <site>
+ <id>sourceforge-site</id>
+ <url>scp://shell.sourceforge.net/home/groups/j/js/jslp/htdocs/</url>
+ </site>
+ <repository>
+ <id>iks-snapshots</id>
+ <name>ETH Zurich IKS Snapshots</name>
+ <url>scp://flowsgi.inf.ethz.ch/repository/maven2</url>
+ </repository>
+ </distributionManagement>
</project> \ No newline at end of file
diff --git a/protocols/bundles/ch.ethz.iks.slp/runtimeTests/pom.xml b/protocols/bundles/ch.ethz.iks.slp/runtimeTests/pom.xml
index 6a5556530..535ae70b3 100644
--- a/protocols/bundles/ch.ethz.iks.slp/runtimeTests/pom.xml
+++ b/protocols/bundles/ch.ethz.iks.slp/runtimeTests/pom.xml
@@ -1,56 +1,56 @@
-<project>
- <modelVersion>4.0.0</modelVersion>
- <name>jSLP-Test</name>
- <groupId>ch.ethz.iks.slp</groupId>
- <artifactId>jslp-test</artifactId>
- <version>1.0.0.RC5</version>
- <packaging>bundle</packaging>
-
- <build>
-
- <plugins>
- <!-- http://felix.apache.org/site/maven-bundle-plugin-bnd.html -->
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Bundle-Version>${pom.version}</Bundle-Version>
- <Bundle-Name>jslp-test</Bundle-Name>
- <Bundle-SymbolicName>ch.ethz.iks.slp.test</Bundle-SymbolicName>
- <Bundle-Vendor>Jan S. Rellermeyer, IKS, ETH Zurich</Bundle-Vendor>
- <Import-Package>org.osgi.framework, ch.ethz.iks.slp, junit.framework, junit.textui</Import-Package>
- <Private-Package>*</Private-Package>
- <Bundle-Activator>ch.ethz.iks.slp.impl.TestActivator</Bundle-Activator>
- <!-- BND just produces Bundle-ManifestVersion: 2 headers which we don't want -->
- <_removeheaders>Bundle-ManifestVersion</_removeheaders>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi</artifactId>
- <version>3.0</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>ch.ethz.iks.slp</groupId>
- <artifactId>jslp-osgi</artifactId>
- <version>${pom.version}</version>
- <scope>system</scope>
- <systemPath>${user.dir}/../target/jslp-osgi-${pom.version}.jar</systemPath>
- </dependency>
- </dependencies>
-
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <name>jSLP-Test</name>
+ <groupId>ch.ethz.iks.slp</groupId>
+ <artifactId>jslp-test</artifactId>
+ <version>1.1.0.RC1</version>
+ <packaging>bundle</packaging>
+
+ <build>
+
+ <plugins>
+ <!-- http://felix.apache.org/site/maven-bundle-plugin-bnd.html -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-Version>${pom.version}</Bundle-Version>
+ <Bundle-Name>jslp-test</Bundle-Name>
+ <Bundle-SymbolicName>ch.ethz.iks.slp.test</Bundle-SymbolicName>
+ <Bundle-Vendor>Jan S. Rellermeyer, IKS, ETH Zurich</Bundle-Vendor>
+ <Import-Package>org.osgi.framework, ch.ethz.iks.slp, junit.framework, junit.textui</Import-Package>
+ <Private-Package>*</Private-Package>
+ <Bundle-Activator>ch.ethz.iks.slp.impl.TestActivator</Bundle-Activator>
+ <!-- BND just produces Bundle-ManifestVersion: 2 headers which we don't want -->
+ <_removeheaders>Bundle-ManifestVersion</_removeheaders>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi</artifactId>
+ <version>3.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>ch.ethz.iks.slp</groupId>
+ <artifactId>jslp-osgi</artifactId>
+ <version>${pom.version}</version>
+ <scope>system</scope>
+ <systemPath>${user.dir}/../target/jslp-osgi-${pom.version}.jar</systemPath>
+ </dependency>
+ </dependencies>
+
</project> \ No newline at end of file
diff --git a/protocols/bundles/ch.ethz.iks.slp/src/main/java/ch/ethz/iks/slp/ServiceURL.java b/protocols/bundles/ch.ethz.iks.slp/src/main/java/ch/ethz/iks/slp/ServiceURL.java
index 7d8193eda..54d94dc38 100644
--- a/protocols/bundles/ch.ethz.iks.slp/src/main/java/ch/ethz/iks/slp/ServiceURL.java
+++ b/protocols/bundles/ch.ethz.iks.slp/src/main/java/ch/ethz/iks/slp/ServiceURL.java
@@ -1,373 +1,397 @@
-/* Copyright (c) 2005-2007 Jan S. Rellermeyer
- * Information and Communication Systems Research Group (IKS),
- * Department of Computer Science, ETH Zurich.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * - Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * - Neither the name of ETH Zurich nor the names of its contributors may be
- * used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-package ch.ethz.iks.slp;
-
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.io.Serializable;
-
-/**
- * Implementation of the SLP ServiceURL class defined in RFC 2614.
- *
- * @author Jan S. Rellermeyer, IKS, ETH Zürich
- * @since 0.1
- */
-public final class ServiceURL extends ch.ethz.iks.slp.impl.AuthenticatedURL
- implements Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = 9181946114021582389L;
-
- /**
- *
- */
- public static final int NO_PORT = 0;
-
- /**
- *
- */
- public static final int LIFETIME_NONE = 0;
-
- /**
- *
- */
- public static final int LIFETIME_DEFAULT = 10800;
-
- /**
- *
- */
- public static final int LIFETIME_MAXIMUM = 65535;
-
- /**
- *
- */
- public static final int LIFETIME_PERMANENT = -1;
-
- /**
- *
- */
- private String url = null;;
-
- /**
- *
- */
- private int lifetime = 0;
-
- /**
- *
- */
- private ServiceType type = null;
-
- /**
- *
- */
- private String host = null;
-
- /**
- *
- */
- private String protocol = null;
-
- /**
- *
- */
- private int port = 0;
-
- /**
- *
- */
- private String path = null;
-
- /**
- *
- *
- */
- private ServiceURL() {
- }
-
- /**
- * create a new ServiceURL instance from a String.
- *
- * @param serviceURL
- * the string representation of a ServiceURL like
- *
- * <pre>
- * service::&quot;serviceType&quot;://&quot;addrspec&quot;
- * </pre>
- *
- * where servicetype should be of the form abstractType:concreteType and
- * addrspec is the hostname or dotted decimal notation of the host's address
- * followed by an optional :portNumber. Example:
- *
- * <pre>
- * service:osgi:remote://my.host.ch:9200
- * </pre>
- *
- * @param lifeTime
- * the lifetime of the ServiceURL in seconds.
- * @throws ServiceLocationException
- * if the String is not parsable.
- */
- public ServiceURL(final String serviceURL, final int lifeTime)
- throws ServiceLocationException {
- url = serviceURL;
- lifetime = lifeTime;
-
- try {
- parse();
- } catch (Exception ex) {
- throw new ServiceLocationException(
- ServiceLocationException.PARSE_ERROR,
- "service url is malformed: [" + url + "]. ");
- }
- }
-
- /**
- * parse the url string.
- *
- */
- private void parse() {
- int pos1 = url.indexOf("://");
- type = new ServiceType(url.substring(0, pos1++));
-
- int pos2 = url.indexOf("://", pos1 + 1);
- if (pos2 > -1) {
- protocol = url.substring(pos1 + 2, pos2);
- pos1 = pos2 + 1;
- }
-
- int hostEnd = url.indexOf(":", pos1 + 2);
-
- int pathStart;
- if (hostEnd == -1) {
- port = NO_PORT;
- pathStart = hostEnd = url.indexOf("/", pos1 + 2);
- } else {
- pathStart = url.indexOf("/", hostEnd + 1);
- if (pathStart == -1) {
- port = Integer.parseInt(url.substring(hostEnd + 1));
- } else {
- port = Integer.parseInt(url.substring(hostEnd + 1, pathStart));
- }
- }
-
- if (hostEnd == -1) {
- host = url.substring(pos1 + 2);
- } else {
- host = url.substring(pos1 + 2, hostEnd);
- }
-
- if (pathStart == -1) {
- path = "";
- } else {
- path = url.substring(pathStart);
- }
- }
-
- /**
- * Check if two instances are equal.
- *
- * @inheritDoc java.lang.Object.equals(Object)
- * @param obj
- * the object to compare to.
- * @return true if the instances are equal.
- */
- public boolean equals(final Object obj) {
- if (obj instanceof ServiceURL) {
- ServiceURL u = (ServiceURL) obj;
- return (type.equals(u.type)
- && host.equals(u.host)
- && port == u.port
- && ((protocol == null && u.protocol == null) || protocol
- .equals(u.protocol)) && path.equals(u.path));
- }
- return false;
- }
-
- /**
- * Check if a ServiceURL matches another ServiceURL or a ServiceType. In the
- * first case, the method performs an equality check with equals(Object
- * obj), for ServiceTypes, the ServiceType part of the ServiceURL is checked
- * against the given ServiceType.
- *
- * @param obj
- * a ServiceURL or ServiceType. All other objects will return
- * false.
- * @return true if the match succeeds.
- */
- public boolean matches(final Object obj) {
- if (obj instanceof ServiceURL) {
- return equals(obj);
- } else if (obj instanceof ServiceType) {
- return type.matches(obj);
- }
- return false;
- }
-
- /**
- * get a String representation of the ServiceURL.
- *
- * @return the String representation.
- */
- public String toString() {
- return type.toString() + "://"
- + (protocol != null ? protocol + "://" : "") + host
- + (port != NO_PORT ? (":" + port) : "") + path;
- }
-
- /**
- * get the hashCode of the ServiceURL instance.
- *
- * @return the hashCode.
- */
- public int hashCode() {
- return url.hashCode();
- }
-
- /**
- * get the service type.
- *
- * @return the service type.
- */
- public ServiceType getServiceType() {
- return type;
- }
-
- /**
- * get the transport method.
- *
- * @return the transport method. IP returns empty string.
- * @deprecated
- */
- public String getTransport() {
- return "";
- }
-
- /**
- * get the protocol.
- *
- * @return the protocol, if specified. Otherwise, returns null.
- */
- public String getProtocol() {
- return protocol;
- }
-
- /**
- * get the host.
- *
- * @return the host.
- */
- public String getHost() {
- return host;
- }
-
- /**
- * get the port.
- *
- * @return the port.
- */
- public int getPort() {
- return port;
- }
-
- /**
- * get the URL path.
- *
- * @return the URL path.
- */
- public String getURLPath() {
- return path;
- }
-
- /**
- * get the lifetime.
- *
- * @return the lifetime.
- */
- public int getLifetime() {
- return lifetime;
- }
-
- /**
- * get the byte representation of the ServiceURL instance.
- *
- * @throws IOException
- * @throws IOException
- * if an internal processing error occurs.
- */
- public void writeTo(DataOutputStream out) throws IOException {
- out.write(0);
- out.writeShort((short) lifetime);
- out.writeUTF(toString());
- writeAuthBlock(out);
- }
-
- public int getLength() {
- return 1 + 2 + 2 + toString().length() + getAuthBlockLength();
- }
-
- /**
- * Reads a byte stream from a DataInput and constructs a ServiceURL from it,
- * following the RFC 2608 schema:
- * <p>
- *
- * <pre>
- * 0 1 2 3
- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Reserved | Lifetime | URL Length |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * |URL len, contd.| URL (variable length) \
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * |# of URL auths | Auth. blocks (if any) \
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * </pre>.
- * </p>
- *
- * @param input
- * the DataInput streaming the ServiceURL bytes.
- * @return a ServiceURL instance.
- * @throws ServiceLocationException
- * in case of IO exceptions.
- * @throws IOException
- */
- public static ServiceURL fromBytes(final DataInputStream input)
- throws ServiceLocationException, IOException {
- ServiceURL surl = new ServiceURL();
- input.readByte();
- surl.lifetime = input.readShort();
- surl.url = input.readUTF();
- surl.authBlocks = parseAuthBlock(input);
- surl.parse();
- return surl;
- }
-}
+/* Copyright (c) 2005-2007 Jan S. Rellermeyer
+ * Information and Communication Systems Research Group (IKS),
+ * Department of Computer Science, ETH Zurich.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * - Neither the name of ETH Zurich nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+package ch.ethz.iks.slp;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.Serializable;
+
+/**
+ * Implementation of the SLP ServiceURL class defined in RFC 2614.
+ *
+ * @author Jan S. Rellermeyer, IKS, ETH Zürich
+ * @since 0.1
+ */
+public final class ServiceURL extends ch.ethz.iks.slp.impl.AuthenticatedURL
+ implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 9181946114021582389L;
+
+ /**
+ *
+ */
+ public static final int NO_PORT = 0;
+
+ /**
+ *
+ */
+ public static final int LIFETIME_NONE = 0;
+
+ /**
+ *
+ */
+ public static final int LIFETIME_DEFAULT = 10800;
+
+ /**
+ *
+ */
+ public static final int LIFETIME_MAXIMUM = 65535;
+
+ /**
+ *
+ */
+ public static final int LIFETIME_PERMANENT = -1;
+
+ /**
+ *
+ */
+ private String url = null;;
+
+ /**
+ *
+ */
+ private int lifetime = 0;
+
+ /**
+ *
+ */
+ private ServiceType type = null;
+
+ /**
+ *
+ */
+ private String host = null;
+
+ /**
+ * user specific uri part
+ */
+ private String userInfo = null;
+
+ /**
+ *
+ */
+ private String protocol = null;
+
+ /**
+ *
+ */
+ private int port = 0;
+
+ /**
+ *
+ */
+ private String path = null;
+
+ /**
+ *
+ *
+ */
+ private ServiceURL() {
+ }
+
+ /**
+ * create a new ServiceURL instance from a String.
+ *
+ * @param serviceURL
+ * the string representation of a ServiceURL like
+ *
+ * <pre>
+ * service::&quot;serviceType&quot;://&quot;addrspec&quot;
+ * </pre>
+ *
+ * where servicetype should be of the form abstractType:concreteType and
+ * addrspec is the hostname or dotted decimal notation of the host's address
+ * followed by an optional :portNumber. Example:
+ *
+ * <pre>
+ * service:osgi:remote://my.host.ch:9200
+ * </pre>
+ *
+ * @param lifeTime
+ * the lifetime of the ServiceURL in seconds.
+ * @throws ServiceLocationException
+ * if the String is not parsable.
+ */
+ public ServiceURL(final String serviceURL, final int lifeTime)
+ throws ServiceLocationException {
+ url = serviceURL;
+ lifetime = lifeTime;
+
+ try {
+ parse();
+ } catch (Exception ex) {
+ throw new ServiceLocationException(
+ ServiceLocationException.PARSE_ERROR,
+ "service url is malformed: [" + url + "]. ");
+ }
+ }
+
+ /**
+ * parse the url string.
+ *
+ */
+ private void parse() {
+ int pos1 = url.indexOf("://");
+ type = new ServiceType(url.substring(0, pos1++));
+
+ int pos2 = url.indexOf("://", pos1 + 1);
+ if (pos2 > -1) {
+ protocol = url.substring(pos1 + 2, pos2);
+ pos1 = pos2 + 1;
+ }
+
+ int hostEnd = url.indexOf(":", pos1 + 2);
+
+ int pathStart;
+ if (hostEnd == -1) {
+ port = NO_PORT;
+ pathStart = hostEnd = url.indexOf("/", pos1 + 2);
+ } else {
+ pathStart = url.indexOf("/", hostEnd + 1);
+ if (pathStart == -1) {
+ port = Integer.parseInt(url.substring(hostEnd + 1));
+ } else {
+ port = Integer.parseInt(url.substring(hostEnd + 1, pathStart));
+ }
+ }
+
+ int pos3 = url.indexOf("@");
+ if (pos3 > -1) {
+ userInfo = url.substring(pos1 + 2, pos3);
+ pos1 = pos3 - 1;
+ } else {
+ userInfo = ""; // no option user info
+ }
+
+ if (hostEnd == -1) {
+ host = url.substring(pos1 + 2);
+ } else {
+ host = url.substring(pos1 + 2, hostEnd);
+ }
+
+ if (pathStart == -1) {
+ path = "";
+ } else {
+ path = url.substring(pathStart);
+ }
+ }
+
+ /**
+ * Check if two instances are equal.
+ *
+ * @inheritDoc java.lang.Object.equals(Object)
+ * @param obj
+ * the object to compare to.
+ * @return true if the instances are equal.
+ */
+ public boolean equals(final Object obj) {
+ if (obj instanceof ServiceURL) {
+ ServiceURL u = (ServiceURL) obj;
+ return (type.equals(u.type)
+ && host.equals(u.host)
+ && port == u.port
+ && ((protocol == null && u.protocol == null) || protocol
+ .equals(u.protocol)) && path.equals(u.path));
+ }
+ return false;
+ }
+
+ /**
+ * Check if a ServiceURL matches another ServiceURL or a ServiceType. In the
+ * first case, the method performs an equality check with equals(Object
+ * obj), for ServiceTypes, the ServiceType part of the ServiceURL is checked
+ * against the given ServiceType.
+ *
+ * @param obj
+ * a ServiceURL or ServiceType. All other objects will return
+ * false.
+ * @return true if the match succeeds.
+ */
+ public boolean matches(final Object obj) {
+ if (obj instanceof ServiceURL) {
+ return equals(obj);
+ } else if (obj instanceof ServiceType) {
+ return type.matches(obj);
+ }
+ return false;
+ }
+
+ /**
+ * get a String representation of the ServiceURL.
+ *
+ * @return the String representation.
+ */
+ public String toString() {
+ return type.toString() + "://"
+ + (protocol != null ? protocol + "://" : "")
+ + ("".equals(userInfo) ? "": (userInfo + "@")) + host
+ + (port != NO_PORT ? (":" + port) : "") + path;
+ }
+
+ /**
+ * get the hashCode of the ServiceURL instance.
+ *
+ * @return the hashCode.
+ */
+ public int hashCode() {
+ return url.hashCode();
+ }
+
+ /**
+ * get the service type.
+ *
+ * @return the service type.
+ */
+ public ServiceType getServiceType() {
+ return type;
+ }
+
+ /**
+ * get the transport method.
+ *
+ * @return the transport method. IP returns empty string.
+ * @deprecated
+ */
+ public String getTransport() {
+ return "";
+ }
+
+ /**
+ * get the protocol.
+ *
+ * @return the protocol, if specified. Otherwise, returns null.
+ */
+ public String getProtocol() {
+ return protocol;
+ }
+
+ /**
+ * get the host.
+ *
+ * @return the host.
+ */
+ public String getHost() {
+ return host;
+ }
+
+ /**
+ * get the user info
+ *
+ * @return the user info or the empty string
+ * @since 1.1
+ */
+ public String getUserInfo() {
+ return userInfo;
+ }
+
+ /**
+ * get the port.
+ *
+ * @return the port.
+ */
+ public int getPort() {
+ return port;
+ }
+
+ /**
+ * get the URL path.
+ *
+ * @return the URL path.
+ */
+ public String getURLPath() {
+ return path;
+ }
+
+ /**
+ * get the lifetime.
+ *
+ * @return the lifetime.
+ */
+ public int getLifetime() {
+ return lifetime;
+ }
+
+ /**
+ * get the byte representation of the ServiceURL instance.
+ *
+ * @throws IOException
+ * @throws IOException
+ * if an internal processing error occurs.
+ */
+ public void writeTo(DataOutputStream out) throws IOException {
+ out.write(0);
+ out.writeShort((short) lifetime);
+ out.writeUTF(toString());
+ writeAuthBlock(out);
+ }
+
+ public int getLength() {
+ return 1 + 2 + 2 + toString().length() + getAuthBlockLength();
+ }
+
+ /**
+ * Reads a byte stream from a DataInput and constructs a ServiceURL from it,
+ * following the RFC 2608 schema:
+ * <p>
+ *
+ * <pre>
+ * 0 1 2 3
+ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Reserved | Lifetime | URL Length |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * |URL len, contd.| URL (variable length) \
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * |# of URL auths | Auth. blocks (if any) \
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * </pre>.
+ * </p>
+ *
+ * @param input
+ * the DataInput streaming the ServiceURL bytes.
+ * @return a ServiceURL instance.
+ * @throws ServiceLocationException
+ * in case of IO exceptions.
+ * @throws IOException
+ */
+ public static ServiceURL fromBytes(final DataInputStream input)
+ throws ServiceLocationException, IOException {
+ ServiceURL surl = new ServiceURL();
+ input.readByte();
+ surl.lifetime = input.readShort();
+ surl.url = input.readUTF();
+ surl.authBlocks = parseAuthBlock(input);
+ surl.parse();
+ return surl;
+ }
+}
diff --git a/protocols/bundles/ch.ethz.iks.slp/src/site/xdoc/index.xml b/protocols/bundles/ch.ethz.iks.slp/src/site/xdoc/index.xml
index 1263c2340..85da59e14 100644
--- a/protocols/bundles/ch.ethz.iks.slp/src/site/xdoc/index.xml
+++ b/protocols/bundles/ch.ethz.iks.slp/src/site/xdoc/index.xml
@@ -1,42 +1,42 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<document>
- <properties>
- <title>jSLP - Java SLP (Service Location Protocol) Implementation. Java SLP</title>
- <author email="rellermeyer_AT_inf.ethz.ch">Jan S. Rellermeyer</author>
- </properties>
- <meta name="keyword" content="Java, SLP, slp, Service Location Protocol, jSLP, jslp, OpenSLP, OSGi, Goals, Overview"/>
- <meta name="description" content="jSLP is a pure Java implementation of RFC 2608 (SLP, Service Location Protocol, Version 2) with a RFC 2614 style API. It can be both SLP UserAgent (UA) and ServiceAgent (SA). jSLP-OSGi integrates SLP with OSGi (Open Service Gateway Initiative)."/>
- <meta http-equiv="cache-control" content="no-cache"/>
- <meta http-equiv="pragma" content="no-cache"/>
- <meta http-equiv="robots" content="index, follow"/>
-<body>
-
-
- <section name="Overview">
- <p>
- <b>Current Release: 1.0.0.RC5</b><br/>
- <b>Current OSGi Release: 1.0.0.RC5</b><br/>
- </p>
- <p>
- <i>jSLP</i> is a pure Java implementation of SLP, the Service Location Protocol, as specified in <a href="http://www.faqs.org/rfcs/rfc2608.html">RFC 2608</a>. The API is derived from <a href="http://www.faqs.org/rfcs/rfc2614.html">RFC 2614</a> with some <a href="jSLP/index.html">modifications</a>. The implementation runs on every Java2 VM, for instance, also on a J2ME CDC Profile. The footprint of less than 80 kBytes for the full version with SA, UA, and Daemon makes it very feasible for small and embedded devices.
- </p>
- <p>
- So far, the only two existing possibilities to use SLP with Java were either to use the <a href="http://openslp.sourceforge.net">OpenSLP</a> Java API or make use of the SLP implementation that ships with Solaris. The former requires an slpd daemon to run on the machine, this is not always possible (e.g. on mobile or embedded devices). The latter has the same limitations and runs only on Solaris hosts. <a href="http://jcp.org/en/jsr/detail?id=140">JSP 140</a> was launched to develop a more usable API for Java but this request has been withdrawn.
- </p>
- <p>
- <i>jSLP</i> fills this gap and provides both SLP User Agent (UA) and SLP Service Agent (SA) functionality. It supports peer to peer service discovery via multicast convergence and unicast client server discovery with a Directory Agent (DA) like <a href="http://www.openslp.org">OpenSLP</a> in the network. Since it is pure Java without any native code parts or system daemons, <i>jSLP</i> can run on mobile devices and might help to build service oriented middleware systems that do not rely on heavyweight XML-based discovery protocols.
- </p>
- <p>
- There are two versions of <i>jSLP</i> available. The standalone distribution is designed to run with arbitrary Java programs. The OSGi version enables the <a href="http://www.osgi.org">OSGi framework</a> to locate services via SLP. The recent <a href="http://r-osgi.sourceforge.net">R-OSGi</a> project integrates <i>jSLP</i> to remotely access OSGi services from distributed OSGi platforms.
- </p>
- <p>
- Java Management Extensions (JMX, <a href="http://www.jcp.org/en/jsr/detail?id=160">JSP 160</a>) defines the integration of JMX and SLP, the examples run with jSLP if the divergences between RFC 2614 and jSLP are regarded.
- </p>
- <br/>
- <p>
- <i>jSLP</i> was developed by Jan S. Rellermeyer for <a href="http://r-osgi.sourceforge.net">R-OSGi</a> (Remote OSGi), part of the <a href="http://flowsgi.inf.ethz.ch">flowSGi</a> project, which is an ongoing research project at <a href="http://pc.inf.ethz.ch">Institute for Pervasive Computing</a>, <a href="http://www.ethz.ch">ETH Zurich</a>.
- </p>
- </section>
-
-</body>
-</document>
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<document>
+ <properties>
+ <title>jSLP - Java SLP (Service Location Protocol) Implementation. Java SLP</title>
+ <author email="rellermeyer_AT_inf.ethz.ch">Jan S. Rellermeyer</author>
+ </properties>
+ <meta name="keyword" content="Java, SLP, slp, Service Location Protocol, jSLP, jslp, OpenSLP, OSGi, Goals, Overview"/>
+ <meta name="description" content="jSLP is a pure Java implementation of RFC 2608 (SLP, Service Location Protocol, Version 2) with a RFC 2614 style API. It can be both SLP UserAgent (UA) and ServiceAgent (SA). jSLP-OSGi integrates SLP with OSGi (Open Service Gateway Initiative)."/>
+ <meta http-equiv="cache-control" content="no-cache"/>
+ <meta http-equiv="pragma" content="no-cache"/>
+ <meta http-equiv="robots" content="index, follow"/>
+<body>
+
+
+ <section name="Overview">
+ <p>
+ <b>Current Release: 1.1.0.RC1</b><br/>
+ <b>Current OSGi Release: 1.1.0.RC1</b><br/>
+ </p>
+ <p>
+ <i>jSLP</i> is a pure Java implementation of SLP, the Service Location Protocol, as specified in <a href="http://www.faqs.org/rfcs/rfc2608.html">RFC 2608</a>. The API is derived from <a href="http://www.faqs.org/rfcs/rfc2614.html">RFC 2614</a> with some <a href="jSLP/index.html">modifications</a>. The implementation runs on every Java2 VM, for instance, also on a J2ME CDC Profile. The footprint of less than 80 kBytes for the full version with SA, UA, and Daemon makes it very feasible for small and embedded devices.
+ </p>
+ <p>
+ So far, the only two existing possibilities to use SLP with Java were either to use the <a href="http://openslp.sourceforge.net">OpenSLP</a> Java API or make use of the SLP implementation that ships with Solaris. The former requires an slpd daemon to run on the machine, this is not always possible (e.g. on mobile or embedded devices). The latter has the same limitations and runs only on Solaris hosts. <a href="http://jcp.org/en/jsr/detail?id=140">JSP 140</a> was launched to develop a more usable API for Java but this request has been withdrawn.
+ </p>
+ <p>
+ <i>jSLP</i> fills this gap and provides both SLP User Agent (UA) and SLP Service Agent (SA) functionality. It supports peer to peer service discovery via multicast convergence and unicast client server discovery with a Directory Agent (DA) like <a href="http://www.openslp.org">OpenSLP</a> in the network. Since it is pure Java without any native code parts or system daemons, <i>jSLP</i> can run on mobile devices and might help to build service oriented middleware systems that do not rely on heavyweight XML-based discovery protocols.
+ </p>
+ <p>
+ There are two versions of <i>jSLP</i> available. The standalone distribution is designed to run with arbitrary Java programs. The OSGi version enables the <a href="http://www.osgi.org">OSGi framework</a> to locate services via SLP. The recent <a href="http://r-osgi.sourceforge.net">R-OSGi</a> project integrates <i>jSLP</i> to remotely access OSGi services from distributed OSGi platforms.
+ </p>
+ <p>
+ Java Management Extensions (JMX, <a href="http://www.jcp.org/en/jsr/detail?id=160">JSP 160</a>) defines the integration of JMX and SLP, the examples run with jSLP if the divergences between RFC 2614 and jSLP are regarded.
+ </p>
+ <br/>
+ <p>
+ <i>jSLP</i> was developed by Jan S. Rellermeyer for <a href="http://r-osgi.sourceforge.net">R-OSGi</a> (Remote OSGi), part of the <a href="http://flowsgi.inf.ethz.ch">flowSGi</a> project, which is an ongoing research project at <a href="http://pc.inf.ethz.ch">Institute for Pervasive Computing</a>, <a href="http://www.ethz.ch">ETH Zurich</a>.
+ </p>
+ </section>
+
+</body>
+</document>
diff --git a/protocols/bundles/ch.ethz.iks.slp/src/test/java/ch/ethz/iks/slp/impl/ServiceURLTest.java b/protocols/bundles/ch.ethz.iks.slp/src/test/java/ch/ethz/iks/slp/impl/ServiceURLTest.java
index f177d04ae..286c09733 100644
--- a/protocols/bundles/ch.ethz.iks.slp/src/test/java/ch/ethz/iks/slp/impl/ServiceURLTest.java
+++ b/protocols/bundles/ch.ethz.iks.slp/src/test/java/ch/ethz/iks/slp/impl/ServiceURLTest.java
@@ -1,114 +1,136 @@
-package ch.ethz.iks.slp.impl;
-
-import ch.ethz.iks.slp.ServiceURL;
-import junit.framework.TestCase;
-
-public class ServiceURLTest extends TestCase {
-
- public ServiceURLTest() {
- super("ServiceURLTest");
- System.setProperty("net.slp.port", "10427");
- }
-
- public void testServiceURL1() throws Exception {
- String urlString = "service:test:myservice://localhost";
- ServiceURL url = new ServiceURL(urlString, 0);
- assertEquals(url.getServiceType().toString(), "service:test:myservice");
- assertEquals(url.getHost(), "localhost");
- assertEquals(url.getPort(), 0);
- assertEquals(url.getURLPath(), "");
- assertEquals(url.getProtocol(), null);
- assertEquals(url.toString(), urlString);
- }
-
- public void testServiceURL2() throws Exception {
- String urlString = "service:test:myservice://localhost:80";
- ServiceURL url = new ServiceURL(urlString, 0);
- assertEquals(url.getServiceType().toString(), "service:test:myservice");
- assertEquals(url.getHost(), "localhost");
- assertEquals(url.getPort(), 80);
- assertEquals(url.getURLPath(), "");
- assertEquals(url.getProtocol(), null);
- assertEquals(url.toString(), urlString);
- }
-
- public void testServiceURL3() throws Exception {
- String urlString = "service:test:myservice://localhost:80/path";
- ServiceURL url = new ServiceURL(urlString, 0);
- assertEquals(url.getServiceType().toString(), "service:test:myservice");
- assertEquals(url.getHost(), "localhost");
- assertEquals(url.getPort(), 80);
- assertEquals(url.getURLPath(), "/path");
- assertEquals(url.getProtocol(), null);
- assertEquals(url.toString(), urlString);
- }
-
- public void testServiceURL4() throws Exception {
- String urlString = "service:test:myservice://localhost/my/path";
- ServiceURL url = new ServiceURL(urlString, 0);
- assertEquals(url.getServiceType().toString(), "service:test:myservice");
- assertEquals(url.getHost(), "localhost");
- assertEquals(url.getPort(), 0);
- assertEquals(url.getURLPath(), "/my/path");
- assertEquals(url.getProtocol(), null);
- assertEquals(url.toString(), urlString);
- }
-
- public void testServiceURL5() throws Exception {
- String urlString = "service:test:myservice://http://localhost:8080/my/path";
- ServiceURL url = new ServiceURL(urlString, 0);
- assertEquals(url.getServiceType().toString(), "service:test:myservice");
- assertEquals(url.getHost(), "localhost");
- assertEquals(url.getPort(), 8080);
- assertEquals(url.getURLPath(), "/my/path");
- assertEquals(url.getProtocol(), "http");
- assertEquals(url.toString(), urlString);
- }
-
- public void testServiceURL6() throws Exception {
- String urlString = "service:test://http://localhost";
- ServiceURL url = new ServiceURL(urlString, 0);
- assertEquals(url.getServiceType().toString(), "service:test");
- assertEquals(url.getHost(), "localhost");
- assertEquals(url.getPort(), 0);
- assertEquals(url.getURLPath(), "");
- assertEquals(url.getProtocol(), "http");
- assertEquals(url.toString(), urlString);
- }
-
- public void testServiceURLNamingAuthorityCustom() throws Exception {
- String urlString = "service:test.foo://http://localhost";
- ServiceURL url = new ServiceURL(urlString, 0);
- assertEquals(url.getServiceType().toString(), "service:test.foo");
- assertEquals(url.getHost(), "localhost");
- assertEquals(url.getPort(), 0);
- assertEquals(url.getURLPath(), "");
- assertEquals(url.getProtocol(), "http");
- assertEquals(url.toString(), urlString);
- assertTrue("foo".equals(url.getServiceType().getNamingAuthority()));
- }
-
- public void testServiceURLNamingAuthorityDefault() throws Exception {
- String urlString = "service:test://http://localhost";
- ServiceURL url = new ServiceURL(urlString, 0);
- assertEquals(url.getServiceType().toString(), "service:test");
- assertEquals(url.getHost(), "localhost");
- assertEquals(url.getPort(), 0);
- assertEquals(url.getURLPath(), "");
- assertEquals(url.getProtocol(), "http");
- assertEquals(url.toString(), urlString);
- assertTrue("".equals(url.getServiceType().getNamingAuthority()));
- }
-
- public void testServiceURLNamingAuthorityIana() throws Exception {
- String urlString = "service:test.iana://http://localhost";
- ServiceURL url = new ServiceURL(urlString, 0);
- assertEquals(url.getServiceType().toString(), "service:test");
- assertEquals(url.getHost(), "localhost");
- assertEquals(url.getPort(), 0);
- assertEquals(url.getURLPath(), "");
- assertEquals(url.getProtocol(), "http");
- assertEquals(url.toString(), "service:test://http://localhost");
- assertTrue("".equals(url.getServiceType().getNamingAuthority()));
- }
-}
+package ch.ethz.iks.slp.impl;
+
+import ch.ethz.iks.slp.ServiceURL;
+import junit.framework.TestCase;
+
+public class ServiceURLTest extends TestCase {
+
+ public ServiceURLTest() {
+ super("ServiceURLTest");
+ System.setProperty("net.slp.port", "10427");
+ }
+
+ public void testServiceURL1() throws Exception {
+ String urlString = "service:test:myservice://localhost";
+ ServiceURL url = new ServiceURL(urlString, 0);
+ assertEquals(url.getServiceType().toString(), "service:test:myservice");
+ assertEquals(url.getHost(), "localhost");
+ assertEquals(url.getPort(), 0);
+ assertEquals(url.getURLPath(), "");
+ assertEquals(url.getUserInfo(), "");
+ assertEquals(url.getProtocol(), null);
+ assertEquals(url.toString(), urlString);
+ }
+
+ public void testServiceURL2() throws Exception {
+ String urlString = "service:test:myservice://localhost:80";
+ ServiceURL url = new ServiceURL(urlString, 0);
+ assertEquals(url.getServiceType().toString(), "service:test:myservice");
+ assertEquals(url.getHost(), "localhost");
+ assertEquals(url.getPort(), 80);
+ assertEquals(url.getURLPath(), "");
+ assertEquals(url.getUserInfo(), "");
+ assertEquals(url.getProtocol(), null);
+ assertEquals(url.toString(), urlString);
+ }
+
+ public void testServiceURL3() throws Exception {
+ String urlString = "service:test:myservice://localhost:80/path";
+ ServiceURL url = new ServiceURL(urlString, 0);
+ assertEquals(url.getServiceType().toString(), "service:test:myservice");
+ assertEquals(url.getHost(), "localhost");
+ assertEquals(url.getPort(), 80);
+ assertEquals(url.getURLPath(), "/path");
+ assertEquals(url.getUserInfo(), "");
+ assertEquals(url.getProtocol(), null);
+ assertEquals(url.toString(), urlString);
+ }
+
+ public void testServiceURL4() throws Exception {
+ String urlString = "service:test:myservice://localhost/my/path";
+ ServiceURL url = new ServiceURL(urlString, 0);
+ assertEquals(url.getServiceType().toString(), "service:test:myservice");
+ assertEquals(url.getHost(), "localhost");
+ assertEquals(url.getPort(), 0);
+ assertEquals(url.getURLPath(), "/my/path");
+ assertEquals(url.getUserInfo(), "");
+ assertEquals(url.getProtocol(), null);
+ assertEquals(url.toString(), urlString);
+ }
+
+ public void testServiceURL5() throws Exception {
+ String urlString = "service:test:myservice://http://localhost:8080/my/path";
+ ServiceURL url = new ServiceURL(urlString, 0);
+ assertEquals(url.getServiceType().toString(), "service:test:myservice");
+ assertEquals(url.getHost(), "localhost");
+ assertEquals(url.getPort(), 8080);
+ assertEquals(url.getURLPath(), "/my/path");
+ assertEquals(url.getUserInfo(), "");
+ assertEquals(url.getProtocol(), "http");
+ assertEquals(url.toString(), urlString);
+ }
+
+ public void testServiceURL6() throws Exception {
+ String urlString = "service:test://http://localhost";
+ ServiceURL url = new ServiceURL(urlString, 0);
+ assertEquals(url.getServiceType().toString(), "service:test");
+ assertEquals(url.getHost(), "localhost");
+ assertEquals(url.getPort(), 0);
+ assertEquals(url.getURLPath(), "");
+ assertEquals(url.getUserInfo(), "");
+ assertEquals(url.getProtocol(), "http");
+ assertEquals(url.toString(), urlString);
+ }
+
+ public void testServiceURLNamingAuthorityCustom() throws Exception {
+ String urlString = "service:test.foo://http://localhost";
+ ServiceURL url = new ServiceURL(urlString, 0);
+ assertEquals(url.getServiceType().toString(), "service:test.foo");
+ assertEquals(url.getHost(), "localhost");
+ assertEquals(url.getPort(), 0);
+ assertEquals(url.getURLPath(), "");
+ assertEquals(url.getUserInfo(), "");
+ assertEquals(url.getProtocol(), "http");
+ assertEquals(url.toString(), urlString);
+ assertTrue("foo".equals(url.getServiceType().getNamingAuthority()));
+ }
+
+ public void testServiceURLNamingAuthorityDefault() throws Exception {
+ String urlString = "service:test://http://localhost";
+ ServiceURL url = new ServiceURL(urlString, 0);
+ assertEquals(url.getServiceType().toString(), "service:test");
+ assertEquals(url.getHost(), "localhost");
+ assertEquals(url.getPort(), 0);
+ assertEquals(url.getURLPath(), "");
+ assertEquals(url.getUserInfo(), "");
+ assertEquals(url.getProtocol(), "http");
+ assertEquals(url.toString(), urlString);
+ assertTrue("".equals(url.getServiceType().getNamingAuthority()));
+ }
+
+ public void testServiceURLNamingAuthorityIana() throws Exception {
+ String urlString = "service:test.iana://http://localhost";
+ ServiceURL url = new ServiceURL(urlString, 0);
+ assertEquals(url.getServiceType().toString(), "service:test");
+ assertEquals(url.getHost(), "localhost");
+ assertEquals(url.getPort(), 0);
+ assertEquals(url.getURLPath(), "");
+ assertEquals(url.getUserInfo(), "");
+ assertEquals(url.getProtocol(), "http");
+ assertEquals(url.toString(), "service:test://http://localhost");
+ assertTrue("".equals(url.getServiceType().getNamingAuthority()));
+ }
+
+ public void testServiceURLUserInfo() throws Exception {
+ String urlString = "service:test.iana://http://foobar@localhost";
+ ServiceURL url = new ServiceURL(urlString, 0);
+ assertEquals(url.getServiceType().toString(), "service:test");
+ assertEquals(url.getHost(), "localhost");
+ assertEquals(url.getPort(), 0);
+ assertEquals(url.getURLPath(), "");
+ assertEquals(url.getProtocol(), "http");
+ assertEquals(url.toString(), "service:test://http://foobar@localhost");
+ assertEquals(url.getUserInfo(), "foobar");
+ assertTrue("".equals(url.getServiceType().getNamingAuthority()));
+ }
+}
diff --git a/protocols/bundles/ch.ethz.iks.slp/test/init.xargs b/protocols/bundles/ch.ethz.iks.slp/test/init.xargs
index f15f70cc3..b8665f496 100644
--- a/protocols/bundles/ch.ethz.iks.slp/test/init.xargs
+++ b/protocols/bundles/ch.ethz.iks.slp/test/init.xargs
@@ -1,6 +1,6 @@
--Dorg.osgi.framework.system.packages=junit.framework,junit.textui
-
--init
-
--istart file:target/jslp-osgi-1.0.0.RC5.jar
--istart file:runtimeTests/target/jslp-test-1.0.0.RC5.jar \ No newline at end of file
+-Dorg.osgi.framework.system.packages=junit.framework,junit.textui
+
+-init
+
+-istart file:target/jslp-osgi-1.1.0.RC1.jar
+-istart file:runtimeTests/target/jslp-test-1.1.0.RC1.jar \ No newline at end of file

Back to the top