001 /* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 018 package org.apache.commons.pool; 019 020 /** 021 * A base implementation of <code>KeyedPoolableObjectFactory</code>. 022 * <p> 023 * All operations defined here are essentially no-op's. 024 * 025 * @see KeyedPoolableObjectFactory 026 * 027 * @author Rodney Waldhoff 028 * @version $Revision: 777748 $ $Date: 2009-05-22 20:00:44 -0400 (Fri, 22 May 2009) $ 029 * @since Pool 1.0 030 */ 031 public abstract class BaseKeyedPoolableObjectFactory implements KeyedPoolableObjectFactory { 032 public abstract Object makeObject(Object key) 033 throws Exception; 034 035 /** No-op. */ 036 public void destroyObject(Object key, Object obj) 037 throws Exception { 038 } 039 040 /** 041 * This implementation always returns <tt>true</tt>. 042 * @return <tt>true</tt> 043 */ 044 public boolean validateObject(Object key, Object obj) { 045 return true; 046 } 047 048 /** No-op. */ 049 public void activateObject(Object key, Object obj) 050 throws Exception { 051 } 052 053 /** No-op. */ 054 public void passivateObject(Object key, Object obj) 055 throws Exception { 056 } 057 }