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

java.lang.Object
  extended by jpl.mipl.mdms.FileService.komodo.api.Admin
All Implemented Interfaces:
Closable

public class Admin
extends Object
implements Closable

All actions that can be take on a file type

Version:
$Id: Admin.java,v 1.23 2009/09/03 21:31:50 ntt Exp $
Author:
J. Jacobson, G. Turek

Constructor Summary
Admin(Session session, String serverName, boolean useAdminPort)
          Constructor
 
Method Summary
 int addFileType(String[] args)
          Method to create file type.
 int addFileTypeToRole(String[] args)
          Method to add file type to role
 int addRole(String[] args)
          Method to add new role access
 int addUser(String[] args)
          Method to add new user
 int addUserToRole(String[] args)
          Method to add user to role
 int changePassword(String userName, String password)
          Method to change a user's password, without verifying old password.
 int changePassword(String userName, String oldPassword, String newPassword)
          Method to change a user's password, verifying old password.
 int close()
          Method to close this admin channel.
 int delFileType(String fileType)
          Method to remove file type
 int delFileTypeFromRole(String[] args)
          Method to remove file type from role
 int delRole(String role)
          Method to remove user role
 int delUser(String name)
          Method to remove user
 int delUserFromRole(String[] args)
          Method to remove user
 int dSync(String fileType, Date datetime)
          Method to synchronize file system with data in database
 int fSync(String fileType, Date datetime)
          Method to synchronize database with file system
 String getServerName()
          Accessor method to get the server name
 int hotboot()
          Method to issue a hotboot request to the server.
 int logMessage(String message)
          Method to log a message from admin client to the server log.
 int makeDomainFile(String fileName)
          Method to create a domain file
 int modifyFileType(String[] args)
          Method to modify a filetype field.
 int modifyRole(String[] args)
          Method to modify the set of capabilities associated with a role.
 int modifyUserAccess(String[] args)
          Method to modify user access level.
 int moveBetweenFileTypes(String[] args, boolean preserve, boolean replace)
          Method to move files from one filetype to another within the same server group.
 int setLocks(String[] args)
          Set file lock values.
 int showConnections()
          Method to count number of users connected to server
 int showFileTypes(String name)
          Method to return list of file types in db or info about specific file type
 int showFiletypesForRole(String[] args)
          Method to show filetypes associated with a role
 int showLocks(String[] args)
          Method to show locks of records found in the db
 int showMemory()
          Method to show memory usage
 int showRoles(String role)
          Method to show user records found in the db
 int showRolesForFileType(String[] args)
          Method to show roles associated with a file type
 int showRolesForUser(String[] args)
          Method to show roles associated with a user
 int showServerParameters(String name)
          Method to show user records found in the db
 int showServers()
          Method to show servers
 int showUsers(String name)
          Method to show user records found in the db
 int showUsersForRoles(String[] args)
          Method to show users associated with a role
 int shutdown(String timeout)
          Method to shutdown server
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Admin

public Admin(Session session,
             String serverName,
             boolean useAdminPort)
      throws SessionException
Constructor

Parameters:
session - a transfer session, for maintining file types and connections.
serverName - the Komodo server name
useAdminPort - the admin port uses port + 1 as admin port.
Throws:
SessionException - when failed to initialize
Method Detail

getServerName

public final String getServerName()
Accessor method to get the server name

Returns:
the server name

addFileTypeToRole

public final int addFileTypeToRole(String[] args)
                            throws SessionException
Method to add file type to role

Parameters:
args - arguments to command
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when failed to queue request

addUserToRole

public final int addUserToRole(String[] args)
                        throws SessionException
Method to add user to role

Parameters:
args - arguments to command
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when failed to queue request

dSync

public final int dSync(String fileType,
                       Date datetime)
                throws SessionException
Method to synchronize file system with data in database

Parameters:
fileType - the file type name
datetime - the data time stamp
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when failed to queue request

fSync

public final int fSync(String fileType,
                       Date datetime)
                throws SessionException
Method to synchronize database with file system

Parameters:
fileType - the file type
datetime - the time stamp
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when failed to queue request

hotboot

public final int hotboot()
                  throws SessionException
Method to issue a hotboot request to the server.

Returns:
the transaction id for tracking this command.
Throws:
SessionException - when failed to queue request

makeDomainFile

public final int makeDomainFile(String fileName)
                         throws SessionException
Method to create a domain file

Parameters:
fileName - the domain file name
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when failed to queue request

addFileType

public final int addFileType(String[] args)
                      throws SessionException
Method to create file type.

Parameters:
args - arguments to command
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when failed to queue request

addRole

public final int addRole(String[] args)
                  throws SessionException
Method to add new role access

Parameters:
args - arguments to command
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when failed to queue request

addUser

public final int addUser(String[] args)
                  throws SessionException
Method to add new user

Parameters:
args - arguments to command
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when failed to queue request

changePassword

public final int changePassword(String userName,
                                String password)
                         throws SessionException
Method to change a user's password, without verifying old password.

Parameters:
userName - the user name
password - the user's new password
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when failed to queue request

changePassword

