Sun Adapter for Batch/FTP

com.stc.connector.batchadapter.heuristics
Class FtpHeuristics

java.lang.Object
  extended by com.stc.connector.batchadapter.heuristics.FtpHeuristics

public class FtpHeuristics
extends java.lang.Object

This class represents the FtpHeuristics configuration file.

Version:
cvs revision: $Revision: 1.7 $ Last Modified: $Date: 2008/03/04 03:06:31 $
Author:
Harry Liu

Field Summary
static java.lang.String UNIX_DIR_LISTING_STYLE
           
 
Constructor Summary
FtpHeuristics()
          Constructs a new FtpHeuristics object using default directory listing style.
FtpHeuristics(java.lang.String style)
          Constructs a new FtpHeuristics object using specified directory listing style.
 
Method Summary
 java.lang.String buildFullFileName(java.lang.String dirName, java.lang.String baseFileName)
          Creates a remote path name taking into consideration any special enveloping characters for the absolute path name and absolute path-name delimiters on the remote FTP host.
 java.lang.String escapeRegExpChars(java.lang.String input)
          Allows you to escape all regular expression special characters in an input string.
 java.lang.String getAbsPathDelims()
          Accessor - Get Absolute Path Delimiters.
 java.lang.String getAbsPathEnvelope()
          Gets Absolute Path Envelope.
 java.lang.String getBaseFileName(java.lang.String fullFileName)
          Strips off the base name of a fully qualified remote file name, pursuant to any special enveloping characters for the absolute path name and absolute path-name delimiters on the remote FTP host.
 java.lang.String getDirectoryName(java.lang.String fullFileName)
          Strips off the base name of a fully qualified remote file name, pursuant to any special enveloping characters for the absolute path name and absolute path-name delimiters on the remote FTP host.
 java.lang.String getDirectoryRegex()
          Gets Directory Regular Expression.
 java.lang.String getDirListingStyle()
          Gets Dir Listing Style.
 java.lang.String getEndingFileDelimiter()
          Gets Ending File Delimiter.
 int getFileExtLength()
          Gets File Ext Length.
 int getFileExtPosn()
          Gets File Ext Position.
 java.lang.String getFileLinkRegex()
          Gets File Link Regular Expression.
 int getFileNameLength()
          Gets File Name Length.
 int getFileNamePosn()
          Gets File Name Position.
 int getFileSizeLength()
          Gets File Size Length.
 int getFileSizePosn()
          Gets File Size Position.
 int getHeaderSkipLines()
          Gets Header Skip Lines.
 java.lang.String getHeaderSkipRegex()
          Gets Header Skip Regular Expression.
 java.lang.String getInitDirDelimiter()
          Gets Initial Dir Delimiter.
 java.lang.String getInitFileDelimiter()
          Gets Initial File Delimiter.
 java.lang.String getInterDirDelimiter()
          Gets Inter Dir Delimiter.
 java.lang.String getLinkSymbolRegex()
          Gets Link Symbol Regular Expression.
 java.lang.String getListLineFormat()
          Gets List Line Format.
 java.util.Properties getProps()
          Gets Properties.
 java.lang.String getSupportCmdMask()
          Gets Support Cmd Mask.
 int getTrailerSkipLines()
          Gets Trailer Skip Lines.
 java.lang.String getTrailerSkipRegex()
          Gets Trailer Skip Regular Expression.
 int getValidFileLineMinPosn()
          Gets Valid File Line Min Position.
 boolean isBlankDelimited()
          Gets the status of Blank Delimited.
 boolean isCdBeforeListing()
          Gets the status of Change Dir Before Listing.
 boolean isDirRequireTerminator()
          Gets the status of Dir Require Terminator.
 boolean isFileLinkRealData()
          Gets the status of File Link Real Data.
 boolean isFileNameIsLastObject()
          Gets the status of File Name Is Last Object.
 boolean isFileSizeVerifiable()
          Gets the status of File Size Verifiable.
 boolean isFixedFormat()
          Gets the status of Fixed Format.
 boolean isListDirYieldsAbsPath()
          Gets the status of List Dir Yields Absolute Path.
static void main(java.lang.String[] args)
          Used to do stand-alone testing.
 java.lang.String[] skipLines(java.lang.String[] lines)
          Parses raw input lines.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNIX_DIR_LISTING_STYLE

public static final java.lang.String UNIX_DIR_LISTING_STYLE
See Also:
Constant Field Values
Constructor Detail

FtpHeuristics

public FtpHeuristics()
              throws java.lang.Exception
Constructs a new FtpHeuristics object using default directory listing style.

Throws:
java.lang.Exception - If some error occurs.

FtpHeuristics

public FtpHeuristics(java.lang.String style)
              throws java.lang.Exception
Constructs a new FtpHeuristics object using specified directory listing style.

Parameters:
style - The directory listing style.
Throws:
java.lang.Exception - If some error occurs.
Method Detail

getAbsPathDelims

public java.lang.String getAbsPathDelims()
Accessor - Get Absolute Path Delimiters.

Returns:
Absolute Path Delimiters.

getAbsPathEnvelope

public java.lang.String getAbsPathEnvelope()
Gets Absolute Path Envelope.

Returns:
The Absolute Path Envelope.

getDirectoryRegex

public java.lang.String getDirectoryRegex()
Gets Directory Regular Expression.

Returns:
The Directory Regular Expression.

getDirListingStyle

public java.lang.String getDirListingStyle()
Gets Dir Listing Style.

Returns:
The Dir Listing Style.

getFileExtLength

public int getFileExtLength()
Gets File Ext Length.

