Package org.openbp.core

Examples of org.openbp.core.OpenBPException


    // TODO Fix 2 Check for the CREATED state after it has been introduced
    int lifecycleState = context.getLifecycleState();
    if (lifecycleState != LifecycleState.CREATED)
    {
      String msg = LogUtil.error(getClass(), "Token has invalid lifecycle state for operation prepareTokenForScheduler. [{0}]", context);
      throw new OpenBPException("InvalidLifecycleState", msg);
    }

    context.setLifecycleRequest(LifecycleRequest.NONE);
    tokenContextService.addContext(context);
    flush();
View Full Code Here


      if (currentSocket == null)
        currentSocket = context.getCurrentSocket();
      if (currentSocket == null)
      {
        String msg = LogUtil.error(getClass(), "Cannot call handler w/o a current socket. [{0}]", context);
        throw new OpenBPException("HandlerExecutionFailed", msg);
      }
      hc.setCurrentSocket(currentSocket);
      if (nextSocket == null && currentSocket != null)
        nextSocket = currentSocket.getNode().getDefaultExitSocket();
      hc.setNextSocket(nextSocket);

      // Execute the handler
      if (handlerDef.getHandlerClassName() != null)
      {
        Object handlerInstanceObject = handlerDef.obtainHandlerInstance();
        if (! (handlerInstanceObject instanceof Handler))
        {
          String msg = LogUtil.error(getClass(),
            "Handler object class $0 does not implement the handler interface $1. [{2}]", handlerInstanceObject
              .getClass().getName(), Handler.class.getName(), context);
          throw new OpenBPException("HandlerExecutionFailed", msg);
        }

        Handler handlerInstance = (Handler) handlerInstanceObject;
        LogUtil.trace(getClass(), "Executing handler on node $0 (class $1) as {2} handler. [{3}]",
          currentSocket.getNode().getQualifier().toString(), handlerInstance.getClass().getName(), eventType, context);

        // Execute the Java implementation of this handler
        try
        {
          handlerInstance.execute(hc);
        }
        catch (OpenBPException ee)
        {
          // Engine exceptions can be rethrown.
          throw ee;
        }
        catch (Throwable t)
        {
          // Catch any exceptions, so the server won't be confused by errors in handlers
          String msg = LogUtil.error(getClass(), "Error executing handler of $0. [{1}]", currentSocket.getNode()
            .getQualifier().toString(), t);
          throw new OpenBPException("HandlerExecutionFailed", msg, t);
        }
      }
      else if (handlerDef.getScript() != null)
      {
        LogUtil.trace(getClass(), "Executing script on node $0 as {1} handler. [{2}]",
View Full Code Here

    }

    // If this is an unrecoverable exception, pass it through
    if (t instanceof OpenBPException)
    {
      OpenBPException oe = (OpenBPException) t;
      if (oe.isUnrecoverable())
      {
        handlingOption = EngineExceptionHandlerEvent.HANDLING_OPTION_RETHROW;
      }
    }
View Full Code Here

    if (! msgContainer.isEmpty())
    {
      String msg = msgContainer.toString();
      LogUtil.error(getClass(), msg);
      throw new OpenBPException("HandlerExecutionFailed", msg);
    }

    return handler;
  }
View Full Code Here

    if (debuggerService == null)
    {
      if (! registerDebugger(false))
      {
        String msg = getPluginResourceCollection().getRequiredString("messages.nodebuggerservice");
        throw new OpenBPException("NoDebugger", msg);
      }
    }
    return debuggerService;
  }
View Full Code Here

TOP

Related Classes of org.openbp.core.OpenBPException

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.