ca.uhn.hl7v2.protocol.impl
Class URLTransport

java.lang.Object
  extended by ca.uhn.hl7v2.protocol.impl.AbstractTransport
      extended by ca.uhn.hl7v2.protocol.impl.URLTransport
All Implemented Interfaces:
TransportLayer

public class URLTransport
extends AbstractTransport
implements TransportLayer

A TransportLayer that reads and writes from an URL (for example over HTTP).

Version:
$Revision: 1.1 $ updated on $Date: 2007/02/19 02:24:26 $ by $Author: jamesagnew $
Author:
Bryan Tripp, Alexei Guevara

Field Summary
protected  int myBufferSize
           
static java.lang.String URL_KEY
          Key in Transportable metadata map under which URL is stored.
 
Constructor Summary
URLTransport(java.net.URL theURL, boolean connectOnSend, boolean connectOnReceive, boolean connectOnConnect)
          The boolean configuration flags determine when new connections are made.
 
Method Summary
 void doConnect()
          Calls openConnection() on the underlying URL and configures the connection, if this transport is configured to connect when connect() is called (see constructor params).
 void doDisconnect()
          Performs disconnection as described in TransportLayer.disconnect().
 Transportable doReceive()
          Called by receive(), which then adds common metadata.
 void doSend(Transportable theMessage)
          Writes the given message to the URL.
 java.lang.String getContentType()
           
 void setContentType(java.lang.String theContentType)
           
 
Methods inherited from class ca.uhn.hl7v2.protocol.impl.AbstractTransport
connect, disconnect, getCommonMetadata, isConnected, receive, send
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ca.uhn.hl7v2.protocol.TransportLayer
connect, disconnect, getCommonMetadata, isConnected, receive, send
 

Field Detail

URL_KEY

public static final java.lang.String URL_KEY
Key in Transportable metadata map under which URL is stored.

See Also:
Constant Field Values

myBufferSize

protected int myBufferSize
Constructor Detail

URLTransport

public URLTransport(java.net.URL theURL,
                    boolean connectOnSend,
                    boolean connectOnReceive,
                    boolean connectOnConnect)
The boolean configuration flags determine when new connections are made. For example if this transport is being used for query/response, you might set connectOnSend to true and the others to false, so that each query/response is done over a fresh connection. If you are using a transport just to read data from a URL, you might set connectOnReceive to true and the others to false.

Parameters:
theURL - the URL at which messages are to be read and written
connectOnSend - makes a new connection before each send
connectOnReceive - makes a new connection before each receive
connectOnConnect - makes a new connection when connect() is called
Method Detail

doSend

public void doSend(Transportable theMessage)
            throws TransportException
Writes the given message to the URL.

Specified by:
doSend in class AbstractTransport
Parameters:
theMessage - the message to send
Throws:
TransportException
See Also:
ca.uhn.hl7v2.protocol.AbstractTransport#doSend(ca.uhn.hl7v2.protocol.Transportable)

doReceive

public Transportable doReceive()
                        throws TransportException
Description copied from class: AbstractTransport
Called by receive(), which then adds common metadata.

Specified by:
doReceive in class AbstractTransport
Returns:
Transportable the next available message
Throws:
TransportException
See Also:
ca.uhn.hl7v2.protocol.AbstractTransport#doReceive()

doConnect

public void doConnect()
               throws TransportException
Calls openConnection() on the underlying URL and configures the connection, if this transport is configured to connect when connect() is called (see constructor params).

Specified by:
doConnect in class AbstractTransport
Throws:
TransportException
See Also:
ca.uhn.hl7v2.protocol.AbstractTransport#doConnect()

getContentType

public java.lang.String getContentType()
Returns:
the string used in the request property "Content-Type" (defaults to "application/hl7+doc+xml")

setContentType

public void setContentType(java.lang.String theContentType)
Parameters:
theContentType - the string to be used in the request property "Content-Type" (defaults to "application/hl7+doc+xml")

doDisconnect

public void doDisconnect()
                  throws TransportException
Description copied from class: AbstractTransport
Performs disconnection as described in TransportLayer.disconnect(). The disconnect() method of this class delegates to doDisconnect() after some internal housekeeping.

Specified by:
doDisconnect in class AbstractTransport
Throws:
TransportException
See Also:
TransportLayer.disconnect()


Copyright © 2001-2011 University Health Network. All Rights Reserved.