/** * Looks up the registered factories and creates a CompositeDataSource * using them. * * @return a new DataSource */ public static CompositeDataSource createDataSource() { CompositeDataSource composite = new CompositeDataSource(); composite.setConfiguration(readConfiguration(composite, "datasources")); ServiceLoaderOSGiWrapper.load(DataSourceProvider.class, log, composite::putDataSource); return composite; }
public void programmaticCompositeDataSourceConfiguration() { // The recommended method to configure data sources is through // the configuration files in DIIRT_HOME. // If is needed, you can still change the configuration through // the programmatic API. This can be useful for unit testing // or standalone applications. You should not do this in shared // environment, like CS-Studio. // Create a composite data source, and add different data sources. // You can either add a DataSourceProvider or a DataSource. CompositeDataSource composite = new CompositeDataSource(); composite.putDataSource(new JCADataSourceProvider()); composite.putDataSource("sim", new SimulationDataSource()); // If no prefix is given to a channel, use JCA as default composite.setConfiguration(new CompositeDataSourceConfiguration().defaultDataSource("ca")); // Set the composite as the default PVManager.setDefaultDataSource(composite); // For more options, check CompositeDataSource. }