本文整理汇总了Java中org.ofbiz.entity.config.model.DelegatorElement.getEntityModelReader方法的典型用法代码示例。如果您正苦于以下问题:Java DelegatorElement.getEntityModelReader方法的具体用法?Java DelegatorElement.getEntityModelReader怎么用?Java DelegatorElement.getEntityModelReader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.ofbiz.entity.config.model.DelegatorElement
的用法示例。
在下文中一共展示了DelegatorElement.getEntityModelReader方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getModelReader
import org.ofbiz.entity.config.model.DelegatorElement; //导入方法依赖的package包/类
public static ModelReader getModelReader(String delegatorName) throws GenericEntityException {
DelegatorElement delegatorInfo = EntityConfig.getInstance().getDelegator(delegatorName);
if (delegatorInfo == null) {
throw new GenericEntityConfException("Could not find a delegator with the name " + delegatorName);
}
String tempModelName = delegatorInfo.getEntityModelReader();
ModelReader reader = readers.get(tempModelName);
if (reader == null) {
reader = new ModelReader(tempModelName);
// preload caches...
reader.getEntityCache();
reader = readers.putIfAbsentAndGet(tempModelName, reader);
}
return reader;
}
示例2: ArtifactInfoFactory
import org.ofbiz.entity.config.model.DelegatorElement; //导入方法依赖的package包/类
protected ArtifactInfoFactory(String delegatorName) throws GeneralException {
this.delegatorName = delegatorName;
this.entityModelReader = ModelReader.getModelReader(delegatorName);
DelegatorElement delegatorInfo = EntityConfig.getInstance().getDelegator(delegatorName);
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);
this.prepareAll();
}
示例3: getModelReader
import org.ofbiz.entity.config.model.DelegatorElement; //导入方法依赖的package包/类
public static ModelReader getModelReader(String delegatorName) throws GenericEntityException {
DelegatorElement delegatorInfo = EntityConfigUtil.getDelegator(delegatorName);
if (delegatorInfo == null) {
throw new GenericEntityConfException("Could not find a delegator with the name " + delegatorName);
}
String tempModelName = delegatorInfo.getEntityModelReader();
ModelReader reader = readers.get(tempModelName);
if (reader == null) {
reader = new ModelReader(tempModelName);
// preload caches...
reader.getEntityCache();
reader = readers.putIfAbsentAndGet(tempModelName, reader);
}
return reader;
}
示例4: ArtifactInfoFactory
import org.ofbiz.entity.config.model.DelegatorElement; //导入方法依赖的package包/类
protected ArtifactInfoFactory(String delegatorName) throws GeneralException {
this.delegatorName = delegatorName;
this.entityModelReader = ModelReader.getModelReader(delegatorName);
DelegatorElement delegatorInfo = EntityConfigUtil.getDelegator(delegatorName);
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);
this.prepareAll();
}
示例5: DispatchContext
import org.ofbiz.entity.config.model.DelegatorElement; //导入方法依赖的package包/类
/**
* Creates new DispatchContext as an immutable object.
* The "dispatcher" argument can be null if the "name" argument matches the name of a valid entity model reader.
* The thread safety of a DispatchContext object is a consequence of its immutability.
*
* @param name The immutable name of the DispatchContext
* @param loader The immutable class loader
* @param dispatcher The immutable dispatcher associated to the DispatchContext
*
*/
public DispatchContext(String name, ClassLoader loader, LocalDispatcher dispatcher) {
this.name = name;
this.loader = loader;
this.dispatcher = dispatcher;
String modelName = null;
if (this.dispatcher != null) {
Delegator delegator = dispatcher.getDelegator();
if (delegator != null) {
DelegatorElement delegatorInfo = null;
try {
delegatorInfo = EntityConfig.getInstance().getDelegator(delegator.getDelegatorBaseName());
} catch (GenericEntityConfException e) {
Debug.logWarning(e, "Exception thrown while getting delegator config: ", module);
}
if (delegatorInfo != null) {
modelName = delegatorInfo.getEntityModelReader();
}
}
}
if (modelName == null) {
// if a modelName is not associated to the dispatcher (e.g. dispatcher is null) then use the name
// of the DispatchContext as the model reader name
modelName = name;
}
this.model = modelName;
getGlobalServiceMap();
}
示例6: LabelReferences
import org.ofbiz.entity.config.model.DelegatorElement; //导入方法依赖的package包/类
public LabelReferences(Delegator delegator, LabelManagerFactory factory) {
this.delegator = delegator;
this.labels = factory.getLabels();
DelegatorElement delegatorInfo = null;
try {
delegatorInfo = EntityConfig.getInstance().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);
}
}
示例7: DispatchContext
import org.ofbiz.entity.config.model.DelegatorElement; //导入方法依赖的package包/类
/**
* Creates new DispatchContext as an immutable object.
* The "dispatcher" argument can be null if the "name" argument matches the name of a valid entity model reader.
* The thread safety of a DispatchContext object is a consequence of its immutability.
*
* @param name The immutable name of the DispatchContext
* @param loader The immutable class loader
* @param dispatcher The immutable dispatcher associated to the DispatchContext
*
*/
public DispatchContext(String name, ClassLoader loader, LocalDispatcher dispatcher) {
this.name = name;
this.loader = loader;
this.dispatcher = dispatcher;
String modelName = null;
if (this.dispatcher != null) {
Delegator delegator = dispatcher.getDelegator();
if (delegator != null) {
DelegatorElement delegatorInfo = null;
try {
delegatorInfo = EntityConfigUtil.getDelegator(delegator.getDelegatorBaseName());
} catch (GenericEntityConfException e) {
Debug.logWarning(e, "Exception thrown while getting delegator config: ", module);
}
if (delegatorInfo != null) {
modelName = delegatorInfo.getEntityModelReader();
}
}
}
if (modelName == null) {
// if a modelName is not associated to the dispatcher (e.g. dispatcher is null) then use the name
// of the DispatchContext as the model reader name
modelName = name;
}
this.model = modelName;
getGlobalServiceMap();
}
示例8: LabelReferences
import org.ofbiz.entity.config.model.DelegatorElement; //导入方法依赖的package包/类
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);
}
}