Change-Id: I96c37055e8f632ab5ea7dd5c6111039a57430887
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
- public ListenerRegistration<org.opendaylight.yangtools.yang.binding.NotificationListener> registerNotificationListener(
- org.opendaylight.yangtools.yang.binding.NotificationListener listener) {
+ public ListenerRegistration<org.opendaylight.yangtools.yang.binding.NotificationListener>
+ registerNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) {
return getNotificationBrokerChecked().registerNotificationListener(listener);
}
}
return getNotificationBrokerChecked().registerNotificationListener(listener);
}
}
- public <L extends RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>>> ListenerRegistration<L> registerRouteChangeListener(
- final L listener) {
+ public <L extends RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>>> ListenerRegistration<L>
+ registerRouteChangeListener(final L listener) {
return getRpcRegistryChecked().registerRouteChangeListener(listener);
}
return getRpcRegistryChecked().registerRouteChangeListener(listener);
}
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkNotNull;
+import com.google.common.collect.ClassToInstanceMap;
+import com.google.common.collect.MutableClassToInstanceMap;
import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.RpcService;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.RpcService;
-import com.google.common.collect.ClassToInstanceMap;
-import com.google.common.collect.MutableClassToInstanceMap;
-
-public class BindingContextUtils {
+public final class BindingContextUtils {
+ private BindingContextUtils() {
+ }
public static ConsumerContext createConsumerContext(BindingAwareConsumer consumer,
ClassToInstanceMap<BindingAwareService> serviceProvider) {
public static ConsumerContext createConsumerContext(BindingAwareConsumer consumer,
ClassToInstanceMap<BindingAwareService> serviceProvider) {
private ClassToInstanceMap<BindingAwareService> alreadyRetrievedServices;
private ClassToInstanceMap<BindingAwareService> serviceProvider;
private ClassToInstanceMap<BindingAwareService> alreadyRetrievedServices;
private ClassToInstanceMap<BindingAwareService> serviceProvider;
- public SingleConsumerContextImpl(ClassToInstanceMap<BindingAwareService> serviceProvider) {
+ SingleConsumerContextImpl(ClassToInstanceMap<BindingAwareService> serviceProvider) {
this.alreadyRetrievedServices = MutableClassToInstanceMap.create();
this.serviceProvider = serviceProvider;
}
this.alreadyRetrievedServices = MutableClassToInstanceMap.create();
this.serviceProvider = serviceProvider;
}
public final <T extends BindingAwareService> T getSALService(Class<T> service) {
checkNotNull(service,"Service class should not be null.");
T potential = alreadyRetrievedServices.getInstance(service);
public final <T extends BindingAwareService> T getSALService(Class<T> service) {
checkNotNull(service,"Service class should not be null.");
T potential = alreadyRetrievedServices.getInstance(service);
- if(potential != null) {
+ if (potential != null) {
return potential;
}
return tryToRetrieveSalService(service);
return potential;
}
return tryToRetrieveSalService(service);
private synchronized <T extends BindingAwareService> T tryToRetrieveSalService(Class<T> service) {
final T potential = alreadyRetrievedServices.getInstance(service);
private synchronized <T extends BindingAwareService> T tryToRetrieveSalService(Class<T> service) {
final T potential = alreadyRetrievedServices.getInstance(service);
- if(potential != null) {
+ if (potential != null) {
return potential;
}
final T requested = serviceProvider.getInstance(service);
return potential;
}
final T requested = serviceProvider.getInstance(service);
- if(requested == null) {
- throw new IllegalArgumentException("Requested service "+service.getName() +" is not available.");
+ if (requested == null) {
+ throw new IllegalArgumentException("Requested service " + service.getName() + " is not available.");
}
final T retrieved = BindingContextUtils.createContextProxyOrReturnService(service,requested);
alreadyRetrievedServices.put(service, retrieved);
}
final T retrieved = BindingContextUtils.createContextProxyOrReturnService(service,requested);
alreadyRetrievedServices.put(service, retrieved);
private static class SingleProviderContextImpl extends SingleConsumerContextImpl implements ProviderContext {
private static class SingleProviderContextImpl extends SingleConsumerContextImpl implements ProviderContext {
- public SingleProviderContextImpl(ClassToInstanceMap<BindingAwareService> serviceProvider) {
+ SingleProviderContextImpl(ClassToInstanceMap<BindingAwareService> serviceProvider) {
super(serviceProvider);
}
@Override
super(serviceProvider);
}
@Override
- public <L extends RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>>> ListenerRegistration<L> registerRouteChangeListener(
- L listener) {
+ public <L extends RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>>> ListenerRegistration<L>
+ registerRouteChangeListener(L listener) {
return getSALService(RpcProviderRegistry.class).registerRouteChangeListener(listener);
}
return getSALService(RpcProviderRegistry.class).registerRouteChangeListener(listener);
}
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
/**
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
/**
- *
- * @deprecated Use
- * {@link org.opendaylight.controller.md.sal.binding.api.ReadTransaction#read(org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType, InstanceIdentifier)}
- * instead.
+ * @deprecated Use {@link org.opendaylight.controller.md.sal.binding.api.ReadTransaction#read(
+ * org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType, InstanceIdentifier)} instead.
*/
@Deprecated
public final class TypeSafeDataReader {
*/
@Deprecated
public final class TypeSafeDataReader {
}
return Futures.makeChecked((ListenableFuture<YangTextSchemaSource>) yangProvider.getSource(sourceIdentifier),
}
return Futures.makeChecked((ListenableFuture<YangTextSchemaSource>) yangProvider.getSource(sourceIdentifier),
- e -> new SchemaSourceException("Error retrieving source", e));
+ e -> new SchemaSourceException("Error retrieving source", e));