cvs commit: jakarta-tomcat-service/java/org/apache/service ServicePermission.java

2001-07-30 Thread pier

pier01/07/30 16:23:22

  Modified:java/org/apache/service ServicePermission.java
  Log:
  Wrong license.
  
  Revision  ChangesPath
  1.3   +5 -5  
jakarta-tomcat-service/java/org/apache/service/ServicePermission.java
  
  Index: ServicePermission.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-service/java/org/apache/service/ServicePermission.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ServicePermission.java2001/07/26 19:30:28 1.2
  +++ ServicePermission.java2001/07/30 23:23:22 1.3
  @@ -26,10 +26,10 @@
*Alternately, this acknowlegement may appear in the software itself, if *
*and wherever such third-party acknowlegements normally appear. *
*   *
  - * 4. The names  "The  Jakarta  Project",  "Tomcat",  and  "Apache  Software *
  - *Foundation"  must not be used  to endorse or promote  products derived *
  - *from this  software without  prior  written  permission.  For  written *
  - *permission, please contact <[EMAIL PROTECTED]>.*
  + * 4. The names  "The Jakarta  Project",  and  "Apache  Software Foundation" *
  + *must not  be used  to endorse  or promote  products derived  from this *
  + *software without  prior written  permission.  For written  permission, *
  + *please contact <[EMAIL PROTECTED]>.*
*   *
* 5. Products derived from this software may not be called "Apache" nor may *
*"Apache" appear in their names without prior written permission of the *
  @@ -124,7 +124,7 @@
* @author mailto:[EMAIL PROTECTED]";>Pier Fumagalli
* @author Copyright © 2000-2001 http://www.apache.org/";>The
* Apache Software Foundation. All rights reserved.
  - * @version 1.0 (CVS $Revision: 1.2 $)
  + * @version 1.0 (CVS $Revision: 1.3 $)
