public class LdifPartition extends AbstractLdifPartition
/ou=example,ou=system.ldif
/ou=example,ou=system/
|
+--> cn=test.ldif
cn=test/
|
+--> cn=another test.ldif
...
| Modifier and Type | Field and Description |
|---|---|
private static boolean |
CREATE
Flags used for the getFile() method
|
private static boolean |
DELETE |
private java.io.FileFilter |
dirFilter
A filter used to pick all the directories
|
private java.io.FileFilter |
entryFilter
A filter used to pick all the ldif entries
|
private static org.slf4j.Logger |
LOG
A logger for this class
|
private java.io.File |
suffixDirectory
The directory into which the entries are stored
|
CONF_FILE_EXTN, defaultCSNFactoryADD_CHILD, administrativeRoleAT, adminRoleIdx, aliasCache, aliasedObjectNameAT, aliasIdx, cacheSize, contextCsnAT, DEFAULT_CACHE_SIZE, entryCsnAT, entryCsnIdx, entryDnAT, entryUuidAT, isSyncOnWrite, master, objectClassAT, objectClassIdx, oneAliasIdx, optimizerEnabled, partitionPath, piarCache, presenceIdx, rdnIdx, REMOVE_CHILD, subAliasIdx, systemIndices, userIndicescacheService, contextEntry, ctxCsnChanged, dnFactory, id, initialized, schemaManager, suffixDnSYS_INDEX_OID_ARRAY, SYS_INDEX_OIDSDEFAULT_ID, ROOT_ID| Constructor and Description |
|---|
LdifPartition(org.apache.directory.api.ldap.model.schema.SchemaManager schemaManager,
DnFactory dnFactory)
Creates a new instance of LdifPartition.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(AddOperationContext addContext)
Adds an entry to this ContextPartition.
|
private void |
addEntry(org.apache.directory.api.ldap.model.entry.Entry entry)
Write the new entry on disk.
|
org.apache.directory.api.ldap.model.entry.Entry |
delete(java.lang.String id)
Delete the entry associated with a given Id
|
private boolean |
deleteFile(java.io.File file)
Recursively delete an entry and all of its children.
|
protected void |
doInit()
Override this method to put your initialization code.
|
private void |
entryMoved(org.apache.directory.api.ldap.model.name.Dn oldEntryDn,
org.apache.directory.api.ldap.model.entry.Entry modifiedEntry,
java.lang.String entryIdOld)
rewrites the moved entry and its associated children
Note that instead of moving and updating the existing files on disk
this method gets the moved entry and its children and writes the LDIF files
|
private java.io.File |
getFile(org.apache.directory.api.ldap.model.name.Dn entryDn,
boolean create)
Create the file name from the entry Dn.
|
private java.lang.String |
getFileName(org.apache.directory.api.ldap.model.name.Dn dn)
Compute the real name based on the Dn, assuming that depending on the underlying
OS, some characters are not allowed.
|
private java.lang.String |
getFileName(org.apache.directory.api.ldap.model.name.Rdn rdn)
Compute the real name based on the Rdn, assuming that depending on the underlying
OS, some characters are not allowed.
|
private java.lang.String |
getOSFileName(java.lang.String fileName)
Get a OS compatible file name.
|
private void |
loadEntries(java.io.File entryDir)
loads the configuration into the DIT from the file system
Note that it assumes the presence of a directory with the partition suffix's upname
under the partition's base dir
for ex.
|
void |
modify(ModifyOperationContext modifyContext)
Modifies an entry by adding, removing or replacing a set of attributes.
|
void |
move(MoveOperationContext moveContext)
Transplants a child entry, to a position in the namespace under a new
parent entry.
|
void |
moveAndRename(MoveAndRenameOperationContext moveAndRenameContext)
Transplants a child entry, to a position in the namespace under a new
parent entry and changes the RN of the child entry which can optionally
have its old RN attributes removed.
|
void |
rename(RenameOperationContext renameContext)
Modifies an entry by changing its relative name.
|
getDefaultId, getPartitionPath, initInstanceconvertAndInit, createSystemIndex, getCacheSize, getRootId, isSyncOnWrite, syncaddAliasIndices, addIndex, addIndexedAttributes, addToCache, buildEntryDn, count, delete, doDestroy, dropAliasIndices, dropMovedAliasIndices, dumpIndex, dumpRdnIdx, fetch, fetch, getAdministrativeRoleIndex, getAliasCache, getAliasIndex, getChildCount, getContextCsn, getEntryCsnIndex, getEntryDn, getEntryId, getIndex, getIndexedAttributes, getMasterTable, getObjectClassIndex, getOneAliasIndex, getOptimizer, getParentId, getPresenceIndex, getRdnIndex, getReadWriteLock, getSearchEngine, getSubAliasIndex, getSuffixId, getSystemIndex, getSystemIndices, getUserIndex, getUserIndices, hasEntry, hasIndexOn, hasSystemIndexOn, hasUserIndexOn, isOptimizerEnabled, loadContextCsn, lookup, lookupCache, modify, move, moveAndRename, rename, saveContextCsn, search, setCacheSize, setIndexedAttributes, setOptimizer, setOptimizerEnabled, setPartitionPath, setSearchEngine, setSyncOnWrite, setupSystemIndices, setupUserIndices, toString, unbind, updateCache, updateRdnIdxcheckInitialized, destroy, getContextEntry, getId, getSchemaManager, getSuffixDn, initialize, isInitialized, setCacheService, setContextCsn, setContextEntry, setId, setSchemaManager, setSuffixDnprivate static final org.slf4j.Logger LOG
private java.io.File suffixDirectory
private static final boolean CREATE
private static final boolean DELETE
private java.io.FileFilter dirFilter
private java.io.FileFilter entryFilter
public LdifPartition(org.apache.directory.api.ldap.model.schema.SchemaManager schemaManager,
DnFactory dnFactory)
protected void doInit()
throws java.lang.Exception
doInit in class AvlPartitionjava.lang.Exceptionpublic void add(AddOperationContext addContext) throws org.apache.directory.api.ldap.model.exception.LdapException
add in interface Partitionadd in class AbstractBTreePartitionaddContext - the context used to add and entry to this ContextPartitionorg.apache.directory.api.ldap.model.exception.LdapException - if there are any problemspublic org.apache.directory.api.ldap.model.entry.Entry delete(java.lang.String id)
throws org.apache.directory.api.ldap.model.exception.LdapException
delete in interface Storedelete in class AbstractBTreePartitionid - The id of the entry to deleteorg.apache.directory.api.ldap.model.exception.LdapExceptionpublic void modify(ModifyOperationContext modifyContext) throws org.apache.directory.api.ldap.model.exception.LdapException
modify in interface Partitionmodify in class AbstractBTreePartitionmodifyContext - The context containing the modification operation
to perform on the entry which is one of constants specified by the
DirContext interface:
ADD_ATTRIBUTE, REMOVE_ATTRIBUTE, REPLACE_ATTRIBUTE.org.apache.directory.api.ldap.model.exception.LdapExceptionDirContext,
DirContext.ADD_ATTRIBUTE,
DirContext.REMOVE_ATTRIBUTE,
DirContext.REPLACE_ATTRIBUTEpublic void move(MoveOperationContext moveContext) throws org.apache.directory.api.ldap.model.exception.LdapException
move in interface Partitionmove in class AbstractBTreePartitionmoveContext - The context containing the DNs to moveorg.apache.directory.api.ldap.model.exception.LdapExceptionpublic void moveAndRename(MoveAndRenameOperationContext moveAndRenameContext) throws org.apache.directory.api.ldap.model.exception.LdapException
moveAndRename in interface PartitionmoveAndRename in class AbstractBTreePartitionmoveAndRenameContext - The context contain all the information about
the modifyDN operationorg.apache.directory.api.ldap.model.exception.LdapExceptionpublic void rename(RenameOperationContext renameContext) throws org.apache.directory.api.ldap.model.exception.LdapException
rename in interface Partitionrename in class AbstractBTreePartitionrenameContext - the modify Dn contextorg.apache.directory.api.ldap.model.exception.LdapExceptionprivate void entryMoved(org.apache.directory.api.ldap.model.name.Dn oldEntryDn,
org.apache.directory.api.ldap.model.entry.Entry modifiedEntry,
java.lang.String entryIdOld)
throws java.lang.Exception
oldEntryDn - the moved entry's old DnentryId - the moved entry's master table IDdeleteOldEntry - a flag to tell whether to delete the old entry filesjava.lang.Exceptionprivate void loadEntries(java.io.File entryDir)
throws java.lang.Exception
java.lang.Exceptionprivate java.io.File getFile(org.apache.directory.api.ldap.model.name.Dn entryDn,
boolean create)
throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate java.lang.String getFileName(org.apache.directory.api.ldap.model.name.Rdn rdn)
throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate java.lang.String getFileName(org.apache.directory.api.ldap.model.name.Dn dn)
throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate java.lang.String getOSFileName(java.lang.String fileName)
private void addEntry(org.apache.directory.api.ldap.model.entry.Entry entry)
throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate boolean deleteFile(java.io.File file)