Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Sun Adapter for SAG API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.stc.connector.sagadapter.namepattern
Class NamePattern

    java.lang.Object
      com.stc.connector.sagadapter.namepattern.NamePattern

    public class NamePattern

extends java.lang.Object

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).

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

    version

    public static final java.lang.String version

    See Also:Constant Field Values

    Constructor Detail

    NamePattern

    public NamePattern(java.lang.String rawFileName)

    Constructs a new NamePattern object.

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

    Method Detail

    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.

    setSw_LogicalName

    public void setSw_LogicalName(java.lang.String logicalName)

    Parameters:logicalName -

    setWorkingName

    public void setWorkingName(java.lang.String workingName)

    Parameters:workingName -

    setSw_FileStatus

    public void setSw_FileStatus(Sw_FileStatus fileStatus)

    Parameters:fileStatus -

    setSeqNo

    public void setSeqNo(long[] sequenceNoList)
                  throws SAGApplicationException

    Parameters:sequenceNoList -
    Throws:
    SAGApplicationException

    isSeqNoIncreased

    public boolean isSeqNoIncreased()

    getMaxSeqNo

    public long getMaxSeqNo()

    Gets the max sequence number.

    Returns:The max sequence number.

    getStep

    public long getStep()

    Gets the increasing step.

    Returns:The increasing step.

    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.

    setStep

    public void setStep(long newStep)

    Sets the increasing step.

    Parameters:newStep - The increasing step.

    setStartSeqNo

    public void setStartSeqNo(long newStartSeqNo)

    Sets the start sequence number.

    Parameters:newMaxSeqNo - The start sequence number.

    getSeqNo

    public long[] getSeqNo()

    Returns:
    Throws:
    java.lang.Exception

    getSeqNo

    public long getSeqNo(int i)
                  throws java.lang.Exception

    Gets the current sequence number.

    Returns:The current sequence number.
    Throws:
    java.lang.Exception

    setSeqNo

    public void setSeqNo(int i,
                         long sequenceNo)
                  throws SAGApplicationException

    Sets the sequence number.

    Parameters:sequenceNo - The sequence number.
    Throws:
    SAGApplicationException - If some error occurs.

    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.

          Overview
          Package
        Class
          Use
          Tree
          Deprecated
          Index
          Help

    Sun Adapter for SAG API

     PREV CLASS
     NEXT CLASS

      FRAMES
     NO FRAMES

      SUMMARY: NESTED | FIELD | CONSTR | METHOD

    DETAIL: FIELD | CONSTR | METHOD

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