KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > corba > se > spi > transport > CorbaConnection


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
8 package com.sun.corba.se.spi.transport;
9
10 import java.io.IOException JavaDoc;
11 import java.nio.ByteBuffer JavaDoc;
12 import java.nio.channels.SocketChannel JavaDoc;
13
14 import org.omg.CORBA.SystemException JavaDoc;
15
16 import com.sun.org.omg.SendingContext.CodeBase;
17
18 import com.sun.corba.se.pept.encoding.InputObject;
19 import com.sun.corba.se.pept.encoding.OutputObject;
20 import com.sun.corba.se.pept.protocol.MessageMediator;
21 import com.sun.corba.se.pept.transport.Connection;
22 import com.sun.corba.se.pept.transport.ResponseWaitingRoom;
23
24 import com.sun.corba.se.spi.ior.IOR ;
25 import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
26 import com.sun.corba.se.spi.orb.ORB;
27 import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
28
29 import com.sun.corba.se.impl.encoding.CodeSetComponentInfo;
30 import com.sun.corba.se.impl.logging.ORBUtilSystemException;
31
32 /**
33  * @author Harold Carr
34  */

35 public interface CorbaConnection
36     extends
37     Connection,
38     com.sun.corba.se.spi.legacy.connection.Connection
39 {
40     public boolean shouldUseDirectByteBuffers();
41
42     public boolean shouldReadGiopHeaderOnly();
43
44     public ByteBuffer JavaDoc read(int size, int offset, int length, long max_wait_time)
45     throws IOException JavaDoc;
46
47     public ByteBuffer JavaDoc read(ByteBuffer JavaDoc byteBuffer, int offset,
48                       int length, long max_wait_time) throws IOException JavaDoc;
49
50     public void write(ByteBuffer JavaDoc byteBuffer)
51     throws IOException JavaDoc;
52
53     public void dprint(String JavaDoc msg);
54
55     //
56
// From iiop.Connection.java
57
//
58

59     public int getNextRequestId();
60     public ORB getBroker();
61     public CodeSetComponentInfo.CodeSetContext getCodeSetContext();
62     public void setCodeSetContext(CodeSetComponentInfo.CodeSetContext csc);
63     
64     //
65
// from iiop.IIOPConnection.java
66
//
67

68     // Facade to ResponseWaitingRoom.
69
public MessageMediator clientRequestMapGet(int requestId);
70
71     public void clientReply_1_1_Put(MessageMediator x);
72     public MessageMediator clientReply_1_1_Get();
73     public void clientReply_1_1_Remove();
74
75     public void serverRequest_1_1_Put(MessageMediator x);
76     public MessageMediator serverRequest_1_1_Get();
77     public void serverRequest_1_1_Remove();
78
79     public boolean isPostInitialContexts();
80
81     // Can never be unset...
82
public void setPostInitialContexts();
83
84     public void purgeCalls(SystemException JavaDoc systemException,
85                boolean die, boolean lockHeld);
86
87     //
88
// Connection status
89
//
90
public static final int OPENING = 1;
91     public static final int ESTABLISHED = 2;
92     public static final int CLOSE_SENT = 3;
93     public static final int CLOSE_RECVD = 4;
94     public static final int ABORT = 5;
95
96     // Begin Code Base methods ---------------------------------------
97
//
98
// Set this connection's code base IOR. The IOR comes from the
99
// SendingContext. This is an optional service context, but all
100
// JavaSoft ORBs send it.
101
//
102
// The set and get methods don't need to be synchronized since the
103
// first possible get would occur during reading a valuetype, and
104
// that would be after the set.
105

106     // Sets this connection's code base IOR. This is done after
107
// getting the IOR out of the SendingContext service context.
108
// Our ORBs always send this, but it's optional in CORBA.
109

110     void setCodeBaseIOR(IOR ior);
111
112     IOR getCodeBaseIOR();
113
114     // Get a CodeBase stub to use in unmarshaling. The CachedCodeBase
115
// won't connect to the remote codebase unless it's necessary.
116
CodeBase getCodeBase();
117
118     // End Code Base methods -----------------------------------------
119

120     public void sendCloseConnection(GIOPVersion giopVersion)
121     throws IOException JavaDoc;
122
123     public void sendMessageError(GIOPVersion giopVersion)
124     throws IOException JavaDoc;
125
126     public void sendCancelRequest(GIOPVersion giopVersion, int requestId)
127     throws
128         IOException JavaDoc;
129
130     public void sendCancelRequestWithLock(GIOPVersion giopVersion,
131                       int requestId)
132     throws
133         IOException JavaDoc;
134
135     public ResponseWaitingRoom getResponseWaitingRoom();
136
137     public void serverRequestMapPut(int requestId,
138                     CorbaMessageMediator messageMediator);
139     public CorbaMessageMediator serverRequestMapGet(int requestId);
140     public void serverRequestMapRemove(int requestId);
141
142     // REVISIT: WRONG: should not expose sockets here.
143
public SocketChannel JavaDoc getSocketChannel();
144
145     // REVISIT - MessageMediator parameter?
146
public void serverRequestProcessingBegins();
147     public void serverRequestProcessingEnds();
148 }
149
150 // End of file.
151

152
Popular Tags