edu.mssm.crover.scentral
Class URLRepositoryImpl

java.lang.Object
  |
  +--edu.mssm.crover.scentral.URLRepositoryImpl
All Implemented Interfaces:
URLRepository

public class URLRepositoryImpl
extends java.lang.Object
implements URLRepository

Implements URLRepository

See Also:
URLRepository

Constructor Summary
URLRepositoryImpl()
           
 
Method Summary
 void defineVariable(java.lang.String name, java.lang.String replacement)
          Defines a new variable with the given value.
 java.lang.String getBase()
          Returns the base URL of the web server.
 java.lang.String getRedirectURLString(java.lang.String name, javax.servlet.http.HttpServletResponse response)
          Returns URL as a string, otherwise the same as getURL() function.
 java.lang.String getRedirectURLString(java.lang.String name, javax.servlet.http.HttpServletResponse response, java.lang.String parameters)
          Returns URL as a string, otherwise the same as getURL() function.
 java.net.URL getURL(java.lang.String name)
          Deprecated.  
 java.net.URL getURL(java.lang.String name, javax.servlet.http.HttpServletResponse response, java.lang.String parameters)
          Returns the URL associated with the name.
 java.lang.String getURLString(java.lang.String name)
          Deprecated.  
 java.lang.String getURLString(java.lang.String name, javax.servlet.http.HttpServletResponse response)
          Returns URL as a string, otherwise the same as getURL() function No paramters are provided.
 java.lang.String getURLString(java.lang.String name, javax.servlet.http.HttpServletResponse response, java.lang.String parameters)
          Behaves the same as getURL, only returns string instead of a URL.
 void loadRepository(java.io.File file)
          Read the url-repository information from this file.
 void loadRepository(java.io.Reader reader)
          Obtain the url-repository information from this Reader.
 void loadRepository(java.lang.String str)
          Read the url-repository information from this file specified as a filename.
 void registerURL(java.lang.String name, java.lang.String page)
           
protected  void removeVariable(java.lang.StringBuffer sb, int start, int count)
           
protected  void replaceVariable(java.lang.StringBuffer sb_url, java.lang.String name, java.lang.String replacement)
          Expand all the variables found in sb_url.
 java.lang.String toString()
          Lists each association on one line, in the style of the text repository file, but with the URL expanded.
protected  java.net.URL translateURL(java.lang.String raw_url)
          Returns the URL as translated from the raw_url.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

URLRepositoryImpl

public URLRepositoryImpl()
Method Detail

getURL

public java.net.URL getURL(java.lang.String name)
Deprecated.  

Tries to return the URL associated with name. If no such URL exists, try to return the url associated with url-not-found. If no such URL exitsts, returns 'http://server/URL-not-found-in-repository?' If the document that contains this error URL is accessed, the webmaster(s) should see the message in the error-log. In any case of error, a message is logged through the log system (PROBLEM level).

See Also:
Log

getURL

public java.net.URL getURL(java.lang.String name,
                           javax.servlet.http.HttpServletResponse response,
                           java.lang.String parameters)
Description copied from interface: URLRepository
Returns the URL associated with the name. A URL is always returned. If the name is not registered, the error url is returned, that points to a document that explains to the user that this URL is not available at this time, or whatever other similare message. A message is logged to the attention of the webmaster(s).

Specified by:
getURL in interface URLRepository
Parameters:
response - The response that possibly needs to encode the URL
parameters - URL parameters for a GET method, must include the question mark '?' as the first character.

getURLString

public java.lang.String getURLString(java.lang.String name)
Deprecated.  

Behaves the same as getURL, only returns string instead of a URL.

See Also:
getURL(java.lang.String)

getBase

public java.lang.String getBase()
Returns the base URL of the web server. eg http://transport.physbio.mssm.edu:8080/

Specified by:
getBase in interface URLRepository

getRedirectURLString

public java.lang.String getRedirectURLString(java.lang.String name,
                                             javax.servlet.http.HttpServletResponse response,
                                             java.lang.String parameters)
Description copied from interface: URLRepository
Returns URL as a string, otherwise the same as getURL() function. Use this method when the URL is to be used for HTTP redirection.

Specified by:
getRedirectURLString in interface URLRepository
Parameters:
response - The response that possibly needs to encode the URL
parameters - URL parameters for a GET method, must include the question mark '?' as the first character.
See Also:
HttpServletResponse.getRedirectURL()

getRedirectURLString

public java.lang.String getRedirectURLString(java.lang.String name,
                                             javax.servlet.http.HttpServletResponse response)
Description copied from interface: URLRepository
Returns URL as a string, otherwise the same as getURL() function. Use this method when the URL is to be used for HTTP redirection.

Specified by:
getRedirectURLString in interface URLRepository
Parameters:
response - The response that possibly needs to encode the URL
See Also:
HttpServletResponse.getRedirectURL()

getURLString

public java.lang.String getURLString(java.lang.String name,
                                     javax.servlet.http.HttpServletResponse response,
                                     java.lang.String parameters)
Behaves the same as getURL, only returns string instead of a URL.

Specified by:
getURLString in interface URLRepository
Parameters:
response - The response that possibly needs to encode the URL
parameters - URL parameters for a GET method, must include the question mark '?' as the first character.
See Also:
getURL(java.lang.String)

getURLString

public java.lang.String getURLString(java.lang.String name,
                                     javax.servlet.http.HttpServletResponse response)
Description copied from interface: URLRepository
Returns URL as a string, otherwise the same as getURL() function No paramters are provided.

Specified by:
getURLString in interface URLRepository
Parameters:
response - The response that possibly needs to encode the URL
See Also:
URLRepository.getURL(java.lang.String, javax.servlet.http.HttpServletResponse, java.lang.String)

registerURL

public void registerURL(java.lang.String name,
                        java.lang.String page)
Specified by:
registerURL in interface URLRepository

loadRepository

public void loadRepository(java.io.Reader reader)
Description copied from interface: URLRepository
Obtain the url-repository information from this Reader.

Specified by:
loadRepository in interface URLRepository

loadRepository

public void loadRepository(java.io.File file)
Description copied from interface: URLRepository
Read the url-repository information from this file.

Specified by:
loadRepository in interface URLRepository

loadRepository

public void loadRepository(java.lang.String str)
Description copied from interface: URLRepository
Read the url-repository information from this file specified as a filename.

Specified by:
loadRepository in interface URLRepository

defineVariable

public void defineVariable(java.lang.String name,
                           java.lang.String replacement)
Description copied from interface: URLRepository
Defines a new variable with the given value.

Specified by:
defineVariable in interface URLRepository

translateURL

protected java.net.URL translateURL(java.lang.String raw_url)
Returns the URL as translated from the raw_url. Uses the variables available at the time of the call to expand raw_url.


replaceVariable

protected void replaceVariable(java.lang.StringBuffer sb_url,
                               java.lang.String name,
                               java.lang.String replacement)
Expand all the variables found in sb_url.


toString

public java.lang.String toString()
Lists each association on one line, in the style of the text repository file, but with the URL expanded.

Specified by:
toString in interface URLRepository
Overrides:
toString in class java.lang.Object

removeVariable

protected void removeVariable(java.lang.StringBuffer sb,
                              int start,
                              int count)


Copyright @ 2003 Mount Sinai School of Medicine. All Rights Reserved.