177 |
177 |
private final Object cacheLock = new Object();
|
178 |
178 |
|
179 |
179 |
/** Containers for context-specific data. */
|
180 |
|
private final ContextLocal<Context> context = new ContextLocal<Context>()
|
|
180 |
private final ContextLocal<Context> context = new ContextLocal<>()
|
181 |
181 |
{
|
182 |
|
public WeightFactor getWeight() { return WeightFactor.LEVEL_8; };
|
|
182 |
public WeightFactor getWeight() { return WeightFactor.LEVEL_8; }
|
183 |
183 |
public Context initialValue() { return new Context(); }
|
184 |
184 |
protected void cleanup(Context ctx) { ctx.cleanup(); }
|
185 |
185 |
};
|
... | ... | |
573 |
573 |
|
574 |
574 |
// check the cache first
|
575 |
575 |
CacheKey cacheKey = new CacheKey(allFields, allIndexes);
|
576 |
|
CacheData cacheData = null;
|
|
576 |
CacheData cacheData;
|
577 |
577 |
|
578 |
578 |
synchronized (cacheLock)
|
579 |
579 |
{
|
580 |
580 |
cacheData = cache.get(cacheKey);
|
581 |
581 |
}
|
582 |
|
|
583 |
|
String fullIfaceName = null;
|
584 |
|
String fullIfaceBufName = null;
|
585 |
|
String fullImplClassName = null;
|
586 |
|
String sqlTableName = null;
|
|
582 |
|
587 |
583 |
DmoMeta dmoMeta = null;
|
588 |
584 |
Class<? extends DataModelObject> dmoIface = null;
|
589 |
585 |
Class<? extends TempTableBuffer> dmoBufIface = null;
|
... | ... | |
603 |
599 |
clsFieldsORMTo4GL = new HashMap<>();
|
604 |
600 |
|
605 |
601 |
long tableId = tableCounter.getAndIncrement();
|
606 |
|
sqlTableName = "dtt" + tableId;
|
|
602 |
String sqlTableName = "dtt" + tableId;
|
607 |
603 |
|
608 |
604 |
String ifaceName = "DynamicRecord" + tableId;
|
609 |
605 |
|
... | ... | |
639 |
635 |
// generate interface Java ASTs
|
640 |
636 |
results = ConversionPool.runTask(ConversionProfile.JAVA_DMO, root);
|
641 |
637 |
Aast iface = (Aast) results.getStoredObject(DMO_IFACE_CATEGORY, ifaceName);
|
642 |
|
fullIfaceName = DMO_BASE_PACKAGE + "." + DatabaseManager.TEMP_TABLE_SCHEMA + "." + ifaceName;
|
643 |
|
fullIfaceBufName = fullIfaceName + "$Buf";
|
|
638 |
String fullIfaceName = DMO_BASE_PACKAGE + "." + DatabaseManager.TEMP_TABLE_SCHEMA + "." + ifaceName;
|
|
639 |
String fullIfaceBufName = fullIfaceName + "$Buf";
|
644 |
640 |
|
645 |
641 |
// generate bytecode from Java ASTs
|
646 |
642 |
results = ConversionPool.runTask(ConversionProfile.BREW_DMO_ASM, iface);
|
... | ... | |
676 |
672 |
dmoMeta = DmoMetadataManager.registerDmo(dmoIface);
|
677 |
673 |
extractIndexes(dmoMeta, fwdIndexes);
|
678 |
674 |
dmoClass = dmoMeta.getImplementationClass();
|
679 |
|
fullImplClassName = dmoClass.getName();
|
|
675 |
String fullImplClassName = dmoClass.getName();
|
680 |
676 |
classes.put(fullImplClassName, dmoClass);
|
681 |
677 |
|
682 |
678 |
dmoInfo = new DMOInfo(classes.values(), clsFields4GLtoORM, clsFieldsORMTo4GL);
|
... | ... | |
704 |
700 |
if (cacheData != null)
|
705 |
701 |
{
|
706 |
702 |
dmoInfo = cacheData.getDMOInfo();
|
707 |
|
fullIfaceName = cacheData.getDMOIfaceName();
|
708 |
|
fullIfaceBufName = fullIfaceName + "$Buf";
|
709 |
|
fullImplClassName = cacheData.getDMOClassName();
|
710 |
|
sqlTableName = cacheData.getSqlTableName();
|
711 |
|
fwdIndexes = cacheData.getFwdIndices();
|
|
703 |
String fullIfaceName = cacheData.getDMOIfaceName();
|
|
704 |
String fullIfaceBufName = fullIfaceName + "$Buf";
|
712 |
705 |
classes = cacheData.getClasses();
|
713 |
|
clsFields4GLtoORM = dmoInfo.getLegacyToDmoNames();
|
714 |
|
clsFieldsORMTo4GL = dmoInfo.getDmoToLegacyNames();
|
715 |
706 |
dmoIface = (Class<? extends DataModelObject>) classes.get(fullIfaceName);
|
716 |
707 |
dmoBufIface = (Class<? extends TempTableBuffer>) classes.get(fullIfaceBufName);
|
717 |
708 |
dmoMeta = DmoMetadataManager.getDmoInfo(dmoIface);
|
718 |
|
dmoClass = dmoMeta.getImplementationClass();
|
719 |
709 |
}
|
720 |
710 |
|
721 |
711 |
if (local.registerDMOInfo(dmoIface, dmoInfo))
|