public LabelReferences(Delegator delegator, LabelManagerFactory factory) { this.delegator = delegator; this.labels = factory.getLabels(); DelegatorElement delegatorInfo = null; try { delegatorInfo = EntityConfigUtil.getDelegator(delegator.getDelegatorBaseName()); } catch (GenericEntityConfException e) { Debug.logWarning(e, "Exception thrown while getting delegator config: ", module); } String modelName; if (delegatorInfo != null) { modelName = delegatorInfo.getEntityModelReader(); } else { modelName = "main"; } // since we do not associate a dispatcher to this DispatchContext, it is important to set a name // of an existing entity model reader: // in this way it will be possible to retrieve the service models from the cache this.dispatchContext = new DispatchContext(modelName, this.getClass().getClassLoader(), null); Collection<LabelInfo> infoList = this.labels.values(); for (LabelInfo labelInfo : infoList) { this.labelSet.add(labelInfo.getLabelKey()); } Collection<ComponentConfig> componentConfigs = ComponentConfig.getAllComponents(); for (ComponentConfig config : componentConfigs) { String rootFolder = config.getRootLocation(); rootFolder = rootFolder.replace('\\', '/'); if (!rootFolder.endsWith("/")) { rootFolder = rootFolder + "/"; } this.rootFolders.add(rootFolder); } }
public ModelReader(String modelName) throws GenericEntityException { this.modelName = modelName; entityResourceHandlers = FastList.newInstance(); resourceHandlerEntities = FastMap.newInstance(); entityResourceHandlerMap = FastMap.newInstance(); EntityModelReaderInfo entityModelReaderInfo = EntityConfigUtil.getEntityModelReaderInfo(modelName); if (entityModelReaderInfo == null) { throw new GenericEntityConfException( "Cound not find an entity-model-reader with the name " + modelName); } // get all of the main resource model stuff, ie specified in the entityengine.xml file for (Element resourceElement : entityModelReaderInfo.resourceElements) { ResourceHandler handler = new MainResourceHandler(EntityConfigUtil.ENTITY_ENGINE_XML_FILENAME, resourceElement); entityResourceHandlers.add(handler); } // get all of the component resource model stuff, ie specified in each ofbiz-component.xml file for (ComponentConfig.EntityResourceInfo componentResourceInfo : ComponentConfig.getAllEntityResourceInfos("model")) { if (modelName.equals(componentResourceInfo.readerName)) { entityResourceHandlers.add(componentResourceInfo.createResourceHandler()); } } }
protected static void readConfig( String entityEcaReaderName, Map<String, Map<String, List<EntityEcaRule>>> ecaCache) { EntityEcaReaderInfo entityEcaReaderInfo = EntityConfigUtil.getEntityEcaReaderInfo(entityEcaReaderName); if (entityEcaReaderInfo == null) { Debug.logError( "BAD ERROR: Could not find entity-eca-reader config with name: " + entityEcaReaderName, module); return; } for (Element eecaResourceElement : entityEcaReaderInfo.resourceElements) { ResourceHandler handler = new MainResourceHandler(EntityConfigUtil.ENTITY_ENGINE_XML_FILENAME, eecaResourceElement); addEcaDefinitions(handler, ecaCache); } // get all of the component resource eca stuff, ie specified in each ofbiz-component.xml file for (ComponentConfig.EntityResourceInfo componentResourceInfo : ComponentConfig.getAllEntityResourceInfos("eca")) { if (entityEcaReaderName.equals(componentResourceInfo.readerName)) { addEcaDefinitions(componentResourceInfo.createResourceHandler(), ecaCache); } } }