KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > pool > BaseKeyedObjectPool


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.commons.pool;
18
19 /**
20  * A simple base impementation of {@link ObjectPool}.
21  * All optional operations are implemented as throwing
22  * {@link UnsupportedOperationException}.
23  *
24  * @author Rodney Waldhoff
25  * @version $Revision$ $Date: 2005-02-26 05:13:28 -0800 (Sat, 26 Feb 2005) $
26  */

27 public abstract class BaseKeyedObjectPool implements KeyedObjectPool {
28     public abstract Object JavaDoc borrowObject(Object JavaDoc key) throws Exception JavaDoc;
29     public abstract void returnObject(Object JavaDoc key, Object JavaDoc obj) throws Exception JavaDoc;
30     public abstract void invalidateObject(Object JavaDoc key, Object JavaDoc obj) throws Exception JavaDoc;
31
32     /**
33      * Not supported in this base implementation.
34      */

35     public void addObject(Object JavaDoc key) throws Exception JavaDoc, UnsupportedOperationException JavaDoc {
36         throw new UnsupportedOperationException JavaDoc();
37     }
38
39     /**
40      * Not supported in this base implementation.
41      */

42     public int getNumIdle(Object JavaDoc key) throws UnsupportedOperationException JavaDoc {
43         throw new UnsupportedOperationException JavaDoc();
44     }
45
46     /**
47      * Not supported in this base implementation.
48      */

49     public int getNumActive(Object JavaDoc key) throws UnsupportedOperationException JavaDoc {
50         throw new UnsupportedOperationException JavaDoc();
51     }
52
53     /**
54      * Not supported in this base implementation.
55      */

56     public int getNumIdle() throws UnsupportedOperationException JavaDoc {
57         throw new UnsupportedOperationException JavaDoc();
58     }
59
60     /**
61      * Not supported in this base implementation.
62      */

63     public int getNumActive() throws UnsupportedOperationException JavaDoc {
64         throw new UnsupportedOperationException JavaDoc();
65     }
66
67     /**
68      * Not supported in this base implementation.
69      */

70     public void clear() throws Exception JavaDoc, UnsupportedOperationException JavaDoc {
71         throw new UnsupportedOperationException JavaDoc();
72     }
73
74     /**
75      * Not supported in this base implementation.
76      */

77     public void clear(Object JavaDoc key)
78     throws Exception JavaDoc, UnsupportedOperationException JavaDoc {
79         throw new UnsupportedOperationException JavaDoc();
80     }
81
82     /**
83      * Does nothing this base implementation.
84      */

85     public void close() throws Exception JavaDoc {
86     }
87
88
89     /**
90      * Not supported in this base implementation.
91      */

92     public void setFactory(KeyedPoolableObjectFactory factory)
93     throws IllegalStateException JavaDoc, UnsupportedOperationException JavaDoc {
94         throw new UnsupportedOperationException JavaDoc();
95     }
96
97 }
98
Popular Tags