public final class DirectoryService
extends java.lang.Object
Class DirectoryService
provides front-end functionality for
one instance of the back-end. The type of the back-end is determined at
startup by reading configuration file.
DirectoryService
interacts with the
SecurityManager
for several purposes. First of all it uses
ContextLocal
variables (backed by the
SecurityManager
) to track clients which are working with the
P2J Directory. For each client separate bind status and batch editing
session status is tracked. If the client interrupts its session abnormally
then the active session is automatically closed and the open batch editing
transaction is rolled back.
During work DirectoryService
can create temporary pseudo
back-ends of type ShadowRemapper
. These back-ends are used
to track changes during batch editing and created when application opens
batch editing session. When batch editing session is closed, depending on
the closing mode (commit/rollback) changes are moved to the real back-end
or just skipped. The implementation is designed so all changes made during
editing session are visible to the application which did open that session
as if they are actually performed. Other clients don't see changes until
they are actually committed.
Beside implementation of the front-end interface
DirectoryService
class provides several static helper
methods used by other members of the package, in particular
DirectoryCopy
and ShadowRemapper
.
Modifier and Type | Class and Description |
---|---|
(package private) class |
DirectoryService.AttributeAdder
Helper class for the adding values to the attributes.
|
(package private) class |
DirectoryService.AttributeGetter
Helper class for the getting value from the attribute.
|
(package private) class |
DirectoryService.AttributeRemover
Helper class for the getting value from the attribute.
|
(package private) class |
DirectoryService.AttributeSetter
Helper class for setting attribute values.
|
(package private) static class |
DirectoryService.BatchRef
Class BatchRef is a container for the batch editing variables.
|
(package private) static class |
DirectoryService.BindRef
This is a helper class used to clean up forgotten or improperly closed
sessions.
|
private class |
DirectoryService.ExpirableLock |
(package private) class |
DirectoryService.LockHelper
Base class for all attribute helper classes.
|
private static class |
DirectoryService.NodeCopier
Utility class which is used to copy subtree into different place.
|
(package private) class |
DirectoryService.NodeLocker
Helper class for accessing nodes.
|
private static class |
DirectoryService.NodeRemover
Utility class which is used for the cleanups after various operations.
|
private static class |
DirectoryService.Rollback
Utility class which is used for the rolling back of the transactions.
|
private static class |
DirectoryService.WorkArea
Wraps old
ContextLocal<BatchRef> activeBatch and
ContextLocal<BindRef> bound and has the purpose of
cleaning them up when needed. |
Modifier and Type | Field and Description |
---|---|
protected Remapper |
backend
Reference to underlying back-end
|
private static java.lang.Object |
batchSynch
Batch activation synchronization object
|
private static java.lang.Object |
bindSync
Reference counter synchronization object
|
private static ContextLocal<DirectoryService.WorkArea> |
clwa
Context-local WorkArea instance
|
private static DirectoryService |
directory
Instance of the DirectoryService
|
private static int |
ERR_BASE
Base error code.
|
static int |
ERR_CANT_LOCK_DIRECTORY
backupDirectory(String) failed because it can't obtain the lock. |
static int |
ERR_CANT_REFRESH_BACKEND
Error code which indicates that backend can't perform refresh.
|
static int |
ERR_CANT_RENAME
backupDirectory(String) cant rename file. |
static int |
ERR_CANT_WRITE
Writing error happened during
backupDirectory(String) call. |
static int |
ERR_EDITING_IS_ACTIVE
backupDirectory(String) failed because editing is active. |
static int |
ERR_FATAL
backupDirectory(String) failed because of fatal backend error. |
static int |
ERR_LOCK_EXPIRED
Error code which indicates that directory lock can't be placed.
|
static int |
ERR_NO_LOCK
Error code which indicates that editing is in progress.
|
static int |
ERR_SAVE_NOT_SUPPORTED
backupDirectory(String) call is not supported. |
private boolean |
initialized
Initialized flag that controls access check methods
|
protected LockManager |
lockManager
An object which performs all tracking of the locks
|
private static java.util.logging.Logger |
LOG
The logger instance.
|
private Remapper |
metaData
Information about classes information
|
static int |
OK
backupDirectory(String) call was successful. |
private int |
refCount
bind()/unbind() call counter
|
private DirectoryService.ExpirableLock |
refreshExpirableLock
Current refresh expirable lock (if any).
|
private long |
refreshingId
ID of the refreshing thread.
|
private java.lang.Object |
refreshLock
Synchronization object for refresh handling.
|
private java.lang.String |
serverId
server's own ID
|
private DirectoryService.BatchRef |
tempActiveBatch
Temporary batch storage when SecurityManager is not present
|
Modifier | Constructor and Description |
---|---|
private |
DirectoryService(BootstrapConfig config)
Construct an instance using the given configuration to instantiate
the directory back-end.
|
Modifier and Type | Method and Description |
---|---|
(package private) static boolean |
addNode(Remapper remapper,
java.lang.String nodeId,
java.lang.String nodeClass,
Attribute[] data,
boolean canReplace,
boolean checkLeafs)
Add node at specified location.
|
boolean |
addNode(java.lang.String nodeId,
java.lang.String nodeClass,
Attribute[] data)
Add new node of specified class with specified ID.
|
boolean |
addNodeAttributes(java.lang.String nodeId,
java.lang.String nodeClass,
java.util.Map<java.lang.String,java.lang.Object[]> data)
Add new node of specified class with specified ID.
|
boolean |
addNodeBitField(java.lang.String nodeId,
java.lang.String name,
BitField value)
Add new
BitField value to the attribute. |
boolean |
addNodeBitSelector(java.lang.String nodeId,
java.lang.String name,
BitSelector value)
Add new
BitSelector value to the attribute. |
boolean |
addNodeBoolean(java.lang.String nodeId,
java.lang.String name,
boolean value)
Add new
boolean value to the attribute. |
boolean |
addNodeByteArray(java.lang.String nodeId,
java.lang.String name,
byte[] value)
Add new
byte[] value to the attribute. |
boolean |
addNodeDate(java.lang.String nodeId,
java.lang.String name,
DateValue value)
Add new
DateValue value to the attribute. |
boolean |
addNodeDouble(java.lang.String nodeId,
java.lang.String name,
double value)
Add new
Double value to the attribute. |
boolean |
addNodeInteger(java.lang.String nodeId,
java.lang.String name,
int value)
Add new
int value to the attribute. |
boolean |
addNodeString(java.lang.String nodeId,
java.lang.String name,
java.lang.String value)
Add new
String value to the attribute. |
boolean |
addNodeTime(java.lang.String nodeId,
java.lang.String name,
TimeValue value)
Add new
TimeValue value to the attribute. |
boolean |
atomicRefresh()
Refresh backend in one single step.
|
int |
backupDirectory(java.lang.String newFile)
Save directory into new file.
|
boolean |
bind()
Initialize directory service for current
SecurityManager
session. |
private boolean |
canAccessAttribute(java.lang.String name,
int mode,
java.lang.String nodeClass)
Checks the subject's permissions to perform the specified access to a
directory node's attribute with the given node class name.
|
private boolean |
canAccessAttribute(java.lang.String oId,
java.lang.String name,
int mode)
Checks the subject's permissions to perform the specified access to a
directory node's attribute.
|
protected boolean |
canAccessNode(java.lang.String oId,
int mode)
Checks the subject's permissions to perform the specified access to a
directory node.
|
private boolean |
canAccessNode(java.lang.String oId,
int parentMode,
int mode)
Checks the subject's permissions to perform the specified access to a
directory node which requires a different access to its parent node.
|
protected boolean |
canAccessNodeAndAttribute(java.lang.String oId,
int nodeMode,
java.lang.String name,
int attrMode)
Checks the subject's permissions to perform the specified access to a
directory node and a different access to its attribute.
|
void |
cancelRefresh()
Cancel planned refreshing operation.
|
boolean |
closeBatch(boolean disposition)
Close batch editing session assuming security cache refresh.
|
boolean |
closeBatch(boolean disposition,
boolean refresh)
Close batch editing session.
|
protected boolean |
closeBatchInt(DirectoryService.BatchRef ref,
boolean disposition,
boolean refresh)
Close batch editing session main worker routine.
|
boolean |
copyNode(java.lang.String nodeId,
java.lang.String newId,
boolean recursive)
Copies source node (and optionally recursively all its child nodes) to
given destination.
|
protected static boolean |
copySubtree(Remapper source,
java.lang.String srcBase,
Remapper destination,
java.lang.String dstBase,
boolean recursive)
Copy subtree from the source location (back-end and source node ID) to
destination (back-end and destination node ID).
|
static DirectoryService |
createInstance(BootstrapConfig cfg)
Returns the current singleton instance if it is already initialized or
creates a new instance using the current configuration to instantiate
the back-end.
|
boolean |
deleteNode(java.lang.String nodeId)
Remove specified node from the directory (unless node has children).
|
boolean |
deleteNodeAttribute(java.lang.String nodeId,
java.lang.String name)
Remove whole node attribute.
|
boolean |
deleteNodeAttributeValue(java.lang.String nodeId,
java.lang.String name,
int index)
Remove particular value from the node attribute.
|
private boolean |
delRef()
Complementary method for the
newRef() . |
NodeAttribute[] |
enumerateNodeAttributes(java.lang.String nodeId)
Return information about existing node attributes.
|
java.lang.String[] |
enumerateNodes(java.lang.String nodeId)
Get array of names of nodes for which given node is immediate parent.
|
private static Attribute |
genEmptyAttribute(Remapper remapper,
java.lang.String nodeId,
java.lang.String name)
Generate new empty (without values) instance of the
Attribute for specified node and attribute name. |
(package private) static Remapper |
genRemapper(BootstrapConfig config)
Construct an back-end instance using provided configuration information.
|
private DirectoryService.BatchRef |
getActiveBatch()
Get active batch for current session.
|
NodeAttribute |
getClassNodeAttribute(java.lang.String className,
java.lang.String name)
Get NodeAttribute structure for the specified attribute.
|
NodeAttribute[] |
getClassNodeAttributes(java.lang.String className)
Generate an array of
NodeAttribute structures for the all
attributes defined for the node class. |
static DirectoryService |
getInstance()
Returns
DirectoryService instance. |
protected static Attribute |
getNodeAttribute(Remapper remapper,
java.lang.String nodeId,
java.lang.String name)
Retrieve entire attribute from specified node.
|
(package private) static Attribute[] |
getNodeAttributes(Remapper remapper,
java.lang.String nodeId)
Returns the entire set of attributes with all their values, or
null if request fails. |
Attribute[] |
getNodeAttributes(java.lang.String nodeId)
Returns all existing attributes of given node.
|
BitField |
getNodeBitField(java.lang.String nodeId,
java.lang.String name)
This is a convenience wrapper for the
getNodeBitField(String, String, int) method. |
BitField |
getNodeBitField(java.lang.String nodeId,
java.lang.String name,
int index)
Get
BitField attribute value for specified node ID and
index. |
BitField[] |
getNodeBitFields(java.lang.String nodeId,
java.lang.String name)
Get all
BitField attribute values for specified node ID. |
BitSelector |
getNodeBitSelector(java.lang.String nodeId,
java.lang.String name)
This is a convenience wrapper for the
getNodeBitSelector(String, String, int) method. |
BitSelector |
getNodeBitSelector(java.lang.String nodeId,
java.lang.String name,
int index)
Get
BitSelector attribute value for specified node ID and
index. |
BitSelector[] |
getNodeBitSelectors(java.lang.String nodeId,
java.lang.String name)
Get all
BitSelector attribute values for specified node
ID. |
java.lang.Boolean |
getNodeBoolean(java.lang.String nodeId,
java.lang.String name)
This is a convenience wrapper for the
getNodeBoolean(String, String, int) method. |
java.lang.Boolean |
getNodeBoolean(java.lang.String nodeId,
java.lang.String name,
int index)
Get
Boolean attribute value for specified node ID and
index. |
java.lang.Boolean[] |
getNodeBooleans(java.lang.String nodeId,
java.lang.String name)
Get all
Boolean attribute values for specified node ID. |
byte[] |
getNodeByteArray(java.lang.String nodeId,
java.lang.String name)
This is a convenience wrapper for the
getNodeByteArray(String, String, int) method. |
byte[] |
getNodeByteArray(java.lang.String nodeId,
java.lang.String name,
int index)
Get
byte array attribute value for specified node ID and
index. |
byte[][] |
getNodeByteArrays(java.lang.String nodeId,
java.lang.String name)
Get all
byte array attribute values for specified node
ID. |
java.lang.String |
getNodeClass(java.lang.String nodeId)
Gets meta class ID for the Object Class to which specified node belongs.
|
DateValue |
getNodeDate(java.lang.String nodeId,
java.lang.String name)
This is a convenience wrapper for the
getNodeDate(String, String, int) method. |
DateValue |
getNodeDate(java.lang.String nodeId,
java.lang.String name,
int index)
Get
DateValue attribute value for specified node ID and
index. |
DateValue[] |
getNodeDates(java.lang.String nodeId,
java.lang.String name)
Get all
DateValue attribute values for specified node ID. |
java.lang.Double |
getNodeDouble(java.lang.String nodeId,
java.lang.String name)
This is a convenience wrapper for the
getNodeDouble(String, String, int) method. |
java.lang.Double |
getNodeDouble(java.lang.String nodeId,
java.lang.String name,
int index)
Get
Double attribute value for specified node ID and
index. |
java.lang.Double[] |
getNodeDoubles(java.lang.String nodeId,
java.lang.String name)
Get all
Double attribute values for specified node ID. |
java.lang.Integer |
getNodeInteger(java.lang.String nodeId,
java.lang.String name)
This is a convenience wrapper for the
getNodeInteger(String, String, int) method. |
java.lang.Integer |
getNodeInteger(java.lang.String nodeId,
java.lang.String name,
int index)
Get
Integer attribute value for specified node ID and
index. |
java.lang.Integer[] |
getNodeIntegers(java.lang.String nodeId,
java.lang.String name)
Get all
Integer attribute values for specified node ID. |
java.lang.String |
getNodeString(java.lang.String nodeId,
java.lang.String name)
This is a convenience wrapper for the
getNodeString(String, String, int) method. |
java.lang.String |
getNodeString(java.lang.String nodeId,
java.lang.String name,
int index)
Get
String attribute value for specified node ID and
index. |
java.lang.String[] |
getNodeStrings(java.lang.String nodeId,
java.lang.String name)
Get all
String attribute values for specified node ID. |
TimeValue |
getNodeTime(java.lang.String nodeId,
java.lang.String name)
This is a convenience wrapper for the
getNodeTime(String, String, int) method. |
TimeValue |
getNodeTime(java.lang.String nodeId,
java.lang.String name,
int index)
Get
TimeValue attribute value for specified node ID and
index. |
TimeValue[] |
getNodeTimes(java.lang.String nodeId,
java.lang.String name)
Get all
TimeValue attribute values for specified node ID. |
java.lang.String |
getServerId()
Returns the server identification string from the bootstrap
configuration.
|
private static boolean |
getSingleAttributeValue(Remapper remapper,
java.lang.String node,
Attribute attr)
Retrieve one attribute value using attribute type specific call.
|
private void |
init()
Common initialisation code,
|
private void |
initMetaInfo()
This method fills "/meta" subtree with the information about supported
classes provided by the backend.
|
boolean |
isBound()
Check if session is bound to the directory service.
|
boolean |
isEditing()
Checks to see if a batch editing is in progress.
|
boolean |
lockForRefresh(int seconds)
Lock directory for refreshing operation.
|
protected static void |
log(java.util.logging.Level level,
java.lang.String message)
Main logging entry point.
|
protected static void |
log(java.util.logging.Level level,
java.lang.String message,
java.lang.Throwable t)
Main logging entry point.
|
protected static void |
logDebug(java.lang.String string)
Log message as debug (sensitive trace) entry.
|
protected static void |
logError(java.lang.String string)
Log message as error entry.
|
protected static void |
logError(java.lang.String string,
java.lang.Throwable t)
Log message as error entry.
|
protected static void |
logList(java.lang.String string)
Log message as list entry.
|
protected static void |
logTrace(java.lang.String string)
Log message as trace entry.
|
protected static void |
logWarning(java.lang.String string)
Log message as warning entry.
|
boolean |
moveNode(java.lang.String nodeId,
java.lang.String newId)
Renames the existing object, specified by nodeId, or moves it to a
different location.
|
private boolean |
newRef()
Bind request counter.
|
boolean |
openBatch(java.lang.String nodeId)
Open batch editing session.
|
protected static int |
prepareNodeAttribute0(Remapper remapper,
java.lang.String nodeId,
java.lang.String name)
Prepare node for the setting of all attribute values.
|
protected static boolean |
pruneSubtree(Remapper remapper,
java.lang.String nodeId,
boolean preserveLock)
Remove subtree from the specified back-end starting from specified
subtree root node ID.
|
int |
refresh()
Refresh backend after placing a refresh lock.
|
private void |
removeActiveBatch()
Remove reference to active batch.
|
private boolean |
rollBack()
Roll back all transactions which are left from previous start.
|
void |
securityIsUp()
Signals the end of security environment initialization.
|
private void |
setActiveBatch(DirectoryService.BatchRef batch)
Set reference to active batch.
|
private static boolean |
setNodeAttribute(Remapper remapper,
java.lang.String nodeId,
Attribute data)
Set one attribute to the node.
|
(package private) static boolean |
setNodeAttributes(Remapper remapper,
java.lang.String nodeId,
Attribute[] data)
Set all attributes on specified node.
|
boolean |
setNodeAttributes(java.lang.String nodeId,
Attribute[] data)
Replace all node attributes with provided ones.
|
boolean |
setNodeBitField(java.lang.String nodeId,
java.lang.String name,
BitField value)
A convenience wrapper for
setNodeBitField(String, String, int, BitFiled) method
which is invoked assuming that index is 0. |
boolean |
setNodeBitField(java.lang.String nodeId,
java.lang.String name,
int index,
BitField value)
Set
BitField attribute value for specified node ID,
attribute name and index. |
boolean |
setNodeBitFields(java.lang.String nodeId,
java.lang.String name,
BitField[] value)
Replace all
BitField node attribute values with new ones. |
boolean |
setNodeBitSelector(java.lang.String nodeId,
java.lang.String name,
BitSelector value)
A convenience wrapper for
setNodeBitSelector(String, String, int, BitSelector)
method which is invoked assuming that index is 0. |
boolean |
setNodeBitSelector(java.lang.String nodeId,
java.lang.String name,
int index,
BitSelector value)
Set
BitSelector attribute value for specified node ID,
attribute name and index. |
boolean |
setNodeBitSelectors(java.lang.String nodeId,
java.lang.String name,
BitSelector[] value)
Replace all
BitSelector node attribute values with new
ones. |
boolean |
setNodeBoolean(java.lang.String nodeId,
java.lang.String name,
boolean value)
A convenience wrapper for
setNodeBoolean(String, String, int, boolean) method which
is invoked assuming that index is 0. |
boolean |
setNodeBoolean(java.lang.String nodeId,
java.lang.String name,
int index,
boolean value)
Set
boolean attribute value for specified node ID,
attribute name and index. |
boolean |
setNodeBooleans(java.lang.String nodeId,
java.lang.String name,
boolean[] value)
Replace all
Boolean node attribute values with new ones. |
boolean |
setNodeByteArray(java.lang.String nodeId,
java.lang.String name,
byte[] value)
A convenience wrapper for
setNodeByteArray(String, String, int, byte[]) method
which is invoked assuming that index is 0. |
boolean |
setNodeByteArray(java.lang.String nodeId,
java.lang.String name,
int index,
byte[] value)
Set
byte[] attribute value for specified node ID,
attribute name and index. |
boolean |
setNodeByteArrays(java.lang.String nodeId,
java.lang.String name,
byte[][] value)
Replace all
byte[] node attribute values with new ones. |
boolean |
setNodeDate(java.lang.String nodeId,
java.lang.String name,
DateValue value)
A convenience wrapper for
setNodeDate(String, String, int, DateValue) method which
is invoked assuming that index is 0. |
boolean |
setNodeDate(java.lang.String nodeId,
java.lang.String name,
int index,
DateValue value)
Set
DateValue attribute value for specified node ID,
attribute name and index. |
boolean |
setNodeDates(java.lang.String nodeId,
java.lang.String name,
DateValue[] value)
Replace all
DateValue node attribute values with new
ones. |
boolean |
setNodeDouble(java.lang.String nodeId,
java.lang.String name,
double value)
A convenience wrapper for
setNodeDouble(String, String, int, double) method which
is invoked assuming that index is 0. |
boolean |
setNodeDouble(java.lang.String nodeId,
java.lang.String name,
int index,
double value)
Set
double attribute value for specified node ID,
attribute name and index. |
boolean |
setNodeDoubles(java.lang.String nodeId,
java.lang.String name,
double[] value)
Replace all
Double node attribute values with new ones. |
boolean |
setNodeInteger(java.lang.String nodeId,
java.lang.String name,
int value)
A convenience wrapper for
setNodeInteger(String, String, int, int) method which is
invoked assuming that index is 0. |
boolean |
setNodeInteger(java.lang.String nodeId,
java.lang.String name,
int index,
int value)
Set
int attribute value for specified node ID, attribute
name and index. |
boolean |
setNodeIntegers(java.lang.String nodeId,
java.lang.String name,
int[] value)
Replace all
Integer node attribute values with new ones. |
boolean |
setNodeString(java.lang.String nodeId,
java.lang.String name,
int index,
java.lang.String value)
Set
String attribute value for specified node ID,
attribute name and index. |
boolean |
setNodeString(java.lang.String nodeId,
java.lang.String name,
java.lang.String value)
A convenience wrapper for
setNodeString(String, String, int, String) method which
is invoked assuming that index is 0. |
boolean |
setNodeStrings(java.lang.String nodeId,
java.lang.String name,
java.lang.String[] value)
Replace all
String node attribute values with new ones. |
boolean |
setNodeTime(java.lang.String nodeId,
java.lang.String name,
int index,
TimeValue value)
Set
TimeValue attribute value for specified node ID,
attribute name and index. |
boolean |
setNodeTime(java.lang.String nodeId,
java.lang.String name,
TimeValue value)
A convenience wrapper for
setNodeTime(String, String, int, TimeValue) method which
is invoked assuming that index is 0. |
boolean |
setNodeTimes(java.lang.String nodeId,
java.lang.String name,
TimeValue[] value)
Replace all
TimeValue node attribute values with new
ones. |
protected Remapper |
synchBatch(java.lang.String id,
boolean rw)
Choose back-end on which operation will be performed.
|
private static java.lang.Object |
traverseTree(Remapper remapper,
java.lang.String nodeId,
NodeProcessor proc,
boolean direction)
Traverse entire subtree from specified node down to the leafs.
|
boolean |
unbind()
Close directory service for current
SecurityManager session. |
private boolean |
unbind(DirectoryService.WorkArea wa)
Worker for unbind() method that closes directory service for current
SecurityManager session. |
private boolean |
verifyAttribute(Remapper remapper,
java.lang.String nodeId,
java.lang.String name,
java.lang.Object value,
int ordinal)
Check attribute for existence of specified value.
|
private static boolean |
verifyBooleanValues(boolean[] value)
Verify array of
boolean values for duplicates. |
private static boolean |
verifyDoubleValues(double[] value)
Verify array of
double values for duplicates. |
private static boolean |
verifyIntegerValues(int[] value)
Verify array of
integer values for duplicates. |
private static boolean |
verifyValues(java.lang.Object[] value)
Verify array of values for duplicates.
|
private static java.lang.Object batchSynch
private static java.lang.Object bindSync
private static DirectoryService directory
private static final ContextLocal<DirectoryService.WorkArea> clwa
public static final int OK
backupDirectory(String)
call was successful.private static final int ERR_BASE
public static final int ERR_NO_LOCK
public static final int ERR_LOCK_EXPIRED
public static final int ERR_CANT_REFRESH_BACKEND
public static final int ERR_SAVE_NOT_SUPPORTED
backupDirectory(String)
call is not supported.public static final int ERR_CANT_WRITE
backupDirectory(String)
call.public static final int ERR_CANT_RENAME
backupDirectory(String)
cant rename file.public static final int ERR_EDITING_IS_ACTIVE
backupDirectory(String)
failed because editing is active.public static final int ERR_CANT_LOCK_DIRECTORY
backupDirectory(String)
failed because it can't obtain the lock.public static final int ERR_FATAL
backupDirectory(String)
failed because of fatal backend error.private static java.util.logging.Logger LOG
protected Remapper backend
protected LockManager lockManager
private final java.lang.Object refreshLock
private DirectoryService.BatchRef tempActiveBatch
private boolean initialized
private Remapper metaData
private int refCount
private java.lang.String serverId
private DirectoryService.ExpirableLock refreshExpirableLock
private long refreshingId
private DirectoryService(BootstrapConfig config) throws ConfigurationException
config
- Configuration information.ConfigurationException
- In case of any configuration error.public static DirectoryService createInstance(BootstrapConfig cfg) throws ConfigurationException
cfg
- Configuration information.ConfigurationException
- In case of configuration error.public static DirectoryService getInstance()
DirectoryService
instance.protected static boolean copySubtree(Remapper source, java.lang.String srcBase, Remapper destination, java.lang.String dstBase, boolean recursive)
source
- The backend from which subtree will be copied.srcBase
- An ID of the root node of the source subtree.destination
- The backend to which subtree will be copied.dstBase
- An ID of the root node in the destination backend.recursive
- true
enables recursive copying of children.true
if operation was successful and
false
otherwise.protected static Attribute getNodeAttribute(Remapper remapper, java.lang.String nodeId, java.lang.String name)
remapper
- Back-end instance.nodeId
- Node IDname
- Attribute nameAttribute
or
null
if there is no such node or no such
attribute name.protected static void log(java.util.logging.Level level, java.lang.String message)
level
- Debug level of this message.message
- Text of the message.protected static void log(java.util.logging.Level level, java.lang.String message, java.lang.Throwable t)
level
- Debug level of this message.message
- Text of the message.t
- Cause of the problem.protected static void logDebug(java.lang.String string)
string
- Message text.protected static void logError(java.lang.String string)
string
- Message text.protected static void logError(java.lang.String string, java.lang.Throwable t)
string
- Message text.t
- Cause of the error.protected static void logList(java.lang.String string)
string
- Message text.protected static void logTrace(java.lang.String string)
string
- Message text.protected static void logWarning(java.lang.String string)
string
- Message text.protected static int prepareNodeAttribute0(Remapper remapper, java.lang.String nodeId, java.lang.String name)
remapper
- Back-end on which operation will be performed.nodeId
- A node whose attribute will be updatedname
- Node attribute name0
in case of error, 1
if
attribute is mandatory, 2
if attribute is
ordinary.protected static boolean pruneSubtree(Remapper remapper, java.lang.String nodeId, boolean preserveLock)
preserveLock
parameter is set to true
. In
this case the subtree root, and any "backup" and "lock" child nodes (and
appropriate subtrees, if there are any) are preserved.remapper
- Back-end where subtree is stored.nodeId
- Subtree starting point.preserveLock
- Preserve child nodes with names "lock" and "backup".true
if operation was successful and
false
otherwise.static boolean addNode(Remapper remapper, java.lang.String nodeId, java.lang.String nodeClass, Attribute[] data, boolean canReplace, boolean checkLeafs)
remapper
- Remapper where node will be added or replaced.nodeId
- ID of the node to add/replacenodeClass
- Name of the Object Class of the created node.data
- List of attributes for the node.canReplace
- Allow replacing existing nodes.checkLeafs
- Check parent node class to make sure that it is not leaf.true
if operation was successful and
false
otherwise.static Remapper genRemapper(BootstrapConfig config) throws ConfigurationException
The back-end instantiated using Java reflection. There are two possible
ways in which name of the class is determined. If user specifies
class configuration variable then it must represent full class
name (including package name) and is used as is. If user specifies
type configuration variable then class name is constructed as
follows: given back-end alias provided in type configuration
variable converted to lower case and its first character converted to
upper case. Then to alias added prefix - full package name (
com.goldencode.p2j.directory ) and suffix - Remapper . For
example:
ldap is converted to
com.goldencode.p2j.directory.LdapRemapper ,
xml is converted to com.goldencode.p2j.directory.XmlRemapper
.
The class configuration variable has higher priority than type configuration variable and if both variables are specified then class variable is used.
Regardless from the method in which back-end class name is constructed,
the class itself must meet two main requirements: 1) it must implement
Remapper
interface, 2) it must have constructor which
accepts one parameter (reference to BootstrapConfig
instance) accessible from the com.goldencode.p2j.directory
package.
config
- Configuration data.ConfigurationException
- In case of configuration error.static Attribute[] getNodeAttributes(Remapper remapper, java.lang.String nodeId)
null
if request fails.remapper
- Remapper instance which will be used to perform operation.nodeId
- Node for which list of attributes is requested.null
.private static Attribute genEmptyAttribute(Remapper remapper, java.lang.String nodeId, java.lang.String name)
Attribute
for specified node and attribute name.remapper
- A back-end on which operation will be performed.nodeId
- Node IDname
- Attribute nameAttribute
or
null
if there is no such node or no such
attribute name.private static boolean getSingleAttributeValue(Remapper remapper, java.lang.String node, Attribute attr)
remapper
- Remapper instance which will be used to perform operation.node
- Node IDattr
- Attribute which will receive new value.true
if operation was successful.private static boolean setNodeAttribute(Remapper remapper, java.lang.String nodeId, Attribute data)
remapper
- Backend on which operation will be performed.nodeId
- Node ID.data
- New attribute value.true
if operation was successful and
false
otherwise.static boolean setNodeAttributes(Remapper remapper, java.lang.String nodeId, Attribute[] data)
remapper
- An instance of Remapper
on which operation will
be performed.nodeId
- Node ID.data
- List of new attributes.true
if operation was successful and
false
otherwise.private static java.lang.Object traverseTree(Remapper remapper, java.lang.String nodeId, NodeProcessor proc, boolean direction)
visit()
method of provided
NodeProcessor
object. If visit()
returns
null
then processing continues. If visit()
returns an instance of Object
then processing is stopped
and that instance is returned.
Depending on the parameter method may traverse tree in top-down
or bottom-up manner. If direction
parameter is
set to true
( top-down mode) then node
visit()
is called for the node nodeId
first and then for child nodes. If direction
is set to
false
( bottom-up mode) then visit()
is called for all child nodes and then for the nodeId
node.
The top-down mode is convenient for operations such as backup,
when copy of the parent node should be created before copies of the
child nodes.
The bottom-up mode is convenient for operations such as pruning
subtree, when child nodes must be removed before parent node.
This method does not check parameters for performance reasons so it is
caller responsibility to provide valid parameters (at least they should
not be null
).
remapper
- Remapper instance which will be traversed.nodeId
- Node ID to start traverse from.proc
- Instance of NodeProcessor
direction
- Traversal direction flag. If it is set to true
then visit()
is called for parent node and then
for each child node. If parameter is false
then
visit()
is called for all child nodes and then
for parent node.NodeProcessor.visit()
or null
if
all nodes are visited.private static boolean verifyBooleanValues(boolean[] value)
boolean
values for duplicates.value
- Source array.true
if array does not contain duplicates.private static boolean verifyDoubleValues(double[] value)
double
values for duplicates.value
- Source array.true
if array does not contain duplicates.private static boolean verifyIntegerValues(int[] value)
integer
values for duplicates.value
- Source array.true
if array does not contain duplicates.private static boolean verifyValues(java.lang.Object[] value)
value
- Source array.true
if array does not contain duplicates.public boolean atomicRefresh()
true
if refresh was successful.public boolean lockForRefresh(int seconds)
seconds
- Seconds to wait before lock will expire.true
if lock was successful.public int refresh()
ERR_NO_LOCK
- is returned when no lock is presentERR_LOCK_EXPIRED
- is returned if lock is present
but it is expired or belongs to other thread.ERR_CANT_REFRESH_BACKEND
- is returned when
backend can't update directory.public void cancelRefresh()
public java.lang.String getServerId()
public boolean addNode(java.lang.String nodeId, java.lang.String nodeClass, Attribute[] data)
Required permissions:
nodeId
- Node name.nodeClass
- Node class name.data
- A list of the attributes.true
if operation was successful and
false
otherwise.public boolean addNodeAttributes(java.lang.String nodeId, java.lang.String nodeClass, java.util.Map<java.lang.String,java.lang.Object[]> data)
Required permissions:
nodeId
- Node name.nodeClass
- Node class name.data
- A map of an attribute name to its value.true
if operation was successful and
false
otherwise.public boolean addNodeBitField(java.lang.String nodeId, java.lang.String name, BitField value)
BitField
value to the attribute.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.value
- New value for the attribute variable.true
is operation is successful and
false
otherwise.public boolean addNodeBitSelector(java.lang.String nodeId, java.lang.String name, BitSelector value)
BitSelector
value to the attribute.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.value
- New value for the attribute variable.true
is operation is successful and
false
otherwise.public boolean addNodeBoolean(java.lang.String nodeId, java.lang.String name, boolean value)
boolean
value to the attribute.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.value
- New value for the attribute variable.true
is operation is successful and
false
otherwise.public boolean addNodeByteArray(java.lang.String nodeId, java.lang.String name, byte[] value)
byte[]
value to the attribute.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.value
- New value for the attribute variable.true
is operation is successful and
false
otherwise.public boolean addNodeDate(java.lang.String nodeId, java.lang.String name, DateValue value)
DateValue
value to the attribute.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.value
- New value for the attribute variable.true
is operation is successful and
false
otherwise.public boolean addNodeDouble(java.lang.String nodeId, java.lang.String name, double value)
Double
value to the attribute.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.value
- New value for the attribute variable.true
is operation is successful and
false
otherwise.public boolean addNodeInteger(java.lang.String nodeId, java.lang.String name, int value)
int
value to the attribute.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.value
- New value for the attribute variable.true
is operation is successful and
false
otherwise.public boolean addNodeString(java.lang.String nodeId, java.lang.String name, java.lang.String value)
String
value to the attribute.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.value
- New value for the attribute variable.true
is operation is successful and
false
otherwise.public boolean addNodeTime(java.lang.String nodeId, java.lang.String name, TimeValue value)
TimeValue
value to the attribute.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.value
- New value for the attribute variable.true
is operation is successful and
false
otherwise.public boolean bind()
SecurityManager
session.
Required permissions:
true
if operation was successful.public boolean closeBatch(boolean disposition)
closeBatch
call made for a batch against "/security" node
or anything under it, is subject to Security Manager notification.
Required permissions:
disposition
- If this parameter is true
then changes need to
be committed. Otherwise they are just thrown away and lock is
removed.true
if operation was successful and tree was
successfully updated.public boolean closeBatch(boolean disposition, boolean refresh)
closeBatch
call made for a batch against "/security" node
or anything under it, is subject to Security Manager notification.
Required permissions:
disposition
- If this parameter is true
then changes need to
be committed. Otherwise they are just thrown away and lock is
removed.refresh
- when committing the batch, tells whether to refresh the
security cache or nottrue
if operation was successful and tree was
successfully updated.public boolean deleteNode(java.lang.String nodeId)
Required permissions:
nodeId
- Node identifier.true
if operation was successful and
false
otherwise.public boolean deleteNodeAttribute(java.lang.String nodeId, java.lang.String name)
Required permissions:
nodeId
- Node name.name
- Attribute name.true
if operation was successful and
false
otherwise.public boolean deleteNodeAttributeValue(java.lang.String nodeId, java.lang.String name, int index)
Required permissions:
nodeId
- Node name.name
- Attribute name.index
- Attribute value index.true
if operation was successful and
false
otherwise.public NodeAttribute[] enumerateNodeAttributes(java.lang.String nodeId)
Required permissions:
This call does NOT fail due to insufficient permissions to the attributes. Instead, a filtering of the results is performed, which may produce an empty array.
nodeId
- Node for which list of attributes is requested.public java.lang.String[] enumerateNodes(java.lang.String nodeId)
Required permissions:
This call does NOT fail due to insufficient permissions to the nodes. Instead, a filtering of the results is performed, which may produce an empty array.
nodeId
- Node for which list of children nodes is requested.public NodeAttribute getClassNodeAttribute(java.lang.String className, java.lang.String name)
NodeAttribute
is not attached to
particular instance of Attribute
, information about number
of the values assigned to the attribute is incorrect. The main purpose
of this method is to create new attributes.
Required permissions:
className
- Object Class name.name
- Object Class attribute name.NodeAttribute
which describes
specified attribute or null
if no such object
class or attribute name.public NodeAttribute[] getClassNodeAttributes(java.lang.String className)
NodeAttribute
structures for the all
attributes defined for the node class. Note that since these instances
of NodeAttribute
are not attached to particular instance
of Attribute
, information about number of the values
assigned to the attribute is incorrect. The purpose of this method is to
create new attributes.
Required permissions:
This call does NOT fail due to insufficient permissions to the attributes. Instead, a filtering of the results is performed, which may produce an empty array.
className
- Object Class name.NodeAttribute
instances which
describe attributes of node or null
if no such
object class or attributes defined for the class.public Attribute[] getNodeAttributes(java.lang.String nodeId)
Required permissions:
Note that attribute must have both R and E permissions set. If some attribute does have E permission but lacks R permission then empty attribute list is returned.
This call does NOT fail due to insufficient permissions to the attributes. Instead, a filtering of the results is performed, which may produce an empty array.
nodeId
- Node for which list of attributes is requested.null
in case of error.public BitField getNodeBitField(java.lang.String nodeId, java.lang.String name)
getNodeBitField(String, String, int)
method. It just
invokes that method assuming that last parameter is 0.nodeId
- Node identifier.name
- Attribute name.getNodeBitField(String, String, int)
public BitField getNodeBitField(java.lang.String nodeId, java.lang.String name, int index)
BitField
attribute value for specified node ID and
index. If wrong parameter (node ID, attribute name or index) are passed
or attribute type is not BitField
then null
is returned.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.index
- Index of the value to retrieve.public BitField[] getNodeBitFields(java.lang.String nodeId, java.lang.String name)
BitField
attribute values for specified node ID.
If wrong parameter (node ID, attribute name) are passed or attribute
type is not BitField
then null
is
returned.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.public BitSelector getNodeBitSelector(java.lang.String nodeId, java.lang.String name)
getNodeBitSelector(String, String, int)
method. It just
invokes that method assuming that last parameter is 0.nodeId
- Node identifier.name
- Attribute name.getNodeBitSelector(String, String, int)
public BitSelector getNodeBitSelector(java.lang.String nodeId, java.lang.String name, int index)
BitSelector
attribute value for specified node ID and
index. If wrong parameter (node ID, attribute name or index) are passed
or attribute type is not BitSelector
then
null
is returned.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.index
- Index of the value to retrieve.public BitSelector[] getNodeBitSelectors(java.lang.String nodeId, java.lang.String name)
BitSelector
attribute values for specified node
ID. If wrong parameter (node ID, attribute name) are passed or attribute
type is not BitSelector
then null
is
returned.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.public java.lang.Boolean getNodeBoolean(java.lang.String nodeId, java.lang.String name)
getNodeBoolean(String, String, int)
method. It just
invokes that method assuming that last parameter is 0.nodeId
- Node identifier.name
- Attribute name.getNodeBoolean(String, String, int)
public java.lang.Boolean getNodeBoolean(java.lang.String nodeId, java.lang.String name, int index)
Boolean
attribute value for specified node ID and
index. If wrong parameter (node ID, attribute name or index) are passed
or attribute type is not Boolean
then null
is returned.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.index
- Index of the value to retrieve.public java.lang.Boolean[] getNodeBooleans(java.lang.String nodeId, java.lang.String name)
Boolean
attribute values for specified node ID.
If wrong parameter (node ID, attribute name) are passed or attribute
type is not Boolean
then null
is returned.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.public byte[] getNodeByteArray(java.lang.String nodeId, java.lang.String name)
getNodeByteArray(String, String, int)
method. It just
invokes that method assuming that last parameter is 0.nodeId
- Node identifier.name
- Attribute name.getNodeByteArray(String, String, int)
public byte[] getNodeByteArray(java.lang.String nodeId, java.lang.String name, int index)
byte array
attribute value for specified node ID and
index. If wrong parameter (node ID, attribute name or index) are passed
or attribute type is not byte[]
then null
is returned.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.index
- Index of the value to retrieve.public byte[][] getNodeByteArrays(java.lang.String nodeId, java.lang.String name)
byte array
attribute values for specified node
ID. If wrong parameter (node ID, attribute name) are passed or attribute
type is not byte[]
then null
is returned.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.public java.lang.String getNodeClass(java.lang.String nodeId)
Required permissions:
nodeId
- Node IDnull
if no such node exists.public DateValue getNodeDate(java.lang.String nodeId, java.lang.String name)
getNodeDate(String, String, int)
method. It just invokes
that method assuming that last parameter is 0.nodeId
- Node identifier.name
- Attribute name.getNodeDate(String, String, int)
public DateValue getNodeDate(java.lang.String nodeId, java.lang.String name, int index)
DateValue
attribute value for specified node ID and
index. If wrong parameter (node ID, attribute name or index) are passed
or attribute type is not DateValue
then null
is returned.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.index
- Index of the value to retrieve.public DateValue[] getNodeDates(java.lang.String nodeId, java.lang.String name)
DateValue
attribute values for specified node ID.
If wrong parameter (node ID, attribute name) are passed or attribute
type is not DateValue
then null
is
returned.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.public java.lang.Double getNodeDouble(java.lang.String nodeId, java.lang.String name)
getNodeDouble(String, String, int)
method. It just
invokes that method assuming that last parameter is 0.nodeId
- Node identifier.name
- Attribute name.getNodeDouble(String, String, int)
public java.lang.Double getNodeDouble(java.lang.String nodeId, java.lang.String name, int index)
Double
attribute value for specified node ID and
index. If wrong parameter (node ID, attribute name or index) are passed
or attribute type is not Double
then null
is returned.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.index
- Index of the value to retrieve.public java.lang.Double[] getNodeDoubles(java.lang.String nodeId, java.lang.String name)
Double
attribute values for specified node ID. If
wrong parameter (node ID, attribute name) are passed or attribute type
is not Double
then null
is returned.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.public java.lang.Integer getNodeInteger(java.lang.String nodeId, java.lang.String name)
getNodeInteger(String, String, int)
method. It just
invokes that method assuming that last parameter is 0.nodeId
- Node identifier.name
- Attribute name.getNodeInteger(String, String, int)
public java.lang.Integer getNodeInteger(java.lang.String nodeId, java.lang.String name, int index)
Integer
attribute value for specified node ID and
index. If wrong parameter (node ID, attribute name or index) are passed
or attribute type is not Integer
then null
is returned.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.index
- Index of the value to retrieve.public java.lang.Integer[] getNodeIntegers(java.lang.String nodeId, java.lang.String name)
Integer
attribute values for specified node ID.
If wrong parameter (node ID, attribute name) are passed or attribute
type is not Integer
then null
is returned.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.public java.lang.String getNodeString(java.lang.String nodeId, java.lang.String name)
getNodeString(String, String, int)
method. It just
invokes that method assuming that last parameter is 0.nodeId
- Node identifier.name
- Attribute name.getNodeString(String, String, int)
public java.lang.String getNodeString(java.lang.String nodeId, java.lang.String name, int index)
String
attribute value for specified node ID and
index. If wrong parameter (node ID, attribute name or index) are passed
or attribute type is not String
then null
is returned.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.index
- Index of the value to retrieve.public java.lang.String[] getNodeStrings(java.lang.String nodeId, java.lang.String name)
String
attribute values for specified node ID. If
wrong parameter (node ID, attribute name) are passed or attribute type
is not String
then null
is returned.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.public TimeValue getNodeTime(java.lang.String nodeId, java.lang.String name)
getNodeTime(String, String, int)
method. It just invokes
that method assuming that last parameter is 0.nodeId
- Node identifier.name
- Attribute name.getNodeTime(String, String, int)
public TimeValue getNodeTime(java.lang.String nodeId, java.lang.String name, int index)
TimeValue
attribute value for specified node ID and
index. If wrong parameter (node ID, attribute name or index) are passed
or attribute type is not TimeValue
then null
is returned.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.index
- Index of the value to retrieve.public TimeValue[] getNodeTimes(java.lang.String nodeId, java.lang.String name)
TimeValue
attribute values for specified node ID.
If wrong parameter (node ID, attribute name) are passed or attribute
type is not TimeValue
then null
is
returned.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.public boolean isEditing()
true
if there is an open editing batchpublic boolean moveNode(java.lang.String nodeId, java.lang.String newId)
Required permissions:
nodeId
- An ID of the node to move.newId
- The desired new location of the node.true
is operation is successful and
false
otherwise.public boolean copyNode(java.lang.String nodeId, java.lang.String newId, boolean recursive)
Required permissions:
nodeId
- An ID of the node to move.newId
- The desired new location of the node.recursive
- true
means copying recursively all child nodes.true
is operation is successful and
false
otherwise.public boolean openBatch(java.lang.String nodeId)
openBatch
call made against "/security" node or anything
under it, is subject to Security Manager notification.
Required permissions:
nodeId
- Subtree which will be edited.true
if operation was successful and application
can start updating tree.public void securityIsUp()
initialized
flag so the access check methods can do some
real work.
Access control considerations:
Normally this call should be issued by SecurityCache class only.
public boolean setNodeAttributes(java.lang.String nodeId, Attribute[] data)
Required permissions:
nodeId
- Node name.data
- An array of new attributes.true
if operation was successful and all
attributes are assigned to the node.public boolean setNodeBitField(java.lang.String nodeId, java.lang.String name, BitField value)
setNodeBitField(String, String, int, BitFiled)
method
which is invoked assuming that index is 0.nodeId
- Node identifier.name
- Attribute name.value
- New value for the attribute variable.true
is operation is successful and
false
otherwise.setNodeBitSelector(String, String, int, BitSelector)
public boolean setNodeBitField(java.lang.String nodeId, java.lang.String name, int index, BitField value)
BitField
attribute value for specified node ID,
attribute name and index. If wrong parameter is passed or attribute
read-only then false
is returned.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.index
- Index of the value to retrieve.value
- New value for the attribute variable.true
is operation is successful and
false
otherwise.public boolean setNodeBitFields(java.lang.String nodeId, java.lang.String name, BitField[] value)
BitField
node attribute values with new ones.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.value
- An array of new attribute values.true
is operation is successful and
false
otherwise.public boolean setNodeBitSelector(java.lang.String nodeId, java.lang.String name, BitSelector value)
setNodeBitSelector(String, String, int, BitSelector)
method which is invoked assuming that index is 0.nodeId
- Node identifier.name
- Attribute name.value
- New value for the attribute variable.true
is operation is successful and
false
otherwise.setNodeBitSelector(String, String, int, BitSelector)
public boolean setNodeBitSelector(java.lang.String nodeId, java.lang.String name, int index, BitSelector value)
BitSelector
attribute value for specified node ID,
attribute name and index. If wrong parameter is passed or attribute
read-only then false
is returned.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.index
- Index of the value to retrieve.value
- New value for the attribute variable.true
is operation is successful and
false
otherwise.public boolean setNodeBitSelectors(java.lang.String nodeId, java.lang.String name, BitSelector[] value)
BitSelector
node attribute values with new
ones.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.value
- An array of new attribute values.true
is operation is successful and
false
otherwise.public boolean setNodeBoolean(java.lang.String nodeId, java.lang.String name, boolean value)
setNodeBoolean(String, String, int, boolean)
method which
is invoked assuming that index is 0.nodeId
- Node identifier.name
- Attribute name.value
- New value for the attribute variable.true
is operation is successful and
false
otherwise.setNodeBoolean(String, String, int, boolean)
public boolean setNodeBoolean(java.lang.String nodeId, java.lang.String name, int index, boolean value)
boolean
attribute value for specified node ID,
attribute name and index. If wrong parameter is passed or attribute
read-only then false
is returned.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.index
- Index of the value to retrieve.value
- New value for the attribute variable.true
is operation is successful and
false
otherwise.public boolean setNodeBooleans(java.lang.String nodeId, java.lang.String name, boolean[] value)
Boolean
node attribute values with new ones.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.value
- An array of new attribute values.true
is operation is successful and
false
otherwise.public boolean setNodeByteArray(java.lang.String nodeId, java.lang.String name, byte[] value)
setNodeByteArray(String, String, int, byte[])
method
which is invoked assuming that index is 0.nodeId
- Node identifier.name
- Attribute name.value
- New value for the attribute variable.true
is operation is successful and
false
otherwise.setNodeByteArray(String, String, int, byte[])
public boolean setNodeByteArray(java.lang.String nodeId, java.lang.String name, int index, byte[] value)
byte[]
attribute value for specified node ID,
attribute name and index. If wrong parameter is passed or attribute
read-only then false
is returned.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.index
- Index of the value to retrieve.value
- New value for the attribute variable.true
is operation is successful and
false
otherwise.public boolean setNodeByteArrays(java.lang.String nodeId, java.lang.String name, byte[][] value)
byte[]
node attribute values with new ones.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.value
- An array of new attribute values.true
is operation is successful and
false
otherwise.public boolean setNodeDate(java.lang.String nodeId, java.lang.String name, DateValue value)
setNodeDate(String, String, int, DateValue)
method which
is invoked assuming that index is 0.nodeId
- Node identifier.name
- Attribute name.value
- New value for the attribute variable.true
is operation is successful and
false
otherwise.setNodeDate(String, String, int, DateValue)
public boolean setNodeDate(java.lang.String nodeId, java.lang.String name, int index, DateValue value)
DateValue
attribute value for specified node ID,
attribute name and index. If wrong parameter is passed or attribute
read-only then false
is returned.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.index
- Index of the value to retrieve.value
- New value for the attribute variable.true
is operation is successful and
false
otherwise.public boolean setNodeDates(java.lang.String nodeId, java.lang.String name, DateValue[] value)
DateValue
node attribute values with new
ones.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.value
- An array of new attribute values.true
is operation is successful and
false
otherwise.public boolean setNodeDouble(java.lang.String nodeId, java.lang.String name, double value)
setNodeDouble(String, String, int, double)
method which
is invoked assuming that index is 0.nodeId
- Node identifier.name
- Attribute name.value
- New value for the attribute variable.true
is operation is successful and
false
otherwise.setNodeDouble(String, String, int, double)
public boolean setNodeDouble(java.lang.String nodeId, java.lang.String name, int index, double value)
double
attribute value for specified node ID,
attribute name and index. If wrong parameter is passed or attribute
read-only then false
is returned.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.index
- Index of the value to retrieve.value
- New value for the attribute variable.true
is operation is successful and
false
otherwise.public boolean setNodeDoubles(java.lang.String nodeId, java.lang.String name, double[] value)
Double
node attribute values with new ones.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.value
- An array of new attribute values.true
is operation is successful and
false
otherwise.public boolean setNodeInteger(java.lang.String nodeId, java.lang.String name, int value)
setNodeInteger(String, String, int, int)
method which is
invoked assuming that index is 0.nodeId
- Node identifier.name
- Attribute name.value
- New value for the attribute variable.true
is operation is successful and
false
otherwise.setNodeInteger(String, String, int, int)
public boolean setNodeInteger(java.lang.String nodeId, java.lang.String name, int index, int value)
int
attribute value for specified node ID, attribute
name and index. If wrong parameter is passed or attribute read-only then
false
is returned.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.index
- Index of the value to retrieve.value
- New value for the attribute variable.true
is operation is successful and
false
otherwise.public boolean setNodeIntegers(java.lang.String nodeId, java.lang.String name, int[] value)
Integer
node attribute values with new ones.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.value
- An array of new attribute values.true
is operation is successful and
false
otherwise.public boolean setNodeString(java.lang.String nodeId, java.lang.String name, int index, java.lang.String value)
String
attribute value for specified node ID,
attribute name and index. If wrong parameter is passed or attribute
read-only then false
is returned.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.index
- Index of the value to retrieve.value
- New value for the attribute variable.true
is operation is successful and
false
otherwise.public boolean setNodeString(java.lang.String nodeId, java.lang.String name, java.lang.String value)
setNodeString(String, String, int, String)
method which
is invoked assuming that index is 0.nodeId
- Node identifier.name
- Attribute name.value
- New value for the attribute variable.true
is operation is successful and
false
otherwise.setNodeString(String, String, int, String)
public boolean setNodeStrings(java.lang.String nodeId, java.lang.String name, java.lang.String[] value)
String
node attribute values with new ones.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.value
- An array of new attribute values.true
is operation is successful and
false
otherwise.public boolean setNodeTime(java.lang.String nodeId, java.lang.String name, int index, TimeValue value)
TimeValue
attribute value for specified node ID,
attribute name and index. If wrong parameter is passed or attribute
read-only then false
is returned.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.index
- Index of the value to retrieve.value
- New value for the attribute variable.true
is operation is successful and
false
otherwise.public boolean setNodeTime(java.lang.String nodeId, java.lang.String name, TimeValue value)
setNodeTime(String, String, int, TimeValue)
method which
is invoked assuming that index is 0.nodeId
- Node identifier.name
- Attribute name.value
- New value for the attribute variable.true
is operation is successful and
false
otherwise.setNodeTime(String, String, int, TimeValue)
public boolean setNodeTimes(java.lang.String nodeId, java.lang.String name, TimeValue[] value)
TimeValue
node attribute values with new
ones.
Required permissions:
nodeId
- Node identifier.name
- Attribute name.value
- An array of new attribute values.true
is operation is successful and
false
otherwise.public boolean unbind()
SecurityManager
session.
Required permissions:
true
if operation was successful.private boolean unbind(DirectoryService.WorkArea wa)
SecurityManager
session. It is context-free so it will not
use any context-local variables. Instead, the this method receives as
parameter a WorkArea
that contains BindRef and BatchRef
instances to unbiund. This is because the Cleanable.cleanup()
cannot use context-local variables as they were already removed
during the cleanup procedure.
Required permissions:
wa
- WorkArea
that contains the active batch and bound
reference to be unbindtrue
if operation was successful.public boolean isBound()
Required permissions:
true
if session is bound properly.public int backupDirectory(java.lang.String newFile)
Note that backend may not support this functionality.
newFile
- Name of the file to store directory.protected boolean canAccessNode(java.lang.String oId, int mode)
oId
- Directory node being accessedmode
- Requested access modetrue
if access is granted.
false otherwise.
protected boolean canAccessNodeAndAttribute(java.lang.String oId, int nodeMode, java.lang.String name, int attrMode)
oId
- Directory node being accessednodeMode
- Requested access mode for directory nodename
- Attribute nameattrMode
- Requested access mode for attributetrue
if access is granted.
false otherwise.
protected boolean closeBatchInt(DirectoryService.BatchRef ref, boolean disposition, boolean refresh)
ref
- A batch to close which should be closed.disposition
- If this parameter is true
then changes need to
be committed. Otherwise they are just thrown away and lock is
removed.refresh
- when committing the batch, tells whether to refresh the
security cache or nottrue
if operation was successful and tree was
successfully updated.protected Remapper synchBatch(java.lang.String id, boolean rw)
id
- Node ID for which operation is planned.rw
- Access type: if parameter is true
then
Read/Write access is planned,private boolean canAccessAttribute(java.lang.String name, int mode, java.lang.String nodeClass)
name
- Attribute namemode
- Requested access modenodeClass
- Directory node class nametrue
if access is granted.
false otherwise.
private boolean canAccessAttribute(java.lang.String oId, java.lang.String name, int mode)
oId
- Directory node being accessedname
- Attribute namemode
- Requested access modetrue
if access is granted.
false otherwise.
private boolean canAccessNode(java.lang.String oId, int parentMode, int mode)
oId
- Directory node being accessedparentMode
- Requested access mode to the node's parent nodemode
- Requested access modetrue
if access is granted.
false otherwise.
private boolean delRef()
newRef()
. If counter
reaches 0 then then back-end is stopped by calling its
unbind()
method.true
if operation was successful.private DirectoryService.BatchRef getActiveBatch()
private void init()
private void initMetaInfo()
private boolean newRef()
delRef()
.
If this is a first call to this method then back-end is started by
calling its bind()
method.true
if operation was successful.private void removeActiveBatch()
private boolean rollBack()
private void setActiveBatch(DirectoryService.BatchRef batch)
batch
- Reference to batch.private boolean verifyAttribute(Remapper remapper, java.lang.String nodeId, java.lang.String name, java.lang.Object value, int ordinal)
remapper
- Back-end instance.nodeId
- Node ID.name
- Attribute name.value
- Value to compare with.ordinal
- Value ordinal to check.true
if value does not exists and new value can
be added safely.