You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by ju...@apache.org on 2001/01/09 10:17:15 UTC

cvs commit: jakarta-slide/src/share/org/apache/slide/lock NodeLock.java

juergen     01/01/09 01:17:14

  Modified:    src/share/org/apache/slide/lock NodeLock.java
  Log:
  implements Serialisable
  
  Revision  Changes    Path
  1.7       +44 -44    jakarta-slide/src/share/org/apache/slide/lock/NodeLock.java
  
  Index: NodeLock.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/lock/NodeLock.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- NodeLock.java	2000/12/01 07:17:33	1.6
  +++ NodeLock.java	2001/01/09 09:17:14	1.7
  @@ -1,13 +1,13 @@
   /*
  - * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/lock/NodeLock.java,v 1.6 2000/12/01 07:17:33 remm Exp $
  - * $Revision: 1.6 $
  - * $Date: 2000/12/01 07:17:33 $
  + * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/lock/NodeLock.java,v 1.7 2001/01/09 09:17:14 juergen Exp $
  + * $Revision: 1.7 $
  + * $Date: 2001/01/09 09:17:14 $
    *
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -15,7 +15,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer. 
  + *    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
  @@ -23,15 +23,15 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution, if
  - *    any, must include the following acknowlegement:  
  - *       "This product includes software developed by the 
  + *    any, must include the following acknowlegement:
  + *       "This product includes software developed by the
    *        Apache Software Foundation (http://www.apache.org/)."
    *    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 
  + *    from this software without prior written permission. For written
    *    permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache"
  @@ -59,7 +59,7 @@
    *
    * [Additional notices, if required by prior licensing conditions]
    *
  - */ 
  + */
   
   package org.apache.slide.lock;
   
  @@ -73,11 +73,11 @@
   
   /**
    * NodeLock class.
  - * 
  + *
    * @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
  - * @version $Revision: 1.6 $
  + * @version $Revision: 1.7 $
    */
  -public final class NodeLock implements Cloneable {
  +public final class NodeLock implements Cloneable, java.io.Serializable {
       
       
       // ----------------------------------------------------------- Constructors
  @@ -92,7 +92,7 @@
       
       /**
        * Constructor.
  -     * 
  +     *
        * @param locked Locked object
        * @param user Lock owner
        * @param lockType Type of the lock
  @@ -108,7 +108,7 @@
       
       /**
        * Constructor.
  -     * 
  +     *
        * @param locked Locked object
        * @param user Lock owner
        * @param lockType Type of the lock
  @@ -116,7 +116,7 @@
        * @param inheritance True if lock is inheritable
        */
       public NodeLock(ObjectNode locked, SubjectNode user, ActionNode lockType,
  -                    Date expirationDate, boolean inheritance, 
  +                    Date expirationDate, boolean inheritance,
                       boolean exclusive) {
           this(locked.getUri(), user.getUri(), lockType.getUri(), expirationDate,
                inheritance, exclusive);
  @@ -125,7 +125,7 @@
       
       /**
        * Constructor.
  -     * 
  +     *
        * @param objectUri Locked object uri
        * @param subjectUri Lock owner uri
        * @param typeUri Lock type uri
  @@ -134,14 +134,14 @@
        */
       public NodeLock(String objectUri, String subjectUri, String typeUri,
                       Date expirationDate, boolean inheritance) {
  -        this(objectUri, subjectUri, typeUri, expirationDate, 
  +        this(objectUri, subjectUri, typeUri, expirationDate,
                inheritance, true);
       }
       
       
       /**
        * Constructor.
  -     * 
  +     *
        * @param objectUri Locked object uri
        * @param subjectUri Lock owner uri
        * @param typeUri Lock type uri
  @@ -149,17 +149,17 @@
        * @param inheritance True if lock is inheritable
        */
       public NodeLock(String objectUri, String subjectUri, String typeUri,
  -                    Date expirationDate, boolean inheritance, 
  +                    Date expirationDate, boolean inheritance,
                       boolean exclusive) {
           this.objectUri = objectUri;
           this.subjectUri = subjectUri;
           this.typeUri = typeUri;
           this.expirationDate = expirationDate;
           this.inheritance = inheritance;
  -        this.lockId = objectUri.hashCode() + "_" + subjectUri.hashCode() + "_" 
  -            + typeUri.hashCode() + "_" + expirationDate.getTime() + "_" 
  +        this.lockId = objectUri.hashCode() + "_" + subjectUri.hashCode() + "_"
  +            + typeUri.hashCode() + "_" + expirationDate.getTime() + "_"
               + (new Date()).getTime();
  -        this.lockId = 
  +        this.lockId =
               md5Encoder.encode(md5Helper.digest(this.lockId.getBytes()));
           this.exclusive = exclusive;
       }
  @@ -168,7 +168,7 @@
       /**
        * Constructor.
        * Creates a new lock linked to another given lock.
  -     * 
  +     *
        * @param lock Linked lock
        */
       public NodeLock(NodeLock lock, String typeUri) {
  @@ -180,15 +180,15 @@
       
       /**
        * Constructor.
  -     * 
  +     *
        * @param objectUri Locked object uri
        * @param subjectUri Lock owner uri
        * @param typeUri Lock type uri
        * @param expirationDate Date of expiration of the lock
        * @param inheritance True if lock is inheritable
        */
  -    public NodeLock(String lockId, String objectUri, String subjectUri, 
  -                    String typeUri, Date expirationDate, boolean inheritance, 
  +    public NodeLock(String lockId, String objectUri, String subjectUri,
  +                    String typeUri, Date expirationDate, boolean inheritance,
                       boolean exclusive) {
           this.objectUri = objectUri;
           this.subjectUri = subjectUri;
  @@ -278,7 +278,7 @@
       
       /**
        * Locked object accessor.
  -     * 
  +     *
        * @return String Locked subject uri
        */
       public String getObjectUri() {
  @@ -288,7 +288,7 @@
       
       /**
        * Locked object mutator.
  -     * 
  +     *
        * @param objectUri Locked subject
        */
       void setObjectUri(String objectUri) {
  @@ -298,7 +298,7 @@
       
       /**
        * Lock owner uri accessor.
  -     * 
  +     *
        * @return String Lock owner
        */
       public String getSubjectUri() {
  @@ -308,7 +308,7 @@
       
       /**
        * Lock owner uri mutator.
  -     * 
  +     *
        * @param subjectUri Lock owner
        */
       void setSubjectUri(String subjectUri) {
  @@ -318,7 +318,7 @@
       
       /**
        * Lock type uri accessor.
  -     * 
  +     *
        * @return String Lock type uri
        */
       public String getTypeUri() {
  @@ -328,7 +328,7 @@
       
       /**
        * Lock type mutator.
  -     * 
  +     *
        * @param typeUri Lock type
        */
       void setTypeUri(String typeUri) {
  @@ -338,7 +338,7 @@
       
       /**
        * Expiration date accessor.
  -     * 
  +     *
        * @return Date Exipiration date
        */
       public Date getExpirationDate() {
  @@ -348,7 +348,7 @@
       
       /**
        * Expiration date mutator.
  -     * 
  +     *
        * @param expirationDate Expiration date
        */
       void setExpirationDate(Date expirationDate) {
  @@ -358,7 +358,7 @@
       
       /**
        * Expiration test.
  -     * 
  +     *
        * @return boolean True if this lock has expired
        */
       public boolean hasExpired() {
  @@ -369,7 +369,7 @@
       
       /**
        * Inheritance flag accessor.
  -     * 
  +     *
        * @return boolean True if token is inheritable
        */
       public boolean isInheritable() {
  @@ -379,7 +379,7 @@
       
       /**
        * Inheritance flag mutator.
  -     * 
  +     *
        * @param inheritance Inheritance flag
        */
       void setInheritable(boolean inheritance) {
  @@ -389,7 +389,7 @@
       
       /**
        * Exclusive flag accessor.
  -     * 
  +     *
        * @return boolean True if token is exclusive
        */
       public boolean isExclusive() {
  @@ -399,7 +399,7 @@
       
       /**
        * Exclusive flag accessor.
  -     * 
  +     *
        * @return boolean True if token is shared (ie, not exclusive)
        */
       public boolean isShared() {
  @@ -409,7 +409,7 @@
       
       /**
        * Exclusive flag mutator.
  -     * 
  +     *
        * @param exclusive Exclusive flag
        */
       void setExclusive(boolean exclusive) {
  @@ -419,7 +419,7 @@
       
       /**
        * Get lock identifier.
  -     * 
  +     *
        * @return String lock id
        */
       public String getLockId() {
  @@ -432,7 +432,7 @@
       
       /**
        * Clone.
  -     * 
  +     *
        * @return Object clone
        */
       public NodeLock cloneObject() {
  @@ -448,7 +448,7 @@
       
       /**
        * Equals.
  -     * 
  +     *
        * @param obj Object to test
        * @return boolean True if the two object are equal :
        * <li>obj is of type SlidePermission and is not null</li>
  @@ -466,7 +466,7 @@
       
       /**
        * Validate.
  -     * 
  +     *
        * @param expectedUri Uri
        */
       public void validate(String expectedUri) {