corba/src/share/classes/com/sun/corba/se/pept/transport/Acceptor.java
author ohair
Tue, 25 May 2010 15:52:11 -0700
changeset 5555 b2b5ed3f0d0d
parent 4 02bb8761fcce
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) 2001, 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.pept.transport;
02bb8761fcce Initial load
duke
parents:
diff changeset
    27
02bb8761fcce Initial load
duke
parents:
diff changeset
    28
import com.sun.corba.se.pept.broker.Broker;
02bb8761fcce Initial load
duke
parents:
diff changeset
    29
import com.sun.corba.se.pept.protocol.MessageMediator;
02bb8761fcce Initial load
duke
parents:
diff changeset
    30
import com.sun.corba.se.pept.encoding.InputObject;
02bb8761fcce Initial load
duke
parents:
diff changeset
    31
import com.sun.corba.se.pept.encoding.OutputObject;
02bb8761fcce Initial load
duke
parents:
diff changeset
    32
import com.sun.corba.se.pept.transport.Connection;
02bb8761fcce Initial load
duke
parents:
diff changeset
    33
import com.sun.corba.se.pept.transport.EventHandler;
02bb8761fcce Initial load
duke
parents:
diff changeset
    34
02bb8761fcce Initial load
duke
parents:
diff changeset
    35
/**
02bb8761fcce Initial load
duke
parents:
diff changeset
    36
 * <p>The <b><em>primary</em></b> PEPt server-side plug-in point and enabler
02bb8761fcce Initial load
duke
parents:
diff changeset
    37
 * for <b><em>altenate encodings, protocols and transports</em></b>.</p>
02bb8761fcce Initial load
duke
parents:
diff changeset
    38
 *
02bb8761fcce Initial load
duke
parents:
diff changeset
    39
 * <p><code>Acceptor</code> is a <em>factory</em> for client-side
02bb8761fcce Initial load
duke
parents:
diff changeset
    40
 * artifacts used to receive a message (and possibly send a response).</p>
02bb8761fcce Initial load
duke
parents:
diff changeset
    41
 *
02bb8761fcce Initial load
duke
parents:
diff changeset
    42
 * @author Harold Carr
02bb8761fcce Initial load
duke
parents:
diff changeset
    43
 */
02bb8761fcce Initial load
duke
parents:
diff changeset
    44
