Tue, 28 Dec 2010 15:52:36 -0800
6962318: Update copyright year
Reviewed-by: xdono
1 /*
2 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
26 package com.sun.corba.se.spi.transport;
28 import java.io.IOException;
29 import java.nio.ByteBuffer;
30 import java.nio.channels.SocketChannel;
32 import org.omg.CORBA.SystemException;
34 import com.sun.org.omg.SendingContext.CodeBase;
36 import com.sun.corba.se.pept.encoding.InputObject;
37 import com.sun.corba.se.pept.encoding.OutputObject;
38 import com.sun.corba.se.pept.protocol.MessageMediator;
39 import com.sun.corba.se.pept.transport.Connection;
40 import com.sun.corba.se.pept.transport.ResponseWaitingRoom;
42 import com.sun.corba.se.spi.ior.IOR ;
43 import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
44 import com.sun.corba.se.spi.orb.ORB;
45 import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
47 import com.sun.corba.se.impl.encoding.CodeSetComponentInfo;
48 import com.sun.corba.se.impl.logging.ORBUtilSystemException;
50 /**
51 * @author Harold Carr
52 */
53 public interface CorbaConnection
54 extends
55 Connection,
56 com.sun.corba.se.spi.legacy.connection.Connection
57 {
58 public boolean shouldUseDirectByteBuffers();
60 public boolean shouldReadGiopHeaderOnly();
62 public ByteBuffer read(int size, int offset, int length, long max_wait_time)
63 throws IOException;
65 public ByteBuffer read(ByteBuffer byteBuffer, int offset,
66 int length, long max_wait_time) throws IOException;
68 public void write(ByteBuffer byteBuffer)
69 throws IOException;
71 public void dprint(String msg);
73 //
74 // From iiop.Connection.java
75 //
77 public int getNextRequestId();
78 public ORB getBroker();
79 public CodeSetComponentInfo.CodeSetContext getCodeSetContext();
80 public void setCodeSetContext(CodeSetComponentInfo.CodeSetContext csc);
82 //
83 // from iiop.IIOPConnection.java
84 //
86 // Facade to ResponseWaitingRoom.
87 public MessageMediator clientRequestMapGet(int requestId);
89 public void clientReply_1_1_Put(MessageMediator x);
90 public MessageMediator clientReply_1_1_Get();
91 public void clientReply_1_1_Remove();
93 public void serverRequest_1_1_Put(MessageMediator x);
94 public MessageMediator serverRequest_1_1_Get();
95 public void serverRequest_1_1_Remove();
97 public boolean isPostInitialContexts();
99 // Can never be unset...
100 public void setPostInitialContexts();
102 public void purgeCalls(SystemException systemException,
103 boolean die, boolean lockHeld);
105 //
106 // Connection status
107 //
108 public static final int OPENING = 1;
109 public static final int ESTABLISHED = 2;
110 public static final int CLOSE_SENT = 3;
111 public static final int CLOSE_RECVD = 4;
112 public static final int ABORT = 5;
114 // Begin Code Base methods ---------------------------------------
115 //
116 // Set this connection's code base IOR. The IOR comes from the
117 // SendingContext. This is an optional service context, but all
118 // JavaSoft ORBs send it.
119 //
120 // The set and get methods don't need to be synchronized since the
121 // first possible get would occur during reading a valuetype, and
122 // that would be after the set.
124 // Sets this connection's code base IOR. This is done after
125 // getting the IOR out of the SendingContext service context.
126 // Our ORBs always send this, but it's optional in CORBA.
128 void setCodeBaseIOR(IOR ior);
130 IOR getCodeBaseIOR();
132 // Get a CodeBase stub to use in unmarshaling. The CachedCodeBase
133 // won't connect to the remote codebase unless it's necessary.
134 CodeBase getCodeBase();
136 // End Code Base methods -----------------------------------------
138 public void sendCloseConnection(GIOPVersion giopVersion)
139 throws IOException;
141 public void sendMessageError(GIOPVersion giopVersion)
142 throws IOException;
144 public void sendCancelRequest(GIOPVersion giopVersion, int requestId)
145 throws
146 IOException;
148 public void sendCancelRequestWithLock(GIOPVersion giopVersion,
149 int requestId)
150 throws
151 IOException;
153 public ResponseWaitingRoom getResponseWaitingRoom();
155 public void serverRequestMapPut(int requestId,
156 CorbaMessageMediator messageMediator);
157 public CorbaMessageMediator serverRequestMapGet(int requestId);
158 public void serverRequestMapRemove(int requestId);
160 // REVISIT: WRONG: should not expose sockets here.
161 public SocketChannel getSocketChannel();
163 // REVISIT - MessageMediator parameter?
164 public void serverRequestProcessingBegins();
165 public void serverRequestProcessingEnds();
167 /** Clean up all connection resources. Used when shutting down an ORB.
168 */
169 public void closeConnectionResources();
170 }
172 // End of file.