Class ConfigMgrImpl
- java.lang.Object
-
- org.apache.directory.fortress.core.impl.Manageable
-
- org.apache.directory.fortress.core.impl.ConfigMgrImpl
-
- All Implemented Interfaces:
Serializable
,ConfigMgr
,Manageable
public class ConfigMgrImpl extends Manageable implements ConfigMgr, Serializable
This Manager impl supplies CRUD methods used to manage properties stored within the ldap directory. The Fortress config nodes are used to remotely share Fortress client specific properties between processes. Fortress places no limits on the number of unique configurations that can be present at one time in the directory. The Fortress client will specify the preferred cfg node by name via a property named,GlobalIds.CONFIG_REALM
. Each process using Fortress client is free to share an existing node with other processes or create its own unique config instance using the methods within this class.
This class is thread safe.
- Author:
- Apache Directory Project
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.apache.directory.fortress.core.impl.Manageable
adminSess, contextId
-
-
Constructor Summary
Constructors Constructor Description ConfigMgrImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Configuration
add(Configuration cfg)
Create a new cfg node with given name and properties.void
delete(String name)
Completely removes named cfg node from the directory.void
delete(String name, Properties inProps)
Delete properties from existing cfg node.Configuration
getIds(String name)
Read an existing cfg node with given name and return posixIds to caller.Configuration
read(String name)
Read an existing cfg node with given name and return to caller.Configuration
update(Configuration cfg)
Update existing cfg node with additional properties, or, replace existing properties.void
updateProperty(String name, String key, String value, String newValue)
This method will update a single property with a new value..-
Methods inherited from class org.apache.directory.fortress.core.impl.Manageable
assertContext, assertContext, checkAccess, getFullMethodName, setAdmin, setAdminData, setContextId, setEntitySession
-
-
-
-
Method Detail
-
add
public Configuration add(Configuration cfg) throws SecurityException
Create a new cfg node with given name and properties. The name is required. If node already exists,SecurityException
with errorGlobalErrIds.FT_CONFIG_ALREADY_EXISTS
will be thrown.required parameters
- Specified by:
add
in interfaceConfigMgr
- Parameters:
cfg
- contains the name and optional attributes.- Configuration#name - contains the name of new object being added
optional parameters
- Configuration#props - List of name / value pairs corresponding to fortress configuration entries.
- Configuration#uidNumber - String containing valid integer value for sequence number
- Configuration#gidNumber - String containing valid integer value for sequence number
- Returns:
- Configuration - contains the configuration entity that was added.
- Throws:
SecurityException
- in the event entry already present or other system error.
-
update
public Configuration update(Configuration cfg) throws SecurityException
Update existing cfg node with additional properties, or, replace existing properties. The name is required. If node does not exist, a org.apache.directory.fortress.core.SecurityException with error org.apache.directory.fortress.core.GlobalErrIds#FT_CONFIG_NOT_FOUND will be thrown.required parameters
- Specified by:
update
in interfaceConfigMgr
- Parameters:
cfg
- contains the name and optional attributes.- Configuration#name - contains the name of new object being added
optional parameters
- Configuration#props - List of name / value pairs corresponding to fortress configuration entries.
- Configuration#uidNumber - String containing valid integer value for sequence number
- Configuration#gidNumber - String containing valid integer value for sequence number
- Returns:
- Configuration - contains the configuration entity that was added.
- Throws:
SecurityException
- in the event entry not present or other system error.
-
updateProperty
public void updateProperty(String name, String key, String value, String newValue) throws SecurityException
This method will update a single property with a new value..- Specified by:
updateProperty
in interfaceConfigMgr
- Parameters:
name
- of the config node, mostly likely 'DEFAULT'.key
- used for the property.value
- this is old value to be replaced with newValue.newValue
- new value for the property- Throws:
SecurityException
- in the event entry not present or other system error.
-
delete
public void delete(String name) throws SecurityException
Completely removes named cfg node from the directory. The name is required. If node does not exist, aSecurityException
with errorwill be thrown.
- Specified by:
delete
in interfaceConfigMgr
- Parameters:
name
- is required and maps to 'cn' attribute on 'device' object class of node targeted for operation.- Throws:
SecurityException
- in the event of system error.
-
delete
public void delete(String name, Properties inProps) throws SecurityException
Delete properties from existing cfg node. The name is required. If node does not exist, aSecurityException
with errorGlobalErrIds.FT_CONFIG_NOT_FOUND
will be thrown.- Specified by:
delete
in interfaceConfigMgr
- Parameters:
name
- attribute is required and maps to 'cn' attribute in 'device' object class.inProps
- contains the properties to remove.- Throws:
SecurityException
- in the event entry not present or other system error.
-
read
public Configuration read(String name) throws SecurityException
Read an existing cfg node with given name and return to caller. The name is required. If node doesn't exist, aSecurityException
with errorGlobalErrIds.FT_CONFIG_NOT_FOUND
will be thrown.- Specified by:
read
in interfaceConfigMgr
- Parameters:
name
- attribute is required and maps to 'cn' attribute in 'device' object class.- Returns:
Configuration
containing the collection of name/value pairs present. Maps to 'ftProps' attribute in 'ftProperties' object class.- Throws:
SecurityException
- in the event entry doesn't exist or other system error.
-
getIds
public Configuration getIds(String name) throws SecurityException
Read an existing cfg node with given name and return posixIds to caller. The name is required. If node doesn't exist, aSecurityException
with errorGlobalErrIds.FT_CONFIG_NOT_FOUND
will be thrown.- Specified by:
getIds
in interfaceConfigMgr
- Parameters:
name
- attribute is required and maps to 'cn' attribute in 'device' object class.- Returns:
Configuration
entity contains the getPosixIds on the specified node.- Throws:
SecurityException
- in the event entry doesn't exist or other system error.
-
-