org.jdesktop.wonderland.common
Class AssetURI

java.lang.Object
  extended by org.jdesktop.wonderland.common.AssetURI
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ContentURI, ModuleURI, WlHttpURI

public abstract class AssetURI
extends java.lang.Object
implements java.io.Serializable

An AssetURI is the base class of all asset uri's handle by the client-side asset management system.

Author:
Jordan Slott
See Also:
Serialized Form

Constructor Summary
AssetURI()
          Default constructor
AssetURI(java.lang.String uri)
          Default constructor
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.lang.String getProtocol()
          Returns the protocol for this uri, null if none is present
abstract  java.lang.String getRelativeCachePath()
          Returns a relative path of the asset so that it exists in a unique location within a cache.
 java.lang.String getURI()
          Returns the String URI
 int hashCode()
           
abstract  void setServerHostAndPort(java.lang.String hostNameAndPort)
          Annotates this URI with a : based upon the current primary server.
 java.lang.String toExternalForm()
          Returns the external representation of the URI.
 java.lang.String toString()
          Returns the string representation of the URI
abstract  java.net.URL toURL()
          Returns the asset uri as a URL
static AssetURI uriFactory(java.lang.String uri)
          Returns an instance of the proper subclass of AssetURI for the given string URI.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AssetURI

public AssetURI()
Default constructor


AssetURI

public AssetURI(java.lang.String uri)
Default constructor

Method Detail

getURI

public java.lang.String getURI()
Returns the String URI

Returns:
The URI as a String

getRelativeCachePath

public abstract java.lang.String getRelativeCachePath()
Returns a relative path of the asset so that it exists in a unique location within a cache. The path does not have a leading "/". This method should return either forward or backward slashes depending upon the platform.

Returns:
A unique relative path for the URI

setServerHostAndPort

public abstract void setServerHostAndPort(java.lang.String hostNameAndPort)
Annotates this URI with a : based upon the current primary server. This method is implemented by subclasses who need a reference to the current server in order to resolve the asset. For URIs that do not need this information, this method does nothing.

Parameters:
hostNameAndPort - The host name and port to annotate the URI with

toURL

public abstract java.net.URL toURL()
                            throws java.net.MalformedURLException
Returns the asset uri as a URL

Returns:
The URL
Throws:
java.net.MalformedURLException

toString

public java.lang.String toString()
Returns the string representation of the URI

Overrides:
toString in class java.lang.Object
Returns:
The string representation of the URI

toExternalForm

public java.lang.String toExternalForm()
Returns the external representation of the URI.

Returns:
The external URI form

getProtocol

public java.lang.String getProtocol()
Returns the protocol for this uri, null if none is present


uriFactory

public static AssetURI uriFactory(java.lang.String uri)
Returns an instance of the proper subclass of AssetURI for the given string URI. Returns null if none exists, based upon the protocol of the given URI.

Parameters:
uri - The String uri
Returns:
Some subclass of AssetURI that supports the uri

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object


Open Wonderland - http://openwonderland.org