Package ca.uhn.hl7v2.protocol

Examples of ca.uhn.hl7v2.protocol.TransportException


        String resource = "ca/uhn/hl7v2/protocol/impl/charset_map.properties";
        InputStream in = MLLPTransport.class.getClassLoader().getResourceAsStream(resource);
        try {
            mappings.load(in);
        } catch (IOException e) {
            throw new TransportException("Can't load character set mappings from " + resource, e);
        }
        return mappings;       
    }
View Full Code Here


                myWriter.writeMessage(theMessage.getMessage(), charset);
            } else {
                myWriter.writeMessage(theMessage.getMessage());
            }
        } catch (LLPException e) {
            throw new TransportException(e);
        } catch (IOException e) {
            throw new TransportException(e);
        }
    }
View Full Code Here

            String message = myReader.getMessage();
            if (message != null) {
                result = new TransportableImpl(message);               
            }
        } catch (LLPException e) {
            throw new TransportException(e);
        } catch (IOException e) {
            throw new TransportException(e);
        }
        return result;
    }
View Full Code Here

        myStreamSource.connect();
        try {
            myReader = new MinLLPReader(myStreamSource.getInboundStream());
            myWriter = new MinLLPWriter(myStreamSource.getOutboundStream());
        } catch (IOException e) {
            throw new TransportException(e);
        }
    }
View Full Code Here

    public void doDisconnect() throws TransportException {
        try {
            if (myReader != null) myReader.close();
            if (myWriter != null) myWriter.close();
        } catch (IOException e) {
            throw new TransportException(e);
        } finally {
            myReader = null;
            myWriter = null;
        }       
        myStreamSource.disconnect();
View Full Code Here

        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);
        }

        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.info("Sent: " + (theMessage == null ? null : theMessage.getMessage()));
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.