public static OverrideOption overrideOption(String overrideOption, OverrideOption def) {
return overrideOption == null ? def : OVERRIDE_OPTIONS.get(overrideOption);
}
public static ModuleComponent bootstrapLoader(String name, AssemblyContext context) throws ConfigurationLoadException {
SystemAssemblyFactory factory = new SystemAssemblyFactoryImpl();
ComponentTypeIntrospector introspector = ProcessorUtils.createCoreIntrospector(factory);
Module module = factory.createModule();
module.setName("org.apache.tuscany.core.system.loader");
List<Component> components = module.getComponents();
// bootstrap the minimal set of loaders needed to read the system module files
// all others should be defined in the system.module file
components.add(bootstrapLoader(factory, introspector, ModuleLoader.class));
components.add(bootstrapLoader(factory, introspector, ModuleFragmentLoader.class));
Component propFactory = factory.createSystemComponent("org.apache.tuscany.core.system.loader.DefaultPropertyFactory", StAXPropertyFactory.class, StringParserPropertyFactory.class, Scope.MODULE);
introspector.introspect(StAXPropertyFactory.class);
components.add(propFactory);
components.add(bootstrapLoader(factory, introspector, ComponentLoader.class));
components.add(bootstrapLoader(factory, introspector, EntryPointLoader.class));
components.add(bootstrapLoader(factory, introspector, InterfaceJavaLoader.class));
components.add(bootstrapLoader(factory, introspector, SystemImplementationLoader.class));
components.add(bootstrapLoader(factory, introspector, SystemBindingLoader.class));
// do not add additional loaders above - they should be in the system.module file
// bootstrap the registries needed by the bootstrap loaders above
bootstrapService(factory, introspector, module, StAXLoaderRegistry.class, StAXLoaderRegistryImpl.class);
bootstrapService(factory, introspector, module, SystemAssemblyFactory.class, SystemAssemblyFactoryImpl.class);
bootstrapService(factory, introspector, module, ComponentTypeIntrospector.class, Java5ComponentTypeIntrospector.class);
ModuleComponent mc = factory.createModuleComponent();
mc.setName(name);
mc.setImplementation(module);
mc.initialize(context);
return mc;
}