/* * @(#)Acceptor.java 1.21 04/06/21 * * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ package com.sun.corba.se.pept.transport; import com.sun.corba.se.pept.broker.Broker; import com.sun.corba.se.pept.protocol.MessageMediator; import com.sun.corba.se.pept.encoding.InputObject; import com.sun.corba.se.pept.encoding.OutputObject; import com.sun.corba.se.pept.transport.Connection; import com.sun.corba.se.pept.transport.EventHandler; /** *

The primary PEPt server-side plug-in point and enabler * for altenate encodings, protocols and transports.

* *

Acceptor is a factory for client-side * artifacts used to receive a message (and possibly send a response).

* * @author Harold Carr */ public interface Acceptor { /** * Used to initialize an Acceptor. * * For example, initialization may mean to create a * {@link java.nio.channels.ServerSocketChannel ServerSocketChannel}. * * Note: this must be prepared to be be called multiple times. * * @return true when it performs initializatin * actions (typically the first call. */ public boolean initialize(); /** * Used to determine if an Acceptor has been initialized. * * @return trueAcceptor has been * initialized. */ public boolean initialized(); /** * PEPt uses separate caches for each type of Acceptor * as given by getConnectionCacheType. * * @return {@link java.lang.String} */ public String getConnectionCacheType(); /** * Set the * {@link com.sun.corba.se.pept.transport.Inbound.ConnectionCache InboundConnectionCache} * to be used by this Acceptor. * * PEPt uses separate caches for each type of Acceptor * as given by {@link #getConnectionCacheType}. * {@link #setConnectionCache} and {@link #getConnectionCache} support * an optimzation to avoid hashing to find that cache. * * @param connectionCache. */ public void setConnectionCache(InboundConnectionCache connectionCache); /** * Get the * {@link com.sun.corba.se.pept.transport.Inbound.ConnectionCache InboundConnectionCache} * used by this Acceptor * * PEPt uses separate caches for each type of Acceptor * as given by {@link #getConnectionCacheType}. * {@link #setConnectionCache} and {@link #getConnectionCache} support * an optimzation to avoid hashing to find that cache. * * @return * {@link com.sun.corba.se.pept.transport.ConnectionCache ConnectionCache} */ public InboundConnectionCache getConnectionCache(); /** * Used to determine if the Acceptor should register * with * {@link com.sun.corba.se.pept.transport.Selector Selector} * to handle accept events. * * For example, this may be false in the case of Solaris Doors * which do not actively listen. * * @return true if the Acceptor should be * registered with * {@link com.sun.corba.se.pept.transport.Selector Selector} */ public boolean shouldRegisterAcceptEvent(); /** * Accept a connection request. * * This is called either when the selector gets an accept event * for this Acceptor or by a * {@link com.sun.corba.se.pept.transport.ListenerThread ListenerThread}. * * It results in a * {@link com.sun.corba.se.pept.transport.Connection Connection} * being created. */ public void accept(); /** * Close the Acceptor. */ public void close(); /** * Get the * {@link com.sun.corba.se.pept.transport.EventHandler EventHandler} * associated with this Acceptor. * * @return * {@link com.sun.corba.se.pept.transport.EventHandler EventHandler} */ public EventHandler getEventHandler(); // // Factory methods // // REVISIT: Identical to ContactInfo method. Refactor into base interface. /** * Used to get a * {@link com.sun.corba.se.pept.protocol.MessageMeidator MessageMediator} * to hold internal data for a message received using the specific * encoding, protocol, transport combination represented by this * Acceptor. * * @return * {@link com.sun.corba.se.pept.protocol.MessageMeidator MessageMediator} */ public MessageMediator createMessageMediator(Broker xbroker, Connection xconnection); // REVISIT: Identical to ContactInfo method. Refactor into base interface. /** * Used to finish creating a * {@link com.sun.corba.se.pept.protocol.MessageMeidator MessageMediator} * to with internal data for a message received using the specific * encoding, protocol, transport combination represented by this * Acceptor. * * @return * {@link com.sun.corba.se.pept.protocol.MessageMediator MessageMediator} */ public MessageMediator finishCreatingMessageMediator(Broker broker, Connection xconnection, MessageMediator messageMediator); /** * Used to get a * {@link com.sun.corba.se.pept.encoding.InputObject InputObject} * for the specific encoding represented by this * Acceptor. * * @return * {@link com.sun.corba.se.pept.encoding.InputObject InputObject} */ public InputObject createInputObject(Broker broker, MessageMediator messageMediator); /** * Used to get a * {@link com.sun.corba.se.pept.encoding.OutputObject OutputObject} * for the specific encoding represented by this * Acceptor. * * @return * {@link com.sun.corba.se.pept.encoding.OutputObject OutputObject} */ public OutputObject createOutputObject(Broker broker, MessageMediator messageMediator); // // Usage dictates implementation equals and hashCode. // } // End of file.