Class ResourceManager


  • public class ResourceManager
    extends Object
    The class ResourceManager manages an index to the resources managed by policies in a specific organization/realm.
    • Method Detail

      • getManagedResourceNames

        public Set getManagedResourceNames()
                                    throws PolicyException
        Returns a set of all managed resource names for all the service types
        Returns:
        names of the resources managed
        Throws:
        PolicyException - if unable to get the policy services, and will contain the exception thrown by SMS.
      • getManagedResourceNames

        public Set getManagedResourceNames​(String serviceType)
                                    throws PolicyException
        Returns a set of all managed resource names for the given service type.
        Parameters:
        serviceType - the service type for which the resource names should be returned.
        Returns:
        names of the resources.
        Throws:
        PolicyException - if unable to get the policy services, and will contain the exception thrown by SMS.
      • canCreateNewResource

        public boolean canCreateNewResource​(String ServiceType)
                                     throws PolicyException
        Determines that with the given organization (or, sub-organization, or container) name, if a new resource can be created or not. Only root level organization/realm has the privilege to create any resource.
        Parameters:
        ServiceType - the service type
        Returns:
        true if new resources can be created, else false
        Throws:
        PolicyException - problem with configuration store
      • getValidServiceNames

        public Set getValidServiceNames()
                                 throws SSOException,
                                        PolicyException
        Returns a set of valid service names that are applicable for the organization. The result will depended if new resources can be created for the organization and also if the organization has managed resources.
        Returns:
        set of service names that are valid for the organization
        Throws:
        SSOException - if the caller's single sign on token has expired
        PolicyException - if not able to get list of services defined for the organization
      • getPolicyNames

        public Set getPolicyNames​(String serviceType,
                                  String resource,
                                  boolean includePoliciesForSuperResources)
                           throws InvalidFormatException,
                                  NoPermissionException,
                                  PolicyException,
                                  SSOException
        Returns a set of names of all the policies for the given resource of the given service.
        Parameters:
        serviceType - the service type which the resource is associated with
        resource - the resource for which policies should be returned
        includePoliciesForSuperResources - indicating whether the policies for all the super-resources in addition to the ultimate (sub)resource should be returned
        Returns:
        set of names of the policies.
        Throws:
        InvalidFormatException - the retrieved resources from the data store have been corrupted or do not have a valid format.
        NoPermissionException - the user does not have sufficient privileges.
        PolicyException - if unable to get the policy services, and will contain the exception thrown by SMS.
        SSOException - single-sign-on token invalid or expired
      • splitResourceName

        public String[] splitResourceName​(String serviceTypeName,
                                          String resourceName)
                                   throws NameNotFoundException,
                                          SSOException,
                                          PolicyException
        Returns the resource prefix (super-resource) and the rest of the resource name (sub-resource)
        Parameters:
        serviceTypeName - the service type which the resource is associated with
        resourceName - the resource name to be split
        Returns:
        array of two strings, the first being the super-resource the second being the sub-resource
        Throws:
        PolicyException - if unable to get the policy services, and will contain the exception thrown by SMS.
        NameNotFoundException - service for the given serviceTypeName does not exist
        SSOException - single-sign-on token invalid or expired