1. /*
  2. * @(#)ContactInfo.java 1.23 04/06/21
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package com.sun.corba.se.pept.transport;
  8. import com.sun.corba.se.pept.broker.Broker;
  9. import com.sun.corba.se.pept.encoding.InputObject;
  10. import com.sun.corba.se.pept.encoding.OutputObject;
  11. import com.sun.corba.se.pept.protocol.MessageMediator;
  12. import com.sun.corba.se.pept.protocol.ClientRequestDispatcher;
  13. import com.sun.corba.se.pept.transport.ConnectionCache;
  14. /**
  15. * <p>The <b><em>primary</em></b> PEPt client-side plug-in point and enabler
  16. * for <b><em>altenate encodings, protocols and transports</em></b>.</p>
  17. *
  18. * <p><code>ContactInfo</code> is a <em>factory</em> for client-side
  19. * artifacts used
  20. * to construct and send a message (and possibly receive and process a
  21. * response).</p>
  22. *
  23. * @author Harold Carr
  24. */
  25. public interface ContactInfo
  26. {
  27. /**
  28. * The {@link com.sun.corba.se.pept.broker.Broker Broker} associated
  29. * with an invocation.
  30. *
  31. * @return {@link com.sun.corba.se.pept.broker.Broker Broker}
  32. */
  33. public Broker getBroker();
  34. /**
  35. * The parent
  36. * {@link com.sun.corba.se.pept.broker.ContactInfoList ContactInfoList}
  37. * for this <code>ContactInfo</code>.
  38. *
  39. * @return
  40. * {@link com.sun.corba.se.pept.broker.ContactInfoList ContactInfoList}
  41. */
  42. public ContactInfoList getContactInfoList();
  43. /**
  44. * Used to get a
  45. * {@link com.sun.corba.se.pept.protocol.ClientRequestDispatcher
  46. * ClientRequestDispatcher}
  47. * used to handle the specific <em>protocol</em> represented by this
  48. * <code>ContactInfo</code>.
  49. *
  50. * @return
  51. * {@link com.sun.corba.se.pept.protocol.ClientRequestDispatcher
  52. * ClientRequestDispatcher} */
  53. public ClientRequestDispatcher getClientRequestDispatcher();
  54. /**
  55. * Used to determine if a
  56. * {@link com.sun.corba.se.pept.transport.Connection Connection}
  57. * will be present in an invocation.
  58. *
  59. * For example, it may be
  60. * <code>false</code> in the case of shared-memory
  61. * <code>Input/OutputObjects</code>.
  62. *
  63. * @return <code>true</code> if a
  64. * {@link com.sun.corba.se.pept.transport.Connection Connection}
  65. * will be used for an invocation.
  66. */
  67. public boolean isConnectionBased();
  68. /**
  69. * Used to determine if the
  70. * {@link com.sun.corba.se.pept.transport.Connection Connection}
  71. * used for a request should be cached.
  72. *
  73. * If <code>true</code> then PEPt will attempt to reuse an existing
  74. * {@link com.sun.corba.se.pept.transport.Connection Connection}. If
  75. * one is not found it will create a new one and cache it for future use.
  76. *
  77. *
  78. * @return <code>true</code> if
  79. * {@link com.sun.corba.se.pept.transport.Connection Connection}s
  80. * created by this <code>ContactInfo</code> should be cached.
  81. */
  82. public boolean shouldCacheConnection();
  83. /**
  84. * PEPt uses separate caches for each type of <code>ContactInfo</code>
  85. * as given by <code>getConnectionCacheType</code>.
  86. *
  87. * @return {@link java.lang.String}
  88. */
  89. public String getConnectionCacheType();
  90. /**
  91. * Set the
  92. * {@link com.sun.corba.se.pept.transport.Outbound.ConnectionCache OutboundConnectionCache}
  93. * to be used by this <code>ContactInfo</code>.
  94. *
  95. * PEPt uses separate caches for each type of <code>ContactInfo</code>
  96. * as given by {@link #getConnectionCacheType}.
  97. * {@link #setConnectionCache} and {@link #getConnectionCache} support
  98. * an optimzation to avoid hashing to find that cache.
  99. *
  100. * @param connectionCache.
  101. */
  102. public void setConnectionCache(OutboundConnectionCache connectionCache);
  103. /**
  104. * Get the
  105. * {@link com.sun.corba.se.pept.transport.Outbound.ConnectionCache OutboundConnectionCache}
  106. * used by this <code>ContactInfo</code>
  107. *
  108. * PEPt uses separate caches for each type of <code>ContactInfo</code>
  109. * as given by {@link #getConnectionCacheType}.
  110. * {@link #setConnectionCache} and {@link #getConnectionCache} support
  111. * an optimzation to avoid hashing to find that cache.
  112. *
  113. * @return
  114. * {@link com.sun.corba.se.pept.transport.ConnectionCache ConnectionCache}
  115. */
  116. public OutboundConnectionCache getConnectionCache();
  117. /**
  118. * Used to get a
  119. * {@link com.sun.corba.se.pept.transport.Connection Connection}
  120. * to send and receive messages on the specific <em>transport</em>
  121. * represented by this <code>ContactInfo</code>.
  122. *
  123. * @return
  124. * {@link com.sun.corba.se.pept.transport.Connection Connection}
  125. */
  126. public Connection createConnection();
  127. /**
  128. * Used to get a
  129. * {@link com.sun.corba.se.pept.protocol.MessageMeidator MessageMediator}
  130. * to hold internal data for a message to be sent using the specific
  131. * encoding, protocol, transport combination represented by this
  132. * <code>ContactInfo</code>.
  133. *
  134. * @return
  135. * {@link com.sun.corba.se.pept.protocol.MessageMediator MessageMediator}
  136. */
  137. public MessageMediator createMessageMediator(Broker broker,
  138. ContactInfo contactInfo,
  139. Connection connection,
  140. String methodName,
  141. boolean isOneWay);
  142. /**
  143. * Used to get a
  144. * {@link com.sun.corba.se.pept.protocol.MessageMeidator MessageMediator}
  145. * to hold internal data for a message received using the specific
  146. * encoding, protocol, transport combination represented by this
  147. * <code>ContactInfo</code>.
  148. *
  149. * @return
  150. * {@link com.sun.corba.se.pept.protocol.MessageMeidator MessageMediator}
  151. */
  152. public MessageMediator createMessageMediator(Broker broker,
  153. Connection connection);
  154. /**
  155. * Used to finish creating a
  156. * {@link com.sun.corba.se.pept.protocol.MessageMeidator MessageMediator}
  157. * with internal data for a message received using the specific
  158. * encoding, protocol, transport combination represented by this
  159. * <code>ContactInfo</code>.
  160. *
  161. * @return
  162. * {@link com.sun.corba.se.pept.protocol.MessageMediator MessageMediator}
  163. */
  164. public MessageMediator finishCreatingMessageMediator(Broker broker,
  165. Connection connection,
  166. MessageMediator messageMediator);
  167. /**
  168. * Used to get a
  169. * {@link com.sun.corba.se.pept.encoding.InputObject InputObject}
  170. * for the specific <em>encoding</em> represented by this
  171. * <code>ContactInfo</code>.
  172. *
  173. * @return
  174. * {@link com.sun.corba.se.pept.encoding.InputObject InputObject}
  175. */
  176. public InputObject createInputObject(Broker broker,
  177. MessageMediator messageMediator);
  178. /**
  179. * Used to get a
  180. * {@link com.sun.corba.se.pept.encoding.OutputObject OutputObject}
  181. * for the specific <em>encoding</em> represented by this
  182. * <code>ContactInfo</code>.
  183. *
  184. * @return
  185. * {@link com.sun.corba.se.pept.encoding.OutputObject OutputObject}
  186. */
  187. public OutputObject createOutputObject(MessageMediator messageMediator);
  188. /**
  189. * Used to lookup artifacts associated with this <code>ContactInfo</code>.
  190. *
  191. * @return the hash value.
  192. */
  193. public int hashCode();
  194. }
  195. // End of file.