com.ibm.edms.od
Class ODServer

java.lang.Object
  |
  +--com.ibm.edms.od.ODServer

public class ODServer
extends java.lang.Object

A class representing a connection to an OnDemand server. From this class you can logon, logoff and change the password. After a successful logon, this object will contain a list of all folders the session has access to. For example:

    ODServer od = new ODServer();
 
Note: Access to this server object should be done in a single threaded environment. The only exception is when cancelling a server operation.

(C) Copyright IBM Corp. 1993, 2002. All Rights Reserved

See Also:
cancel()

Constructor Summary
ODServer()
          The class constructor.
 
Method Summary
 void cancel()
          Cancel the current search or retrieve operation.
 void changePassword(java.lang.String newPassword)
          Change the user's password.
 char getConnectType()
          Get the connection type used during logon.
 java.lang.String getFolderDescription(java.lang.String fldName)
          Get the folder description for the specified folder.
 java.util.Enumeration getFolderNames()
          Return a list of folder names accessable to the user.
 java.util.Enumeration getFolderNames(java.lang.String criteria)
          Return a list of folder names.
 java.lang.String getLocalDir()
          Get the OD local server directory.
 int getNumFolders()
          Get the number of folders for which the user associated with this server object has access to.
 int getNumFolders(java.lang.String criteria)
          Get the number of folders.
 java.lang.String getPassword()
          Return the user's password.
 int getPort()
          Get the port used for logon.
 java.lang.String getServerName()
          Get the server name.
 java.lang.String getUserId()
          Get the name of the user.
 void initialize(java.lang.String configDir, java.lang.String applicationName)
          Initialize the connection to the OnDemand server.
 void logoff()
          This method will log the user off of the OD server.
 void logon()
          This method is used to logon to the server.
 void logon(java.lang.String server, java.lang.String user, java.lang.String password)
          This method is used to logon to the server.
 void logon(java.lang.String server, java.lang.String user, java.lang.String password, char connectType, int port, java.lang.String localDir)
          This method is used to logon to the server.
 ODFolder openFolder(java.lang.String fldName)
          This method will open the specified folder.
 byte[] retrieve(java.lang.String docid, java.lang.String fldName, java.lang.String viewer)
          Retrieve document data.
 void setApplicationName(java.lang.String applicationName)
          Set the web applications path.
 void setConnectType(char connectType)
          This method is used to set the server connection type.
 void setLocalDir(java.lang.String localDir)
          Set the OD local server directory.
 void setPassword(java.lang.String password)
          Set the password for the user.
 void setPort(int port)
          Set the OD port number.
 void setServer(java.lang.String server)
          Set the name of the OD server to connect with.
 void setUserId(java.lang.String user)
          Set the name of the user to log onto OD with.
 void terminate()
          Terminate the connection to the OnDemand server.
 byte[] viewerPassthru(java.lang.String queryStr)
          This method is used to pass ODWEK document viewer requests for data through to the ODWEK code.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ODServer

public ODServer()
The class constructor.
Method Detail

initialize

public void initialize(java.lang.String configDir,
                       java.lang.String applicationName)
                throws ODException
Initialize the connection to the OnDemand server. This method must be called after object creation and before the logon method is called.
Parameters:
configDir - The directory where the arswww.ini file exists.
applicationName - The servlet/CGI application name. This is only used when retrieving a document for viewing and one of ODWEK's viewers is invoked.
Throws:
ODException -  
See Also:
setApplicationName(java.lang.String)

terminate

public void terminate()
Terminate the connection to the OnDemand server. This method is to be called when you are done with the server object.

cancel

public void cancel()
Cancel the current search or retrieve operation. To issue this call you will need to create another thread and make the call from that thread using the same ODServer object that the search/retrieve call was made from.
Notes:
  1. For search methods a successful cancel call is not considered an error and therefore a partial hit list may be returned.
  2. For retrieve methods a successful cancel call is considered an error and therefore the retrieve method call will throw an exception.

logon

public void logon(java.lang.String server,
                  java.lang.String user,
                  java.lang.String password,
                  char connectType,
                  int port,
                  java.lang.String localDir)
           throws java.lang.Exception
This method is used to logon to the server. If successful, this method will create a list of all folders the user has access to.
Parameters:
server - The name of the OD server.
user - The name of the user.
password - The user's password.
connectType - The connection protocol to use.
port - The port on which the OD server is listening. The default is 0.
localDir - This parameter is to be used for local OD servers only.
Throws:
java.lang.Exception -  
See Also:
getFolderNames(), ODConstant.CONNECT_TYPE_TCPIP

logon

public void logon(java.lang.String server,
                  java.lang.String user,
                  java.lang.String password)
           throws java.lang.Exception
This method is used to logon to the server.
Parameters:
server - The name of the OD server.
user - The name of the user.
password - The user's password.
Throws:
java.lang.Exception -  
See Also:
logon(String,String,String,char,int,String)

logon

public void logon()
           throws java.lang.Exception
This method is used to logon to the server.
Throws:
java.lang.Exception -  
See Also:
This method is to be called only after setServer, setUserId and setPassword have been called.

logoff

public void logoff()
            throws java.lang.Exception
This method will log the user off of the OD server.
Throws:
java.lang.Exception -  

changePassword

public void changePassword(java.lang.String newPassword)
                    throws java.lang.Exception
Change the user's password. This method will log the user on if the logon method was not previously called.
Parameters:
newPassword - The user's new password.
Throws:
java.lang.Exception -  

