01: /* JFox, the OpenSource J2EE Application Server
02: *
03: * Copyright (C) 2002 huihoo.com
04: * Distributable under GNU LGPL license
05: * See the GNU Lesser General Public License for more details.
06: */
07:
08: package org.huihoo.jfox.jmx;
09:
10: import java.util.Iterator;
11: import java.util.Map;
12: import java.util.HashMap;
13: import java.util.List;
14: import java.util.ArrayList;
15: import javax.management.ObjectName;
16:
17: /**
18: * store the MBeans
19: * @author <a href="mailto:young_yy@hotmail.com">Young Yang</a>
20: */
21:
22: public final class MBeanServerRepositorySupport implements
23: MBeanServerRepository {
24: private Map repository = new HashMap();
25:
26: public MBeanMetaData get(ObjectName name) {
27: return (MBeanMetaData) repository.get(name);
28: }
29:
30: public synchronized void put(ObjectName name, MBeanMetaData metadata) {
31: repository.put(name, metadata);
32: }
33:
34: public synchronized void remove(ObjectName name) {
35: repository.remove(name);
36: }
37:
38: public int size() {
39: return repository.size();
40: }
41:
42: public boolean contains(ObjectName name) {
43: return repository.containsKey(name);
44: }
45:
46: public synchronized Iterator iterator() {
47: return repository.values().iterator();
48: }
49:
50: public synchronized List keys() {
51: return new ArrayList(repository.keySet());
52: }
53:
54: }
|