Examples of HandlerException


Examples of org.switchyard.HandlerException

    public static Throwable getCauseFromHandlerException(final Throwable thrown) {
        Throwable cause = thrown;
        if (thrown instanceof InvocationFaultException) {
            final InvocationFaultException faultException = (InvocationFaultException) thrown;
            if (faultException.getCause() instanceof HandlerException) {
                HandlerException handlerEx = (HandlerException)faultException.getCause();
                cause = handlerEx.isWrapper() ? handlerEx.getCause() : handlerEx;
            } else if (faultException.getFaultMessage().getContent() instanceof Exception) {
                cause = faultException.getFaultMessage().getContent(Throwable.class);
            }
        }
        return cause;
View Full Code Here

Examples of org.switchyard.HandlerException

                invokeRemote(exchange);
            } else {
                invokeLocal(exchange);
            }
        } catch (SwitchYardException syEx) {
            throw new HandlerException(syEx.getMessage());
        }
    }
View Full Code Here

Examples of org.switchyard.HandlerException

    private HandlerException createHandlerException(Message message) {
        return createHandlerException(message == null ? null : message.getContent());
    }
   
    private HandlerException createHandlerException(Object content) {
        HandlerException ex;
        if (content == null) {
            ex = SCAMessages.MESSAGES.runtimeFaultOccurredWithoutExceptionDetails();
        } else if (content instanceof HandlerException) {
            ex = (HandlerException)content;
        } else if (content instanceof Throwable) {
            ex = new HandlerException((Throwable)content);
        } else {
            ex = new HandlerException(content.toString());
        }
        return ex;
    }
View Full Code Here

Examples of org.switchyard.HandlerException

        try {
            restRequest = _messageComposer.decompose(exchange, new RESTEasyBindingData());
        } catch (Exception e) {
            final String m = RestEasyMessages.MESSAGES.unexpectedExceptionComposingRESTRequest();
            LOGGER.error(m, e);
            throw new HandlerException(m, e);
        }

        Object response = null;
        MethodInvoker methodInvoker = _methodMap.get(opName);
        if (methodInvoker == null) {
            final String m = RestEasyMessages.MESSAGES.unableToMapAmongResources(opName, _methodMap.keySet().toString());
            throw new HandlerException(m);
        }

        try {
            RESTEasyBindingData restResponse = methodInvoker.invoke(restRequest.getParameters(), restRequest.getHeaders());
            restResponse.setOperationName(opName);
            Message out = _messageComposer.compose(restResponse, exchange);
            // Our transformer magic transforms the entity appropriately here :)
            exchange.send(out);
        } catch (Exception e) {
            final String m = "Unexpected exception composing inbound Message from Outbound";
            LOGGER.error(m, e);
            throw new HandlerException(m, e);
        }
    }
View Full Code Here

Examples of org.switchyard.HandlerException

            if (declaredFault != null && QNameUtil.isJavaMessageType(declaredFault)
                    && QNameUtil.toJavaMessageType(declaredFault).isAssignableFrom(e.getClass())) {
                Message msg = exchange.createMessage().setContent(e);
                exchange.sendFault(msg);
            } else {
                throw new HandlerException(e);
            }
        }
    }
View Full Code Here

