1 /*
2 Licensed to the Apache Software Foundation (ASF) under one
3 or more contributor license agreements. See the NOTICE file
4 distributed with this work for additional information
5 regarding copyright ownership. The ASF licenses this file
6 to you under the Apache License, Version 2.0 (the
7 "License"); you may not use this file except in compliance
8 with the License. You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12 Unless required by applicable law or agreed to in writing,
13 software distributed under the License is distributed on an
14 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 KIND, either express or implied. See the License for the
16 specific language governing permissions and limitations
17 under the License.
18 =================== DO NOT EDIT THIS FILE ====================
19 Generated by Modello 2.5.1,
20 any modifications will be overwritten.
21 ==============================================================
22 */
23
24 package org.apache.maven.model;
25
26 /**
27 * This is the file specification used to activate the profile. The
28 * <code>missing</code> value
29 * is the location of a file that needs to exist, and if it
30 * doesn't, the profile will be
31 * activated. On the other hand, <code>exists</code> will
32 * test for the existence of the file and if it is
33 * there, the profile will be activated.<br>
34 * Variable interpolation for these file specifications is
35 * limited to <code>${project.basedir}</code>,
36 * system properties and user properties.
37 *
38 * @version $Revision$ $Date$
39 */
40 @SuppressWarnings( "all" )
41 public class ActivationFile
42 implements java.io.Serializable, java.lang.Cloneable, org.apache.maven.model.InputLocationTracker
43 {
44
45 //--------------------------/
46 //- Class/Member Variables -/
47 //--------------------------/
48
49 /**
50 * The name of the file that must be missing to activate the
51 * profile.
52 */
53 private String missing;
54
55 /**
56 * The name of the file that must exist to activate the profile.
57 */
58 private String exists;
59
60 /**
61 * Field locations.
62 */
63 private java.util.Map<Object, InputLocation> locations;
64
65 /**
66 * Field location.
67 */
68 private InputLocation location;
69
70 /**
71 * Field missingLocation.
72 */
73 private InputLocation missingLocation;
74
75 /**
76 * Field existsLocation.
77 */
78 private InputLocation existsLocation;
79
80
81 //-----------/
82 //- Methods -/
83 //-----------/
84
85 /**
86 * Method clone.
87 *
88 * @return ActivationFile
89 */
90 public ActivationFile clone()
91 {
92 try
93 {
94 ActivationFile copy = (ActivationFile) super.clone();
95
96 if ( copy.locations != null )
97 {
98 copy.locations = new java.util.LinkedHashMap( copy.locations );
99 }
100
101 return copy;
102 }
103 catch ( java.lang.Exception ex )
104 {
105 throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
106 + " does not support clone()" ).initCause( ex );
107 }
108 } //-- ActivationFile clone()
109
110 /**
111 * Get the name of the file that must exist to activate the
112 * profile.
113 *
114 * @return String
115 */
116 public String getExists()
117 {
118 return this.exists;
119 } //-- String getExists()
120
121 /**
122 *
123 *
124 * @param key a key object.
125 * @return InputLocation
126 */
127 public InputLocation getLocation( Object key )
128 {
129 if ( key instanceof String )
130 {
131 switch ( ( String ) key )
132 {
133 case "" :
134 {
135 return this.location;
136 }
137 case "missing" :
138 {
139 return missingLocation;
140 }
141 case "exists" :
142 {
143 return existsLocation;
144 }
145 default :
146 {
147 return getOtherLocation( key );
148 }
149 }
150 }
151 else
152 {
153 return getOtherLocation( key );
154 }
155 } //-- InputLocation getLocation( Object )
156
157 /**
158 * Get the name of the file that must be missing to activate
159 * the
160 * profile.
161 *
162 * @return String
163 */
164 public String getMissing()
165 {
166 return this.missing;
167 } //-- String getMissing()
168
169 /**
170 *
171 *
172 * @param key a key object.
173 * @param location a location object.
174 */
175 public void setLocation( Object key, InputLocation location )
176 {
177 if ( key instanceof String )
178 {
179 switch ( ( String ) key )
180 {
181 case "" :
182 {
183 this.location = location;
184 return;
185 }
186 case "missing" :
187 {
188 missingLocation = location;
189 return;
190 }
191 case "exists" :
192 {
193 existsLocation = location;
194 return;
195 }
196 default :
197 {
198 setOtherLocation( key, location );
199 return;
200 }
201 }
202 }
203 else
204 {
205 setOtherLocation( key, location );
206 }
207 } //-- void setLocation( Object, InputLocation )
208
209 /**
210 *
211 *
212 * @param key a key object.
213 * @param location a location object.
214 */
215 public void setOtherLocation( Object key, InputLocation location )
216 {
217 if ( location != null )
218 {
219 if ( this.locations == null )
220 {
221 this.locations = new java.util.LinkedHashMap<Object, InputLocation>();
222 }
223 this.locations.put( key, location );
224 }
225 } //-- void setOtherLocation( Object, InputLocation )
226
227 /**
228 *
229 *
230 * @param key a key object.
231 * @return InputLocation
232 */
233 private InputLocation getOtherLocation( Object key )
234 {
235 return ( locations != null ) ? locations.get( key ) : null;
236 } //-- InputLocation getOtherLocation( Object )
237
238 /**
239 * Set the name of the file that must exist to activate the
240 * profile.
241 *
242 * @param exists a exists object.
243 */
244 public void setExists( String exists )
245 {
246 this.exists = exists;
247 } //-- void setExists( String )
248
249 /**
250 * Set the name of the file that must be missing to activate
251 * the
252 * profile.
253 *
254 * @param missing a missing object.
255 */
256 public void setMissing( String missing )
257 {
258 this.missing = missing;
259 } //-- void setMissing( String )
260
261 }