1 18 package org.objectweb.speedo.naming.api; 19 20 import org.objectweb.perseus.cache.api.CacheManager; 21 import org.objectweb.speedo.metadata.SpeedoClass; 22 import org.objectweb.speedo.generation.jorm.JormMIMappingBuilder; 23 import org.objectweb.speedo.api.SpeedoException; 24 import org.objectweb.speedo.mapper.api.JormFactory; 25 import org.objectweb.speedo.pm.api.ProxyManagerFactory; 26 import org.objectweb.jorm.metainfo.api.NameDef; 27 import org.objectweb.jorm.metainfo.api.MetaObject; 28 import org.objectweb.jorm.metainfo.api.Reference; 29 import org.objectweb.jorm.metainfo.api.CommonClassMapping; 30 import org.objectweb.jorm.metainfo.api.Manager; 31 import org.objectweb.jorm.api.PClassMapping; 32 import org.objectweb.jorm.api.PException; 33 import org.objectweb.jorm.api.PMapper; 34 import org.objectweb.jorm.naming.api.PBinder; 35 import org.objectweb.jorm.naming.api.PName; 36 import org.objectweb.jorm.naming.api.PNameCoder; 37 import org.objectweb.jorm.naming.api.PNamingContext; 38 import org.objectweb.jorm.type.api.PType; 39 import org.objectweb.util.monolog.api.Logger; 40 41 import java.util.Collection ; 42 import java.util.Map ; 43 import java.util.Properties ; 44 45 52 public interface NamingManager { 53 54 String SEP = "/"; 55 56 61 boolean canManage(SpeedoClass sc); 62 63 69 boolean canProvidePBinder(Object hints, ClassLoader classLoader); 70 71 77 boolean canProvidePNamingContext(Object hints, ClassLoader classLoader); 78 79 92 PBinder getPBinder(String className, 93 String hints, 94 ClassLoader classLoader, 95 byte mappingStructureRule, 96 Map cn2binder, 97 Map cn2pnc) throws PException; 98 99 112 PNamingContext getPNamingContext(String className, 113 String hints, 114 ClassLoader classLoader, 115 byte mappingStructureRule, Map cn2binder, 116 Map cn2pnc, Manager miManager, 117 PClassMapping pcm) throws PException; 118 119 130 PName decode(PNameCoder pnc, 131 Object oid, 132 Class clazz, 133 JormFactory jf) throws PException; 134 135 139 Object encode(PName pn) throws PException; 140 141 147 boolean supportPNamingcontext(); 148 149 173 void fillNameDef(MIBuilderHelper mibh, 174 Manager manager, 175 NameDef nd, 176 SpeedoClass tsc, 177 SpeedoClass ssc, 178 MetaObject mo, 179 Reference ref, 180 CommonClassMapping hcm, 181 JormMIMappingBuilder mb, 182 boolean isIdentifier, 183 boolean isInGenClass, 184 boolean createField, 185 Collection createdMOs) throws SpeedoException, PException; 186 187 204 void getJormNamingConfig(NameDef nd, 205 SpeedoClass targetClass, 206 MetaObject sourceMO, 207 String key, 208 Properties result) throws SpeedoException; 209 210 216 String getPNameHints(SpeedoClass sc, NameDef nd); 217 218 224 String getGCPNameHints(SpeedoClass sc, NameDef nd); 225 226 void setPMapper(PMapper mapper) throws PException; 227 228 void setLogger(Logger logger); 229 230 void setCache(CacheManager cache); 231 232 void setPmf(ProxyManagerFactory pmf); 233 234 241 NamingField[] getNamingfields(SpeedoClass sc) throws PException; 242 243 247 class NamingField { 248 private String userFieldName = null; 249 private Class userFieldType = null; 250 private String namingFieldName = null; 251 private PType namingFieldType = null; 252 253 260 public NamingField(String userFieldName, 261 Class userFieldType, 262 String namingFieldName, 263 PType namingFieldType) { 264 this.userFieldName = userFieldName; 265 this.userFieldType = userFieldType; 266 this.namingFieldName = namingFieldName; 267 this.namingFieldType = namingFieldType; 268 } 269 272 public String getUserFieldName() { return userFieldName; } 273 276 public Class getUserFieldType() { return userFieldType; } 277 280 public String getNamingFieldName() { return namingFieldName; } 281 284 public PType getNamingFieldType() { return namingFieldType; } 285 } 286 } | Popular Tags |