Examples of ParamConfig


Examples of de.odysseus.calyxo.control.conf.ParamConfig

   */
  void removeFormData(HttpServletRequest request, FilterConfig filterConfig) throws Exception {
    if (filterConfig == null) {
      return;
    }
    ParamConfig attribute = filterConfig.getParamConfig("attribute");
    if (attribute != null) {
      ParamConfig scope = filterConfig.getParamConfig("scope");
      if (scope == null || "session".equals(scope.getValue())) {
        request.getSession().removeAttribute(attribute.getValue());
      } else if ("request".equals(scope.getValue())) {
        request.removeAttribute(attribute.getValue());
      } else {
        throw new ConfigException("Bad scope '" +  scope.getValue() + "' in " + filterConfig.toInlineString());
      }
    }
  }
View Full Code Here

Examples of de.odysseus.calyxo.control.conf.ParamConfig

   */
  public void init(PluginConfig config, PluginContext context) throws ConfigException {
    log.trace("init() start");

    module = context.getModuleContext();
    ParamConfig param = config.getParamConfig("config");
    if (param == null) {
      throw new ConfigException("Missing parameter 'config' in " + config.toInlineString());
    }
    service.init(module, param.getValue());

    Dispatcher dispatcher = new PanelsDispatcher(module);
    context.setDispatcher("panels", dispatcher);
   
    param = config.getParamConfig("global");
    if (param != null && "true".equals(param.getValue())) {
      context.setDefaultDispatcher(dispatcher);
    }

    AccessSupport access = AccessSupport.getInstance(module);
    access.put("panels", new PanelsAccessor(module));
View Full Code Here

Examples of de.odysseus.calyxo.control.conf.ParamConfig

    formsSupport = (FormsSupport)FormsSupport.getInstance(context);
    if (formsSupport == null) {
      throw new ConfigException("No forms support! Forms plugin loaded?");
    }
    dispatch = config.getDispatchConfig(null);
    ParamConfig param = config.getParamConfig("dispatch");
    if ((param == null) == (dispatch == null)) {
      throw new ConfigException("One of 'dispatch' parameter or anonymous <dispatch> child must be given for filter '" + config.toInlineString() + "'");
    }
    if (dispatch == null) {
      dispatch = config.getActionConfig().findDispatchConfig(param.getValue());
      if (dispatch == null) {
        throw new ConfigException("Cannot find dispatch '" + param.getValue() + "' for filter '" + config.toInlineString() + "'");
      }
    }
    messageSupport = MessageSupport.getInstance(context);
    param = config.getParamConfig("commit");
    if (param == null) {
        commit = false;
    } else {
        try {
            commit = ((Boolean)ParseUtils.parse(Boolean.class, param.getValue())).booleanValue();
        } catch (Exception e) {
        throw new ConfigException("Bad commit value '" + param.getValue() + "' in " + config.toInlineString());
        }
    }
    formsSupport.add(config);
    this.config = config;
  }
View Full Code Here

Examples of de.odysseus.calyxo.control.conf.ParamConfig

  public void init(PluginConfig config, PluginContext context) throws ConfigException {
    log.trace("init() start");

    module = context.getModuleContext();

    ParamConfig param = config.getParamConfig("default-class");
    Class dataClass = null;
    if (param != null) {
      try {
        dataClass = module.getClassLoader().loadClass(param.getValue());
      } catch (Exception e) {
        throw new ConfigException("Could not load data class in " + config.toInlineString(), e);
      }
    }
    String factoryClass = DEFAULT_FACTORY;
    param = config.getParamConfig("factory-class");
    if (param != null) {
      factoryClass = param.getValue();
    }
    FormFactory factory = null;
    try {
      factory = (FormFactory)module.getClassLoader().loadClass(factoryClass).newInstance();
    } catch (Exception e) {
      throw new ConfigException("Could not create form factory in " + config.toInlineString(), e);
    }
    factory.init(module);
    param = config.getParamConfig("config");
    if (param == null) {
      throw new ConfigException("Missing parameter 'config' in " + config.toInlineString());
    }
    FormsSupport support = new FormsSupport(module.getClassLoader(), dataClass);
    service.init(module, support, factory, param.getValue());

    context.setFilterClass("forms", FormsFilter.class);

    AccessSupport access = AccessSupport.getInstance(module);
    access.put("forms", new FormsAccessor(module));
View Full Code Here

Examples of de.odysseus.calyxo.panels.conf.ParamConfig

      }
      return result;
    }

    ParamConfig lookupParamConfig(String name) {
      ParamConfig result = item.getParamConfig(name);
      if (result == null && previous != null) {
        result = previous.lookupParamConfig(name);
      }
      return result;
    }
