1 /** 2 * JORM: an implementation of a generic mapping system for persistent Java 3 * objects. Two mapping are supported: to RDBMS and to binary files. 4 * Copyright (C) 2001-2003 France Telecom R&D - INRIA 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 * Contact: jorm-team@objectweb.org 21 * 22 */ 23 24 package org.objectweb.jorm.naming.api; 25 26 import org.objectweb.jorm.api.PClassMapping; 27 import org.objectweb.jorm.api.PException; 28 import org.objectweb.jorm.api.PBindingCtrl; 29 import org.objectweb.jorm.api.PBinding; 30 import org.objectweb.perseus.cache.api.CacheManager; 31 32 import java.util.Iterator; 33 34 /** 35 * This interface defines a binder as a particular PNameManager that manages 36 * the association of bindings with PName. Each JORM class managed by a mapper 37 * have an associated PBinder. * Binders provide binding objects specific to the persistent class. 38 * @author R. Basset, P. D?chamboux 39 */ 40 public interface PBinder extends PNameManager { 41 /** 42 * It looks for a PBinding object with the given PName within a PBinder. 43 * @param pn The PName to associate to the PBinding. This PName must be 44 * valid within this binder just like with a naming context. 45 * @return The PBinding bound with the given PName. 46 * @exception PExceptionNaming The given PName is not valid in this 47 * PBinder or this PBinding cannot be managed 48 * by this PBinder. 49 */ 50 PBinding lookup(PName pn) throws PException; 51 52 /** 53 * It associates a PBinding object with a PName within a PBinder. This 54 * sets/resets the link between a PBinding and a DSI. 55 * @param pn The PName to associate to the PBinding. This PName must be 56 * valid within this binder just like with a naming context. 57 * @param pb The PBinding to bind with the given PName; this PBinding 58 * must have been created or initialised by this PBinder. 59 * @exception PExceptionNaming The given PName is not valid in this 60 * PBinder or this PBinding cannot be managed 61 * by this PBinder. 62 */ 63 void bind(PName pn, PBindingCtrl pb) throws PException; 64 65 /** 66 * It returns the PClassMapping for which it is the binder. 67 * @return The PClassMapping to which it is associated. 68 */ 69 PClassMapping getBinderClassMapping(); 70 71 /** 72 * It set the PClassMapping which use this binder slave. 73 * @param pcm The PClassMapping. 74 */ 75 void setPClassMapping(PClassMapping pcm); 76 77 /** 78 * It releases the link between the PBinding passed as parameter and its 79 * associated DSI represented by the PName referenced by this PBinding. 80 * @param pb The PBinding to unbind. 81 * @exception PExceptionNaming This PBinding cannot be managed by this 82 * PBinder. 83 */ 84 void unbind(PBindingCtrl pb) throws PException; 85 86 /** 87 * Returns the cache manager associated with this binder. 88 * @return The cache manager. 89 */ 90 CacheManager getCacheManager(); 91 92 /** 93 * Assigns the cache manager associated with this binder. 94 * @param cm The cache manager. 95 * @throws PException 96 */ 97 void setCacheManager(CacheManager cm) throws PException; 98 } 99