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.util
Class SAGUtil

    java.lang.Object
      com.stc.connector.sagadapter.util.SAGUtil

    public class SAGUtil

extends java.lang.Object

It is class that provides some utlity functions.

Version:
  cvs revision: $Revision: 1.7 $ Last Modified: $Date: 2008/02/27 01:41:20 $
Author:
  Harry Liu (harry.liu@sun.com)

Field Summary
`static java.lang.String` | `version`

Constructor Summary
`SAGUtil()` Constructor

Method Summary
`static java.lang.String` | `addNameSpaces(java.lang.String xmlContent)` Add namespace attributes to the root element.
`static java.lang.String` | `changeTagNames(java.lang.String xmlContent)` For example, change following xmlContent: <{urn:swift:snl:ns.SwInt}Requestor type="Sw.Gbl.DN" version="4.0.0"> o=ptsauszz,o=swift <{urn:swift:snl:ns.SwInt}Responder type="Sw.Gbl.DN" version="4.0.0"> o=ptsauszz,o=swift into: o=ptsauszz,o=swift o=ptsauszz,o=swift
`static java.lang.String` | `findRootElementName(java.lang.String xmlContent)` Finds the name of the root element with swift prefix.
`static java.lang.String` | `getGUID()` It generates a random secure GUID by using the following factors: (1) LocalHost's IP address; (2) System timestamp in milliseconds; (3) A random number; (4) Security algorithm (SHA-1) digest.
`static java.lang.String` | `getGUID(java.lang.String algorithm)` It generates a random secure GUID by using the following factors: (1) LocalHost's IP address; (2) System timestamp in milliseconds; (3) A random number; (4) Security algorithm (for example, SHA-1, MD2, MD5) digest.
`static java.lang.String` | `getTestOperatorName()` Gets test operator name from file {user.home}/sagtest.properties.
`static java.lang.String` | `getTestOperatorPassword()` Gets test operator password (decrypted) from file {user.home}/sagtest.properties.
`static boolean` | `isPushedSnFSessionMode(java.lang.String snfSessionId)` Determines/derives the SnF session mode from sessionId.
`static boolean` | `isRASystemAvailable()` Checks whether Swift Remote API (RA) is available.
`static boolean` | `isRASystemAvailable(java.lang.String sagRaHomeValue, java.lang.String swnetHomeValue, java.lang.String swnetCfgPathValue, java.lang.String pathValue)` Checks whether Swift Remote API (RA) is available by examining the specified parameters.
`static boolean` | `isSAGSystemAvailable()` Checks whether Swift Alliance Gateway (SAG) is available.
`static boolean` | `isSAGSystemAvailable(java.lang.String swnetCfgPathValue)` Checks whether Swift Alliance Gateway (SAG) is available by examining the specified parameters.
`static java.lang.String` | `removeNameSpaces(java.lang.String xmlContent)` Remove namespace attributes from the root element.
`static void` | `setTestOperatorPassword(java.lang.String operatorName, java.lang.String operatorPassword)` Sets test operator name & password into file {user.home}/sagtest.properties.

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

### SAGUtil

    public SAGUtil()

  Constructor

Method Detail

### findRootElementName

    public static java.lang.String findRootElementName(java.lang.String xmlContent)
                                                throws SAGApplicationException

  Finds the name of the root element with swift prefix.

  Parameters:
    `xmlContent` -
  Returns:
    root element name
  Throws:
    `SAGApplicationException` - up on error

### addNameSpaces

    public static java.lang.String addNameSpaces(java.lang.String xmlContent)
                                          throws SAGApplicationException

  Add namespace attributes to the root element. For Example, change following xmlContent:

          .......

       into:

          .......

  Parameters:
    `xmlContent` -
  Returns:
    The xml content with swift specified name spaces xmlns:Sw, xmlns:SwInt, etc in root element
  Throws:
    `SAGApplicationException` - up on error

### removeNameSpaces

    public static java.lang.String removeNameSpaces(java.lang.String xmlContent)
                                             throws SAGApplicationException

  Remove namespace attributes from the root element. For Example, change following xmlContent:

          .......

       into:

          .......

  Parameters:
    `xmlContent` -
  Returns:
    The xml content without swift specified name spaces xmlns:Sw, xmlns:SwInt, etc in root element
  Throws:
    `SAGApplicationException` - up on error

### changeTagNames

    public static java.lang.String changeTagNames(java.lang.String xmlContent)

       For example, change following xmlContent:

       <{urn:swift:snl:ns.SwInt}Requestor type="Sw.Gbl.DN" version="4.0.0">
            o=ptsauszz,o=swift

       <{urn:swift:snl:ns.SwInt}Responder type="Sw.Gbl.DN" version="4.0.0">
            o=ptsauszz,o=swift

       into:

            o=ptsauszz,o=swift

            o=ptsauszz,o=swift

  Parameters:
    `xmlContent` -
  Returns:
    The xml content with modified tag names Sw:XXX, SwInt:XXX, etc
  Throws:
    `SAGApplicationException` - up on error

