net.agmodel.resData
Class ResourceHTTP

java.lang.Object
  |
  +--net.agmodel.genericBroker.ServiceHTTP
        |
        +--net.agmodel.genericBroker.ServerHTTP
              |
              +--net.agmodel.resData.ResourceHTTP

public class ResourceHTTP
extends ServerHTTP

Handles:
database connections,
requests for details of databases and weather stations, and
requests for weather data.

Typically a client establishes a MetBroker session through a call to ServerHTTP.getConnection(String,String).
The session manages connections to ResourceServer.


Field Summary
static int ADDVIEWLANGUAGE
           
static int CHANGEPASSWORD
           
static int GETEDITLANGUAGE
           
static int GETITEMDESCRIPTION
           
static int GETLANGUAGENAME
           
static int GETRESITEM
           
static int GETRESITEMS
           
static int GETTRANSLATORFILESET
           
static int GETUSERFILESET
           
static int GETVIEWLANGUAGE
           
static String HTTPHOSTPARAM
           
static String HTTPPORTPARAM
           
static int LISTFILESET
           
static int LISTLANGUAGES
           
static int REMOVEVIEWLANGUAGE
           
 
Fields inherited from class net.agmodel.genericBroker.ServerHTTP
CONNECT, CONNECTUSER, DISCONNECT
 
Fields inherited from class net.agmodel.genericBroker.ServiceHTTP
HOSTPARAMEXTENSION, PORTPARAMEXTENSION, servlet
 
Constructor Summary
ResourceHTTP(String host)
           
ResourceHTTP(String host, int port)
           
 
Method Summary
 void addViewLanguage(String sessionID, String[] viewLanguage)
          Adds the new viewLanguages into the perticular translator's viewLanguage list.
 void changePassword(String sessionID, String password)
          Replaces the old password with new password entered by a prticular translator.
 String getEditLanguage(String sessionID)
          Get the editLanguage of a translator.
 String getLanguageName(String sessionID, String readerID, String languageID)
          Get the languageName for a languageID .
 ResItem getResItem(String sessionID, String languageID, String fileSet, String itemKey)
          Get the relevant text for a single id.
 ResItem[] getResItems(String sessionID, String languageID, String fileSet, String[] itemKey)
          Get the relevant text for a set if ids.
protected  String getServletPath()
           
 TranslatorFileSet getTranslatorFileSet(String sessionID, String fileSetID)
          Get the TranslatorFileSet object for a specific fileSetID.
 UserFileSet getUserFileSet(String sessionID, String languageID, String fileSetID)
          Get the UserFileSet object for a specific languageID and fileSetID.
 String[] getViewLanguage(String userType, String username)
          Get the ViewLanguages of a perticular (user)translator
 String[] listFileSet(String sessionID)
          Get the list of ResFileSet.
 String[] listLanguages(String sessionID, String readerID)
          Get the list of all languages.
 void removeViewLanguage(String sessionID, String viewLanguage)
          Removes the viewLanguage from a perticular translator's viewLanguage list.
 
Methods inherited from class net.agmodel.genericBroker.ServerHTTP
disconnect, getConnection, getConnection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HTTPHOSTPARAM

public static final String HTTPHOSTPARAM
See Also:
Constant Field Values

HTTPPORTPARAM

public static final String HTTPPORTPARAM
See Also:
Constant Field Values

LISTFILESET

public static final int LISTFILESET
See Also:
Constant Field Values

GETLANGUAGENAME

public static final int GETLANGUAGENAME
See Also:
Constant Field Values

GETUSERFILESET

public static final int GETUSERFILESET
See Also:
Constant Field Values

GETRESITEM

public static final int GETRESITEM
See Also:
Constant Field Values

GETRESITEMS

public static final int GETRESITEMS
See Also:
Constant Field Values

GETTRANSLATORFILESET

public static final int GETTRANSLATORFILESET
See Also:
Constant Field Values

GETEDITLANGUAGE

public static final int GETEDITLANGUAGE
See Also:
Constant Field Values

GETVIEWLANGUAGE

public static final int GETVIEWLANGUAGE
See Also:
Constant Field Values

ADDVIEWLANGUAGE

public static final int ADDVIEWLANGUAGE
See Also:
Constant Field Values

REMOVEVIEWLANGUAGE

public static final int REMOVEVIEWLANGUAGE
See Also:
Constant Field Values

CHANGEPASSWORD

public static final int CHANGEPASSWORD
See Also:
Constant Field Values

