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 TopConfigurationBuilder {
14: public TopConfigurationBuilder() {
15: }
16:
17: public Configuration build(String id) {
18: ConfigurationBuilder cb = null;
19: cb = ConfigurationBuilderFactory.getBuilder(null);
20:
21: ConfigurationMetadataBuilder builder = new ConfigurationMetadataBuilder(
22: true);
23: InputStream is = DefaultResourceManager
24: .instance()
25: .getResourceAsStream(
26: "org/objectweb/celtix/bus/configuration/resources/top.xml");
27: ConfigurationMetadata model = null;
28: try {
29: model = builder.build(is);
30: } catch (IOException ex) {
31: // ignore
32: }
33: cb.addModel(model);
34: return cb.buildConfiguration(model.getNamespaceURI(), id);
35: }
36: }
|