1 /** 2 * Copyright (C) 2001-2002 3 * - France Telecom R&D 4 * - Laboratoire Logiciels, Systemes, Reseaux - UMR 5526, CNRS-INPG-UJF 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2 of the License, or (at your option) any later version. 10 * 11 * This library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with this library; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * 20 * Release: 1.0 21 * 22 * Authors: 23 * 24 */ 25 26 package org.objectweb.perseus.pool.api; 27 28 /** 29 * The interface <b>PoolMatchFactory</b> defines the object used by a Pool to 30 * test if a given resource of a Pool matches with the hints passed with the 31 * Pool getResource method. It also allows such a Pool to allocate a 32 * PoolResource as needed, conforming to the passed hints. Finally the factory 33 * is called when a resource is going to be destroyed. 34 * 35 * @author S.Chassande-Barrioz, P.Dechamboux 36 */ 37 public interface PoolMatchFactory { 38 /** 39 * <b>createResource</b> creates a new PoolResource. 40 * @param hints The "properties" that the created PoolResource should 41 * conform to. 42 * @return The created PoolResource. 43 */ 44 Object createResource(Object hints) throws PoolException; 45 46 /** 47 * <b>matchResource</b> tests if a given resource of a Pool matches with 48 * the hints passed with the Pool getResource method. 49 * @param resource The PoolResource to test its matching with some 50 * "properties" specified by hints. 51 * @param hints The "properties" that the PoolResource specified by pr 52 * should match. 53 * @return <b>true</b> if the pr PoolResource matches the hints 54 * "properties". 55 */ 56 boolean matchResource(Object resource, Object hints); 57 58 /** 59 * is called when a resource is going to be destroyed. This method permits 60 * to close physical resource for example. 61 * 62 * @param resource to initialize. 63 */ 64 void destroyResource(Object resource); 65 } 66