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

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

public class FileType
extends Object

This class defines all operations that can be performed on a file type

Version:
$Id: FileType.java,v 1.31 2004/11/18 18:16:44 txh Exp $
Author:
G. Turek

Constructor Summary
FileType(Session session, FileTypeInfo ftInfo)
          Constructor
 
Method Summary
 int add(String regexp)
          Method to add with regular expression
 int add(String[] fileNames)
          Method to add a list of files
 int add(String[] fileNames, String comment)
          Method to add a list of files with comment
 int add(String fileName, byte[] buffer, long length, String comment)
          Method to add in-memory file.
 int add(String regexp, String comment)
          Method to add file with regular expression
 int addAndRef(String regexp, String vft, String linkDirectory)
          Method to add and reference files with regular expression.
 int archive(String fileName)
          Method to remove archive notation from a file
 int archive(String fileName, String comment)
          Method to archive a file
 int close()
          Method to close this file type.
 int comment(String fileName)
          Method to remove comment from a file
 int comment(String fileName, String comment)
          Method to add comment to a file
 int delete(String regexp)
          Method to delete a file
 int get(String regexp)
          Method to get files according to a regular expression
 int get(String[] fileNames)
          Method to get a file
 int get(String[] fileNames, OutputStream out)
          Method to get a file and return it on the output stream specified.
 int getAfter(Date datetime)
          Method to get files of this file type after a given date.
 int getAfter(Date datetime, String regexp)
          Method to get files of this file type after a given date.
 int getBetween(Date begDate, Date endDate)
          Method to get files of this file type between two dates
 int getBetween(Date begDate, Date endDate, String regexp)
          Method to get files of this file type between two dates
 int getFileFromPath(String filePath)
          Method to get a file from a Komodo server based on an absolute path.
 String getGroup()
          Accessor method to get the name of this file type.
 int getLatest()
          Method to get the latest file
 int getLatest(String regexp)
          Method to get latest file according to a regular expression
 String getName()
          Accessor method to get the name of this file type.
 int getSince(Date datetime)
          Method to get files of this file type since a given date
 int getSince(Date datetime, String regexp)
          Method to get files of this file type since a given date
 int ignore(String[] fileNames)
          Method to ignore a file
 int lock(String mode)
          Method to lock file type
 int memGet(String regexp)
          Method to get files according to a regular expression into memory
 int memGet(String[] fileNames)
          Method to get file in memory
 int memGetBetween(Date begDate, Date endDate)
          Method to get files of this file type between two dates into memory
 int memGetSince(Date datetime)
          Method to get files of this file type since a given date
 int rename(String oldFile, String newFile)
          Method to rename a file
 int replace(String regexp)
          Replace with regular expression
 int replace(String[] fileNames)
          Method to replace a file
 int replace(String[] fileNames, String comment)
          Method to replace a file
 int replace(String fileName, byte[] buffer, long length, String comment)
          Method to replace in-memory file.
 int replace(String regexp, String comment)
          Replace with regular expression
 int show()
          Method to show all files of this file type
 int show(String regexp)
          Method to show files according to regular expression
 int show(String[] fileNames)
          Method to show given files in the server
 int showAfter(Date datetime)
          Method to show files of this file type after a given date
 int showAfter(Date datetime, String regexp)
          Method to show files of this file type after a given date
 int showBetween(Date begDate, Date endDate)
          Method to show files of this file type between two dates
 int showBetween(Date begDate, Date endDate, String regexp)
          Method to show files of this file type between two dates
 int showCapabilities()
          Method to show all the user's file type capabilities on the server associated with this file type.
 int showLatest()
          Method to show the latest file for this type.
 int showLatest(String regexp)
          Method to show files according to regular expression
 int showSince(Date datetime)
          Method to show files of this file type since a given date
 int unlock(String mode)
          Method to unlock file type
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileType

public FileType(Session session,
                FileTypeInfo ftInfo)
         throws SessionException
Constructor

Parameters:
session - a transfer session, for maintining file types and connections.
ftInfo - a file type
Throws:
SessionException - when session failure
Method Detail

getName

public final String getName()
Accessor method to get the name of this file type.

