You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by eg...@apache.org on 2003/06/25 10:56:33 UTC

cvs commit: cocoon-lenya/src/java/org/apache/lenya/cms/ac FileRole.java LDAPUser.java User.java Role.java ItemManager.java FileUser.java FileGroup.java

egli        2003/06/25 01:56:32

  Modified:    src/java/org/apache/lenya/cms/ac FileRole.java LDAPUser.java
                        User.java Role.java ItemManager.java FileUser.java
                        FileGroup.java
  Log:
  Added complete javadoc to all methods to make checkstule happy.
  
  Revision  Changes    Path
  1.4       +18 -8     cocoon-lenya/src/java/org/apache/lenya/cms/ac/FileRole.java
  
  Index: FileRole.java
  ===================================================================
  RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/cms/ac/FileRole.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- FileRole.java	3 Jun 2003 13:45:48 -0000	1.3
  +++ FileRole.java	25 Jun 2003 08:56:32 -0000	1.4
  @@ -69,8 +69,12 @@
   	public static final String CLASS_ATTRIBUTE = "class";
   
   	private Publication publication;
  +	
   	/**
  -	 * @param name
  +	 * Create a new instance of <code>FileRole</code>
  +	 * 
  +	 * @param publication to which the role is to be attached
  +	 * @param name name of the role
   	 */
   	public FileRole(Publication publication, String name) {
   		super(name);
  @@ -78,8 +82,11 @@
   	}
   
   	/**
  -	 * @param config
  -	 * @throws ConfigurationException
  +	 * Create a new instance of <code>FileRole</code>
  +	 * 
  +	 * @param publication to which the role is to be attached
  +	 * @param config containing the role details
  +	 * @throws ConfigurationException if the <code>FileRole</code> could not be instantiated
   	 */
   	public FileRole(Publication publication, Configuration config) throws ConfigurationException {
   		super(config.getAttribute(NAME_ATTRIBUTE));
  @@ -87,8 +94,9 @@
   	}
   	
   	/**
  -	 * @param publication
  -	 * @throws AccessControlException
  +	 * Save the role
  +	 * 
  +	 * @throws AccessControlException if the save fails
   	 */
   	public void save() throws AccessControlException {
   		DefaultConfigurationSerializer serializer =
  @@ -104,12 +112,14 @@
   	}
   
   	/**
  -	 * @return
  +	 * Create a configuration containing the role details
  +	 * 
  +	 * @return a <code>Configuration</code>
   	 */
   	private Configuration createConfiguration() {
   		
   		DefaultConfiguration config = new DefaultConfiguration(GROUP);
  -		config.setAttribute(NAME_ATTRIBUTE, name);
  +		config.setAttribute(NAME_ATTRIBUTE, getName());
   		config.setAttribute(CLASS_ATTRIBUTE, this.getClass().getName());
   		return config;
   	}
  
  
  
  1.6       +2 -2      cocoon-lenya/src/java/org/apache/lenya/cms/ac/LDAPUser.java
  
  Index: LDAPUser.java
  ===================================================================
  RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/cms/ac/LDAPUser.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- LDAPUser.java	24 Jun 2003 17:44:26 -0000	1.5
  +++ LDAPUser.java	25 Jun 2003 08:56:32 -0000	1.6
  @@ -246,7 +246,7 @@
        * @param plainTextPassword is ignored
        */
       public void setPassword(String plainTextPassword) {
  -        encryptedPassword = null;
  +    	setEncryptedPassword(null);
       }
   
       /** 
  
  
  
  1.15      +65 -34    cocoon-lenya/src/java/org/apache/lenya/cms/ac/User.java
  
  Index: User.java
  ===================================================================
  RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/cms/ac/User.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- User.java	12 Jun 2003 15:46:06 -0000	1.14
  +++ User.java	25 Jun 2003 08:56:32 -0000	1.15
  @@ -62,18 +62,19 @@
   public abstract class User {
   	private Category log = Category.getInstance(User.class);
   	
  -	protected String id;
  -	protected String fullName;
  -	protected String email;
  -	protected String encryptedPassword;
  -	protected Set groups = new HashSet();
  -
  -	/**
  -	 * Create a User instance
  -	* @param id
  -	* @param fullName
  -	* @param email
  -	* @param password
  +	private String id;
  +	private String fullName;
  +	private String email;
  +	private String encryptedPassword;
  +	private Set groups = new HashSet();
  +
  +   /**
  +	* Create a User instance
  +	* 
  +	* @param id the user id
  +	* @param fullName the full name of the user
  +	* @param email the users email address
  +	* @param password the users password
   	*/
   	public User(String id, String fullName, String email, String password) {
   		this.id = id;
  @@ -83,49 +84,61 @@
   	}
   
   	/**
  -	 * @return
  +	 * Get the email address
  +	 * 
  +	 * @return a <code>String</code>
   	 */
   	public String getEmail() {
   		return email;
   	}
   
   	/**
  -	 * @return
  +	 * Get the full name
  +	 * 
  +	 * @return a <code>String</code>
   	 */
   	public String getFullName() {
   		return fullName;
   	}
   
   	/**
  -	 * @return
  +	 * Get all groups
  +	 * 
  +	 * @return an <code>Iterator</code>
   	 */
   	public Iterator getGroups() {
   		return groups.iterator();
   	}
   
   	/**
  -	 * @return
  +	 * Get the user id
  +	 * 
  +	 * @return the user id
   	 */
   	public String getId() {
   		return id;
   	}
   
   	/**
  -	 * @param string
  +	 * Set the email address
  +	 * 
  +	 * @param email the new email address
   	 */
  -	public void setEmail(String string) {
  -		email = string;
  +	public void setEmail(String email) {
  +		this.email = email;
   	}
   
   	/**
  -	 * @param string
  +	 * Set the full name
  +	 * 
  +	 * @param name the new full name
   	 */
  -	public void setFullName(String string) {
  -		fullName = string;
  +	public void setFullName(String name) {
  +		fullName = name;
   	}
   
   	/**
  -	 * 
  +	 * Remove all groups
   	 */
   	public void removeAllGroups() {
   		for (Iterator iter = groups.iterator(); iter.hasNext();) {
  @@ -136,7 +149,9 @@
   	}
   
   	/**
  -	 * @param set
  +	 * Add the specified group to this user
  +	 * 
  +	 * @param group which is to be added
   	 */
   	public void addGroup(Group group) {
   		assert group != null;
  @@ -145,7 +160,9 @@
   	}
   
   	/**
  -	 * @param set
  +	 * Remove the specified group from this user
  +	 * 
  +	 * @param group which is to be removed
   	 */
   	public void removeGroup(Group group) {
   		groups.remove(group);
  @@ -153,7 +170,9 @@
   	}
   
   	/**
  -	 * @param plainTextPassword
  +	 * Set the password
  +	 * 
  +	 * @param plainTextPassword the password in plain text
   	 */
   	public void setPassword(String plainTextPassword) {
   		encryptedPassword = Password.encrypt(plainTextPassword);
  @@ -164,26 +183,38 @@
   	 * being encrypted again. Some subclass might have knowledge of the encrypted
   	 * password and needs to be able to set it.
   	 * 
  -	 * @param encryptedPassword
  +	 * @param encryptedPassword the encrypted password
   	 */
   	protected void setEncryptedPassword(String encryptedPassword) {
   		this.encryptedPassword = encryptedPassword;
   	}
   	
   	/**
  -	 * @param publication
  -	 * @throws AccessControlException
  +	 * Get the encrypted password
  +	 * 
  +	 * @return the encrypted password
  +	 */
  +	protected String getEncryptedPassword() {
  +		return encryptedPassword;
  +	}
  +	
  +	/**
  +	 * Save the user
  +	 * 
  +	 * @throws AccessControlException if the save failed
   	 */
   	public abstract void save() throws AccessControlException;
   
   	/**
  +	 * Delete a user
   	 * 
  +	 * @throws AccessControlException if the delete failed
   	 */
   	public void delete() throws AccessControlException {
   		removeAllGroups();
   	}
   
  -	/* (non-Javadoc)
  +	/** (non-Javadoc)
   	 * @see java.lang.Object#equals(java.lang.Object)
   	 */
   	public boolean equals(Object obj) {
  @@ -193,7 +224,7 @@
   		return false;
   	}
   
  -	/* (non-Javadoc)
  +	/** (non-Javadoc)
   	 * @see java.lang.Object#hashCode()
   	 */
   	public int hashCode() {
  @@ -205,8 +236,8 @@
   	 * the given password and comparing this to the 
   	 * encryptedPassword.
   	 * 
  -	 * @param password
  -	 * @return true if the given passwprd matches the password for this user
  +	 * @param password to authenticate with
  +	 * @return true if the given password matches the password for this user
   	 */
   	public boolean authenticate(String password) {
   		log.debug("Password: " + password);
  
  
  
  1.8       +36 -3     cocoon-lenya/src/java/org/apache/lenya/cms/ac/Role.java
  
  Index: Role.java
  ===================================================================
  RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/cms/ac/Role.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Role.java	2 Jun 2003 09:24:34 -0000	1.7
  +++ Role.java	25 Jun 2003 08:56:32 -0000	1.8
  @@ -15,34 +15,61 @@
    * @author  nobby
    */
   public class Role {
  -    
  -    /** Creates a new instance of Role */
  +
  +	/**
  +	 * Create a new instance of <code>Role</code>
  +	 * 
  +	 * @param name the name of the role
  +	 */    
       public Role(String name) {
           assert name != null;
           this.name = name;
       }
       
  -    protected String name;
  +    private String name;
       
   	private Set groups = new HashSet();
   
  +	/**
  +	 * Get the name
  +	 * 
  +	 * @return a <code>String</code>
  +	 */
       public String getName() {
           return name;
       }
       
  +    /**
  +     * Add a group
  +     * 
  +     * @param group the group to add
  +     */
       public void addGroup(Group group) {
           assert group != null;
       	groups.add(group);
       }
       
  +    /**
  +     * Remove a specific group
  +     * 
  +     * @param group the group to remove
  +     */
       public void removeGroup(Group group) {
       	groups.remove(group);
       }
       
  +    /**
  +     * Get all groups
  +     * 
  +     * @return an <code>Iterator</code>
  +     */
       public Iterator getGroups() {
       	return groups.iterator();
       }
       
  +    /** (non-Javadoc)
  +     * @see java.lang.Object#equals(java.lang.Object)
  +     */
       public boolean equals(Object otherObject) {
           boolean equals = false;
           
  @@ -54,10 +81,16 @@
           return equals;
       }
       
  +    /** (non-Javadoc)
  +     * @see java.lang.Object#hashCode()
  +     */
       public int hashCode() {
           return getName().hashCode();
       }
       
  +    /** (non-Javadoc)
  +     * @see java.lang.Object#toString()
  +     */
       public String toString() {
           return getName();
       }
  
  
  
  1.6       +15 -3     cocoon-lenya/src/java/org/apache/lenya/cms/ac/ItemManager.java
  
  Index: ItemManager.java
  ===================================================================
  RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/cms/ac/ItemManager.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ItemManager.java	24 Jun 2003 17:44:26 -0000	1.5
  +++ ItemManager.java	25 Jun 2003 08:56:32 -0000	1.6
  @@ -165,15 +165,27 @@
   		items.remove(item);
   	}
   	
  +	/**
  +	 * Get the path where the items are located.
  +	 * 
  +	 * @return a <code>File</code>
  +	 */
   	public File getPath() {
   		return new File(publication.getDirectory(), PATH);
   	}
   	
  -
  +	/**
  +	 * Get a file filter which filters for files containing items.
  +	 *  
  +	 * @return a <code>FileFilter</code>
  +	 */
   	protected abstract FileFilter getFileFilter();
   	
   	/**
  -	 * @return
  +	 * Items are attached to a publication. Get the publication
  +	 * to which the items are attached to.
  +	 * 
  +	 * @return a <code>Publication</code>
   	 */
   	public Publication getPublication() {
   		return publication;
  
  
  
  1.17      +31 -16    cocoon-lenya/src/java/org/apache/lenya/cms/ac/FileUser.java
  
  Index: FileUser.java
  ===================================================================
  RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/cms/ac/FileUser.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- FileUser.java	19 Jun 2003 13:55:38 -0000	1.16
  +++ FileUser.java	25 Jun 2003 08:56:32 -0000	1.17
  @@ -80,11 +80,13 @@
   	private Publication publication;
   
   	/**
  -	 * @param publication
  -	 * @param id
  -	 * @param fullName
  -	 * @param email
  -	 * @param password
  +	 * Create a FileUser
  +	 * 
  +	 * @param publication where the user will be attached to
  +	 * @param id the user id
  +	 * @param fullName the full name of the user
  +	 * @param email the users email address
  +	 * @param password the users password
   	 */
   	public FileUser(
   		Publication publication,
  @@ -96,6 +98,13 @@
   		this.publication = publication;
   	}
   
  +	/**
  +	 * Create a FileUser.
  +	 * 
  +	 * @param publication where the user will be attached to
  +	 * @param config where the user details are specified 
  +	 * @throws ConfigurationException if the necessary details aren't specified in the config
  +	 */
   	public FileUser(Publication publication, Configuration config)
   		throws ConfigurationException {
   		super(
  @@ -137,26 +146,30 @@
   		}
   	}
   
  +
   	/**
  -	 * @return
  -	 */
  -	protected Configuration createConfiguration() {
  +	 * Create a configuration from the current user details. Can
  +	 * be used for saving.
  +	 * 
  +     * @return a <code>Configuration</code>
  +     */
  +    protected Configuration createConfiguration() {
   
   		DefaultConfiguration config = new DefaultConfiguration(ID);
  -		config.setAttribute(ID_ATTRIBUTE, id);
  +		config.setAttribute(ID_ATTRIBUTE, getId());
   		config.setAttribute(CLASS_ATTRIBUTE, this.getClass().getName());
   		DefaultConfiguration child = null;
   		// add fullname node
   		child = new DefaultConfiguration(FULL_NAME);
  -		child.setValue(fullName);
  +		child.setValue(getFullName());
   		config.addChild(child);
   		// add email node
   		child = new DefaultConfiguration(EMAIL);
  -		child.setValue(email);
  +		child.setValue(getEmail());
   		config.addChild(child);
   		// add password node
   		child = new DefaultConfiguration(PASSWORD);
  -		child.setValue(encryptedPassword);
  +		child.setValue(getEncryptedPassword());
   		child.setAttribute(PASSWORD_ATTRIBUTE, "md5");
   		config.addChild(child);
   		// add group nodes
  @@ -172,7 +185,7 @@
   		return config;
   	}
   
  -	/* (non-Javadoc)
  +	/** (non-Javadoc)
   	 * @see org.apache.lenya.cms.ac.User#save()
   	 */
   	public void save() throws AccessControlException {
  @@ -191,7 +204,7 @@
   		}
   	}
   
  -	/* (non-Javadoc)
  +	/** (non-Javadoc)
   	 * @see org.apache.lenya.cms.ac.User#delete()
   	 */
   	public void delete() throws AccessControlException {
  @@ -204,7 +217,9 @@
   	}
   
       /**
  -     * @return
  +     * Get the publication where this FileUser is attached to.
  +     * 
  +     * @return the <code>Publication</code>
        */
       protected Publication getPublication() {
           return publication;
  
  
  
  1.5       +20 -3     cocoon-lenya/src/java/org/apache/lenya/cms/ac/FileGroup.java
  
  Index: FileGroup.java
  ===================================================================
  RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/cms/ac/FileGroup.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- FileGroup.java	3 Jun 2003 16:30:16 -0000	1.4
  +++ FileGroup.java	25 Jun 2003 08:56:32 -0000	1.5
  @@ -76,13 +76,23 @@
   	private Publication publication;
   
   	/**
  -	 * @param name
  +	 * Create a new instance of <code>FileGroup</code>
  +	 * 
  +	 * @param publication to which the group will be attached to
  +	 * @param name the name of the group
   	 */
   	public FileGroup(Publication publication, String name) {
   		super(name);
   		this.publication = publication;
   	}
   
  +	/**
  +	 * Create a new instance of <code>FileGroup</code>
  +	 * 
  +	 * @param publication to which the group will be attached to
  +	 * @param config containing the group details
  +	 * @throws ConfigurationException if the instantiation fails
  +	 */
   	public FileGroup(Publication publication, Configuration config)
   		throws ConfigurationException {
   		super(config.getAttribute(NAME_ATTRIBUTE));
  @@ -114,6 +124,11 @@
   		}
   	}
   	
  +	/**
  +	 * Save this group
  +	 * 
  +	 * @throws AccessControlException if the save failed
  +	 */
   	public void save() throws AccessControlException {
   		DefaultConfigurationSerializer serializer =
   			new DefaultConfigurationSerializer();
  @@ -128,7 +143,9 @@
   	}
   
   	/**
  -	 * @return
  +	 * Create a configuration containing the group details
  +	 * 
  +	 * @return a <code>Configuration</code>
   	 */
   	private Configuration createConfiguration() {
   		
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-cvs-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-cvs-help@cocoon.apache.org