jpl.mipl.mdms.FileService.komodo.api
Class Session

java.lang.Object
  extended byjpl.mipl.mdms.FileService.komodo.api.Session

public class Session
extends Object

Implements the Session session class. The constructor takes a user name and password, security mode, and domain?

Version:
$Id: Session.java,v 1.16 2003/11/25 01:03:14 txh Exp $
Author:
J. Jacobson

Constructor Summary
Session(String domainFile, int securityModel)
          Constructor
Session(String userName, String password, String domainFile, int securityModel)
          Constructor
Session(URL domainFile, int securityModel)
          Another constructor
 
Method Summary
 int changePassword(String oldPassword, String newPassword)
          Change password.
 int close()
          Close all clients.
 void close(FileType type)
          Start closing all file types, disconnect from all servers.
 void closeImmediate()
          close all file types, disconnect from all servers, wait for close to complete and throw away all pending results.
 void dump()
          Dump Komodo class to stderr, and any interesting has-a classes.
 boolean getAddVFT()
          Method to check if user has add vft priv
 Admin getAdminConnection(String serverName, boolean useAdminPort, boolean debug)
          Method to connection to an admin session
static float getApiVersion()
          Get the api version.
static String getApiVersionString()
          Get the api version string.
 LinkedList getCapabilities()
          method to return a list of capabilities for all file types
 Capability getCapabilities(String fileType)
          Method to return capabilities specific to the input file type
 String getDir()
          Get directory associated with this session.
 LinkedList getFileTypeList()
          Get a sorted list of file types.
 String getFTServerGroup(String fileTypeName)
          Method to get a server group name from a file type name.
 boolean getOption(int option)
          Method to return the option value
 String getPassword()
          Get password for this Komodo session.
 String getRegistory()
          Get restart directory.
 int getSecurityModel()
          Get the type of security for this session, e.g.: Kerberos, SSL, none.
 String getServerGroup(String serverName)
          Method to get a server group name from a server name.
 int getTcpEndPort()
          Method to get TCP port end value
 int getTcpStartPort()
          Method to get TCP port start value
 int getTransactionCount()
          Get the current transaction count.
 int getTransactionId()
          Get new transaction id.
 int getUserAccess()
          Get user access, Session.ADMIN, Session.READALL, Session.WRITEALL.
 String getUserAccessStr()
          Get user access, Session.ADMIN, Session.READALL, Session.WRITEALL.
 String getUserName()
          Get user name for this Komodo session.
 LinkedList getVFTCapabilities()
          getVFTCapabilities
 Capability getVFTCapabilities(String vft)
          Method to return a capability object specific to the input vft
static void init()
          optional initialization
Call to get a head start on loading classes.
 boolean isConnected(String fileTypeName)
          See if a file type already has a server proxy connection.
 int makeDomainFile(String domainFilePath)
          Make a domain file.
 FileType open(String fileTypeName)
          Open a file type
 Admin openAdmin(String serverName)
          Method to open an admin session
 void postResult(Result result)
          Method to post a result to the result queue.
 Result result()
          Get the next profile representing a command result.
 Result result(int timeDelay)
          Get the next profile representing a command result.
 String setDirectory(String path)
          setDirectory for the session.
 void setLoginInfo(String userName, String password)
          Set login information.
 boolean setOption(int option, boolean value)
          Method to enable/disable an option
 void setTcpPortRange(int start, int end)
          Method to set TCP port range
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Session

public Session(String domainFile,
               int securityModel)
        throws SessionException
Constructor

Parameters:
domainFile - the full path to a domain file.
securityModel - Session.SSL, Session.kerberos, or Session.INSECURE
Throws:
SessionException - when session init failure

Session

public Session(URL domainFile,
               int securityModel)
        throws SessionException
Another constructor

Parameters:
domainFile - URL location of domainFile
securityModel - Session.SSL, Session.kerberos, or Session.INSECURE
Throws:
SessionException - when session failure

Session

public Session(String userName,
               String password,
               String domainFile,
               int securityModel)
        throws SessionException
