Package org.megatome.frame2.event.xml

Examples of org.megatome.frame2.event.xml.PassthruEvent


    try {
      if (handlerNames != null) {
        for (int i = 0; i < handlerNames.size(); i++) {
          String handlerName = handlerNames.get(i);
          EventHandlerDef handlerDef = this.eventHandlers
              .get(handlerName);

          if (handlerDef == null) {
            throw new ConfigException("Handler : " + handlerName //$NON-NLS-1$
                + " is not configured"); //$NON-NLS-1$
          }

          // EventHandler handler = (EventHandler)
          // getClass().forName(handlerDef.getType())
          // .newInstance();
          EventHandler handler = (EventHandler) Class.forName(
              handlerDef.getType()).newInstance();

          result.add(new EventHandlerProxy(handlerName, handler,
              handlerDef));
        }
      }
View Full Code Here


  }

  private List<String> getHandlerNames(String eventName)
      throws ConfigException {
    List<String> handlers = null;
    EventMapping mapping = this.eventMappings.get(eventName);

    if (mapping != null) {
      handlers = mapping.getHandlers();
    } else {
      throw new ConfigException("No mapping defined for event " //$NON-NLS-1$
          + eventName);
    }
View Full Code Here

   * @return String
   */
  public String getEventMappingView(String eventName, ViewType type)
      throws ViewException {
    String view = null;
    EventMapping eventMapping = getEventMappings().get(eventName);

    view = eventMapping.getView(type.toString());

    if (view == null) {
      throw new ViewException(
          "There is no view defined in the config file for EventMapping: " //$NON-NLS-1$
              + eventName);
View Full Code Here

    return resolveForward(result, HTML_TOKEN);
  }

  private EventMapping mappingFor(String eventName) throws ConfigException {
    EventMapping mapping = this.eventMappings.get(eventName);

    if (mapping != null) {
      return mapping;
    }
View Full Code Here

  }

  public String[] rolesfor(String event) throws ConfigException {
    final String[] TYPE = new String[0];

    EventMapping mapping = mappingFor(event);

    if (mapping != null) {
      return mapping.getRoles();
    }

    return TYPE;
  }
View Full Code Here

  public ForwardProxy resolveForward(EventHandlerProxy handler, String token,
      String tokenType) throws ViewException {
    // look in local forward first
    // then in global forward
    Forward fwd = null;

    if (tokenType.equals(HTML_TOKEN)) {
      fwd = handler.getDefinition().getHTMLForward(token);
    } else if (tokenType.equals(XML_TOKEN)) {
      fwd = handler.getDefinition().getXMLForward(token);
View Full Code Here

  }

  public ForwardProxy resolveForward(String token, String tokenType)
      throws ViewException {
    // global forward
    Forward fwd = resolveGlobalForward(token, tokenType);

    return new ForwardProxy(fwd);
  }
View Full Code Here

  }

  public Forward resolveGlobalForward(String token, String tokenType)
      throws ViewException {
    // global forward
    Forward fwd = null;

    if (tokenType.equals(HTML_TOKEN)) {
      fwd = getGlobalHTMLForward(token);
    } else if (tokenType.equals(XML_TOKEN)) {
      fwd = getGlobalXMLForward(token);
View Full Code Here

    for (ExceptionDef edef : this.exceptions) {
      String classtype = edef.getType();
      try {
        if (Class.forName(classtype).isInstance(ex)) {
          String view = edef.getView(vtype.toString());
          Forward fwd = resolveGlobalForward(view, tokenType);
          return new ExceptionProxy(fwd, edef);
        }
      } catch (ClassNotFoundException e) { // Not concerned with this
      }
    }
View Full Code Here

   private PluginProxy proxy = null;

   @Before
   public void setUp() throws Exception {
      PluginDef pluginDef = new PluginDef();
      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

TOP

Related Classes of org.megatome.frame2.event.xml.PassthruEvent

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.