public final int changePassword(String userName,
                                String oldPassword,
                                String newPassword)
                         throws SessionException
Method to change a user's password, verifying old password.

Parameters:
userName - the user name
oldPassword - the user's old password
newPassword - the user's new password
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when failed to queue request

delRole

public final int delRole(String role)
                  throws SessionException
Method to remove user role

Parameters:
role - the role name
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when failed to queue request

delUser

public final int delUser(String name)
                  throws SessionException
Method to remove user

Parameters:
name - the user name
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when failed to queue request

delFileType

public final int delFileType(String fileType)
                      throws SessionException
Method to remove file type

Parameters:
fileType - the file type name
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when failed to queue request

delFileTypeFromRole

public final int delFileTypeFromRole(String[] args)
                              throws SessionException
Method to remove file type from role

Parameters:
args - type and role
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when failed to queue request

delUserFromRole

public final int delUserFromRole(String[] args)
                          throws SessionException
Method to remove user

Parameters:
args - the name and role
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when failed to queue request

showConnections

public final int showConnections()
                          throws SessionException
Method to count number of users connected to server

Returns:
the transaction id for tracking this command.
Throws:
SessionException - when failed to queue request

showRolesForFileType

public final int showRolesForFileType(String[] args)
                               throws SessionException
Method to show roles associated with a file type

Parameters:
args - the name and role
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when failed to queue request

showFiletypesForRole

public final int showFiletypesForRole(String[] args)
                               throws SessionException
Method to show filetypes associated with a role

Parameters:
args - the role and optinal type
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when failed to queue request

showRolesForUser

public final int showRolesForUser(String[] args)
                           throws SessionException
Method to show roles associated with a user

Parameters:
args - the user name
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when failed to queue request

showUsersForRoles

public final int showUsersForRoles(String[] args)
                            throws SessionException
Method to show users associated with a role

Parameters:
args - the role name
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when failed to queue request

showFileTypes

public final int showFileTypes(String name)
                        throws SessionException
Method to return list of file types in db or info about specific file type

Parameters:
name - the file type name
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when failed to queue request

showMemory

public final int showMemory()
                     throws SessionException
Method to show memory usage

Returns:
the transaction id for tracking this command.
Throws:
SessionException - when failed to queue request

showServerParameters

public final int showServerParameters(String name)
                               throws SessionException
Method to show user records found in the db

Parameters:
name - the server name
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when failed to queue request

showServers

public final int showServers()
                      throws SessionException
Method to show servers

Returns:
the transaction id for tracking this command.
Throws:
SessionException - when failed to queue request

showRoles

public final int showRoles(String role)
                    throws SessionException
Method to show user records found in the db

Parameters:
role - the role name
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when failed to queue request

showLocks

public final int showLocks(String[] args)
                    throws SessionException
Method to show locks of records found in the db

Parameters:
args - Array of arguments in position
typeExpr - the name or wildcard expression for filetype
nameExpr - the name or wildcard expression for files
lockValue - value of file lock, acts a filter
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when failed to queue request

showUsers

public final int showUsers(String name)
                    throws SessionException
Method to show user records found in the db

Parameters:
name - the user name
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when failed to queue request

shutdown

public final int shutdown(String timeout)
                   throws SessionException
Method to shutdown server

Parameters:
timeout - the timeout in seconds
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when failed to queue request

close

public final int close()
Method to close this admin channel. Do this by appending the close command at the head of the requests queue. The ServerProxy will then remove any admin requests for from the request queue. If all referneces, file types and admin for this server have been closed, then the connection to the server will be gracefully closed.

Specified by:
close in interface Closable
Returns:
the transaction id for tracking this command.

moveBetweenFileTypes

public final int moveBetweenFileTypes(String[] args,
                                      boolean preserve,
                                      boolean replace)
                               throws SessionException
Method to move files from one filetype to another within the same server group.

Parameters:
args - source filetype, destination filetype, options, expression
preserve - Preserve flag, if true, then modification flag in database will not be modified
replace - Replaces existing file on the server if true
Returns:
transaction id for tracking this command
Throws:
SessionException

modifyFileType

public final int modifyFileType(String[] args)
                         throws SessionException
Method to modify a filetype field.

Parameters:
args - filetype, field, value
Returns:
transaction id for tracking this command
Throws:
SessionException

logMessage

public final int logMessage(String message)
                     throws SessionException
Method to log a message from admin client to the server log.

Parameters:
message - Message to write to log
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when failed to queue request

modifyRole

public final int modifyRole(String[] args)
                     throws SessionException
Method to modify the set of capabilities associated with a role.

Parameters:
args - Array of arguments = [roleName, operation, capString]. operation is one of {add, delete, set}, and capString is a string of the integer interpretation.
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when failed to queue request

modifyUserAccess

public final int modifyUserAccess(String[] args)
                           throws SessionException
Method to modify user access level.

Parameters:
args - Array of arguments = [userName, access level, switch].
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when failed to queue request

setLocks

public final int setLocks(String[] args)
                   throws SessionException
Set file lock values.

Parameters:
args - Array of arguments = [filetype expr, file expr, new value] or [filetype expr, file expr, new value, old value].
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when failed to queue request