private static void configureMetaData(OpenJPAConfiguration conf, ClassLoader envLoader, Class<?> cls, boolean redefineAvailable) { ClassMetaData meta = conf.getMetaDataRepositoryInstance() .getMetaData(cls, envLoader, true); configureMetaData(meta, conf, redefineAvailable, true); }
private static void write(BCClass bc, PCEnhancer enhancer, Map<Class<?>, byte[]> map, Class<?> cls, List<Class<?>> subs, List<Class<?>> ints) throws IOException { if (bc == enhancer.getManagedTypeBytecode()) { // if it was already defined, don't put it in the map, // but do set the metadata accordingly. if (enhancer.isAlreadyRedefined()) ints.add(bc.getType()); else { map.put(bc.getType(), bc.toByteArray()); debugBytecodes(bc); } } else { if (!enhancer.isAlreadySubclassed()) { debugBytecodes(bc); // this is the new subclass ClassLoader loader = GeneratedClasses.getMostDerivedLoader( cls, PersistenceCapable.class); subs.add(GeneratedClasses.loadBCClass(bc, loader)); } } }
ManagedClassSubclasser.prepareUnenhancedClasses(_conf, toRedefine, envLoader);
configureMetaData(enhancer.getMetaData(), conf, redefine, false); unspecified = collectRelatedUnspecifiedTypes(enhancer.getMetaData(), classes, unspecified); setIntercepting(conf, envLoader, cls); configureMetaData(conf, envLoader, cls, redefine); configureMetaData(conf, envLoader, cls, redefine); for (Class cls : (Collection<Class>) ints) setIntercepting(conf, envLoader, cls);
private static Set<Class> collectRelatedUnspecifiedTypes(ClassMetaData meta, Collection<? extends Class> classes, Set<Class> unspecified) { unspecified = collectUnspecifiedType(meta.getPCSuperclass(), classes, unspecified); for (FieldMetaData fmd : meta.getFields()) { if (fmd.isTransient()) continue; if (fmd.isTypePC()) unspecified = collectUnspecifiedType(fmd.getType(), classes, unspecified); if (fmd.getElement() != null && fmd.getElement().isTypePC()) unspecified = collectUnspecifiedType(fmd.getElement().getType(), classes, unspecified); if (fmd.getKey() != null && fmd.getKey().isTypePC()) unspecified = collectUnspecifiedType(fmd.getKey().getType(), classes, unspecified); if (fmd.getValue() != null && fmd.getValue().isTypePC()) unspecified = collectUnspecifiedType(fmd.getValue().getType(), classes, unspecified); } return unspecified; }
private static void configureMetaData(ClassMetaData meta, OpenJPAConfiguration conf, boolean redefineAvailable, boolean warn) { setDetachedState(meta); if (warn && meta.getAccessType() == ClassMetaData.ACCESS_FIELD && !redefineAvailable) { // only warn about declared fields; superclass fields will be // warned about when the superclass is handled for (FieldMetaData fmd : meta.getDeclaredFields()) { switch (fmd.getTypeCode()) { case JavaTypes.COLLECTION: case JavaTypes.MAP: // we can lazily load these, since we own the // relationship container break; default: if (!fmd.isInDefaultFetchGroup() && !(fmd.isVersion() || fmd.isPrimaryKey())) { Log log = conf.getLog( OpenJPAConfiguration.LOG_ENHANCE); log.warn(_loc.get("subclasser-fetch-group-override", meta.getDescribedType().getName(), fmd.getName())); fmd.setInDefaultFetchGroup(true); } } } } }
configureMetaData(enhancer.getMetaData(), conf, redefine, false); unspecified = collectRelatedUnspecifiedTypes(enhancer.getMetaData(), classes, unspecified); setIntercepting(conf, envLoader, cls); configureMetaData(conf, envLoader, cls, redefine); configureMetaData(conf, envLoader, cls, redefine); for (Class cls : (Collection<Class>) ints) setIntercepting(conf, envLoader, cls);
private static Set<Class<?>> collectRelatedUnspecifiedTypes(ClassMetaData meta, Collection<? extends Class<?>> classes, Set<Class<?>> unspecified) { unspecified = collectUnspecifiedType(meta.getPCSuperclass(), classes, unspecified); for (FieldMetaData fmd : meta.getFields()) { if (fmd.isTransient()) continue; if (fmd.isTypePC()) unspecified = collectUnspecifiedType(fmd.getType(), classes, unspecified); if (fmd.getElement() != null && fmd.getElement().isTypePC()) unspecified = collectUnspecifiedType(fmd.getElement().getType(), classes, unspecified); if (fmd.getKey() != null && fmd.getKey().isTypePC()) unspecified = collectUnspecifiedType(fmd.getKey().getType(), classes, unspecified); if (fmd.getValue() != null && fmd.getValue().isTypePC()) unspecified = collectUnspecifiedType(fmd.getValue().getType(), classes, unspecified); } return unspecified; }
private static void configureMetaData(ClassMetaData meta, OpenJPAConfiguration conf, boolean redefineAvailable, boolean warn) { setDetachedState(meta); if (warn && meta.getAccessType() == ClassMetaData.ACCESS_FIELD && !redefineAvailable) { // only warn about declared fields; superclass fields will be // warned about when the superclass is handled for (FieldMetaData fmd : meta.getDeclaredFields()) { switch (fmd.getTypeCode()) { case JavaTypes.COLLECTION: case JavaTypes.MAP: // we can lazily load these, since we own the // relationship container break; default: if (!fmd.isInDefaultFetchGroup() && !(fmd.isVersion() || fmd.isPrimaryKey())) { Log log = conf.getLog( OpenJPAConfiguration.LOG_ENHANCE); log.warn(_loc.get("subclasser-fetch-group-override", meta.getDescribedType().getName(), fmd.getName())); fmd.setInDefaultFetchGroup(true); } } } } }
configureMetaData(enhancer.getMetaData(), conf, redefine, false); unspecified = collectRelatedUnspecifiedTypes(enhancer.getMetaData(), classes, unspecified); setIntercepting(conf, envLoader, cls); configureMetaData(conf, envLoader, cls, redefine); configureMetaData(conf, envLoader, cls, redefine); for (Class cls : (Collection<Class>) ints) setIntercepting(conf, envLoader, cls);
private static void configureMetaData(OpenJPAConfiguration conf, ClassLoader envLoader, Class<?> cls, boolean redefineAvailable) { ClassMetaData meta = conf.getMetaDataRepositoryInstance() .getMetaData(cls, envLoader, true); configureMetaData(meta, conf, redefineAvailable, true); }
private static Set<Class<?>> collectRelatedUnspecifiedTypes(ClassMetaData meta, Collection<? extends Class<?>> classes, Set<Class<?>> unspecified) { unspecified = collectUnspecifiedType(meta.getPCSuperclass(), classes, unspecified); for (FieldMetaData fmd : meta.getFields()) { if (fmd.isTransient()) continue; if (fmd.isTypePC()) unspecified = collectUnspecifiedType(fmd.getType(), classes, unspecified); if (fmd.getElement() != null && fmd.getElement().isTypePC()) unspecified = collectUnspecifiedType(fmd.getElement().getType(), classes, unspecified); if (fmd.getKey() != null && fmd.getKey().isTypePC()) unspecified = collectUnspecifiedType(fmd.getKey().getType(), classes, unspecified); if (fmd.getValue() != null && fmd.getValue().isTypePC()) unspecified = collectUnspecifiedType(fmd.getValue().getType(), classes, unspecified); } return unspecified; }
private static void configureMetaData(ClassMetaData meta, OpenJPAConfiguration conf, boolean redefineAvailable, boolean warn) { setDetachedState(meta); if (warn && meta.getAccessType() == ClassMetaData.ACCESS_FIELD && !redefineAvailable) { // only warn about declared fields; superclass fields will be // warned about when the superclass is handled for (FieldMetaData fmd : meta.getDeclaredFields()) { switch (fmd.getTypeCode()) { case JavaTypes.COLLECTION: case JavaTypes.MAP: // we can lazily load these, since we own the // relationship container break; default: if (!fmd.isInDefaultFetchGroup() && !(fmd.isVersion() || fmd.isPrimaryKey())) { Log log = conf.getLog( OpenJPAConfiguration.LOG_ENHANCE); log.warn(_loc.get("subclasser-fetch-group-override", meta.getDescribedType().getName(), fmd.getName())); fmd.setInDefaultFetchGroup(true); } } } } }
private static void write(BCClass bc, PCEnhancer enhancer, Map<Class<?>, byte[]> map, Class<?> cls, List<Class<?>> subs, List<Class<?>> ints) throws IOException { if (bc == enhancer.getManagedTypeBytecode()) { // if it was already defined, don't put it in the map, // but do set the metadata accordingly. if (enhancer.isAlreadyRedefined()) ints.add(bc.getType()); else { map.put(bc.getType(), bc.toByteArray()); debugBytecodes(bc); } } else { if (!enhancer.isAlreadySubclassed()) { debugBytecodes(bc); // this is the new subclass ClassLoader loader = GeneratedClasses.getMostDerivedLoader( cls, PersistenceCapable.class); subs.add(GeneratedClasses.loadBCClass(bc, loader)); } } }
ManagedClassSubclasser.prepareUnenhancedClasses(_conf, toRedefine, envLoader);
throw new MetaDataException(_loc.get("no-meta", cls)).setFatal(true); configureMetaData(meta, conf, redefine, false); unspecified = collectRelatedUnspecifiedTypes(enhancer.getMetaData(), classes, unspecified); setIntercepting(conf, envLoader, cls); configureMetaData(conf, envLoader, cls, redefine); configureMetaData(conf, envLoader, cls, redefine); for (Class<?> cls : ints) setIntercepting(conf, envLoader, cls);
private static void configureMetaData(OpenJPAConfiguration conf, ClassLoader envLoader, Class cls, boolean redefineAvailable) { ClassMetaData meta = conf.getMetaDataRepositoryInstance() .getMetaData(cls, envLoader, true); configureMetaData(meta, conf, redefineAvailable, true); }
private static Set<Class> collectRelatedUnspecifiedTypes(ClassMetaData meta, Collection<? extends Class> classes, Set<Class> unspecified) { unspecified = collectUnspecifiedType(meta.getPCSuperclass(), classes, unspecified); for (FieldMetaData fmd : meta.getFields()) { if (fmd.isTransient()) continue; if (fmd.isTypePC()) unspecified = collectUnspecifiedType(fmd.getType(), classes, unspecified); if (fmd.getElement() != null && fmd.getElement().isTypePC()) unspecified = collectUnspecifiedType(fmd.getElement().getType(), classes, unspecified); if (fmd.getKey() != null && fmd.getKey().isTypePC()) unspecified = collectUnspecifiedType(fmd.getKey().getType(), classes, unspecified); if (fmd.getValue() != null && fmd.getValue().isTypePC()) unspecified = collectUnspecifiedType(fmd.getValue().getType(), classes, unspecified); } return unspecified; }
private static void configureMetaData(ClassMetaData meta, OpenJPAConfiguration conf, boolean redefineAvailable, boolean warn) { setDetachedState(meta);
private static void write(BCClass bc, PCEnhancer enhancer, Map<Class<?>, byte[]> map, Class<?> cls, List<Class<?>> subs, List<Class<?>> ints) throws IOException { if (bc == enhancer.getManagedTypeBytecode()) { // if it was already defined, don't put it in the map, // but do set the metadata accordingly. if (enhancer.isAlreadyRedefined()) ints.add(bc.getType()); else { map.put(bc.getType(), bc.toByteArray()); debugBytecodes(bc); } } else { if (!enhancer.isAlreadySubclassed()) { debugBytecodes(bc); // this is the new subclass ClassLoader loader = GeneratedClasses.getMostDerivedLoader( cls, PersistenceCapable.class); subs.add(GeneratedClasses.loadBCClass(bc, loader)); } } }