use of org.opendaylight.controller.sal.core.api.model.YangTextSourceProvider in project controller by opendaylight.
the class SchemaServiceImplSingletonModule method createInstance.
@Override
public AutoCloseable createInstance() {
final WaitingServiceTracker<SchemaService> schemaServiceTracker = WaitingServiceTracker.create(SchemaService.class, bundleContext);
final SchemaService schemaService = schemaServiceTracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
final WaitingServiceTracker<YangTextSourceProvider> sourceProviderTracker = WaitingServiceTracker.create(YangTextSourceProvider.class, bundleContext);
final YangTextSourceProvider sourceProvider = sourceProviderTracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
class GlobalSchemaServiceProxy implements AutoCloseable, SchemaService, YangTextSourceProvider {
@Override
public void close() {
schemaServiceTracker.close();
sourceProviderTracker.close();
}
@Override
public void addModule(final Module arg0) {
schemaService.addModule(arg0);
}
@Override
public SchemaContext getGlobalContext() {
return schemaService.getGlobalContext();
}
@Override
public SchemaContext getSessionContext() {
return schemaService.getSessionContext();
}
@Override
public ListenerRegistration<SchemaContextListener> registerSchemaContextListener(final SchemaContextListener arg0) {
return schemaService.registerSchemaContextListener(arg0);
}
@Override
public void removeModule(final Module arg0) {
schemaService.removeModule(arg0);
}
@Override
public ListenableFuture<? extends YangTextSchemaSource> getSource(final SourceIdentifier sourceIdentifier) {
return sourceProvider.getSource(sourceIdentifier);
}
}
return new GlobalSchemaServiceProxy();
}
Aggregations