*/
   public final class ServicePermission extends Permission {
   
  
  
  



cvs commit: jakarta-tomcat-service/java/org/apache/service ServicePermission.java

2001-07-26 Thread pier

pier01/07/26 12:30:28

  Modified:java/org/apache/service ServicePermission.java
  Log:
  - Updated JavaDOC descriptions for those methods which didn't have one.
  - Modified how the toString() and hashCode() methods work, by storing a
copy of the description of this permission instance in a local private
variable.
  
  Revision  ChangesPath
  1.2   +64 -14
jakarta-tomcat-service/java/org/apache/service/ServicePermission.java
  
  Index: ServicePermission.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-service/java/org/apache/service/ServicePermission.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ServicePermission.java2001/07/26 18:09:44 1.1
  +++ ServicePermission.java2001/07/26 19:30:28 1.2
  @@ -124,7 +124,7 @@
* @author mailto:[EMAIL PROTECTED]";>Pier Fumagalli
* @author Copyright © 2000-2001 http://www.apache.org/";>The
* Apache Software Foundation. All rights reserved.
  - * @version 1.0 (CVS $Revision: 1.1 $)
  + * @version 1.0 (CVS $Revision: 1.2 $)
*/
   public final class ServicePermission extends Permission {
   
  @@ -195,7 +195,7 @@
* target name.
*/
   protected static final String WILDCARD = "*";
  -
  +
   /*  */
   /* Instance variables */
   
  @@ -203,6 +203,8 @@
   private transient int type = 0;
   /** The permission mask associated with this permission object. */
   private transient int mask = 0;
  +/** The String representation of this permission object. */
  +private transient String desc = null;
   
   /*  */
   /* Constructors */
  @@ -220,16 +222,20 @@
*/
   public ServicePermission (String target)
   throws IllegalArgumentException {
  +// Setup the target name of this permission object.
   super(target);
   
  +// Check if the permission target name was specified
   if (target==null)
   throw new IllegalArgumentException("Null permission name");
   
  +// Check if this is a "control" permission and set up accordingly.
   if (CONTROL.equalsIgnoreCase(target)) {
   type=TYPE_CONTROL;
   return;
   }
  -
  +
  +// If we got here, we have an invalid permission name.
   throw new IllegalArgumentException("Invalid permission name \""+
  target+"\" specified");
   }
  @@ -239,7 +245,7 @@
* permission name and a specified list of actions.
* 
* 
  - * 
  + *
* @param target The target name of this permission.
* @param actions The list of actions permitted by this permission.
* @exception IllegalArgumentException If the specified target name is not
  @@ -248,50 +254,96 @@
*/
   public ServicePermission(String target, String actions)
   throws IllegalArgumentException {
  +// Setup this instance's target name.
   this(target);
   
  +// Create the appropriate mask if this is a control permission.
   if (this.type==TYPE_CONTROL) {
   this.mask=this.createControlMask(actions);
  +return();
   }
   }
   
   /*  */
   /* Public methods */
   
  +/**
  + * Return the list of actions permitted by this instance of
  + * ServicePermission in its canonical form.
  + *
  + * @return The canonicalized list of actions.
  + */
   public String getActions() {
  -if (this.type==TYPE_CONTROL)
  +if (this.type==TYPE_CONTROL) {
   return(this.createControlActions(this.mask));
  -
  +}
   return("");
   }
   
  +/**
  + * Return the hash code for this ServicePermission instance.
  + *
  + * @return An hash code value.
  + */
   public int hashCode() {
  -return(this.toString().hashCode());
  +this.setupDescription();
  +return(this.dest.hashCode());
   }
   
  +/**
  + * Check if a specified object equals ServicePermission.
  + *
  + * @return true or false wether the specified object equals
  + * this ServicePermission instance or not.
  + */
   public boolean equals(Object object) {
   if (object == this) return(true);
   
   if (!(object instanceof ServicePermission)) return false;
   
   ServicePermission that = (ServicePermission)object;
  -
  +
   if (this.type!=that.type) return(false);
   return(this.mask==that.mask);
   }
   
  +/**
  + * Check if this ServicePermission implies another
  + * Permission.
  + *
  + 

cvs commit: jakarta-tomcat-service/java/org/apache/service ServicePermission.java

2001-07-26 Thread pier

pier01/07/26 11:09:44

  Added:   java/org/apache/service ServicePermission.java
  Log:
  Added a permission class to control access to the Service.
  
  Revision  ChangesPath
  1.1  
jakarta-tomcat-service/java/org/apache/service/ServicePermission.java
  
  Index: ServicePermission.java
  ===
  /* = *
   *   *
   * The Apache Software License,  Version 1.1 *
   *   *
   * Copyright (c) 2001 The Apache Software Foundation.*
   *   All rights reserved.*
   *   *
   * = *
   *   *
   * Redistribution and use in source and binary forms,  with or without modi- *
   * fication, are permitted provided that the following conditions are met:   *
   *   *
   * 1. Redistributions of source code  must retain the above copyright notice *
   *notice, this list of conditions and the following disclaimer.  *
   *   *
   * 2. Redistributions  in binary  form  must  reproduce the  above copyright *
   *notice,  this list of conditions  and the following  disclaimer in the *
   *documentation and/or other materials provided with the distribution.   *
   *   *
   * 3. The end-user documentation  included with the redistribution,  if any, *
   *must include the following acknowlegement: *
   *   *
   *   "This product includes  software developed  by the Apache  Software *
   *Foundation ."  *
   *   *
   *Alternately, this acknowlegement may appear in the software itself, if *
   *and wherever such third-party acknowlegements normally appear. *
   *   *
   * 4. The names  "The  Jakarta  Project",  "Tomcat",  and  "Apache  Software *
   *Foundation"  must not be used  to endorse or promote  products derived *
   *from this  software without  prior  written  permission.  For  written *
   *permission, please contact <[EMAIL PROTECTED]>.*
   *   *
   * 5. Products derived from this software may not be called "Apache" nor may *
   *"Apache" appear in their names without prior written permission of the *
   *Apache Software Foundation.*
   *   *
   * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES *
   * INCLUDING, BUT NOT LIMITED TO,  THE IMPLIED WARRANTIES OF MERCHANTABILITY *
   * AND FITNESS FOR  A PARTICULAR PURPOSE  ARE DISCLAIMED.  IN NO EVENT SHALL *
   * THE APACHE  SOFTWARE  FOUNDATION OR  ITS CONTRIBUTORS  BE LIABLE  FOR ANY *
   * DIRECT,  INDIRECT,   INCIDENTAL,  SPECIAL,  EXEMPLARY,  OR  CONSEQUENTIAL *
   * DAMAGES (INCLUDING,  BUT NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE GOODS *
   * OR SERVICES;  LOSS OF USE,  DATA,  OR PROFITS;  OR BUSINESS INTERRUPTION) *
   * HOWEVER CAUSED AND  ON ANY  THEORY  OF  LIABILITY,  WHETHER IN  CONTRACT, *
   * STRICT LIABILITY, OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN *
   * ANY  WAY  OUT OF  THE  USE OF  THIS  SOFTWARE,  EVEN  IF  ADVISED  OF THE *
   * POSSIBILITY OF SUCH DAMAGE.   *
   *   *
   * = *
   *   *
   * This software  consists of voluntary  contributions made  by many indivi- *
   * duals on behalf of the  Apache Software Foundation.  For more information *
   * on the Apache Software Foundation, please see .   *
   *   *
   * = */
  package org.apache.service;
  
  import java.security.Permission;