blob: 5a6ca78a73d37fb15173804b8b7ac9ac18374751 [file] [log] [blame]
Stuart McCulloch669423b2012-06-26 16:34:24 +00001package aQute.bnd.build.model;
2
3import java.beans.*;
4import java.io.*;
5import java.util.*;
6import java.util.Map.Entry;
7
Stuart McCulloch42151ee2012-07-16 13:43:38 +00008import org.osgi.resource.*;
Stuart McCulloch54229442012-07-12 22:12:58 +00009
Stuart McCulloch669423b2012-06-26 16:34:24 +000010import aQute.bnd.build.model.clauses.*;
11import aQute.bnd.build.model.conversions.*;
Stuart McCulloch42151ee2012-07-16 13:43:38 +000012import aQute.bnd.header.*;
13import aQute.bnd.osgi.*;
14import aQute.bnd.properties.*;
Stuart McCullochcd1ddd72012-07-19 13:11:20 +000015import aQute.bnd.version.*;
Stuart McCulloch669423b2012-06-26 16:34:24 +000016import aQute.libg.tuple.*;
Stuart McCulloch669423b2012-06-26 16:34:24 +000017
18/**
19 * A model for a Bnd file. In the first iteration, use a simple Properties
20 * object; this will need to be enhanced to additionally record formatting, e.g.
21 * line breaks and empty lines, and comments.
22 *
23 * @author Neil Bartlett
24 */
25public class BndEditModel {
26
Stuart McCulloch2a0afd62012-09-06 18:28:06 +000027 public static final String NEWLINE_LINE_SEPARATOR = "\\n\\\n\t";
Stuart McCulloch669423b2012-06-26 16:34:24 +000028 public static final String LIST_SEPARATOR = ",\\\n\t";
29
Stuart McCullochcd1ddd72012-07-19 13:11:20 +000030 private static final String ISO_8859_1 = "ISO-8859-1"; //$NON-NLS-1$
Stuart McCulloch669423b2012-06-26 16:34:24 +000031
Stuart McCullochcd1ddd72012-07-19 13:11:20 +000032 private static String[] KNOWN_PROPERTIES = new String[] {
Stuart McCulloch2a0afd62012-09-06 18:28:06 +000033 Constants.BUNDLE_LICENSE, Constants.BUNDLE_CATEGORY,
34 Constants.BUNDLE_NAME, Constants.BUNDLE_DESCRIPTION, Constants.BUNDLE_COPYRIGHT, Constants.BUNDLE_UPDATELOCATION,
35 Constants.BUNDLE_VENDOR, Constants.BUNDLE_CONTACTADDRESS, Constants.BUNDLE_DOCURL,
Stuart McCulloch669423b2012-06-26 16:34:24 +000036 Constants.BUNDLE_SYMBOLICNAME, Constants.BUNDLE_VERSION, Constants.BUNDLE_ACTIVATOR,
Stuart McCulloch42151ee2012-07-16 13:43:38 +000037 Constants.EXPORT_PACKAGE, Constants.IMPORT_PACKAGE, aQute.bnd.osgi.Constants.PRIVATE_PACKAGE,
38 aQute.bnd.osgi.Constants.SOURCES,
39 aQute.bnd.osgi.Constants.SERVICE_COMPONENT, aQute.bnd.osgi.Constants.CLASSPATH,
40 aQute.bnd.osgi.Constants.BUILDPATH, aQute.bnd.osgi.Constants.BUILDPACKAGES,
41 aQute.bnd.osgi.Constants.RUNBUNDLES, aQute.bnd.osgi.Constants.RUNPROPERTIES, aQute.bnd.osgi.Constants.SUB,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +000042 aQute.bnd.osgi.Constants.RUNFRAMEWORK, aQute.bnd.osgi.Constants.RUNFW,
Stuart McCulloch42151ee2012-07-16 13:43:38 +000043 aQute.bnd.osgi.Constants.RUNVM,
Stuart McCulloch669423b2012-06-26 16:34:24 +000044 // BndConstants.RUNVMARGS,
45 // BndConstants.TESTSUITES,
Stuart McCulloch42151ee2012-07-16 13:43:38 +000046 aQute.bnd.osgi.Constants.TESTCASES, aQute.bnd.osgi.Constants.PLUGIN, aQute.bnd.osgi.Constants.PLUGINPATH,
47 aQute.bnd.osgi.Constants.RUNREPOS, aQute.bnd.osgi.Constants.RUNREQUIRES, aQute.bnd.osgi.Constants.RUNEE};
Stuart McCulloch669423b2012-06-26 16:34:24 +000048
49 public static final String BUNDLE_VERSION_MACRO = "${"
50 + Constants.BUNDLE_VERSION
51 + "}";
52
Stuart McCullochcd1ddd72012-07-19 13:11:20 +000053 private final Map<String,Converter< ? extends Object,String>> converters = new HashMap<String,Converter< ? extends Object,String>>();
54 private final Map<String,Converter<String, ? extends Object>> formatters = new HashMap<String,Converter<String, ? extends Object>>();
Stuart McCulloch669423b2012-06-26 16:34:24 +000055 // private final DataModelHelper obrModelHelper = new DataModelHelperImpl();
56
57 private final PropertyChangeSupport propChangeSupport = new PropertyChangeSupport(
58 this);
59 private final Properties properties = new Properties();
60
61 private File bndResource;
62 private boolean projectFile;
63 private final Map<String,Object> objectProperties = new HashMap<String,Object>();
64 private final Map<String,String> changesToSave = new HashMap<String,String>();
65
66 // CONVERTERS
Stuart McCullochcd1ddd72012-07-19 13:11:20 +000067 private Converter<List<VersionedClause>,String> buildPathConverter = new ClauseListConverter<VersionedClause>(
Stuart McCulloch669423b2012-06-26 16:34:24 +000068 new Converter<VersionedClause,Pair<String,Attrs>>() {
69 public VersionedClause convert(
70 Pair<String,Attrs> input)
71 throws IllegalArgumentException {
72 return new VersionedClause(
73 input.getFirst(),
74 input.getSecond());
75 }
76 });
Stuart McCullochcd1ddd72012-07-19 13:11:20 +000077 private Converter<List<VersionedClause>,String> buildPackagesConverter = new ClauseListConverter<VersionedClause>(
Stuart McCulloch669423b2012-06-26 16:34:24 +000078 new Converter<VersionedClause,Pair<String,Attrs>>() {
79 public VersionedClause convert(
80 Pair<String,Attrs> input)
81 throws IllegalArgumentException {
82 return new VersionedClause(
83 input.getFirst(),
84 input.getSecond());
85 }
86 });
Stuart McCullochcd1ddd72012-07-19 13:11:20 +000087 private Converter<List<VersionedClause>,String> clauseListConverter = new ClauseListConverter<VersionedClause>(
Stuart McCulloch669423b2012-06-26 16:34:24 +000088 new VersionedClauseConverter());
Stuart McCullochcd1ddd72012-07-19 13:11:20 +000089 private Converter<String,String> stringConverter = new NoopConverter<String>();
90 private Converter<Boolean,String> includedSourcesConverter = new Converter<Boolean,String>() {
Stuart McCulloch669423b2012-06-26 16:34:24 +000091 public Boolean convert(
92 String string)
93 throws IllegalArgumentException {
94 return Boolean
95 .valueOf(string);
96 }
97 };
Stuart McCullochcd1ddd72012-07-19 13:11:20 +000098 private Converter<List<String>,String> listConverter = SimpleListConverter
Stuart McCulloch669423b2012-06-26 16:34:24 +000099 .create();
Stuart McCullochcd1ddd72012-07-19 13:11:20 +0000100 private Converter<List<HeaderClause>,String> headerClauseListConverter = new HeaderClauseListConverter();
101 private ClauseListConverter<ExportedPackage> exportPackageConverter = new ClauseListConverter<ExportedPackage>(
Stuart McCulloch669423b2012-06-26 16:34:24 +0000102 new Converter<ExportedPackage,Pair<String,Attrs>>() {
103 public ExportedPackage convert(
104 Pair<String,Attrs> input) {
105 return new ExportedPackage(
106 input.getFirst(),
107 input.getSecond());
108 }
109 });
Stuart McCullochcd1ddd72012-07-19 13:11:20 +0000110 private Converter<List<ServiceComponent>,String> serviceComponentConverter = new ClauseListConverter<ServiceComponent>(
Stuart McCulloch669423b2012-06-26 16:34:24 +0000111 new Converter<ServiceComponent,Pair<String,Attrs>>() {
112 public ServiceComponent convert(
113 Pair<String,Attrs> input)
114 throws IllegalArgumentException {
115 return new ServiceComponent(
116 input.getFirst(),
117 input.getSecond());
118 }
119 });
Stuart McCullochcd1ddd72012-07-19 13:11:20 +0000120 private Converter<List<ImportPattern>,String> importPatternConverter = new ClauseListConverter<ImportPattern>(
Stuart McCulloch669423b2012-06-26 16:34:24 +0000121 new Converter<ImportPattern,Pair<String,Attrs>>() {
122 public ImportPattern convert(
123 Pair<String,Attrs> input)
124 throws IllegalArgumentException {
125 return new ImportPattern(
126 input.getFirst(),
127 input.getSecond());
128 }
129 });
130
Stuart McCullochcd1ddd72012-07-19 13:11:20 +0000131 private Converter<Map<String,String>,String> propertiesConverter = new PropertiesConverter();
Stuart McCulloch54229442012-07-12 22:12:58 +0000132
Stuart McCullochcd1ddd72012-07-19 13:11:20 +0000133 private Converter<List<Requirement>,String> requirementListConverter = new RequirementListConverter();
134 private Converter<EE,String> eeConverter = new EEConverter();
Stuart McCulloch669423b2012-06-26 16:34:24 +0000135
Stuart McCulloch669423b2012-06-26 16:34:24 +0000136 // Converter<ResolveMode, String> resolveModeConverter =
137 // EnumConverter.create(ResolveMode.class, ResolveMode.manual);
138
139 // FORMATTERS
Stuart McCullochcd1ddd72012-07-19 13:11:20 +0000140 private Converter<String,String> newlineEscapeFormatter = new NewlineEscapedStringFormatter();
141 private Converter<String,Boolean> defaultFalseBoolFormatter = new DefaultBooleanFormatter(
Stuart McCulloch669423b2012-06-26 16:34:24 +0000142 false);
Stuart McCullochcd1ddd72012-07-19 13:11:20 +0000143 private Converter<String,Collection< ? >> stringListFormatter = new CollectionFormatter<Object>(
Stuart McCulloch669423b2012-06-26 16:34:24 +0000144 LIST_SEPARATOR,
145 (String) null);
Stuart McCullochcd1ddd72012-07-19 13:11:20 +0000146 private Converter<String,Collection< ? extends HeaderClause>> headerClauseListFormatter = new CollectionFormatter<HeaderClause>(
Stuart McCulloch669423b2012-06-26 16:34:24 +0000147 LIST_SEPARATOR,
148 new HeaderClauseFormatter(),
149 null);
Stuart McCullochcd1ddd72012-07-19 13:11:20 +0000150 private Converter<String,Map<String,String>> propertiesFormatter = new MapFormatter(
Stuart McCulloch669423b2012-06-26 16:34:24 +0000151 LIST_SEPARATOR,
152 new PropertiesEntryFormatter(),
153 null);
Stuart McCulloch54229442012-07-12 22:12:58 +0000154
Stuart McCullochcd1ddd72012-07-19 13:11:20 +0000155 private Converter<String,Collection< ? extends Requirement>> requirementListFormatter = new CollectionFormatter<Requirement>(
Stuart McCulloch54229442012-07-12 22:12:58 +0000156 LIST_SEPARATOR,
157 new RequirementFormatter(),
158 null);
159
Stuart McCullochcd1ddd72012-07-19 13:11:20 +0000160 private Converter<String,EE> eeFormatter = new EEFormatter();
161 private Converter<String,Collection< ? extends String>> runReposFormatter = new CollectionFormatter<String>(
Stuart McCulloch669423b2012-06-26 16:34:24 +0000162 LIST_SEPARATOR,
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000163 aQute.bnd.osgi.Constants.EMPTY_HEADER);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000164
165 // Converter<String, ResolveMode> resolveModeFormatter =
166 // EnumFormatter.create(ResolveMode.class, ResolveMode.manual);
167
168 @SuppressWarnings("deprecation")
169 public BndEditModel() {
170 // register converters
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000171 converters.put(aQute.bnd.osgi.Constants.BUNDLE_LICENSE, stringConverter);
172 converters.put(aQute.bnd.osgi.Constants.BUNDLE_CATEGORY, stringConverter);
173 converters.put(aQute.bnd.osgi.Constants.BUNDLE_NAME, stringConverter);
174 converters.put(aQute.bnd.osgi.Constants.BUNDLE_DESCRIPTION, stringConverter);
175 converters.put(aQute.bnd.osgi.Constants.BUNDLE_COPYRIGHT, stringConverter);
176 converters.put(aQute.bnd.osgi.Constants.BUNDLE_UPDATELOCATION, stringConverter);
177 converters.put(aQute.bnd.osgi.Constants.BUNDLE_VENDOR, stringConverter);
178 converters.put(aQute.bnd.osgi.Constants.BUNDLE_CONTACTADDRESS, stringConverter);
179 converters.put(aQute.bnd.osgi.Constants.BUNDLE_DOCURL, stringConverter);
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000180 converters.put(aQute.bnd.osgi.Constants.BUILDPATH, buildPathConverter);
181 converters.put(aQute.bnd.osgi.Constants.BUILDPACKAGES, buildPackagesConverter);
182 converters.put(aQute.bnd.osgi.Constants.RUNBUNDLES, clauseListConverter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000183 converters.put(Constants.BUNDLE_SYMBOLICNAME, stringConverter);
184 converters.put(Constants.BUNDLE_VERSION, stringConverter);
185 converters.put(Constants.BUNDLE_ACTIVATOR, stringConverter);
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000186 converters.put(aQute.bnd.osgi.Constants.OUTPUT, stringConverter);
187 converters.put(aQute.bnd.osgi.Constants.SOURCES, includedSourcesConverter);
188 converters.put(aQute.bnd.osgi.Constants.PRIVATE_PACKAGE, listConverter);
189 converters.put(aQute.bnd.osgi.Constants.CLASSPATH, listConverter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000190 converters.put(Constants.EXPORT_PACKAGE, exportPackageConverter);
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000191 converters.put(aQute.bnd.osgi.Constants.SERVICE_COMPONENT, serviceComponentConverter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000192 converters.put(Constants.IMPORT_PACKAGE, importPatternConverter);
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000193 converters.put(aQute.bnd.osgi.Constants.RUNFRAMEWORK, stringConverter);
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000194 converters.put(aQute.bnd.osgi.Constants.RUNFW, stringConverter);
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000195 converters.put(aQute.bnd.osgi.Constants.SUB, listConverter);
196 converters.put(aQute.bnd.osgi.Constants.RUNPROPERTIES, propertiesConverter);
197 converters.put(aQute.bnd.osgi.Constants.RUNVM, stringConverter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000198 // converters.put(BndConstants.RUNVMARGS, stringConverter);
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000199 converters.put(aQute.bnd.osgi.Constants.TESTSUITES, listConverter);
200 converters.put(aQute.bnd.osgi.Constants.TESTCASES, listConverter);
201 converters.put(aQute.bnd.osgi.Constants.PLUGIN, headerClauseListConverter);
202 converters.put(aQute.bnd.osgi.Constants.RUNREQUIRES, requirementListConverter);
203 converters.put(aQute.bnd.osgi.Constants.RUNEE, eeConverter);
204 converters.put(aQute.bnd.osgi.Constants.RUNREPOS, listConverter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000205 // converters.put(BndConstants.RESOLVE_MODE, resolveModeConverter);
206
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000207 formatters.put(aQute.bnd.osgi.Constants.BUNDLE_LICENSE, newlineEscapeFormatter);
208 formatters.put(aQute.bnd.osgi.Constants.BUNDLE_CATEGORY, newlineEscapeFormatter);
209 formatters.put(aQute.bnd.osgi.Constants.BUNDLE_NAME, newlineEscapeFormatter);
210 formatters.put(aQute.bnd.osgi.Constants.BUNDLE_DESCRIPTION, newlineEscapeFormatter);
211 formatters.put(aQute.bnd.osgi.Constants.BUNDLE_COPYRIGHT, newlineEscapeFormatter);
212 formatters.put(aQute.bnd.osgi.Constants.BUNDLE_UPDATELOCATION, newlineEscapeFormatter);
213 formatters.put(aQute.bnd.osgi.Constants.BUNDLE_VENDOR, newlineEscapeFormatter);
214 formatters.put(aQute.bnd.osgi.Constants.BUNDLE_CONTACTADDRESS, newlineEscapeFormatter);
215 formatters.put(aQute.bnd.osgi.Constants.BUNDLE_DOCURL, newlineEscapeFormatter);
216
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000217 formatters.put(aQute.bnd.osgi.Constants.BUILDPATH, headerClauseListFormatter);
218 formatters.put(aQute.bnd.osgi.Constants.BUILDPACKAGES, headerClauseListFormatter);
219 formatters.put(aQute.bnd.osgi.Constants.RUNBUNDLES, headerClauseListFormatter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000220 formatters.put(Constants.BUNDLE_SYMBOLICNAME, newlineEscapeFormatter);
221 formatters.put(Constants.BUNDLE_VERSION, newlineEscapeFormatter);
222 formatters.put(Constants.BUNDLE_ACTIVATOR, newlineEscapeFormatter);
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000223 formatters.put(aQute.bnd.osgi.Constants.OUTPUT, newlineEscapeFormatter);
224 formatters.put(aQute.bnd.osgi.Constants.SOURCES, defaultFalseBoolFormatter);
225 formatters.put(aQute.bnd.osgi.Constants.PRIVATE_PACKAGE, stringListFormatter);
226 formatters.put(aQute.bnd.osgi.Constants.CLASSPATH, stringListFormatter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000227 formatters.put(Constants.EXPORT_PACKAGE, headerClauseListFormatter);
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000228 formatters.put(aQute.bnd.osgi.Constants.SERVICE_COMPONENT, headerClauseListFormatter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000229 formatters.put(Constants.IMPORT_PACKAGE, headerClauseListFormatter);
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000230 formatters.put(aQute.bnd.osgi.Constants.RUNFRAMEWORK, newlineEscapeFormatter);
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000231 formatters.put(aQute.bnd.osgi.Constants.RUNFW, newlineEscapeFormatter);
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000232 formatters.put(aQute.bnd.osgi.Constants.SUB, stringListFormatter);
233 formatters.put(aQute.bnd.osgi.Constants.RUNPROPERTIES, propertiesFormatter);
234 formatters.put(aQute.bnd.osgi.Constants.RUNVM, newlineEscapeFormatter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000235 // formatters.put(BndConstants.RUNVMARGS, newlineEscapeFormatter);
236 // formatters.put(BndConstants.TESTSUITES, stringListFormatter);
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000237 formatters.put(aQute.bnd.osgi.Constants.TESTCASES, stringListFormatter);
238 formatters.put(aQute.bnd.osgi.Constants.PLUGIN, headerClauseListFormatter);
239 formatters.put(aQute.bnd.osgi.Constants.RUNREQUIRES, requirementListFormatter);
240 formatters.put(aQute.bnd.osgi.Constants.RUNEE, eeFormatter);
241 formatters.put(aQute.bnd.osgi.Constants.RUNREPOS, runReposFormatter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000242 // formatters.put(BndConstants.RESOLVE_MODE, resolveModeFormatter);
243 }
244
245 public void loadFrom(IDocument document) throws IOException {
246 InputStream inputStream = new ByteArrayInputStream(document.get().getBytes(ISO_8859_1));
247 loadFrom(inputStream);
248 }
249
250 public void loadFrom(File file) throws IOException {
251 loadFrom(new BufferedInputStream(new FileInputStream(file)));
252 }
253
254 public void loadFrom(InputStream inputStream) throws IOException {
255 try {
256 // Clear and load
257 properties.clear();
258 properties.load(inputStream);
259 objectProperties.clear();
260 changesToSave.clear();
261
262 // Fire property changes on all known property names
263 for (String prop : KNOWN_PROPERTIES) {
264 // null values for old and new forced the change to be fired
265 propChangeSupport.firePropertyChange(prop, null, null);
266 }
267 }
268 finally {
269 inputStream.close();
270 }
271
272 }
273
274 public void saveChangesTo(IDocument document) {
275 for (Iterator<Entry<String,String>> iter = changesToSave.entrySet().iterator(); iter.hasNext();) {
276 Entry<String,String> entry = iter.next();
277 iter.remove();
278
279 String propertyName = entry.getKey();
280 String stringValue = entry.getValue();
281
282 updateDocument(document, propertyName, stringValue);
283 }
284 }
285
Stuart McCullochcd1ddd72012-07-19 13:11:20 +0000286 private static IRegion findEntry(IDocument document, String name) throws Exception {
Stuart McCulloch669423b2012-06-26 16:34:24 +0000287 PropertiesLineReader reader = new PropertiesLineReader(document);
288 LineType type = reader.next();
289 while (type != LineType.eof) {
290 if (type == LineType.entry) {
291 String key = reader.key();
292 if (name.equals(key))
293 return reader.region();
294 }
295 type = reader.next();
296 }
297 return null;
298 }
299
Stuart McCullochcd1ddd72012-07-19 13:11:20 +0000300 private static void updateDocument(IDocument document, String name, String value) {
Stuart McCulloch669423b2012-06-26 16:34:24 +0000301 String newEntry;
302 if (value != null) {
303 StringBuilder buffer = new StringBuilder();
304 buffer.append(name).append(": ").append(value);
305 newEntry = buffer.toString();
306 } else {
307 newEntry = "";
308 }
309
310 try {
311 IRegion region = findEntry(document, name);
312 if (region != null) {
313 // Replace an existing entry
314 int offset = region.getOffset();
315 int length = region.getLength();
316
317 // If the replacement is empty, remove one extra character to
318 // the right, i.e. the following newline,
319 // unless this would take us past the end of the document
320 if (newEntry.length() == 0 && offset + length + 1 < document.getLength()) {
321 length++;
322 }
323 document.replace(offset, length, newEntry);
324 } else if (newEntry.length() > 0) {
325 // This is a new entry, put it at the end of the file
326
327 // Does the last line of the document have a newline? If not,
328 // we need to add one.
329 if (document.getLength() > 0 && document.getChar(document.getLength() - 1) != '\n')
330 newEntry = "\n" + newEntry;
331 document.replace(document.getLength(), 0, newEntry);
332 }
333 }
334 catch (Exception e) {
335 // TODO Auto-generated catch block
336 e.printStackTrace();
337 }
338 }
339
340 public List<String> getAllPropertyNames() {
341 List<String> result = new ArrayList<String>(properties.size());
342
343 Enumeration<String> names = (Enumeration<String>) properties.propertyNames();
344
345 while (names.hasMoreElements()) {
346 result.add(names.nextElement());
347 }
348 return result;
349 }
350
351 public Object genericGet(String propertyName) {
352 Converter< ? extends Object,String> converter = converters.get(propertyName);
353 if (converter == null)
354 converter = new NoopConverter<String>();
355 return doGetObject(propertyName, converter);
356 }
357
358 public void genericSet(String propertyName, Object value) {
359 Object oldValue = genericGet(propertyName);
360 Converter<String,Object> formatter = (Converter<String,Object>) formatters.get(propertyName);
361 if (formatter == null)
362 formatter = new DefaultFormatter();
363 doSetObject(propertyName, oldValue, value, formatter);
364 }
365
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000366 public String getBundleLicense() {
367 return doGetObject(Constants.BUNDLE_LICENSE, stringConverter);
368 }
369
370 public void setBundleLicense(String bundleLicense) {
371 doSetObject(Constants.BUNDLE_LICENSE, getBundleLicense(), bundleLicense, newlineEscapeFormatter);
372 }
373
374 public String getBundleCategory() {
375 return doGetObject(Constants.BUNDLE_CATEGORY, stringConverter);
376 }
377
378 public void setBundleCategory(String bundleCategory) {
379 doSetObject(Constants.BUNDLE_CATEGORY, getBundleCategory(), bundleCategory, newlineEscapeFormatter);
380 }
381
382 public String getBundleName() {
383 return doGetObject(Constants.BUNDLE_NAME, stringConverter);
384 }
385
386 public void setBundleName(String bundleName) {
387 doSetObject(Constants.BUNDLE_NAME, getBundleName(), bundleName, newlineEscapeFormatter);
388 }
389
390 public String getBundleDescription() {
391 return doGetObject(Constants.BUNDLE_DESCRIPTION, stringConverter);
392 }
393
394 public void setBundleDescription(String bundleDescription) {
395 doSetObject(Constants.BUNDLE_DESCRIPTION, getBundleDescription(), bundleDescription, newlineEscapeFormatter);
396 }
397
398 public String getBundleCopyright() {
399 return doGetObject(Constants.BUNDLE_COPYRIGHT, stringConverter);
400 }
401
402 public void setBundleCopyright(String bundleCopyright) {
403 doSetObject(Constants.BUNDLE_COPYRIGHT, getBundleCopyright(), bundleCopyright, newlineEscapeFormatter);
404 }
405
406 public String getBundleUpdateLocation() {
407 return doGetObject(Constants.BUNDLE_UPDATELOCATION, stringConverter);
408 }
409
410 public void setBundleUpdateLocation(String bundleUpdateLocation) {
411 doSetObject(Constants.BUNDLE_UPDATELOCATION, getBundleUpdateLocation(), bundleUpdateLocation, newlineEscapeFormatter);
412 }
413
414 public String getBundleVendor() {
415 return doGetObject(Constants.BUNDLE_VENDOR, stringConverter);
416 }
417
418 public void setBundleVendor(String bundleVendor) {
419 doSetObject(Constants.BUNDLE_VENDOR, getBundleVendor(), bundleVendor, newlineEscapeFormatter);
420 }
421
422 public String getBundleContactAddress() {
423 return doGetObject(Constants.BUNDLE_CONTACTADDRESS, stringConverter);
424 }
425
426 public void setBundleContactAddress(String bundleContactAddress) {
427 doSetObject(Constants.BUNDLE_CONTACTADDRESS, getBundleContactAddress(), bundleContactAddress, newlineEscapeFormatter);
428 }
429
430 public String getBundleDocUrl() {
431 return doGetObject(Constants.BUNDLE_DOCURL, stringConverter);
432 }
433
434 public void setBundleDocUrl(String bundleDocUrl) {
435 doSetObject(Constants.BUNDLE_DOCURL, getBundleDocUrl(), bundleDocUrl, newlineEscapeFormatter);
436 }
437
Stuart McCulloch669423b2012-06-26 16:34:24 +0000438 public String getBundleSymbolicName() {
439 return doGetObject(Constants.BUNDLE_SYMBOLICNAME, stringConverter);
440 }
441
442 public void setBundleSymbolicName(String bundleSymbolicName) {
443 doSetObject(Constants.BUNDLE_SYMBOLICNAME, getBundleSymbolicName(), bundleSymbolicName, newlineEscapeFormatter);
444 }
445
446 public String getBundleVersionString() {
447 return doGetObject(Constants.BUNDLE_VERSION, stringConverter);
448 }
449
450 public void setBundleVersion(String bundleVersion) {
451 doSetObject(Constants.BUNDLE_VERSION, getBundleVersionString(), bundleVersion, newlineEscapeFormatter);
452 }
453
454 public String getBundleActivator() {
455 return doGetObject(Constants.BUNDLE_ACTIVATOR, stringConverter);
456 }
457
458 public void setBundleActivator(String bundleActivator) {
459 doSetObject(Constants.BUNDLE_ACTIVATOR, getBundleActivator(), bundleActivator, newlineEscapeFormatter);
460 }
461
462 public String getOutputFile() {
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000463 return doGetObject(aQute.bnd.osgi.Constants.OUTPUT, stringConverter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000464 }
465
466 public void setOutputFile(String name) {
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000467 doSetObject(aQute.bnd.osgi.Constants.OUTPUT, getOutputFile(), name, newlineEscapeFormatter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000468 }
469
470 public boolean isIncludeSources() {
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000471 return doGetObject(aQute.bnd.osgi.Constants.SOURCES, includedSourcesConverter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000472 }
473
474 public void setIncludeSources(boolean includeSources) {
475 boolean oldValue = isIncludeSources();
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000476 doSetObject(aQute.bnd.osgi.Constants.SOURCES, oldValue, includeSources, defaultFalseBoolFormatter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000477 }
478
479 public List<String> getPrivatePackages() {
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000480 return doGetObject(aQute.bnd.osgi.Constants.PRIVATE_PACKAGE, listConverter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000481 }
482
483 public void setPrivatePackages(List< ? extends String> packages) {
484 List<String> oldPackages = getPrivatePackages();
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000485 doSetObject(aQute.bnd.osgi.Constants.PRIVATE_PACKAGE, oldPackages, packages, stringListFormatter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000486 }
487
488 public List<ExportedPackage> getSystemPackages() {
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000489 return doGetObject(aQute.bnd.osgi.Constants.RUNSYSTEMPACKAGES, exportPackageConverter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000490 }
491
492 public void setSystemPackages(List< ? extends ExportedPackage> packages) {
493 List<ExportedPackage> oldPackages = getSystemPackages();
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000494 doSetObject(aQute.bnd.osgi.Constants.RUNSYSTEMPACKAGES, oldPackages, packages, headerClauseListFormatter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000495 }
496
497 public List<String> getClassPath() {
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000498 return doGetObject(aQute.bnd.osgi.Constants.CLASSPATH, listConverter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000499 }
500
501 public void addPrivatePackage(String packageName) {
502 List<String> packages = getPrivatePackages();
503 if (packages == null)
504 packages = new ArrayList<String>();
505 else
506 packages = new ArrayList<String>(packages);
507 packages.add(packageName);
508 setPrivatePackages(packages);
509 }
510
511 public void setClassPath(List< ? extends String> classPath) {
512 List<String> oldClassPath = getClassPath();
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000513 doSetObject(aQute.bnd.osgi.Constants.CLASSPATH, oldClassPath, classPath, stringListFormatter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000514 }
515
516 public List<ExportedPackage> getExportedPackages() {
517 return doGetObject(Constants.EXPORT_PACKAGE, exportPackageConverter);
518 }
519
520 public void setExportedPackages(List< ? extends ExportedPackage> exports) {
521 boolean referencesBundleVersion = false;
522
523 if (exports != null) {
524 for (ExportedPackage pkg : exports) {
525 String versionString = pkg.getVersionString();
526 if (versionString != null && versionString.indexOf(BUNDLE_VERSION_MACRO) > -1) {
527 referencesBundleVersion = true;
528 }
529 }
530 }
531 List<ExportedPackage> oldValue = getExportedPackages();
532 doSetObject(Constants.EXPORT_PACKAGE, oldValue, exports, headerClauseListFormatter);
533
534 if (referencesBundleVersion && getBundleVersionString() == null) {
Stuart McCulloch54229442012-07-12 22:12:58 +0000535 setBundleVersion(Version.emptyVersion.toString());
Stuart McCulloch669423b2012-06-26 16:34:24 +0000536 }
537 }
538
539 public void addExportedPackage(ExportedPackage export) {
540 List<ExportedPackage> exports = getExportedPackages();
541 exports = (exports == null) ? new ArrayList<ExportedPackage>() : new ArrayList<ExportedPackage>(exports);
542 exports.add(export);
543 setExportedPackages(exports);
544 }
545
546 public List<String> getDSAnnotationPatterns() {
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000547 return doGetObject(aQute.bnd.osgi.Constants.DSANNOTATIONS, listConverter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000548 }
549
550 public void setDSAnnotationPatterns(List< ? extends String> patterns) {
551 List<String> oldValue = getDSAnnotationPatterns();
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000552 doSetObject(aQute.bnd.osgi.Constants.DSANNOTATIONS, oldValue, patterns, stringListFormatter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000553 }
554
555 public List<ServiceComponent> getServiceComponents() {
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000556 return doGetObject(aQute.bnd.osgi.Constants.SERVICE_COMPONENT, serviceComponentConverter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000557 }
558
559 public void setServiceComponents(List< ? extends ServiceComponent> components) {
560 List<ServiceComponent> oldValue = getServiceComponents();
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000561 doSetObject(aQute.bnd.osgi.Constants.SERVICE_COMPONENT, oldValue, components, headerClauseListFormatter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000562 }
563
564 public List<ImportPattern> getImportPatterns() {
565 return doGetObject(Constants.IMPORT_PACKAGE, importPatternConverter);
566 }
567
568 public void setImportPatterns(List< ? extends ImportPattern> patterns) {
569 List<ImportPattern> oldValue = getImportPatterns();
570 doSetObject(Constants.IMPORT_PACKAGE, oldValue, patterns, headerClauseListFormatter);
571 }
572
573 public List<VersionedClause> getBuildPath() {
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000574 return doGetObject(aQute.bnd.osgi.Constants.BUILDPATH, buildPathConverter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000575 }
576
577 public void setBuildPath(List< ? extends VersionedClause> paths) {
578 List<VersionedClause> oldValue = getBuildPath();
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000579 doSetObject(aQute.bnd.osgi.Constants.BUILDPATH, oldValue, paths, headerClauseListFormatter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000580 }
581
582 public List<VersionedClause> getBuildPackages() {
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000583 return doGetObject(aQute.bnd.osgi.Constants.BUILDPACKAGES, buildPackagesConverter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000584 }
585
586 public void setBuildPackages(List< ? extends VersionedClause> paths) {
587 List<VersionedClause> oldValue = getBuildPackages();
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000588 doSetObject(aQute.bnd.osgi.Constants.BUILDPACKAGES, oldValue, paths, headerClauseListFormatter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000589 }
590
591 public List<VersionedClause> getRunBundles() {
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000592 return doGetObject(aQute.bnd.osgi.Constants.RUNBUNDLES, clauseListConverter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000593 }
594
595 public void setRunBundles(List< ? extends VersionedClause> paths) {
596 List<VersionedClause> oldValue = getBuildPath();
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000597 doSetObject(aQute.bnd.osgi.Constants.RUNBUNDLES, oldValue, paths, headerClauseListFormatter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000598 }
599
600 public boolean isIncludedPackage(String packageName) {
601 final Collection<String> privatePackages = getPrivatePackages();
602 if (privatePackages != null) {
603 if (privatePackages.contains(packageName))
604 return true;
605 }
606 final Collection<ExportedPackage> exportedPackages = getExportedPackages();
607 if (exportedPackages != null) {
608 for (ExportedPackage pkg : exportedPackages) {
609 if (packageName.equals(pkg.getName())) {
610 return true;
611 }
612 }
613 }
614 return false;
615 }
616
617 public List<String> getSubBndFiles() {
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000618 return doGetObject(aQute.bnd.osgi.Constants.SUB, listConverter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000619 }
620
621 public void setSubBndFiles(List<String> subBndFiles) {
622 List<String> oldValue = getSubBndFiles();
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000623 doSetObject(aQute.bnd.osgi.Constants.SUB, oldValue, subBndFiles, stringListFormatter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000624 }
625
626 public Map<String,String> getRunProperties() {
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000627 return doGetObject(aQute.bnd.osgi.Constants.RUNPROPERTIES, propertiesConverter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000628 }
629
630 /*
631 * (non-Javadoc)
632 * @see bndtools.editor.model.IBndModel#setRunProperties(java.util.Map)
633 */
634 public void setRunProperties(Map<String,String> props) {
635 Map<String,String> old = getRunProperties();
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000636 doSetObject(aQute.bnd.osgi.Constants.RUNPROPERTIES, old, props, propertiesFormatter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000637 }
638
639 /*
640 * (non-Javadoc)
641 * @see bndtools.editor.model.IBndModel#getRunVMArgs()
642 */
643 public String getRunVMArgs() {
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000644 return doGetObject(aQute.bnd.osgi.Constants.RUNVM, stringConverter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000645 }
646
647 /*
648 * (non-Javadoc)
649 * @see bndtools.editor.model.IBndModel#setRunVMArgs(java.lang.String)
650 */
651 public void setRunVMArgs(String args) {
652 String old = getRunVMArgs();
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000653 doSetObject(aQute.bnd.osgi.Constants.RUNVM, old, args, newlineEscapeFormatter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000654 }
655
656 @SuppressWarnings("deprecation")
657 public List<String> getTestSuites() {
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000658 List<String> testCases = doGetObject(aQute.bnd.osgi.Constants.TESTCASES, listConverter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000659 testCases = testCases != null ? testCases : Collections.<String> emptyList();
660
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000661 List<String> testSuites = doGetObject(aQute.bnd.osgi.Constants.TESTSUITES, listConverter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000662 testSuites = testSuites != null ? testSuites : Collections.<String> emptyList();
663
664 List<String> result = new ArrayList<String>(testCases.size() + testSuites.size());
665 result.addAll(testCases);
666 result.addAll(testSuites);
667 return result;
668 }
669
670 @SuppressWarnings("deprecation")
671 public void setTestSuites(List<String> suites) {
672 List<String> old = getTestSuites();
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000673 doSetObject(aQute.bnd.osgi.Constants.TESTCASES, old, suites, stringListFormatter);
674 doSetObject(aQute.bnd.osgi.Constants.TESTSUITES, null, null, stringListFormatter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000675 }
676
677 public List<HeaderClause> getPlugins() {
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000678 return doGetObject(aQute.bnd.osgi.Constants.PLUGIN, headerClauseListConverter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000679 }
680
681 public void setPlugins(List<HeaderClause> plugins) {
682 List<HeaderClause> old = getPlugins();
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000683 doSetObject(aQute.bnd.osgi.Constants.PLUGIN, old, plugins, headerClauseListFormatter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000684 }
685
686 public List<String> getPluginPath() {
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000687 return doGetObject(aQute.bnd.osgi.Constants.PLUGINPATH, listConverter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000688 }
689
690 public void setPluginPath(List<String> pluginPath) {
691 List<String> old = getPluginPath();
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000692 doSetObject(aQute.bnd.osgi.Constants.PLUGINPATH, old, pluginPath, stringListFormatter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000693 }
694
695 public List<String> getRunRepos() {
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000696 return doGetObject(aQute.bnd.osgi.Constants.RUNREPOS, listConverter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000697 }
698
699 public void setRunRepos(List<String> repos) {
700 List<String> old = getRunRepos();
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000701 doSetObject(aQute.bnd.osgi.Constants.RUNREPOS, old, repos, runReposFormatter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000702 }
703
704 public String getRunFramework() {
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000705 return doGetObject(aQute.bnd.osgi.Constants.RUNFRAMEWORK, stringConverter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000706 }
707
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000708 public String getRunFw() {
709 return doGetObject(aQute.bnd.osgi.Constants.RUNFW, stringConverter);
710 }
711
Stuart McCulloch54229442012-07-12 22:12:58 +0000712 public EE getEE() {
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000713 return doGetObject(aQute.bnd.osgi.Constants.RUNEE, eeConverter);
Stuart McCulloch54229442012-07-12 22:12:58 +0000714 }
715
716 public void setEE(EE ee) {
717 EE old = getEE();
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000718 doSetObject(aQute.bnd.osgi.Constants.RUNEE, old, ee, eeFormatter);
Stuart McCulloch54229442012-07-12 22:12:58 +0000719 }
720
721
Stuart McCulloch669423b2012-06-26 16:34:24 +0000722 public void setRunFramework(String clause) {
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000723 assert (Constants.RUNFRAMEWORK_SERVICES.equals(clause.toLowerCase().trim()) ||
724 Constants.RUNFRAMEWORK_NONE.equals(clause.toLowerCase().trim()));
Stuart McCulloch669423b2012-06-26 16:34:24 +0000725 String oldValue = getRunFramework();
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000726 doSetObject(aQute.bnd.osgi.Constants.RUNFRAMEWORK, oldValue, clause, newlineEscapeFormatter);
Stuart McCulloch669423b2012-06-26 16:34:24 +0000727 }
Stuart McCulloch54229442012-07-12 22:12:58 +0000728
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000729 public void setRunFw(String clause) {
730 String oldValue = getRunFw();
731 doSetObject(aQute.bnd.osgi.Constants.RUNFW, oldValue, clause, newlineEscapeFormatter);
732 }
733
Stuart McCulloch54229442012-07-12 22:12:58 +0000734 public List<Requirement> getRunRequires() {
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000735 return doGetObject(aQute.bnd.osgi.Constants.RUNREQUIRES, requirementListConverter);
Stuart McCulloch54229442012-07-12 22:12:58 +0000736 }
737
738 public void setRunRequires(List<Requirement> requires) {
739 List<Requirement> oldValue = getRunRequires();
Stuart McCulloch42151ee2012-07-16 13:43:38 +0000740 doSetObject(aQute.bnd.osgi.Constants.RUNREQUIRES, oldValue, requires, requirementListFormatter);
Stuart McCulloch54229442012-07-12 22:12:58 +0000741 }
Stuart McCulloch669423b2012-06-26 16:34:24 +0000742
743
Stuart McCullochcd1ddd72012-07-19 13:11:20 +0000744 private <R> R doGetObject(String name, Converter< ? extends R, ? super String> converter) {
Stuart McCulloch669423b2012-06-26 16:34:24 +0000745 R result;
746 if (objectProperties.containsKey(name)) {
747 R temp = (R) objectProperties.get(name);
748 result = temp;
749 } else if (changesToSave.containsKey(name)) {
750 result = converter.convert(changesToSave.get(name));
751 objectProperties.put(name, result);
752 } else if (properties.containsKey(name)) {
753 result = converter.convert(properties.getProperty(name));
754 objectProperties.put(name, result);
755 } else {
756 result = null;
757 }
758 return result;
759 }
760
Stuart McCullochcd1ddd72012-07-19 13:11:20 +0000761 private <T> void doSetObject(String name, T oldValue, T newValue, Converter<String, ? super T> formatter) {
Stuart McCulloch669423b2012-06-26 16:34:24 +0000762 objectProperties.put(name, newValue);
763 changesToSave.put(name, formatter.convert(newValue));
764 propChangeSupport.firePropertyChange(name, oldValue, newValue);
765 }
766
767 public void setProjectFile(boolean projectFile) {
768 this.projectFile = projectFile;
769 }
770
771 public boolean isProjectFile() {
772 return this.projectFile;
773 }
774
775 public void addPropertyChangeListener(PropertyChangeListener listener) {
776 propChangeSupport.addPropertyChangeListener(listener);
777 }
778
779 public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
780 propChangeSupport.addPropertyChangeListener(propertyName, listener);
781 }
782
783 public void removePropertyChangeListener(PropertyChangeListener listener) {
784 propChangeSupport.removePropertyChangeListener(listener);
785 }
786
787 public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
788 propChangeSupport.removePropertyChangeListener(propertyName, listener);
789 }
790
791 public void setBndResource(File bndResource) {
792 this.bndResource = bndResource;
793 }
794
795 public File getBndResource() {
796 return bndResource;
797 }
Stuart McCulloch54229442012-07-12 22:12:58 +0000798}