juergen     01/09/10 02:20:38

  Added:       src/share/org/apache/slide/common SlideTokenWrapper.java
  Log:
  preparation to get request a URI for read or write. The default in SlideToken may be 
overwritten. Please note: SlideToken is now an interface, the implementation is 
loacted in SlideTokenImpl.
  
  Revision  Changes    Path
  1.1                  
jakarta-slide/src/share/org/apache/slide/common/SlideTokenWrapper.java
  
  Index: SlideTokenWrapper.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/common/SlideTokenWrapper.java,v 1.1 
2001/09/10 09:20:38 juergen Exp $
   * $Revision: 1.1 $
   * $Date: 2001/09/10 09:20:38 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    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 (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
   *    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 Group.
   *
   * 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
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.slide.common;
  
  import java.security.Principal;
  import java.util.Hashtable;
  import java.util.Enumeration;
  import org.apache.slide.authenticate.CredentialsToken;
  
  /**
   * Slide token class.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]";>Remy Maucherat</a>
   */
  public final class SlideTokenWrapper implements SlideToken{
      
      
      // ------------------------------------------------------------ Constructor
      
      
      /**
       * Constructor.
       *
       * @param credentials Credentials stored in this token
       */
      public SlideTokenWrapper(SlideToken token, boolean forceStoreEnlistment) {
          this.wrappedToken = token;
          this.forceStoreEnlistment = forceStoreEnlistment;
      }
      
      
      
      // ----------------------------------------------------- Instance Variables
      
      
      /**
       * Credentials.
       */
      private SlideToken wrappedToken;
      
      private boolean forceStoreEnlistment = false;
      
      
      
      // ------------------------------------------------------------- Properties
      
      
      /**
       * Returns the credentials token.
       *
       * @return String
       */
      public CredentialsToken getCredentialsToken() {
           return wrappedToken.getCredentialsToken();
      }
      
      
      /**
       * Credentials token mutator.
       */
      public void setCredentialsToken(CredentialsToken credentialsToken) {
          wrappedToken.setCredentialsToken(credentialsToken);
      }
      
      
      /**
       * Returns the CacheInfo token.
       *
       * @return CacheInfoToken
       */
      public CacheInfoToken getCacheInfoToken() {
           return wrappedToken.getCacheInfoToken();
      }
      
      
      /**
       * CacheInfo token mutator.
       */
      public void setCacheInfoToken(CacheInfoToken cacheInfoToken) {
          wrappedToken.setCacheInfoToken(cacheInfoToken);
      }
      
      
      /**
       * Use lock tokens in lock resolution ?
       *
       * @return boolean
       */
      public boolean isEnforceLockTokens() {
          return wrappedToken.isEnforceLockTokens();
      }
      
      
      /**
       * Enforce lock tokens flag mutator.
       *
       * @param enforceLockTokens New flag value
       */
      public void setEnforceLockTokens(boolean enforceLockTokens) {
          wrappedToken.setEnforceLockTokens(enforceLockTokens);
      }
      
      
      /**
       * Force store enlistment flag accessor. If true, that will cause Slide to
       * enlist the store in the current transaction for all operations,
       * to be able to prevent dirty reads when doing complex updates.
       *
       * @return boolean
       */
      public boolean isForceStoreEnlistment() {
          return forceStoreEnlistment;
      }
      
      
      /**
       * Force store enlistment flag mutator. If set to true, that will cause
       * Slide to enlist the store in the current transaction for all
       * operations, to be able to prevent dirty reads when doing complex
       * updates. That value should be set to true only in some very specific
       * critical sections of the code, as this would greatly decrease the
       * ability of Slide to handle multiple concurrent requests.
       *
       * @param forceStoreEnlistment New flag value
       */
      public void setForceStoreEnlistment(boolean forceStoreEnlistment) {
          this.forceStoreEnlistment = forceStoreEnlistment;
      }
      
      
      /**
       * Add a new lock token to the lock token list.
       *
       * @param lockToken Lock token to add
       */
      public void addLockToken(String lockId) {
          wrappedToken.addLockToken(lockId);
      }
      
      
      /**
       * Removes a lock token from the lock token list.
       *
       * @param lockToken Lock token to remove
       */
      public void removeLockToken(String lockId) {
          wrappedToken.removeLockToken(lockId);
      }
      
      
      /**
       * Clears the lock token list.
       */
      public void clearLockTokens() {
          wrappedToken.clearLockTokens();
      }
      
      
      /**
       * Checks if the given lock token is present.
       *
       * @param lockToken Lock token to check
       * @return boolean True if the given lock token is present
       */
      public boolean checkLockToken(String lockToken) {
          return wrappedToken.checkLockToken(lockToken);
      }
      
      
      /**
       * Add a new parameter to the parameter list.
       *
       * @param parameterName Parameter to add
       * @param parameterValue Parameter value
       */
      public void addParameter(String parameterName, Object parameterValue) {
          wrappedToken.addParameter(parameterName, parameterValue);
      }
      
      
      /**
       * Removes a parameter from the parameter list.
       *
       * @param parameterName Parameter to remove
       */
      public void removeParameter(String parameterName) {
              wrappedToken.removeParameter(parameterName);
      }
      
      
      /**
       * Clears the parameter list.
       */
      public void clearParameters() {
          wrappedToken.clearParameters();
      }
      
      
      /**
       * Return parameter list.
       */
      public Enumeration getParameterNames() {
          return wrappedToken.getParameterNames();
      }
      
      
  }
  
  
  

Reply via email to