01: /*
02: * JBoss, Home of Professional Open Source.
03: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
04: * as indicated by the @author tags. See the copyright.txt file in the
05: * distribution for a full listing of individual contributors.
06: *
07: * This is free software; you can redistribute it and/or modify it
08: * under the terms of the GNU Lesser General Public License as
09: * published by the Free Software Foundation; either version 2.1 of
10: * the License, or (at your option) any later version.
11: *
12: * This software is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: *
17: * You should have received a copy of the GNU Lesser General Public
18: * License along with this software; if not, write to the Free
19: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21: */
22: package org.jboss.mx.server.registry;
23:
24: import java.util.Enumeration;
25: import java.util.Vector;
26:
27: import javax.management.ObjectName;
28:
29: /**
30: * In-Memory database of MBeanInfo objects.
31: * This is primarily used to store and load MBean info objects (and therefore, MBeans)
32: * through the persistence manager attached to this object.
33: * The MBean Registry delegates to this class the work of MBean Info persistence.
34: * This class further delegates that task to it's persistence manager. This allows
35: * MBeanInfo persistence to be managed as part of the invocation stack via the
36: * Persistence Interceptor.
37: * @author Matt Munz
38: */
39: public class MbeanInfoDb extends Object {
40: protected Vector fMbInfosToStore;
41:
42: public MbeanInfoDb() {
43: super ();
44: }
45:
46: public void add(ObjectName nameOfMbean) {
47: mbInfosToStore().add(nameOfMbean);
48: }
49:
50: public void add(Vector namesOfMbeans) {
51: mbInfosToStore().addAll(namesOfMbeans);
52: }
53:
54: /**
55: * ObjectName objects bound to MBean Info objects that are waiting to be stored in the
56: * persistence store.
57: */
58: protected Vector mbInfosToStore() {
59: if (fMbInfosToStore == null) {
60: fMbInfosToStore = new Vector(10);
61: }
62: return fMbInfosToStore;
63: }
64:
65: public Enumeration mbiPersistenceQueue() {
66: return mbInfosToStore().elements();
67: }
68:
69: public void removeFromMbiQueue(ObjectName name) {
70: mbInfosToStore().remove(name);
71: }
72: }
|