1. /*
  2. * @(#)CorbaConnection.java 1.28 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.spi.transport;
  8. import java.io.IOException;
  9. import java.nio.ByteBuffer;
  10. import java.nio.channels.SocketChannel;
  11. import org.omg.CORBA.SystemException;
  12. import com.sun.org.omg.SendingContext.CodeBase;
  13. import com.sun.corba.se.pept.encoding.InputObject;
  14. import com.sun.corba.se.pept.encoding.OutputObject;
  15. import com.sun.corba.se.pept.protocol.MessageMediator;
  16. import com.sun.corba.se.pept.transport.Connection;
  17. import com.sun.corba.se.pept.transport.ResponseWaitingRoom;
  18. import com.sun.corba.se.spi.ior.IOR ;
  19. import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
  20. import com.sun.corba.se.spi.orb.ORB;
  21. import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
  22. import com.sun.corba.se.impl.encoding.CodeSetComponentInfo;
  23. import com.sun.corba.se.impl.logging.ORBUtilSystemException;
  24. /**
  25. * @author Harold Carr
  26. */
  27. public interface CorbaConnection
  28. extends
  29. Connection,
  30. com.sun.corba.se.spi.legacy.connection.Connection
  31. {
  32. public boolean shouldUseDirectByteBuffers();
  33. public boolean shouldReadGiopHeaderOnly();
  34. public ByteBuffer read(int size, int offset, int length, long max_wait_time)
  35. throws IOException;
  36. public ByteBuffer read(ByteBuffer byteBuffer, int offset,
  37. int length, long max_wait_time) throws IOException;
  38. public void write(ByteBuffer byteBuffer)
  39. throws IOException;
  40. public void dprint(String msg);
  41. //
  42. // From iiop.Connection.java
  43. //
  44. public int getNextRequestId();
  45. public ORB getBroker();
  46. public CodeSetComponentInfo.CodeSetContext getCodeSetContext();
  47. public void setCodeSetContext(CodeSetComponentInfo.CodeSetContext csc);
  48. //
  49. // from iiop.IIOPConnection.java
  50. //
  51. // Facade to ResponseWaitingRoom.
  52. public MessageMediator clientRequestMapGet(int requestId);
  53. public void clientReply_1_1_Put(MessageMediator x);
  54. public MessageMediator clientReply_1_1_Get();
  55. public void clientReply_1_1_Remove();
  56. public void serverRequest_1_1_Put(MessageMediator x);
  57. public MessageMediator serverRequest_1_1_Get();
  58. public void serverRequest_1_1_Remove();
  59. public boolean isPostInitialContexts();
  60. // Can never be unset...
  61. public void setPostInitialContexts();
  62. public void purgeCalls(SystemException systemException,
  63. boolean die, boolean lockHeld);
  64. //
  65. // Connection status
  66. //
  67. public static final int OPENING = 1;
  68. public static final int ESTABLISHED = 2;
  69. public static final int CLOSE_SENT = 3;
  70. public static final int CLOSE_RECVD = 4;
  71. public static final int ABORT = 5;
  72. // Begin Code Base methods ---------------------------------------
  73. //
  74. // Set this connection's code base IOR. The IOR comes from the
  75. // SendingContext. This is an optional service context, but all
  76. // JavaSoft ORBs send it.
  77. //
  78. // The set and get methods don't need to be synchronized since the
  79. // first possible get would occur during reading a valuetype, and
  80. // that would be after the set.
  81. // Sets this connection's code base IOR. This is done after
  82. // getting the IOR out of the SendingContext service context.
  83. // Our ORBs always send this, but it's optional in CORBA.
  84. void setCodeBaseIOR(IOR ior);
  85. IOR getCodeBaseIOR();
  86. // Get a CodeBase stub to use in unmarshaling. The CachedCodeBase
  87. // won't connect to the remote codebase unless it's necessary.
  88. CodeBase getCodeBase();
  89. // End Code Base methods -----------------------------------------
  90. public void sendCloseConnection(GIOPVersion giopVersion)
  91. throws IOException;
  92. public void sendMessageError(GIOPVersion giopVersion)
  93. throws IOException;
  94. public void sendCancelRequest(GIOPVersion giopVersion, int requestId)
  95. throws
  96. IOException;
  97. public void sendCancelRequestWithLock(GIOPVersion giopVersion,
  98. int requestId)
  99. throws
  100. IOException;
  101. public ResponseWaitingRoom getResponseWaitingRoom();
  102. public void serverRequestMapPut(int requestId,
  103. CorbaMessageMediator messageMediator);
  104. public CorbaMessageMediator serverRequestMapGet(int requestId);
  105. public void serverRequestMapRemove(int requestId);
  106. // REVISIT: WRONG: should not expose sockets here.
  107. public SocketChannel getSocketChannel();
  108. // REVISIT - MessageMediator parameter?
  109. public void serverRequestProcessingBegins();
  110. public void serverRequestProcessingEnds();
  111. }
  112. // End of file.