public interface Acceptor
02bb8761fcce Initial load
duke
parents:
diff changeset
    45
{
02bb8761fcce Initial load
duke
parents:
diff changeset
    46
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
    47
     * Used to initialize an <code>Acceptor</code>.
02bb8761fcce Initial load
duke
parents:
diff changeset
    48
     *
02bb8761fcce Initial load
duke
parents:
diff changeset
    49
     * For example, initialization may mean to create a
02bb8761fcce Initial load
duke
parents:
diff changeset
    50
     * {@link java.nio.channels.ServerSocketChannel ServerSocketChannel}.
02bb8761fcce Initial load
duke
parents:
diff changeset
    51
     *
02bb8761fcce Initial load
duke
parents:
diff changeset
    52
     * Note: this must be prepared to be be called multiple times.
02bb8761fcce Initial load
duke
parents:
diff changeset
    53
     *
02bb8761fcce Initial load
duke
parents:
diff changeset
    54
     * @return <code>true</code> when it performs initializatin
02bb8761fcce Initial load
duke
parents:
diff changeset
    55
     * actions (typically the first call.
02bb8761fcce Initial load
duke
parents:
diff changeset
    56
     */
02bb8761fcce Initial load
duke
parents:
diff changeset
    57
    public boolean initialize();
02bb8761fcce Initial load
duke
parents:
diff changeset
    58
02bb8761fcce Initial load
duke
parents:
diff changeset
    59
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
    60
     * Used to determine if an <code>Acceptor</code> has been initialized.
02bb8761fcce Initial load
duke
parents:
diff changeset
    61
     *
02bb8761fcce Initial load
duke
parents:
diff changeset
    62
     * @return <code>true</code. if the <code>Acceptor</code> has been
02bb8761fcce Initial load
duke
parents:
diff changeset
    63
     * initialized.
02bb8761fcce Initial load
duke
parents:
diff changeset
    64
     */
02bb8761fcce Initial load
duke
parents:
diff changeset
    65
    public boolean initialized();
02bb8761fcce Initial load
duke
parents:
diff changeset
    66
02bb8761fcce Initial load
duke
parents:
diff changeset
    67
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
    68
     * PEPt uses separate caches for each type of <code>Acceptor</code>
02bb8761fcce Initial load
duke
parents:
diff changeset
    69
     * as given by <code>getConnectionCacheType</code>.
02bb8761fcce Initial load
duke
parents:
diff changeset
    70
     *
02bb8761fcce Initial load
duke
parents:
diff changeset
    71
     * @return {@link java.lang.String}
02bb8761fcce Initial load
duke
parents:
diff changeset
    72
     */
02bb8761fcce Initial load
duke
parents:
diff changeset
    73
    public String getConnectionCacheType();
02bb8761fcce Initial load
duke
parents:
diff changeset
    74
02bb8761fcce Initial load
duke
parents:
diff changeset
    75
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
    76
     * Set the
02bb8761fcce Initial load
duke
parents:
diff changeset
    77
     * {@link com.sun.corba.se.pept.transport.Inbound.ConnectionCache InboundConnectionCache}
02bb8761fcce Initial load
duke
parents:
diff changeset
    78
     * to be used by this <code>Acceptor</code>.
02bb8761fcce Initial load
duke
parents:
diff changeset
    79
     *
02bb8761fcce Initial load
duke
parents:
diff changeset
    80
     * PEPt uses separate caches for each type of <code>Acceptor</code>
02bb8761fcce Initial load
duke
parents:
diff changeset
    81
     * as given by {@link #getConnectionCacheType}.
02bb8761fcce Initial load
duke
parents:
diff changeset
    82
     * {@link #setConnectionCache} and {@link #getConnectionCache} support
02bb8761fcce Initial load
duke
parents:
diff changeset
    83
     * an optimzation to avoid hashing to find that cache.
02bb8761fcce Initial load
duke
parents:
diff changeset
    84
     *
02bb8761fcce Initial load
duke
parents:
diff changeset
    85
     * @param connectionCache.
02bb8761fcce Initial load
duke
parents:
diff changeset
    86
     */
02bb8761fcce Initial load
duke
parents:
diff changeset
    87
    public void setConnectionCache(InboundConnectionCache connectionCache);
02bb8761fcce Initial load
duke
parents:
diff changeset
    88
02bb8761fcce Initial load
duke
parents:
diff changeset
    89
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
    90
     * Get the
02bb8761fcce Initial load
duke
parents:
diff changeset
    91
     * {@link com.sun.corba.se.pept.transport.Inbound.ConnectionCache InboundConnectionCache}
02bb8761fcce Initial load
duke
parents:
diff changeset
    92
     * used by this <code>Acceptor</code>
02bb8761fcce Initial load
duke
parents:
diff changeset
    93
     *
02bb8761fcce Initial load
duke
parents:
diff changeset
    94
     * PEPt uses separate caches for each type of <code>Acceptor</code>
02bb8761fcce Initial load
duke
parents:
diff changeset
    95
     * as given by {@link #getConnectionCacheType}.
02bb8761fcce Initial load
duke
parents:
diff changeset
    96
     * {@link #setConnectionCache} and {@link #getConnectionCache} support
02bb8761fcce Initial load
duke
parents:
diff changeset
    97
     * an optimzation to avoid hashing to find that cache.
02bb8761fcce Initial load
duke
parents:
diff changeset
    98
     *
02bb8761fcce Initial load
duke
parents:
diff changeset
    99
     * @return
02bb8761fcce Initial load
duke
parents:
diff changeset
   100
     * {@link com.sun.corba.se.pept.transport.ConnectionCache ConnectionCache}
02bb8761fcce Initial load
duke
parents:
diff changeset
   101
     */
02bb8761fcce Initial load
duke
parents:
diff changeset
   102
    public InboundConnectionCache getConnectionCache();
02bb8761fcce Initial load
duke
parents:
diff changeset
   103
02bb8761fcce Initial load
duke
parents:
diff changeset
   104
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   105
     * Used to determine if the <code>Acceptor</code> should register
02bb8761fcce Initial load
duke
parents:
diff changeset
   106
     * with
02bb8761fcce Initial load
duke
parents:
diff changeset
   107
     * {@link com.sun.corba.se.pept.transport.Selector Selector}
02bb8761fcce Initial load
duke
parents:
diff changeset
   108
     * to handle accept events.
02bb8761fcce Initial load
duke
parents:
diff changeset
   109
     *
02bb8761fcce Initial load
duke
parents:
diff changeset
   110
     * For example, this may be <em>false</em> in the case of Solaris Doors
02bb8761fcce Initial load
duke
parents:
diff changeset
   111
     * which do not actively listen.
02bb8761fcce Initial load
duke
parents:
diff changeset
   112
     *
02bb8761fcce Initial load
duke
parents:
diff changeset
   113
     * @return <code>true</code> if the <code>Acceptor</code> should be
02bb8761fcce Initial load
duke
parents:
diff changeset
   114
     * registered with
02bb8761fcce Initial load
duke
parents:
diff changeset
   115
     * {@link com.sun.corba.se.pept.transport.Selector Selector}
02bb8761fcce Initial load
duke
parents:
diff changeset
   116
     */
02bb8761fcce Initial load
duke
parents:
diff changeset
   117
    public boolean shouldRegisterAcceptEvent();
02bb8761fcce Initial load
duke
parents:
diff changeset
   118
02bb8761fcce Initial load
duke
parents:
diff changeset
   119
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   120
     * Accept a connection request.
02bb8761fcce Initial load
duke
parents:
diff changeset
   121
     *
02bb8761fcce Initial load
duke
parents:
diff changeset
   122
     * This is called either when the selector gets an accept event
02bb8761fcce Initial load
duke
parents:
diff changeset
   123
     * for this <code>Acceptor</code> or by a
02bb8761fcce Initial load
duke
parents:
diff changeset
   124
     * {@link com.sun.corba.se.pept.transport.ListenerThread ListenerThread}.
02bb8761fcce Initial load
duke
parents:
diff changeset
   125
     *
02bb8761fcce Initial load
duke
parents:
diff changeset
   126
     * It results in a
02bb8761fcce Initial load
duke
parents:
diff changeset
   127
     * {@link com.sun.corba.se.pept.transport.Connection Connection}
02bb8761fcce Initial load
duke
parents:
diff changeset
   128
     * being created.
02bb8761fcce Initial load
duke
parents:
diff changeset
   129
     */
02bb8761fcce Initial load
duke
parents:
diff changeset
   130
    public void accept();
02bb8761fcce Initial load
duke
parents:
diff changeset
   131
02bb8761fcce Initial load
duke
parents:
diff changeset
   132
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   133
     * Close the <code>Acceptor</code>.
02bb8761fcce Initial load
duke
parents:
diff changeset
   134
     */
02bb8761fcce Initial load
duke
parents:
diff changeset
   135
    public void close();
02bb8761fcce Initial load
duke
parents:
diff changeset
   136
02bb8761fcce Initial load
duke
parents:
diff changeset
   137
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   138
     * Get the
02bb8761fcce Initial load
duke
parents:
diff changeset
   139
     * {@link com.sun.corba.se.pept.transport.EventHandler EventHandler}
02bb8761fcce Initial load
duke
parents:
diff changeset
   140
     * associated with this <code>Acceptor</code>.
02bb8761fcce Initial load
duke
parents:
diff changeset
   141
     *
02bb8761fcce Initial load
duke
parents:
diff changeset
   142
     * @return
02bb8761fcce Initial load
duke
parents:
diff changeset
   143
     * {@link com.sun.corba.se.pept.transport.EventHandler EventHandler}
02bb8761fcce Initial load
duke
parents:
diff changeset
   144
     */
02bb8761fcce Initial load
duke
parents:
diff changeset
   145
    public EventHandler getEventHandler();
02bb8761fcce Initial load
duke
parents:
diff changeset
   146
02bb8761fcce Initial load
duke
parents:
diff changeset
   147
    //
02bb8761fcce Initial load
duke
parents:
diff changeset
   148
    // Factory methods
02bb8761fcce Initial load
duke
parents:
diff changeset
   149
    //
02bb8761fcce Initial load
duke
parents:
diff changeset
   150
02bb8761fcce Initial load
duke
parents:
diff changeset
   151
    // REVISIT: Identical to ContactInfo method.  Refactor into base interface.
02bb8761fcce Initial load
duke
parents:
diff changeset
   152
02bb8761fcce Initial load
duke
parents:
diff changeset
   153
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   154
     * Used to get a
02bb8761fcce Initial load
duke
parents:
diff changeset
   155
     * {@link com.sun.corba.se.pept.protocol.MessageMeidator MessageMediator}
02bb8761fcce Initial load
duke
parents:
diff changeset
   156
     * to hold internal data for a message received using the specific
02bb8761fcce Initial load
duke
parents:
diff changeset
   157
     * encoding, protocol, transport combination represented by this
02bb8761fcce Initial load
duke
parents:
diff changeset
   158
     * <code>Acceptor</code>.
02bb8761fcce Initial load
duke
parents:
diff changeset
   159
     *
02bb8761fcce Initial load
duke
parents:
diff changeset
   160
     * @return
02bb8761fcce Initial load
duke
parents:
diff changeset
   161
     * {@link com.sun.corba.se.pept.protocol.MessageMeidator MessageMediator}
02bb8761fcce Initial load
duke
parents:
diff changeset
   162
     */
02bb8761fcce Initial load
duke
parents:
diff changeset
   163
    public MessageMediator createMessageMediator(Broker xbroker,
02bb8761fcce Initial load
duke
parents:
diff changeset
   164
                                                 Connection xconnection);
02bb8761fcce Initial load
duke
parents:
diff changeset
   165
02bb8761fcce Initial load
duke
parents:
diff changeset
   166
    // REVISIT: Identical to ContactInfo method.  Refactor into base interface.
02bb8761fcce Initial load
duke
parents:
diff changeset
   167
02bb8761fcce Initial load
duke
parents:
diff changeset
   168
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   169
     * Used to finish creating a
02bb8761fcce Initial load
duke
parents:
diff changeset
   170
     * {@link com.sun.corba.se.pept.protocol.MessageMeidator MessageMediator}
02bb8761fcce Initial load
duke
parents:
diff changeset
   171
     * to with internal data for a message received using the specific
02bb8761fcce Initial load
duke
parents:
diff changeset
   172
     * encoding, protocol, transport combination represented by this
02bb8761fcce Initial load
duke
parents:
diff changeset
   173
     * <code>Acceptor</code>.
02bb8761fcce Initial load
duke
parents:
diff changeset
   174
     *
02bb8761fcce Initial load
duke
parents:
diff changeset
   175
     * @return
02bb8761fcce Initial load
duke
parents:
diff changeset
   176
     * {@link com.sun.corba.se.pept.protocol.MessageMediator MessageMediator}
02bb8761fcce Initial load
duke
parents:
diff changeset
   177
     */
02bb8761fcce Initial load
duke
parents:
diff changeset
   178
02bb8761fcce Initial load
duke
parents:
diff changeset
   179
    public MessageMediator finishCreatingMessageMediator(Broker broker,
02bb8761fcce Initial load
duke
parents:
diff changeset
   180
                                                         Connection xconnection,
02bb8761fcce Initial load
duke
parents:
diff changeset
   181
                                                         MessageMediator messageMediator);
02bb8761fcce Initial load
duke
parents:
diff changeset
   182
02bb8761fcce Initial load
duke
parents:
diff changeset
   183
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   184
     * Used to get a
02bb8761fcce Initial load
duke
parents:
diff changeset
   185
     * {@link com.sun.corba.se.pept.encoding.InputObject InputObject}
02bb8761fcce Initial load
duke
parents:
diff changeset
   186
     * for the specific <em>encoding</em> represented by this
02bb8761fcce Initial load
duke
parents:
diff changeset
   187
     * <code>Acceptor</code>.
02bb8761fcce Initial load
duke
parents:
diff changeset
   188
     *
02bb8761fcce Initial load
duke
parents:
diff changeset
   189
     * @return
02bb8761fcce Initial load
duke
parents:
diff changeset
   190
     * {@link com.sun.corba.se.pept.encoding.InputObject InputObject}
02bb8761fcce Initial load
duke
parents:
diff changeset
   191
     */
02bb8761fcce Initial load
duke
parents:
diff changeset
   192
    public InputObject createInputObject(Broker broker,
02bb8761fcce Initial load
duke
parents:
diff changeset
   193
                                         MessageMediator messageMediator);
02bb8761fcce Initial load
duke
parents:
diff changeset
   194
02bb8761fcce Initial load
duke
parents:
diff changeset
   195
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   196
     * Used to get a
02bb8761fcce Initial load
duke
parents:
diff changeset
   197
     * {@link com.sun.corba.se.pept.encoding.OutputObject OutputObject}
02bb8761fcce Initial load
duke
parents:
diff changeset
   198
     * for the specific <em>encoding</em> represented by this
02bb8761fcce Initial load
duke
parents:
diff changeset
   199
     * <code>Acceptor</code>.
02bb8761fcce Initial load
duke
parents:
diff changeset
   200
     *
02bb8761fcce Initial load
duke
parents:
diff changeset
   201
     * @return
02bb8761fcce Initial load
duke
parents:
diff changeset
   202
     * {@link com.sun.corba.se.pept.encoding.OutputObject OutputObject}
02bb8761fcce Initial load
duke
parents:
diff changeset
   203
     */
02bb8761fcce Initial load
duke
parents:
diff changeset
   204
    public OutputObject createOutputObject(Broker broker,
02bb8761fcce Initial load
duke
parents:
diff changeset
   205
                                           MessageMediator messageMediator);
02bb8761fcce Initial load
duke
parents:
diff changeset
   206
02bb8761fcce Initial load
duke
parents:
diff changeset
   207
    //
02bb8761fcce Initial load
duke
parents:
diff changeset
   208
    // Usage dictates implementation equals and hashCode.
02bb8761fcce Initial load
duke
parents:
diff changeset
   209
    //
02bb8761fcce Initial load
duke
parents:
diff changeset
   210
}
02bb8761fcce Initial load
duke
parents:
diff changeset
   211
02bb8761fcce Initial load
duke
parents:
diff changeset
   212
// End of file.