/*
 * 
 * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
 * 
 * The contents of this file are subject to the Sun Community Source
 * License v3.0/Jini Technology Specific Attachment v 1.0 (the
 * "License"). You may not use this file except in compliance with the
 * License. You may obtain a copy of the License at
 * http://wwws.sun.com/software/jini/licensing/SCSL3_JiniTSA1.html.
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 * the License for the specific language governing rights and limitations
 * under the License.
 * 
 * The Reference Code is Jini Technology Core Platform code, v2.0. The
 * Developer of the Reference Code is Sun Microsystems, Inc.
 * 
 * Contributor(s): Sun Microsystems, Inc.
 * 
 * The contents of this file comply with the Jini Technology Core
 * Platform Compatibility Kit, v2.0A.
 * 
 * Tester(s): Sun Microsystems, Inc.
 * 
 * Test Platform(s):
 * Java 2 SDK, Standard Edition, Version 1.4.2_03 for Solaris(TM)SPARC/x86
 * Java 2 SDK, Standard Edition, Version 1.4.2_03 for Linux (Intel x86)
 * Java 2 SDK, Standard Edition, Version 1.4.2_03 for Windows (Intel Platform)
 * 
 */

package net.jini.jeri;

import net.jini.core.constraint.InvocationConstraints;
import net.jini.security.proxytrust.TrustEquivalence;

/**
 * Represents a remote communication endpoint to send requests to.
 *
 * <p>An <code>Endpoint</code> instance contains the information
 * necessary to send requests to the remote endpoint.  For example, a
 * TCP-based <code>Endpoint</code> implementation typically contains
 * the remote host address and TCP port to connect to.
 *
 * <p>The {@link #newRequest newRequest} method can be used to send a
 * request to the remote endpoint that this object represents.
 *
 * <p>An instance of this interface should be serializable and should
 * implement {@link Object#equals Object.equals} to return
 * <code>true</code> if and only if the argument is equivalent to the
 * instance in trust, content, and function.  That is, the
 * <code>equals</code> method should be a sufficient substitute for
 * {@link TrustEquivalence#checkTrustEquivalence
 * TrustEquivalence.checkTrustEquivalence}.  But unlike
 * <code>checkTrustEquivalence</code>, the <code>equals</code> method
 * cannot assume that the implementations of any of the invoked
 * instance's pluggable component objects are trusted (whether
 * pluggable through public APIs or deserialization).  Therefore, the
 * <code>equals</code> method should not invoke comparison methods
 * (such as <code>equals</code>) on any such component without first
 * verifying that the component's implementation is at least as
 * trusted as the implementation of the corresponding component in the
 * <code>equals</code> argument (such as by verifying that the
 * corresponding component objects have the same actual class).  If
 * any such verification fails, the <code>equals</code> method should
 * return <code>false</code> without invoking a comparison method on
 * the component.  Furthermore, these guidelines should be recursively
 * obeyed by the comparison methods of each such component for its
 * subcomponents.
 *
 * <p>If an <code>Endpoint</code> is an instance of {@link
 * TrustEquivalence}, then its <code>equals</code> method must obey
 * the above guidelines and its <code>checkTrustEquivalence</code>
 * method must not return <code>true</code> if its <code>equals</code>
 * method would not return <code>true</code> for the same argument.
 *
 * <p>All aspects of the underlying communication mechanism that are not
 * specified here are defined by the particular implementation of this
 * interface.
 *
 * @author Sun Microsystems, Inc.
 * @see ServerEndpoint
 * @since 2.0
 **/
public interface Endpoint {

    /**
     * Returns an <code>OutboundRequestIterator</code> to use to send
     * a new request to this remote endpoint using the specified
     * constraints.
     *
     * <p>The constraints must be the complete, absolute constraints
     * for the request.
     *
     * @param constraints the complete, absolute constraints
     *
     * @return an <code>OutboundRequestIterator</code> to use to send
     * a new request to this remote endpoint
     *
     * @throws NullPointerException if <code>constraints</code> is
     * <code>null</code>
     **/
    OutboundRequestIterator newRequest(InvocationConstraints constraints);
}
