Class SuffixResourceName

    • Field Detail

      • wildcard

        protected String wildcard
    • Constructor Detail

      • SuffixResourceName

        public SuffixResourceName()
        empty no argument constructor.
    • Method Detail

      • initialize

        public void initialize​(Map configParams)
        Initializes the resource name with configuration information, usally set by the administrators. The main configration information retrived is mainly like wild card pattern used, delimiter, case sensitivity etc.
        Specified by:
        initialize in interface BaseResourceName<ResourceMatch,​PolicyException>
        Parameters:
        configParams - configuration parameters as a map. The keys of the map are the configuration paramaters. Each key is corresponding to one String value which specifies the configuration paramater value.
      • compare

        public ResourceMatch compare​(String requestResource,
                                     String targetResource,
                                     boolean wildcardCompare)
        Compares two resources. Description: The targetResource may contain wildcard '*' which matches zero or more characters. The wildcard character can show up anywhere within the string. The targetResource can contain any number of wildcard characters. One of the five possible match types is returned based on how the two resource strings are related. The comparison starts from the end of the reource strings. ResourceMatch.NO_MATCH means two resources don't match. ResourceMatch.EXACT_MATCH means two resources match. ResourceMatch.SUB_RESOURCE_MATCH means targetResource is the sub resource of the requestResource. ResourceMatch.SUPER_RESOURCE_MATCH means targetResource is the super resource of the requestResource. ResourceMatch.WILDCARD_MATCH means two resources match with respect to the wildcard.
        Specified by:
        compare in interface BaseResourceName<ResourceMatch,​PolicyException>
        Parameters:
        requestResource - name of the resource which will be compared
        targetResource - name of the resource which will be compared with
        wildcardCompare - flag for wildcard comparison
        Returns:
        returns ResourceMatch that specifies if the resources are exact match, or otherwise.
      • append

        public String append​(String superResource,
                             String subResource)
        Appends sub-resource to super-resource.
        Specified by:
        append in interface BaseResourceName<ResourceMatch,​PolicyException>
        Parameters:
        superResource - name of the super-resource to be appended to
        subResource - name of the sub-resource to be appended
        Returns:
        returns the combination resource.
      • getSubResource

        public String getSubResource​(String resource,
                                     String superResource)
        Gets sub-resource from an original resource minus a super resource. This is the complementary method of append().
        Specified by:
        getSubResource in interface BaseResourceName<ResourceMatch,​PolicyException>
        Parameters:
        resource - name of the original resource consisting of the second parameter superResource and the returned value
        superResource - name of the super-resource which the first parameter begins with.
        Returns:
        returns the sub-resource which the first paramter ends with. If the first parameter doesn't begin with the the first parameter, then the return value is null.
      • split

        public String[] split​(String res)
        Description copied from interface: BaseResourceName
        Method to split a resource into the smallest necessary sub resource units.
        Specified by:
        split in interface BaseResourceName<ResourceMatch,​PolicyException>
        Parameters:
        res - name of the resource to be split
        Returns:
        returns the array of sub-resources, with the first element being what the original resource begins with, and the last one being what it ends with