Exemple #1
0
 public <C> C loadSettingValue(Setting<C> setting) {
   String v =
       null; // TODO SystemProperties.getComponentProperty(setting.getComponent().getName(),
             // setting.getName());
   if (v != null) {
     return setting.getDataType().cast(v, null, null);
   }
   return null;
 }
Exemple #2
0
 @SuppressWarnings("unchecked")
 @Override
 public <C> C getSettingValue(Setting<C> setting, Parameters parameters) {
   boolean useSession = parameters != null && parameters.get(USE_REQ);
   if (useSession) {
     HttpServletRequest req = parameters.get(Parameter.REQUEST);
     if (req != null) {
       Object v = req.getSession(true).getAttribute(getKey(setting));
       if (v != null) {
         return setting.getDataType().cast(v, null, null);
       }
     }
   }
   if (settingValues.containsKey(setting)) {
     return (C) settingValues.get(setting);
   } else {
     C settingValue = loadSettingValue(setting);
     if (settingValue != null) {
       settingValues.put(setting, settingValue);
       return settingValue;
     }
     return setting.getDataType().getDefaultValue();
   }
 }
Exemple #3
0
 protected String getKey(Setting<?> setting) {
   return "org.mmbase.framework." + setting.getComponent().getName() + "." + setting.getName();
 }