author | ohair |
Tue, 25 May 2010 15:58:33 -0700 | |
changeset 5506 | 202f599c92aa |
parent 4173 | d01972926813 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
5506 | 2 |
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. |
2 | 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 |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 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 |
* |
|
5506 | 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. |
|
2 | 24 |
*/ |
25 |
||
26 |
/* |
|
27 |
* @author Sun Microsystems, Inc. |
|
28 |
* @build @BUILD_TAG_PLACEHOLDER@ |
|
29 |
* |
|
30 |
* @COPYRIGHT_MINI_LEGAL_NOTICE_PLACEHOLDER@ |
|
31 |
*/ |
|
32 |
||
33 |
package sun.management.jmxremote; |
|
34 |
||
35 |
import java.rmi.AccessException; |
|
36 |
import java.rmi.NotBoundException; |
|
37 |
import java.rmi.Remote; |
|
38 |
import java.rmi.RemoteException; |
|
39 |
import java.rmi.server.RMIClientSocketFactory; |
|
40 |
import java.rmi.server.RMIServerSocketFactory; |
|
41 |
||
42 |
import sun.rmi.registry.RegistryImpl; |
|
43 |
||
44 |
/** A Registry that consists of a single entry that never changes. */ |
|
45 |
public class SingleEntryRegistry extends RegistryImpl { |
|
46 |
SingleEntryRegistry(int port, String name, Remote object) |
|
47 |
throws RemoteException { |
|
48 |
super(port); |
|
49 |
this.name = name; |
|
50 |
this.object = object; |
|
51 |
} |
|
52 |
||
53 |
SingleEntryRegistry(int port, |
|
54 |
RMIClientSocketFactory csf, |
|
55 |
RMIServerSocketFactory ssf, |
|
56 |
String name, |
|
57 |
Remote object) |
|
58 |
throws RemoteException { |
|
59 |
super(port, csf, ssf); |
|
60 |
this.name = name; |
|
61 |
this.object = object; |
|
62 |
} |
|
63 |
||
64 |
public String[] list() { |
|
65 |
return new String[] {name}; |
|
66 |
} |
|
67 |
||
68 |
public Remote lookup(String name) throws NotBoundException { |
|
69 |
if (name.equals(this.name)) |
|
70 |
return object; |
|
71 |
throw new NotBoundException("Not bound: \"" + name + "\" (only " + |
|
72 |
"bound name is \"" + this.name + "\")"); |
|
73 |
} |
|
74 |
||
75 |
public void bind(String name, Remote obj) throws AccessException { |
|
76 |
throw new AccessException("Cannot modify this registry"); |
|
77 |
} |
|
78 |
||
79 |
public void rebind(String name, Remote obj) throws AccessException { |
|
80 |
throw new AccessException("Cannot modify this registry"); |
|
81 |
} |
|
82 |
||
83 |
public void unbind(String name) throws AccessException { |
|
84 |
throw new AccessException("Cannot modify this registry"); |
|
85 |
} |
|
86 |
||
87 |
private final String name; |
|
88 |
private final Remote object; |
|
4173
d01972926813
6895875: Missing serialVersionUID in sun.management classes
mchung
parents:
2
diff
changeset
|
89 |
|
d01972926813
6895875: Missing serialVersionUID in sun.management classes
mchung
parents:
2
diff
changeset
|
90 |
private static final long serialVersionUID = -4897238949499730950L; |
2 | 91 |
} |