1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package net.sf.jameleon.util;
20
21 import java.io.File;
22 import java.util.Collections;
23 import java.util.HashMap;
24 import java.util.Iterator;
25 import java.util.Map;
26 import java.util.TreeMap;
27
28 import net.sf.jameleon.bean.FunctionalPoint;
29 import net.sf.jameleon.util.JameleonUtility;
30
31 public class GenSyntaxReference {
32
33 protected SupportedTags supportedTags;
34 protected Map tags;
35
36 public GenSyntaxReference(){
37 supportedTags = new SupportedTags();
38 }
39
40 public Map getTagsForPlugin(String plugin){
41 Map supportedTagsMap = Collections.synchronizedMap(new TreeMap());
42 tags = Collections.synchronizedMap(new TreeMap());
43 supportedTags.setTagsFor(supportedTagsMap, plugin);
44 Iterator it = supportedTagsMap.keySet().iterator();
45 String className, key;
46 FunctionalPoint fp;
47 while (it.hasNext()) {
48 key = (String)it.next();
49 className = (String)supportedTagsMap.get(key);
50 fp = JameleonUtility.loadFunctionalPoint(className, this);
51 tags.put(fp.getDefaultTagName(), fp);
52 }
53 return tags;
54 }
55
56 public void genReferenceForPlugin(String plugin, String templateName, File toFile, Map templateParams){
57 getTagsForPlugin(plugin);
58 Map params = new HashMap();
59 params.put("tags", tags);
60 params.putAll(templateParams);
61 TemplateProcessor tcdf = new TemplateProcessor(templateName);
62 tcdf.transform(toFile,params);
63 }
64 }