001: /*
002: * Copyright 1999-2004 The Apache Software Foundation.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016:
017: package org.apache.commons.pool;
018:
019: /**
020: * A simple base impementation of {@link ObjectPool}.
021: * All optional operations are implemented as throwing
022: * {@link UnsupportedOperationException}.
023: *
024: * @author Rodney Waldhoff
025: * @version $Revision: 155430 $ $Date: 2005-02-26 08:13:28 -0500 (Sat, 26 Feb 2005) $
026: */
027: public abstract class BaseKeyedObjectPool implements KeyedObjectPool {
028: public abstract Object borrowObject(Object key) throws Exception;
029:
030: public abstract void returnObject(Object key, Object obj)
031: throws Exception;
032:
033: public abstract void invalidateObject(Object key, Object obj)
034: throws Exception;
035:
036: /**
037: * Not supported in this base implementation.
038: */
039: public void addObject(Object key) throws Exception,
040: UnsupportedOperationException {
041: throw new UnsupportedOperationException();
042: }
043:
044: /**
045: * Not supported in this base implementation.
046: */
047: public int getNumIdle(Object key)
048: throws UnsupportedOperationException {
049: throw new UnsupportedOperationException();
050: }
051:
052: /**
053: * Not supported in this base implementation.
054: */
055: public int getNumActive(Object key)
056: throws UnsupportedOperationException {
057: throw new UnsupportedOperationException();
058: }
059:
060: /**
061: * Not supported in this base implementation.
062: */
063: public int getNumIdle() throws UnsupportedOperationException {
064: throw new UnsupportedOperationException();
065: }
066:
067: /**
068: * Not supported in this base implementation.
069: */
070: public int getNumActive() throws UnsupportedOperationException {
071: throw new UnsupportedOperationException();
072: }
073:
074: /**
075: * Not supported in this base implementation.
076: */
077: public void clear() throws Exception, UnsupportedOperationException {
078: throw new UnsupportedOperationException();
079: }
080:
081: /**
082: * Not supported in this base implementation.
083: */
084: public void clear(Object key) throws Exception,
085: UnsupportedOperationException {
086: throw new UnsupportedOperationException();
087: }
088:
089: /**
090: * Does nothing this base implementation.
091: */
092: public void close() throws Exception {
093: }
094:
095: /**
096: * Not supported in this base implementation.
097: */
098: public void setFactory(KeyedPoolableObjectFactory factory)
099: throws IllegalStateException, UnsupportedOperationException {
100: throw new UnsupportedOperationException();
101: }
102:
103: }
|