Package org.megatome.frame2.errors

Examples of org.megatome.frame2.errors.Errors


   * @return DOCUMENT ME!
   * @throws ConfigException
   *             DOCUMENT ME!
   */
  public EventProxy getEventProxy(String eventName) throws ConfigException {
    EventDef eventDef = this.events.get(eventName);
    Event event = null;

    if (eventDef == null) {
      throw new ConfigException("Invalid Event Name: " + eventName); //$NON-NLS-1$
    }

    try {
      String type = eventDef.getType();

      if (type != null) {
        // event = (Event) getClass().forName(type).newInstance();
        event = (Event) Class.forName(type).newInstance();
        event.setEventName(eventName);
View Full Code Here


    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

TOP

Related Classes of org.megatome.frame2.errors.Errors

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.