1 18 package org.objectweb.speedo.mapper.lib; 19 20 import org.objectweb.jorm.api.PMapper; 21 import org.objectweb.jorm.api.PClassMapping; 22 import org.objectweb.jorm.api.PException; 23 import org.objectweb.jorm.api.PMappingStructuresManager; 24 import org.objectweb.jorm.api.PMapperListener; 25 import org.objectweb.jorm.api.PMapCluster; 26 import org.objectweb.jorm.metainfo.api.Manager; 27 import org.objectweb.jorm.type.api.PTypeSpace; 28 import org.objectweb.speedo.mapper.api.JormFactory; 29 import org.objectweb.speedo.api.ExceptionHelper; 30 import org.objectweb.util.monolog.api.Logger; 31 import org.objectweb.medor.eval.prefetch.api.PrefetchCache; 32 33 import javax.jdo.JDOException; 34 import java.util.Collection ; 35 36 45 public class DelegatePMapper implements PMapper { 46 47 private JormFactory jf; 48 private PMapper mapper; 49 private ClassLoader classLoader; 50 51 public DelegatePMapper(PMapper mapper) { 52 this.mapper = mapper; 53 } 54 55 public JormFactory getJormFactory() { 56 return jf; 57 } 58 59 public void setJormFactory(JormFactory jf) { 60 this.jf = jf; 61 } 62 63 public PMapper getMapper() { 64 return mapper; 65 } 66 67 public void setMapper(PMapper mapper) { 68 this.mapper = mapper; 69 } 70 71 public ClassLoader getClassLoader() { 72 return classLoader; 73 } 74 75 public void setClassLoader(ClassLoader classLoader) { 76 this.classLoader = classLoader; 77 } 78 80 public PClassMapping lookup(String s) { 81 try { 82 return jf.getPClassMapping(s, classLoader); 83 } catch (PException e) { 84 throw new JDOException( 85 "Impossible to initialize the persistent class '" + s 86 + "': ", ExceptionHelper.getNested(e)); 87 } 88 } 89 90 public void setPMapper(PMapper pm) { 91 mapper.setPMapper(pm); 92 } 93 94 public void setLogger(Logger l) { 95 mapper.setLogger(l); 96 } 97 98 public void setPrefetchCache(PrefetchCache prefetchCache) throws PException { 99 mapper.setPrefetchCache(prefetchCache); 100 } 101 public PrefetchCache getPrefetchCache() { 102 return mapper.getPrefetchCache(); 103 } 104 public void closeConnection(Object o) throws PException { 105 mapper.closeConnection(o); 106 } 107 public String cn2mn(String s) { 108 return mapper.cn2mn(s); 109 } 110 public Object getConnection() throws PException { 111 return mapper.getConnection(); 112 } 113 public Object getConnection(Object o) throws PException { 114 return mapper.getConnection(o); 115 } 116 public Object getConnection(Object connectionContext, Object user) throws PException { 117 return mapper.getConnection(connectionContext, user); 118 } 119 public String getMapperName() { 120 return mapper.getMapperName(); 121 } 122 public PMappingStructuresManager getPMappingStructuresManager() { 123 return mapper.getPMappingStructuresManager(); 124 } 125 public void map(PClassMapping pClassMapping) throws PException { 126 mapper.map(pClassMapping); 127 } 128 public void map(Object o, PClassMapping pClassMapping) throws PException { 129 mapper.map(o, pClassMapping); 130 } 131 public void map(Object o, PClassMapping pClassMapping, boolean b) throws PException { 132 mapper.map(o, pClassMapping, b); 133 } 134 public void setConnectionFactory(Object o) throws PException { 135 mapper.setConnectionFactory(o); 136 } 137 public Object getConnectionFactory() { 138 return mapper.getConnectionFactory(); 139 } 140 public void setMapperName(String s) { 141 mapper.setMapperName(s); 142 } 143 public Manager getMetaInfoManager() { 144 return mapper.getMetaInfoManager(); 145 } 146 public PTypeSpace getPTypeSpace() { 147 return mapper.getPTypeSpace(); 148 } 149 public void start() throws PException { 150 mapper.start(); 151 } 152 public void stop() throws PException { 153 mapper.stop(); 154 } 155 public void unmap(String s) throws PException { 156 mapper.unmap(s); 157 } 158 public void addMapperEventListener(PMapperListener pMapperListener) { 159 mapper.addMapperEventListener(pMapperListener); 160 } 161 public void removeMapperEventListener(PMapperListener pMapperListener) { 162 mapper.removeMapperEventListener(pMapperListener); 163 } 164 public PClassMapping createGenClassMapping() throws PException { 165 return mapper.createGenClassMapping(); 166 } 167 public PMapCluster getPMapCluster(String s) throws PException { 168 return mapper.getPMapCluster(s); 169 } 170 public Collection getPMapClusters() { 171 return mapper.getPMapClusters(); 172 } 173 public void addDependency(String s, String s1) throws PException { 174 mapper.addDependency(s, s1); 175 } 176 public void classDefined(String s) throws PException { 177 mapper.classDefined(s); 178 } 179 public void declareClass(String jcname) { 180 mapper.declareClass(jcname); 181 } 182 public String [] getMappedClasses() { 183 return mapper.getMappedClasses(); 184 } 185 } 186 187 | Popular Tags |