|
Sun Adapter for SAG API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.stc.connector.sagadapter.namepattern.NamePattern
public class NamePattern
Provides utilities for the SAG e*Way 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 literal abc%d, and %d is not expanded again.
The SAG e*Way provides the following types of name expansions:
1. Universally Unique Identifier (%I). It will be in length 40 like: d4ab91d00ea908532e131f37a201eeb5fd072416. For example, abc.%I can be resolved as abc.d4ab91d00ea908532e131f37a201eeb5fd072416.
2. Sequence number (%[0-9])+. Each sequence number counts on independently. For example, abc%0 can be resolved as abc1, abc2, abc3, ..., abc100, etc. The repeated patterns is used for leading zero padding, the number of repeated patterns is the minimum number of digits, and shorter numbers are zero-padded to this amount. For example, abc%1%1%1 can be resolved as abc001, abc002, abc003, ..., abc010, ..., abc100, ..., abc1000, etc.
3. Time stamps (%[GyMdhHmsSEDFwWakKzZ])+. The currrent system date time is used as replacement value. The SAG e*Way uses the format of java class java.text.SimpleDateFormat. For example, abc%y%y%y%y%M%d can be resolved as abc20010625. For more details, please see http://java.sun.com/j2se/1.5.0/docs/api/java/text/SimpleDateFormat.html.
4. Swift Sw:LogicalName replacement (%L). Normally it will only be used file name portion. For example, "file001.dat".
5. Working file|directory replacement (%f). It is only used for post operation. For example, %f_processed can be resolved as dir /home/harryliu_processed, or file dataFile_processed.
6. Swift file status replacements (only used for post operation). We'll recognize following parameters existed in Sw:FileStatus: - $Sw:LogicalName Logical name of the file. It is same as pattern %L. For example, file001.dat. - $Sw:StartTime Start time of the file transfer. For example, "2007-05-29T17:54:54Z". Note: Colon ':' is not a valid character in file name for windows, we'll replace it with a dash '-', so the last example will become "2007-05-29T17-54-54Z". - $Sw:StateTime Time of the last state transition of the file transfer. For example, "2007-05-29T17:54:57Z". Note: Colon ':' is not a valid character in file name for windows, we'll replace it with a dash '-', so the last example will become "2007-05-29T17-54-57Z". - $Sw:TransferRef Unique reference of the file transfer. For example, "SNL00514D11180461294006687C". - $SwInt:Service Business service used for the file transfer. For example, "swift.generic.fa!x". - $SwInt:Requestor DN of the requestor of the file transfer. For example, "cn=user,o=ptsauszz,o=swift" Note: We give the replacement by putting all labels in sequence, separating by character '@' and ignoring the last "o=swift", so the last example will become "user@ptsauszz". - $SwInt:Responder DN of the responder to the file transfer. For example, "ou=management,o=ptsauszz,o=swift". Note: We give the replacement by putting all labels in sequence, separating by character '@' and ignoring the last "o=swift", so the last example will become "management@ptsauszz". The sequence of expansion is 1, 2, 3, 4, 5, 6. Some embedded patterns are possible, for example, working file name may contain other patterns like time stamps or sequence numbers, all will be resolved. The same kind of pattern in same input string will be resolved one time as one shot. For example, abc%9.def%9 will be resolved as abc1.def1 (instead of abc1.def2).
Here are some additional examples:
abc.%y%y%y%y%M%M%d%d.%H%H%m%m%s%s%S%S%S can be resolved as abc.20011112.162532678
abc%0.def%1 can be resolved as abc2.def3
$Sw:LogicalName.%2 can be resolved as xxxxx.4, xxxxx.5, ... (where xxxxx is the logical file name in FileAct).
Field Summary | |
---|---|
static java.lang.String |
version
|
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. |
long |
getMaxSeqNo()
Gets the max sequence number. |
long[] |
getSeqNo()
|
long |
getSeqNo(int i)
Gets the current sequence number. |
long |
getStartSeqNo()
Gets the start sequence number. |
long |
getStep()
Gets the increasing step. |
boolean |
isSeqNoIncreased()
|
static void |
main(java.lang.String[] args)
Used to do stand-alone testing. |
void |
setMaxSeqNo(long newMaxSeqNo)
Sets the max sequence number. |
void |
setSeqNo(int i,
long sequenceNo)
Sets the sequence number. |
void |
setSeqNo(long[] sequenceNoList)
|
void |
setStartSeqNo(long newStartSeqNo)
Sets the start sequence number. |
void |
setStep(long newStep)
Sets the increasing step. |
void |
setSw_FileStatus(Sw_FileStatus fileStatus)
|
void |
setSw_LogicalName(java.lang.String logicalName)
|
void |
setWorkingName(java.lang.String workingName)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String version
Constructor Detail |
---|
public NamePattern(java.lang.String rawFileName)
rawFileName
- The original file name that needs to be expanded.Method Detail |
---|
public java.lang.String expand() throws java.lang.Exception
java.lang.Exception
- If some error occurs.public void setSw_LogicalName(java.lang.String logicalName)
logicalName
- public void setWorkingName(java.lang.String workingName)
workingName
- public void setSw_FileStatus(Sw_FileStatus fileStatus)
fileStatus
- public void setSeqNo(long[] sequenceNoList) throws SAGApplicationException
sequenceNoList
-
SAGApplicationException
public boolean isSeqNoIncreased()
public long getMaxSeqNo()
public long getStep()
public long getStartSeqNo()
public void setMaxSeqNo(long newMaxSeqNo)
newMaxSeqNo
- The max sequence number.public void setStep(long newStep)
newStep
- The increasing step.public void setStartSeqNo(long newStartSeqNo)
newMaxSeqNo
- The start sequence number.public long[] getSeqNo()
java.lang.Exception
public long getSeqNo(int i) throws java.lang.Exception
java.lang.Exception
public void setSeqNo(int i, long sequenceNo) throws SAGApplicationException
sequenceNo
- The sequence number.
SAGApplicationException
- If some error occurs.public static void main(java.lang.String[] args) throws java.lang.Exception
args
- Command line parameters.
java.lang.Exception
- If some error occurs.
|
Sun Adapter for SAG API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |