|
1 /* |
|
2 * Copyright 2008 Sun Microsystems, Inc. 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. Sun designates this |
|
8 * particular file as subject to the "Classpath" exception as provided |
|
9 * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
22 * CA 95054 USA or visit www.sun.com if you need additional information or |
|
23 * have any questions. |
|
24 */ |
|
25 |
|
26 package javax.management.namespace; |
|
27 |
|
28 import java.io.IOException; |
|
29 import javax.management.remote.JMXServiceURL; |
|
30 |
|
31 /** |
|
32 * A {@link JMXNamespaceMBean} that will connect to a remote MBeanServer |
|
33 * by creating a {@link javax.management.remote.JMXConnector} from a |
|
34 * {@link javax.management.remote.JMXServiceURL}. |
|
35 * You can call {@link #connect connect()} and {@link #close close()} |
|
36 * several times. |
|
37 * @since 1.7 |
|
38 */ |
|
39 public interface JMXRemoteNamespaceMBean |
|
40 extends JMXNamespaceMBean { |
|
41 |
|
42 /** |
|
43 * Connects to the underlying remote source name space, if not already |
|
44 * {@link #isConnected connected}. |
|
45 * If connected, do nothing. Otherwise, creates a new connector from the |
|
46 * {@link javax.management.remote.JMXServiceURL JMXServiceURL} provided at |
|
47 * creation time, and connects to the remote source name space. |
|
48 * <p> |
|
49 * The source MBeans will not appear in the target name space until the |
|
50 * JMXRemoteNamespaceMBean is connected. |
|
51 * </p><p> |
|
52 * It is possible to call {@code connect()}, {@link #close close()}, and |
|
53 * {@code connect()} again. |
|
54 * However, closing the connection with the remote name space may cause |
|
55 * notification listeners to be lost, unless the client explicitly uses |
|
56 * the new {@linkplain javax.management.event JMX event service}. |
|
57 * </p><p> |
|
58 * @throws IOException if connection to the remote source name space fails. |
|
59 * @see #isConnected isConnected |
|
60 **/ |
|
61 public void connect() |
|
62 throws IOException; |
|
63 |
|
64 /** |
|
65 * Closes the connection with the remote source name space. |
|
66 * If the connection is already closed, do nothing. |
|
67 * Otherwise, closes the underlying {@link |
|
68 * javax.management.remote.JMXConnector}. |
|
69 * <p>Once closed, it is possible to reopen the connection by |
|
70 * calling {@link #connect connect}. |
|
71 * </p> |
|
72 * @throws IOException if the connection to the remote source name space |
|
73 * can't be closed properly. |
|
74 * @see #isConnected isConnected |
|
75 **/ |
|
76 public void close() |
|
77 throws IOException; |
|
78 |
|
79 /** |
|
80 * Tells whether the connection to the remote source name space is opened. |
|
81 * @see #connect connect |
|
82 * @see #close close |
|
83 * @return {@code true} if connected. |
|
84 **/ |
|
85 public boolean isConnected(); |
|
86 |
|
87 /** |
|
88 * Returns the {@link JMXServiceURL} address that points to the remote name |
|
89 * space mirrored by this {@link JMXNamespaceMBean JMXNamespace MBean}, |
|
90 * if available. |
|
91 * @return The {@link JMXServiceURL} address that points to the remote name |
|
92 * space mirrored by this {@link JMXNamespaceMBean JMXNamespace MBean}, |
|
93 * or {@code null}. |
|
94 */ |
|
95 public JMXServiceURL getAddress(); |
|
96 } |