Examples of org.wymiwyg.wrhapi.HandlerException

    Date moment = null;
    String[] momentParameterStrings = request.getRequestURI()
        .getParameterValues("moment");
    if (momentParameterStrings != null) {
      if (momentParameterStrings.length != 1) {
        throw new HandlerException(
            "only one get parameter \"moment\" supported");
      }
      String momentString = momentParameterStrings[0];
      String datePattern = "yyyyMMddHHmmssSSS";
      try {
        SimpleDateFormat dateFormat = new SimpleDateFormat(datePattern
            .substring(0, momentString.length()));
        dateFormat.setTimeZone(utcTZ);
        moment = dateFormat.parse(momentString);
      } catch (ParseException e) {
        throw new HandlerException(e);
      }
      ;
    }
    if (moment == null) {
      moment = new Date();
View Full Code Here

Examples of org.wymiwyg.wrhapi.HandlerException

      String passwordSha1 = Util.sha1(password);
      String mboxSha1 = Util.sha1("mbox" + email);
      Resource user = getUserByUsername(username);
      if (user != null) {
        if (!user.hasProperty(FOAF.mbox_sha1sum, mboxSha1)) {
          throw new HandlerException(
              "user already exists with a differen email address");
        } else {
          log
              .info("Username/Email combination exist, will delete exitisting on confirmation");
        }
      }

      LoginData loginData = new LoginData(username, passwordSha1,
          mboxSha1);
      String verificationKey = Util.createRandomString(28);
      verificationMap.put(verificationKey, loginData);
      log.info("sending login link to " + email);
      loginLinkSender.sendLoginLink(email, getVerificationLink(request,
          verificationKey));
      response.setResponseStatus(ResponseStatus.MOVED_TEMPORARILY);
      response.setHeader(HeaderName.LOCATION,
          "/application/verification-sent");
    } else {
      String[] verificationParameters = request.getRequestURI()
          .getParameterValues("verification");
      if (verificationParameters != null) {
        if (verificationParameters.length == 1) {
          LoginData loginData = verificationMap
              .get(verificationParameters[0]);
          if (loginData == null) {
            throw new HandlerException(
                "Verification string not found, probably expired");
          }
          Graph graph = new SimpleGraph();
          addUser(loginData, graph, request);
          response
              .setDefaultStylesheet("/application/stylesheets/verification-result");
          response.setBody(graph);
          Resource user = getUserByUsernameInIdentityGOT(loginData.userName);
          FCAGraph revokeGraphTmp = null;
          if (user != null) {
            log
                .info("Username already exist, removing previous password");
            Model revokeModel = ModelFactory.createDefaultModel();
            revokeModel.add(user
                .listProperties(ACCOUNTMANAGER.passwordSha1));
            revokeModel.add(user.listProperties(FOAF.mbox_sha1sum));
            revokeModel.add(user
                .listProperties(ACCOUNTMANAGER.userName));
            revokeGraphTmp = new FCAGraphImpl(revokeModel);
            // store.revokeGraph(identity, new
            // FCAGraphImpl(revokeModel), now);
          }
          final FCAGraph revokeGraph = revokeGraphTmp;
          final FCAGraph assertGraph = new FCAGraphImpl(graph);
          // store.assertGraph(identity, new FCAGraphImpl(graph),
          // now);
          store.perform(identity, new StoreTransaction() {

            public void execute(SourceStoreView storeView) {
              if (revokeGraph != null)
                storeView.revokeGraph(revokeGraph);
              storeView.assertGraph(assertGraph);
            }

          });
        } else {
          throw new HandlerException(
              "Invalid request: needs exactly one verification-parameter");
        }
      } else {
        // login
        if (!loginValid(username, password)) {
View Full Code Here

Examples of org.wymiwyg.wrhapi.HandlerException

  private String getHost(Request request) throws HandlerException {
    String host;
    try {
      host = request.getHeaderValues(HeaderName.HOST)[0];
    } catch (ArrayIndexOutOfBoundsException e) {
      throw new HandlerException("No host header");
    }

    int colonPos = host.indexOf(':');

    if (colonPos != -1) {
View Full Code Here

Examples of org.wymiwyg.wrhapi.HandlerException

        return;
      } else {
        currentBrowseNode = currentBrowseNode.getSubPath(currentToken);
      }
    }
    throw new HandlerException(ResponseStatus.NOT_FOUND, "file "+path+" not found");

  }
View Full Code Here

Examples of org.wymiwyg.wrhapi.HandlerException

        return false;
      }
    });
    //childStrings is null if the directory doesn't exist
    if ((childStrings == null) || (childStrings.length == 0)) {
      throw new HandlerException(ResponseStatus.NOT_FOUND, "file "+baseName+" not found");
    }
    // TODO content negotiation
    String fileName = childStrings[0];
    MimeType mimeType = MediaTypesUtil.getDefaultInstance().getTypeForExtension(getExtension(fileName));
    if (mimeType != null) {
      response.addHeader(HeaderName.CONTENT_TYPE, mimeType.toString());
    }
    PathNode resultNode = pathNode.getSubPath(fileName);
    final InputStream dataInputStream;
    try {
      //log.info("getting stream from"+fileName+" in "+pathNode+"("+resultNode+")");
      dataInputStream = resultNode.getInputStream();
    } catch (IOException e) {
      throw new HandlerException(e);
    }
    response.setBody(new MessageBody2Read() {

      public ReadableByteChannel read() throws IOException {
        return Channels.newChannel(dataInputStream);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.