Пример #1
0
 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);
   }
 }