Package org.apache.fulcrum.parser

Examples of org.apache.fulcrum.parser.ParameterParser


                .append(" within the screen.")
                .append("<p>")
                .append("Please click ");

        message.addElement(sb.toString());
        ParameterParser pp;
        pp = (ParameterParser) data.getUser().getTemp("prev_parameters");
        pp.remove("_session_access_counter");

        TurbineURI back = new TurbineURI(data,(String) data.getUser().getTemp("prev_screen"));
        back.addPathInfo(pp);
        message.addElement(new A().setHref(back.getRelativeLink()).addElement("here"));
View Full Code Here


      throws Exception
  {
    // Name of the button.
    String theButton = null;
    // Parameter parser.
    ParameterParser pp = data.getParameters();

    String button = pp.convert(BUTTON);
    String key = null;

    // Loop through and find the button.
    for (Iterator it = pp.keySet().iterator(); it.hasNext();)
    {
      key = (String) it.next();
      if (key.startsWith(button))
      {
        if (considerKey(key, pp))
        {
          theButton = formatString(key, pp);
          break;
        }
      }
    }

    if (theButton == null)
    {
      throw new NoSuchMethodException("ActionEvent: The button was null");
    }

    Method method = null;

    try
    {
      method = getClass().getMethod(theButton, methodParams);
      Object[] methodArgs = new Object[] { data };

      if (log.isDebugEnabled())
      {
        log.debug("Invoking " + method);
      }

      method.invoke(this, methodArgs);
    }
    catch (InvocationTargetException ite)
    {
      Throwable t = ite.getTargetException();
      log.error("Invokation of " + method , t);
    }
    finally
    {
      pp.remove(key);
    }
  }
View Full Code Here

      RunData data = getRunData(pipelineData);

    // Name of the button.
    String theButton = null;
    // Parameter parser.
    ParameterParser pp = data.getParameters();

    String button = pp.convert(BUTTON);
    String key = null;

    // Loop through and find the button.
    for (Iterator it = pp.keySet().iterator(); it.hasNext();)
    {
      key = (String) it.next();
      if (key.startsWith(button))
      {
        if (considerKey(key, pp))
        {
          theButton = formatString(key, pp);
          break;
        }
      }
    }

    if (theButton == null)
    {
      throw new NoSuchMethodException("ActionEvent: The button was null");
    }

    Method method = null;

    try
    {
      method = getClass().getMethod(theButton, methodParams);
      Object[] methodArgs = new Object[] { pipelineData };

      if (log.isDebugEnabled())
      {
        log.debug("Invoking " + method);
      }

      method.invoke(this, methodArgs);
    }
    catch (InvocationTargetException ite)
    {
      Throwable t = ite.getTargetException();
      log.error("Invokation of " + method , t);
    }
    finally
    {
      pp.remove(key);
    }
  }
View Full Code Here

    {
        // Name of the button.
        String theButton = null;

        // ParameterParser.
        ParameterParser pp = data.getParameters();

        String button = pp.convert(BUTTON);
        String key = null;

        // Loop through and find the button.
        for (Iterator it = pp.keySet().iterator(); it.hasNext();)
        {
            key = (String) it.next();
            if (key.startsWith(button))
            {
                if (considerKey(key, pp))
                {
                    theButton = formatString(key, pp);
                    break;
                }
            }
        }

        if (theButton == null)
        {
            throw new NoSuchMethodException(
                    "ActionEvent: The button was null");
        }

        Method method = null;
        try
        {
            method = getClass().getMethod(theButton, methodParams);
            Object[] methodArgs = new Object[] { data, context };

            if (log.isDebugEnabled())
            {
                log.debug("Invoking " + method);
            }

            method.invoke(this, methodArgs);
        }
        catch (NoSuchMethodException nsme)
        {
            // Attempt to execute things the old way..
            if (log.isDebugEnabled())
            {
                log.debug("Couldn't locate the Event ( " + theButton
                        + "), running executeEvents() in "
                        + super.getClass().getName());
            }

            super.executeEvents(data);
        }
        catch (InvocationTargetException ite)
        {
            Throwable t = ite.getTargetException();
            log.error("Invokation of " + method , t);
            throw ite;
        }
        finally
        {
            pp.remove(key);
        }
    }