Returns:
file type name

getGroup

public final String getGroup()
Accessor method to get the name of this file type.

Returns:
Server Group name

comment

public int comment(String fileName)
            throws SessionException
Method to remove comment from a file

Parameters:
fileName - a file name
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

comment

public int comment(String fileName,
                   String comment)
            throws SessionException
Method to add comment to a file

Parameters:
fileName - a file name
comment - the comment that goes along with file(s)
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

archive

public int archive(String fileName)
            throws SessionException
Method to remove archive notation from a file

Parameters:
fileName - a file name
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

archive

public int archive(String fileName,
                   String comment)
            throws SessionException
Method to archive a file

Parameters:
fileName - a file name
comment - the optional comment for the file
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

add

public int add(String regexp)
        throws SessionException
Method to add with regular expression

Parameters:
regexp - a regular expression
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

add

public int add(String regexp,
               String comment)
        throws SessionException
Method to add file with regular expression

Parameters:
regexp - a regular expression
comment - a comment to associated with each file
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

add

public int add(String[] fileNames)
        throws SessionException
Method to add a list of files

Parameters:
fileNames - an array of file names
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

add

public int add(String[] fileNames,
               String comment)
        throws SessionException
Method to add a list of files with comment

Parameters:
fileNames - an array of file names
comment - a comment to associated with each file
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

addAndRef

public int addAndRef(String regexp,
                     String vft,
                     String linkDirectory)
              throws SessionException
Method to add and reference files with regular expression. Server makes the file name unique, and sets a reference to it. The name of the reference is the same as the file name. If linkDirectory is not null, causes Komodo to create a link of the form / , where ref name is the name of the local file. Note: References and file system links take effect at the next vft update. If reference does not exist for the vft, create one. If it does exist, schedule the reference for change at the next VFT update.

Parameters:
regexp - a regular expression
vft - virtual file type in created reference.
linkDirectory - where file system soft link directory.
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

add

public int add(String fileName,
               byte[] buffer,
               long length,
               String comment)
        throws SessionException
Method to add in-memory file.

Parameters:
fileName - a file name
buffer - in-memory file contents
length - amount of data in the buffer to be sent as a file
comment - a comment to associated with each file, or null
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

replace

public int replace(String regexp)
            throws SessionException
Replace with regular expression

Parameters:
regexp - a regular expression
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

replace

public int replace(String regexp,
                   String comment)
            throws SessionException
Replace with regular expression

Parameters:
regexp - a regular expression
comment - a comment to associated with each file
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

replace

public int replace(String[] fileNames)
            throws SessionException
Method to replace a file

Parameters:
fileNames - an array of file names
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

replace

public int replace(String[] fileNames,
                   String comment)
            throws SessionException
Method to replace a file

Parameters:
fileNames - an array of file names
comment - a comment to associated with each file
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

replace

public int replace(String fileName,
                   byte[] buffer,
                   long length,
                   String comment)
            throws SessionException
Method to replace in-memory file.

Parameters:
fileName - a file name
buffer - in-memory file contents
length - amount of data in the buffer to be sent as a file
comment - a comment to associated with each file, or null
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

delete

public int delete(String regexp)
           throws SessionException
Method to delete a file

Parameters:
regexp - The regular expression file selector
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

ignore

public int ignore(String[] fileNames)
           throws SessionException
Method to ignore a file

Parameters:
fileNames - an array of file names
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

rename

public int rename(String oldFile,
                  String newFile)
           throws SessionException
Method to rename a file

Parameters:
oldFile - the old file name
newFile - the new file name
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

showCapabilities

public int showCapabilities()
                     throws SessionException
Method to show all the user's file type capabilities on the server associated with this file type.

Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

show

public int show()
         throws SessionException
Method to show all files of this file type

Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

show

public int show(String regexp)
         throws SessionException
Method to show files according to regular expression

Parameters:
regexp - a regular expression
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

show

public int show(String[] fileNames)
         throws SessionException
Method to show given files in the server

Parameters:
fileNames - an array of file names
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

showSince

public int showSince(Date datetime)
              throws SessionException
Method to show files of this file type since a given date

