1 22 package org.jboss.ejb.plugins.cmp.ejbql; 23 24 import java.util.Collections ; 25 import java.util.HashMap ; 26 import java.util.Map ; 27 import java.util.Set ; 28 29 import org.jboss.ejb.plugins.cmp.bridge.EntityBridge; 30 31 37 public final class Catalog { 38 private final Map entityByAbstractSchemaName = new HashMap (); 39 private final Map entityByEJBName = new HashMap (); 40 private final Map entityByInterface = new HashMap (); 41 42 public void addEntity(EntityBridge entityBridge) { 43 entityByAbstractSchemaName.put( 44 entityBridge.getAbstractSchemaName(), 45 entityBridge); 46 entityByEJBName.put( 47 entityBridge.getEntityName(), 48 entityBridge); 49 50 Class remote = entityBridge.getRemoteInterface(); 51 if(remote != null) { 52 entityByInterface.put(remote, entityBridge); 53 } 54 Class local = entityBridge.getLocalInterface(); 55 if(local != null) { 56 entityByInterface.put(local, entityBridge); 57 } 58 59 } 60 61 public EntityBridge getEntityByAbstractSchemaName( 62 String abstractSchemaName) { 63 return (EntityBridge) entityByAbstractSchemaName.get(abstractSchemaName); 64 } 65 66 public EntityBridge getEntityByInterface(Class intf) { 67 return (EntityBridge) entityByInterface.get(intf); 68 } 69 70 public EntityBridge getEntityByEJBName(String ejbName) { 71 return (EntityBridge) entityByEJBName.get(ejbName); 72 } 73 74 public int getEntityCount() { 75 return entityByEJBName.size(); 76 } 77 78 public Set getEJBNames() { 79 return Collections.unmodifiableSet(entityByEJBName.keySet()); 80 } 81 } 82 | Popular Tags |