Class SMSFlatFileObjectBase

    • Field Detail

      • mRootDir

        protected String mRootDir
      • mRootDirHandle

        protected File mRootDirHandle
      • mRootDN

        protected String mRootDN
      • mInitialized

        protected boolean mInitialized
      • mDebug

        protected Debug mDebug
    • Constructor Detail

      • SMSFlatFileObjectBase

        protected SMSFlatFileObjectBase()
                                 throws SMSException
        Constructor for SMSFlatFileObject.
        Throws:
        SMSException
    • Method Detail

      • loadProperties

        protected Properties loadProperties​(File filehandle,
                                            String objName)
                                     throws SMSException
        Loads properties from the attribute file handle.
        Returns:
        Properties object of the configuration object.
        Throws:
        ServiceNotFoundException - if the attributes file is not found.
        SMSException - if an IO error occurred while reading the attributes properties file.
        SchemaException - if a format error occurred while reading the attributes properties file.
      • saveProperties

        protected void saveProperties​(Properties props,
                                      File filehandle,
                                      String header)
                               throws SMSException
        Saves properties to the attributes file handle, with given objName in the file header.
        Throws:
        SMSException
      • toValString

        protected String toValString​(Set vals)
        Converts a Set of values for an attribute into a string, encoding special characters in the values as necessary.
      • toValString

        protected String toValString​(Enumeration en)
        Converts an enumeration of values for an attribute into a string, encoding special characters in the values as necessary. This is used by the modify() method where the values needs to be in a particular order.
      • encodeVal

        protected String encodeVal​(String v)
        Encodes special characters in a value. percent to %25 and comma to %2C.
      • toValSet

        protected Set toValSet​(String attrName,
                               String vals)
        Converts a string of values from the attributes properties file to a Set, decoding special characters in each value.
      • decodeVal

        protected String decodeVal​(String v)
        Decodes a value, %2C to comma and %25 to percent.
      • initialize

        protected void initialize()
                           throws SMSException
        Initializes the SMSFlatFileObject: Gets the flat file directory and default organization DN from AMConfig.properties, creates the root directory if it does not exist.
        Throws:
        SMSException
      • subEntries

        public Set<String> subEntries​(SSOToken token,
                                      String objName,
                                      String filter,
                                      int numOfEntries,
                                      boolean sortResults,
                                      boolean ascendingOrder)
                               throws SMSException,
                                      SSOException
        Returns a Set of sub-entry names that match the given filter.
        Specified by:
        subEntries in class SMSObject
        Parameters:
        token - Ignored argument. Access check is assumed to have occurred before reaching this method.
        objName - Name of the configuration object to get sub entries for. Name is expected to be a dn.
        filter - Filter of sub entry names to get. Only the wildcard character '*' is currently supported.
        numOfEntries - Number of entries to return, or 0 to return all entries.
        sortResults - Whether to sort results. If true will return a Set that will return entries in a sorted order.
        ascendingOrder - Whether the sorted results should be in alphabetically ascending or decending order. This argument is ignored if sortResults is false.
        Returns:
        Set of sub entry names that match the given filter, or an empty Set if the objName is not found or if no sub entries are found with the given filter.
        Throws:
        IllegalArgumentException - if objName or filter is null or empty, or if numOfEntries is less than 0.
        SchemaException - if a sub directory name is not in the expected "ou=..." format.
        SMSException
        SSOException
      • schemaSubEntries

        public Set<String> schemaSubEntries​(SSOToken token,
                                            String objName,
                                            String filter,
                                            String sidFilter,
                                            int numOfEntries,
                                            boolean sortResults,
                                            boolean ascendingOrder)
                                     throws SMSException,
                                            SSOException
        Returns a Set of sub entry names that match the given filter and the given sun service id filter.
        Specified by:
        schemaSubEntries in class SMSObject
        Parameters:
        token - Ignored argument. Access check is assumed to have occurred before reaching this method.
        objName - Name of the configuration object to get sub entries for. Name is expected to be a dn.
        filter - Filter of sub entry names to get. Only the wildcard character '*' is currently supported.
        sidFilter - Filter of Sun Service ID for the sub entries.
        numOfEntries - Number of entries to return, or 0 to return all entries.
        sortResults - Whether to sort results. If true will return a Set that will return entries in a sorted order.
        ascendingOrder - Whether the sorted results should be in alphabetically ascending or decending order. This argument is ignored if sortResults is false.
        Returns:
        Set of sub entry names that match the given filter and sun service id filter, or an empty Set if the objName is not found or if no sub entries are found with the given filters.
        Throws:
        IllegalArgumentException - if objName or filter is null or empty, or if numOfEntries is less than 0.
        SchemaException - if a sub directory name is not in the expected "ou=..." format.
        SMSException
        SSOException
      • search

        public Iterator<SMSDataEntry> search​(SSOToken token,
                                             String objName,
                                             String filter,
                                             int numOfEntries,
                                             int timeLimit,
                                             boolean sortResults,
                                             boolean ascendingOrder,
                                             Set excludes)
                                      throws SSOException,
                                             SMSException
        Search for a config object with the given filter. Do some cheating here - callers of this method only pass service name and version in the filter in a ldap filter format. So return entries matching service name and version in the filter.
        Specified by:
        search in class SMSObject
        Parameters:
        token - Ignored argument. Access check is assumed to have occurred before reaching this method.
        objName - Name of the configuration object to begin search. Name is expected to be a dn.
        filter - Filter of service name and version. Expected to be in SMSEntry.FILTER_PATTERN_SERVICE format.
        numOfEntries - number of max entries, 0 means unlimited
        timeLimit - maximum number of seconds for the search to spend, 0 means unlimited
        sortResults - true to have result sorted.
        ascendingOrder - true to have result sorted in ascending order.
        excludes - Set of DNs to excluded.
        Returns:
        a Map of entries (dn's) that match the given filter.
        Throws:
        IllegalArgumentException - if objName or filter is null or empty, or if filter is not in the expected format.
        SSOException
        SMSException
      • search

        public Set<String> search​(SSOToken token,
                                  String objName,
                                  String filter,
                                  int numOfEntries,
                                  int timeLimit,
                                  boolean sortResults,
                                  boolean ascendingOrder)
                           throws SSOException,
                                  SMSException
        Search for a config object with the given filter. Do some cheating here - callers of this method only pass service name and version in the filter in a ldap filter format. So return entries matching service name and version in the filter.
        Specified by:
        search in class SMSObject
        Parameters:
        token - Ignored argument. Access check is assumed to have occurred before reaching this method.
        objName - Name of the configuration object to begin search. Name is expected to be a dn.
        filter - Filter of service name and version. Expected to be in SMSEntry.FILTER_PATTERN_SERVICE format.
        numOfEntries - number of max entries, 0 means unlimited
        timeLimit - maximum number of seconds for the search to spend, 0 means unlimited
        sortResults - true to have result sorted.
        ascendingOrder - true to have result sorted in ascending order.
        Returns:
        a Set of entries (dn's) that match the given filter.
        Throws:
        IllegalArgumentException - if objName or filter is null or empty, or if filter is not in the expected format.
        SSOException
        SMSException
      • searchSubOrgNames

        public Set<String> searchSubOrgNames​(SSOToken token,
                                             String objName,
                                             String filter,
                                             int numOfEntries,
                                             boolean sortResults,
                                             boolean ascendingOrder,
                                             boolean recursive)
                                      throws SMSException,
                                             SSOException
        Returns the suborganization names. Returns a set of SMSEntry objects that are suborganization names. The paramter numOfEntries identifies the number of entries to return, if 0 returns all the entries.
        Specified by:
        searchSubOrgNames in class SMSObject
        Throws:
        SMSException
        SSOException
      • getSubEntries

        protected abstract Set<String> getSubEntries​(String objName,
                                                     String filter,
                                                     String sidFilter,
                                                     boolean isSubConfig,
                                                     int numOfEntries,
                                                     boolean sortResults,
                                                     boolean ascendingOrder)
                                              throws SMSException
        Real routine to get sub entries, used by subEntries() and schemaSubEntries().
        Throws:
        ServiceNotFoundException - if the configuration object is not found.
        SchemaException - if a sub directory name is not in the expected "ou=..." format.
        SMSException