Package org.g4studio.core.mvc.xstruts.config

Examples of org.g4studio.core.mvc.xstruts.config.ActionConfig


   *
   * @param path
   *            Path of the action configuration to return
   */
  public ActionConfig findActionConfig(String path) {
    ActionConfig config = (ActionConfig) actionConfigs.get(path);

    // If a direct match cannot be found, try to match action configs
    // containing wildcard patterns only if a matcher exists.
    if ((config == null) && (matcher != null)) {
      config = matcher.match(path);
View Full Code Here


    // Process ActionConfig extensions.
    ActionConfig[] actionConfigs = config.findActionConfigs();

    for (int i = 0; i < actionConfigs.length; i++) {
      ActionConfig actionConfig = actionConfigs[i];

      processActionConfigExtension(actionConfig, config);
    }

    for (int i = 0; i < actionConfigs.length; i++) {
      ActionConfig actionConfig = actionConfigs[i];

      // Verify that required fields are all present for the forward
      // configs
      ForwardConfig[] forwards = actionConfig.findForwardConfigs();

      for (int j = 0; j < forwards.length; j++) {
        ForwardConfig forward = forwards[j];

        if (forward.getPath() == null) {
          handleValueRequiredException("path", forward.getName(), "action forward");
        }
      }

      // ... and the exception configs
      ExceptionConfig[] exceptions = actionConfig.findExceptionConfigs();

      for (int j = 0; j < exceptions.length; j++) {
        ExceptionConfig exception = exceptions[j];

        if (exception.getKey() == null) {
View Full Code Here

   *            A valid ActionContext
   * @return a <code>Command</code> to execute, or null if none is specified
   *         or if the specified command cannot be found.
   */
  protected Command getCommand(ActionContext context) {
    ActionConfig actionConfig = context.getActionConfig();

    String commandName = actionConfig.getCommand();

    if (commandName == null) {
      return null;
    }

    String catalogName = actionConfig.getCatalog();

    return getCommand(commandName, catalogName);
  }
View Full Code Here

      // Nothing to do, then
      return actionConfig;
    }

    // Make sure that this config is of the right class
    ActionConfig baseConfig = moduleConfig.findActionConfig(ancestor);

    if (baseConfig == null) {
      throw new UnavailableException("Unable to find " + "action config for '" + ancestor + "' to extend.");
    }

    // Was our actionConfig's class overridden already?
    if (actionConfig.getClass().equals(ActionMapping.class)) {
      // Ensure that our config is using the correct class
      if (!baseConfig.getClass().equals(actionConfig.getClass())) {
        // Replace the config with an instance of the correct class
        ActionConfig newActionConfig = null;
        String baseConfigClassName = baseConfig.getClass().getName();

        try {
          newActionConfig = (ActionConfig) RequestUtils.applicationInstance(baseConfigClassName);

          // copy the values
          BeanUtils.copyProperties(newActionConfig, actionConfig);

          // copy the forward and exception configs, too
          ForwardConfig[] forwards = actionConfig.findForwardConfigs();

          for (int i = 0; i < forwards.length; i++) {
            newActionConfig.addForwardConfig(forwards[i]);
          }

          ExceptionConfig[] exceptions = actionConfig.findExceptionConfigs();

          for (int i = 0; i < exceptions.length; i++) {
            newActionConfig.addExceptionConfig(exceptions[i]);
          }
        } catch (Exception e) {
          handleCreationException(baseConfigClassName, e);
        }
View Full Code Here

   * @throws Exception
   *             if authorization fails
   */
  public boolean execute(ActionContext actionCtx) throws Exception {
    // Retrieve ActionConfig
    ActionConfig actionConfig = actionCtx.getActionConfig();

    // Is this action protected by role requirements?
    if (!isAuthorizationRequired(actionConfig)) {
      return (false);
    }

    boolean throwEx;

    try {
      throwEx = !(isAuthorized(actionCtx, actionConfig.getRoleNames(), actionConfig));
    } catch (Exception ex) {
      throwEx = true;
      LOG.error("Unable to complete authorization process", ex);
    }

View Full Code Here

    if (actionForm == null) {
      return false;
    }

    // Is validation disabled on this request?
    ActionConfig actionConfig = actionCtx.getActionConfig();

    if (!actionConfig.getValidate()) {
      return false;
    }

    // Was this request cancelled?
    if (isCancelled(actionCtx, actionConfig)) {
View Full Code Here

    if ((valid == null) || !valid.booleanValue()) {
      return (false);
    }

    // Acquire configuration objects that we need
    ActionConfig actionConfig = actionCtx.getActionConfig();
    ModuleConfig moduleConfig = actionConfig.getModuleConfig();

    ForwardConfig forwardConfig = null;
    String forward = actionConfig.getForward();

    if (forward != null) {
      forwardConfig = forward(actionCtx, moduleConfig, forward);

      if (LOG.isDebugEnabled()) {
View Full Code Here

      return (true);
    }

    // Look up the local or global exception handler configuration
    ExceptionConfig exceptionConfig = null;
    ActionConfig actionConfig = actionCtx.getActionConfig();
    ModuleConfig moduleConfig = actionCtx.getModuleConfig();

    if (actionConfig != null) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("See if actionConfig " + actionConfig + " has an exceptionConfig for "
            + exception.getClass().getName());
      }

      exceptionConfig = actionConfig.findException(exception.getClass());
    } else if (moduleConfig != null) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("No action yet, see if moduleConfig " + moduleConfig + " has an exceptionConfig "
            + exception.getClass().getName());
      }
View Full Code Here

    // Identify the matching path for this request
    String path = getPath(actionCtx);

    // Cache the corresponding ActonConfig instance
    ModuleConfig moduleConfig = actionCtx.getModuleConfig();
    ActionConfig actionConfig = moduleConfig.findActionConfig(path);

    if (actionConfig == null) {
      // NOTE Shouldn't this be the responsibility of ModuleConfig?
      // Locate the mapping for unknown paths (if any)
      ActionConfig[] configs = moduleConfig.findActionConfigs();
View Full Code Here

   * @throws Exception
   *             on any error
   */
  public boolean execute(ActionContext actionCtx) throws Exception {
    // Is there a form bean associated with this ActionConfig?
    ActionConfig actionConfig = actionCtx.getActionConfig();
    String name = actionConfig.getName();

    if (name == null) {
      actionCtx.setActionForm(null);

      return (false);
    }

    if (LOG.isTraceEnabled()) {
      LOG.trace("Look up form-bean " + name);
    }

    // Look up the corresponding FormBeanConfig (if any)
    FormBeanConfig formBeanConfig = actionConfig.getModuleConfig().findFormBeanConfig(name);

    if (formBeanConfig == null) {
      LOG.warn("No FormBeanConfig found in module " + actionConfig.getModuleConfig().getPrefix() + " under name "
          + name);
      actionCtx.setActionForm(null);

      return (false);
    }

    Map scope = actionCtx.getScope(actionConfig.getScope());

    ActionForm instance;

    instance = (ActionForm) scope.get(actionConfig.getAttribute());

    // Can we recycle the existing instance (if any)?
    if (!formBeanConfig.canReuse(instance)) {
      instance = formBeanConfig.createActionForm(actionCtx);
    }

    // TODO: Remove ServletActionContext when ActionForm no longer
    // directly depends on ActionServlet
    if (actionCtx instanceof ServletActionContext) {
      // The servlet property of ActionForm is transient, so
      // ActionForms which are restored from a serialized state
      // need to have their servlet restored.
      ServletActionContext sac = (ServletActionContext) actionCtx;

      instance.setServlet(sac.getActionServlet());
    }

    actionCtx.setActionForm(instance);

    scope.put(actionConfig.getAttribute(), instance);

    return (false);
  }
View Full Code Here

TOP

Related Classes of org.g4studio.core.mvc.xstruts.config.ActionConfig

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.