Package org.openengsb.core.api.remote

Examples of org.openengsb.core.api.remote.FilterException


            byte[] sessionKeyData = CipherUtils.decrypt(encryptedKey, privateKeySource.getPrivateKey());
            sessionKey = CipherUtils.deserializeSecretKey(sessionKeyData, secretKeyAlgorithm);
            LOGGER.trace("decrypting message using session-key");
            decryptedMessage = CipherUtils.decrypt(input.getEncryptedContent(), sessionKey);
        } catch (DecryptionException e) {
            throw new FilterException(e);
        }
        LOGGER.debug("forwarding decrypted message to next filter {}", next);
        byte[] plainResult = (byte[]) next.filter(decryptedMessage, metaData);
        try {
            LOGGER.trace("encrypting result using previously decrypted session-key");
            return CipherUtils.encrypt(plainResult, sessionKey);
        } catch (EncryptionException e) {
            throw new FilterException(e);
        }
    }
View Full Code Here


        MethodCallMessage request;
        try {
            LOGGER.trace("attempt to read SecureRequest from inputData");
            request = mapper.readValue(input, MethodCallMessage.class);
        } catch (IOException e) {
            throw new FilterException(e);
        }
        String callId = request.getCallId();
        LOGGER.info("extracted callId \"{}\" from message", callId);
        metaData.put("callId", callId);
        LOGGER.debug("converting arguments of inputmessage");
        JsonUtils.convertAllArgs(request);
        LOGGER.debug("invoking next filter: {}", next.getClass().getName());
        MethodResultMessage response = (MethodResultMessage) next.filter(request, metaData);
        LOGGER.debug("response received for callId {}: {}. serializing to json", callId, response);
        try {
            return mapper.writeValueAsBytes(response);
        } catch (IOException e) {
            throw new FilterException(e);
        }

    }
View Full Code Here

        String className = input.getCredentials().getClassName();
        Class<? extends Credentials> credentialType;
        try {
            credentialType = loadCredentialsType(className);
        } catch (ClassNotFoundException e) {
            throw new FilterException(e);
        }
        try {
            authenticationContext.login(input.getPrincipal(), input.getCredentials().toObject(credentialType));
        } catch (AuthenticationException e) {
            throw new FilterException(e);
        }
        LOGGER.debug("authenticated");
        return (MethodResultMessage) next.filter(input, metaData);
    }
View Full Code Here

        if (next instanceof String) {
            try {
                Class<?> class1 = Class.forName((String) next);
                return createFromClass(class1);
            } catch (ClassNotFoundException e) {
                throw new FilterException(e);
            }
        }
        if (next instanceof Class) {
            return createFromClass(next);
        }
View Full Code Here

    public Document doFilter(Document input, Map<String, Object> metadata) throws FilterException {
        MethodCallMessage call;
        try {
            call = parseMethodCall(input);
        } catch (JAXBException e) {
            throw new FilterException(e);
        }
        MethodResultMessage result = (MethodResultMessage) next.filter(call, metadata);
        return serializeResult(result);
    }
View Full Code Here

            Marshaller marshaller = jaxbContext.createMarshaller();
            marshaller.marshal(new JAXBElement<MethodResultMessage>(
                new QName(MethodResultMessage.class.getSimpleName()),
                MethodResultMessage.class, result), domResult);
        } catch (JAXBException e) {
            throw new FilterException(e);
        } catch (ClassNotFoundException e) {
            throw new FilterException(e);
        }
        return (Document) domResult.getNode();
    }
View Full Code Here

    public Document doFilter(Document input, Map<String, Object> metadata) throws FilterException {
        String docString;
        try {
            docString = writeDocument(input);
        } catch (TransformerException e) {
            throw new FilterException(e);
        }
        String result = (String) next.filter(docString, metadata);
        return parseDocument(result);
    }
View Full Code Here

        Document doc;
        try {
            DocumentBuilder db = dbf.newDocumentBuilder();
            doc = db.parse(new InputSource(new StringReader(input)));
        } catch (ParserConfigurationException e) {
            throw new FilterException(e);
        } catch (SAXException e) {
            throw new FilterException(e);
        } catch (IOException e) {
            throw new FilterException(e);
        }
        return doc;
    }
View Full Code Here

                        MethodCallMessage deserialize;

                        try {
                            deserialize = (MethodCallMessage) SerializationUtils.deserialize(input);
                        } catch (SerializationException e) {
                            throw new FilterException(e);
                        }
                        MethodResultMessage result = (MethodResultMessage) next.filter(deserialize, metaData);
                        return SerializationUtils.serialize(result);
                    }
View Full Code Here

        EncryptedMessage message;
        try {
            LOGGER.debug("attempting to parse encrypted json message");
            message = objectMapper.readValue(input, EncryptedMessage.class);
        } catch (IOException e) {
            throw new FilterException(e);
        }
        LOGGER.info("Encrypted message parsed sucessfully, passing to next filter {}", next.getClass().getName());
        byte[] result = (byte[]) next.filter(message, metaData);
        return Base64.encodeBase64String(result);
    }
View Full Code Here

TOP

Related Classes of org.openengsb.core.api.remote.FilterException

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.