You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by re...@apache.org on 2018/11/07 13:57:58 UTC
svn commit: r1846014 [10/14] - in /jackrabbit/oak/branches/1.8: ./ oak-core/
oak-core/src/main/java/org/apache/jackrabbit/oak/
oak-core/src/main/java/org/apache/jackrabbit/oak/core/
oak-core/src/main/java/org/apache/jackrabbit/oak/management/ oak-core/...
Modified: jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProvider.java?rev=1846014&r1=1846013&r2=1846014&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProvider.java (original)
+++ jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProvider.java Wed Nov 7 13:57:55 2018
@@ -22,8 +22,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nonnull;
import javax.jcr.RepositoryException;
import com.google.common.collect.Iterators;
@@ -35,6 +33,8 @@ import org.apache.jackrabbit.oak.api.Typ
import org.apache.jackrabbit.oak.plugins.memory.PropertyValues;
import org.apache.jackrabbit.oak.spi.security.ConfigurationParameters;
import org.apache.jackrabbit.oak.spi.security.user.AuthorizableType;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -114,7 +114,7 @@ class MembershipProvider extends Authori
* @param root the current root
* @param config the security configuration
*/
- MembershipProvider(@Nonnull Root root, @Nonnull ConfigurationParameters config) {
+ MembershipProvider(@NotNull Root root, @NotNull ConfigurationParameters config) {
super(root, config);
}
@@ -133,8 +133,8 @@ class MembershipProvider extends Authori
* @param includeInherited {@code true} to include inherited memberships
* @return an iterator over all membership paths.
*/
- @Nonnull
- Iterator<String> getMembership(@Nonnull Tree authorizableTree, final boolean includeInherited) {
+ @NotNull
+ Iterator<String> getMembership(@NotNull Tree authorizableTree, final boolean includeInherited) {
return getMembership(authorizableTree, includeInherited, new HashSet<String>());
}
@@ -146,16 +146,16 @@ class MembershipProvider extends Authori
* @param processedPaths helper set that contains the processed paths
* @return an iterator over all membership paths.
*/
- @Nonnull
- private Iterator<String> getMembership(@Nonnull Tree authorizableTree, final boolean includeInherited,
- @Nonnull final Set<String> processedPaths) {
+ @NotNull
+ private Iterator<String> getMembership(@NotNull Tree authorizableTree, final boolean includeInherited,
+ @NotNull final Set<String> processedPaths) {
final Iterable<String> refPaths = identifierManager.getReferences(
authorizableTree, REP_MEMBERS, NT_REP_MEMBER_REFERENCES, true
);
return new AbstractMemberIterator(refPaths.iterator()) {
@Override
- protected String internalGetNext(@Nonnull String propPath) {
+ protected String internalGetNext(@NotNull String propPath) {
String next = null;
String groupPath = getGroupPath(propPath);
@@ -177,14 +177,14 @@ class MembershipProvider extends Authori
return next;
}
- @Nonnull
+ @NotNull
@Override
- protected Iterator<String> getNextIterator(@Nonnull Tree groupTree) {
+ protected Iterator<String> getNextIterator(@NotNull Tree groupTree) {
return getMembership(groupTree, true, processedPaths);
}
- @CheckForNull
- private String getGroupPath(@Nonnull String membersPropPath) {
+ @Nullable
+ private String getGroupPath(@NotNull String membersPropPath) {
int index = membersPropPath.indexOf('/' + REP_MEMBERS_LIST);
if (index < 0) {
index = membersPropPath.indexOf('/' + REP_MEMBERS);
@@ -207,7 +207,7 @@ class MembershipProvider extends Authori
* @param groupPath The path of the group which needs to be tested.
* @return {@code true} if the group is contained in the membership of the specified authorizable.
*/
- private boolean hasMembership(@Nonnull Tree authorizableTree, @Nonnull String groupPath) {
+ private boolean hasMembership(@NotNull Tree authorizableTree, @NotNull String groupPath) {
return Iterators.contains(getMembership(authorizableTree, true), groupPath);
}
@@ -218,8 +218,8 @@ class MembershipProvider extends Authori
* @param includeInherited {@code true} to include inherited members
* @return an iterator over all member paths
*/
- @Nonnull
- Iterator<String> getMembers(@Nonnull Tree groupTree, boolean includeInherited) {
+ @NotNull
+ Iterator<String> getMembers(@NotNull Tree groupTree, boolean includeInherited) {
return getMembers(groupTree, getContentID(groupTree), includeInherited, new HashSet<String>());
}
@@ -231,14 +231,14 @@ class MembershipProvider extends Authori
* @param processedRefs helper set that contains the references that are already processed.
* @return an iterator over all member paths
*/
- @Nonnull
- private Iterator<String> getMembers(@Nonnull final Tree groupTree,
- @Nonnull final String groupContentId,
+ @NotNull
+ private Iterator<String> getMembers(@NotNull final Tree groupTree,
+ @NotNull final String groupContentId,
final boolean includeInherited,
- @Nonnull final Set<String> processedRefs) {
+ @NotNull final Set<String> processedRefs) {
MemberReferenceIterator mrit = new MemberReferenceIterator(groupTree) {
@Override
- protected boolean hasProcessedReference(@Nonnull String value) {
+ protected boolean hasProcessedReference(@NotNull String value) {
if (groupContentId.equals(value)) {
log.warn("Cyclic group membership detected for contentId " + groupContentId);
return false;
@@ -250,7 +250,7 @@ class MembershipProvider extends Authori
return new AbstractMemberIterator(mrit) {
@Override
- protected String internalGetNext(@Nonnull String value) {
+ protected String internalGetNext(@NotNull String value) {
String next = identifierManager.getPath(PropertyValues.newWeakReference(value));
// eventually remember groups for including inherited members
@@ -263,9 +263,9 @@ class MembershipProvider extends Authori
return next;
}
- @Nonnull
+ @NotNull
@Override
- protected Iterator<String> getNextIterator(@Nonnull Tree groupTree) {
+ protected Iterator<String> getNextIterator(@NotNull Tree groupTree) {
return getMembers(groupTree, groupContentId, true, processedRefs);
}
};
@@ -279,7 +279,7 @@ class MembershipProvider extends Authori
*
* @return true if the group has given member.
*/
- boolean isMember(@Nonnull Tree groupTree, @Nonnull Tree authorizableTree) {
+ boolean isMember(@NotNull Tree groupTree, @NotNull Tree authorizableTree) {
if (!hasMembers(groupTree)) {
return false;
}
@@ -290,7 +290,7 @@ class MembershipProvider extends Authori
}
}
- boolean isDeclaredMember(@Nonnull Tree groupTree, @Nonnull Tree authorizableTree) {
+ boolean isDeclaredMember(@NotNull Tree groupTree, @NotNull Tree authorizableTree) {
if (!hasMembers(groupTree)) {
return false;
}
@@ -298,7 +298,7 @@ class MembershipProvider extends Authori
String contentId = getContentID(authorizableTree);
MemberReferenceIterator refs = new MemberReferenceIterator(groupTree) {
@Override
- protected boolean hasProcessedReference(@Nonnull String value) {
+ protected boolean hasProcessedReference(@NotNull String value) {
return true;
}
};
@@ -312,7 +312,7 @@ class MembershipProvider extends Authori
* @return {@code true} if the group has any members i.e. if it has a rep:members
* property or a rep:membersList child node.
*/
- private static boolean hasMembers(@Nonnull Tree groupTree) {
+ private static boolean hasMembers(@NotNull Tree groupTree) {
return groupTree.getPropertyStatus(REP_MEMBERS) != null || groupTree.hasChild(REP_MEMBERS_LIST);
}
@@ -327,7 +327,7 @@ class MembershipProvider extends Authori
* @return {@code true} if the specified group tree has an unmodified rep:members
* property or if the root has pending changes.
*/
- private boolean pendingChanges(@Nonnull Tree groupTree) {
+ private boolean pendingChanges(@NotNull Tree groupTree) {
Tree.Status memberPropStatus = groupTree.getPropertyStatus(REP_MEMBERS);
// rep:members is new or has been modified or root has pending changes
return Tree.Status.UNCHANGED != memberPropStatus || root.hasPendingChanges();
@@ -340,7 +340,7 @@ class MembershipProvider extends Authori
* @return {@code true} if the member was added
* @throws RepositoryException if an error occurs
*/
- boolean addMember(@Nonnull Tree groupTree, @Nonnull Tree newMemberTree) throws RepositoryException {
+ boolean addMember(@NotNull Tree groupTree, @NotNull Tree newMemberTree) throws RepositoryException {
return writer.addMember(groupTree, getContentID(newMemberTree));
}
@@ -351,7 +351,7 @@ class MembershipProvider extends Authori
* @param memberIds Map of 'contentId':'memberId' of all members to be added.
* @return the set of member IDs that was not successfully processed.
*/
- Set<String> addMembers(@Nonnull Tree groupTree, @Nonnull Map<String, String> memberIds) throws RepositoryException {
+ Set<String> addMembers(@NotNull Tree groupTree, @NotNull Map<String, String> memberIds) throws RepositoryException {
return writer.addMembers(groupTree, memberIds);
}
@@ -362,7 +362,7 @@ class MembershipProvider extends Authori
* @param memberTree member to remove
* @return {@code true} if the member was removed.
*/
- boolean removeMember(@Nonnull Tree groupTree, @Nonnull Tree memberTree) {
+ boolean removeMember(@NotNull Tree groupTree, @NotNull Tree memberTree) {
if (writer.removeMember(groupTree, getContentID(memberTree))) {
return true;
} else {
@@ -378,7 +378,7 @@ class MembershipProvider extends Authori
* @param memberIds Map of 'contentId':'memberId' of all members that need to be removed.
* @return the set of member IDs that was not successfully processed.
*/
- Set<String> removeMembers(@Nonnull Tree groupTree, @Nonnull Map<String, String> memberIds) {
+ Set<String> removeMembers(@NotNull Tree groupTree, @NotNull Map<String, String> memberIds) {
return writer.removeMembers(groupTree, memberIds);
}
@@ -390,7 +390,7 @@ class MembershipProvider extends Authori
private final Iterator<Tree> trees;
private Iterator<String> propertyValues;
- private MemberReferenceIterator(@Nonnull Tree groupTree) {
+ private MemberReferenceIterator(@NotNull Tree groupTree) {
this.trees = Iterators.concat(
Iterators.singletonIterator(groupTree),
groupTree.getChild(REP_MEMBERS_LIST).getChildren().iterator()
@@ -424,7 +424,7 @@ class MembershipProvider extends Authori
return next;
}
- protected abstract boolean hasProcessedReference(@Nonnull String value);
+ protected abstract boolean hasProcessedReference(@NotNull String value);
}
private abstract class AbstractMemberIterator extends AbstractLazyIterator<String> {
@@ -433,7 +433,7 @@ class MembershipProvider extends Authori
private List<Tree> groupTrees;
private Iterator<String> parent;
- AbstractMemberIterator(@Nonnull Iterator<String> references) {
+ AbstractMemberIterator(@NotNull Iterator<String> references) {
this.references = references;
}
@@ -471,7 +471,7 @@ class MembershipProvider extends Authori
* @param groupTree A tree associated with a group
* @see #getNextIterator(Tree)
*/
- protected void remember(@Nonnull Tree groupTree) {
+ protected void remember(@NotNull Tree groupTree) {
if (groupTrees == null) {
groupTrees = new ArrayList<Tree>();
}
@@ -486,8 +486,8 @@ class MembershipProvider extends Authori
* @return The path of the authorizable identified by {@code nextReference}
* or {@code null} if it cannot be resolved.
*/
- @CheckForNull
- protected abstract String internalGetNext(@Nonnull String nextReference);
+ @Nullable
+ protected abstract String internalGetNext(@NotNull String nextReference);
/**
* Abstract method to retrieve the next member iterator for the given
@@ -496,7 +496,7 @@ class MembershipProvider extends Authori
* @param groupTree Tree referring to a group.
* @return The next member reference 'parent' iterator to be processed.
*/
- @Nonnull
- protected abstract Iterator<String> getNextIterator(@Nonnull Tree groupTree);
+ @NotNull
+ protected abstract Iterator<String> getNextIterator(@NotNull Tree groupTree);
}
-}
\ No newline at end of file
+}
Modified: jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipWriter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipWriter.java?rev=1846014&r1=1846013&r2=1846014&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipWriter.java (original)
+++ jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipWriter.java Wed Nov 7 13:57:55 2018
@@ -21,7 +21,6 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Set;
-import javax.annotation.Nonnull;
import javax.jcr.RepositoryException;
import com.google.common.collect.Maps;
@@ -32,6 +31,7 @@ import org.apache.jackrabbit.oak.api.Tre
import org.apache.jackrabbit.oak.api.Type;
import org.apache.jackrabbit.oak.spi.security.user.UserConstants;
import org.apache.jackrabbit.oak.plugins.memory.PropertyBuilder;
+import org.jetbrains.annotations.NotNull;
import com.google.common.collect.Iterators;
@@ -75,7 +75,7 @@ public class MembershipWriter {
* @return the set of member IDs that was not successfully processed.
* @throws RepositoryException if an error occurs
*/
- Set<String> addMembers(@Nonnull Tree groupTree, @Nonnull Map<String, String> memberIds) throws RepositoryException {
+ Set<String> addMembers(@NotNull Tree groupTree, @NotNull Map<String, String> memberIds) throws RepositoryException {
// check all possible rep:members properties for the new member and also find the one with the least values
Tree membersList = groupTree.getChild(UserConstants.REP_MEMBERS_LIST);
Iterator<Tree> trees = Iterators.concat(
@@ -162,7 +162,7 @@ public class MembershipWriter {
return failed;
}
- private static Tree createMemberRefTree(@Nonnull Tree groupTree, @Nonnull Tree membersList) {
+ private static Tree createMemberRefTree(@NotNull Tree groupTree, @NotNull Tree membersList) {
if (!membersList.exists()) {
membersList = groupTree.addChild(UserConstants.REP_MEMBERS_LIST);
membersList.setProperty(JcrConstants.JCR_PRIMARYTYPE, UserConstants.NT_REP_MEMBER_REFERENCES_LIST, NAME);
@@ -172,7 +172,7 @@ public class MembershipWriter {
return refTree;
}
- private static String nextRefNodeName(@Nonnull Tree membersList) {
+ private static String nextRefNodeName(@NotNull Tree membersList) {
// keep node names linear
int i = 0;
String name = String.valueOf(i);
@@ -189,7 +189,7 @@ public class MembershipWriter {
* @param memberContentId member to remove
* @return {@code true} if the member was removed.
*/
- boolean removeMember(@Nonnull Tree groupTree, @Nonnull String memberContentId) {
+ boolean removeMember(@NotNull Tree groupTree, @NotNull String memberContentId) {
Map<String, String> m = Maps.newHashMapWithExpectedSize(1);
m.put(memberContentId, "-");
return removeMembers(groupTree, m).isEmpty();
@@ -202,7 +202,7 @@ public class MembershipWriter {
* @param memberIds Map of 'contentId':'memberId' of all members that need to be removed.
* @return the set of member IDs that was not successfully processed.
*/
- Set<String> removeMembers(@Nonnull Tree groupTree, @Nonnull Map<String, String> memberIds) {
+ Set<String> removeMembers(@NotNull Tree groupTree, @NotNull Map<String, String> memberIds) {
Tree membersList = groupTree.getChild(UserConstants.REP_MEMBERS_LIST);
Iterator<Tree> trees = Iterators.concat(
Iterators.singletonIterator(groupTree),
@@ -234,4 +234,4 @@ public class MembershipWriter {
}
return Sets.newHashSet(memberIds.values());
}
-}
\ No newline at end of file
+}
Modified: jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/PasswordHistory.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/PasswordHistory.java?rev=1846014&r1=1846013&r2=1846014&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/PasswordHistory.java (original)
+++ jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/PasswordHistory.java Wed Nov 7 13:57:55 2018
@@ -18,7 +18,6 @@ package org.apache.jackrabbit.oak.securi
import java.util.ArrayList;
import java.util.List;
-import javax.annotation.Nonnull;
import javax.jcr.AccessDeniedException;
import javax.jcr.nodetype.ConstraintViolationException;
@@ -31,6 +30,7 @@ import org.apache.jackrabbit.oak.spi.sec
import org.apache.jackrabbit.oak.spi.security.user.UserConstants;
import org.apache.jackrabbit.oak.spi.security.user.util.PasswordUtil;
import org.apache.jackrabbit.oak.plugins.tree.TreeUtil;
+import org.jetbrains.annotations.NotNull;
/**
* Helper class for the password history feature.
@@ -42,7 +42,7 @@ final class PasswordHistory implements U
private final int maxSize;
private final boolean isEnabled;
- public PasswordHistory(@Nonnull ConfigurationParameters config) {
+ public PasswordHistory(@NotNull ConfigurationParameters config) {
maxSize = Math.min(HISTORY_MAX_SIZE, config.getConfigValue(UserConstants.PARAM_PASSWORD_HISTORY_SIZE, UserConstants.PASSWORD_HISTORY_DISABLED_SIZE));
isEnabled = maxSize > UserConstants.PASSWORD_HISTORY_DISABLED_SIZE;
}
@@ -61,7 +61,7 @@ final class PasswordHistory implements U
* @throws javax.jcr.AccessDeniedException If the rep:pwd tree cannot be
* accessed.
*/
- boolean updatePasswordHistory(@Nonnull Tree userTree, @Nonnull String password) throws ConstraintViolationException, AccessDeniedException {
+ boolean updatePasswordHistory(@NotNull Tree userTree, @NotNull String password) throws ConstraintViolationException, AccessDeniedException {
boolean updated = false;
if (isEnabled) {
checkPasswordInHistory(userTree, password);
@@ -79,7 +79,7 @@ final class PasswordHistory implements U
* @throws AccessDeniedException If the editing session cannot access or
* create the rep:pwd node.
*/
- private void shiftPasswordHistory(@Nonnull Tree userTree) throws AccessDeniedException {
+ private void shiftPasswordHistory(@NotNull Tree userTree) throws AccessDeniedException {
String currentPasswordHash = TreeUtil.getString(userTree, UserConstants.REP_PASSWORD);
if (currentPasswordHash != null) {
Tree passwordTree = getPasswordTree(userTree, true);
@@ -108,7 +108,7 @@ final class PasswordHistory implements U
* @throws ConstraintViolationException If the passsword is found in the history
* @throws AccessDeniedException If the editing session cannot access the rep:pwd node.
*/
- private void checkPasswordInHistory(@Nonnull Tree userTree, @Nonnull String newPassword) throws ConstraintViolationException, AccessDeniedException {
+ private void checkPasswordInHistory(@NotNull Tree userTree, @NotNull String newPassword) throws ConstraintViolationException, AccessDeniedException {
if (PasswordUtil.isSame(TreeUtil.getString(userTree, UserConstants.REP_PASSWORD), newPassword)) {
throw new PasswordHistoryException("New password is identical to the current password.");
}
@@ -125,12 +125,12 @@ final class PasswordHistory implements U
}
}
- @Nonnull
- private static Tree getPasswordTree(@Nonnull Tree userTree, boolean doCreate) throws AccessDeniedException {
+ @NotNull
+ private static Tree getPasswordTree(@NotNull Tree userTree, boolean doCreate) throws AccessDeniedException {
if (doCreate) {
return TreeUtil.getOrAddChild(userTree, UserConstants.REP_PWD, UserConstants.NT_REP_PASSWORD);
} else {
return userTree.getChild(UserConstants.REP_PWD);
}
}
-}
\ No newline at end of file
+}
Modified: jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/RandomAuthorizableNodeName.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/RandomAuthorizableNodeName.java?rev=1846014&r1=1846013&r2=1846014&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/RandomAuthorizableNodeName.java (original)
+++ jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/RandomAuthorizableNodeName.java Wed Nov 7 13:57:55 2018
@@ -20,9 +20,8 @@ import static org.apache.jackrabbit.oak.
import java.security.SecureRandom;
import java.util.Random;
-import javax.annotation.Nonnull;
-
import org.apache.jackrabbit.oak.spi.security.user.AuthorizableNodeName;
+import org.jetbrains.annotations.NotNull;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.ConfigurationPolicy;
@@ -85,9 +84,9 @@ public class RandomAuthorizableNodeName
private int length = DEFAULT_LENGTH;
- @Nonnull
+ @NotNull
@Override
- public String generateNodeName(@Nonnull String authorizableId) {
+ public String generateNodeName(@NotNull String authorizableId) {
Random random = new SecureRandom();
char[] chars = new char[length];
for (int i = 0; i < length; i++) {
Modified: jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/RepMembersConflictHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/RepMembersConflictHandler.java?rev=1846014&r1=1846013&r2=1846014&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/RepMembersConflictHandler.java (original)
+++ jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/RepMembersConflictHandler.java Wed Nov 7 13:57:55 2018
@@ -20,8 +20,6 @@ package org.apache.jackrabbit.oak.securi
import java.util.Set;
-import javax.annotation.Nonnull;
-
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Type;
import org.apache.jackrabbit.oak.plugins.memory.PropertyBuilder;
@@ -29,6 +27,7 @@ import org.apache.jackrabbit.oak.spi.com
import org.apache.jackrabbit.oak.spi.security.user.UserConstants;
import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
import org.apache.jackrabbit.oak.spi.state.NodeState;
+import org.jetbrains.annotations.NotNull;
import com.google.common.collect.Sets;
@@ -46,10 +45,10 @@ import com.google.common.collect.Sets;
*/
public class RepMembersConflictHandler implements ThreeWayConflictHandler {
- @Nonnull
+ @NotNull
@Override
- public Resolution addExistingProperty(@Nonnull NodeBuilder parent, @Nonnull PropertyState ours,
- @Nonnull PropertyState theirs) {
+ public Resolution addExistingProperty(@NotNull NodeBuilder parent, @NotNull PropertyState ours,
+ @NotNull PropertyState theirs) {
if (isRepMembersProperty(theirs)) {
mergeChange(parent, ours, theirs,Sets.newHashSet());
return Resolution.MERGED;
@@ -59,9 +58,9 @@ public class RepMembersConflictHandler i
}
@Override
- @Nonnull
- public Resolution changeDeletedProperty(@Nonnull NodeBuilder parent, @Nonnull PropertyState ours,
- @Nonnull PropertyState base) {
+ @NotNull
+ public Resolution changeDeletedProperty(@NotNull NodeBuilder parent, @NotNull PropertyState ours,
+ @NotNull PropertyState base) {
if (isRepMembersProperty(ours)) {
// removing the members property takes precedence
return Resolution.THEIRS;
@@ -70,10 +69,10 @@ public class RepMembersConflictHandler i
}
}
- @Nonnull
+ @NotNull
@Override
- public Resolution changeChangedProperty(@Nonnull NodeBuilder parent, @Nonnull PropertyState ours,
- @Nonnull PropertyState theirs, @Nonnull PropertyState base) {
+ public Resolution changeChangedProperty(@NotNull NodeBuilder parent, @NotNull PropertyState ours,
+ @NotNull PropertyState theirs, @NotNull PropertyState base) {
if (isRepMembersProperty(theirs)) {
Set<String> baseMembers = Sets.newHashSet(base.getValue(Type.STRINGS));
mergeChange(parent, ours, theirs, baseMembers);
@@ -83,17 +82,17 @@ public class RepMembersConflictHandler i
}
}
- @Nonnull
+ @NotNull
@Override
- public Resolution deleteDeletedProperty(@Nonnull NodeBuilder parent, @Nonnull PropertyState base) {
+ public Resolution deleteDeletedProperty(@NotNull NodeBuilder parent, @NotNull PropertyState base) {
// both are removing the members property, ignoring
return Resolution.IGNORED;
}
- @Nonnull
+ @NotNull
@Override
- public Resolution deleteChangedProperty(@Nonnull NodeBuilder parent, @Nonnull PropertyState theirs,
- @Nonnull PropertyState base) {
+ public Resolution deleteChangedProperty(@NotNull NodeBuilder parent, @NotNull PropertyState theirs,
+ @NotNull PropertyState base) {
if (isRepMembersProperty(theirs)) {
// removing the members property takes precedence
return Resolution.OURS;
@@ -103,30 +102,30 @@ public class RepMembersConflictHandler i
}
- @Nonnull
+ @NotNull
@Override
- public Resolution addExistingNode(@Nonnull NodeBuilder parent, @Nonnull String name, @Nonnull NodeState ours,
- @Nonnull NodeState theirs) {
+ public Resolution addExistingNode(@NotNull NodeBuilder parent, @NotNull String name, @NotNull NodeState ours,
+ @NotNull NodeState theirs) {
return Resolution.IGNORED;
}
- @Nonnull
+ @NotNull
@Override
- public Resolution changeDeletedNode(@Nonnull NodeBuilder parent, @Nonnull String name, @Nonnull NodeState ours,
- @Nonnull NodeState base) {
+ public Resolution changeDeletedNode(@NotNull NodeBuilder parent, @NotNull String name, @NotNull NodeState ours,
+ @NotNull NodeState base) {
return Resolution.IGNORED;
}
- @Nonnull
+ @NotNull
@Override
- public Resolution deleteChangedNode(@Nonnull NodeBuilder parent, @Nonnull String name, @Nonnull NodeState theirs,
- @Nonnull NodeState base) {
+ public Resolution deleteChangedNode(@NotNull NodeBuilder parent, @NotNull String name, @NotNull NodeState theirs,
+ @NotNull NodeState base) {
return Resolution.IGNORED;
}
- @Nonnull
+ @NotNull
@Override
- public Resolution deleteDeletedNode(@Nonnull NodeBuilder parent, @Nonnull String name, @Nonnull NodeState base) {
+ public Resolution deleteDeletedNode(@NotNull NodeBuilder parent, @NotNull String name, @NotNull NodeState base) {
return Resolution.IGNORED;
}
Modified: jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/SystemUserImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/SystemUserImpl.java?rev=1846014&r1=1846013&r2=1846014&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/SystemUserImpl.java (original)
+++ jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/SystemUserImpl.java Wed Nov 7 13:57:55 2018
@@ -17,24 +17,24 @@
package org.apache.jackrabbit.oak.security.user;
import java.security.Principal;
-import javax.annotation.Nonnull;
import javax.jcr.RepositoryException;
import javax.jcr.UnsupportedRepositoryOperationException;
import org.apache.jackrabbit.oak.api.Tree;
import org.apache.jackrabbit.oak.spi.security.user.util.UserUtil;
+import org.jetbrains.annotations.NotNull;
/**
* Default implementation for a system user.
*/
class SystemUserImpl extends UserImpl {
- SystemUserImpl(@Nonnull String id, @Nonnull Tree tree, @Nonnull UserManagerImpl userManager) throws RepositoryException {
+ SystemUserImpl(@NotNull String id, @NotNull Tree tree, @NotNull UserManagerImpl userManager) throws RepositoryException {
super(id, tree, userManager);
}
@Override
- void checkValidTree(@Nonnull Tree tree) throws RepositoryException {
+ void checkValidTree(@NotNull Tree tree) throws RepositoryException {
super.checkValidTree(tree);
if (!UserUtil.isSystemUser(tree)) {
throw new IllegalArgumentException("Invalid user node: node type rep:SystemUser expected.");
@@ -65,4 +65,4 @@ class SystemUserImpl extends UserImpl {
public void changePassword(String password, String oldPassword) throws RepositoryException {
throw new UnsupportedRepositoryOperationException("system user");
}
-}
\ No newline at end of file
+}
Modified: jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/SystemUserPrincipalImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/SystemUserPrincipalImpl.java?rev=1846014&r1=1846013&r2=1846014&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/SystemUserPrincipalImpl.java (original)
+++ jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/SystemUserPrincipalImpl.java Wed Nov 7 13:57:55 2018
@@ -16,11 +16,10 @@
*/
package org.apache.jackrabbit.oak.security.user;
-import javax.annotation.Nonnull;
-
import org.apache.jackrabbit.oak.api.Tree;
import org.apache.jackrabbit.oak.namepath.PathMapper;
import org.apache.jackrabbit.oak.spi.security.principal.SystemUserPrincipal;
+import org.jetbrains.annotations.NotNull;
/**
* Implementation of the {@code SystemUserPrincipal} for this user management
@@ -28,7 +27,7 @@ import org.apache.jackrabbit.oak.spi.sec
*/
final class SystemUserPrincipalImpl extends TreeBasedPrincipal implements SystemUserPrincipal {
- SystemUserPrincipalImpl(@Nonnull String principalName, @Nonnull Tree tree, @Nonnull PathMapper pathMapper) {
+ SystemUserPrincipalImpl(@NotNull String principalName, @NotNull Tree tree, @NotNull PathMapper pathMapper) {
super(principalName, tree, pathMapper);
}
}
Modified: jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserAuthentication.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserAuthentication.java?rev=1846014&r1=1846013&r2=1846014&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserAuthentication.java (original)
+++ jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserAuthentication.java Wed Nov 7 13:57:55 2018
@@ -19,9 +19,6 @@ package org.apache.jackrabbit.oak.securi
import java.security.Principal;
import java.util.Collections;
import java.util.concurrent.TimeUnit;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
import javax.jcr.Credentials;
import javax.jcr.GuestCredentials;
import javax.jcr.RepositoryException;
@@ -50,6 +47,8 @@ import org.apache.jackrabbit.oak.spi.sec
import org.apache.jackrabbit.oak.spi.security.user.UserConfiguration;
import org.apache.jackrabbit.oak.spi.security.user.UserConstants;
import org.apache.jackrabbit.oak.spi.security.user.util.PasswordUtil;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -85,7 +84,7 @@ class UserAuthentication implements Auth
private String userId;
private Principal principal;
- UserAuthentication(@Nonnull UserConfiguration config, @Nonnull Root root, @Nullable String loginId) {
+ UserAuthentication(@NotNull UserConfiguration config, @NotNull Root root, @Nullable String loginId) {
this.config = config;
this.root = root;
this.loginId = loginId;
@@ -147,7 +146,7 @@ class UserAuthentication implements Auth
return success;
}
- @CheckForNull
+ @Nullable
@Override
public String getUserId() {
if (userId == null) {
@@ -156,7 +155,7 @@ class UserAuthentication implements Auth
return userId;
}
- @CheckForNull
+ @Nullable
@Override
public Principal getUserPrincipal() {
if (principal == null) {
@@ -173,7 +172,7 @@ class UserAuthentication implements Auth
}
}
- private static boolean equalUserId(@Nonnull ImpersonationCredentials creds, @Nonnull String userId) {
+ private static boolean equalUserId(@NotNull ImpersonationCredentials creds, @NotNull String userId) {
Credentials base = creds.getBaseCredentials();
return (base instanceof SimpleCredentials) && userId.equals(((SimpleCredentials) base).getUserID());
}
@@ -221,7 +220,7 @@ class UserAuthentication implements Auth
return false;
}
- @CheckForNull
+ @Nullable
private Long getPasswordLastModified(User user) throws RepositoryException {
Tree userTree;
if (user instanceof UserImpl) {
@@ -233,7 +232,7 @@ class UserAuthentication implements Auth
return (property != null) ? property.getValue(Type.LONG) : null;
}
- private boolean isPasswordExpired(@Nonnull User user) throws RepositoryException {
+ private boolean isPasswordExpired(@NotNull User user) throws RepositoryException {
// the password of the "admin" user never expires
if (user.isAdmin()) {
return false;
Modified: jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserAuthenticationFactoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserAuthenticationFactoryImpl.java?rev=1846014&r1=1846013&r2=1846014&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserAuthenticationFactoryImpl.java (original)
+++ jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserAuthenticationFactoryImpl.java Wed Nov 7 13:57:55 2018
@@ -18,13 +18,12 @@ package org.apache.jackrabbit.oak.securi
import static org.apache.jackrabbit.oak.spi.security.RegistrationConstants.OAK_SECURITY_NAME;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
import org.apache.jackrabbit.oak.api.Root;
import org.apache.jackrabbit.oak.spi.security.authentication.Authentication;
import org.apache.jackrabbit.oak.spi.security.user.UserAuthenticationFactory;
import org.apache.jackrabbit.oak.spi.security.user.UserConfiguration;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import org.osgi.service.component.annotations.Component;
@Component(
@@ -32,9 +31,9 @@ import org.osgi.service.component.annota
property = OAK_SECURITY_NAME + "=org.apache.jackrabbit.oak.security.user.UserAuthenticationFactoryImpl")
public class UserAuthenticationFactoryImpl implements UserAuthenticationFactory {
- @Nonnull
+ @NotNull
@Override
- public Authentication getAuthentication(@Nonnull UserConfiguration userConfiguration, @Nonnull Root root, @Nullable String userId) {
+ public Authentication getAuthentication(@NotNull UserConfiguration userConfiguration, @NotNull Root root, @Nullable String userId) {
return new UserAuthentication(userConfiguration, root, userId);
}
}
Modified: jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserConfigurationImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserConfigurationImpl.java?rev=1846014&r1=1846013&r2=1846014&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserConfigurationImpl.java (original)
+++ jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserConfigurationImpl.java Wed Nov 7 13:57:55 2018
@@ -22,9 +22,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
import com.google.common.collect.ImmutableList;
import org.apache.jackrabbit.api.security.user.UserManager;
import org.apache.jackrabbit.oak.api.Root;
@@ -46,6 +43,8 @@ import org.apache.jackrabbit.oak.spi.sec
import org.apache.jackrabbit.oak.spi.security.user.util.PasswordUtil;
import org.apache.jackrabbit.oak.spi.xml.ImportBehavior;
import org.apache.jackrabbit.oak.spi.xml.ProtectedItemImporter;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.metatype.annotations.AttributeDefinition;
@@ -178,13 +177,13 @@ public class UserConfigurationImpl exten
}
//----------------------------------------------< SecurityConfiguration >---
- @Nonnull
+ @NotNull
@Override
public String getName() {
return NAME;
}
- @Nonnull
+ @NotNull
@Override
public ConfigurationParameters getParameters() {
ConfigurationParameters params = super.getParameters();
@@ -197,38 +196,38 @@ public class UserConfigurationImpl exten
}
}
- @Nonnull
+ @NotNull
@Override
public WorkspaceInitializer getWorkspaceInitializer() {
return new UserInitializer(getSecurityProvider());
}
- @Nonnull
+ @NotNull
@Override
- public List<? extends ValidatorProvider> getValidators(@Nonnull String workspaceName, @Nonnull Set<Principal> principals, @Nonnull MoveTracker moveTracker) {
+ public List<? extends ValidatorProvider> getValidators(@NotNull String workspaceName, @NotNull Set<Principal> principals, @NotNull MoveTracker moveTracker) {
return ImmutableList.of(new UserValidatorProvider(getParameters(), getRootProvider(), getTreeProvider()), new CacheValidatorProvider(principals, getTreeProvider()));
}
- @Nonnull
+ @NotNull
@Override
public List<ThreeWayConflictHandler> getConflictHandlers() {
return ImmutableList.of(new RepMembersConflictHandler());
}
- @Nonnull
+ @NotNull
@Override
public List<ProtectedItemImporter> getProtectedItemImporters() {
return Collections.<ProtectedItemImporter>singletonList(new UserImporter(getParameters()));
}
- @Nonnull
+ @NotNull
@Override
public Context getContext() {
return UserContext.getInstance();
}
//--------------------------------------------------< UserConfiguration >---
- @Nonnull
+ @NotNull
@Override
public UserManager getUserManager(Root root, NamePathMapper namePathMapper) {
UserManager umgr = new UserManagerImpl(root, namePathMapper, getSecurityProvider());
@@ -241,7 +240,7 @@ public class UserConfigurationImpl exten
@Nullable
@Override
- public PrincipalProvider getUserPrincipalProvider(@Nonnull Root root, @Nonnull NamePathMapper namePathMapper) {
+ public PrincipalProvider getUserPrincipalProvider(@NotNull Root root, @NotNull NamePathMapper namePathMapper) {
return new UserPrincipalProvider(root, this, namePathMapper);
}
}
Modified: jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserContext.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserContext.java?rev=1846014&r1=1846013&r2=1846014&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserContext.java (original)
+++ jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserContext.java Wed Nov 7 13:57:55 2018
@@ -16,8 +16,6 @@
*/
package org.apache.jackrabbit.oak.security.user;
-import javax.annotation.Nonnull;
-
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Tree;
import org.apache.jackrabbit.oak.plugins.tree.TreeLocation;
@@ -25,6 +23,7 @@ import org.apache.jackrabbit.oak.spi.sec
import org.apache.jackrabbit.oak.spi.security.user.UserConstants;
import org.apache.jackrabbit.oak.plugins.tree.TreeUtil;
import org.apache.jackrabbit.util.Text;
+import org.jetbrains.annotations.NotNull;
final class UserContext implements Context, UserConstants {
@@ -39,7 +38,7 @@ final class UserContext implements Conte
//------------------------------------------------------------< Context >---
@Override
- public boolean definesProperty(@Nonnull Tree parent, @Nonnull PropertyState property) {
+ public boolean definesProperty(@NotNull Tree parent, @NotNull PropertyState property) {
String propName = property.getName();
String ntName = TreeUtil.getPrimaryTypeName(parent);
if (NT_REP_USER.equals(ntName) || NT_REP_SYSTEM_USER.equals(ntName)) {
@@ -57,18 +56,18 @@ final class UserContext implements Conte
}
@Override
- public boolean definesContextRoot(@Nonnull Tree tree) {
+ public boolean definesContextRoot(@NotNull Tree tree) {
return definesTree(tree);
}
@Override
- public boolean definesTree(@Nonnull Tree tree) {
+ public boolean definesTree(@NotNull Tree tree) {
String ntName = TreeUtil.getPrimaryTypeName(tree);
return NT_NAMES.contains(ntName);
}
@Override
- public boolean definesLocation(@Nonnull TreeLocation location) {
+ public boolean definesLocation(@NotNull TreeLocation location) {
Tree tree = location.getTree();
if (tree != null && location.exists()) {
PropertyState p = location.getProperty();
@@ -88,8 +87,8 @@ final class UserContext implements Conte
}
@Override
- public boolean definesInternal(@Nonnull Tree tree) {
+ public boolean definesInternal(@NotNull Tree tree) {
return false;
}
-}
\ No newline at end of file
+}
Modified: jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserImpl.java?rev=1846014&r1=1846013&r2=1846014&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserImpl.java (original)
+++ jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserImpl.java Wed Nov 7 13:57:55 2018
@@ -17,8 +17,6 @@
package org.apache.jackrabbit.oak.security.user;
import java.security.Principal;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nonnull;
import javax.jcr.Credentials;
import javax.jcr.RepositoryException;
@@ -33,6 +31,8 @@ import org.apache.jackrabbit.oak.spi.sec
import org.apache.jackrabbit.oak.spi.security.user.util.PasswordUtil;
import org.apache.jackrabbit.oak.spi.security.user.util.UserUtil;
import org.apache.jackrabbit.oak.plugins.tree.TreeUtil;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import static org.apache.jackrabbit.oak.api.Type.STRING;
@@ -53,7 +53,7 @@ class UserImpl extends AuthorizableImpl
//---------------------------------------------------< AuthorizableImpl >---
@Override
- void checkValidTree(@Nonnull Tree tree) throws RepositoryException {
+ void checkValidTree(@NotNull Tree tree) throws RepositoryException {
if (!UserUtil.isType(tree, AuthorizableType.USER)) {
throw new IllegalArgumentException("Invalid user node: node type rep:User expected.");
}
@@ -158,8 +158,8 @@ class UserImpl extends AuthorizableImpl
}
//------------------------------------------------------------< private >---
- @CheckForNull
+ @Nullable
private String getPasswordHash() {
return TreeUtil.getString(getTree(), UserConstants.REP_PASSWORD);
}
-}
\ No newline at end of file
+}
Modified: jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserImporter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserImporter.java?rev=1846014&r1=1846013&r2=1846014&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserImporter.java (original)
+++ jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserImporter.java Wed Nov 7 13:57:55 2018
@@ -25,7 +25,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
-import javax.annotation.Nonnull;
import javax.jcr.ImportUUIDBehavior;
import javax.jcr.PropertyType;
import javax.jcr.RepositoryException;
@@ -65,6 +64,7 @@ import org.apache.jackrabbit.oak.spi.xml
import org.apache.jackrabbit.oak.spi.xml.ReferenceChangeTracker;
import org.apache.jackrabbit.oak.spi.xml.TextValue;
import org.apache.jackrabbit.oak.plugins.tree.TreeUtil;
+import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -168,9 +168,9 @@ class UserImporter implements ProtectedP
//----------------------------------------------< ProtectedItemImporter >---
@Override
- public boolean init(@Nonnull Session session, @Nonnull Root root, @Nonnull NamePathMapper namePathMapper,
+ public boolean init(@NotNull Session session, @NotNull Root root, @NotNull NamePathMapper namePathMapper,
boolean isWorkspaceImport, int uuidBehavior,
- @Nonnull ReferenceChangeTracker referenceTracker, @Nonnull SecurityProvider securityProvider) {
+ @NotNull ReferenceChangeTracker referenceTracker, @NotNull SecurityProvider securityProvider) {
if (!(session instanceof JackrabbitSession)) {
log.debug("Importing protected user content requires a JackrabbitSession");
@@ -199,7 +199,7 @@ class UserImporter implements ProtectedP
return initialized;
}
- private static boolean canInitUserManager(@Nonnull JackrabbitSession session, boolean isWorkspaceImport, @Nonnull SecurityProvider securityProvider) {
+ private static boolean canInitUserManager(@NotNull JackrabbitSession session, boolean isWorkspaceImport, @NotNull SecurityProvider securityProvider) {
try {
if (!isWorkspaceImport && session.getUserManager().isAutoSave()) {
log.warn("Session import cannot handle user content: UserManager is in autosave mode.");
@@ -216,7 +216,7 @@ class UserImporter implements ProtectedP
// -----------------------------------------< ProtectedPropertyImporter >---
@Override
- public boolean handlePropInfo(@Nonnull Tree parent, @Nonnull PropInfo propInfo, @Nonnull PropertyDefinition def) throws RepositoryException {
+ public boolean handlePropInfo(@NotNull Tree parent, @NotNull PropInfo propInfo, @NotNull PropertyDefinition def) throws RepositoryException {
checkInitialized();
String propName = propInfo.getName();
@@ -326,7 +326,7 @@ class UserImporter implements ProtectedP
}
@Override
- public void propertiesCompleted(@Nonnull Tree protectedParent) throws RepositoryException {
+ public void propertiesCompleted(@NotNull Tree protectedParent) throws RepositoryException {
if (isCacheNode(protectedParent)) {
// remove the cache if present
protectedParent.remove();
@@ -387,7 +387,7 @@ class UserImporter implements ProtectedP
// ---------------------------------------------< ProtectedNodeImporter >---
@Override
- public boolean start(@Nonnull Tree protectedParent) throws RepositoryException {
+ public boolean start(@NotNull Tree protectedParent) throws RepositoryException {
Authorizable auth = null;
if (isMemberNode(protectedParent)) {
Tree groupTree = protectedParent;
@@ -410,7 +410,7 @@ class UserImporter implements ProtectedP
}
@Override
- public void startChildInfo(@Nonnull NodeInfo childInfo, @Nonnull List<PropInfo> propInfos) throws RepositoryException {
+ public void startChildInfo(@NotNull NodeInfo childInfo, @NotNull List<PropInfo> propInfos) throws RepositoryException {
checkState(currentMembership != null);
String ntName = childInfo.getPrimaryTypeName();
@@ -439,12 +439,12 @@ class UserImporter implements ProtectedP
}
@Override
- public void end(@Nonnull Tree protectedParent) throws RepositoryException {
+ public void end(@NotNull Tree protectedParent) throws RepositoryException {
currentMembership = null;
}
//------------------------------------------------------------< private >---
- @Nonnull
+ @NotNull
private IdentifierManager getIdentifierManager() {
if (identifierManager == null) {
identifierManager = new IdentifierManager(root);
@@ -452,13 +452,13 @@ class UserImporter implements ProtectedP
return identifierManager;
}
- @Nonnull
+ @NotNull
private PrincipalManager getPrincipalManager() throws RepositoryException {
return userManager.getPrincipalManager();
}
- @Nonnull
- private Membership getMembership(@Nonnull String authId) {
+ @NotNull
+ private Membership getMembership(@NotNull String authId) {
Membership membership = memberships.get(authId);
if (membership == null) {
membership = new Membership(authId);
@@ -473,25 +473,25 @@ class UserImporter implements ProtectedP
}
}
- private boolean isValid(@Nonnull PropertyDefinition definition, @Nonnull String oakNodeTypeName, boolean multipleStatus) {
+ private boolean isValid(@NotNull PropertyDefinition definition, @NotNull String oakNodeTypeName, boolean multipleStatus) {
return multipleStatus == definition.isMultiple() &&
definition.getDeclaringNodeType().isNodeType(namePathMapper.getJcrName(oakNodeTypeName));
}
- private static boolean isMemberNode(@Nonnull Tree tree) {
+ private static boolean isMemberNode(@NotNull Tree tree) {
//noinspection deprecation
return tree.exists() && NT_REP_MEMBERS.equals(TreeUtil.getPrimaryTypeName(tree));
}
- private static boolean isMemberReferencesListNode(@Nonnull Tree tree) {
+ private static boolean isMemberReferencesListNode(@NotNull Tree tree) {
return tree.exists() && NT_REP_MEMBER_REFERENCES_LIST.equals(TreeUtil.getPrimaryTypeName(tree));
}
- private static boolean isPwdNode(@Nonnull Tree tree) {
+ private static boolean isPwdNode(@NotNull Tree tree) {
return REP_PWD.equals(tree.getName()) && NT_REP_PASSWORD.equals(TreeUtil.getPrimaryTypeName(tree));
}
- private static boolean importPwdNodeProperty(@Nonnull Tree parent, @Nonnull PropInfo propInfo, @Nonnull PropertyDefinition def) throws RepositoryException {
+ private static boolean importPwdNodeProperty(@NotNull Tree parent, @NotNull PropInfo propInfo, @NotNull PropertyDefinition def) throws RepositoryException {
String propName = propInfo.getName();
if (propName == null) {
propName = def.getName();
@@ -517,7 +517,7 @@ class UserImporter implements ProtectedP
return true;
}
- private static boolean isCacheNode(@Nonnull Tree tree) {
+ private static boolean isCacheNode(@NotNull Tree tree) {
return tree.exists() && CacheConstants.REP_CACHE.equals(tree.getName()) && CacheConstants.NT_REP_CACHE.equals(TreeUtil.getPrimaryTypeName(tree));
}
@@ -728,4 +728,4 @@ class UserImporter implements ProtectedP
}
}
}
-}
\ No newline at end of file
+}
Modified: jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserManagerImpl.java?rev=1846014&r1=1846013&r2=1846014&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserManagerImpl.java (original)
+++ jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserManagerImpl.java Wed Nov 7 13:57:55 2018
@@ -22,9 +22,6 @@ import java.security.Principal;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
import javax.jcr.RepositoryException;
import javax.jcr.UnsupportedRepositoryOperationException;
@@ -58,6 +55,8 @@ import org.apache.jackrabbit.oak.spi.sec
import org.apache.jackrabbit.oak.spi.security.user.util.PasswordUtil;
import org.apache.jackrabbit.oak.spi.security.user.util.UserUtil;
import org.apache.jackrabbit.oak.plugins.tree.TreeUtil;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -80,8 +79,8 @@ public class UserManagerImpl implements
private UserQueryManager queryManager;
private ReadOnlyNodeTypeManager ntMgr;
- public UserManagerImpl(@Nonnull Root root, @Nonnull NamePathMapper namePathMapper,
- @Nonnull SecurityProvider securityProvider) {
+ public UserManagerImpl(@NotNull Root root, @NotNull NamePathMapper namePathMapper,
+ @NotNull SecurityProvider securityProvider) {
this.root = root;
this.namePathMapper = namePathMapper;
this.securityProvider = securityProvider;
@@ -93,8 +92,8 @@ public class UserManagerImpl implements
this.actionProvider = getActionProvider(config);
}
- @Nonnull
- private static AuthorizableActionProvider getActionProvider(@Nonnull ConfigurationParameters config) {
+ @NotNull
+ private static AuthorizableActionProvider getActionProvider(@NotNull ConfigurationParameters config) {
AuthorizableActionProvider actionProvider = config.getConfigValue(UserConstants.PARAM_AUTHORIZABLE_ACTION_PROVIDER, null, AuthorizableActionProvider.class);
if (actionProvider == null) {
actionProvider = new DefaultAuthorizableActionProvider(config);
@@ -259,7 +258,7 @@ public class UserManagerImpl implements
* @param password The password.
* @throws RepositoryException If an exception occurs.
*/
- void onCreate(@Nonnull User user, @CheckForNull String password) throws RepositoryException {
+ void onCreate(@NotNull User user, @Nullable String password) throws RepositoryException {
if (!user.isSystemUser()) {
for (AuthorizableAction action : actionProvider.getAuthorizableActions(securityProvider)) {
action.onCreate(user, password, root, namePathMapper);
@@ -277,7 +276,7 @@ public class UserManagerImpl implements
* @param group The new group.
* @throws RepositoryException If an exception occurs.
*/
- void onCreate(@Nonnull Group group) throws RepositoryException {
+ void onCreate(@NotNull Group group) throws RepositoryException {
for (AuthorizableAction action : actionProvider.getAuthorizableActions(securityProvider)) {
action.onCreate(group, root, namePathMapper);
}
@@ -291,7 +290,7 @@ public class UserManagerImpl implements
* @param authorizable The authorizable to be removed.
* @throws RepositoryException If an exception occurs.
*/
- void onRemove(@Nonnull Authorizable authorizable) throws RepositoryException {
+ void onRemove(@NotNull Authorizable authorizable) throws RepositoryException {
for (AuthorizableAction action : actionProvider.getAuthorizableActions(securityProvider)) {
action.onRemove(authorizable, root, namePathMapper);
}
@@ -306,7 +305,7 @@ public class UserManagerImpl implements
* @param password The new password.
* @throws RepositoryException If an exception occurs.
*/
- void onPasswordChange(@Nonnull User user, @Nonnull String password) throws RepositoryException {
+ void onPasswordChange(@NotNull User user, @NotNull String password) throws RepositoryException {
for (AuthorizableAction action : actionProvider.getAuthorizableActions(securityProvider)) {
action.onPasswordChange(user, password, root, namePathMapper);
}
@@ -322,7 +321,7 @@ public class UserManagerImpl implements
* @param member The member successfully removed or added.
* @throws RepositoryException If an error occurs.
*/
- void onGroupUpdate(@Nonnull Group group, boolean isRemove, @Nonnull Authorizable member) throws RepositoryException {
+ void onGroupUpdate(@NotNull Group group, boolean isRemove, @NotNull Authorizable member) throws RepositoryException {
for (GroupAction action : selectGroupActions()) {
if (isRemove) {
action.onMemberRemoved(group, member, root, namePathMapper);
@@ -344,7 +343,7 @@ public class UserManagerImpl implements
* @param failedIds The IDs of all members whose addition or removal failed.
* @throws RepositoryException If an error occurs.
*/
- void onGroupUpdate(@Nonnull Group group, boolean isRemove, boolean isContentId, @Nonnull Set<String> memberIds, @Nonnull Set<String> failedIds) throws RepositoryException {
+ void onGroupUpdate(@NotNull Group group, boolean isRemove, boolean isContentId, @NotNull Set<String> memberIds, @NotNull Set<String> failedIds) throws RepositoryException {
for (GroupAction action : selectGroupActions()) {
if (isRemove) {
action.onMembersRemoved(group, memberIds, failedIds, root, namePathMapper);
@@ -359,25 +358,25 @@ public class UserManagerImpl implements
}
//--------------------------------------------------------------------------
- @CheckForNull
- public Authorizable getAuthorizable(@CheckForNull Tree tree) throws RepositoryException {
+ @Nullable
+ public Authorizable getAuthorizable(@Nullable Tree tree) throws RepositoryException {
if (tree == null || !tree.exists()) {
return null;
}
return getAuthorizable(UserUtil.getAuthorizableId(tree), tree);
}
- @CheckForNull
- Authorizable getAuthorizableByOakPath(@Nonnull String oakPath) throws RepositoryException {
+ @Nullable
+ Authorizable getAuthorizableByOakPath(@NotNull String oakPath) throws RepositoryException {
return getAuthorizable(userProvider.getAuthorizableByPath(oakPath));
}
- @Nonnull
+ @NotNull
NamePathMapper getNamePathMapper() {
return namePathMapper;
}
- @Nonnull
+ @NotNull
ReadOnlyNodeTypeManager getNodeTypeManager() {
if (ntMgr == null) {
ntMgr = ReadOnlyNodeTypeManager.getInstance(root, NamePathMapper.DEFAULT);
@@ -385,23 +384,23 @@ public class UserManagerImpl implements
return ntMgr;
}
- @Nonnull
+ @NotNull
MembershipProvider getMembershipProvider() {
return membershipProvider;
}
- @Nonnull
+ @NotNull
PrincipalManager getPrincipalManager() throws RepositoryException {
return securityProvider.getConfiguration(PrincipalConfiguration.class).getPrincipalManager(root, namePathMapper);
}
- @Nonnull
+ @NotNull
ConfigurationParameters getConfig() {
return config;
}
- @CheckForNull
- private Authorizable getAuthorizable(@CheckForNull String id, @CheckForNull Tree tree) throws RepositoryException {
+ @Nullable
+ private Authorizable getAuthorizable(@Nullable String id, @Nullable Tree tree) throws RepositoryException {
if (id == null || tree == null) {
return null;
}
@@ -418,7 +417,7 @@ public class UserManagerImpl implements
}
}
- private void checkValidId(@CheckForNull String id) throws RepositoryException {
+ private void checkValidId(@Nullable String id) throws RepositoryException {
if (id == null || id.isEmpty()) {
throw new IllegalArgumentException("Invalid ID " + id);
}
@@ -427,7 +426,7 @@ public class UserManagerImpl implements
}
}
- void checkValidPrincipal(@CheckForNull Principal principal, boolean isGroup) throws RepositoryException {
+ void checkValidPrincipal(@Nullable Principal principal, boolean isGroup) throws RepositoryException {
if (principal == null || Strings.isNullOrEmpty(principal.getName())) {
throw new IllegalArgumentException("Principal may not be null and must have a valid name.");
}
@@ -439,11 +438,11 @@ public class UserManagerImpl implements
}
}
- void setPrincipal(@Nonnull Tree authorizableTree, @Nonnull Principal principal) {
+ void setPrincipal(@NotNull Tree authorizableTree, @NotNull Principal principal) {
authorizableTree.setProperty(UserConstants.REP_PRINCIPAL_NAME, principal.getName());
}
- void setPassword(@Nonnull Tree userTree, @Nonnull String userId, @Nonnull String password, boolean forceHash) throws RepositoryException {
+ void setPassword(@NotNull Tree userTree, @NotNull String userId, @NotNull String password, boolean forceHash) throws RepositoryException {
String pwHash;
if (forceHash || PasswordUtil.isPlainTextPassword(password)) {
try {
@@ -484,7 +483,7 @@ public class UserManagerImpl implements
return config.getConfigValue(UserConstants.PARAM_PASSWORD_INITIAL_CHANGE, UserConstants.DEFAULT_PASSWORD_INITIAL_CHANGE);
}
- @Nonnull
+ @NotNull
private UserQueryManager getQueryManager() {
if (queryManager == null) {
queryManager = new UserQueryManager(this, namePathMapper, config, root);
@@ -497,7 +496,7 @@ public class UserManagerImpl implements
*
* @return A {@code List} of {@code GroupAction}s. List may be empty.
*/
- @Nonnull
+ @NotNull
private List<GroupAction> selectGroupActions() {
List<GroupAction> actions = Lists.newArrayList();
for (AuthorizableAction action : actionProvider.getAuthorizableActions(securityProvider)) {
@@ -507,4 +506,4 @@ public class UserManagerImpl implements
}
return actions;
}
-}
\ No newline at end of file
+}
Modified: jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserPrincipalProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserPrincipalProvider.java?rev=1846014&r1=1846013&r2=1846014&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserPrincipalProvider.java (original)
+++ jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserPrincipalProvider.java Wed Nov 7 13:57:55 2018
@@ -24,9 +24,6 @@ import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
import javax.jcr.AccessDeniedException;
import javax.jcr.RepositoryException;
@@ -58,6 +55,8 @@ import org.apache.jackrabbit.oak.spi.sec
import org.apache.jackrabbit.oak.spi.security.user.util.UserUtil;
import org.apache.jackrabbit.oak.plugins.tree.TreeUtil;
import org.apache.jackrabbit.util.Text;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -88,9 +87,9 @@ class UserPrincipalProvider implements P
private final long expiration;
private final boolean cacheEnabled;
- UserPrincipalProvider(@Nonnull Root root,
- @Nonnull UserConfiguration userConfiguration,
- @Nonnull NamePathMapper namePathMapper) {
+ UserPrincipalProvider(@NotNull Root root,
+ @NotNull UserConfiguration userConfiguration,
+ @NotNull NamePathMapper namePathMapper) {
this.root = root;
this.config = userConfiguration;
this.namePathMapper = namePathMapper;
@@ -104,7 +103,7 @@ class UserPrincipalProvider implements P
//--------------------------------------------------< PrincipalProvider >---
@Override
- public Principal getPrincipal(@Nonnull String principalName) {
+ public Principal getPrincipal(@NotNull String principalName) {
Tree authorizableTree = userProvider.getAuthorizableByPrincipal(new PrincipalImpl(principalName));
Principal principal = createPrincipal(authorizableTree);
@@ -116,9 +115,9 @@ class UserPrincipalProvider implements P
}
}
- @Nonnull
+ @NotNull
@Override
- public Set<Group> getGroupMembership(@Nonnull Principal principal) {
+ public Set<Group> getGroupMembership(@NotNull Principal principal) {
Tree tree = getAuthorizableTree(principal);
if (tree == null) {
return Collections.emptySet();
@@ -127,9 +126,9 @@ class UserPrincipalProvider implements P
}
}
- @Nonnull
+ @NotNull
@Override
- public Set<? extends Principal> getPrincipals(@Nonnull String userID) {
+ public Set<? extends Principal> getPrincipals(@NotNull String userID) {
Set<Principal> principals = new HashSet<Principal>();
Tree tree = userProvider.getAuthorizable(userID);
if (tree != null && UserUtil.isType(tree, AuthorizableType.USER)) {
@@ -142,7 +141,7 @@ class UserPrincipalProvider implements P
return principals;
}
- @Nonnull
+ @NotNull
@Override
public Iterator<? extends Principal> findPrincipals(final String nameHint,
final int searchType) {
@@ -175,20 +174,20 @@ class UserPrincipalProvider implements P
}
}
- @Nonnull
+ @NotNull
@Override
public Iterator<? extends Principal> findPrincipals(int searchType) {
return findPrincipals(null, searchType);
}
//------------------------------------------------------------< private >---
- @CheckForNull
- private Tree getAuthorizableTree(@Nonnull Principal principal) {
+ @Nullable
+ private Tree getAuthorizableTree(@NotNull Principal principal) {
return userProvider.getAuthorizableByPrincipal(principal);
}
- @CheckForNull
- private Principal createPrincipal(@CheckForNull Tree authorizableTree) {
+ @Nullable
+ private Principal createPrincipal(@Nullable Tree authorizableTree) {
Principal principal = null;
if (authorizableTree != null) {
AuthorizableType type = UserUtil.getType(authorizableTree);
@@ -201,8 +200,8 @@ class UserPrincipalProvider implements P
return principal;
}
- @CheckForNull
- private Principal createUserPrincipal(@Nonnull String id, @Nonnull Tree userTree) {
+ @Nullable
+ private Principal createUserPrincipal(@NotNull String id, @NotNull Tree userTree) {
String principalName = getPrincipalName(userTree);
if (principalName == null) {
return null;
@@ -216,8 +215,8 @@ class UserPrincipalProvider implements P
}
}
- @CheckForNull
- private Group createGroupPrincipal(@Nonnull Tree groupTree) {
+ @Nullable
+ private Group createGroupPrincipal(@NotNull Tree groupTree) {
String principalName = getPrincipalName(groupTree);
if (principalName == null) {
return null;
@@ -225,8 +224,8 @@ class UserPrincipalProvider implements P
return new GroupPrincipal(principalName, groupTree);
}
- @CheckForNull
- private static String getPrincipalName(@Nonnull Tree tree) {
+ @Nullable
+ private static String getPrincipalName(@NotNull Tree tree) {
PropertyState principalName = tree.getProperty(UserConstants.REP_PRINCIPAL_NAME);
if (principalName != null) {
return principalName.getValue(STRING);
@@ -237,8 +236,8 @@ class UserPrincipalProvider implements P
}
}
- @Nonnull
- private Set<Group> getGroupMembership(@Nonnull Tree authorizableTree) {
+ @NotNull
+ private Set<Group> getGroupMembership(@NotNull Tree authorizableTree) {
Set<Group> groupPrincipals = null;
boolean doCache = cacheEnabled && UserUtil.isType(authorizableTree, AuthorizableType.USER);
if (doCache) {
@@ -271,7 +270,7 @@ class UserPrincipalProvider implements P
return groupPrincipals;
}
- private void cacheGroups(@Nonnull Tree authorizableNode, @Nonnull Set<Group> groupPrincipals) {
+ private void cacheGroups(@NotNull Tree authorizableNode, @NotNull Set<Group> groupPrincipals) {
try {
root.refresh();
Tree cache = authorizableNode.getChild(CacheConstants.REP_CACHE);
@@ -306,8 +305,8 @@ class UserPrincipalProvider implements P
}
}
- @CheckForNull
- private Set<Group> readGroupsFromCache(@Nonnull Tree authorizableNode) {
+ @Nullable
+ private Set<Group> readGroupsFromCache(@NotNull Tree authorizableNode) {
Tree principalCache = authorizableNode.getChild(CacheConstants.REP_CACHE);
if (!principalCache.exists()) {
log.debug("No group cache at " + authorizableNode.getPath());
@@ -399,11 +398,11 @@ class UserPrincipalProvider implements P
private UserManager userManager;
- BaseGroupPrincipal(@Nonnull String principalName, @Nonnull Tree groupTree) {
+ BaseGroupPrincipal(@NotNull String principalName, @NotNull Tree groupTree) {
super(principalName, groupTree, namePathMapper);
}
- BaseGroupPrincipal(@Nonnull String principalName, @Nonnull String groupPath) {
+ BaseGroupPrincipal(@NotNull String principalName, @NotNull String groupPath) {
super(principalName, groupPath, namePathMapper);
}
@@ -421,19 +420,19 @@ class UserPrincipalProvider implements P
}
@Override
- boolean isMember(@Nonnull Authorizable authorizable) throws RepositoryException {
+ boolean isMember(@NotNull Authorizable authorizable) throws RepositoryException {
org.apache.jackrabbit.api.security.user.Group g = getGroup();
return g != null && g.isMember(authorizable);
}
- @Nonnull
+ @NotNull
@Override
Iterator<Authorizable> getMembers() throws RepositoryException {
org.apache.jackrabbit.api.security.user.Group g = getGroup();
return (g == null) ? Collections.<Authorizable>emptyIterator() : g.getMembers();
}
- @CheckForNull
+ @Nullable
abstract org.apache.jackrabbit.api.security.user.Group getGroup()throws RepositoryException;
}
@@ -445,12 +444,12 @@ class UserPrincipalProvider implements P
private org.apache.jackrabbit.api.security.user.Group group;
- GroupPrincipal(@Nonnull String principalName, @Nonnull Tree groupTree) {
+ GroupPrincipal(@NotNull String principalName, @NotNull Tree groupTree) {
super(principalName, groupTree);
}
@Override
- @CheckForNull
+ @Nullable
org.apache.jackrabbit.api.security.user.Group getGroup() throws RepositoryException {
if (group == null) {
Authorizable authorizable = getUserManager().getAuthorizable(this);
@@ -466,7 +465,7 @@ class UserPrincipalProvider implements P
private org.apache.jackrabbit.api.security.user.Group group;
- CachedGroupPrincipal(@Nonnull String principalName) {
+ CachedGroupPrincipal(@NotNull String principalName) {
super(principalName, "");
}
@@ -488,7 +487,7 @@ class UserPrincipalProvider implements P
}
@Override
- @CheckForNull
+ @Nullable
org.apache.jackrabbit.api.security.user.Group getGroup() throws RepositoryException {
if (group == null) {
Authorizable authorizable = getUserManager().getAuthorizable(new PrincipalImpl(getName()));
Modified: jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserProvider.java?rev=1846014&r1=1846013&r2=1846014&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserProvider.java (original)
+++ jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserProvider.java Wed Nov 7 13:57:55 2018
@@ -20,9 +20,6 @@ import java.security.Principal;
import java.text.ParseException;
import java.util.Collections;
import java.util.Iterator;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
import javax.jcr.AccessDeniedException;
import javax.jcr.RepositoryException;
import javax.jcr.nodetype.ConstraintViolationException;
@@ -43,6 +40,8 @@ import org.apache.jackrabbit.oak.spi.sec
import org.apache.jackrabbit.oak.spi.security.user.UserConstants;
import org.apache.jackrabbit.oak.plugins.tree.TreeUtil;
import org.apache.jackrabbit.util.Text;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -170,7 +169,7 @@ class UserProvider extends AuthorizableB
private final String groupPath;
private final String userPath;
- UserProvider(@Nonnull Root root, @Nonnull ConfigurationParameters config) {
+ UserProvider(@NotNull Root root, @NotNull ConfigurationParameters config) {
super(root, config);
defaultDepth = config.getConfigValue(PARAM_DEFAULT_DEPTH, DEFAULT_DEPTH);
@@ -178,18 +177,18 @@ class UserProvider extends AuthorizableB
userPath = config.getConfigValue(PARAM_USER_PATH, DEFAULT_USER_PATH);
}
- @Nonnull
- Tree createUser(@Nonnull String userID, @Nullable String intermediateJcrPath) throws RepositoryException {
+ @NotNull
+ Tree createUser(@NotNull String userID, @Nullable String intermediateJcrPath) throws RepositoryException {
return createAuthorizableNode(userID, NT_REP_USER, intermediateJcrPath);
}
- @Nonnull
- Tree createGroup(@Nonnull String groupID, @Nullable String intermediateJcrPath) throws RepositoryException {
+ @NotNull
+ Tree createGroup(@NotNull String groupID, @Nullable String intermediateJcrPath) throws RepositoryException {
return createAuthorizableNode(groupID, NT_REP_GROUP, intermediateJcrPath);
}
- @Nonnull
- Tree createSystemUser(@Nonnull String userID, @Nullable String intermediateJcrPath) throws RepositoryException {
+ @NotNull
+ Tree createSystemUser(@NotNull String userID, @Nullable String intermediateJcrPath) throws RepositoryException {
String relSysPath = config.getConfigValue(PARAM_SYSTEM_RELATIVE_PATH, DEFAULT_SYSTEM_RELATIVE_PATH);
String relPath;
if (intermediateJcrPath == null) {
@@ -204,18 +203,18 @@ class UserProvider extends AuthorizableB
return createAuthorizableNode(userID, NT_REP_SYSTEM_USER, relPath);
}
- @CheckForNull
- Tree getAuthorizable(@Nonnull String authorizableId) {
+ @Nullable
+ Tree getAuthorizable(@NotNull String authorizableId) {
return getByID(authorizableId, AuthorizableType.AUTHORIZABLE);
}
- @CheckForNull
- Tree getAuthorizableByPath(@Nonnull String authorizableOakPath) {
+ @Nullable
+ Tree getAuthorizableByPath(@NotNull String authorizableOakPath) {
return getByPath(authorizableOakPath, AuthorizableType.AUTHORIZABLE);
}
- @CheckForNull
- Tree getAuthorizableByPrincipal(@Nonnull Principal principal) {
+ @Nullable
+ Tree getAuthorizableByPrincipal(@NotNull Principal principal) {
if (principal instanceof TreeBasedPrincipal) {
return root.getTree(((TreeBasedPrincipal) principal).getOakPath());
}
@@ -248,8 +247,8 @@ class UserProvider extends AuthorizableB
//------------------------------------------------------------< private >---
- private Tree createAuthorizableNode(@Nonnull String authorizableId,
- @Nonnull String ntName,
+ private Tree createAuthorizableNode(@NotNull String authorizableId,
+ @NotNull String ntName,
@Nullable String intermediatePath) throws RepositoryException {
String nodeName = getNodeName(authorizableId);
Tree folder = createFolderNodes(nodeName, NT_REP_GROUP.equals(ntName), intermediatePath);
@@ -285,7 +284,7 @@ class UserProvider extends AuthorizableB
* @return The folder node.
* @throws RepositoryException If an error occurs
*/
- private Tree createFolderNodes(@Nonnull String nodeName,
+ private Tree createFolderNodes(@NotNull String nodeName,
boolean isGroup,
@Nullable String intermediatePath) throws RepositoryException {
String authRoot = (isGroup) ? groupPath : userPath;
@@ -321,10 +320,10 @@ class UserProvider extends AuthorizableB
return folder;
}
- @Nonnull
- private String getFolderPath(@Nonnull String nodeName,
+ @NotNull
+ private String getFolderPath(@NotNull String nodeName,
@Nullable String intermediatePath,
- @Nonnull String authRoot) throws ConstraintViolationException {
+ @NotNull String authRoot) throws ConstraintViolationException {
boolean emptyOrNull = (intermediatePath == null || intermediatePath.isEmpty() || authRoot.equals(intermediatePath));
StringBuilder sb = new StringBuilder();
if (!emptyOrNull) {
@@ -354,8 +353,8 @@ class UserProvider extends AuthorizableB
return sb.toString();
}
- private String getNodeName(@Nonnull String authorizableId) {
+ private String getNodeName(@NotNull String authorizableId) {
AuthorizableNodeName generator = checkNotNull(config.getConfigValue(PARAM_AUTHORIZABLE_NODE_NAME, AuthorizableNodeName.DEFAULT, AuthorizableNodeName.class));
return generator.generateNodeName(authorizableId);
}
-}
\ No newline at end of file
+}
Modified: jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserValidator.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserValidator.java?rev=1846014&r1=1846013&r2=1846014&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserValidator.java (original)
+++ jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserValidator.java Wed Nov 7 13:57:55 2018
@@ -16,9 +16,6 @@
*/
package org.apache.jackrabbit.oak.security.user;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.oak.api.CommitFailedException;
import org.apache.jackrabbit.oak.api.PropertyState;
@@ -34,6 +31,8 @@ import org.apache.jackrabbit.oak.spi.sec
import org.apache.jackrabbit.oak.spi.state.NodeState;
import org.apache.jackrabbit.oak.plugins.tree.TreeUtil;
import org.apache.jackrabbit.util.Text;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import static com.google.common.base.Preconditions.checkNotNull;
@@ -161,7 +160,7 @@ class UserValidator extends DefaultValid
true);
}
- private boolean isAdminUser(@Nonnull Tree userTree) {
+ private boolean isAdminUser(@NotNull Tree userTree) {
if (userTree.exists() && isUser(userTree)) {
String id = UserUtil.getAuthorizableId(userTree);
return UserUtil.getAdminId(provider.getConfig()).equals(id);
@@ -170,7 +169,7 @@ class UserValidator extends DefaultValid
}
}
- private void validateAuthorizable(@Nonnull Tree tree, @Nullable AuthorizableType type) throws CommitFailedException {
+ private void validateAuthorizable(@NotNull Tree tree, @Nullable AuthorizableType type) throws CommitFailedException {
boolean isSystemUser = (type == AuthorizableType.USER) && UserUtil.isSystemUser(tree);
String authRoot = UserUtil.getAuthorizableRootPath(provider.getConfig(), type);
if (isSystemUser) {
@@ -196,7 +195,7 @@ class UserValidator extends DefaultValid
}
}
- private boolean isValidUUID(@Nonnull Tree parent, @Nonnull String uuid) {
+ private boolean isValidUUID(@NotNull Tree parent, @NotNull String uuid) {
String id = UserUtil.getAuthorizableId(parent);
return id != null && uuid.equals(provider.getMembershipProvider().getContentID(id));
}
@@ -213,7 +212,7 @@ class UserValidator extends DefaultValid
* @param pathConstraint The path constraint.
* @throws CommitFailedException If the hierarchy isn't valid.
*/
- private static void assertHierarchy(@Nonnull Tree tree, @Nonnull String pathConstraint) throws CommitFailedException {
+ private static void assertHierarchy(@NotNull Tree tree, @NotNull String pathConstraint) throws CommitFailedException {
if (!Text.isDescendant(pathConstraint, tree.getPath())) {
String msg = "Attempt to create user/group outside of configured scope " + pathConstraint;
throw constraintViolation(28, msg);
@@ -230,7 +229,7 @@ class UserValidator extends DefaultValid
}
}
- private static CommitFailedException constraintViolation(int code, @Nonnull String message) {
+ private static CommitFailedException constraintViolation(int code, @NotNull String message) {
return new CommitFailedException(CommitFailedException.CONSTRAINT, code, message);
}
-}
\ No newline at end of file
+}
Modified: jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserValidatorProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserValidatorProvider.java?rev=1846014&r1=1846013&r2=1846014&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserValidatorProvider.java (original)
+++ jackrabbit/oak/branches/1.8/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserValidatorProvider.java Wed Nov 7 13:57:55 2018
@@ -16,8 +16,6 @@
*/
package org.apache.jackrabbit.oak.security.user;
-import javax.annotation.Nonnull;
-
import org.apache.jackrabbit.oak.plugins.tree.RootProvider;
import org.apache.jackrabbit.oak.plugins.tree.TreeProvider;
import org.apache.jackrabbit.oak.spi.commit.CommitInfo;
@@ -25,6 +23,7 @@ import org.apache.jackrabbit.oak.spi.com
import org.apache.jackrabbit.oak.spi.commit.ValidatorProvider;
import org.apache.jackrabbit.oak.spi.security.ConfigurationParameters;
import org.apache.jackrabbit.oak.spi.state.NodeState;
+import org.jetbrains.annotations.NotNull;
/**
* Provides a validator for user and group management.
@@ -37,7 +36,7 @@ class UserValidatorProvider extends Vali
private MembershipProvider membershipProvider;
- UserValidatorProvider(@Nonnull ConfigurationParameters config, @Nonnull RootProvider rootProvider, @Nonnull TreeProvider treeProvider) {
+ UserValidatorProvider(@NotNull ConfigurationParameters config, @NotNull RootProvider rootProvider, @NotNull TreeProvider treeProvider) {
this.config = config;
this.rootProvider = rootProvider;
this.treeProvider = treeProvider;
@@ -45,7 +44,7 @@ class UserValidatorProvider extends Vali
//--------------------------------------------------< ValidatorProvider >---
- @Override @Nonnull
+ @Override @NotNull
public Validator getRootValidator(
NodeState before, NodeState after, CommitInfo info) {
membershipProvider = new MembershipProvider(rootProvider.createReadOnlyRoot(after), config);
@@ -53,13 +52,13 @@ class UserValidatorProvider extends Vali
}
//-----------------------------------------------------------< internal >---
- @Nonnull
+ @NotNull
ConfigurationParameters getConfig() {
return config;
}
- @Nonnull
+ @NotNull
MembershipProvider getMembershipProvider() {
return membershipProvider;
}
-}
\ No newline at end of file
+}