| 1 | | | <body> |
| 2 | | | <section> |
| 3 | | | <title>Overview</title> |
| 4 | | | <p> |
| 5 | | | The Http Connector is intended to send Http messages to target system |
| 6 | | | and to receive response from that system. |
| 7 | | | The Http Connector implements the Java Connector Architecture (JCA) 1.0 specification. |
| 8 | | | The most important features of the connector are |
| 9 | | | <ul> |
| 10 | | | <li>Sending and receiving Http messages.</li> |
| 11 | | | <li>Performing a configurable amount of retries.</li> |
| 12 | | | <li>Provide a sufficient error handling.</li> |
| 13 | | | </ul> |
| 14 | | | </p> |
| 15 | | | <section> |
| 16 | | | <title>Restrictions</title> |
| 17 | | | <p> |
| 18 | | | <ul> |
| 19 | | | <li>This connector does not provide the javax.resource.cci</li> |
| 20 | | | <li>This connector does not implement the transaction and security contract |
| 21 | | | defined in the JCA.</li> |
| 22 | | | </ul> |
| 23 | | | </p> |
| 24 | | | </section> |
| 25 | | | </section> |
| 26 | | | |
| 27 | | | <section> |
| 28 | | | <title>Logical View</title> |
| 29 | | | <p> |
| 30 | | | The JCA 1.0 defines three major components involved in the |
| 31 | | | Connector Architecture: |
| 32 | | | <ul> |
| 33 | | | <li>J2EE Application Server</li> |
| 34 | | | <li>Application running on a J2EE Server (the Client)</li> |
| 35 | | | <li>Connector (JCA) provider</li> |
| 36 | | | </ul> |
| 37 | | | </p> |
| 38 | | | <p> |
| 39 | | | Following contracts should be met by these components: |
| 40 | | | <ul> |
| 41 | | | <li>System Contract (between JCA provider and J2EE Server)</li> |
| 42 | | | <li>Container-Component Contract (between Application and J2EE Server)</li> |
| 43 | | | <li>Client API (between JCA provider and Application)</li> |
| 44 | | | </ul> |
| 45 | | | </p> |
| 46 | | | <p> |
| 47 | | | The HttpConnector implements two of these contracts: |
| 48 | | | <ul> |
| 49 | | | <li>Container-Component Contract by providing |
| 50 | | | <ul> |
| 51 | | | <li>managed connection factory HttpManagedConnectionFactoryImpl</li> |
| 52 | | | <li>managed connection HttpManagedConnectionImpl</li> |
| 53 | | | </ul> |
| 54 | | | </li> |
| 55 | | | <li>Client API by providing |
| 56 | | | <ul> |
| 57 | | | <li>connection factory interface HttpConnectionFactory</li> |
| 58 | | | <li>connection interface HttpConnection</li> |
| 59 | | | <li>connection factory's implementation HttpConnectionFactoryImpl</li> |
| 60 | | | <li>connection's implementation HttpConnectionImpl</li> |
| 61 | | | </ul> |
| 62 | | | </li> |
| 63 | | | </ul> |
| 64 | | | </p> |
| 65 | | | <section> |
| 66 | | | <title>Managed Connection Factory</title> |
| 67 | | | <p> |
| 68 | | | The Managed Connection Factory HttpManagedConnectionFactoryImpl |
| 69 | | | implements the javax.resource.spi.ManagedConnectionFactory interface. |
| 70 | | | This class is as well a factory for managed connections as a factory |
| 71 | | | for HttpConnectionFactory's. This class is the main entry point for |
| 72 | | | the underlying Application Server for interactions with the Http |
| 73 | | | Connector. An instance of this class will be instantiated by the |
| 74 | | | application server immediately after deployment. The |
| 75 | | | HttpManagedConnectionFactoryImpl provides some connector specific |
| 76 | | | attributes (for more details see the section 'Connector's Attributes'). |
| 77 | | | <diagram type="class" name="HttpManagedConnectionFactoryImpl"> |
| 78 | | | <class name="org.jcoderz.commons.connector.ManagedConnectionFactoryBase"/> |
| 79 | | | <class name="org.jcoderz.commons.connector.http.HttpManagedConnectionFactoryImpl"/> |
| 80 | | | <description> |
| 81 | | | The Managed Connection Factory HttpManagedConnectionFactoryImpl. |
| 82 | | | </description> |
| 83 | | | </diagram> |
| 84 | | | </p> |
| 85 | | | </section> |
| 86 | | | <section> |
| 87 | | | <title>Managed Connection</title> |
| 88 | | | <p> |
| 89 | | | The main task of the HttpManagedConnectionImpl class is to manage |
| 90 | | | HttpConnection's instances. |
| 91 | | | <diagram type="class" name="HttpManagedConnectionImpl"> |
| 92 | | | <class name="org.jcoderz.commons.connector.http.HttpManagedConnectionImpl"/> |
| 93 | | | <description> |
| 94 | | | The Managed Connection HttpManagedConnectionImpl. |
| 95 | | | </description> |
| 96 | | | </diagram> |
| 97 | | | </p> |
| 98 | | | </section> |
| 99 | | | <section> |
| 100 | | | <title>Connection Factory</title> |
| 101 | | | <p> |
| 102 | | | The HttpConnectionFactory interface specifies the methods to retrieve a |
| 103 | | | HttpConnection. The Http Connector does not provide the |
| 104 | | | javax.resource.cci interface. A connector's client should use the |
| 105 | | | HttpConnectionFactory to obtain a http connection instead. |
| 106 | | | <diagram type="class" name="HttpConnectionFactory"> |
| 107 | | | <class name="org.jcoderz.commons.connector.http.HttpConnectionFactoryImpl"/> |
| 108 | | | <description> |
| 109 | | | The Connection Factory. |
| 110 | | | </description> |
| 111 | | | </diagram> |
| 112 | | | </p> |
| 113 | | | </section> |
| 114 | | | <section> |
| 115 | | | <title>Connection</title> |
| 116 | | | <p> |
| 117 | | | The HttpConnection provides the interface between a connector's client and |
| 118 | | | a http target system. |
| 119 | | | <diagram type="class" name="HttpConnectionImpl"> |
| 120 | | | <class name="org.jcoderz.commons.connector.http.HttpConnectionImpl"/> |
| 121 | | | <description> |
| 122 | | | The HttpConnection. |
| 123 | | | </description> |
| 124 | | | </diagram> |
| 125 | | | </p> |
| 126 | | | </section> |
| 127 | | | </section> |
| 128 | | | |
| 129 | | | <section> |
| 130 | | | <title>Packaging and Deployment</title> |
| 131 | | | <section> |
| 132 | | | <title>Deployment Descriptor</title> |
| 133 | | | <p> |
| 134 | | | The deployment descriptor of the Http Connector consists of two |
| 135 | | | components: |
| 136 | | | <ul> |
| 137 | | | <li> |
| 138 | | | standard deployment descriptor ra.xml, that specifies the |
| 139 | | | common and connector specific properties |
| 140 | | | </li> |
| 141 | | | <li> |
| 142 | | | application server specific deployment descriptor, that specify |
| 143 | | | server relevant configuration and settings for an resource |
| 144 | | | adapter. |
| 145 | | | </li> |
| 146 | | | </ul> |
| 147 | | | The FawkeZ module delivers modules for the WebLogic Application |
| 148 | | | Server, thus the Http Connector includes the WebLogic specific |
| 149 | | | deployment descriptor weblogic-ra.xml. |
| 150 | | | </p> |
| 151 | | | </section> |
| 152 | | | <section> |
| 153 | | | <title>Packaging</title> |
| 154 | | | <p> |
| 155 | | | The Http Connector is packaged in to the http.rar |
| 156 | | | archive. This archive contains |
| 157 | | | <ul> |
| 158 | | | <li>the deployment descriptors |
| 159 | | | <ul> |
| 160 | | | <li>ra.xml - standard deployment descriptor</li> |
| 161 | | | <li>weblogic-ra.xml - the WebLogic specific deployment descriptor</li> |
| 162 | | | </ul> |
| 163 | | | </li> |
| 164 | | | <li>the implementation classes included in the http.jar</li> |
| 165 | | | <li>and the http-client.jar archive containing the client interfaces.</li> |
| 166 | | | </ul> |
| 167 | | | </p> |
| 168 | | | |
| 169 | | | <p> |
| 170 | | | The following shows the structure of the http.rar: |
| 171 | | | <pre> |
| 172 | | | META-INF/MANIFEST.MF |
| 173 | | | VERSION |
| 174 | | | META-INF/ra.xml |
| 175 | | | META-INF/weblogic-ra.xml |
| 176 | | | http-client.jar |
| 177 | | | http.jar |
| 178 | | | </pre> |
| 179 | | | </p> |
| 180 | | | </section> |
| 181 | | | <section> |
| 182 | | | <title>Deployment</title> |
| 183 | | | <p> |
| 184 | | | The Http Connector can be deployed either: |
| 185 | | | <ul> |
| 186 | | | <li>Directly into an application server as a stand-alone unit, or,</li> |
| 187 | | | <li>Deployed with a J2EE application that consists of one or |
| 188 | | | more J2EE modules in addition to the Http Connector |
| 189 | | | module |
| 190 | | | </li> |
| 191 | | | </ul> |
| 192 | | | </p> |
| 193 | | | </section> |
| 194 | | | <section> |
| 195 | | | <title>Connector Client Archive</title> |
| 196 | | | <p> |
| 197 | | | To prevent the connector's client to use the Http Connector's |
| 198 | | | implementation classes directly, the client archive file is supplied |
| 199 | | | on the client side. This archive provide connector's interfaces |
| 200 | | | only and should be included in the client classpath. |
| 201 | | | </p> |
| 202 | | | </section> |
| 203 | | | </section> |
| 204 | | | <section> |
| 205 | | | <title>Implementation View</title> |
| 206 | | | <section> |
| 207 | | | <title>Connection handling</title> |
| 208 | | | <p> |
| 209 | | | The connector is able to perform retries. Therefore a connection will be initiated |
| 210 | | | internally if necessary. |
| 211 | | | </p> |
| 212 | | | </section> |
| 213 | | | <section> |
| 214 | | | <title>Usage</title> |
| 215 | | | <section> |
| 216 | | | <title>Base Path</title> |
| 217 | | | <p> |
| 218 | | | A connector's client is required to look up a connection |
| 219 | | | factory instance using the JNDI interface. The client then uses |
| 220 | | | the connection factory instance to get a connection to the |
| 221 | | | target system. |
| 222 | | | A connection client is required to close the connection after the |
| 223 | | | connection is no more in use. |
| 224 | | | <pre> |
| 225 | | | // Create initial context |
| 226 | | | final InitialContext ctx = new InitialContext(); |
| 227 | | | // Lookup the connection factory |
| 228 | | | final HttpConnectionFactory cf = (HttpConnectionFactory) ctx.lookup("java:comp/env/eis/HttpConnector"); |
| 229 | | | // Retrieve conection |
| 230 | | | final HttpConnection con = cf.getConnection(); |
| 231 | | | // perform send and receive |
| 232 | | | byte[] message = "message".getBytes(); |
| 233 | | | con.sendAndReceive(message); |
| 234 | | | ... |
| 235 | | | // close connection |
| 236 | | | con.close(); |
| 237 | | | </pre> |
| 238 | | | </p> |
| 239 | | | </section> |
| 240 | | | </section> |
| 241 | | | <section> |
| 242 | | | <title>Connector Attributes</title> |
| 243 | | | <p>The Http Connector provides a couple of attributes |
| 244 | | | See the config file for further details. |
| 245 | | | </p> |
| 246 | | | </section> |
| 247 | | | </section> |
| 248 | | | <section> |
| 249 | | | <title>API Documentation</title> |
| 250 | | | <apidoc name="filesystemconnector"> |
| 251 | | | <class name="org.jcoderz.commons.connector.http.HttpConnection"/> |
| 252 | | | <class name="org.jcoderz.commons.connector.http.HttpConnectionFactory"/> |
| 253 | | | <class name="org.jcoderz.commons.connector.http.HttpConnectionUtil"/> |
| 254 | | | </apidoc> |
| 255 | | | </section> |
| 256 | | | </body> |