01: package org.objectweb.celtix.bus.configuration;
02:
03: import java.io.IOException;
04: import java.io.InputStream;
05:
06: import org.objectweb.celtix.configuration.Configuration;
07: import org.objectweb.celtix.configuration.ConfigurationBuilder;
08: import org.objectweb.celtix.configuration.ConfigurationBuilderFactory;
09: import org.objectweb.celtix.configuration.ConfigurationMetadata;
10: import org.objectweb.celtix.configuration.impl.ConfigurationMetadataBuilder;
11: import org.objectweb.celtix.resource.DefaultResourceManager;
12:
13: public class LeafConfigurationBuilder {
14:
15: public LeafConfigurationBuilder() {
16: }
17:
18: public Configuration build(Configuration top, String id) {
19: ConfigurationBuilder cb = null;
20: cb = ConfigurationBuilderFactory.getBuilder(null);
21:
22: ConfigurationMetadataBuilder builder = new ConfigurationMetadataBuilder(
23: true);
24: InputStream is = DefaultResourceManager
25: .instance()
26: .getResourceAsStream(
27: "org/objectweb/celtix/bus/configuration/resources/leaf.xml");
28: ConfigurationMetadata model = null;
29: try {
30: model = builder.build(is);
31: } catch (IOException ex) {
32: // ignore
33: }
34: cb.addModel(model);
35: return cb.buildConfiguration(model.getNamespaceURI(), id, top);
36: }
37: }
|