*/
package org.opendaylight.controller.sal.binding.api;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
-import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
public abstract class AbstractBindingAwareConsumer extends AbstractBrokerAwareActivator implements BindingAwareConsumer {
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
import org.opendaylight.yangtools.yang.binding.RpcService;
-import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
public abstract class AbstractBindingAwareProvider extends AbstractBrokerAwareActivator implements BindingAwareProvider {
-
+
@Override
protected final void onBrokerAvailable(BindingAwareBroker broker, BundleContext context) {
ProviderContext ctx = broker.registerProvider(this, context);
public Collection<? extends RpcService> getImplementations() {
return Collections.emptySet();
}
-
+
/**
* Initialization of consumer context.
- *
+ *
* {@link ProviderContext} is replacement of {@link ConsumerContext}
* so this method is not needed in case of Provider.
- *
+ *
*/
@Deprecated
@Override
import org.opendaylight.controller.md.sal.common.api.notify.NotificationPublishService;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.concepts.Registration;
import org.opendaylight.yangtools.yang.binding.Notification;
public interface NotificationProviderService extends NotificationService, NotificationPublishService<Notification> {
/**
* Deprecated. Use {@link #publish(Notification)}.
- *
+ *
* @param notification
*/
@Deprecated
/**
* Deprecated. Use {@link #publish(Notification,ExecutorService)}.
- *
+ *
* @param notification
*/
@Deprecated
/**
* Publishes a notification.
- *
+ *
* @param Notification
* notification to publish.
- *
+ *
*/
@Override
void publish(Notification notification);
/**
* Publishes a notification, listener calls are done in provided executor.
- *
+ *
*/
@Override
void publish(Notification notification, ExecutorService service);
*/
package org.opendaylight.controller.sal.binding.api;
-import org.opendaylight.controller.md.sal.common.api.notify.NotificationSubscriptionService;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.concepts.Registration;
import org.opendaylight.yangtools.yang.binding.Notification;
public interface NotificationService extends BindingAwareService {
/**
- *
+ *
* Deprecated: use {@link #addNotificationListener(Class, NotificationListener)} istead.
- *
+ *
* @param listener
*/
@Deprecated
<T extends Notification> void addNotificationListener(Class<T> notificationType, NotificationListener<T> listener);
/**
- *
+ *
* Deprecated: use {@link #addNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener)} istead.
- *
+ *
* @param listener
*/
@Deprecated
@Deprecated
<T extends Notification> void removeNotificationListener(Class<T> notificationType, NotificationListener<T> listener);
-
+
/**
* Register a generic listener for specified notification type only.
- *
+ *
* @param notificationType
* @param listener
* @return Registration for listener. To unregister listener invoke {@link Registration#close()} method.
* Register a listener which implements generated notification interfaces derived from
* {@link org.opendaylight.yangtools.yang.binding.NotificationListener}.
* Listener is registered for all notifications present in implemented interfaces.
- *
+ *
* @param listener
* @return Registration for listener. To unregister listener invoke {@link Registration#close()} method.
*/
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
import org.opendaylight.controller.sal.binding.api.rpc.RpcContextIdentifier;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.RpcService;
/**
* Interface defining provider's access to the Rpc Registry which could be used
* to register their implementations of service to the MD-SAL.
- *
+ *
* @author ttkacik
- *
+ *
*/
public interface RpcProviderRegistry extends //
RpcConsumerRegistry, //
RouteChangePublisher<RpcContextIdentifier, InstanceIdentifier<?>> {
/**
* Registers an global RpcService implementation.
- *
+ *
* @param type
* @param implementation
* @return
throws IllegalStateException;
/**
- *
+ *
* Register an Routed RpcService where routing is determined on annotated
* (in YANG model) context-reference and value of annotated leaf.
- *
+ *
* @param type
* Type of RpcService, use generated interface class, not your
* implementation clas
* Implementation of RpcService
* @return Registration object for routed Rpc which could be used to close
* an
- *
+ *
* @throws IllegalStateException
*/
<T extends RpcService> RoutedRpcRegistration<T> addRoutedRpcImplementation(Class<T> type, T implementation)
import java.util.concurrent.Future;
import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
+import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler;
import org.opendaylight.controller.md.sal.common.api.data.DataModification;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.concepts.Registration;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.RpcResult;
/**
* Returns an unique identifier for transaction
- *
+ *
*/
@Override
public Object getIdentifier();
-
+
/**
* Initiates a two-phase commit of candidate data.
- *
+ *
* <p>
* The {@link Consumer} could initiate a commit of candidate data
- *
+ *
* <p>
* The successful commit changes the state of the system and may affect
* several components.
- *
+ *
* <p>
* The effects of successful commit of data are described in the
* specifications and YANG models describing the {@link Provider} components
* of controller. It is assumed that {@link Consumer} has an understanding
* of this changes.
- *
- *
+ *
+ *
* @see DataCommitHandler for further information how two-phase commit is
* processed.
* @param store
*/
@Override
public Future<RpcResult<TransactionStatus>> commit();
-
-
-
+
+
+
/**
* Register a listener for transaction
- *
+ *
* @param listener
* @return
*/
/**
* Listener for transaction state changes
- *
+ *
*
*/
public interface DataTransactionListener extends EventListener {
/**
* Callback is invoked after each transaction status change.
- *
+ *
* @param transaction Transaction
* @param status New status
*/
import org.opendaylight.controller.md.sal.common.api.data.DataProvisionService;
import org.opendaylight.controller.md.sal.common.api.data.DataReader;
import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
-import org.opendaylight.controller.sal.common.DataStoreIdentifier;
import org.opendaylight.yangtools.concepts.Registration;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
*/
public interface DataProviderService extends DataBrokerService, DataProvisionService<InstanceIdentifier<? extends DataObject>, DataObject> {
-
+
/**
* Registers a data reader for particular subtree of overal YANG data tree.
- *
- * Registered data reader is called if anyone tries to read data from
+ *
+ * Registered data reader is called if anyone tries to read data from
* paths which are nested to provided path.
- *
+ *
* @param path Subpath which is handled by registered data reader
- * @param reader Instance of reader which
+ * @param reader Instance of reader which
* @return Registration object for reader. Invoking {@link Registration#close()} will unregister reader.
*/
Registration<DataReader<InstanceIdentifier<? extends DataObject>,DataObject>> registerDataReader(InstanceIdentifier<? extends DataObject> path,DataReader<InstanceIdentifier<? extends DataObject>,DataObject> reader);
package org.opendaylight.controller.sal.binding.api.data;
import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
-import org.opendaylight.controller.sal.binding.api.BindingAwareProvider.ProviderFunctionality;
/**
* Trigger for refreshing of the data exposed by the {@link Provider}
- *
- *
- *
+ *
+ *
+ *
*/
public interface DataRefresher extends BindingAwareProvider.ProviderFunctionality {
/**
* Fired when some component explicitly requested the data refresh.
- *
+ *
* The provider which exposed the {@link DataRefresher} should republish its
* provided data by editing the data in all affected data stores.
*/
*/
package org.opendaylight.controller.sal.binding.api.data;
-import java.util.Set;
-
import org.opendaylight.controller.md.sal.common.api.data.DataReader;
import org.opendaylight.controller.sal.binding.api.BindingAwareProvider.ProviderFunctionality;
-import org.opendaylight.controller.sal.common.DataStoreIdentifier;
import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.DataRoot;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
/**
- * Utility interface which does type capture for BindingAware DataReader.
- *
- * @author
+ * Utility interface which does type capture for BindingAware DataReader.
+ *
+ * @author
*
*/
public interface RuntimeDataProvider extends ProviderFunctionality,DataReader<InstanceIdentifier<? extends DataObject>, DataObject> {
-
-
+
+
}
import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
import org.opendaylight.yangtools.concepts.Identifiable;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.RpcService;
public interface MountInstance //
extends //
import java.util.EventListener;
-import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.concepts.Registration;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
/**
* Provider MountProviderService, this version allows access to MD-SAL services
* specific for this mountpoint and registration / provision of interfaces for
* mount point.
- *
+ *
* @author ttkacik
- *
+ *
*/
public interface MountProviderService extends MountService {
-
+
@Override
public MountProviderInstance getMountPoint(InstanceIdentifier<?> path);
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
import org.opendaylight.yangtools.yang.binding.BaseIdentity;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.RpcImplementation;
import org.opendaylight.yangtools.yang.binding.RpcService;
/**
* RpcRouter is responsible for selecting RpcService based on provided routing
* context identifier {@link RpcRoutingTable#getContextIdentifier()} and path in
* overal data tree (@link {@link InstanceIdentifier}.
- *
- *
+ *
+ *
* @author Tony Tkacik <ttkacik@cisco.com>
- *
+ *
* @param <T>
* Type of RpcService for which router provides routing information
* and route selection.
/**
* Returns a type of RpcService which is served by this instance of router.
- *
+ *
* @return type of RpcService which is served by this instance of router.
*/
Class<T> getServiceType();
-
-
+
+
/**
* Returns a instance of T which is associated with this router instance
* and routes messages based on routing tables.
- *
+ *
* @return type of RpcService which is served by this instance of router.
*/
T getInvocationProxy();
/**
* Returns a routing table for particular route context
- *
+ *
* @param routeContext
* @return Routing Table for particular route context.
*/
/**
* Returns an instance of RpcService which is responsible for processing
* particular path.
- *
+ *
* @param context
* Rpc Routing Context
* @param path
/**
* Returns a default fallback instance of RpcService which is responsible
* for handling all unknown imports.
- *
+ *
* @return default instance responsible for processing RPCs.
*/
T getDefaultService();
Set<Class<? extends BaseIdentity>> getContexts();
-
+
RoutedRpcRegistration<T> addRoutedRpcImplementation(T service);
-
+
RpcRegistration<T> registerDefaultService(T service);
}
import org.opendaylight.controller.sal.binding.impl.forward.DomForwardingUtils;\r
import org.osgi.framework.BundleContext;\r
\r
-import com.google.common.util.concurrent.MoreExecutors;\r
-\r
/**\r
*\r
*/\r
*/
package org.opendaylight.controller.config.yang.md.sal.binding.impl;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-
import org.opendaylight.controller.sal.binding.codegen.impl.SingletonHolder;
import org.opendaylight.controller.sal.binding.impl.NotificationBrokerImpl;
import com.google.common.util.concurrent.ListeningExecutorService;
-import com.google.common.util.concurrent.MoreExecutors;
/**
*
import java.util.Map.Entry;
import java.util.Set;
-import javassist.ClassPool;
-
import org.opendaylight.controller.sal.binding.codegen.impl.SingletonHolder;
import org.opendaylight.yangtools.concepts.Delegator;
import org.opendaylight.yangtools.sal.binding.generator.impl.RuntimeGeneratedMappingServiceImpl;
this.delegate = Preconditions.checkNotNull(delegate);
}
+ @Override
public CodecRegistry getCodecRegistry() {
return delegate.getCodecRegistry();
}
+ @Override
public CompositeNode toDataDom(DataObject data) {
return delegate.toDataDom(data);
}
+ @Override
public Entry<InstanceIdentifier, CompositeNode> toDataDom(
Entry<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<? extends DataObject>, DataObject> entry) {
return delegate.toDataDom(entry);
}
+ @Override
public InstanceIdentifier toDataDom(
org.opendaylight.yangtools.yang.binding.InstanceIdentifier<? extends DataObject> path) {
return delegate.toDataDom(path);
}
+ @Override
public DataObject dataObjectFromDataDom(
org.opendaylight.yangtools.yang.binding.InstanceIdentifier<? extends DataObject> path,
CompositeNode result) throws DeserializationException {
return delegate.dataObjectFromDataDom(path, result);
}
+ @Override
public org.opendaylight.yangtools.yang.binding.InstanceIdentifier<?> fromDataDom(InstanceIdentifier entry)
throws DeserializationException {
return delegate.fromDataDom(entry);
}
+ @Override
public Set<QName> getRpcQNamesFor(Class<? extends RpcService> service) {
return delegate.getRpcQNamesFor(service);
}
+ @Override
public DataContainer dataObjectFromDataDom(Class<? extends DataContainer> inputClass, CompositeNode domInput) {
return delegate.dataObjectFromDataDom(inputClass, domInput);
}
*/
package org.opendaylight.controller.sal.binding.codegen.impl;
-import org.opendaylight.yangtools.yang.binding.RpcService;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
-import org.opendaylight.controller.sal.binding.api.rpc.RpcRouter;
-import org.opendaylight.controller.sal.binding.api.rpc.RpcRoutingTable;
-import org.opendaylight.controller.sal.binding.codegen.RuntimeCodeHelper;
-import org.opendaylight.yangtools.yang.binding.BaseIdentity;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-import static org.opendaylight.controller.sal.binding.codegen.RuntimeCodeHelper.*;
+import static org.opendaylight.controller.sal.binding.codegen.RuntimeCodeHelper.setRoutingTable;
+import java.util.HashMap;
import java.util.Map;
import java.util.Set;
-import java.util.HashMap;
-import org.opendaylight.yangtools.yang.binding.DataContainer;
-import org.opendaylight.yangtools.yang.binding.RpcImplementation;
-import org.opendaylight.controller.md.sal.common.api.routing.MutableRoutingTable;
import org.opendaylight.controller.md.sal.common.api.routing.RouteChange;
import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
+import org.opendaylight.controller.sal.binding.api.rpc.RpcRouter;
+import org.opendaylight.controller.sal.binding.api.rpc.RpcRoutingTable;
+import org.opendaylight.controller.sal.binding.codegen.RuntimeCodeHelper;
import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.concepts.util.ListenerRegistry;
+import org.opendaylight.yangtools.yang.binding.BaseIdentity;
+import org.opendaylight.yangtools.yang.binding.DataContainer;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.RpcService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Map<Class<? extends BaseIdentity>, RpcRoutingTableImpl<? extends BaseIdentity, T>> mutableRoutingTables = new HashMap<>();
for (Class<? extends BaseIdentity> ctx : contexts) {
RpcRoutingTableImpl<? extends BaseIdentity, T> table = new RpcRoutingTableImpl<>(name,ctx,type);
-
+
@SuppressWarnings("rawtypes")
Map invokerView = table.getRoutes();
-
- setRoutingTable((RpcService) invocationProxy, ctx, invokerView);
+
+ setRoutingTable(invocationProxy, ctx, invokerView);
mutableRoutingTables.put(ctx, table);
table.registerRouteChangeListener(this);
}
*/
package org.opendaylight.controller.sal.binding.codegen.impl;
-import org.opendaylight.controller.sal.binding.api.rpc.RpcRoutingTable;
-import org.opendaylight.yangtools.yang.binding.BaseIdentity;
-import org.opendaylight.yangtools.yang.binding.RpcService;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
import java.util.Collections;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.controller.md.sal.common.api.routing.RouteChangePublisher;
import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener;
+import org.opendaylight.controller.md.sal.common.api.routing.RouteChangePublisher;
import org.opendaylight.controller.md.sal.common.impl.routing.RoutingUtils;
+import org.opendaylight.controller.sal.binding.api.rpc.RpcRoutingTable;
import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
-import org.opendaylight.yangtools.concepts.Identifiable;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.concepts.Mutable;
+import org.opendaylight.yangtools.yang.binding.BaseIdentity;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.RpcService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private RouteChangeListener<Class<? extends BaseIdentity>, InstanceIdentifier<?>> listener;
private S defaultRoute;
-
+
public RpcRoutingTableImpl(String routerName,Class<C> contextType, Class<S> serviceType) {
super();
this.routerName = routerName;
@Override
public <L extends RouteChangeListener<Class<? extends BaseIdentity>, InstanceIdentifier<?>>> ListenerRegistration<L> registerRouteChangeListener(
L listener) {
- return (ListenerRegistration<L>) new SingletonListenerRegistration<L>(listener);
+ return new SingletonListenerRegistration<L>(listener);
}
-
+
@Override
public Class<C> getIdentifier() {
return contextType;
@SuppressWarnings("unchecked")
public void updateRoute(InstanceIdentifier<?> path, S service) {
S previous = this.routes.put(path, service);
-
+
LOGGER.debug("Route {} updated to {} in routing table {}",path,service,this);
@SuppressWarnings("rawtypes")
RouteChangeListener listenerCapture = listener;
}
}
-
+
@Override
@SuppressWarnings("unchecked")
public void removeRoute(InstanceIdentifier<?> path) {
listenerCapture.onRouteChange(RoutingUtils.removalChange(contextType, path));
}
}
-
+
public void removeRoute(InstanceIdentifier<?> path, S service) {
@SuppressWarnings("rawtypes")
RouteChangeListener listenerCapture = listener;
public Map<InstanceIdentifier<?>, S> getRoutes() {
return unmodifiableRoutes;
}
-
+
protected void removeAllReferences(S service) {
-
+
}
-
-
+
+
@Override
public String toString() {
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ThreadFactory;
+import javassist.ClassPool;
+
import org.opendaylight.controller.sal.binding.codegen.RuntimeCodeGenerator;
import org.opendaylight.controller.sal.binding.spi.NotificationInvokerFactory;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
-import javassist.ClassPool;
-
public class SingletonHolder {
public static final ClassPool CLASS_POOL = new ClassPool();
package org.opendaylight.controller.sal.binding.impl;\r
\r
import java.util.Set;
-import java.util.concurrent.Future;\r
-import java.util.concurrent.atomic.AtomicLong;\r
-\r
-import org.opendaylight.controller.md.sal.common.impl.service.AbstractDataBroker;\r
-import org.opendaylight.controller.sal.binding.api.data.DataChangeListener;\r
-import org.opendaylight.controller.sal.binding.api.data.DataProviderService;\r
-import org.opendaylight.controller.sal.binding.impl.util.BindingAwareDataReaderRouter;\r
-import org.opendaylight.controller.sal.common.DataStoreIdentifier;\r
-import org.opendaylight.yangtools.yang.binding.DataObject;\r
-import org.opendaylight.yangtools.yang.binding.DataRoot;\r
-import org.opendaylight.yangtools.yang.binding.Identifiable;\r
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;\r
-import org.opendaylight.yangtools.yang.common.RpcResult;\r
+import java.util.concurrent.Future;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.opendaylight.controller.md.sal.common.impl.service.AbstractDataBroker;
+import org.opendaylight.controller.sal.binding.api.data.DataChangeListener;
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
+import org.opendaylight.controller.sal.binding.impl.util.BindingAwareDataReaderRouter;
+import org.opendaylight.controller.sal.common.DataStoreIdentifier;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.DataRoot;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.RpcResult;
\r
\r
public class DataBrokerImpl extends AbstractDataBroker<InstanceIdentifier<? extends DataObject>, DataObject, DataChangeListener> //\r
\r
private final AtomicLong nextTransaction = new AtomicLong();\r
private final AtomicLong createdTransactionsCount = new AtomicLong();\r
- \r
+\r
public AtomicLong getCreatedTransactionsCount() {\r
return createdTransactionsCount;\r
}\r
DataChangeListener changeListener) {\r
throw new UnsupportedOperationException("Deprecated");\r
}\r
- \r
+\r
@Override\r
public void close() throws Exception {\r
- \r
+\r
}
-
-
+
@Override
protected boolean isAffectedBy(InstanceIdentifier<? extends DataObject> key,
Set<InstanceIdentifier<? extends DataObject>> paths) {
import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
import org.opendaylight.controller.md.sal.common.impl.service.AbstractDataTransaction;
import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
-import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction.DataTransactionListener;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.concepts.util.ListenerRegistry;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-public class DataTransactionImpl extends AbstractDataTransaction<InstanceIdentifier<? extends DataObject>, DataObject>
+public class DataTransactionImpl extends AbstractDataTransaction<InstanceIdentifier<? extends DataObject>, DataObject>
implements DataModificationTransaction {
private final ListenerRegistry<DataTransactionListener> listeners = new ListenerRegistry<DataTransactionListener>();
-
-
-
+
+
+
public DataTransactionImpl(Object identifier,DataBrokerImpl dataBroker) {
super(identifier,dataBroker);
}
return listeners.register(listener);
}
+ @Override
protected void onStatusChange(TransactionStatus status) {
for (ListenerRegistration<DataTransactionListener> listenerRegistration : listeners) {
listenerRegistration.getInstance().onStatusUpdated(this, status);
*/
package org.opendaylight.controller.sal.binding.impl;
+import static com.google.common.base.Preconditions.checkState;
+
import java.util.EventListener;
+import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
-import java.util.HashMap;
import java.util.Set;
import java.util.WeakHashMap;
-import javax.swing.tree.ExpandVetoException;
-
import org.opendaylight.controller.md.sal.common.api.routing.RouteChange;
import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener;
import org.opendaylight.controller.md.sal.common.api.routing.RouteChangePublisher;
import org.opendaylight.controller.md.sal.common.impl.routing.RoutingUtils;
-import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.controller.sal.binding.api.rpc.RpcContextIdentifier;
import org.opendaylight.controller.sal.binding.api.rpc.RpcRouter;
import org.opendaylight.controller.sal.binding.codegen.RuntimeCodeGenerator;
import org.opendaylight.controller.sal.binding.codegen.RuntimeCodeHelper;
import org.opendaylight.controller.sal.binding.codegen.impl.SingletonHolder;
-import org.opendaylight.controller.sal.binding.api.rpc.RpcContextIdentifier;
import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
-import org.opendaylight.yangtools.concepts.Identifiable;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.concepts.util.ListenerRegistry;
import org.opendaylight.yangtools.yang.binding.BaseIdentity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import static com.google.common.base.Preconditions.*;
-
public class RpcProviderRegistryImpl implements //
RpcProviderRegistry, //
RouteChangePublisher<RpcContextIdentifier, InstanceIdentifier<?>> {
private final String name;
- private ListenerRegistry<GlobalRpcRegistrationListener> globalRpcListeners = ListenerRegistry.create();
+ private final ListenerRegistry<GlobalRpcRegistrationListener> globalRpcListeners = ListenerRegistry.create();
public String getName() {
return name;
potentialProxy = (T) publicProxies.get(type);
if (potentialProxy != null) {
- return (T) potentialProxy;
+ return potentialProxy;
}
T proxy = rpcFactory.getDirectProxyFor(type);
LOG.debug("Created {} as public proxy for {} in {}", proxy, type.getSimpleName(), this);
LOG.error("Unhandled exception during invoking listener {}", e);
}
}
-
+
}
private void notifyListenersRoutedCreated(RpcRouter router) {
public interface RouterInstantiationListener extends EventListener {
void onRpcRouterCreated(RpcRouter<?> router);
}
-
+
public ListenerRegistration<GlobalRpcRegistrationListener> registerGlobalRpcRegistrationListener(GlobalRpcRegistrationListener listener) {
return globalRpcListeners.register(listener);
}
public interface GlobalRpcRegistrationListener extends EventListener {
void onGlobalRpcRegistered(Class<? extends RpcService> cls);
void onGlobalRpcUnregistered(Class<? extends RpcService> cls);
-
+
}
private class RouteChangeForwarder<T extends RpcService> implements
import org.opendaylight.controller.md.sal.common.api.data.DataModification;
import org.opendaylight.yangtools.concepts.Path;
-import com.google.common.util.concurrent.JdkFutureAdapters;
-
public final class DataModificationTracker<P extends Path<P>,D> {
-
ConcurrentMap<Object, DataModification<P,D>> trackedTransactions = new ConcurrentHashMap<>();
-
-
+
public void startTrackingModification(DataModification<P,D> modification) {
trackedTransactions.putIfAbsent(modification.getIdentifier(), modification);
-
-
}
-
+
public boolean containsIdentifier(Object identifier) {
return trackedTransactions.containsKey(identifier);
}
import org.junit.After;
import org.junit.Before;
import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
-import org.opendaylight.yangtools.yang.data.impl.codec.BindingIndependentMappingService;
import org.opendaylight.controller.sal.binding.test.util.BindingBrokerTestFactory;
import org.opendaylight.controller.sal.binding.test.util.BindingTestContext;
import org.opendaylight.controller.sal.core.api.data.DataStore;
import org.opendaylight.controller.sal.dom.broker.impl.DataStoreStatsWrapper;
-import org.opendaylight.controller.sal.dom.broker.impl.HashMapDataStore;
+import org.opendaylight.yangtools.yang.data.impl.codec.BindingIndependentMappingService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
*/
package org.opendaylight.controller.sal.binding.test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import javassist.ClassPool;
import org.junit.Before;
import org.junit.Test;
-
-import static org.opendaylight.controller.sal.binding.codegen.RuntimeCodeHelper.*;
-
-import org.opendaylight.controller.sal.binding.api.NotificationListener;
import org.opendaylight.controller.sal.binding.api.rpc.RpcRouter;
import org.opendaylight.controller.sal.binding.api.rpc.RpcRoutingTable;
import org.opendaylight.controller.sal.binding.codegen.impl.RuntimeCodeGenerator;
import org.opendaylight.controller.sal.binding.spi.NotificationInvokerFactory.NotificationInvoker;
import org.opendaylight.controller.sal.binding.test.mock.BarListener;
import org.opendaylight.controller.sal.binding.test.mock.BarUpdate;
-import org.opendaylight.controller.sal.binding.test.mock.CompositeListener;
import org.opendaylight.controller.sal.binding.test.mock.FlowDelete;
import org.opendaylight.controller.sal.binding.test.mock.FooListener;
import org.opendaylight.controller.sal.binding.test.mock.FooService;
import org.opendaylight.controller.sal.binding.test.mock.FooUpdate;
-import org.opendaylight.controller.sal.binding.test.mock.InheritedContextInput;
import org.opendaylight.controller.sal.binding.test.mock.ReferencableObject;
import org.opendaylight.controller.sal.binding.test.mock.ReferencableObjectKey;
import org.opendaylight.controller.sal.binding.test.mock.SimpleInput;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.IdentifiableItem;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument;
-import static org.mockito.Mockito.*;
-
public class RuntimeCodeGeneratorTest {
private RuntimeCodeGenerator codeGenerator;
NotificationInvoker invokerFoo = invokerFactory.invokerFor(fooListener);
-
+
assertSame(fooListener,invokerFoo.getDelegate());
assertNotNull(invokerFoo.getSupportedNotifications());
assertEquals(1, invokerFoo.getSupportedNotifications().size());
import javassist.ClassPool;
-import org.opendaylight.controller.sal.core.api.data.DataStore;
-import org.opendaylight.controller.sal.dom.broker.impl.DataStoreStatsWrapper;
-import org.opendaylight.controller.sal.dom.broker.impl.HashMapDataStore;
-import org.opendaylight.controller.sal.dom.broker.impl.SchemaAwareDataStoreAdapter;
-
import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
private ExecutorService executor;
private ClassPool classPool;
-
+
public boolean isStartWithParsedSchema() {
return startWithParsedSchema;
}
if(classPool == null) {
return CLASS_POOL;
}
-
+
return classPool;
}
package org.opendaylight.controller.md.sal.binding.util;
import java.util.concurrent.Future;
-import java.util.zip.Checksum;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
import org.opendaylight.controller.sal.binding.api.NotificationListener;
import org.opendaylight.controller.sal.binding.api.NotificationService;
import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
-import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
import org.opendaylight.controller.sal.binding.api.data.DataChangeListener;
import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
-import org.opendaylight.controller.sal.binding.api.mount.MountInstance;
import org.opendaylight.controller.sal.common.DataStoreIdentifier;
-import org.opendaylight.yangtools.concepts.Identifiable;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.concepts.Registration;
import org.opendaylight.yangtools.yang.binding.DataObject;
protected final D getDataBroker() {
return dataBroker;
}
-
+
protected final R getRpcRegistryChecked() {
Preconditions.checkState(rpcRegistry != null,"Rpc Registry is not available.");
return rpcRegistry;
Preconditions.checkState(dataBroker != null, "Data Broker is not available");
return dataBroker;
}
-
+
protected AbstractBindingSalConsumerInstance(R rpcRegistry, N notificationBroker, D dataBroker) {
this.rpcRegistry = rpcRegistry;
this.dataBroker = dataBroker;
}
+ @Override
public <T extends RpcService> T getRpcService(Class<T> module) {
return getRpcRegistryChecked().getRpcService(module);
}
+ @Override
@Deprecated
public <T extends Notification> void addNotificationListener(Class<T> notificationType,
NotificationListener<T> listener) {
getNotificationBrokerChecked().addNotificationListener(notificationType, listener);
}
+ @Override
@Deprecated
public void addNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) {
getNotificationBrokerChecked().addNotificationListener(listener);
}
+ @Override
@Deprecated
public void removeNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) {
getNotificationBrokerChecked().removeNotificationListener(listener);
}
+ @Override
@Deprecated
public <T extends Notification> void removeNotificationListener(Class<T> notificationType,
NotificationListener<T> listener) {
getNotificationBrokerChecked().removeNotificationListener(notificationType, listener);
}
+ @Override
public <T extends Notification> Registration<NotificationListener<T>> registerNotificationListener(
Class<T> notificationType, NotificationListener<T> listener) {
return getNotificationBrokerChecked().registerNotificationListener(notificationType, listener);
}
+ @Override
public Registration<org.opendaylight.yangtools.yang.binding.NotificationListener> registerNotificationListener(
org.opendaylight.yangtools.yang.binding.NotificationListener listener) {
return getNotificationBrokerChecked().registerNotificationListener(listener);
}
+ @Override
@Deprecated
public <T extends DataRoot> T getData(DataStoreIdentifier store, Class<T> rootType) {
return getDataBrokerChecked().getData(store, rootType);
}
+ @Override
@Deprecated
public <T extends DataRoot> T getData(DataStoreIdentifier store, T filter) {
return getDataBrokerChecked().getData(store, filter);
}
+ @Override
@Deprecated
public <T extends DataRoot> T getCandidateData(DataStoreIdentifier store, Class<T> rootType) {
return getDataBrokerChecked().getCandidateData(store, rootType);
}
+ @Override
@Deprecated
public <T extends DataRoot> T getCandidateData(DataStoreIdentifier store, T filter) {
return getDataBrokerChecked().getCandidateData(store, filter);
}
+ @Override
@Deprecated
public RpcResult<DataRoot> editCandidateData(DataStoreIdentifier store, DataRoot changeSet) {
return getDataBrokerChecked().editCandidateData(store, changeSet);
}
+ @Override
@Deprecated
public Future<RpcResult<Void>> commit(DataStoreIdentifier store) {
return getDataBrokerChecked().commit(store);
}
+ @Override
@Deprecated
public DataObject getData(InstanceIdentifier<? extends DataObject> data) {
return getDataBrokerChecked().getData(data);
}
+ @Override
@Deprecated
public DataObject getConfigurationData(InstanceIdentifier<?> data) {
return getDataBrokerChecked().getConfigurationData(data);
}
+ @Override
public DataModificationTransaction beginTransaction() {
return getDataBrokerChecked().beginTransaction();
}
+ @Override
@Deprecated
public void registerChangeListener(InstanceIdentifier<? extends DataObject> path, DataChangeListener changeListener) {
getDataBrokerChecked().registerChangeListener(path, changeListener);
}
+ @Override
@Deprecated
public void unregisterChangeListener(InstanceIdentifier<? extends DataObject> path,
DataChangeListener changeListener) {
getDataBrokerChecked().unregisterChangeListener(path, changeListener);
}
+ @Override
@Deprecated
public DataObject readConfigurationData(InstanceIdentifier<? extends DataObject> path) {
return getDataBrokerChecked().readConfigurationData(path);
}
+ @Override
public DataObject readOperationalData(InstanceIdentifier<? extends DataObject> path) {
return getDataBrokerChecked().readOperationalData(path);
}
+ @Override
@Deprecated
public ListenerRegistration<DataChangeListener> registerDataChangeListener(
InstanceIdentifier<? extends DataObject> path, DataChangeListener listener) {
import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
-import org.opendaylight.controller.sal.binding.api.mount.MountProviderInstance;
import org.opendaylight.controller.sal.binding.api.rpc.RpcContextIdentifier;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.concepts.Registration;
L listener) {
return getRpcRegistryChecked().registerRouteChangeListener(listener);
}
-
+
@Override
public ListenerRegistration<NotificationInterestListener> registerInterestListener(
NotificationInterestListener interestListener) {
*/
package org.opendaylight.controller.md.sal.binding.util;
-import java.awt.image.SinglePixelPackedSampleModel;
+import static com.google.common.base.Preconditions.checkNotNull;
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.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
+import org.opendaylight.controller.sal.binding.api.BindingAwareConsumer;
import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
import org.opendaylight.controller.sal.binding.api.BindingAwareProvider.ProviderFunctionality;
-import org.opendaylight.controller.sal.binding.api.rpc.RpcContextIdentifier;
-import org.opendaylight.controller.sal.binding.api.BindingAwareConsumer;
import org.opendaylight.controller.sal.binding.api.BindingAwareService;
import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.controller.sal.binding.api.rpc.RpcContextIdentifier;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.RpcService;
-import static com.google.common.base.Preconditions.*;
-
import com.google.common.collect.ClassToInstanceMap;
import com.google.common.collect.MutableClassToInstanceMap;
checkNotNull(serviceProvider,"Service map should not be null");
return new SingleConsumerContextImpl(serviceProvider);
}
-
+
public static ProviderContext createProviderContext(BindingAwareProvider provider,
ClassToInstanceMap<BindingAwareService> serviceProvider) {
checkNotNull(provider,"Provider should not be null");
consumer.onSessionInitialized(context);
return context;
}
-
+
public static ProviderContext createProviderContextAndInitialize(BindingAwareProvider provider,
ClassToInstanceMap<BindingAwareService> serviceProvider) {
ProviderContext context = createProviderContext(provider, serviceProvider);
// FIXME: Create Proxy
return instance;
}
-
+
private static class SingleConsumerContextImpl implements ConsumerContext, AutoCloseable {
-
+
private ClassToInstanceMap<BindingAwareService> alreadyRetrievedServices;
private ClassToInstanceMap<BindingAwareService> serviceProvider;
public final <T extends RpcService> T getRpcService(Class<T> module) {
return getSALService(RpcConsumerRegistry.class).getRpcService(module);
}
-
+
@Override
public final <T extends BindingAwareService> T getSALService(Class<T> service) {
checkNotNull(service,"Service class should not be null.");
}
return tryToRetrieveSalService(service);
}
-
+
private synchronized <T extends BindingAwareService> T tryToRetrieveSalService(Class<T> service) {
final T potential = alreadyRetrievedServices.getInstance(service);
if(potential != null) {
alreadyRetrievedServices.put(service, retrieved);
return retrieved;
}
-
+
@Override
public final void close() throws Exception {
alreadyRetrievedServices = null;
serviceProvider = null;
}
}
-
+
private static class SingleProviderContextImpl extends SingleConsumerContextImpl implements ProviderContext {
public SingleProviderContextImpl(ClassToInstanceMap<BindingAwareService> serviceProvider) {
super(serviceProvider);
}
-
+
@Override
public <L extends RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>>> ListenerRegistration<L> registerRouteChangeListener(
L listener) {
return getSALService(RpcProviderRegistry.class).registerRouteChangeListener(listener);
}
-
+
@Override
public <T extends RpcService> RoutedRpcRegistration<T> addRoutedRpcImplementation(Class<T> type,
T implementation) throws IllegalStateException {
return getSALService(RpcProviderRegistry.class).addRoutedRpcImplementation(type, implementation);
}
-
+
@Override
public <T extends RpcService> RpcRegistration<T> addRpcImplementation(Class<T> type, T implementation)
throws IllegalStateException {
return getSALService(RpcProviderRegistry.class).addRpcImplementation(type, implementation);
}
-
+
@Deprecated
@Override
public void registerFunctionality(ProviderFunctionality functionality) {
// NOOP
}
-
+
@Deprecated
@Override
public void unregisterFunctionality(ProviderFunctionality functionality) {
import org.opendaylight.yangtools.concepts.ListenerRegistration;
+
// FIXME: After 0.6 Release of YANGTools refactor to use Path marker interface for arguments.
// import org.opendaylight.yangtools.concepts.Path;
-import org.opendaylight.yangtools.concepts.Registration;
-
public interface DataChangePublisher<P/* extends Path<P> */,D, L extends DataChangeListener<P,D>> {
ListenerRegistration<L> registerDataChangeListener(P path, L listener);
*/
package org.opendaylight.controller.md.sal.common.api.data;
-import java.util.Map;
-import java.util.Set;
import java.util.concurrent.Future;
import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
-// FIXME: After 0.6 Release of YANGTools refactor to use Path marker interface for arguments.
-// import org.opendaylight.yangtools.concepts.Path;
import org.opendaylight.yangtools.yang.common.RpcResult;
+//FIXME: After 0.6 Release of YANGTools refactor to use Path marker interface for arguments.
+//import org.opendaylight.yangtools.concepts.Path;
public interface DataModification<P/* extends Path<P> */, D> extends DataChange<P, D>, DataReader<P, D> {
/**
* Returns transaction identifier
- *
+ *
* @return Transaction identifier
*/
Object getIdentifier();
TransactionStatus getStatus();
/**
- *
+ *
* @deprecated Use {@link #putOperationalData(Object, Object)} instead.
- *
+ *
* @param path
* @param data
*/
/**
* @deprecated Use {@link #removeOperationalData(Object)}
- *
+ *
* @param path
*/
@Deprecated
/**
* Initiates a two-phase commit of modification.
- *
+ *
* <p>
* The successful commit changes the state of the system and may affect
* several components.
- *
+ *
* <p>
* The effects of successful commit of data are described in the
* specifications and YANG models describing the Provider components of
* controller. It is assumed that Consumer has an understanding of this
* changes.
- *
- *
+ *
+ *
* @see DataCommitHandler for further information how two-phase commit is
* processed.
* @param store
*/
package org.opendaylight.controller.md.sal.common.impl;
+import static com.google.common.base.Preconditions.checkNotNull;
+
import java.util.Collections;
import java.util.EventListener;
import java.util.HashSet;
import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-import static com.google.common.base.Preconditions.*;
import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
return unmodifiableView;
}
-
+
public ListenerRegistration<T> register(T listener) {
checkNotNull(listener, "Listener should not be null.");
ListenerRegistrationImpl<T> ret = new ListenerRegistrationImpl<T>(listener);
listeners.add(ret);
return ret;
}
-
-
+
+
@SuppressWarnings("rawtypes")
private void remove(ListenerRegistrationImpl registration) {
listeners.remove(registration);
package org.opendaylight.controller.md.sal.common.impl.util;
import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReadWriteLock;
-import java.util.concurrent.locks.ReentrantLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
private final ReentrantReadWriteLock delegateLock = new ReentrantReadWriteLock();
private final ReadLock delegateReadLock = delegateLock.readLock();
private final WriteLock delegateWriteLock = delegateLock.writeLock();
-
-
+
+
protected Lock getDelegateReadLock() {
return delegateReadLock;
}
}
/**
- *
+ *
* @param newDelegate
* @return oldDelegate
*/
delegateWriteLock.unlock();
}
}
-
-
+
+
protected void onDelegateChanged(T oldDelegate, T newDelegate) {
// NOOP in abstract calss;
}
package org.opendaylight.controller.sal.common.util;
import java.io.Serializable;
-import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import org.opendaylight.yangtools.concepts.Immutable;
import org.opendaylight.yangtools.yang.common.RpcError;
import com.google.common.collect.ImmutableList;
public class Rpcs {
-
+
public static <T> RpcResult<T> getRpcResult(boolean successful) {
RpcResult<T> ret = new RpcResultTO<T>(successful, null, ImmutableList.<RpcError>of());
return ret;
}
-
+
public static <T> RpcResult<T> getRpcResult(boolean successful, T result,
Collection<RpcError> errors) {
RpcResult<T> ret = new RpcResultTO<T>(successful, result, errors);
public static <T> RpcResult<T> getRpcResult(boolean successful, Collection<RpcError> errors) {
return new RpcResultTO<T>(successful, null, errors);
}
-
+
private static class RpcResultTO<T> implements RpcResult<T>, Serializable, Immutable {
private final Collection<RpcError> errors;
import java.util.Collection;
import java.util.Collections;
-import javax.naming.Context;
-
-import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
broker.registerProvider(this, context);
return broker;
}
-
+
return null;
}
-
+
@Override
public void modifiedService(ServiceReference<Broker> reference, Broker service) {
// NOOP
}
-
+
@Override
public void removedService(ServiceReference<Broker> reference, Broker service) {
stopImpl(context);
}
-
+
}
package org.opendaylight.controller.sal.core.api.data;
import java.util.EventListener;
-import java.util.Map;
-import java.util.Set;
import java.util.concurrent.Future;
import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
/**
* Returns transaction identifier
- *
+ *
* @return Transaction identifier
*/
+ @Override
Object getIdentifier();
-
+
+ @Override
TransactionStatus getStatus();
-
+
/**
* Commits transaction to be stored in global data repository.
- *
- *
- * @return Future object which returns RpcResult with TransactionStatus
+ *
+ *
+ * @return Future object which returns RpcResult with TransactionStatus
* when transaction is processed by store.
*/
+ @Override
Future<RpcResult<TransactionStatus>> commit();
-
+
ListenerRegistration<DataTransactionListener> registerListener(DataTransactionListener listener);
-
-
+
public interface DataTransactionListener extends EventListener {
-
void onStatusUpdated(DataModificationTransaction transaction,TransactionStatus status);
-
}
-
-
-
}
import org.opendaylight.controller.sal.core.api.RpcProvisionRegistry;
import org.opendaylight.controller.sal.core.api.data.DataProviderService;
import org.opendaylight.controller.sal.core.api.notify.NotificationPublishService;
-import com.google.common.base.Optional;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
public interface MountProvisionInstance extends //
import java.util.Collection;
import java.util.Collections;
-import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
-import org.opendaylight.controller.sal.core.api.BrokerService;
import org.opendaylight.controller.sal.core.api.Broker.ConsumerSession;
import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
+import org.opendaylight.controller.sal.core.api.BrokerService;
import org.opendaylight.controller.sal.core.api.Consumer.ConsumerFunctionality;
import org.opendaylight.controller.sal.core.api.Provider.ProviderFunctionality;
import org.opendaylight.controller.sal.core.api.notify.NotificationListener;
private static Logger log = LoggerFactory
.getLogger(NotificationModule.class);
- private Multimap<QName, NotificationListener> listeners = HashMultimap
+ private final Multimap<QName, NotificationListener> listeners = HashMultimap
.create();
private static final Set<Class<? extends BrokerService>> PROVIDED_SERVICE_TYPE = ImmutableSet
private class NotificationConsumerSessionImpl implements
NotificationService {
- private Multimap<QName, NotificationListener> consumerListeners = HashMultimap
+ private final Multimap<QName, NotificationListener> consumerListeners = HashMultimap
.create();
private boolean closed = false;
+ @Override
public Registration<NotificationListener> addNotificationListener(QName notification,
NotificationListener listener) {
checkSessionState();
package org.opendaylight.controller.sal.dom.broker.impl;
import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import org.opendaylight.controller.sal.core.api.BrokerService;
-import org.opendaylight.controller.sal.core.api.Broker.ConsumerSession;
-import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
-import org.opendaylight.controller.sal.core.api.Consumer.ConsumerFunctionality;
-import org.opendaylight.controller.sal.core.api.Provider.ProviderFunctionality;
import org.opendaylight.controller.sal.core.api.notify.NotificationListener;
-import org.opendaylight.controller.sal.core.api.notify.NotificationPublishService;
-import org.opendaylight.controller.sal.core.api.notify.NotificationService;
-import org.opendaylight.controller.sal.core.spi.BrokerModule;
import org.opendaylight.controller.sal.dom.broker.spi.NotificationRouter;
import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
import org.opendaylight.yangtools.concepts.Registration;
import org.slf4j.LoggerFactory;
import com.google.common.collect.HashMultimap;
-import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Multimap;
import com.google.common.collect.Multimaps;
public class NotificationRouterImpl implements NotificationRouter {
private static Logger log = LoggerFactory.getLogger(NotificationRouterImpl.class);
- private Multimap<QName, Registration<NotificationListener>> listeners = Multimaps.synchronizedSetMultimap(HashMultimap.<QName, Registration<NotificationListener>>create());
+ private final Multimap<QName, Registration<NotificationListener>> listeners = Multimaps.synchronizedSetMultimap(HashMultimap.<QName, Registration<NotificationListener>>create());
// private Registration<NotificationListener> defaultListener;
-
+
private void sendNotification(CompositeNode notification) {
final QName type = notification.getNodeType();
final Collection<Registration<NotificationListener>> toNotify = listeners.get(type);
public void publish(CompositeNode notification) {
sendNotification(notification);
}
-
+
@Override
public Registration<NotificationListener> addNotificationListener(QName notification, NotificationListener listener) {
ListenerRegistration ret = new ListenerRegistration(notification, listener);
*/
package org.opendaylight.controller.sal.dom.broker.osgi;
-import org.opendaylight.controller.sal.core.api.data.DataBrokerService;
import org.opendaylight.controller.sal.core.api.mount.MountProvisionInstance;
import org.opendaylight.controller.sal.core.api.mount.MountProvisionService;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
public class MountProviderServiceProxy extends AbstractBrokerServiceProxy<MountProvisionService> implements MountProvisionService{
-
+
public MountProviderServiceProxy(ServiceReference<MountProvisionService> ref, MountProvisionService delegate) {
super(ref, delegate);
}
+ @Override
public MountProvisionInstance getMountPoint(InstanceIdentifier path) {
return getDelegate().getMountPoint(path);
}
+ @Override
public MountProvisionInstance createMountPoint(InstanceIdentifier path) {
return getDelegate().createMountPoint(path);
}
+ @Override
public MountProvisionInstance createOrGetMountPoint(InstanceIdentifier path) {
return getDelegate().createOrGetMountPoint(path);
}
-
+
@Override
public ListenerRegistration<MountProvisionListener> registerProvisionListener(MountProvisionListener listener) {
return getDelegate().registerProvisionListener(listener);
import java.util.Set;
-import org.opendaylight.controller.sal.core.api.RpcImplementation;
-import org.opendaylight.controller.sal.core.api.RpcProvisionRegistry;
import org.opendaylight.controller.sal.core.api.Broker.RoutedRpcRegistration;
import org.opendaylight.controller.sal.core.api.Broker.RpcRegistration;
-import org.opendaylight.controller.sal.core.api.RpcRegistrationListener;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.controller.sal.core.api.RpcImplementation;
+import org.opendaylight.controller.sal.core.api.RpcProvisionRegistry;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
@Override
public RoutedRpcRegistration addRoutedRpcImplementation(QName rpcType, RpcImplementation implementation);
-
+
@Override
public RpcRegistration addRpcImplementation(QName rpcType, RpcImplementation implementation)
throws IllegalArgumentException;
-
+
@Override
public Set<QName> getSupportedRpcs();
-
+
@Override
public RpcResult<CompositeNode> invokeRpc(QName rpc, CompositeNode input);
}