Package ca.uhn.hl7v2.protocol

Examples of ca.uhn.hl7v2.protocol.TransportException


        try {
            Writer out = new OutputStreamWriter(new BufferedOutputStream(myConnection.getOutputStream()));
            out.write(theMessage.getMessage());
            out.flush();
        } catch (IOException e) {
            throw new TransportException(e);
        }
    }
View Full Code Here


                    readerThread.join(10000);

                    bytesRead = bytesReadRef.getValue();

                    if (bytesRead == 0) {
                        throw new TransportException("Timeout waiting for response");
                    }
                }
                catch (InterruptedException x) {
                }

                if (bytesRead > 0) {
                    response.append(buf, 0, bytesRead);
                }

            }

            in.close();
        } catch (IOException e) {
            log.error(e.getMessage(), e);
        }

        if (response.length() == 0) {
            throw new TransportException("Timeout waiting for response");
        }

        return new TransportableImpl(response.toString());
    }
View Full Code Here

            myConnection.setDoOutput(true);
            myConnection.setDoInput(true);
            myConnection.setRequestProperty("Content-Type", getContentType());
            myConnection.connect();
        } catch (IOException e) {
            throw new TransportException(e);
        }    
        log.debug("Made connection to {}", myURL.toExternalForm());
    }
View Full Code Here

     * Delegates to <code>doReceive()</code> and adds common metadata
     * to the resulting <code>Transportable</code> before it is returned.
     */
    public Transportable receive() throws TransportException {
        if (!isConnected()) {
            throw new TransportException("Can't receive because TransportLayer is not connected");
        }
       
        Transportable message = doReceive();
        if (message != null) {
            message.getMetadata().putAll(myCommonMetadata);
View Full Code Here

     *
     * @see ca.uhn.hl7v2.protocol.TransportLayer#send(Transportable)
     */
    public void send(Transportable theMessage) throws TransportException {
        if (!isConnected()) {
            throw new TransportException("Can't send because TransportLayer is not connected");
        }
       
        doSend(theMessage);
       
        log.debug("Sent: {}", (theMessage == null ? null : theMessage.getMessage()));
View Full Code Here

    public void doSend(Transportable theMessage) throws TransportException {
        try {           
            Message message = toMessage(theMessage);
            sendJMS(message);           
        } catch (JMSException e) {
            throw new TransportException(e);
        }
    }
View Full Code Here

        Message message;
        try {
            message = getMessage();
        
            if ( !(message instanceof TextMessage)) {
                throw new TransportException("This implementation expects getMessage() to return "
                    + " a TextMessage.  Override this method if another message type is to be used");
            }

            ((TextMessage) message).setText(theSource.getMessage());
       
            Iterator<String> it = theSource.getMetadata().keySet().iterator();
            while (it.hasNext()) {
                String key = it.next();
                Object val = theSource.getMetadata().get(key);
                message.setObjectProperty(key, val);
            }
        } catch (JMSException e) {
            throw new TransportException(e);
        }      
       
        return message;
    }
View Full Code Here

     * @param theMessage a JMS Message from which to obtain data 
     * @return a Transportable containing data from the given Message
     */
    protected Transportable toTransportable(Message theMessage) throws TransportException {
        if ( !(theMessage instanceof TextMessage)) {
            throw new TransportException("This implementation expects getMessage() to return "
                + " a TextMessage.  Override this method if another message type is to be used");
        }
       
        Transportable result = null;
        try {
            String text = ((TextMessage) theMessage).getText();
            result = new TransportableImpl(text);
            result.getMetadata().putAll(getCommonMetadata());
        } catch (JMSException e) {
            throw new TransportException(e);
        }

        return result;
    }
View Full Code Here

        Transportable result = null;
        try {
            Message message = receiveJMS();
            result = toTransportable(message);
        } catch (JMSException e) {
            throw new TransportException(e);           
        }
        return result;
    }
View Full Code Here

            myPublisher = mySendingSession.createPublisher(myTopic);

            myReceivingSession = myConnection.createTopicSession(transacted, ackMode);
            mySubscriber = myReceivingSession.createSubscriber(myTopic);
        } catch (JMSException e) {
            throw new TransportException(e);
        }
    }
View Full Code Here

TOP

Related Classes of ca.uhn.hl7v2.protocol.TransportException

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.