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