Author: andreas
Date: Mon Dec 17 07:08:47 2007
New Revision: 604890
URL: http://svn.apache.org/viewvc?rev=604890&view=rev
Log:
Added javadoc comments and serial version UIDs
Modified:
lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/AccessControlException.java
lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/AccessController.java
lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/AccessControllerResolver.java
lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/Identity.java
lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/ManagedUser.java
Modified: lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/AccessControlException.java
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/AccessControlException.java?rev=604890&r1=604889&r2=604890&view=diff
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/AccessControlException.java (original)
+++ lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/AccessControlException.java Mon Dec 17 07:08:47 2007
@@ -23,6 +23,9 @@
* @version $Id: AccessControlException.java 473841 2006-11-12 00:46:38Z gregor $
*/
public class AccessControlException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
/**
* Create an AccessControlException
*
Modified: lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/AccessController.java
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/AccessController.java?rev=604890&r1=604889&r2=604890&view=diff
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/AccessController.java (original)
+++ lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/AccessController.java Mon Dec 17 07:08:47 2007
@@ -27,9 +27,19 @@
*/
public interface AccessController extends Component {
+ /**
+ * The namespace for access control releated XML documents.
+ */
String NAMESPACE = "http://apache.org/cocoon/lenya/ac/1.0";
+
+ /**
+ * The default namespace prefix for access control releated XML documents.
+ */
String DEFAULT_PREFIX = "ac";
+ /**
+ * The service role.
+ */
String ROLE = AccessController.class.getName();
/**
Modified: lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/AccessControllerResolver.java
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/AccessControllerResolver.java?rev=604890&r1=604889&r2=604890&view=diff
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/AccessControllerResolver.java (original)
+++ lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/AccessControllerResolver.java Mon Dec 17 07:08:47 2007
@@ -28,7 +28,15 @@
*/
public interface AccessControllerResolver extends Component {
+ /**
+ * The service role.
+ */
String ROLE = AccessControllerResolver.class.getName();
+
+ /**
+ * The type of the default resolver.
+ * @see org.apache.avalon.framework.service.ServiceSelector
+ */
String DEFAULT_RESOLVER = "publication";
/**
Modified: lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/Identity.java
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/Identity.java?rev=604890&r1=604889&r2=604890&view=diff
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/Identity.java (original)
+++ lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/Identity.java Mon Dec 17 07:08:47 2007
@@ -25,14 +25,17 @@
import java.util.Set;
import org.apache.cocoon.environment.Session;
+import org.apache.lenya.util.Assert;
import org.apache.log4j.Logger;
/**
- * Identity object. Used to store the authenticated accreditables in the session.
+ * Identity object. Used to store the authenticated {@link Identifiable}s in the session.
*/
public class Identity implements Identifiable, java.io.Serializable {
+
+ private static final long serialVersionUID = 1L;
+
private Set identifiables = new HashSet();
-
private static final Logger log = Logger.getLogger(Identity.class);
/**
@@ -43,54 +46,57 @@
}
/**
- * In the case of Tomcat the object will be serialized to TOMCAT/work/Standalone/localhost/lenya/SESSIONS.ser
+ * In the case of Tomcat the object will be serialized to
+ * $TOMCAT_HOME/work/Standalone/localhost/lenya/SESSIONS.ser
*/
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
if (log.isDebugEnabled()) {
- log.debug("Serializing identity which is attached to session: " + this.toString());
+ log.debug("Serializing identity which is attached to session: " + this.toString());
}
out.defaultWriteObject();
out.writeObject(identifiables);
}
/**
- * In case of Tomcat the object will be restored from TOMCAT/work/Standalone/localhost/lenya/SESSIONS.ser
+ * In case of Tomcat the object will be restored from
+ * $TOMCAT_HOME/work/Standalone/localhost/lenya/SESSIONS.ser
*/
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException,
+ ClassNotFoundException {
in.defaultReadObject();
identifiables = (Set) in.readObject();
if (log.isDebugEnabled()) {
- log.debug("Identity loaded from serialized object: " + this.toString());
+ log.debug("Identity loaded from serialized object: " + this.toString());
}
}
/**
- * Returns the identifiables of this identity.
- * @return An array of identifiables.
+ * Returns the {@link Identifiable}s which are contained in this identity.
+ * @return An array of {@link Identifiable}s.
*/
public Identifiable[] getIdentifiables() {
return (Identifiable[]) identifiables.toArray(new Identifiable[identifiables.size()]);
}
/**
- * Adds a new identifiable to this identity.
- * @param identifiable The identifiable to add.
+ * Adds a new {@link Identifiable} to this identity.
+ * @param identifiable The {@link Identifiable} to add.
*/
public void addIdentifiable(Identifiable identifiable) {
- assert identifiable != null;
- assert identifiable != this;
- assert !identifiables.contains(identifiable);
-
+ Assert.notNull("identifiable", identifiable);
+ Assert.isTrue("identifiable not same as identity", identifiable != this);
+ Assert.isTrue("identifiable not contained", !identifiables.contains(identifiable));
+
if (log.isDebugEnabled()) {
log.debug("Adding identifiable: [" + identifiable + "]");
}
-
+
identifiables.add(identifiable);
}
/**
- * @return all accreditables which belong to this identity.
+ * @return all {@link Accreditable}s which belong to this identity.
*/
public Accreditable[] getAccreditables(AccreditableManager manager) {
Set accreditables = new HashSet();
@@ -116,10 +122,11 @@
buf.append("]");
return buf.toString();
}
-
+
/**
- * Returns the user of this identity.
- * @return A user.
+ * Returns the user reference of this identity or <code>null</code> if no user reference is
+ * contained.
+ * @return A user reference.
*/
public UserReference getUserReference() {
UserReference user = null;
@@ -132,10 +139,10 @@
i++;
}
return user;
- }
+ }
/**
- * Returns the machine of this identity.
+ * Returns the machine of this identity or <code>null</code> if no machine is contained.
* @return A machine.
*/
public Machine getMachine() {
@@ -149,34 +156,34 @@
i++;
}
return machine;
- }
-
- /**
- * Checks if this identity contains a certain identifiable.
- * @param identifiable The identifiable to look for.
- * @return A boolean value.
- */
- public boolean contains(Identifiable identifiable) {
- return identifiables.contains(identifiable);
- }
-
- /**
- * Fetches the identity from a session.
- * @param session The session.
- * @return An identity.
- */
- public static Identity getIdentity(Session session) {
- Identity identity = (Identity) session.getAttribute(Identity.class.getName());
- return identity;
- }
-
- /**
- * Removes a certain identifiable from the idenity.
- * @param identifiable An identifiable.
- */
- public void removeIdentifiable(Identifiable identifiable) {
- assert identifiables.contains(identifiable);
- identifiables.remove(identifiable);
- }
+ }
+
+ /**
+ * Checks if this identity contains a certain identifiable.
+ * @param identifiable The identifiable to look for.
+ * @return A boolean value.
+ */
+ public boolean contains(Identifiable identifiable) {
+ return identifiables.contains(identifiable);
+ }
+
+ /**
+ * Fetches the identity from a session.
+ * @param session The session.
+ * @return An identity or <code>null</code> if no identity is attached to the session.
+ */
+ public static Identity getIdentity(Session session) {
+ return (Identity) session.getAttribute(Identity.class.getName());
+ }
+
+ /**
+ * Removes a certain identifiable from the identity.
+ * @param identifiable An identifiable.
+ */
+ public void removeIdentifiable(Identifiable identifiable) {
+ Assert.isTrue("identifiable '" + identifiable + "' contained", identifiables
+ .contains(identifiable));
+ identifiables.remove(identifiable);
+ }
}
Modified: lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/ManagedUser.java
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/ManagedUser.java?rev=604890&r1=604889&r2=604890&view=diff
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/ManagedUser.java (original)
+++ lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/ManagedUser.java Mon Dec 17 07:08:47 2007
@@ -1,20 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
package org.apache.lenya.ac;
+/**
+ * A user which is managed by the Lenya CMS itself, i.e. it belongs to a {@link UserManager}.
+ */
public interface ManagedUser extends User, Accreditable {
/**
- * Delete a user
- *
+ * Delete this user.
* @throws AccessControlException if the delete failed
*/
void delete() throws AccessControlException;
/**
- * Authenticate a user. This is done by encrypting the given password and
- * comparing this to the encryptedPassword.
- *
- * @param password to authenticate with
- * @return true if the given password matches the password for this user
+ * Authenticate this user. This is done by encrypting the given password and comparing this to
+ * the encrypted password.
+ * @param password The plain text password.
+ * @return true if the given password matches the password of this user.
*/
boolean authenticate(String password);
@@ -25,9 +43,8 @@
void setPassword(String plainTextPassword);
/**
- * Save the user
- *
- * @throws AccessControlException if the save failed
+ * Saves this user.
+ * @throws AccessControlException if the user could not be saved.
*/
void save() throws AccessControlException;
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.