KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > util > explorer > property > lib > AbstractProperty


1 /*====================================================================
2
3 Objectweb Explorer Framework
4 Copyright (C) 2000-2004 INRIA - USTL - LIFL - GOAL
5 Contact: openccm@objectweb.org
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or any later version.
11
12 This library 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 library; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 USA
21
22 Initial developer(s): Jerome Moroy, Philippe Merle.
23 Contributor(s): ______________________________________.
24
25 ====================================================================*/

26 package org.objectweb.util.explorer.property.lib;
27
28 import java.util.HashMap JavaDoc;
29 import java.util.Map JavaDoc;
30
31 import org.objectweb.fractal.api.NoSuchInterfaceException;
32 import org.objectweb.util.explorer.core.code.api.CodeProvider;
33 import org.objectweb.util.explorer.core.common.api.Description;
34 import org.objectweb.util.explorer.core.common.lib.BindingFeature;
35 import org.objectweb.util.explorer.property.api.PropertyFeeder;
36 import org.objectweb.util.explorer.property.api.PropertyProvider;
37
38 /**
39  *
40  *
41  * @author <a HREF="mailto:Jerome.Moroy@lifl.fr">Jérôme Moroy</a>,
42  * <a HREF="mailto:Philippe.Merle@lifl.fr">Philippe Merle</a>.
43  *
44  * @version 0.1
45  */

46 public abstract class AbstractProperty
47               extends BindingFeature
48            implements PropertyFeeder, PropertyProvider
49 {
50
51     //==================================================================
52
//
53
// Internal States.
54
//
55
// ==================================================================
56

57     /** The code provider to use. */
58     protected CodeProvider codeProvider_ = null;
59     
60     /** The data structure containing the mappings. */
61     protected Map JavaDoc properties_ = null;
62     
63     // ==================================================================
64
//
65
// Constructors.
66
//
67
// ==================================================================
68

69     protected AbstractProperty(){
70         properties_ = new HashMap JavaDoc();
71     }
72     
73     // ==================================================================
74
//
75
// Internal methods.
76
//
77
// ==================================================================
78

79     /**
80      * Provides the code provider binding.
81      */

82     protected CodeProvider getCodeProvider(){
83         if(codeProvider_==null){
84             try {
85                 codeProvider_ = (CodeProvider)lookupFc(CodeProvider.CODE_PROVIDER);
86             } catch (NoSuchInterfaceException e) {
87                 getTrace().warn(CodeProvider.CODE_PROVIDER);
88             }
89         }
90         return codeProvider_;
91     }
92     
93     // ==================================================================
94
//
95
// Public methods for BindingFeature abstract class.
96
//
97
// ==================================================================
98

99     /* (non-Javadoc)
100      * @see org.objectweb.util.explorer.core.common.lib.BindingFeature#clientFc()
101      */

102     public String JavaDoc[] clientFc() {
103         return new String JavaDoc[]{CodeProvider.CODE_PROVIDER};
104     }
105
106     // ==================================================================
107
//
108
// Public methods for PropertyFeeder interface.
109
//
110
// ==================================================================
111

112     /* (non-Javadoc)
113      * @see org.objectweb.util.explorer.property.api.PropertyFeeder#feed(java.lang.String, java.lang.Object, org.objectweb.util.explorer.core.common.api.Description)
114      */

115     public abstract void feed(String JavaDoc propertyType, Object JavaDoc key, Description value);
116     
117     // ==================================================================
118
//
119
// Public methods for PropertyProvider interface.
120
//
121
// ==================================================================
122

123     /* (non-Javadoc)
124      * @see org.objectweb.util.explorer.property.api.PropertyProvider#getPropertyDescription(java.lang.String, java.lang.Object)
125      */

126     public abstract Description getPropertyDescription(String JavaDoc propertyType, Object JavaDoc key);
127
128 }
129
Popular Tags