juergen 01/09/10 02:20:48 Added: src/share/org/apache/slide/common SlideTokenImpl.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/SlideTokenImpl.java Index: SlideTokenImpl.java =================================================================== /* * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/common/SlideTokenImpl.java,v 1.1 2001/09/10 09:20:48 juergen Exp $ * $Revision: 1.1 $ * $Date: 2001/09/10 09:20:48 $ * * ==================================================================== * * 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 SlideTokenImpl implements SlideToken { // ------------------------------------------------------------ Constructor /** * Constructor. * * @param credentials Credentials stored in this token */ public SlideTokenImpl(CredentialsToken credentialsToken) { this.credentialsToken = credentialsToken; } /** * Constructor. * * @param credentials Credentials stored in this token */ public SlideTokenImpl() { } /** * Constructor. * * @param credentials Credentials stored in this token * @param parameters Token parameters */ public SlideTokenImpl(CredentialsToken credentialsToken, Hashtable parameters) { this.credentialsToken = credentialsToken; this.parameters = parameters; } // ----------------------------------------------------- Instance Variables /** * Credentials. */ private CredentialsToken credentialsToken; /** * CacheInfo. */ private CacheInfoToken cacheInfoToken; /** * Use lock tokens for lock resolution. */ private boolean enforceLockTokens = false; /** * Always use a transaction for all operations. 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. */ private boolean forceStoreEnlistment = false; /** * Lock tokens. */ private Hashtable lockTokens = new Hashtable(); /** * Parameters. */ private Hashtable parameters = new Hashtable(); // ------------------------------------------------------------- Properties /** * Returns the credentials token. * * @return String */ public CredentialsToken getCredentialsToken() { return credentialsToken; } /** * Credentials token mutator. */ public void setCredentialsToken(CredentialsToken credentialsToken) { this.credentialsToken = credentialsToken; } /** * Returns the CacheInfo token. * * @return CacheInfoToken */ public CacheInfoToken getCacheInfoToken() { return cacheInfoToken; } /** * CacheInfo token mutator. */ public void setCacheInfoToken(CacheInfoToken cacheInfoToken) { this.cacheInfoToken = cacheInfoToken; } /** * Use lock tokens in lock resolution ? * * @return boolean */ public boolean isEnforceLockTokens() { return enforceLockTokens; } /** * Enforce lock tokens flag mutator. * * @param enforceLockTokens New flag value */ public void setEnforceLockTokens(boolean enforceLockTokens) { this.enforceLockTokens = 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) { lockTokens.put(lockId, lockId); } /** * Removes a lock token from the lock token list. * * @param lockToken Lock token to remove */ public void removeLockToken(String lockId) { lockTokens.remove(lockId); } /** * Clears the lock token list. */ public void clearLockTokens() { lockTokens.clear(); } /** * 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 lockTokens.containsKey(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) { parameters.put(parameterName, parameterValue); } /** * Removes a parameter from the parameter list. * * @param parameterName Parameter to remove */ public void removeParameter(String parameterName) { parameters.remove(parameterName); } /** * Clears the parameter list. */ public void clearParameters() { parameters.clear(); } /** * Return parameter list. */ public Enumeration getParameterNames() { return parameters.keys(); } }
