blob: 4801ec9770cf0c11a0890d1d10cd3e14c2e59a60 [file] [log] [blame]
Stuart McCulloch26e7a5a2011-10-17 10:31:43 +00001package aQute.bnd.make.metatype;
2
3import java.util.*;
4
5import aQute.bnd.annotation.metatype.*;
6import aQute.bnd.service.*;
7import aQute.lib.osgi.*;
8import aQute.lib.osgi.Clazz.*;
9
10/**
11 * This class is responsible for meta type types. It is a plugin that can
12 * @author aqute
13 *
14 */
15public class MetatypePlugin implements AnalyzerPlugin {
16
17 public boolean analyzeJar(Analyzer analyzer) throws Exception {
18
19 Map<String, Map<String, String>> map = analyzer.parseHeader(analyzer
20 .getProperty(Constants.METATYPE));
21
22 Jar jar = analyzer.getJar();
23 for (String name : map.keySet()) {
24 Collection<Clazz> metatypes = analyzer.getClasses("", QUERY.ANNOTATION.toString(),
25 Meta.OCD.class.getName(), //
26 QUERY.NAMED.toString(), name //
27 );
28 for (Clazz c : metatypes) {
29 jar.putResource("OSGI-INF/metatype/" + c.getFQN() + ".xml", new MetaTypeReader(c,
30 analyzer));
31 }
32 }
33 return false;
34 }
35}