001package ca.uhn.hl7v2.hoh.hapi.client;
002
003import java.net.URL;
004
005import ca.uhn.hl7v2.hoh.api.IClientSimple;
006import ca.uhn.hl7v2.hoh.raw.client.HohRawClientSimple;
007import ca.uhn.hl7v2.parser.Parser;
008
009public class HohClientSimple extends AbstractClient<HohRawClientSimple> implements IClientSimple {
010        /**
011         * Constructor
012         * 
013         * @param theHost
014         *            The HOST (name/address). E.g. "192.168.1.1"
015         * @param thePort
016         *            The PORT. E.g. "8080"
017         * @param theUriPath
018         *            The URI being requested (must either be blank or start with
019         *            '/' and contain a path). E.g. "/Apps/Receiver.jsp"
020         */
021        public HohClientSimple(String theHost, int thePort, String theUriPath) {
022                super(new HohRawClientSimple(theHost, thePort, theUriPath), null);
023        }
024
025        /**
026         * Constructor
027         * 
028         * @param theHost
029         *            The HOST (name/address). E.g. "192.168.1.1"
030         * @param thePort
031         *            The PORT. E.g. "8080"
032         * @param theUriPath
033         *            The URI being requested (must either be blank or start with
034         *            '/' and contain a path). E.g. "/Apps/Receiver.jsp"
035         * @param theParser
036         *            The Parser to use, or <code>null</code> in which case a
037         *            PipeParser will be used
038         */
039        public HohClientSimple(String theHost, int thePort, String theUriPath, Parser theParser) {
040                super(new HohRawClientSimple(theHost, thePort, theUriPath), theParser);
041        }
042
043        /**
044         * Constructor
045         * 
046         * @param theUrl
047         *            The URL to send messages to
048         */
049        public HohClientSimple(URL theUrl) {
050                super(new HohRawClientSimple(theUrl), null);
051        }
052
053        /**
054         * Constructor
055         * 
056         * @param theUrl
057         *            The URL to send messages to
058         * @param theParser
059         *            The Parser to use, or <code>null</code> in which case a
060         *            PipeParser will be used
061         */
062        public HohClientSimple(URL theUrl, Parser theParser) {
063                super(new HohRawClientSimple(theUrl), theParser);
064        }
065
066        /**
067         * {@inheritDoc}
068         */
069        public void close() {
070                getRawClient().close();
071        }
072
073        /**
074         * {@inheritDoc}
075         */
076        public boolean isAutoClose() {
077                return getRawClient().isAutoClose();
078        }
079
080        /**
081         * {@inheritDoc}
082         */
083        public boolean isConnected() {
084                return getRawClient().isConnected();
085        }
086
087        /**
088         * {@inheritDoc}
089         */
090        public void setAutoClose(boolean theAutoClose) {
091                getRawClient().setAutoClose(theAutoClose);
092        }
093
094}