Project Report: fawkez

Packagesummary org.jcoderz.commons.connector.http

org.jcoderz.commons.connector.http.HttpConnectionFactoryImpl

LineHitsNoteSource
1  /*
2   * $Id: HttpConnectionFactoryImpl.java 1011 2008-06-16 17:57:36Z amandel $
3   *
4   * Copyright 2006, The jCoderZ.org Project. All rights reserved.
5   *
6   * Redistribution and use in source and binary forms, with or without
7   * modification, are permitted provided that the following conditions are
8   * met:
9   *
10   *    * Redistributions of source code must retain the above copyright
11   *      notice, this list of conditions and the following disclaimer.
12   *    * Redistributions in binary form must reproduce the above
13   *      copyright notice, this list of conditions and the following
14   *      disclaimer in the documentation and/or other materials
15   *      provided with the distribution.
16   *    * Neither the name of the jCoderZ.org Project nor the names of
17   *      its contributors may be used to endorse or promote products
18   *      derived from this software without specific prior written
19   *      permission.
20   *
21   * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND
22   * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24   * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS
25   * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27   * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
28   * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29   * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30   * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31   * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32   */
33  package org.jcoderz.commons.connector.http;
34  
35  import javax.naming.Reference;
36  import javax.resource.ResourceException;
37  import javax.resource.spi.ConnectionManager;
38  
39  
40  /**
41   * Factory for the creation of a connection handle used by the client.
42   *
43   */
44 (1)public class HttpConnectionFactoryImpl
45        implements HttpConnectionFactory
46  {
47     /** The managed connection factory in use. */
48     private final HttpManagedConnectionFactoryImpl mManagedConnectionFactory;
49     /** The connection manager in use. */
50     private final ConnectionManager mConnectionManager;
51     /** The reference used for JNDI. */
52     private Reference mReference;
53     /** Human-readable description. */
54     private String mDescription;
55  
56     /**
57      * Constructor.
58      *
59      * @param mcf the used ManagedConnectionFactory
60      * @param cm the used ConnectionManager
61      */
62     public HttpConnectionFactoryImpl (HttpManagedConnectionFactoryImpl mcf,
63        ConnectionManager cm)
640    {
650       mManagedConnectionFactory = mcf;
660       mConnectionManager = cm;
670    }
68  
69     /** {@inheritDoc} */
70     public HttpConnection getConnection (HttpConnectionSpec connectionSpec)
71           throws ResourceException
72     {
730       return new HttpConnectionHelper(this, connectionSpec);
74     }
75  
76     /**
77      * Gets a HttpConnection implementation
78      * (here: HttpConnectionImpl - see deployment descriptor) as
79      * counterpart of the HttpManagedConnectionImpl.
80      * This connection does not support multiple retries and is used
81      * within the HttpConnectionHelper to provide retries.
82      *
83      * @param connectionSpec specifies the target system
84      * @return HttpConnection an implementation of the HttpConnection
85      *          interface
86      * @throws ResourceException
87    */
88     protected HttpConnection getConnectionHandle (
89           HttpConnectionSpec connectionSpec)
90           throws ResourceException
91     {
920       final HttpConnectionRequestInfo cri = new HttpConnectionRequestInfo(
93              mManagedConnectionFactory, connectionSpec);
940       final HttpConnection connectionHandle
95           = (HttpConnection) mConnectionManager
96              .allocateConnection(mManagedConnectionFactory, cri);
970(2)      return connectionHandle;
98     }
99  
100     /** {@inheritDoc} */
101 (3)   public void setReference (Reference reference)
102     {
1030       mReference = reference;
1040    }
105  
106     /** {@inheritDoc} */
107 (4)   public Reference getReference ()
108     {
1090       return mReference;
110     }
111  
112     /**
113      * Get the human-readable description.
114      *
115      * @return String - the description of the connector as part of the
116      *                  deployment descriptor
117      */
118     public String getDescription ()
119     {
1200       return mDescription;
121     }
122  
123     /**
124      * Set the human-readable description.
125      *
126      * @param desc the description of the connector as part of the deployment
127      *             descriptor
128      */
129     public void setDescription (String desc)
130     {
1310       mDescription = desc;
1320    }
133  }

Findings in this File

c (1) 44 : 0 Type Javadoc comment is missing an @author tag.
w (2) 97 : 0 method org.jcoderz.commons.connector.http.HttpConnectionFactoryImpl.getConnectionHandle(HttpConnectionSpec) stores return result in local before immediately returning it
d (3) 101 : 0 @inheritDoc used but setReference(Reference) does not override or implement any method.
d (4) 107 : 0 @inheritDoc used but getReference() does not override or implement any method.