1 package org.apache.maven.plugin.invoker;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.util.Collection;
23 import java.util.Map;
24 import java.util.Properties;
25 import java.util.Set;
26
27 import org.apache.maven.project.MavenProject;
28 import org.codehaus.plexus.util.introspection.ReflectionValueExtractor;
29
30
31
32
33
34
35 class CompositeMap
36 implements Map
37 {
38
39 private MavenProject mavenProject;
40
41 private Properties properties;
42
43 protected CompositeMap( MavenProject mavenProject, Properties properties )
44 {
45 this.mavenProject = mavenProject;
46 this.properties = properties == null ? new Properties() : properties;
47 }
48
49
50
51
52 public void clear()
53 {
54
55
56 }
57
58
59
60
61 public boolean containsKey( Object key )
62 {
63 if ( key == null )
64 {
65 return false;
66 }
67 try
68 {
69 Object evaluated = ReflectionValueExtractor.evaluate( (String) key, this.mavenProject );
70 return evaluated == null;
71 }
72 catch ( Exception e )
73 {
74
75 }
76
77 return ( mavenProject.getProperties().containsKey( key ) || properties.containsKey( key ) );
78 }
79
80
81
82
83 public boolean containsValue( Object value )
84 {
85 throw new UnsupportedOperationException();
86 }
87
88
89
90
91 public Set entrySet()
92 {
93 throw new UnsupportedOperationException();
94 }
95
96
97
98
99 public Object get( Object key )
100 {
101 if ( key == null )
102 {
103 return null;
104 }
105 try
106 {
107 Object evaluated = ReflectionValueExtractor.evaluate( (String) key, this.mavenProject );
108 if ( evaluated != null )
109 {
110 return evaluated;
111 }
112 }
113 catch ( Exception e )
114 {
115
116 }
117
118 Object value = properties.get( key );
119
120 return ( value != null ? value : this.mavenProject.getProperties().get( key ) );
121
122 }
123
124
125
126
127 public boolean isEmpty()
128 {
129 return this.mavenProject == null && this.mavenProject.getProperties().isEmpty() && this.properties.isEmpty();
130 }
131
132
133
134
135 public Set keySet()
136 {
137 throw new UnsupportedOperationException();
138 }
139
140
141
142
143 public Object put( Object key, Object value )
144 {
145 throw new UnsupportedOperationException();
146 }
147
148
149
150
151 public void putAll( Map t )
152 {
153 throw new UnsupportedOperationException();
154 }
155
156
157
158
159 public Object remove( Object key )
160 {
161 throw new UnsupportedOperationException();
162 }
163
164
165
166
167 public int size()
168 {
169 throw new UnsupportedOperationException();
170 }
171
172
173
174
175 public Collection values()
176 {
177 throw new UnsupportedOperationException();
178 }
179 }