CorbaConnection.java revision 608:7e06bf1dcb09
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 */ 25 26package com.sun.corba.se.spi.transport; 27 28import java.io.IOException; 29import java.nio.ByteBuffer; 30import java.nio.channels.SocketChannel; 31 32import org.omg.CORBA.SystemException; 33 34import com.sun.org.omg.SendingContext.CodeBase; 35 36import com.sun.corba.se.pept.encoding.InputObject; 37import com.sun.corba.se.pept.encoding.OutputObject; 38import com.sun.corba.se.pept.protocol.MessageMediator; 39import com.sun.corba.se.pept.transport.Connection; 40import com.sun.corba.se.pept.transport.ResponseWaitingRoom; 41 42import com.sun.corba.se.spi.ior.IOR ; 43import com.sun.corba.se.spi.ior.iiop.GIOPVersion; 44import com.sun.corba.se.spi.orb.ORB; 45import com.sun.corba.se.spi.protocol.CorbaMessageMediator; 46 47import com.sun.corba.se.impl.encoding.CodeSetComponentInfo; 48import com.sun.corba.se.impl.logging.ORBUtilSystemException; 49 50/** 51 * @author Harold Carr 52 */ 53public interface CorbaConnection 54 extends 55 Connection, 56 com.sun.corba.se.spi.legacy.connection.Connection 57{ 58 public boolean shouldUseDirectByteBuffers(); 59 60 public boolean shouldReadGiopHeaderOnly(); 61 62 public ByteBuffer read(int size, int offset, int length, long max_wait_time) 63 throws IOException; 64 65 public ByteBuffer read(ByteBuffer byteBuffer, int offset, 66 int length, long max_wait_time) throws IOException; 67 68 public void write(ByteBuffer byteBuffer) 69 throws IOException; 70 71 public void dprint(String msg); 72 73 // 74 // From iiop.Connection.java 75 // 76 77 public int getNextRequestId(); 78 public ORB getBroker(); 79 public CodeSetComponentInfo.CodeSetContext getCodeSetContext(); 80 public void setCodeSetContext(CodeSetComponentInfo.CodeSetContext csc); 81 82 // 83 // from iiop.IIOPConnection.java 84 // 85 86 // Facade to ResponseWaitingRoom. 87 public MessageMediator clientRequestMapGet(int requestId); 88 89 public void clientReply_1_1_Put(MessageMediator x); 90 public MessageMediator clientReply_1_1_Get(); 91 public void clientReply_1_1_Remove(); 92 93 public void serverRequest_1_1_Put(MessageMediator x); 94 public MessageMediator serverRequest_1_1_Get(); 95 public void serverRequest_1_1_Remove(); 96 97 public boolean isPostInitialContexts(); 98 99 // Can never be unset... 100 public void setPostInitialContexts(); 101 102 public void purgeCalls(SystemException systemException, 103 boolean die, boolean lockHeld); 104 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; 113 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. 123 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. 127 128 void setCodeBaseIOR(IOR ior); 129 130 IOR getCodeBaseIOR(); 131 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(); 135 136 // End Code Base methods ----------------------------------------- 137 138 public void sendCloseConnection(GIOPVersion giopVersion) 139 throws IOException; 140 141 public void sendMessageError(GIOPVersion giopVersion) 142 throws IOException; 143 144 public void sendCancelRequest(GIOPVersion giopVersion, int requestId) 145 throws 146 IOException; 147 148 public void sendCancelRequestWithLock(GIOPVersion giopVersion, 149 int requestId) 150 throws 151 IOException; 152 153 public ResponseWaitingRoom getResponseWaitingRoom(); 154 155 public void serverRequestMapPut(int requestId, 156 CorbaMessageMediator messageMediator); 157 public CorbaMessageMediator serverRequestMapGet(int requestId); 158 public void serverRequestMapRemove(int requestId); 159 160 // REVISIT: WRONG: should not expose sockets here. 161 public SocketChannel getSocketChannel(); 162 163 // REVISIT - MessageMediator parameter? 164 public void serverRequestProcessingBegins(); 165 public void serverRequestProcessingEnds(); 166 167 /** Clean up all connection resources. Used when shutting down an ORB. 168 */ 169 public void closeConnectionResources(); 170} 171 172// End of file. 173