Interface ISubjectMapping

  • All Known Implementing Classes:
    SubjectMapping

    public interface ISubjectMapping
    Interface that represents the mapping of a set of subjects from one namespace to another.

    The patterns used within the permissioning system are Basic or Extended regular expressions. 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.

    Regular expression captures can be used to perform substitution between the values returned by getMapFromPattern() and getMapToPattern(). This functionality can be used to implement tiering for StreamLink clients. For example, calling setMapFromPattern(java.lang.String) to set ^/FX/(.*) and setMapToPattern(java.lang.String) to set ^/FX/TIER1/(1) causes all client requests within the /FX namespace to be mapped to "TIER1" prices; thus a request for the subject /FX/EURGBP is mapped to /FX/TIER1/EURGBP.

    This example demonstrates implementing tiering on FX instruments for a non-trading user.

    public class SettingATierForAUser
    {
            public IUserPermissions createTieredPermission()
            {
                    // Create an empty set of permissions.
                    IUserPermissions userPerms = new UserPermissions();
                    
                    // Create a mapping so that any request for /FX/.* is mapped to /FX/TIER1/.*
                    userPerms.addMapping(new SubjectMapping("^/FX/(.*)", "/FX/TIER/(1)"));
                    
                    // Add a read permission for /FX/TIER1/*
                    userPerms.addPermission(new Permission("^/FX/TIER1/.*", true, false, false));
                    
                    return userPerms;
            }
            
    }
    

    • Method Detail

      • getMapFromPattern

        java.lang.String getMapFromPattern()
        Gets the pattern that will match a request for a subject.

        The pattern is an Extended regular expression and can contain captures.

        Returns:
        The pattern.
      • setMapFromPattern

        void setMapFromPattern​(java.lang.String value)
        Sets the pattern that will match a request for a subject.

        The pattern is an Extended regular expression and can contain captures.

        Parameters:
        value - The pattern.
      • getMapToPattern

        java.lang.String getMapToPattern()
        Gets the pattern that client requests matching getMapFromPattern() will be mapped to.

        The pattern should contain references to capture registers.

        Returns:
        The pattern.
      • setMapToPattern

        void setMapToPattern​(java.lang.String value)
        Sets the pattern that client requests matching getMapFromPattern() will be mapped to.

        The pattern should contain references to capture registers.

        Parameters:
        value - The Pattern.