uk.ac.ebi.intact.application.editor.business
Class EditorService

java.lang.Object
  |
  +--uk.ac.ebi.intact.application.editor.business.EditorService

public class EditorService
extends java.lang.Object

This class provides the general editor services common to all the users.

Version:
$Id: EditorService.java,v 1.17 2004/03/30 21:23:07 smudali Exp $
Author:
Sugath Mudali (smudali@ebi.ac.uk)

Method Summary
 java.lang.String getClassName(java.lang.String topic)
          Returns the class name associated with the given topic.
 java.lang.String getHelpURL(javax.servlet.http.HttpServletRequest request)
          Returns the relative link to the help page.
static EditorService getInstance()
          Returns the only instance of this class using the default resources file.
static EditorService getInstance(java.lang.String name)
          Returns the only instance of this class using given resources file.
 java.util.Collection getIntactTypes()
          Returns a collection of Intact types.
 int getInteger(java.lang.String key)
          Retrieves the resource for given key from the editor resource file as an int.
 int getInteractionLimit()
          A convenient method to return the interaction limit for JSPs.
 java.lang.String getInteractionPageLimit()
          A convenient method to return the interaction per page limit for JSPs.
 java.lang.String getResource(java.lang.String key)
          Retrieves the resource for given key from the editor resource file.
 java.lang.String getSearchURL(javax.servlet.http.HttpServletRequest request)
          Returns the relative link to the search application.
 java.lang.String getTopic(java.lang.Class clazz)
          Returns the topic name for given class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static EditorService getInstance()
Returns the only instance of this class using the default resources file. However, if this instance has already been initialized by getInstance(String), it will be returned instead (i.e, the default resource is ignored).

Returns:
the only instance of this class or null for any errors.
See Also:
getInstance(String)

getInstance

public static EditorService getInstance(java.lang.String name)
                                 throws EmptyTopicsException
Returns the only instance of this class using given resources file. This method not synchronized because it is only invoked by EditorActionServlet at the init stage.

Parameters:
name - the resource file name.
Returns:
the only instance of this class.
Throws:
EmptyTopicsException - thrown for an empty resource file.

getClassName

public java.lang.String getClassName(java.lang.String topic)
Returns the class name associated with the given topic.

Parameters:
topic - the topic to search in the Intact types resource.
Returns:
the classname saved under topic.

getTopic

public java.lang.String getTopic(java.lang.Class clazz)
Returns the topic name for given class.

Parameters:
clazz - the Class object to extract the tipic name.
Returns:
the class name without the package prefix. The returned value equals to given class's class name if there is no package information associated with clazz

getIntactTypes

public java.util.Collection getIntactTypes()
Returns a collection of Intact types.

Returns:
an ArrayList of Intact types. The list sorted on an alphabetical order. Since this reference refers to this class's internal cache, handle this reference with care (do not modify contents).

getSearchURL

public java.lang.String getSearchURL(javax.servlet.http.HttpServletRequest request)
Returns the relative link to the search application.

Parameters:
request - the request object to get the context path. This is only used once when this method is called for the first time. For subsequent calls, the cached value is returned.
Returns:
the relative path to the search page.

getHelpURL

public java.lang.String getHelpURL(javax.servlet.http.HttpServletRequest request)
Returns the relative link to the help page.

Parameters:
request - the request object to get the context path. This is only used once when this method is called for the first time. For subsequent calls, the cached value is returned.
Returns:
the relative path to the help page.

getResource

public java.lang.String getResource(java.lang.String key)
Retrieves the resource for given key from the editor resource file.

Parameters:
key - the key to search for the resource.
Returns:
the resource for key if it is found.

getInteger

public int getInteger(java.lang.String key)
Retrieves the resource for given key from the editor resource file as an int.

Parameters:
key - the key to search for the resource. This must be a key to an integer property.
Returns:
the resource for key if it is found as an integer.

getInteractionLimit

public int getInteractionLimit()
A convenient method to return the interaction limit for JSPs. This method is equivalent to calling getInteger(String) with exp.interaction.limit as the key.

Returns:
the maximum number of interactions allowed to display in the experiment editor.
See Also:
getInteger(String)

getInteractionPageLimit

public java.lang.String getInteractionPageLimit()
A convenient method to return the interaction per page limit for JSPs. This method is equivalent to calling getResource(String) with exp.interaction.page.limit as the key.

Returns:
the maximum number of interactions allowed (per page) to display in the experiment editor.
See Also:
getResource(String)


IntAct Project - EMBL-EBI 2004 - intact-help@ebi.ac.uk