Package org.megatome.frame2.validator

Examples of org.megatome.frame2.validator.TestCommonsFieldValidator


    static private Logger getDefault(String name) {
        Logger result = null;

        if (STD_LOGGING_AVAILABLE) {
            try {
                result = new StandardLogger(name);
            } catch (Throwable t) {
                STD_LOGGING_AVAILABLE = false;
            }
        }
View Full Code Here


                STD_LOGGING_AVAILABLE = false;
            }
        }

        if (result == null) {
            result = new StdoutLogger(name);
        }

        return result;
    }
View Full Code Here

      pluginDef.setName("PluginName"); //$NON-NLS-1$
      pluginDef.setType("PluginType"); //$NON-NLS-1$
      Map<String, String> testParams = new HashMap<String, String>();
      testParams.put("param1", "value1"); //$NON-NLS-1$ //$NON-NLS-2$
      pluginDef.setInitParams(testParams);
      MockPluginInterface mockPlugin = new MockPluginInterface(100);
     
      this.proxy = new PluginProxy(pluginDef, mockPlugin);
   }
View Full Code Here

   public MockPluginInterface(int startIndex) {
       this.state = startIndex;
   }

  public void destroy(ServletContext context, Map<String, String> initParams) throws PluginException {
     if (context == null) throw new PluginException("Plugin Init Exception"); //$NON-NLS-1$
     if (initParams.get("throwsDestroyParam") != null){ //$NON-NLS-1$
         this.state = STATE_THROW; // value if throw
         throw new PluginException("got throwsDestoryParam, throw for test"); //$NON-NLS-1$
     }
     this.state = STATE_DESTROY;
  }
View Full Code Here

     }
     this.state = STATE_DESTROY;
  }

  public void init(ServletContext context, Map<String, String> initParams) throws PluginException {
      if (context == null) throw new PluginException("Plugin Init Exception"); //$NON-NLS-1$
      if (initParams.get("throwsParam") != null){ //$NON-NLS-1$
         throw new PluginException("got throwsParam, throw for test"); //$NON-NLS-1$
      }
     
      this.state = STATE_INIT;
  }
View Full Code Here

    try {
      TemplateConfigFactory.loadTemplateFile(context, this.templateFile, configDir);
    } catch (TemplateException e) {
      LOGGER.severe(PLUGIN_INIT_ERROR + e.getMessage());
      throw new PluginException(PLUGIN_INIT_ERROR + e.getMessage(), e);
    }
  }
View Full Code Here

    LOGGER.debug("CommonsValidatorPlugin:init()"); //$NON-NLS-1$
    try {
      CommonsValidatorWrapper.load(context);
    } catch (CommonsValidatorException e) {
      LOGGER.severe("CommonsValidatorPlugin not loaded : " + e); //$NON-NLS-1$
      throw new PluginException(e);
    } catch (NoClassDefFoundError e) {
      // Bug Fix: 917752
      // Throw exception when plugin is specified, but class files
      // are missing
      LOGGER.severe("CommonsValidatorPlugin not loaded : " + e); //$NON-NLS-1$
      throw new PluginException(e);
    }

  }
View Full Code Here

      return;
    }

    for (PluginProxy proxy : proxys) {
      try {
        PluginInterface plugin = proxy.getPlugin();
        plugin.init(context, proxy.getInitParams());
      } catch (PluginException e) {
        LOGGER
            .warn("Warning: initPlugins(), Unable to initialize plugin: " + proxy.getName() + " (" + e.getMessage() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        proxy.setInitThrewException(true);
      }
View Full Code Here

      if (proxy.initThrewException()) {
        continue;
      }

      try {
        PluginInterface plugin = proxy.getPlugin();
        plugin.destroy(context, proxy.getInitParams());
      } catch (PluginException e) {
        LOGGER
            .warn("Warning: destroyPlugins(), Unable to destroy plugin: " + proxy.getName()); //$NON-NLS-1$
      }
    }
View Full Code Here

  }

  private void loadPluginProxies() throws ConfigException {
    this.pluginProxies = new ArrayList<PluginProxy>();
    for (PluginDef pluginDef : this.plugins) {
      PluginInterface plugin = null;

      try {
        String type = pluginDef.getType();
        plugin = (PluginInterface) Class.forName(type).newInstance();
      } catch (Exception e) {
View Full Code Here

TOP

Related Classes of org.megatome.frame2.validator.TestCommonsFieldValidator

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.