Constructor

Parameters:
userName - the user name to connect to the service.
password - the user password to connect to the service.
domainFile - the full path to a domain file.
securityModel - Session.SSL, Session.kerberos, or Session.INSECURE
Throws:
SessionException - when session failure
Method Detail

init

public static void init()
optional initialization
Call to get a head start on loading classes. This is because just loading the classes needed by SSLSecureSocket factory takes ~20 seconds.


getApiVersion

public static final float getApiVersion()
Get the api version.

Returns:
apiVersion The current vervsion represented as a decimal number.

getApiVersionString

public static final String getApiVersionString()
Get the api version string.

Returns:
apiVersionString current version represented as a decimal number.

getRegistory

public String getRegistory()
Get restart directory.

Returns:
restart file directory location.

setLoginInfo

public final void setLoginInfo(String userName,
                               String password)
Set login information. Used to reset login name and password. This is used for invalid login recovery.

Parameters:
userName - the user name
password - the user password

getSecurityModel

public final int getSecurityModel()
Get the type of security for this session, e.g.: Kerberos, SSL, none.

Returns:
an integer value, represting the type of security.

setOption

public boolean setOption(int option,
                         boolean value)
Method to enable/disable an option

Parameters:
option - the option
value - the on/off flag
Returns:
previous values of option

getOption

public boolean getOption(int option)
Method to return the option value

Parameters:
option - the option
Returns:
boolean value for option.

setDirectory

public String setDirectory(String path)
                    throws SessionException
setDirectory for the session. This applies to functions, like getChecksum (), that operate on file independent of file type.

Parameters:
path - the string directory
Returns:
the string old directory
Throws:
SessionException - when session failure

getDir

public String getDir()
Get directory associated with this session.

Returns:
String directory.

getCapabilities

public Capability getCapabilities(String fileType)
                           throws SessionException
Method to return capabilities specific to the input file type

Parameters:
fileType - the file type name
Returns:
Capabilities for a specific file type.
Throws:
SessionException - when session failure

getCapabilities

public LinkedList getCapabilities()
                           throws SessionException
method to return a list of capabilities for all file types

Returns:
a list of Capabilities for all file types where a user has capabilities.
Throws:
SessionException - when session failure

getVFTCapabilities

public LinkedList getVFTCapabilities()
                              throws SessionException
getVFTCapabilities

Returns:
a list of Capabilities all VFT where a user has capabilities.
Throws:
SessionException - when session failure

getVFTCapabilities

public Capability getVFTCapabilities(String vft)
                              throws SessionException
Method to return a capability object specific to the input vft

Parameters:
vft - the virtual file type
Returns:
Capabilities for a specific VFT
Throws:
SessionException - when session failure

getUserAccess

public int getUserAccess()
                  throws SessionException
Get user access, Session.ADMIN, Session.READALL, Session.WRITEALL. Returns Session.NOT_SET if not initialized.

Returns:
user access value
Throws:
SessionException - when session failure

getAddVFT

public boolean getAddVFT()
                  throws SessionException
Method to check if user has add vft priv

Returns:
true if user has the ability to add VFT.
Throws:
SessionException - when session failure

getUserAccessStr

public String getUserAccessStr()
Get user access, Session.ADMIN, Session.READALL, Session.WRITEALL.

Returns:
user access string value

changePassword

public int changePassword(String oldPassword,
                          String newPassword)
                   throws SessionException
Change password. To be safe, only let the user to change passwords when there are no outstanding transactions. This way, we can avoid problems tracking down the correct result before closing our utility connection.

Parameters:
oldPassword - the old password
newPassword - the new password
Returns:
Transaction id.
Throws:
SessionException - when session failure

makeDomainFile

public int makeDomainFile(String domainFilePath)
                   throws SessionException
Make a domain file.

Parameters:
domainFilePath - the new domain file path.
Returns:
Transaction id.
Throws:
SessionException - when session failure

setTcpPortRange

public void setTcpPortRange(int start,
                            int end)
                     throws SessionException
