org.objectweb.proactive.core.util
Class UrlBuilder

java.lang.Object
  |
  +--org.objectweb.proactive.core.util.UrlBuilder

public class UrlBuilder
extends java.lang.Object

This class is a utility class to perform modifications and operations on urls.


Constructor Summary
UrlBuilder()
           
 
Method Summary
static java.lang.String appendVnSuffix(java.lang.String name)
           
static java.lang.String buildUrl(java.lang.String host, java.lang.String name, java.lang.String protocol)
           
static java.lang.String buildUrl(java.lang.String host, java.lang.String name, java.lang.String protocol, int port)
           
static java.lang.String buildUrlFromProperties(java.lang.String host, java.lang.String name, java.lang.String protocol)
          This method build an url in the form protocol://host:port/name where the port is given from system propeties, except when the protocol is jini.
static java.lang.String buildVirtualNodeUrl(java.lang.String url)
           
static java.lang.String checkProtocol(java.lang.String protocol)
           
static java.lang.String checkUrl(java.lang.String url)
          Checks if the given url is well-formed
static java.lang.String getHostNameFromUrl(java.lang.String url)
           
static java.lang.String getNameFromUrl(java.lang.String url)
          Returns the name included in the url
static int getPortFromUrl(java.lang.String url)
          Returns port number included in the url or 1099 if no port is specified
static java.lang.String getProtocol(java.lang.String nodeURL)
          Return the protocol specified in the string The same convention as in URL is used
static java.lang.String removePortFromHost(java.lang.String hostname)
           
static java.lang.String removeProtocol(java.lang.String url, java.lang.String protocol)
          Returns the url without protocol
static java.lang.String removeVnSuffix(java.lang.String url)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UrlBuilder

public UrlBuilder()
Method Detail

checkUrl

public static java.lang.String checkUrl(java.lang.String url)
                                 throws java.net.UnknownHostException
Checks if the given url is well-formed

Parameters:
url - the url to check
Returns:
String the url if well-formed
Throws:
UnknownHostException - if the url is not well-formed

buildUrl

public static java.lang.String buildUrl(java.lang.String host,
                                        java.lang.String name,
                                        java.lang.String protocol)

buildUrl

public static java.lang.String buildUrl(java.lang.String host,
                                        java.lang.String name,
                                        java.lang.String protocol,
                                        int port)

buildUrlFromProperties

public static java.lang.String buildUrlFromProperties(java.lang.String host,
                                                      java.lang.String name,
                                                      java.lang.String protocol)
This method build an url in the form protocol://host:port/name where the port is given from system propeties, except when the protocol is jini. In that case the url looks like jini://host/name.

Parameters:
host -
name -
protocol -
Returns:
an Url built from properties

buildVirtualNodeUrl

public static java.lang.String buildVirtualNodeUrl(java.lang.String url)
                                            throws java.net.UnknownHostException
java.net.UnknownHostException

appendVnSuffix

public static java.lang.String appendVnSuffix(java.lang.String name)

removeVnSuffix

public static java.lang.String removeVnSuffix(java.lang.String url)

getNameFromUrl

public static java.lang.String getNameFromUrl(java.lang.String url)
Returns the name included in the url

Parameters:
url -
Returns:
the name included in the url

getProtocol

public static java.lang.String getProtocol(java.lang.String nodeURL)
Return the protocol specified in the string The same convention as in URL is used


removeProtocol

public static java.lang.String removeProtocol(java.lang.String url,
                                              java.lang.String protocol)
Returns the url without protocol


getHostNameFromUrl

public static java.lang.String getHostNameFromUrl(java.lang.String url)
                                           throws java.net.UnknownHostException
java.net.UnknownHostException

checkProtocol

public static java.lang.String checkProtocol(java.lang.String protocol)

removePortFromHost

public static java.lang.String removePortFromHost(java.lang.String hostname)

getPortFromUrl

public static int getPortFromUrl(java.lang.String url)
Returns port number included in the url or 1099 if no port is specified

Parameters:
url -
Returns:
the port number included in the url or 1099 if no port is specified


Copyright © April 2004 INRIA All Rights Reserved.