modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class);
assemblyFactory = new RuntimeAssemblyFactory();
modelFactories.addFactory(assemblyFactory);
// Create a monitor
UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
monitor = monitorFactory.createMonitor();
// Initialize the Tuscany module activators
ModuleActivatorExtensionPoint activators = extensionPoints.getExtensionPoint(ModuleActivatorExtensionPoint.class);
for (ModuleActivator moduleActivator: activators.getModuleActivators()) {
try {
moduleActivator.start(extensionPoints);
moduleActivators.add(moduleActivator);
} catch (Throwable e) {
// Ignore the failing module for now
logger.log(Level.SEVERE, e.getMessage(), e);
}
}
// Get XML input/output factories
inputFactory = modelFactories.getFactory(XMLInputFactory.class);
// Get contribution workspace and assembly model factories
contributionFactory = modelFactories.getFactory(ContributionFactory.class);
workspaceFactory = modelFactories.getFactory(WorkspaceFactory.class);
// Create XML artifact processors
xmlProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
compositeProcessor = xmlProcessors.getProcessor(Composite.class);
// Create contribution content processor
URLArtifactProcessorExtensionPoint docProcessorExtensions = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
contributionProcessor = docProcessorExtensions.getProcessor(Contribution.class);
// Get the model resolvers
modelResolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class);
// Get a contribution dependency builder
ContributionBuilderExtensionPoint contributionBuilders = extensionPoints.getExtensionPoint(ContributionBuilderExtensionPoint.class);
contributionDependencyBuilder = contributionBuilders.getContributionBuilder("org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilder");
// Get composite builders
CompositeBuilderExtensionPoint compositeBuilders = extensionPoints.getExtensionPoint(CompositeBuilderExtensionPoint.class);
compositeBuilder = compositeBuilders.getCompositeBuilder("org.apache.tuscany.sca.assembly.builder.CompositeBuilder");
// Initialize runtime
// Get proxy factory
ProxyFactoryExtensionPoint proxyFactories = extensionPoints.getExtensionPoint(ProxyFactoryExtensionPoint.class);
proxyFactory = new ExtensibleProxyFactory(proxyFactories);
// Get the composite activator
compositeActivator = utilities.getUtility(CompositeActivator.class);
workScheduler = utilities.getUtility(WorkScheduler.class);
// Load the system definitions.xml from all of the loaded extension points
DefinitionsProviderExtensionPoint definitionsProviders = extensionPoints.getExtensionPoint(DefinitionsProviderExtensionPoint.class);
DefinitionsFactory definitionsFactory = modelFactories.getFactory(DefinitionsFactory.class);
systemDefinitions = definitionsFactory.createDefinitions();