LISTLANGUAGES

public static final int LISTLANGUAGES
See Also:
Constant Field Values

GETITEMDESCRIPTION

public static final int GETITEMDESCRIPTION
See Also:
Constant Field Values
Constructor Detail

ResourceHTTP

public ResourceHTTP(String host)
             throws GeneralException

ResourceHTTP

public ResourceHTTP(String host,
                    int port)
             throws GeneralException
Method Detail

getServletPath

protected String getServletPath()
Specified by:
getServletPath in class ServiceHTTP

listFileSet

public String[] listFileSet(String sessionID)
                     throws GeneralException
Get the list of ResFileSet.

Parameters:
sessionID - the ID returned by getConnection
Returns:
the list of fileset that the ResourceServer holds
GeneralException

getLanguageName

public String getLanguageName(String sessionID,
                              String readerID,
                              String languageID)
                       throws GeneralException
Get the languageName for a languageID .

Parameters:
sessionID - the ID returned by getConnection
readerID - the readers preferred LanguageID in which name for a languageId is needed
languageID - the languageID for which languageName is needed
Returns:
a name for languageID
GeneralException

getUserFileSet

public UserFileSet getUserFileSet(String sessionID,
                                  String languageID,
                                  String fileSetID)
                           throws GeneralException
Get the UserFileSet object for a specific languageID and fileSetID.

Parameters:
sessionID - the ID returned by getConnection
languageID - specifies language in which object for UserFileSet is to be neede
fileSetID - specifies the resource for which UserFileSet object is needed
Returns:
the requested TranslatorFileSet object
GeneralException

getResItem

public ResItem getResItem(String sessionID,
                          String languageID,
                          String fileSet,
                          String itemKey)
                   throws GeneralException
Get the relevant text for a single id.

Parameters:
sessionID - the ID returned by getConnection
languageID - specifies language in which text for an id to get
itemKey - specifies the id(key)for which text is to be obtained
Returns:
the requested text
GeneralException

getResItems

public ResItem[] getResItems(String sessionID,
                             String languageID,
                             String fileSet,
                             String[] itemKey)
                      throws GeneralException
Get the relevant text for a set if ids.

Parameters:
sessionID - the ID returned by getConnection
languageID - specifies language in which texts for an ids to get
Returns:
the requested text for each id
GeneralException

getTranslatorFileSet

public TranslatorFileSet getTranslatorFileSet(String sessionID,
                                              String fileSetID)
                                       throws GeneralException
Get the TranslatorFileSet object for a specific fileSetID.

Parameters:
sessionID - the ID returned by getConnection
fileSetID - specifies the resource for which TranslatorFileSet object is needed
Returns:
the requested TranslatorFileSet object
GeneralException

getViewLanguage

public String[] getViewLanguage(String userType,
                                String username)
                         throws GeneralException
Get the ViewLanguages of a perticular (user)translator

Parameters:
userType - the type of user(eg: "translator" or "supervisror" or "user")
username - specifies the name of a user(tanslator)
Returns:
the requested viewLanguages
GeneralException

addViewLanguage

public void addViewLanguage(String sessionID,
                            String[] viewLanguage)
                     throws GeneralException
Adds the new viewLanguages into the perticular translator's viewLanguage list.

Parameters:
sessionID - the ID returned by getConnection
viewLanguage - specifies the array of viewLanguage to be added into translator's viewLanguage list
GeneralException

removeViewLanguage

public void removeViewLanguage(String sessionID,
                               String viewLanguage)
                        throws GeneralException
Removes the viewLanguage from a perticular translator's viewLanguage list.

Parameters:
sessionID - the ID returned by getConnection
viewLanguage - specifies the viewLanguage to be removed from the translator's viewLanguage list
GeneralException

getEditLanguage

public String getEditLanguage(String sessionID)
                       throws GeneralException
Get the editLanguage of a translator.

Parameters:
sessionID - the ID returned by getConnection
Returns:
a editLanguage
GeneralException

listLanguages

public String[] listLanguages(String sessionID,
                              String readerID)
                       throws GeneralException
Get the list of all languages.

Parameters:
sessionID - the ID returned by getConnection
readerID - the readers preferred LanguageID in which language list is needed
Returns:
the requested list of languages
GeneralException

changePassword

public void changePassword(String sessionID,
                           String password)
                    throws GeneralException
Replaces the old password with new password entered by a prticular translator.

Parameters:
sessionID - the ID returned by getConnection
password - specifies the new password enterd by the translator
GeneralException