openFolder

public ODFolder openFolder(java.lang.String fldName)
                    throws java.lang.Exception
This method will open the specified folder.
Parameters:
fldName - Name of folder to open.
Returns:
ODFolder This object contains folder criteria information and is the object which searches can be performed against.
Throws:
java.lang.Exception -  
See Also:
ODFolder

retrieve

public byte[] retrieve(java.lang.String docid,
                       java.lang.String fldName,
                       java.lang.String viewer)
                throws java.lang.Exception
Retrieve document data.
Parameters:
docid - The document identifier as returned from the search method.
fldName - Specifies the folder for the document.
viewer - Specifies if any conversion is to be applied to the data.
Returns:
A byte array containing the document data. Note: When using ODWEK applets to view documents the data returned from this call is an html page containing a reference to the ODWEK applet. You should return this data without modification to the browser. Once the applet is loaded it will call back to your application to request the data. This call is based upon the application name specified either during the initialize method or the setApplicationName method.
Throws:
java.lang.Exception -  
See Also:
ODConstant, viewerPassthru(java.lang.String), initialize(java.lang.String, java.lang.String), setApplicationName(java.lang.String)

viewerPassthru

public byte[] viewerPassthru(java.lang.String queryStr)
                      throws java.lang.Exception
This method is used to pass ODWEK document viewer requests for data through to the ODWEK code.
Parameters:
queryStr - The query string as sent from the ODWEK document viewer.
Returns:
byte[] A byte array containing data to be sent back to the ODWEK document viewer.
Throws:
java.lang.Exception -  
See Also:
retrieve(java.lang.String, java.lang.String, java.lang.String)

getNumFolders

public int getNumFolders()
                  throws java.lang.Exception
Get the number of folders for which the user associated with this server object has access to.
Returns:
int The number of folders accessable to the user.
Throws:
java.lang.Exception -  

getNumFolders

public int getNumFolders(java.lang.String criteria)
                  throws java.lang.Exception
Get the number of folders. This method will query the server for the folders which match the specified criteria.
Parameters:
criteria - Folder search criteria. This can include wild cards. Examples include: 'Credit%', 'C%', etc... A complete folder name may be specified as well which results in only one folder being returned. Any folder list previously retrieve will be replaced by the result of this call.
Returns:
int The number of folders accessable to the user based upon the criteria specified.
Throws:
java.lang.Exception -  

getFolderNames

public java.util.Enumeration getFolderNames()
                                     throws java.lang.Exception
Return a list of folder names accessable to the user.
Returns:
An enumeration containing all folders accessable to the user.
Throws:
java.lang.Exception -  

getFolderNames

public java.util.Enumeration getFolderNames(java.lang.String criteria)
                                     throws java.lang.Exception
Return a list of folder names. This method will query the server for the folders which match the specified criteria.
Parameters:
criteria - Folder search criteria. This can include wild cards. Examples include: 'Credit%', 'C%', etc... A complete folder name may be specified as well which results in only one folder being returned. Any folder list previously retrieve will be replaced by the result of this call.
Returns:
Enumeration An enumeration containing all folders accessable to the user based upon the criteria specified.
Throws:
java.lang.Exception -  

getFolderDescription

public java.lang.String getFolderDescription(java.lang.String fldName)
                                      throws java.lang.Exception
Get the folder description for the specified folder.
Parameters:
fldName - The name of the folder to retrieve a description for.
Returns:
String The description of the specified folder.
Throws:
java.lang.Exception -  

getServerName

public java.lang.String getServerName()
Get the server name.
Returns:
String The name of the server.

setServer

public void setServer(java.lang.String server)
Set the name of the OD server to connect with. This name can be an alias name if the arswww.ini file is properly configured.
Parameters:
server - Name of the OnDemand server.

getUserId

public java.lang.String getUserId()
Get the name of the user.
Returns:
String The name of the user.

setUserId

public void setUserId(java.lang.String user)
Set the name of the user to log onto OD with.
Parameters:
user - The name of the user.

getPassword

public java.lang.String getPassword()
Return the user's password.
Returns:
String The user's password.

setPassword

public void setPassword(java.lang.String password)
Set the password for the user. This method does not change the user's password.
Parameters:
password - The user's password, to be used during logon.
See Also:
changePassword(java.lang.String)

getConnectType

public char getConnectType()
Get the connection type used during logon.
Returns:
The connection type used to connect to OD with.
See Also:
ODConstant.CONNECT_TYPE_TCPIP

setConnectType

public void setConnectType(char connectType)
                    throws ODException
This method is used to set the server connection type.
Parameters:
connectType - Connection type to use during logon.
Throws:
ODException -  
See Also:
ODConstant.CONNECT_TYPE_TCPIP

getPort

public int getPort()
Get the port used for logon.
Returns:
The server port number.

setPort

public void setPort(int port)
Set the OD port number.
Parameters:
port - OD port number

getLocalDir

public java.lang.String getLocalDir()
Get the OD local server directory.
Returns:
Local OD server directory name.

setLocalDir

public void setLocalDir(java.lang.String localDir)
Set the OD local server directory.
Parameters:
localDir - Local directory

setApplicationName

public void setApplicationName(java.lang.String applicationName)
Set the web applications path. For cgi/servlet applications this method is used to specify the path to be used for any callbacks to the web server from ODWEK document viewers running within a web browser.
Parameters:
applicationName - The applications name relative to a web server, i.e., "/servlets/MyServlet".