KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > mx4j > tools > remote > ConnectionManager


1 /*
2  * Copyright (C) The MX4J Contributors.
3  * All rights reserved.
4  *
5  * This software is distributed under the terms of the MX4J License version 1.0.
6  * See the terms of the MX4J License in the documentation provided with this software.
7  */

8
9 package mx4j.tools.remote;
10
11 import java.io.IOException JavaDoc;
12
13 /**
14  * A ConnectionManager is a server-side object that acts as the factory for new connections and
15  * manages the authentication details.
16  * A JMXConnectorServer delegates a ConnectionManager for the creation of connections, and a
17  * ConnectionManager interacts with the JMXConnectorServer to emit connection notifications.
18  * It is the first object contacted by a remote client to obtain a client-specific connection, that is,
19  * a connection with a specific connection ID.
20  *
21  * @version $Revision: 1.4 $
22  */

23 public interface ConnectionManager
24 {
25    /**
26     * Factory method that creates connections that are specific to the client that invoked this method.
27     *
28     * @param credentials The credentials sent by the client to authenticate a subject.
29     * @return A new client-specific connection.
30     * @throws IOException If the connection cannot be created.
31     * @throws SecurityException If the authentication fails.
32     */

33    public Connection connect(Object JavaDoc credentials) throws IOException JavaDoc, SecurityException JavaDoc;
34
35    /**
36     * Returns the protocol used by the corrispondent JMXConnectorServer.
37     */

38    public String JavaDoc getProtocol();
39
40    /**
41     * Closes this ConnectionManager and all the opened connections it manages.
42     *
43     * @see #closeConnection
44     */

45    public void close() throws IOException JavaDoc;
46
47    /**
48     * Closes the given Connection.
49     * This method is called by the connection manager when it is closing the connections it manages,
50     * or as a consequence of the fact that the client end of the connection has been closed.
51     *
52     * @see Connection#close
53     * @see #close
54     */

55    public void closeConnection(Connection connection) throws IOException JavaDoc;
56 }
57
Popular Tags