View Full Code Here

Examples of de.odysseus.calyxo.panels.conf.ParamConfig

    PanelConfig test = context.lookupPanelConfig("test");
    assertNotNull(test);

    context.push(test); // --> /panel

    ParamConfig param = context.lookupParamConfig("param");
    assertNotNull(param);
    assertEquals("test.param", param.getValue());

    PanelConfig panel = context.lookupPanelConfig("panel");
    assertNotNull(panel);
    context.push(panel); // --> /panel/panel
    param = context.lookupParamConfig("param");
    assertNotNull(param);
    assertEquals("test.panel.param", param.getValue());
    context.pop(); // --> /panel

    ListConfig list = context.lookupListConfig("list");
    assertNotNull(list);
    Iterator items = list.getItemConfigs();
    assertTrue(items.hasNext());
    ItemConfig item = (ItemConfig)items.next();
    context.push(item); // --> /panel/item

    param = context.lookupParamConfig("param");
    assertNotNull(param);
    assertEquals("test.item.param", param.getValue());

    panel = context.lookupPanelConfig("panel");
    assertNotNull(panel);
    context.push(panel); // --> /panel/item/panel
    param = context.lookupParamConfig("param");
    assertNotNull(param);
    assertEquals("test.item.panel.param", param.getValue());
    context.pop(); // --> /panel/item

    context.pop(); // --> /panel

    assertTrue(items.hasNext());
    item = (ItemConfig)items.next();
    context.push(item); // --> /panel/item

    param = context.lookupParamConfig("param");
    assertNotNull(param);
    assertEquals("test.param", param.getValue());

    panel = context.lookupPanelConfig("panel");
    assertNotNull(panel);
    context.push(panel); // --> /panel/item/panel
    param = context.lookupParamConfig("param");
    assertNotNull(param);
    assertEquals("test.panel.param", param.getValue());
    context.pop(); // --> /panel/item

    context.pop(); // --> /panel

    context.pop(); // --> /
View Full Code Here

Examples of de.odysseus.calyxo.panels.conf.ParamConfig

    /**
     * Lookup parameter.
     */
    protected Object get(HttpServletRequest request, Object key) {
      PanelsContext context = support.getContext(request);
      ParamConfig param = context.lookupParamConfig(key.toString());
      if (param == null) {
        throw new AccessException("Unknown panel parameter '" + key + "'");
      }
      if (!param.isDefined()) {
        throw new AccessException("Undefined value for panel parameter '" + key + "'");
      }
      return param.getValue();
    }
View Full Code Here

Examples of de.odysseus.calyxo.panels.conf.ParamConfig

  /**
   * Search receiver and generalizations for a contained param with
   * given name
   */
  ParamConfig findParamConfigByGeneralization(String name) {
    ParamConfig param = getParamConfig(name);
    if (param == null && generalizedPanel != null) {
      param = generalizedPanel.findParamConfigByGeneralization(name);
    }
    return param;
  }
View Full Code Here

Examples of de.odysseus.calyxo.panels.conf.ParamConfig

   * @see de.odysseus.calyxo.panels.conf.PanelConfig#findParamConfig(java.lang.String, java.util.Locale)
   */
  public ParamConfig findParamConfig(String name, Locale locale) {
    PanelConfigImpl panel = this;
    while (panel != null) {
      ParamConfig result = panel.findParamConfigByGeneralization(name);
      if (result != null) {
        return result;
      }
      panel = panel.lookupBase(locale);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.