Class Permission

  • All Implemented Interfaces:
    IPermission

    public class Permission
    extends java.lang.Object
    implements IPermission
    An implementation of the IPermission interface. You should create instances of this class if you want to use the KeyMaster permissioning system.

    The permissioning system can control read and write access to subjects selected by the specified SubjectPattern.

    Within the Caplin Xaqua environment there is a dedicated trade channel (subject) per asset class, for each user. If the trade channel subject is within the ^/TRADE/FX namespace and you wish to permit trading for the user on subjects within the ^/FX/ namespace, then the permissions should be configured as follows:

    SubjectPatternReadAllowed WriteAllowedTradeAllowedInstrumentField
    ^/TRADE/FXtruetruefalseInstrumentField
    ^/FXtruefalsetruenull
    • Constructor Summary

      Constructors 
      Constructor Description
      Permission​(java.lang.String subjectPattern)
      Initializes a new instance of the Permission class with a subject pattern.
      Permission​(java.lang.String subjectPattern, boolean allowRead, boolean allowWrite, boolean allowTrade)
      Initializes a new instance of the Permission class with permissions for a subject pattern.
      Permission​(java.lang.String subjectPattern, boolean allowRead, boolean allowWrite, boolean allowTrade, java.lang.String instrumentField)
      Initializes a new instance of the Permission class with permissions for a subject pattern, and the name of a field specifying an instrument that can be traded.
    • Constructor Detail

      • Permission

        public Permission​(java.lang.String subjectPattern)
        Initializes a new instance of the Permission class with a subject pattern.

        The initial permission settings deny all access to the subjects that match the subject pattern.

        Parameters:
        subjectPattern - The subject pattern.
      • Permission

        public Permission​(java.lang.String subjectPattern,
                          boolean allowRead,
                          boolean allowWrite,
                          boolean allowTrade)
        Initializes a new instance of the Permission class with permissions for a subject pattern.
        Parameters:
        subjectPattern - The subject pattern.
        allowRead - If set to true, the user can read subjects matching subjectPattern
        allowWrite - If set to true, the user can contribute to (publish to) subjects matching subjectPattern.
        allowTrade - If set to true, the user can trade on subjects matching subjectPattern.
      • Permission

        public Permission​(java.lang.String subjectPattern,
                          boolean allowRead,
                          boolean allowWrite,
                          boolean allowTrade,
                          java.lang.String instrumentField)
        Initializes a new instance of the Permission class with permissions for a subject pattern, and the name of a field specifying an instrument that can be traded.
        Parameters:
        subjectPattern - The subject pattern.
        allowRead - If set to true, the user can read subjects matching subjectPattern.
        allowWrite - If set to true, the user can contribute to (publish to) subjects matching subjectPattern.
        allowTrade - If set to true, the user can trade on subjects matching subjectPattern.
        instrumentField - The name of the field that will contain the name of the instrument being traded.
    • Method Detail

      • getSubjectPattern

        public java.lang.String getSubjectPattern()
        Description copied from interface: IPermission
        Gets the regular expression representing the subjects that should have the permissions defined by this IPermission.

        The regular expression syntaxes supported by the Liberator are Basic and Extended. The full Java regular expressions syntax is not supported. However, the syntax for the most common regular expression operations is the same in each case. For more information on the various regular expression syntaxes, see www .regular-expressions.info.

        Specified by:
        getSubjectPattern in interface IPermission
        Returns:
        The regular expression.
      • setSubjectPattern

        public void setSubjectPattern​(java.lang.String value)
        Description copied from interface: IPermission
        Sets the regular expression representing the subjects that should have the permissions defined by this IPermission.

        The regular expression syntaxes supported by the Liberator are Basic and Extended. The full Java regular expressions syntax is not supported. However, the syntax for the most common regular expression operations is the same in each case. For more information on the various regular expression syntaxes, see www .regular-expressions.info.

        Specified by:
        setSubjectPattern in interface IPermission
        Parameters:
        value - the subject pattern to set.
      • setWriteAllowed

        public void setWriteAllowed​(boolean value)
        Description copied from interface: IPermission
        Sets a value indicating whether the user can contribute to (publish to) subjects matching IPermission.getSubjectPattern().
        Specified by:
        setWriteAllowed in interface IPermission
        Parameters:
        value - boolean value indicating if write is allowed.
      • setTradeAllowed

        public void setTradeAllowed​(boolean value)
        Description copied from interface: IPermission
        Sets a value indicating whether the user can trade on subjects matching IPermission.getSubjectPattern().
        Specified by:
        setTradeAllowed in interface IPermission
        Parameters:
        value - boolean value indicating if trading is allowed.
      • getInstrumentField

        public java.lang.String getInstrumentField()
        Description copied from interface: IPermission
        Gets the instrument field.

        The instrument field must be present on StreamLink contributions to trade channels. It contains the name of a field specifying the name of an instrument that can be traded.

        The default value of null implies that the field is not defined.

        Specified by:
        getInstrumentField in interface IPermission
        Returns:
        The instrument field.
      • setInstrumentField

        public void setInstrumentField​(java.lang.String value)
        Description copied from interface: IPermission
        Sets the instrument field.

        The instrument field must be present on StreamLink contributions to trade channels. It contains the name of a field specifying the name of an instrument that can be traded.

        The default value of null implies that the field is not defined.

        Specified by:
        setInstrumentField in interface IPermission
        Parameters:
        value - the instrument field.
      • toString

        public java.lang.String toString()
        Returns a String that represents this instance.
        Overrides:
        toString in class java.lang.Object