KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > mx > server > registry > MbeanInfoDb


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * 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 JavaDoc;
25 import java.util.Vector JavaDoc;
26
27 import javax.management.ObjectName JavaDoc;
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 JavaDoc
40 {
41    protected Vector JavaDoc fMbInfosToStore;
42
43    public MbeanInfoDb()
44    {
45        super();
46    }
47    
48    public void add(ObjectName JavaDoc nameOfMbean)
49    {
50       mbInfosToStore().add(nameOfMbean);
51    }
52
53    public void add(Vector JavaDoc namesOfMbeans)
54    {
55       mbInfosToStore().addAll(namesOfMbeans);
56    }
57
58    /**
59     * ObjectName objects bound to MBean Info objects that are waiting to be stored in the
60     * persistence store.
61     */

62    protected Vector JavaDoc mbInfosToStore()
63    {
64       if(fMbInfosToStore == null)
65       {
66          fMbInfosToStore = new Vector JavaDoc(10);
67       }
68       return fMbInfosToStore;
69    }
70    
71    public Enumeration JavaDoc mbiPersistenceQueue()
72    {
73       return mbInfosToStore().elements();
74    }
75    
76    public void removeFromMbiQueue(ObjectName JavaDoc name)
77    {
78        mbInfosToStore().remove(name);
79    }
80 }
Popular Tags