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.7.0,
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 * <code>${project.rootDirectory}</code>, system properties
37 * and user properties.
38 *
39 * @version $Revision$ $Date$
40 */
41 @SuppressWarnings( "all" )
42 public class ActivationFile
43 implements java.io.Serializable, java.lang.Cloneable, org.apache.maven.model.InputLocationTracker
44 {
45
46 //--------------------------/
47 //- Class/Member Variables -/
48 //--------------------------/
49
50 /**
51 * The name of the file that must be missing to activate the
52 * profile.
53 */
54 private String missing;
55
56 /**
57 * The name of the file that must exist to activate the profile.
58 */
59 private String exists;
60
61 /**
62 * Field locations.
63 */
64 private java.util.Map<Object, InputLocation> locations;
65
66 /**
67 * Field location.
68 */
69 private InputLocation location;
70
71 /**
72 * Field missingLocation.
73 */
74 private InputLocation missingLocation;
75
76 /**
77 * Field existsLocation.
78 */
79 private InputLocation existsLocation;
80
81
82 //-----------/
83 //- Methods -/
84 //-----------/
85
86 /**
87 * Method clone.
88 *
89 * @return ActivationFile
90 */
91 public ActivationFile clone()
92 {
93 try
94 {
95 ActivationFile copy = (ActivationFile) super.clone();
96
97 if ( copy.locations != null )
98 {
99 copy.locations = new java.util.LinkedHashMap( copy.locations );
100 }
101
102 return copy;
103 }
104 catch ( java.lang.Exception ex )
105 {
106 throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
107 + " does not support clone()" ).initCause( ex );
108 }
109 } //-- ActivationFile clone()
110
111 /**
112 * Get the name of the file that must exist to activate the
113 * profile.
114 *
115 * @return String
116 */
117 public String getExists()
118 {
119 return this.exists;
120 } //-- String getExists()
121
122 /**
123 *
124 *
125 * @param key a key object.
126 * @return InputLocation
127 */
128 public InputLocation getLocation( Object key )
129 {
130 if ( key instanceof String )
131 {
132 switch ( ( String ) key )
133 {
134 case "" :
135 {
136 return this.location;
137 }
138 case "missing" :
139 {
140 return missingLocation;
141 }
142 case "exists" :
143 {
144 return existsLocation;
145 }
146 default :
147 {
148 return getOtherLocation( key );
149 }
150 }
151 }
152 else
153 {
154 return getOtherLocation( key );
155 }
156 } //-- InputLocation getLocation( Object )
157
158 /**
159 * Get the name of the file that must be missing to activate
160 * the
161 * profile.
162 *
163 * @return String
164 */
165 public String getMissing()
166 {
167 return this.missing;
168 } //-- String getMissing()
169
170 /**
171 *
172 *
173 * @param key a key object.
174 * @param location a location object.
175 */
176 public void setLocation( Object key, InputLocation location )
177 {
178 if ( key instanceof String )
179 {
180 switch ( ( String ) key )
181 {
182 case "" :
183 {
184 this.location = location;
185 return;
186 }
187 case "missing" :
188 {
189 missingLocation = location;
190 return;
191 }
192 case "exists" :
193 {
194 existsLocation = location;
195 return;
196 }
197 default :
198 {
199 setOtherLocation( key, location );
200 return;
201 }
202 }
203 }
204 else
205 {
206 setOtherLocation( key, location );
207 }
208 } //-- void setLocation( Object, InputLocation )
209
210 /**
211 *
212 *
213 * @param key a key object.
214 * @param location a location object.
215 */
216 public void setOtherLocation( Object key, InputLocation location )
217 {
218 if ( location != null )
219 {
220 if ( this.locations == null )
221 {
222 this.locations = new java.util.LinkedHashMap<Object, InputLocation>();
223 }
224 this.locations.put( key, location );
225 }
226 } //-- void setOtherLocation( Object, InputLocation )
227
228 /**
229 *
230 *
231 * @param key a key object.
232 * @return InputLocation
233 */
234 private InputLocation getOtherLocation( Object key )
235 {
236 return ( locations != null ) ? locations.get( key ) : null;
237 } //-- InputLocation getOtherLocation( Object )
238
239 /**
240 * Set the name of the file that must exist to activate the
241 * profile.
242 *
243 * @param exists a exists object.
244 */
245 public void setExists( String exists )
246 {
247 this.exists = exists;
248 } //-- void setExists( String )
249
250 /**
251 * Set the name of the file that must be missing to activate
252 * the
253 * profile.
254 *
255 * @param missing a missing object.
256 */
257 public void setMissing( String missing )
258 {
259 this.missing = missing;
260 } //-- void setMissing( String )
261
262 }