Returns:
The File Ext Length.

getFileExtPosn

public int getFileExtPosn()
Gets File Ext Position.

Returns:
The File Ext Position.

getFileLinkRegex

public java.lang.String getFileLinkRegex()
Gets File Link Regular Expression.

Returns:
The File Link Regular Expression.

getFileNameLength

public int getFileNameLength()
Gets File Name Length.

Returns:
The File Name Length.

getFileNamePosn

public int getFileNamePosn()
Gets File Name Position.

Returns:
The File Name Position.

getFileSizeLength

public int getFileSizeLength()
Gets File Size Length.

Returns:
The File Size Length.

getFileSizePosn

public int getFileSizePosn()
Gets File Size Position.

Returns:
The File Size Position.

getHeaderSkipLines

public int getHeaderSkipLines()
Gets Header Skip Lines.

Returns:
The Header Skip Lines.

getHeaderSkipRegex

public java.lang.String getHeaderSkipRegex()
Gets Header Skip Regular Expression.

Returns:
The Header Skip Regular Expression.

getLinkSymbolRegex

public java.lang.String getLinkSymbolRegex()
Gets Link Symbol Regular Expression.

Returns:
The Link Symbol Regular Expression.

getListLineFormat

public java.lang.String getListLineFormat()
Gets List Line Format.

Returns:
The List Line Format.

getProps

public java.util.Properties getProps()
Gets Properties.

Returns:
The Properties.

getSupportCmdMask

public java.lang.String getSupportCmdMask()
Gets Support Cmd Mask.

Returns:
The Support Cmd Mask.

getTrailerSkipLines

public int getTrailerSkipLines()
Gets Trailer Skip Lines.

Returns:
The Trailer Skip Lines.

getTrailerSkipRegex

public java.lang.String getTrailerSkipRegex()
Gets Trailer Skip Regular Expression.

Returns:
The Trailer Skip Regular Expression.

getValidFileLineMinPosn

public int getValidFileLineMinPosn()
Gets Valid File Line Min Position.

Returns:
The Valid File Line Min Position.

isCdBeforeListing

public boolean isCdBeforeListing()
Gets the status of Change Dir Before Listing.

Returns:
The status of Change Dir Before Listing.

isDirRequireTerminator

public boolean isDirRequireTerminator()
Gets the status of Dir Require Terminator.

Returns:
The status of Dir Require Terminator.

isFileLinkRealData

public boolean isFileLinkRealData()
Gets the status of File Link Real Data.

Returns:
The status of File Link Real Data.

isFileNameIsLastObject

public boolean isFileNameIsLastObject()
Gets the status of File Name Is Last Object.

Returns:
The status of File Name Is Last Object.

isFileSizeVerifiable

public boolean isFileSizeVerifiable()
Gets the status of File Size Verifiable.

Returns:
The status of File Size Verifiable.

isListDirYieldsAbsPath

public boolean isListDirYieldsAbsPath()
Gets the status of List Dir Yields Absolute Path.

Returns:
The status of List Dir Yields Absolute Path.

buildFullFileName

public java.lang.String buildFullFileName(java.lang.String dirName,
                                          java.lang.String baseFileName)
Creates a remote path name taking into consideration any special enveloping characters for the absolute path name and absolute path-name delimiters on the remote FTP host.

Parameters:
dirName - The remote directory name.
baseFileName - The remote base file name.
Returns:
The full remote file name.

getBaseFileName

public java.lang.String getBaseFileName(java.lang.String fullFileName)
Strips off the base name of a fully qualified remote file name, pursuant to any special enveloping characters for the absolute path name and absolute path-name delimiters on the remote FTP host.

Parameters:
fullFileName - The full remote file name.
Returns:
The base part of the remote file name.

getEndingFileDelimiter

public java.lang.String getEndingFileDelimiter()
Gets Ending File Delimiter.

Returns:
The Ending File Delimiter.

getInitDirDelimiter

public java.lang.String getInitDirDelimiter()
Gets Initial Dir Delimiter.

Returns:
The Initial Dir Delimiter.

getInitFileDelimiter

public java.lang.String getInitFileDelimiter()
Gets Initial File Delimiter.

Returns:
The Initial File Delimiter.

getInterDirDelimiter

public java.lang.String getInterDirDelimiter()
Gets Inter Dir Delimiter.

Returns:
The Inter Dir Delimiter.

isBlankDelimited

public boolean isBlankDelimited()
Gets the status of Blank Delimited.

Returns:
The status of Blank Delimited.

isFixedFormat

public boolean isFixedFormat()
Gets the status of Fixed Format.

Returns:
The status of Fixed Format.

skipLines

public java.lang.String[] skipLines(java.lang.String[] lines)
Parses raw input lines. These input lines are raw lines from FTP LIST command. This method skips header lines and trailer lines, and returns a solid-line string array.

Parameters:
lines - The raw lines to be parsed.
Returns:
A string array.

getDirectoryName

public java.lang.String getDirectoryName(java.lang.String fullFileName)
Strips off the base name of a fully qualified remote file name, pursuant to any special enveloping characters for the absolute path name and absolute path-name delimiters on the remote FTP host.

Parameters:
fullFileName - The full remote file name.
Returns:
The directory part of the full remote file name.

main

public static void main(java.lang.String[] args)
Used to do stand-alone testing.

Parameters:
args - Command line parameters.

escapeRegExpChars

public java.lang.String escapeRegExpChars(java.lang.String input)
Allows you to escape all regular expression special characters in an input string.

Parameters:
input - Original input non-escaped string.
Returns:
Escaped output string.

Sun Adapter for Batch/FTP