Class ArgBlock

java.lang.Object
com.netscape.cmscore.base.ArgBlock
All Implemented Interfaces:
IArgBlock, Serializable

public class ArgBlock extends Object implements IArgBlock
This class represents a set of indexed arguments. Each argument is indexed by a key, which can be used during the argument retrieval.
Version:
$Revision$, $Date$
See Also:
  • Field Details

  • Constructor Details

    • ArgBlock

      public ArgBlock(String realm, Hashtable<String,String> httpReq)
      Constructs an argument block with the given hashtable values.
      Parameters:
      realm - the type of argblock - used for debugging the values
    • ArgBlock

      public ArgBlock(Hashtable<String,String> httpReq)
      Constructs an argument block with the given hashtable values.
      Parameters:
      httpReq - hashtable keys and values
    • ArgBlock

      public ArgBlock()
      Constructs an empty argument block.
  • Method Details

    • isValuePresent

      public boolean isValuePresent(String n)
      Checks if this argument block contains the given key.
      Specified by:
      isValuePresent in interface IArgBlock
      Parameters:
      n - key
      Returns:
      true if key is present
    • addStringValue

      public Object addStringValue(String n, String v)
      Adds string-based value into this argument block.
      Specified by:
      addStringValue in interface IArgBlock
      Parameters:
      n - key
      v - value
      Returns:
      value
    • getValueAsString

      public String getValueAsString(String n) throws EBaseException
      Retrieves argument value as string.
      Specified by:
      getValueAsString in interface IArgBlock
      Parameters:
      n - key
      Returns:
      argument value as string
      Throws:
      EBaseException - failed to retrieve value
    • getValueAsString

      public String getValueAsString(String n, String def)
      Retrieves argument value as string.
      Specified by:
      getValueAsString in interface IArgBlock
      Parameters:
      n - key
      def - default value to be returned if key is not present
      Returns:
      argument value as string
    • getValueAsInt

      public int getValueAsInt(String n) throws EBaseException
      Retrieves argument value as integer.
      Specified by:
      getValueAsInt in interface IArgBlock
      Parameters:
      n - key
      Returns:
      argument value as int
      Throws:
      EBaseException - failed to retrieve value
    • getValueAsInt

      public int getValueAsInt(String n, int def)
      Retrieves argument value as integer.
      Specified by:
      getValueAsInt in interface IArgBlock
      Parameters:
      n - key
      def - default value to be returned if key is not present
      Returns:
      argument value as int
    • getValueAsBigInteger

      public BigInteger getValueAsBigInteger(String n) throws EBaseException
      Retrieves argument value as big integer.
      Specified by:
      getValueAsBigInteger in interface IArgBlock
      Parameters:
      n - key
      Returns:
      argument value as big integer
      Throws:
      EBaseException - failed to retrieve value
    • getValueAsBigInteger

      public BigInteger getValueAsBigInteger(String n, BigInteger def)
      Retrieves argument value as big integer.
      Specified by:
      getValueAsBigInteger in interface IArgBlock
      Parameters:
      n - key
      def - default value to be returned if key is not present
      Returns:
      argument value as big integer
    • getValue

      public Object getValue(Object n) throws EBaseException
      Retrieves argument value as object
      Specified by:
      getValue in interface IArgBlock
      Parameters:
      n - key
      Returns:
      argument value as object
      Throws:
      EBaseException - failed to retrieve value
    • getValue

      public Object getValue(Object n, Object def)
      Retrieves argument value as object
      Specified by:
      getValue in interface IArgBlock
      Parameters:
      n - key
      def - default value to be returned if key is not present
      Returns:
      argument value as object
    • getValueAsBoolean

      public boolean getValueAsBoolean(String name) throws EBaseException
      Gets boolean value. They should be "true" or "false".
      Specified by:
      getValueAsBoolean in interface IArgBlock
      Parameters:
      name - name of the input type
      Returns:
      boolean type: true or false
      Throws:
      EBaseException - failed to retrieve value
    • getValueAsBoolean

      public boolean getValueAsBoolean(String name, boolean def)
      Gets boolean value. They should be "true" or "false".
      Specified by:
      getValueAsBoolean in interface IArgBlock
      Parameters:
      name - name of the input type
      def - Default value to return.
      Returns:
      boolean type: true or false
    • getValueAsKeyGenInfo

      public KeyGenInfo getValueAsKeyGenInfo(String name, KeyGenInfo def) throws EBaseException
      Gets KeyGenInfo
      Specified by:
      getValueAsKeyGenInfo in interface IArgBlock
      Parameters:
      name - name of the input type
      def - default value
      Returns:
      KeyGenInfo object
      Throws:
      EBaseException
    • getValueAsRawPKCS10

      public org.mozilla.jss.netscape.security.pkcs.PKCS10 getValueAsRawPKCS10(String name) throws EBaseException
      Gets PKCS10 request. This pkcs10 attribute does not contain header information.
      Specified by:
      getValueAsRawPKCS10 in interface IArgBlock
      Parameters:
      name - name of the input type
      Returns:
      pkcs10 request
      Throws:
      EBaseException - failed to retrieve value
    • getValueAsRawPKCS10

      public org.mozilla.jss.netscape.security.pkcs.PKCS10 getValueAsRawPKCS10(String name, org.mozilla.jss.netscape.security.pkcs.PKCS10 def) throws EBaseException
      Gets PKCS10 request. This pkcs10 attribute does not contain header information.
      Specified by:
      getValueAsRawPKCS10 in interface IArgBlock
      Parameters:
      name - name of the input type
      def - default PKCS10
      Returns:
      pkcs10 request
      Throws:
      EBaseException - failed to retrieve value
    • getValueAsPKCS10

      public org.mozilla.jss.netscape.security.pkcs.PKCS10 getValueAsPKCS10(String name, boolean checkheader) throws EBaseException
      Retrieves PKCS10
      Specified by:
      getValueAsPKCS10 in interface IArgBlock
      Parameters:
      name - name of the input type
      checkheader - true if header must be present
      Returns:
      PKCS10 object
      Throws:
      EBaseException - failed to retrieve value
    • getValueAsPKCS10

      public org.mozilla.jss.netscape.security.pkcs.PKCS10 getValueAsPKCS10(String name, boolean checkheader, org.mozilla.jss.netscape.security.pkcs.PKCS10 def) throws EBaseException
      Retrieves PKCS10
      Specified by:
      getValueAsPKCS10 in interface IArgBlock
      Parameters:
      name - name of the input type
      checkheader - true if header must be present
      def - default PKCS10
      Returns:
      PKCS10 object
      Throws:
      EBaseException
    • getValuePKCS10

      public org.mozilla.jss.netscape.security.pkcs.PKCS10 getValuePKCS10(String name, org.mozilla.jss.netscape.security.pkcs.PKCS10 def) throws EBaseException
      Retrieves PKCS10
      Specified by:
      getValuePKCS10 in interface IArgBlock
      Parameters:
      name - name of the input type
      def - default PKCS10
      Returns:
      PKCS10 object
      Throws:
      EBaseException
    • set

      public void set(String name, Object ob)
      Sets argument into this block.
      Specified by:
      set in interface IArgBlock
      Parameters:
      name - key
      ob - value
    • get

      public Object get(String name)
      Retrieves argument.
      Specified by:
      get in interface IArgBlock
      Parameters:
      name - key
      Returns:
      object value
    • delete

      public void delete(String name)
      Deletes argument by the given key.
      Specified by:
      delete in interface IArgBlock
      Parameters:
      name - key
    • getElements

      public Enumeration<String> getElements()
      Retrieves a list of argument keys.
      Specified by:
      getElements in interface IArgBlock
      Returns:
      a list of string-based keys
    • elements

      public Enumeration<String> elements()
      Retrieves a list of argument keys.
      Specified by:
      elements in interface IArgBlock
      Returns:
      a list of string-based keys
    • addLongValue

      public Object addLongValue(String n, long v)
      Adds long-type arguments to this block.
      Specified by:
      addLongValue in interface IArgBlock
      Parameters:
      n - key
      v - value
      Returns:
      value
    • addIntegerValue

      public Object addIntegerValue(String n, int v)
      Adds integer-type arguments to this block.
      Specified by:
      addIntegerValue in interface IArgBlock
      Parameters:
      n - key
      v - value
      Returns:
      value
    • addBooleanValue

      public Object addBooleanValue(String n, boolean v)
      Adds boolean-type arguments to this block.
      Specified by:
      addBooleanValue in interface IArgBlock
      Parameters:
      n - key
      v - value
      Returns:
      value
    • addBigIntegerValue

      public Object addBigIntegerValue(String n, BigInteger v, int radix)
      Adds integer-type arguments to this block.
      Specified by:
      addBigIntegerValue in interface IArgBlock
      Parameters:
      n - key
      v - value
      radix - radix
      Returns:
      value