org.apache.jackrabbit.core.security.user
Class UserImporter
java.lang.Object
org.apache.jackrabbit.core.xml.DefaultProtectedPropertyImporter
org.apache.jackrabbit.core.security.user.UserImporter
- All Implemented Interfaces:
- ProtectedPropertyImporter
public class UserImporter
- extends DefaultProtectedPropertyImporter
UserImporter
implements a
DefaultProtectedPropertyImporter
that is able to deal with
user/group content as defined by the default user related node types present
with jackrabbit-core.
The importer is intended to be used by applications that import user content
extracted from another repository instance and immediately persist the
imported content using Session.save()
. Omitting the
save call will lead to transient, semi-validated user content and eventually
to inconsistencies.
Note the following restrictions:
- The importer will only be initialized if the user manager is an instance
of
TransientChangeUserManager
.
- The importer will only be initialized if the editing session starting
this import is the same as the UserManager's Session instance.
- The jcr:uuid property of user and groups is defined to represent the
hashed authorizable id as calculated by the UserManager. This importer
is therefore not able to handle imports with
ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW
.
- The rep:password property is expected to contain the crypted password
value as stored in the content upon calling
UserManager.createUser(java.lang.String, java.lang.String)
and exposed upon Property.getString()
or Session.exportSystemView(java.lang.String, org.xml.sax.ContentHandler, boolean, boolean)
- Importing user/group nodes outside of the hierarchy defined by
UserManagerImpl.getUsersPath()
and UserManagerImpl.getGroupsPath()
will fail upon save as the mandatory properties will not be imported. The same may
be true in case of ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING
inserting the user/group node at some other place in the node hierarchy.
- While creating user/groups through the API the
UserManagerImpl
makes
sure that authorizables are never nested and are created below a hierarchy
of nt:AuthorizableFolder nodes. This isn't efforced by means of node type
constraints but only by the API. This importer currently doesn't perform such
a validation check.
- Any attempt to import conflicting data will cause the import to fail
either immediately or upon calling
Session.save()
with the
following exceptions:
rep:members
: Group membership
rep:impersonators
: Impersonators of a User.
The import behavior of these two properties is defined by the PARAM_IMPORT_BEHAVIOR
configuration parameter, which can be set to
ignore
: A warning is logged.
besteffort
: A warning is logged
and the importer tries to fix the problem.
abort
: The import is immediately
aborted with a ConstraintViolationException. (default)
Known Issue:
Importing rep:impersonators
property refering to principals
that are created during this import AND have principalName different from the
ID will no succeed, as the validation in ImpersonationImpl
isn't able
to find the authorizable with the given principal (reason: query will only
find persisted content).
Nested Class Summary |
static class |
UserImporter.ImportBehavior
Inner class defining the treatment of membership or impersonator
values pointing to non-existing authorizables. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PARAM_IMPORT_BEHAVIOR
public static final String PARAM_IMPORT_BEHAVIOR
- See Also:
- Constant Field Values
UserImporter
public UserImporter()
init
public boolean init(JackrabbitSession session,
NamePathResolver resolver,
boolean isWorkspaceImport,
int uuidBehavior,
ReferenceChangeTracker referenceTracker)
- Specified by:
init
in interface ProtectedPropertyImporter
- Overrides:
init
in class DefaultProtectedPropertyImporter
referenceTracker
- @return
handlePropInfo
public boolean handlePropInfo(NodeImpl parent,
PropInfo protectedPropInfo,
QPropertyDefinition def)
throws RepositoryException
- Description copied from class:
DefaultProtectedPropertyImporter
- Always returns
false
.
- Specified by:
handlePropInfo
in interface ProtectedPropertyImporter
- Overrides:
handlePropInfo
in class DefaultProtectedPropertyImporter
- Parameters:
parent
- The affected parent node.protectedPropInfo
- The PropInfo
to be imported.def
- The property definition determined by the importer that
calls this method.
- Returns:
true
If the property could be successfully imported;
false
otherwise.
- Throws:
RepositoryException
- If an error occurs.- See Also:
ProtectedPropertyImporter.handlePropInfo(org.apache.jackrabbit.core.NodeImpl, PropInfo, QPropertyDefinition)
processReferences
public void processReferences()
throws RepositoryException
- Description copied from class:
DefaultProtectedPropertyImporter
- Always returns
false
.
- Specified by:
processReferences
in interface ProtectedPropertyImporter
- Overrides:
processReferences
in class DefaultProtectedPropertyImporter
- Throws:
RepositoryException
- If an error occurs.- See Also:
ProtectedPropertyImporter.processReferences()
getImportBehavior
public String getImportBehavior()
- Returns:
- human readable representation of the
importBehavior
value.
setImportBehavior
public void setImportBehavior(String importBehaviorStr)
- Parameters:
importBehaviorStr
-
Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.