Parameters:
datetime - the date cutoff for file show
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

showAfter

public int showAfter(Date datetime)
              throws SessionException
Method to show files of this file type after a given date

Parameters:
datetime - the date cutoff for file show
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

showAfter

public int showAfter(Date datetime,
                     String regexp)
              throws SessionException
Method to show files of this file type after a given date

Parameters:
datetime - the date cutoff for file show
regexp - the file name regular expression
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

showBetween

public int showBetween(Date begDate,
                       Date endDate)
                throws SessionException
Method to show files of this file type between two dates

Parameters:
begDate - the beginning Date
endDate - the last Date
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

showBetween

public int showBetween(Date begDate,
                       Date endDate,
                       String regexp)
                throws SessionException
Method to show files of this file type between two dates

Parameters:
begDate - the beginning Date
endDate - the last Date
regexp - the file name regular expression
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

showLatest

public int showLatest()
               throws SessionException
Method to show the latest file for this type.

Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

showLatest

public int showLatest(String regexp)
               throws SessionException
Method to show files according to regular expression

Parameters:
regexp - a regular expression
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

getFileFromPath

public int getFileFromPath(String filePath)
                    throws SessionException
Method to get a file from a Komodo server based on an absolute path.

Parameters:
filePath - the location to files
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

get

public int get(String regexp)
        throws SessionException
Method to get files according to a regular expression

Parameters:
regexp - a regular expression
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

get

public int get(String[] fileNames)
        throws SessionException
Method to get a file

Parameters:
fileNames - an array of file names
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

get

public int get(String[] fileNames,
               OutputStream out)
        throws SessionException
Method to get a file and return it on the output stream specified.

Parameters:
fileNames - an array of file names
out - the output stream to return the data on.
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

getAfter

public int getAfter(Date datetime)
             throws SessionException
Method to get files of this file type after a given date.

Parameters:
datetime - the date overrides restart file date.
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

getAfter

public int getAfter(Date datetime,
                    String regexp)
             throws SessionException
Method to get files of this file type after a given date.

Parameters:
datetime - the date overrides restart file date.
regexp - the file name regular expression
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

getSince

public int getSince(Date datetime)
             throws SessionException
Method to get files of this file type since a given date

Parameters:
datetime - to date cutoff for file get
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

getSince

public int getSince(Date datetime,
                    String regexp)
             throws SessionException
Method to get files of this file type since a given date

Parameters:
datetime - to date cutoff for file get
regexp - the file name regular expression
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

getBetween

public int getBetween(Date begDate,
                      Date endDate)
               throws SessionException
Method to get files of this file type between two dates

Parameters:
begDate - the beginning date
endDate - the last date
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

getBetween

public int getBetween(Date begDate,
                      Date endDate,
                      String regexp)
               throws SessionException
Method to get files of this file type between two dates

Parameters:
begDate - the beginning date
endDate - the last date
regexp - the file name regular expression
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

getLatest

public int getLatest()
              throws SessionException
Method to get the latest file

Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

getLatest

public int getLatest(String regexp)
              throws SessionException
Method to get latest file according to a regular expression

Parameters:
regexp - a regular expression
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

memGet

public int memGet(String regexp)
           throws SessionException
Method to get files according to a regular expression into memory

Parameters:
regexp - a regular expression
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

memGet

public int memGet(String[] fileNames)
           throws SessionException
Method to get file in memory

Parameters:
fileNames - - an array of file names
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

memGetSince

public int memGetSince(Date datetime)
                throws SessionException
Method to get files of this file type since a given date

Parameters:
datetime - the date cutoff for file get
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

memGetBetween

public int memGetBetween(Date begDate,
                         Date endDate)
                  throws SessionException
Method to get files of this file type between two dates into memory

Parameters:
begDate - the beginning date
endDate - the last date
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

lock

public int lock(String mode)
         throws SessionException
Method to lock file type

Parameters:
mode - the lock mode
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

unlock

public int unlock(String mode)
           throws SessionException
Method to unlock file type

Parameters:
mode - the lock mode
Returns:
the transaction id for tracking this command.
Throws:
SessionException - when session failure

close

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

Returns:
the transaction id for tracking this command.