KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > management > support > AMXAttributeNameMapper


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 package com.sun.enterprise.management.support;
24
25 import java.util.Set JavaDoc;
26
27 /**
28     Maps names to a derived name. An example use for this might be to map a JMX
29     Attribute "foo-bar" to a suiteable "FooBar" form so that it can be used
30     as a Java identifier.
31  */

32 public interface AMXAttributeNameMapper
33 {
34     /**
35         Determine if the attribute name requires mapping.
36         
37         @param originalName the original name from which a derived name is made
38      */

39     //public boolean requiresMapping( String originalName );
40

41     /**
42         @param originalName the original/source/real name of the Attribute
43         @param derivedName the name by which it should be known
44      */

45     //public void addMapping( final String originalName, final String derivedName );
46

47     /**
48         Don't perform any mapping on this name. Equivalent to calling
49         addMapping( originalName, originalName )
50         
51         @param originalName the "real" name of the Attribute
52      */

53     //public void dontMap( final String originalName );
54

55     /**
56         Setup mapping for all specified Attribute names. These add to (or replace)
57         any existing mappings.
58         
59         @param originalNames all names from which should be derived names
60      */

61     //public void deriveAll( final String[] originalNames );
62

63     /**
64         Attempt to match the derived name to one of the candidates.
65         This facility is used when different runtime conditions
66         present different original names which must be mapped to the
67         same derived name.
68         <p>
69         If a name is matched it is added as a mapping and the
70         original name is returned.
71      */

72         public String JavaDoc
73     matchName(
74         final String JavaDoc derivedName,
75         final String JavaDoc[] candidates );
76         
77         public String JavaDoc
78     matchName(
79         final String JavaDoc derivedName,
80         final String JavaDoc candidates );
81         
82         public String JavaDoc
83     matchName(
84         final String JavaDoc derivedName,
85         final String JavaDoc candidates1, final String JavaDoc candidate2 );
86     
87     /**
88         Call {@link #getUnmappedOriginals} to get the original names
89         which are not used in a mapping.
90      */

91         public void
92     matchNames(
93         final String JavaDoc[] derivedCandidates ,
94         final String JavaDoc[] originalCandidates );
95      
96     public Set JavaDoc<String JavaDoc> getUnmappedOriginals();
97     
98     
99     /**
100         Maps Attribute names to another name.
101         <p>
102         A common use is to construct legal Java identifiers, so that they can
103         be exposed in an MBean proxy with get/set routines.
104         <p>
105         For example "classpath-prefix" is not legal in a Java API; it could not
106         generate the methods getclasspath-prefix() and setclasspath-prefix().
107         <p>
108         Any legal mapping is OK. Suggested possible mappings include:
109         ClasspathPrefix, classpathPrefix, classpath_prefix, etc. These would
110         result in the method names: getClasspathPrefix(), getclasspathPrefix(),
111         getclasspath_prefix(), etc.
112         
113         @param originalName original name
114      */

115     public String JavaDoc originalToDerived( String JavaDoc originalName );
116     
117     /**
118         Reverse the effect of originalToDerived()
119         
120         @param derivedName name derived from the original one
121      */

122     public String JavaDoc derivedToOriginal( String JavaDoc derivedName );
123     
124     
125     /**
126         Get all derived names which have a mapping.
127      */

128     public Set JavaDoc<String JavaDoc> getDerivedNames( );
129 }
130
Popular Tags