### getGUID

    public static java.lang.String getGUID()
                                    throws SAGApplicationException

  It generates a random secure GUID by using the following factors: (1) LocalHost's IP address; (2) System timestamp in milliseconds; (3) A random number; (4) Security algorithm (SHA-1) digest. The output GUID will be in length 40 like: 167332fa171d0412f0b10c074fd7da576afd3895 d4ab91d00ea908532e131f37a201eeb5fd072416

  Returns:
    The random secure GUID
  Throws:
    `SAGApplicationException` - up on error

### getGUID

    public static java.lang.String getGUID(java.lang.String algorithm)
                                    throws SAGApplicationException

  It generates a random secure GUID by using the following factors: (1) LocalHost's IP address; (2) System timestamp in milliseconds; (3) A random number; (4) Security algorithm (for example, SHA-1, MD2, MD5) digest. The output GUID will be like: 167332fa171d0412f0b10c074fd7da576afd3895 d4ab91d00ea908532e131f37a201eeb5fd072416 SHA-1 : 160-bit (20-bytes), output GUID is in length 40 MD2 : 128-bit (16-bytes), output GUID is in length 32 MD5 : 128-bit (16-bytes), output GUID is in length 32

  Parameters:
    `algorithm` - A valid algorithm
  Returns:
    The random secure GUID
  Throws:
    `SAGApplicationException` - up on error

### isPushedSnFSessionMode

    public static boolean isPushedSnFSessionMode(java.lang.String snfSessionId)
                                          throws SAGApplicationException

  Determines/derives the SnF session mode from sessionId. SnFSessionId = Queue:[p|d]:SequenceNumber. For example, bankwxyz_applicq1:p:000458. The p indicates a push session. For a pull this would have been a d. Indeed, push and pull start both with a p. The choice for d for pull comes from the fact that pulling a queue is like draining a queue. The d comes thus from drain. This terminology was visible in previous releases of SWIFTNet SnF.

  Parameters:
    `snfSessionId` -
  Returns:
    true or false
  Throws:
    `SAGApplicationException` - up on error

### isRASystemAvailable

    public static boolean isRASystemAvailable()
                                       throws SAGApplicationException

  Checks whether Swift Remote API (RA) is available.

  Returns:
    true or false
  Throws:
    `SAGApplicationException` - up on error

### isRASystemAvailable

    public static boolean isRASystemAvailable(java.lang.String sagRaHomeValue,
                                              java.lang.String swnetHomeValue,
                                              java.lang.String swnetCfgPathValue,
                                              java.lang.String pathValue)
                                       throws SAGApplicationException

  Checks whether Swift Remote API (RA) is available by examining the specified parameters. It could be used by ant command line junit tests.

  Parameters:
    `sagRaHomeValue` -
    `swnetHomeValue` -
    `swnetCfgPathValue` -
    `pathValue` -
  Returns:
    true or false
  Throws:
    `SAGApplicationException` - up on error

### isSAGSystemAvailable

    public static boolean isSAGSystemAvailable()
                                        throws SAGApplicationException

  Checks whether Swift Alliance Gateway (SAG) is available.

  Returns:
    true or false
  Throws:
    `SAGApplicationException` - up on error

### isSAGSystemAvailable

    public static boolean isSAGSystemAvailable(java.lang.String swnetCfgPathValue)
                                        throws SAGApplicationException

  Checks whether Swift Alliance Gateway (SAG) is available by examining the specified parameters.

  Parameters:
    `swnetCfgPathValue` -
  Returns:
    true or false
  Throws:
    `SAGApplicationException` - up on error

### getTestOperatorName

    public static java.lang.String getTestOperatorName()
                                                throws SAGApplicationException

  Gets test operator name from file {user.home}/sagtest.properties. Used for test cases.

  Returns:
    operator name
  Throws:
    `SAGApplicationException` - up on error

### getTestOperatorPassword

    public static java.lang.String getTestOperatorPassword()
                                                    throws SAGApplicationException

  Gets test operator password (decrypted) from file {user.home}/sagtest.properties. When retrieving, always try to get encypted password from property "EncryptedOperatorPassword" first, only when the property is absent, try to get the clear text password from property OperatorPassword. Used for test cases.

  Returns:
    operator password (decrypted)
  Throws:
    `SAGApplicationException` - up on error

### setTestOperatorPassword

    public static void setTestOperatorPassword(java.lang.String operatorName,
                                               java.lang.String operatorPassword)
                                        throws SAGApplicationException

  Sets test operator name & password into file {user.home}/sagtest.properties. If OperatorPassword is a non-empty string, sets property EncryptedOperatorPassword (in encrypted text), then removes property OperatorPassword if it exists. Used for test cases.

  Parameters:
    `operatorName` - operator name
    `operatorPassword` - operator password
  Throws:
    `SAGApplicationException` - up on error

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.