Package ca.uhn.hl7v2.protocol

Examples of ca.uhn.hl7v2.protocol.TransportException


     * @param rowHL7
     * @return XML String
     */
    private String serializeHL7toXML(String rowHL7) {
        Parser xmlParser = new DefaultXMLParser();
        Parser ediParser = new PipeParser();
        ediParser.setValidationContext(new NoValidation());
        String xmlDoc = null;
        try {
            Message message = ediParser.parse(rowHL7);
            ConformanceProfileRule rule = new ConformanceProfileRule();
        ValidationException[] exs = rule.test(message);
        if (exs != null && exs.length > 0) {
          throw new HL7Exception(exs[0].getMessage());
       
View Full Code Here


    private Socket getSocket(SocketAddress theAddress) throws TransportException {
        Socket s = new Socket();       
        try {
            s.connect(theAddress);
        } catch (IOException e) {
            throw new TransportException(e);
        }
        return s;       
    }
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

        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

    private Socket getSocket(SocketAddress theAddress) throws TransportException {
        Socket s = new Socket();       
        try {
            s.connect(theAddress);
        } catch (IOException e) {
            throw new TransportException(e);
        }
        return s;       
    }
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.