Sun Adapter for Batch/FTP

com.stc.connector.batchadapter.util
Class NamePattern

java.lang.Object
  extended by com.stc.connector.batchadapter.util.NamePattern

public class NamePattern
extends java.lang.Object

Provides utilities for the Batch e*Way's file-name expansion feature. You must use the percent symbol (%) to indicate any special character that needs to be expanded. The characters %% indicate the escaped character %. For example, abc%%d means abc%d, and %d is not expanded again.

   
        

The e*Way provides the following types of name expansions:

1. Time stamps (%[GyMdhHmsSEDFwWakKz]). The e*Way uses the Java simple date/time format. For example, abc%y%y%y%y means abc2001.

2. Sequence number (%#, %5#). For example, abc%# means abc1, abc2, abc3, etc. abc%5# (zero padded) means abc00001, abc00002, abc00003, ..., abc00010, ..., abc00100, etc.

3. Working file name replacement (%f). Normally, it is used for RenameOrArchiveName. For example, %f.abc means working_filename.abc.

Here are some additional examples:

abc.%y%y%y%y%M%M%d%d.%h%h%m%m%s%s%S%S%S means abc.20011112.162532678

abc%#.def%# means abc2.def3

%f.%# means xxxxx.4, xxxxx.5, ... (where xxxxx is the working file name).

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

Constructor Summary
NamePattern(java.lang.String rawFileName)
          Constructs a new NamePattern object.
 
Method Summary
 java.lang.String expand()
          This method is exposed to other classes for them to call.
 java.lang.String getFileNameFromEgate()
          Gets the original working file name (used for pattern %f).
 long getMaxSeqNo()
          Gets the max sequence number.
 long getSeqNo()
          Gets the current sequence number.
 long getStartSeqNo()
          Gets the start sequence number.
static void main(java.lang.String[] args)
          Used to do stand-alone testing.
 void setFileNameFromEgate(java.lang.String newFileNameFromEgate)
          Sets the start sequence number.
 void setMaxSeqNo(long newMaxSeqNo)
          Sets the max sequence number.
 void setSeqNo(long sequenceNo)
          Sets the sequence number.
 void setStartSeqNo(long newStartSeqNo)
          Sets the start sequence number.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NamePattern

public NamePattern(java.lang.String rawFileName)
Constructs a new NamePattern object.

Parameters:
rawFileName - The file name that needs to be expanded.
Method Detail

main

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

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

expand

public java.lang.String expand()
                        throws java.lang.Exception
This method is exposed to other classes for them to call.

Returns:
The expanded file name.
Throws:
java.lang.Exception - If some error occurs.

getMaxSeqNo

public long getMaxSeqNo()
Gets the max sequence number.

Returns:
The max sequence number.

getStartSeqNo

public long getStartSeqNo()
Gets the start sequence number.

Returns:
The start sequence number.

setMaxSeqNo

public void setMaxSeqNo(long newMaxSeqNo)
Sets the max sequence number.

Parameters:
newMaxSeqNo - The max sequence number.

setStartSeqNo

public void setStartSeqNo(long newStartSeqNo)
Sets the start sequence number.

Parameters:
newMaxSeqNo - The start sequence number.

setFileNameFromEgate

public void setFileNameFromEgate(java.lang.String newFileNameFromEgate)
Sets the start sequence number.

Parameters:
newFileNameFromEgate - The working file name from eGate.

getFileNameFromEgate

public java.lang.String getFileNameFromEgate()
Gets the original working file name (used for pattern %f).

Returns:
The original working file name from eGate.

getSeqNo

public long getSeqNo()
Gets the current sequence number.

Returns:
The current sequence number.

setSeqNo

public void setSeqNo(long sequenceNo)
              throws java.lang.Exception
Sets the sequence number.

Parameters:
sequenceNo - The sequence number.
Throws:
java.lang.Exception - If some error occurs.

Sun Adapter for Batch/FTP