Package com.sun.identity.sm.flatfile
Class SMSFlatFileObject
- java.lang.Object
-
- com.sun.identity.sm.SMSObject
-
- com.sun.identity.sm.SMSObjectDB
-
- com.sun.identity.sm.flatfile.SMSFlatFileObjectBase
-
- com.sun.identity.sm.flatfile.SMSFlatFileObject
-
public class SMSFlatFileObject extends SMSFlatFileObjectBase
This class represents a configuration object stored in a file. Each file lives in a file system under a directory of configuration objects organized in a hierarchy. Each level in the hierarchy is represented by a directory. The naming convention of a configuration object is hierarchy levels separated by a comma, for example "ou=serviceName,ou=services,dc=sun,dc=com". This object would live in the directory/dc=com/dc=sun/ou=services/ou=serviceName The directory has a file with the object's attributes in java.util.Properties format. The file name is Attributes.properties. Attributes with multi-values are seperated by a comma. A comma within a value is encoded as %2C, and a % within a value is encoded with %25.
-
-
Field Summary
-
Fields inherited from class com.sun.identity.sm.flatfile.SMSFlatFileObjectBase
mDebug, mInitialized, mRootDir, mRootDirHandle, mRootDN, mRWLock
-
-
Constructor Summary
Constructors Constructor Description SMSFlatFileObject()
Constructor for SMSFlatFileObject.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
create(SSOToken token, String objName, Map attrs)
Creates the configuration object.void
delete(SSOToken token, String objName)
Deletes the configuration object and all objects below it.protected void
deleteSunXmlKeyValFiles(File dirHandle)
Delete sunxmlkeyvalue files under the given directory.boolean
entryExists(SSOToken token, String objName)
Returnsture
if the configuration object exists.protected Set
getSubEntries(String objName, String filter, String sidFilter, boolean isSubConfig, int numOfEntries, boolean sortResults, boolean ascendingOrder)
Real routine to get sub entries, used by subEntries() and schemaSubEntries().protected void
loadMapper()
Loads the name mapper, create it if it doesn't exist.void
modify(SSOToken token, String objName, ModificationItem[] mods)
Modify the attributes for the given configuration object.Map
read(SSOToken token, String objName)
Reads in attributes of a configuration object.String
toString()
-
Methods inherited from class com.sun.identity.sm.flatfile.SMSFlatFileObjectBase
decodeVal, deregisterCallbackHandler, encodeVal, initialize, loadProperties, modifyValues, registerCallbackHandler, saveProperties, schemaSubEntries, search, search, searchOrganizationNames, searchSubOrgNames, subEntries, toValSet, toValString, toValString
-
Methods inherited from class com.sun.identity.sm.SMSObjectDB
getAMSdkBaseDN, getRootSuffix
-
Methods inherited from class com.sun.identity.sm.SMSObject
cacheResults, debug, getAttributeNames, getNamingAttribute, getOrgNamingAttribute, getSearchFilter, getServiceIdSearchFilter, initialize, registerCallbackHandler, shutdown
-
-
-
-
Constructor Detail
-
SMSFlatFileObject
public SMSFlatFileObject() throws SMSException
Constructor for SMSFlatFileObject.- Throws:
SMSException
-
-
Method Detail
-
loadMapper
protected void loadMapper() throws SMSException
Loads the name mapper, create it if it doesn't exist.- Throws:
SMSException
-
getSubEntries
protected Set 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().- Specified by:
getSubEntries
in classSMSFlatFileObjectBase
- Throws:
ServiceNotFoundException
- if the configuration object is not found.SchemaException
- if a sub directory name is not in the expected "ou=..." format.ServiceNotFoundException
- if the configuration object is not found.SchemaException
- if a sub directory name is not in the expected "ou=..." format.SMSException
-
deleteSunXmlKeyValFiles
protected void deleteSunXmlKeyValFiles(File dirHandle) throws SMSException
Delete sunxmlkeyvalue files under the given directory.- Throws:
SMSException
-
read
public Map read(SSOToken token, String objName) throws SMSException, SSOException
Reads in attributes of a configuration object.- Specified by:
read
in classSMSObject
- Parameters:
token
- Ignored argument. Access check is assumed to have occurred before reaching this method.objName
- Name of the configuration object, expected to be a dn.- Returns:
- A Map with the coniguration object's attributes or null if the configuration object does not exist or no attributes are found.
- Throws:
SMSException
- if an IO error occurred during the read.SchemaException
- if a format error occurred while reading the attributes properties file.IllegalArgumentException
- if objName argument is null or empty.SSOException
-
create
public void create(SSOToken token, String objName, Map attrs) throws SMSException, SSOException
Creates the configuration object. Creates the directory for the object and the attributes properties file with the given attributes.- Specified by:
create
in classSMSObject
- Parameters:
token
- Ignored argument. Access check is assumed to have occurred before reaching this method.objName
- Name of the configuration object to create. Name is expected to be a dn.attrs
- Map of attributes for the object.- Throws:
IllegalArgumentException
- if the objName or attrs argument is null or empty.ServiceAlreadyExistsException
- if the configuration object already exists.SMSException
- if an IO error occurred while creating the configuration object.SSOException
-
modify
public void modify(SSOToken token, String objName, ModificationItem[] mods) throws SMSException, SSOException
Modify the attributes for the given configuration object.- Specified by:
modify
in classSMSObject
- Parameters:
token
- Ignored argument. Access check is assumed to have occurred before reaching this method.objName
- Name of the configuration object to modify. Name is expected to be a dn.mods
- Array of attributes to modify.- Throws:
IllegalArgumentException
- if objName or mods argument is null or empty, or if an error was encountered getting attributes from the mods argument.ServiceNotFoundException
- if the attributes properties file for the configuration object is not found.SchemaException
- if a format error occurred while reading in the existing attributes properties file.SMSException
- if an IO error occurred while reading or writing to the attributes properties file.SSOException
-
delete
public void delete(SSOToken token, String objName) throws SMSException, SSOException
Deletes the configuration object and all objects below it.- Specified by:
delete
in classSMSObject
- Parameters:
token
- Ignored argument. Access check is assumed to have occurred before reaching this method.objName
- Name of the configuration object to delete. Name is expected to be a dn.- Throws:
IllegalArgumentException
- if objName argument is null or empty.SMSException
- if any files for or under the configuration object could not be removed.SSOException
-
entryExists
public boolean entryExists(SSOToken token, String objName)
Returnsture
if the configuration object exists.- Specified by:
entryExists
in classSMSObject
- Parameters:
token
- Ignored argument. Access check is assumed to have occurred before reaching this method.objName
- Name of the configuration object to check.- Returns:
true>/code> if the configuration object exists.
- Throws:
IllegalArgumentException
- if objName is null or empty.
-
-