Project Report: fawkez

Packagesummary org.jcoderz.commons.connector.http

org.jcoderz.commons.connector.http.HttpConnectionRequestInfo

LineHitsNoteSource
1  /*
2   * $Id: HttpConnectionRequestInfo.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 org.jcoderz.commons.connector.ConnectionRequestInfoBase;
36  
37   /**
38    * This class contains the request information for a requested
39    * connection. It implements the java connector architecture
40    * interface <code>HttpConnectionRequestInfo</code>.
41    *
42    */
43 (1)public class HttpConnectionRequestInfo
44        extends ConnectionRequestInfoBase
45   {
46     /** the connection specification including the connection parameter */
47     private final HttpConnectionSpec mConnectionSpec;
48  
49     /**
50      * Constructor.
51      * Called by a managed connection factory.
52      *
53      * @param mcf the calling managed connection factory
54      */
55     public HttpConnectionRequestInfo (HttpManagedConnectionFactoryImpl mcf)
560    {
570       mConnectionSpec = null;
580    }
59  
60     /**
61      * Constructor.
62      * Create a HttpConnectionRequestInfo from a ConnectionSpec.
63      *
64      * @param mcf the calling managed connectin factory
65      * @param cs the used connection specification
66      */
67     public HttpConnectionRequestInfo (
68        HttpManagedConnectionFactoryImpl mcf,
69        HttpConnectionSpec cs)
700    {
710       mConnectionSpec = cs;
720    }
73  
74     /*
75      * Methods defined in interface
76      *     ConnectionRequestInfo
77      *
78      *     boolean equals (java.lang.Object other)
79      *     int hashCode ()
80      */
81  
82     /**
83      * Compare two instances based on the relevant properties.<p>
84      * Depends on
85      * {link #canonicKey() <code>canonicKey</code>}
86      *
87      * @param obj other object instance
88      * @return boolean - true if given object is equal to this request
89      *                   information object, false else.
90      */
91     public boolean equals (Object obj)
92     {
930       return obj instanceof HttpConnectionRequestInfo
94              && canonicKey().equals(
95                 ((HttpConnectionRequestInfo) obj).canonicKey());
96     }
97  
98     /**
99      * Calculate hashCode based on all relevant properties.<p>
100      * Depends on
101      * {link #canonicKey() <code>canonicKey</code>}
102      *
103      * @return int - the calculated hashCode
104      */
105     public int hashCode ()
106     {
1070       return canonicKey().hashCode();
108     }
109  
110     /*
111      * Implementation of Interface
112      *     javax.resource.spi.ConnectionRequestInfo
113      *
114      * finished.
115      */
116  
117  
118     /**
119      * Create canonic human-readable string.
120      * A canonic string contains *all* relevant information of the Connection
121      * Request info.
122      *
123      * @return String - the result of <code>canonicKey</code>
124      */
125     public String toString ()
126     {
1270       return canonicKey();
128     }
129  
130     /**
131      * Create canonic key string.
132      * Return a canonic string which contains *all* relevant information of the
133      * Connection Request info.
134      * Example: "{user=Hans password=asecret domain=Purchasing}"
135      *
136      * NOTE: hashCode() and equals() depend on the proper implementation
137      * of this !
138      *
139      * @return String - the canonical string
140      */
141     public String canonicKey ()
142     {
143        String result;
1440       if (mConnectionSpec != null)
145        {
1460          result = mConnectionSpec.canonicKey();
147        }
148        else
149        {
150           // No special request-specific properties available
1510          result = "{dummy}";
152        }
1530       return result;
154     }
155  
156     /**
157      * Gets the connection specification object of this request information.
158      *
159      * @return PaymentProtocolConnectionSpec - the specification object
160      */
161     public HttpConnectionSpec getConnectionSpec ()
162     {
1630       return mConnectionSpec;
164     }
165  }

Findings in this File

c (1) 43 : 0 Type Javadoc comment is missing an @author tag.