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