001: /*****************************************************************************
002: * Java Plug-in Framework (JPF)
003: * Copyright (C) 2004-2007 Dmitry Olshansky
004: *
005: * This library is free software; you can redistribute it and/or
006: * modify it under the terms of the GNU Lesser General Public
007: * License as published by the Free Software Foundation; either
008: * version 2.1 of the License, or (at your option) any later version.
009: *
010: * This library is distributed in the hope that it will be useful,
011: * but WITHOUT ANY WARRANTY; without even the implied warranty of
012: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013: * Lesser General Public License for more details.
014: *
015: * You should have received a copy of the GNU Lesser General Public
016: * License along with this library; if not, write to the Free Software
017: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
018: *****************************************************************************/package org.java.plugin.registry.xml;
019:
020: import java.net.URL;
021: import java.util.LinkedList;
022: import java.util.List;
023:
024: import org.java.plugin.registry.ExtensionMultiplicity;
025: import org.java.plugin.registry.MatchingRule;
026: import org.java.plugin.registry.ParameterMultiplicity;
027: import org.java.plugin.registry.ParameterType;
028: import org.java.plugin.registry.Version;
029:
030: /**
031: * @version $Id: Model.java,v 1.4 2007/03/03 17:16:26 ddimon Exp $
032: */
033: abstract class ModelPluginManifest {
034: private URL location;
035: private String id;
036: private Version version;
037: private String vendor;
038: private String docsPath;
039: private ModelDocumentation documentation;
040: private LinkedList<ModelAttribute> attributes = new LinkedList<ModelAttribute>();
041: private LinkedList<ModelPrerequisite> prerequisites = new LinkedList<ModelPrerequisite>();
042: private LinkedList<ModelLibrary> libraries = new LinkedList<ModelLibrary>();
043: private LinkedList<ModelExtensionPoint> extensionPoints = new LinkedList<ModelExtensionPoint>();
044: private LinkedList<ModelExtension> extensions = new LinkedList<ModelExtension>();
045:
046: URL getLocation() {
047: return location;
048: }
049:
050: void setLocation(final URL value) {
051: location = value;
052: }
053:
054: String getDocsPath() {
055: return docsPath;
056: }
057:
058: void setDocsPath(final String value) {
059: docsPath = value;
060: }
061:
062: ModelDocumentation getDocumentation() {
063: return documentation;
064: }
065:
066: void setDocumentation(final ModelDocumentation value) {
067: documentation = value;
068: }
069:
070: String getId() {
071: return id;
072: }
073:
074: void setId(final String value) {
075: id = value;
076: }
077:
078: String getVendor() {
079: return vendor;
080: }
081:
082: void setVendor(final String value) {
083: vendor = value;
084: }
085:
086: Version getVersion() {
087: return version;
088: }
089:
090: void setVersion(final String value) {
091: version = Version.parse(value);
092: }
093:
094: List<ModelAttribute> getAttributes() {
095: return attributes;
096: }
097:
098: List<ModelExtensionPoint> getExtensionPoints() {
099: return extensionPoints;
100: }
101:
102: List<ModelExtension> getExtensions() {
103: return extensions;
104: }
105:
106: List<ModelLibrary> getLibraries() {
107: return libraries;
108: }
109:
110: List<ModelPrerequisite> getPrerequisites() {
111: return prerequisites;
112: }
113: }
114:
115: final class ModelPluginDescriptor extends ModelPluginManifest {
116: private String className;
117:
118: ModelPluginDescriptor() {
119: // no-op
120: }
121:
122: String getClassName() {
123: return className;
124: }
125:
126: void setClassName(final String value) {
127: className = value;
128: }
129: }
130:
131: final class ModelPluginFragment extends ModelPluginManifest {
132: private String pluginId;
133: private Version pluginVersion;
134: private MatchingRule matchingRule = MatchingRule.COMPATIBLE;
135:
136: ModelPluginFragment() {
137: // no-op
138: }
139:
140: MatchingRule getMatchingRule() {
141: return matchingRule;
142: }
143:
144: void setMatchingRule(final MatchingRule value) {
145: matchingRule = value;
146: }
147:
148: String getPluginId() {
149: return pluginId;
150: }
151:
152: void setPluginId(final String value) {
153: pluginId = value;
154: }
155:
156: Version getPluginVersion() {
157: return pluginVersion;
158: }
159:
160: void setPluginVersion(final String value) {
161: pluginVersion = Version.parse(value);
162: }
163: }
164:
165: final class ModelDocumentation {
166: private LinkedList<ModelDocumentationReference> references = new LinkedList<ModelDocumentationReference>();
167: private String caption;
168: private String text;
169:
170: ModelDocumentation() {
171: // no-op
172: }
173:
174: String getCaption() {
175: return caption;
176: }
177:
178: void setCaption(final String value) {
179: caption = value;
180: }
181:
182: String getText() {
183: return text;
184: }
185:
186: void setText(final String value) {
187: text = value;
188: }
189:
190: List<ModelDocumentationReference> getReferences() {
191: return references;
192: }
193: }
194:
195: final class ModelDocumentationReference {
196: private String path;
197: private String caption;
198:
199: ModelDocumentationReference() {
200: // no-op
201: }
202:
203: String getCaption() {
204: return caption;
205: }
206:
207: void setCaption(final String value) {
208: caption = value;
209: }
210:
211: String getPath() {
212: return path;
213: }
214:
215: void setPath(final String value) {
216: path = value;
217: }
218: }
219:
220: final class ModelAttribute {
221: private String id;
222: private String value;
223: private ModelDocumentation documentation;
224: private LinkedList<ModelAttribute> attributes = new LinkedList<ModelAttribute>();
225:
226: ModelAttribute() {
227: // no-op
228: }
229:
230: ModelDocumentation getDocumentation() {
231: return documentation;
232: }
233:
234: void setDocumentation(final ModelDocumentation aValue) {
235: documentation = aValue;
236: }
237:
238: String getId() {
239: return id;
240: }
241:
242: void setId(final String aValue) {
243: id = aValue;
244: }
245:
246: String getValue() {
247: return value;
248: }
249:
250: void setValue(final String aValue) {
251: value = aValue;
252: }
253:
254: List<ModelAttribute> getAttributes() {
255: return attributes;
256: }
257: }
258:
259: final class ModelPrerequisite {
260: private String id;
261: private String pluginId;
262: private Version pluginVersion;
263: private MatchingRule matchingRule = MatchingRule.COMPATIBLE;
264: private ModelDocumentation documentation;
265: private boolean isExported;
266: private boolean isOptional;
267: private boolean isReverseLookup;
268:
269: ModelPrerequisite() {
270: // no-op
271: }
272:
273: ModelDocumentation getDocumentation() {
274: return documentation;
275: }
276:
277: void setDocumentation(final ModelDocumentation value) {
278: documentation = value;
279: }
280:
281: String getId() {
282: return id;
283: }
284:
285: void setId(final String value) {
286: id = value;
287: }
288:
289: boolean isExported() {
290: return isExported;
291: }
292:
293: void setExported(final String value) {
294: isExported = "true".equals(value); //$NON-NLS-1$
295: }
296:
297: boolean isOptional() {
298: return isOptional;
299: }
300:
301: void setOptional(final String value) {
302: isOptional = "true".equals(value); //$NON-NLS-1$
303: }
304:
305: boolean isReverseLookup() {
306: return isReverseLookup;
307: }
308:
309: void setReverseLookup(final String value) {
310: isReverseLookup = "true".equals(value); //$NON-NLS-1$
311: }
312:
313: MatchingRule getMatchingRule() {
314: return matchingRule;
315: }
316:
317: void setMatchingRule(final MatchingRule value) {
318: matchingRule = value;
319: }
320:
321: String getPluginId() {
322: return pluginId;
323: }
324:
325: void setPluginId(final String value) {
326: pluginId = value;
327: }
328:
329: Version getPluginVersion() {
330: return pluginVersion;
331: }
332:
333: void setPluginVersion(final String value) {
334: pluginVersion = Version.parse(value);
335: }
336: }
337:
338: final class ModelLibrary {
339: private String id;
340: private String path;
341: private boolean isCodeLibrary;
342: private ModelDocumentation documentation;
343: private LinkedList<String> exports = new LinkedList<String>();
344: private Version version;
345:
346: ModelLibrary() {
347: // no-op
348: }
349:
350: ModelDocumentation getDocumentation() {
351: return documentation;
352: }
353:
354: void setDocumentation(final ModelDocumentation value) {
355: documentation = value;
356: }
357:
358: String getId() {
359: return id;
360: }
361:
362: void setId(final String value) {
363: id = value;
364: }
365:
366: boolean isCodeLibrary() {
367: return isCodeLibrary;
368: }
369:
370: void setCodeLibrary(final String value) {
371: isCodeLibrary = "code".equals(value); //$NON-NLS-1$
372: }
373:
374: String getPath() {
375: return path;
376: }
377:
378: void setPath(final String value) {
379: path = value;
380: }
381:
382: List<String> getExports() {
383: return exports;
384: }
385:
386: Version getVersion() {
387: return version;
388: }
389:
390: void setVersion(final String value) {
391: version = Version.parse(value);
392: }
393: }
394:
395: final class ModelExtensionPoint {
396: private String id;
397: private String parentPluginId;
398: private String parentPointId;
399: private ExtensionMultiplicity extensionMultiplicity = ExtensionMultiplicity.ONE;
400: private ModelDocumentation documentation;
401: private LinkedList<ModelParameterDef> paramDefs = new LinkedList<ModelParameterDef>();
402:
403: ModelExtensionPoint() {
404: // no-op
405: }
406:
407: ModelDocumentation getDocumentation() {
408: return documentation;
409: }
410:
411: void setDocumentation(final ModelDocumentation value) {
412: documentation = value;
413: }
414:
415: ExtensionMultiplicity getExtensionMultiplicity() {
416: return extensionMultiplicity;
417: }
418:
419: void setExtensionMultiplicity(final ExtensionMultiplicity value) {
420: extensionMultiplicity = value;
421: }
422:
423: String getId() {
424: return id;
425: }
426:
427: void setId(final String value) {
428: id = value;
429: }
430:
431: String getParentPluginId() {
432: return parentPluginId;
433: }
434:
435: void setParentPluginId(final String value) {
436: parentPluginId = value;
437: }
438:
439: String getParentPointId() {
440: return parentPointId;
441: }
442:
443: void setParentPointId(final String value) {
444: parentPointId = value;
445: }
446:
447: List<ModelParameterDef> getParamDefs() {
448: return paramDefs;
449: }
450: }
451:
452: final class ModelParameterDef {
453: private String id;
454: private ParameterMultiplicity multiplicity = ParameterMultiplicity.ONE;
455: private ParameterType type = ParameterType.STRING;
456: private String customData;
457: private ModelDocumentation documentation;
458: private LinkedList<ModelParameterDef> paramDefs = new LinkedList<ModelParameterDef>();
459: private String defaultValue;
460:
461: ModelParameterDef() {
462: // no-op
463: }
464:
465: String getCustomData() {
466: return customData;
467: }
468:
469: void setCustomData(final String value) {
470: customData = value;
471: }
472:
473: ModelDocumentation getDocumentation() {
474: return documentation;
475: }
476:
477: void setDocumentation(final ModelDocumentation value) {
478: documentation = value;
479: }
480:
481: String getId() {
482: return id;
483: }
484:
485: void setId(final String value) {
486: id = value;
487: }
488:
489: ParameterMultiplicity getMultiplicity() {
490: return multiplicity;
491: }
492:
493: void setMultiplicity(final ParameterMultiplicity value) {
494: multiplicity = value;
495: }
496:
497: ParameterType getType() {
498: return type;
499: }
500:
501: void setType(final ParameterType value) {
502: type = value;
503: }
504:
505: List<ModelParameterDef> getParamDefs() {
506: return paramDefs;
507: }
508:
509: String getDefaultValue() {
510: return defaultValue;
511: }
512:
513: void setDefaultValue(final String value) {
514: defaultValue = value;
515: }
516: }
517:
518: final class ModelExtension {
519: private String id;
520: private String pluginId;
521: private String pointId;
522: private ModelDocumentation documentation;
523: private LinkedList<ModelParameter> params = new LinkedList<ModelParameter>();
524:
525: ModelExtension() {
526: // no-op
527: }
528:
529: ModelDocumentation getDocumentation() {
530: return documentation;
531: }
532:
533: void setDocumentation(final ModelDocumentation value) {
534: documentation = value;
535: }
536:
537: String getId() {
538: return id;
539: }
540:
541: void setId(final String value) {
542: id = value;
543: }
544:
545: String getPluginId() {
546: return pluginId;
547: }
548:
549: void setPluginId(final String value) {
550: pluginId = value;
551: }
552:
553: String getPointId() {
554: return pointId;
555: }
556:
557: void setPointId(final String value) {
558: pointId = value;
559: }
560:
561: List<ModelParameter> getParams() {
562: return params;
563: }
564: }
565:
566: final class ModelParameter {
567: private String id;
568: private String value;
569: private ModelDocumentation documentation;
570: private LinkedList<ModelParameter> params = new LinkedList<ModelParameter>();
571:
572: ModelParameter() {
573: // no-op
574: }
575:
576: ModelDocumentation getDocumentation() {
577: return documentation;
578: }
579:
580: void setDocumentation(final ModelDocumentation aValue) {
581: documentation = aValue;
582: }
583:
584: String getId() {
585: return id;
586: }
587:
588: void setId(final String aValue) {
589: id = aValue;
590: }
591:
592: String getValue() {
593: return value;
594: }
595:
596: void setValue(final String aValue) {
597: value = aValue;
598: }
599:
600: List<ModelParameter> getParams() {
601: return params;
602: }
603: }
604:
605: final class ModelManifestInfo {
606: private String id;
607: private Version version;
608: private String vendor;
609: private String pluginId;
610: private Version pluginVersion;
611: private MatchingRule matchingRule = MatchingRule.COMPATIBLE;
612:
613: ModelManifestInfo() {
614: // no-op
615: }
616:
617: String getId() {
618: return id;
619: }
620:
621: void setId(final String value) {
622: id = value;
623: }
624:
625: String getVendor() {
626: return vendor;
627: }
628:
629: void setVendor(final String value) {
630: vendor = value;
631: }
632:
633: Version getVersion() {
634: return version;
635: }
636:
637: void setVersion(final String value) {
638: version = Version.parse(value);
639: }
640:
641: MatchingRule getMatchRule() {
642: return matchingRule;
643: }
644:
645: void setMatchingRule(final MatchingRule value) {
646: matchingRule = value;
647: }
648:
649: String getPluginId() {
650: return pluginId;
651: }
652:
653: void setPluginId(final String value) {
654: pluginId = value;
655: }
656:
657: Version getPluginVersion() {
658: return pluginVersion;
659: }
660:
661: void setPluginVersion(final String value) {
662: pluginVersion = Version.parse(value);
663: }
664: }
|