Method to set TCP port range

Parameters:
start - the start value
end - the end value
Throws:
SessionException - when session failure

getTcpStartPort

public int getTcpStartPort()
Method to get TCP port start value

Returns:
tcp lower port limit for client side port

getTcpEndPort

public int getTcpEndPort()
Method to get TCP port end value

Returns:
tcp upper port limit for client side port

open

public FileType open(String fileTypeName)
              throws SessionException
Open a file type

Parameters:
fileTypeName - file type to open.
Returns:
a file type object reference
Throws:
SessionException - when session failure

getFTServerGroup

public String getFTServerGroup(String fileTypeName)
                        throws SessionException
Method to get a server group name from a file type name.

Parameters:
fileTypeName - the name of the filetype
Returns:
The server group name
Throws:
SessionException - when session failure

getServerGroup

public String getServerGroup(String serverName)
                      throws SessionException
Method to get a server group name from a server name.

Parameters:
serverName - the name of the filetype
Returns:
The server group name
Throws:
SessionException - when session failure

openAdmin

public Admin openAdmin(String serverName)
                throws SessionException
Method to open an admin session

Parameters:
serverName - open a server w/o a file type, enrolls connection into list.
Returns:
an admin object reference
Throws:
SessionException - when session failure

getAdminConnection

public Admin getAdminConnection(String serverName,
                                boolean useAdminPort,
                                boolean debug)
                         throws SessionException
Method to connection to an admin session

Parameters:
serverName - open a server w/o a file type.
useAdminPort - flag to indicate to use an defined admin port
debug - the debug flag
Returns:
an admin object reference
Throws:
SessionException - when session failure.

postResult

public void postResult(Result result)
Method to post a result to the result queue.

Parameters:
result - the file profile

getTransactionCount

public int getTransactionCount()
Get the current transaction count.

Returns:
transaction count

closeImmediate

public void closeImmediate()
close all file types, disconnect from all servers, wait for close to complete and throw away all pending results.


close

public int close()
          throws SessionException
Close all clients. If the application program wants to synch-up on this close, then wait on the Komodo result queue for the close command result. The close request goes into the queue as a transaction. The result of the close will appear on the results queue.

Returns:
transaction id.
Throws:
SessionException - when session failure

close

public void close(FileType type)
           throws SessionException
Start closing all file types, disconnect from all servers. The application may then synch up by calling result until the transaction count goes to zero. If flushResults is true, wait for close to complete and throw away all pending results. Also, close all admin clients.

Parameters:
type - the file type to close. If null, close all file types.
Throws:
SessionException - when session failure

isConnected

public boolean isConnected(String fileTypeName)
                    throws SessionException
See if a file type already has a server proxy connection.

Parameters:
fileTypeName - the file type name
Returns:
true if is connected
Throws:
SessionException - when session failure

result

public Result result()
              throws SessionException
Get the next profile representing a command result. Wait forever for the result. Decrements transaction count on EoT. Returns the EoT profile on some commands (add, for example). On commands that can return multiple results, such as get file by regular expression, do not return the EoT profile.

Returns:
a result object. null profile if the transaction count is already zero.
Throws:
SessionException - when session failure

result

public Result result(int timeDelay)
              throws SessionException
Get the next profile representing a command result. Block until a specified number of milleseconds for a result.

Parameters:
timeDelay - time in seconds.
Returns:
the result object
Throws:
SessionException - when session failure

getTransactionId

public int getTransactionId()
Get new transaction id. Also increments the transaction count.

Returns:
the transaction id

getUserName

public final String getUserName()
Get user name for this Komodo session.

Returns:
user name

getPassword

public final String getPassword()
Get password for this Komodo session.

Returns:
the password

getFileTypeList

public LinkedList getFileTypeList()
Get a sorted list of file types.

Returns:
the list of file types

dump

public void dump()
          throws SessionException
Dump Komodo class to stderr, and any interesting has-a classes.

Throws:
SessionExceptin - when session failure
SessionException