You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by an...@apache.org on 2009/03/10 12:01:55 UTC
svn commit: r752060 - in
/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user:
AuthorizableImpl.java GroupImpl.java NodeResolver.java
TraversingNodeResolver.java UserAccessControlProvider.java
Author: angela
Date: Tue Mar 10 11:01:54 2009
New Revision: 752060
URL: http://svn.apache.org/viewvc?rev=752060&view=rev
Log:
javadoc
Modified:
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/AuthorizableImpl.java
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/GroupImpl.java
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/NodeResolver.java
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/TraversingNodeResolver.java
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserAccessControlProvider.java
Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/AuthorizableImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/AuthorizableImpl.java?rev=752060&r1=752059&r2=752060&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/AuthorizableImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/AuthorizableImpl.java Tue Mar 10 11:01:54 2009
@@ -61,7 +61,9 @@
/**
* @param node the Authorizable is persisted to.
* @param userManager UserManager that created this Authorizable.
- * @throws RepositoryException
+ * @throws IllegalArgumentException if the given node isn't of node type
+ * {@link #NT_REP_AUTHORIZABLE}.
+ * @throws RepositoryException If an error occurs.
*/
protected AuthorizableImpl(NodeImpl node, UserManagerImpl userManager)
throws RepositoryException {
@@ -203,8 +205,11 @@
* Sets the Value for the given name. If a value existed, it is replaced,
* if not it is created.
*
- * @param name
- * @param value
+ * @param name The property name.
+ * @param value The property value.
+ * @throws RepositoryException If the specified name defines a property
+ * that needs to be modified by this user API or setting the corresponding
+ * JCR property fails.
* @see Authorizable#setProperty(String, Value)
*/
public synchronized void setProperty(String name, Value value) throws RepositoryException {
@@ -223,8 +228,11 @@
* Sets the Value[] for the given name. If a value existed, it is replaced,
* if not it is created.
*
- * @param name
- * @param values
+ * @param name The property name.
+ * @param values The property values.
+ * @throws RepositoryException If the specified name defines a property
+ * that needs to be modified by this user API or setting the corresponding
+ * JCR property fails.
* @see Authorizable#setProperty(String, Value[])
*/
public synchronized void setProperty(String name, Value[] values) throws RepositoryException {
@@ -280,7 +288,7 @@
/**
* @return node The underlying <code>Node</code> object.
*/
- NodeImpl getNode() throws RepositoryException {
+ NodeImpl getNode() {
return node;
}
@@ -368,11 +376,11 @@
* Returns true if the given property of the authorizable node is one of the
* non-protected properties defined by the rep:authorizable.
*
- * @param prop
+ * @param prop Property to be tested.
* @return <code>true</code> if the given property is defined
* by the rep:authorizable node type or one of it's sub-node types;
* <code>false</code> otherwise.
- * @throws RepositoryException
+ * @throws RepositoryException If the property definition cannot be retrieved.
*/
private static boolean isAuthorizableProperty(Property prop) throws RepositoryException {
PropertyDefinition def = prop.getDefinition();
@@ -401,29 +409,28 @@
* method is a simple utility in order to save the extra effort to modify
* the props just to find out later that they are in fact protected.
*
- * @param propertyName
- * @return
- * @throws RepositoryException
+ * @param propertyName Name of the property.
+ * @return true if the property with the given name represents a protected
+ * user/group property that needs to be changed through the API.
+ * @throws RepositoryException If the specified name is not valid.
*/
private boolean isProtectedProperty(String propertyName) throws RepositoryException {
Name pName = getSession().getQName(propertyName);
- if (P_PRINCIPAL_NAME.equals(pName) || P_USERID.equals(pName)
+ return P_PRINCIPAL_NAME.equals(pName) || P_USERID.equals(pName)
|| P_REFEREES.equals(pName) || P_GROUPS.equals(pName)
- || P_IMPERSONATORS.equals(pName) || P_PASSWORD.equals(pName)) {
- return true;
- } else {
- return false;
- }
+ || P_IMPERSONATORS.equals(pName) || P_PASSWORD.equals(pName);
}
/**
* Throws ConstraintViolationException if {@link #isProtectedProperty(String)}
* returns <code>true</code>.
*
- * @param propertyName
- * @throws RepositoryException
+ * @param propertyName Name of the property.
+ * @throws ConstraintViolationException If the property is protected according
+ * to {@link #isProtectedProperty(String)}.
+ * @throws RepositoryException If another error occurs.
*/
- private void checkProtectedProperty(String propertyName) throws RepositoryException {
+ private void checkProtectedProperty(String propertyName) throws ConstraintViolationException, RepositoryException {
if (isProtectedProperty(propertyName)) {
throw new ConstraintViolationException("Attempt to modify protected property " + propertyName + " of an Authorizable.");
}
@@ -462,7 +469,7 @@
* Method revealing the path to the Node that represents the
* Authorizable this principal is created for.
*
- * @return
+ * @return The path of the underlying node.
* @see ItemBasedPrincipal#getPath()
*/
public String getPath() throws RepositoryException {
Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/GroupImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/GroupImpl.java?rev=752060&r1=752059&r2=752060&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/GroupImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/GroupImpl.java Tue Mar 10 11:01:54 2009
@@ -162,8 +162,10 @@
//--------------------------------------------------------------------------
/**
*
- * @return
- * @throws RepositoryException
+ * @param includeIndirect If <code>true</code> all members of this group
+ * will be return; otherwise only the declared members.
+ * @return A collection of members of this group.
+ * @throws RepositoryException If an error occurs while collecting the members.
*/
private Collection getMembers(boolean includeIndirect) throws RepositoryException {
// TODO: replace by weak-refs
@@ -191,9 +193,10 @@
* membership this method simply checks if the potential new member is
* a group that would in turn have <code>this</code> as a member.
*
- * @param newMember
+ * @param newMember The new member to be tested for cyclic membership.
* @return true if the 'newMember' is a group and 'this' is an declared or
* inherited member of it.
+ * @throws javax.jcr.RepositoryException If an error occurs.
*/
private boolean isCyclicMembership(Authorizable newMember) throws RepositoryException {
boolean cyclic = false;
@@ -323,8 +326,8 @@
* implement the writeObject method to assert initalization of all members
* before serialization.
*
- * @param stream
- * @throws IOException
+ * @param stream The object output stream.
+ * @throws IOException If an error occurs.
*/
private void writeObject(ObjectOutputStream stream) throws IOException {
getMembers();
Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/NodeResolver.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/NodeResolver.java?rev=752060&r1=752059&r2=752060&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/NodeResolver.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/NodeResolver.java Tue Mar 10 11:01:54 2009
@@ -43,10 +43,11 @@
/**
* Create a new <code>NodeResolver</code>.
*
- * @param session;
- * @throws RepositoryException if instanciation fails
+ * @param session to use for repository access
+ * @param resolver The NamePathResolver used to convert {@link org.apache.jackrabbit.spi.Name}
+ * and {@link org.apache.jackrabbit.spi.Path} to JCR names/path.
*/
- NodeResolver(Session session, NamePathResolver resolver) throws RepositoryException {
+ NodeResolver(Session session, NamePathResolver resolver) {
this.session = session;
this.resolver = resolver;
}
@@ -55,10 +56,10 @@
* Get the first node that matches <code>ntName</code> and whose name
* exactly matches the given <code>nodeName</code>.
*
- * @param nodeName
- * @param ntName
+ * @param nodeName Name of the node to find.
+ * @param ntName Node type name of the node to find.
* @return A matching node or <code>null</code>.
- * @throws RepositoryException
+ * @throws RepositoryException If an error occurs.
*/
public abstract Node findNode(Name nodeName, Name ntName) throws RepositoryException;
@@ -67,12 +68,13 @@
* property whose value exactly matches the given value. Same as
* {@link #findNodes(Set,String,Name,boolean,long)} but returning a single node or <code>null</code>.
*
- * @param propertyName
- * @param value
- * @param ntName
- * @return The first node that has a property with the given propertyName that
- * exactly matches the given value or <code>null</code>.
- * @throws RepositoryException
+ * @param propertyName Name of the property to find.
+ * @param value Value of the property to find.
+ * @param ntName Name of the parent node's node type.
+ * @return The first node that matches the specified node type name and has
+ * a property with the given propertyName that exactly matches the given
+ * value or <code>null</code>.
+ * @throws RepositoryException If an error occurs.
*/
public abstract Node findNode(Name propertyName, String value, Name ntName) throws RepositoryException;
@@ -82,11 +84,12 @@
* Same as {@link #findNodes(Set,String,Name,boolean,long)}; where
* the maxSize parameters is set to {@link Long#MAX_VALUE)}.
*
- * @param propertyName property to be searched
- * @param value value to be matched
- * @param ntName
- * @param exact if <code>true</code> value has to match exactly
+ * @param propertyName Name of the property to be searched.
+ * @param value Value to be matched.
+ * @param ntName Name of the parent node's node type.
+ * @param exact If <code>true</code> value has to match exactly.
* @return matching nodes (or an empty iterator if no match was found).
+ * @throws RepositoryException If an error occurs.
*/
public NodeIterator findNodes(Name propertyName, String value, Name ntName, boolean exact)
throws RepositoryException {
@@ -98,29 +101,38 @@
* The queried value has to be a string fragment of one of the Properties
* contained in the given set. And the node have to be of a requested nodetype
*
- * @param propertyNames
- * @param value
+ * @param propertyNames Names of the property to be searched.
+ * @param value The value to find.
* @param ntName NodeType the hits have to have
* @param exact if <code>true</code> match must be exact
* @param maxSize maximal number of results to search for.
- * @return
- * @throws RepositoryException
+ * @return matching nodes (or an empty iterator if no match was found).
+ * @throws RepositoryException If an error occurs.
*/
- public abstract NodeIterator findNodes(Set propertyNames, String value, Name ntName,
- boolean exact, long maxSize)
+ public abstract NodeIterator findNodes(Set propertyNames, String value,
+ Name ntName, boolean exact, long maxSize)
throws RepositoryException;
/**
- * @return Session this instance has been constructed with
+ * @return Session this instance has been constructed with.
*/
Session getSession() {
return session;
}
+ /**
+ * @return The <code>NamePathResolver</code>.
+ */
NamePathResolver getNamePathResolver() {
return resolver;
}
+ /**
+ * @param ntName Any of the following node type names:
+ * {@link UserConstants#NT_REP_USER}, {@link UserConstants#NT_REP_GROUP} or
+ * {@link UserConstants#NT_REP_AUTHORIZABLE}.
+ * @return The path of search root for the specified node type name.
+ */
String getSearchRoot(Name ntName) {
String searchRoot;
if (UserConstants.NT_REP_USER.equals(ntName)) {
Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/TraversingNodeResolver.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/TraversingNodeResolver.java?rev=752060&r1=752059&r2=752060&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/TraversingNodeResolver.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/TraversingNodeResolver.java Tue Mar 10 11:01:54 2009
@@ -50,9 +50,11 @@
* Additonally to the NodeType-Argument the resolvers searched is narrowed
* by indicating a Path to an {@link javax.jcr.Item} as start for the search
*
- * @param session to use for repository access
+ * @param session to use for repository access
+ * @param resolver The NamePathResolver used to convert {@link org.apache.jackrabbit.spi.Name}
+ * and {@link org.apache.jackrabbit.spi.Path} to JCR names/path.
*/
- TraversingNodeResolver(Session session, NamePathResolver resolver) throws RepositoryException {
+ TraversingNodeResolver(Session session, NamePathResolver resolver) {
super(session, resolver);
}
Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserAccessControlProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserAccessControlProvider.java?rev=752060&r1=752059&r2=752060&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserAccessControlProvider.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserAccessControlProvider.java Tue Mar 10 11:01:54 2009
@@ -494,7 +494,7 @@
* Event listener is only interested in changes of group-membership
* that effect the permission-evaluation.
*
- * @param events
+ * @see javax.jcr.observation.EventListener#onEvent(EventIterator)
*/
public void onEvent(EventIterator events) {
while (events.hasNext()) {