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

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


    super.setModuleConfig(moduleConfig);
    this.getRequestScope().put(Globals.MODULE_KEY, moduleConfig);
  }

  public ModuleConfig getModuleConfig() {
    ModuleConfig mc = super.getModuleConfig();

    if (mc == null) {
      mc = (ModuleConfig) this.getRequestScope().get(Globals.MODULE_KEY);
    }
View Full Code Here


  private Map initLookupMap(HttpServletRequest request, Locale userLocale) {
    Map lookupMap = new HashMap();

    this.keyMethodMap = this.getKeyMethodMap();

    ModuleConfig moduleConfig = (ModuleConfig) request.getAttribute(Globals.MODULE_KEY);

    MessageResourcesConfig[] mrc = moduleConfig.findMessageResourcesConfigs();

    // Look through all module's MessageResources
    for (int i = 0; i < mrc.length; i++) {
      MessageResources resources = this.getResources(request, mrc[i].getKey());
View Full Code Here

   *            The ServletContext for this web application
   * @return the ModuleConfig object specified, or null if not found in the
   *         context.
   */
  public ModuleConfig getModuleConfig(String prefix, HttpServletRequest request, ServletContext context) {
    ModuleConfig moduleConfig = null;

    if (prefix != null) {
      // lookup module stored with the given prefix.
      moduleConfig = this.getModuleConfig(prefix, context);
    } else {
View Full Code Here

   * @param context
   *            The ServletContext for this web application
   * @return the ModuleConfig object
   */
  public ModuleConfig getModuleConfig(HttpServletRequest request, ServletContext context) {
    ModuleConfig moduleConfig = this.getModuleConfig(request);

    if (moduleConfig == null) {
      moduleConfig = this.getModuleConfig("", context);
      request.setAttribute(Globals.MODULE_KEY, moduleConfig);
    }
View Full Code Here

   * @param context
   *            The ServletContext for this web application
   */
  public void selectModule(String prefix, HttpServletRequest request, ServletContext context) {
    // Expose the resources for this module
    ModuleConfig config = getModuleConfig(prefix, context);

    if (config != null) {
      request.setAttribute(Globals.MODULE_KEY, config);

      MessageResourcesConfig[] mrConfig = config.findMessageResourcesConfigs();

      for (int i = 0; i < mrConfig.length; i++) {
        String key = mrConfig[i].getKey();
        MessageResources resources = (MessageResources) context.getAttribute(key + prefix);

View Full Code Here

      if (multipartHandler != null) {
        return multipartHandler;
      }
    }

    ModuleConfig moduleConfig = ModuleUtils.getInstance().getModuleConfig(request);

    multipartClass = moduleConfig.getControllerConfig().getMultipartClass();

    // Try to initialize the global request handler
    if (multipartClass != null) {
      try {
        multipartHandler = (MultipartRequestHandler) applicationInstance(multipartClass);
View Full Code Here

    if (pattern.endsWith("/*")) {
      sb.append(pattern.substring(0, pattern.length() - 2));
      sb.append(action.getPath());
    } else if (pattern.startsWith("*.")) {
      ModuleConfig appConfig = ModuleUtils.getInstance().getModuleConfig(request);

      sb.append(appConfig.getPrefix());
      sb.append(action.getPath());
      sb.append(pattern.substring(1));
    } else {
      throw new IllegalArgumentException(pattern);
    }
View Full Code Here

   */
  public boolean execute(ActionContext actionCtx) throws Exception {
    // Are we configured to select Locale automatically?
    LOG.trace("retrieve config...");

    ModuleConfig moduleConfig = actionCtx.getModuleConfig();

    if (!moduleConfig.getControllerConfig().getLocale()) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("module is not configured for a specific locale; " + "nothing to do");
      }

      return (false);
View Full Code Here

      getServletContext().setAttribute(Globals.ACTION_SERVLET_KEY, this);
      initModuleConfigFactory();

      // Initialize modules as needed
      ModuleConfig moduleConfig = initModuleConfig("", config);

      initModuleMessageResources(moduleConfig);
      initModulePlugIns(moduleConfig);
      initModuleFormBeans(moduleConfig);
      initModuleForwards(moduleConfig);
      initModuleExceptionConfigs(moduleConfig);
      initModuleActions(moduleConfig);
      moduleConfig.freeze();

      Enumeration names = getServletConfig().getInitParameterNames();

      while (names.hasMoreElements()) {
        String name = (String) names.nextElement();

        if (!name.startsWith(configPrefix)) {
          continue;
        }

        String prefix = name.substring(configPrefixLength);

        moduleConfig = initModuleConfig(prefix, getServletConfig().getInitParameter(name));
        initModuleMessageResources(moduleConfig);
        initModulePlugIns(moduleConfig);
        initModuleFormBeans(moduleConfig);
        initModuleForwards(moduleConfig);
        initModuleExceptionConfigs(moduleConfig);
        initModuleActions(moduleConfig);
        moduleConfig.freeze();
      }

      this.initModulePrefixes(this.getServletContext());

      this.destroyConfigDigester();
View Full Code Here

      if (!(value instanceof ModuleConfig)) {
        continue;
      }

      ModuleConfig config = (ModuleConfig) value;

      if (this.getProcessorForModule(config) != null) {
        this.getProcessorForModule(config).destroy();
      }

      getServletContext().removeAttribute(name);

      PlugIn[] plugIns = (PlugIn[]) getServletContext().getAttribute(Globals.PLUG_INS_KEY + config.getPrefix());

      if (plugIns != null) {
        for (int i = 0; i < plugIns.length; i++) {
          int j = plugIns.length - (i + 1);

          plugIns[j].destroy();
        }

        getServletContext().removeAttribute(Globals.PLUG_INS_KEY + config.getPrefix());
      }
    }
  }
View Full Code Here

TOP

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

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.