Sun Adapter for SAG API

com.stc.connector.sagadapter.namepattern
Class LocalDirRegExp

java.lang.Object
  extended by com.stc.connector.sagadapter.namepattern.LocalDirRegExp

public class LocalDirRegExp
extends java.lang.Object

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:\\bank$\\^customer\\statement\D\\... (\D means any non-digit char in the context of regex) d:\\a.b\\c.d\\e.f\\g.h\\[0-9]\\... ('.' means any char in the context of regex)

(2). /regexp1/regexp2/regexp3... (Unix platforms including mounted directory), for example /abc\d/def/ghi/... (\d means any digit char in the context of regex) /^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: 2007/10/19 19:48:39 $
Author:
Harry Liu (harry.liu@sun.com)

Field Summary
static java.lang.String SPECIAL_REGEXP_CHARS
           
static java.lang.String version
           
 
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
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

version

public static final java.lang.String version
See Also:
Constant Field Values

SPECIAL_REGEXP_CHARS

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

LocalDirRegExp

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

getDirs

public java.util.ArrayList getDirs()
                            throws java.lang.Exception
Get directory names.

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 SAG API

Copyright © 2008 Sun Microsystems, Inc. All rights reserved.