1/*
2 * Copyright (c) 2002, 2007, 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
26package javax.management.remote.rmi;
27
28import java.io.IOException;
29import java.rmi.Remote;
30import java.rmi.RemoteException;
31
32/**
33 * <p>RMI object used to establish connections to an RMI connector.
34 * There is one Remote object implementing this interface for each RMI
35 * connector.</p>
36 *
37 * <p>User code does not usually refer to this interface.  It is
38 * specified as part of the public API so that different
39 * implementations of that API will interoperate.</p>
40 *
41 * @since 1.5
42 */
43public interface RMIServer extends Remote {
44    /**
45     * <p>The version of the RMI Connector Protocol understood by this
46     * connector server.  This is a string with the following format:</p>
47     *
48     * <pre>
49     * <em>protocol-version</em> <em>implementation-name</em>
50     * </pre>
51     *
52     * <p>The <code><em>protocol-version</em></code> is a series of
53     * two or more non-negative integers separated by periods
54     * (<code>.</code>).  An implementation of the version described
55     * by this documentation must use the string <code>1.0</code>
56     * here.</p>
57     *
58     * <p>After the protocol version there must be a space, followed
59     * by the implementation name.  The format of the implementation
60     * name is unspecified.  It is recommended that it include an
61     * implementation version number.  An implementation can use an
62     * empty string as its implementation name, for example for
63     * security reasons.</p>
64     *
65     * @return a string with the format described here.
66     *
67     * @exception RemoteException if there is a communication
68     * exception during the remote method call.
69     */
70    public String getVersion() throws RemoteException;
71
72    /**
73     * <p>Makes a new connection through this RMI connector.  Each
74     * remote client calls this method to obtain a new RMI object
75     * representing its connection.</p>
76     *
77     * @param credentials this object specifies the user-defined credentials
78     * to be passed in to the server in order to authenticate the user before
79     * creating the <code>RMIConnection</code>.  Can be null.
80     *
81     * @return the newly-created connection object.
82     *
83     * @exception IOException if the new client object cannot be
84     * created or exported, or if there is a communication exception
85     * during the remote method call.
86     *
87     * @exception SecurityException if the given credentials do not
88     * allow the server to authenticate the caller successfully.
89     */
90    public RMIConnection newClient(Object credentials) throws IOException;
91}
92