View Full Code Here

      RunData data = getRunData(pipelineData);
        // Name of the button.
        String theButton = null;

        // ParameterParser.
        ParameterParser pp = data.getParameters();

        String button = pp.convert(BUTTON);
        String key = null;

        // Loop through and find the button.
        for (Iterator it = pp.keySet().iterator(); it.hasNext();)
        {
            key = (String) it.next();
            if (key.startsWith(button))
            {
                if (considerKey(key, pp))
                {
                    theButton = formatString(key, pp);
                    break;
                }
            }
        }

        if (theButton == null)
        {
            throw new NoSuchMethodException(
                    "ActionEvent: The button was null");
        }

        Method method = null;
        try
        {
            method = getClass().getMethod(theButton, methodParams);
            Object[] methodArgs = new Object[] { pipelineData, context };

            if (log.isDebugEnabled())
            {
                log.debug("Invoking " + method);
            }

            method.invoke(this, methodArgs);
        }
        catch (NoSuchMethodException nsme)
        {
            // Attempt to execute things the old way..
            if (log.isDebugEnabled())
            {
                log.debug("Couldn't locate the Event ( " + theButton
                        + "), running executeEvents() in "
                        + super.getClass().getName());
            }

            super.executeEvents(pipelineData);
        }
        catch (InvocationTargetException ite)
        {
            Throwable t = ite.getTargetException();
            log.error("Invokation of " + method , t);
            throw ite;
        }
        finally
        {
            pp.remove(key);
        }
    }
View Full Code Here

        Class<?> runDataClazz = Class.forName(cfg[0]);
        Class<?> parameterParserClazz = Class.forName(cfg[1]);
        Class<?> cookieParserClazz = Class.forName(cfg[2]);

            data = (TurbineRunData) pool.getInstance(runDataClazz);
            ParameterParser pp = (ParameterParser) parserService.getParser(parameterParserClazz);
            data.setParameterParser(pp);
            CookieParser cp = (CookieParser) parserService.getParser(cookieParserClazz);
            data.setCookieParser(cp);
            // also copy data directly into pipelineData
            pipelineDataMap.put(ParameterParser.class, pp);
View Full Code Here

     *
     * @return the valid flag
     */
    public boolean validate()
    {
        ParameterParser pp = (ParameterParser) super.parser;
        if (isMultiValued)
        {
            FileItem[] ss = pp.getFileItems(getKey());
            // this definition of not set might need refined.  But
            // not sure the situation will arise.
            if (ss.length == 0)
            {
                setFlag = false;
            }

            if (validator != null)
            {
                for (int i = 0; i < ss.length; i++)
                {
                    try
                    {
                        ((FileValidator) validator).assertValidity(ss[i]);
                    }
                    catch (ValidationException ve)
                    {
                        setMessage(ve.getMessage());
                    }
                }
            }

            if (setFlag && validFlag)
            {
                doSetValue();
            }
        }
        else
        {
            FileItem s = pp.getFileItem(getKey());
            if (s == null || s.getSize() == 0)
            {
                setFlag = false;
            }

View Full Code Here

    /**
     * Sets the value of the field from data in the parser.
     */
    protected void doSetValue()
    {
        ParameterParser pp = (ParameterParser) super.parser;
        if (isMultiValued)
        {
            setTestValue(pp.getFileItems(getKey()));
        }
        else
        {
            setTestValue(pp.getFileItem(getKey()));
        }
    }
View Full Code Here

        assertEquals("/context/servlet/turbine", turi.getRelativeLink());
    }

    public void testAddEmptyParameterParser()
    {
        ParameterParser pp = new DefaultParameterParser();
        turi.add(1, pp); // 1 = query data
        assertEquals("/context/servlet/turbine", turi.getRelativeLink());
    }
View Full Code Here

        assertEquals("/context/servlet/turbine", turi.getRelativeLink());
    }

    public void testAddParameterParser() throws InstantiationException
    {
        ParameterParser pp = (ParameterParser) parserService.getParser(DefaultParameterParser.class);
        pp.add("test", "");
        turi.add(1, pp); // 1 = query data
        assertEquals("/context/servlet/turbine?test=", turi.getRelativeLink());
        turi.removeQueryData("test");
        assertEquals("/context/servlet/turbine", turi.getRelativeLink());
       
        parserService.putParser(pp);
        pp = (ParameterParser) parserService.getParser(DefaultParameterParser.class);
        pp.add("test", (String) null);
        turi.add(1, pp); // 1 = query data
        // Should make the following work so as to be consistent with directly
        // added values.
        // assertEquals("/context/servlet/turbine?test=null",
        // turi.getRelativeLink());
View Full Code Here

TOP

Related Classes of org.apache.fulcrum.parser.ParameterParser

Copyright © 2018 www.massapicom. 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.