Sun Adapter for Batch/FTP

com.stc.connector.batchadapter.util
Class LocalDirRegExp

java.lang.Object
  extended by com.stc.connector.batchadapter.util.LocalDirRegExp
All Implemented Interfaces:
DirRegExp

public class LocalDirRegExp
extends java.lang.Object
implements DirRegExp

Provides supports for local directory name regular expression. The input is a full directory name that is composed of some regular expressions, and the output is a set of directories that are qualified against the regular expressions. Use the following rules for local directory regular expressions:

        

(1). The directory root, the driver name, directory separators should be expressed exclusively. That is, don't express them as regexp, only folder names are expected to appear as regexp.

(2). Regexp shouldn't go over the directory separators. So between two directory separators, it would be one whole regexp.

(3). Escape all directory separators in directory pattern if the separator conflicts with regexp special character (one of "*[]()|+{}:.^$?\"). Back slash ('\') is a special character in regexp (it is used to escape other special characters). For Windows platforms, the directory separator is back slash, so it should be escaped as "\\".

(4). For Win32 UNC (Universal Naming Convention), the directory root (including computer name and the shared root folder name) should be expressed exclusively. That is, don't express the computer name and shared root folder as regexp.

The expected directory pattern would be like

(1). driver:\\regexp1\\regexp2\\regexp3... (Win32 platforms), for example c:\\eGate$\\^client\\collab\D\\... (\D means any non-digit char) d:\\a.b\\c.d\\e.f\\g.h\\[0-9]\\... ('.' means any char)

(2). /regexp1/regexp2/regexp3... (Unix platforms including mounted directory), for example /abc\d/def/ghi/... (\d means any digit char) /^PRE[0-9]{5}\.dat$/... (Begin with "PRE" followed by a 5 digit number, with a "dat" extension. "\." means a real char '.' instead of any char. So PRE12345.dat will match, PRE123456dat will not match.)

(3). \\\\machineName\\shared_folder\\regexp1\\regexp2\\regexp3... (Win32 UNC platforms, prefix for Win32 UNC platforms is \\, after escaping, it becomes \\\\), for example \\\\My_Machine\\public\\xyz$\\^abc

NOTE: If user doesn't specify the absolute directory, then the directory is relative to the user's current working directory. That is, the starting point is the user's current working directory.

Version:
cvs revision: $Revision: 1.4 $ Last Modified: $Date: 2008/02/25 16:56:30 $
Author:
Harry Liu

Field Summary
 
Fields inherited from interface com.stc.connector.batchadapter.util.DirRegExp
regExpChars
 
Constructor Summary
LocalDirRegExp(java.lang.String dirPattern)
           
 
Method Summary
 java.util.ArrayList getDirs()
          Get directory names.
static void main(java.lang.String[] args)
          Used to do stand-alone testing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalDirRegExp

public LocalDirRegExp(java.lang.String dirPattern)
Method Detail

getDirs

public java.util.ArrayList getDirs()
                            throws java.lang.Exception
Description copied from interface: DirRegExp
Get directory names.

Specified by:
getDirs in interface DirRegExp
Returns:
A list of directory names.
Throws:
java.lang.Exception - If some error occurs.

main

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

Parameters:
args - Command line parameters.
Throws:
java.lang.Exception - If some error occurs.

Sun Adapter for Batch/FTP