KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > admin > server > core > jmx > IRepository


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.enterprise.admin.server.core.jmx;
25
26 //JDK imports
27
import java.util.Set JavaDoc;
28
29 //JMX imports
30
import javax.management.ObjectName JavaDoc;
31
32 /**
33     Defines the interface for a Repository of MBeans. Note that there is a
34     one to many relationship between an MBeanServer and Domains of MBeans.
35     This interface abstracts out that relationship and hides the fact
36     that in fact there can be multiple Repositories, one per Domain.
37     @author Kedar Mhaswade
38     @version 1.0
39 */

40
41 public interface IRepository
42 {
43     /**
44         Adds an Object in the repository. Neither Object nor the ObjectName
45         should be null. Given Object will not be added if an Object with the
46         same ObjectName already exists in the repository.
47
48         @param objectName - ObjectName of the Object to be stored.
49         @param mbeanImpl - Object that is to be stored.
50
51         @return true if the addition was successful, false otherwise.
52     */

53     public boolean add(ObjectName JavaDoc name, Object JavaDoc mbeanImpl);
54     
55     /**
56         Removes the Object with given ObjectName from repository. The passed
57         ObjectName must not be null.
58
59         @param objectName - ObjectName of the Object to be removed.
60         @return true if the Object could be removed, false otherwise.
61     */

62     public boolean remove(ObjectName JavaDoc objectName);
63     
64     /**
65         Tests whether an Object with given ObjectName is present in this
66         Repository.
67         @param objectName - ObjectName of the Object to be searched for.
68         @return true if the Object could be found, false otherwise.
69         */

70     public boolean contains(ObjectName JavaDoc objectName);
71     
72     /**
73         Returns the Object with given ObjectName. Returns null if there
74         is no Object with given ObjectName. Passed ObjectName may not be null.
75         @param objectName - ObjectName of the Object to be searched for.
76         Note that ObjectName may not be a pattern for query or pattern
77         on key properties.
78
79         @return Object searched, null if there is none. Also returns null,
80         if the ObjectName is pattern.
81     */

82     public Object JavaDoc find(ObjectName JavaDoc objectName);
83     
84     /**
85         Makes the check for the existence of corresponding element in the
86         persistent store. This method will also register or unregister
87         the MBeans as required by adding/removing them, depending on its existence
88         in the persistent store.
89         @return MBean that is registered, null otherwise. In case of the MBean
90         that exists in both MBeanRepository and persistent store simply the
91         object in memory is returned.
92     */

93     public Object JavaDoc findPersistent(ObjectName JavaDoc objectName);
94     
95     /**
96         Returns the number of Objects stored in the repository for
97         given domainName.
98         @param domainName - String representing the name of domain.
99     */

100     public int getCount(String JavaDoc domainName);
101     
102     /**
103         Returns the total number of MBeans stored in entire repository.
104         
105         @return int representing all MBeans in this repository.
106     */

107     public int getTotalCount();
108     
109     /**
110         Method to get ALL MBeans in all domains in this repository.
111         The returned Set contains the ObjectNames of all MBeans.
112      
113         @return Set containing MBean ObjectNames, null if none exists.
114     */

115     public Set JavaDoc getAllMBeans();
116     
117     /**
118         Returns a Set of Objects whose ObjectNames match zero or more Objects in the
119         repository as per the pattern suggested by the argument. If the argument
120         is NOT a pattern an exact match will be performed.
121      
122         @param objectName the ObjectName that may represent a pattern.
123         
124         @return Set of all Objects that match the pattern in argument, null if
125         there is no such object.
126     */

127     public Set JavaDoc query(ObjectName JavaDoc objectName);
128 }
Popular Tags