KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > appserv > management > config > PropertiesAccess


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 /*
25  * $Header: /cvs/glassfish/admin-core/mbeanapi/src/java/com/sun/appserv/management/config/PropertiesAccess.java,v 1.6 2006/03/09 20:30:24 llc Exp $
26  * $Revision: 1.6 $
27  * $Date: 2006/03/09 20:30:24 $
28  */

29
30 package com.sun.appserv.management.config;
31
32 import com.sun.appserv.management.base.XTypes;
33
34
35 import java.util.Map JavaDoc;
36
37
38
39 /**
40     All MBeans that have Properties must extend this interface.
41     <p>
42     Properties are always Strings. Property names are required to be unique.
43     <p>
44     To specify properties when creating any type of {@link AMXConfig} which
45     (the AMXConfig must extend PropertiesAccess), add them to the optional
46     Map when creating it:
47 <pre><code>
48     final Map<String,String> optional = new HashMap<String,String>();
49     optional.put( PropertiesAccess.PROPERTY_PREFIX + "prop1", prop1Value );
50     optional.put( PropertiesAccess.PROPERTY_PREFIX + "prop2", prop2Value );
51     ...
52 </code></pref>
53  */

54 public interface PropertiesAccess
55 {
56     /**
57         When a key is required for a property in a Map,
58         its name must consist of this prefix plus the actual name. When
59         accessing a property directly, this prefix must not be used.
60      */

61     final static String JavaDoc PROPERTY_PREFIX = "property.";
62     
63     /**
64         Get the names of all properties.
65      */

66     public String JavaDoc[] getPropertyNames( );
67     
68     /**
69         @return Map containing all properties, keyed by name
70      */

71     public Map JavaDoc<String JavaDoc,String JavaDoc> getProperties();
72     
73     /**
74         Get the value of a property.
75         
76         @param propertyName the name of the property
77      */

78     public String JavaDoc getPropertyValue( String JavaDoc propertyName );
79                     
80     /**
81         Set the value of a property. The property must already exist.
82         The existing description is retained.
83         
84         @param propertyName the name of the property
85         @param propertyValue the value of the property
86      */

87     public void setPropertyValue( String JavaDoc propertyName, String JavaDoc propertyValue );
88                         
89     /**
90         Return true if any properties exist with the specified name.
91         
92         @param propertyName the name of the property
93      */

94     public boolean existsProperty( String JavaDoc propertyName );
95     
96     /**
97         Create a new property.
98         
99         @param propertyName the name of the property
100         @param propertyValue the value of the property
101      */

102     public void createProperty( String JavaDoc propertyName, String JavaDoc propertyValue);
103     
104     /**
105         Remove a property with the specified name.
106         
107         @param propertyName the name of the property
108      */

109     public void removeProperty( String JavaDoc propertyName );
110 }
111
112
113
Popular Tags