<dependency>
<groupId>org.opendaylight.yangtools.model</groupId>
<artifactId>opendaylight-l2-types</artifactId>
- <version>2013.08.27-SNAPSHOT</version>
+ <version>2013.08.27.0</version>
</dependency>
</dependencies>
<packaging>bundle</packaging>
}
@Deprecated
- abstract protected void startImpl(BundleContext context);
+ protected void startImpl(BundleContext context) {
+
+ }
@Override
public final void stop(BundleContext context) throws Exception {
package org.opendaylight.controller.sal.binding.api;
+import java.util.Collection;
+
+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 final void start(BundleContext context) throws Exception {
ServiceReference<BindingAwareBroker> brokerRef = context.getServiceReference(BindingAwareBroker.class);
BindingAwareBroker broker = context.getService(brokerRef);
- broker.registerProvider(this, context);
+
+ ProviderContext ctx = broker.registerProvider(this, context);
+ registerRpcImplementations(ctx);
+ registerFunctionality(ctx);
+
startImpl(context);
}
- @Deprecated
- abstract protected void startImpl(BundleContext context);
+ private void registerFunctionality(ProviderContext ctx) {
+ Collection<? extends ProviderFunctionality> functionality = this.getFunctionality();
+ if(functionality == null || functionality.isEmpty()) {
+ return;
+ }
+ for (ProviderFunctionality providerFunctionality : functionality) {
+ ctx.registerFunctionality(providerFunctionality);
+ }
+
+ }
+
+ private void registerRpcImplementations(ProviderContext ctx) {
+ Collection<? extends RpcService> rpcs = this.getImplementations();
+ if(rpcs == null || rpcs.isEmpty()) {
+ return;
+ }
+ for (RpcService rpcService : rpcs) {
+ //ctx.addRpcImplementation(type, implementation);
+ }
+
+ }
+
+ protected void startImpl(BundleContext context) {
+ // NOOP
+ }
@Override
public final void stop(BundleContext context) throws Exception {
}
+
+ @Override
+ public Collection<? extends ProviderFunctionality> getFunctionality() {
+ return null;
+ }
+
+ @Override
+ public Collection<? extends RpcService> getImplementations() {
+ return null;
+ }
}
*/
package org.opendaylight.controller.sal.binding.api;
+import org.opendaylight.controller.sal.binding.api.BindingAwareProvider.ProviderFunctionality;
import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
+import org.opendaylight.yangtools.yang.binding.BaseIdentity;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.RpcService;
import org.osgi.framework.BundleContext;
*
*/
public interface ProviderContext extends ConsumerContext {
+ /**
+ * Registers an global RpcService implementation.
+ *
+ * @param type
+ * @param implementation
+ * @return
+ */
+ <T extends RpcService> RpcRegistration<T> addRpcImplementation(Class<T> type, T implementation)
+ throws IllegalStateException;
- <T extends RpcService> RpcServiceRegistration<T> addRpcImplementation(Class<T> type, T implementation);
+ <T extends RpcService> RpcRegistration<T> addMountRpcImplementation(Class<T> type,
+ InstanceIdentifier mount, T implementation) throws IllegalStateException;
+
+ <T extends RpcService> RoutedRpcRegistration<T> addRoutedRpcImplementation(Class<T> type, T implementation)
+ throws IllegalStateException;
+
+ void registerFunctionality(ProviderFunctionality functionality);
+ void unregisterFunctionality(ProviderFunctionality functionality);
}
- public interface RpcServiceRegistration<T extends RpcService> {
+ public interface RpcRegistration<T extends RpcService> {
+ /**
+ *
+ * @return instance for which registration does exists.
+ */
T getService();
+ /**
+ * Unregister an RpcService from broker.
+ *
+ */
void unregister();
}
+
+ public interface RoutedRpcRegistration<T extends RpcService> extends RpcRegistration<T> {
+
+ /**
+ * Register particular instance identifier to be processed by this
+ * RpcService
+ *
+ * @param context
+ * @param instance
+ */
+ void registerInstance(Class<? extends BaseIdentity> context, InstanceIdentifier instance);
+
+ void unregisterInstance(Class<? extends BaseIdentity> context, InstanceIdentifier instance);
+ }
}
*/
package org.opendaylight.controller.sal.binding.api;
+import java.util.concurrent.ExecutorService;
+
import org.opendaylight.yangtools.yang.binding.Notification;
public interface NotificationProviderService extends NotificationService {
void notify(Notification notification);
+
+ void notify(Notification notification, ExecutorService service);
}
public interface NotificationService extends BindingAwareService {
<T extends Notification> void addNotificationListener(Class<T> notificationType, NotificationListener<T> listener);
-
+ void addNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener);
+ void removeNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener);
<T extends Notification> void removeNotificationListener(Class<T> notificationType, NotificationListener<T> listener);
}
import org.opendaylight.controller.sal.binding.api.BindingAwareService;
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;
/**
* Data tree filter similar to the NETCONF filter
* @return
*/
+ @Deprecated
<T extends DataRoot> T getData(DataStoreIdentifier store, T filter);
/**
* Identifier of the store, from which will be data retrieved
* @return
*/
+ @Deprecated
<T extends DataRoot> T getCandidateData(DataStoreIdentifier store, Class<T> rootType);
/**
* A filter data root
* @return
*/
+ @Deprecated
<T extends DataRoot> T getCandidateData(DataStoreIdentifier store, T filter);
/**
* @return Result object containing the modified data tree if the operation
* was successful, otherwise list of the encountered errors.
*/
+ @Deprecated
RpcResult<DataRoot> editCandidateData(DataStoreIdentifier store, DataRoot changeSet);
/**
* @return Result of the commit, containing success information or list of
* encountered errors, if commit was not successful.
*/
+ @Deprecated
Future<RpcResult<Void>> commit(DataStoreIdentifier store);
+
+
+ DataObject getData(InstanceIdentifier data);
+ DataObject getConfigurationData(InstanceIdentifier data);
+
+ /**
+ * Creates a data modification transaction.
+ *
+ * @return new blank data modification transaction.
+ */
+ DataModification beginTransaction();
}
* <li>For each <code>CommitTransaction</code> from Commit Request phase
* <ol>
* <li><code>Broker</code>
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
* broker invokes a {@link CommitTransaction#finish()}
* <li>The provider rollbacks a commit and returns an {@link RpcResult} of
* rollback. </ol>
*/
DataStoreIdentifier getDataStore();
+ /**
+ * Returns a modification transaction which is the source of this
+ * commit transaction.
+ *
+ */
+ DataModification getModification();
+
/**
* Returns the handler associated with this transaction.
*
--- /dev/null
+package org.opendaylight.controller.sal.binding.api.data;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.Future;
+
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.Identifiable;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+
+public interface DataModification {
+
+ /**
+ * Returns transaction identifier
+ *
+ * @return Transaction identifier
+ */
+ Object getIdentifier();
+
+ TransactionStatus getStatus();
+
+ /**
+ * Reads data from overal data storage which includes
+ * runtime and configuration data.
+ *
+ * @param path
+ * @return
+ */
+ DataObject read(InstanceIdentifier path);
+
+ /**
+ * Reads data from configuration data storage.
+ *
+ * @param path Instance identifier which
+ * @return
+ */
+ DataObject readConfiguration(InstanceIdentifier path);
+
+ void putRuntimeData(InstanceIdentifier path,DataObject data);
+ void putConfigurationData(InstanceIdentifier path,DataObject data);
+ void removeRuntimeData(InstanceIdentifier path);
+ void removeConfigurationData(InstanceIdentifier path);
+
+
+ Map<InstanceIdentifier,DataObject> getRuntimeDataUpdates();
+ Map<InstanceIdentifier,DataObject> getConfigurationDataUpdates();
+ Set<InstanceIdentifier> getRemovals();
+ Set<InstanceIdentifier> getConfigurationRemovals();
+
+ /**
+ * Commits transaction to be stored in global data repository.
+ *
+ *
+ * @return Future object which returns RpcResult with TransactionStatus
+ * when transaction is processed by store.
+ */
+ Future<RpcResult<TransactionStatus>> commit();
+
+ void registerListener(DataTransactionListener listener);
+ void unregisterListener(DataTransactionListener listener);
+
+ public enum TransactionStatus {
+
+ UNSUBMITTED,
+ COMMITING,
+ COMMITED,
+ FAILED,
+ CANCELED
+ }
+
+ public interface DataTransactionListener {
+
+ void onStatusUpdated(DataModification transaction,TransactionStatus status);
+
+ }
+}
*/
package org.opendaylight.controller.sal.binding.api.data;
+import java.util.Map;
+import java.util.Set;
+
import org.opendaylight.controller.sal.common.DataStoreIdentifier;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
public interface DataProviderService extends DataBrokerService {
* @param refresher
*/
void removeRefresher(DataStoreIdentifier store, DataRefresher refresher);
-
}
import java.util.Set;
+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;
-public interface RuntimeDataProvider {
+public interface RuntimeDataProvider extends ProviderFunctionality {
Set<DataStoreIdentifier> getSupportedStores();
* @return
*/
<T extends DataRoot> T getData(DataStoreIdentifier store, T filter);
+
+
+ <T extends DataObject> T getData(Class<T> dataType, InstanceIdentifier identifier);
}
--- /dev/null
+package org.opendaylight.controller.sal.binding.codegen;
+
+import org.opendaylight.controller.sal.binding.spi.DelegateProxy;
+import org.opendaylight.controller.sal.binding.spi.RpcRouter;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.RpcService;
+import org.opendaylight.yangtools.yang.binding.annotations.RoutingContext;
+
+public interface RuntimeCodeGenerator {
+
+ /**
+ * Returns an instance of provided RpcService type which delegates all calls
+ * to the delegate.
+ *
+ * <p>
+ * Returned instance:
+ * <ul>
+ * <li>implements provided subclass of RpcService type and
+ * {@link DelegateProxy} interface.
+ * <li>
+ * <p>
+ * delegates all invocations of methods, which are defined in RpcService
+ * subtype to delegate which is defined by
+ * {@link DelegateProxy#setDelegate(Object)}.
+ * <p>
+ * If delegate is not defined (<code>getDelegate() == null</code>)
+ * implementation throws {@link IllegalStateException}
+ * <li>{@link DelegateProxy#getDelegate()} - returns the delegate to which
+ * all calls are delegated.
+ * <li>{@link DelegateProxy#setDelegate(Object)} - sets the delegate for
+ * particular instance
+ *
+ * </ul>
+ *
+ * @param serviceType
+ * - Subclass of RpcService for which direct proxy is to be
+ * generated.
+ * @return Instance of RpcService of provided serviceType which implements
+ * and {@link DelegateProxy}
+ * @throws IllegalArgumentException
+ *
+ */
+ <T extends RpcService> T getDirectProxyFor(Class<T> serviceType) throws IllegalArgumentException;
+
+ /**
+ * Returns an instance of provided RpcService type which routes all calls to
+ * other instances selected on particular input field.
+ *
+ * <p>
+ * Returned instance:
+ * <ul><li>Implements:
+ * <ul><li>{@link DelegateProxy}
+ * <li>{@link RpcRouter}
+ * </ul>
+ * <li>
+ * routes all invocations of methods, which are defined in RpcService
+ * subtype based on method arguments and routing information defined in the
+ * RpcRoutingTables for this instance
+ * {@link RpcRouter#getRoutingTable(Class)}.
+ * <ul>
+ * <li>
+ * Implementation uses
+ * {@link RpcRouter#getService(Class, InstanceIdentifier)} method to
+ * retrieve particular instance to which call will be routed.
+ * <li>
+ * Instance of {@link InstanceIdentifier} is determined by first argument of
+ * method and is retrieved via method which is annotated with
+ * {@link RoutingContext}. Class representing Routing Context Identifier is
+ * retrieved by {@link RoutingContext}.
+ * <li>If first argument is not defined / {@link RoutingContext} annotation
+ * is not present on any field invocation will be delegated to default
+ * service {@link RpcRouter#getDefaultService()}.
+ * </ul>
+ *
+ * @param serviceType
+ * - Subclass of RpcService for which Router is to be generated.
+ * @return Instance of RpcService of provided serviceType which implements
+ * also {@link RpcRouter}<T> and {@link DelegateProxy}
+ */
+ <T extends RpcService> T getRouterFor(Class<T> serviceType) throws IllegalArgumentException;
+}
--- /dev/null
+package org.opendaylight.controller.sal.binding.codegen.impl
+
+import java.lang.ClassLoader
+
+class BrokerImplClassLoader extends ClassLoader {
+
+ val ClassLoader spiClassLoader
+
+ public new(ClassLoader model, ClassLoader spi) {
+ super(model)
+ spiClassLoader = spi;
+ }
+
+ override public loadClass(String name) throws ClassNotFoundException {
+ try {
+ return super.loadClass(name);
+ } catch (ClassNotFoundException e) {
+ return spiClassLoader.loadClass(name);
+ }
+ }
+
+}
import org.slf4j.LoggerFactory
import org.opendaylight.controller.sal.binding.codegen.impl.RuntimeCodeGenerator
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration
class BindingAwareBrokerImpl implements BindingAwareBroker {
private static val log = LoggerFactory.getLogger(BindingAwareBrokerImpl)
-
+
private val clsPool = ClassPool.getDefault()
private var RuntimeCodeGenerator generator;
private Map<Class<? extends RpcService>, RpcProxyContext> managedProxies = new HashMap();
private var NotificationBrokerImpl notifyBroker
private var ServiceRegistration<NotificationProviderService> notifyBrokerRegistration
-
+
@Property
var BundleContext brokerBundleContext
* If proxy class does not exist for supplied service class it will be generated automatically.
*/
def <T extends RpcService> getManagedDirectProxy(Class<T> service) {
-
+
var RpcProxyContext existing = null
- if ((existing = managedProxies.get(service)) != null) {
+ if((existing = managedProxies.get(service)) != null) {
return existing.proxy
}
val proxyClass = generator.generateDirectProxy(service)
managedProxies.put(service, rpcProxyCtx)
return rpcProxyCtx.proxy
}
+
/**
* Registers RPC Implementation
*
proxy.delegate = service;
return new RpcServiceRegistrationImpl<T>(type, service, osgiReg);
}
+
+ def <T extends RpcService> RpcRegistration<T> registerMountedRpcImplementation(Class<T> tyoe, T service, InstanceIdentifier identifier,
+ OsgiProviderContext context, Hashtable<String, String> properties) {
+ throw new UnsupportedOperationException("TODO: auto-generated method stub")
+ }
+
+ def <T extends RpcService> RoutedRpcRegistration<T> registerRoutedRpcImplementation(Class<T> type, T service, OsgiProviderContext context,
+ Hashtable<String, String> properties) {
+ throw new UnsupportedOperationException("TODO: auto-generated method stub")
+ }
+
}
def notifyAll(Collection<NotificationListener<?>> listeners, Notification notification) {
listeners.forEach[(it as NotificationListener).onNotification(notification)]
}
+
+ override addNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) {
+ throw new UnsupportedOperationException("TODO: auto-generated method stub")
+
+ }
+
+ override removeNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) {
+ throw new UnsupportedOperationException("TODO: auto-generated method stub")
+ }
+
+ override notify(Notification notification, ExecutorService service) {
+ throw new UnsupportedOperationException("TODO: auto-generated method stub")
+ }
}
+++ /dev/null
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.sal.binding.impl
-
-import org.opendaylight.controller.sal.binding.api.NotificationService
-import org.opendaylight.controller.sal.binding.api.NotificationListener
-import org.opendaylight.yangtools.yang.binding.Notification
-import com.google.common.collect.Multimap
-import com.google.common.collect.HashMultimap
-
-class NotificationServiceImpl implements NotificationService {
- val Multimap<Class<? extends Notification>, NotificationListener<?>> listeners;
-
- new() {
- listeners = HashMultimap.create()
- }
-
- override <T extends Notification> addNotificationListener(Class<T> notificationType,
- NotificationListener<T> listener) {
- listeners.put(notificationType, listener)
- }
-
- override <T extends Notification> removeNotificationListener(Class<T> notificationType,
- NotificationListener<T> listener) {
- listeners.remove(notificationType, listener)
- }
-
-}
import java.util.Map;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcServiceRegistration;
import org.opendaylight.yangtools.yang.binding.RpcService;
import org.osgi.framework.BundleContext;
import static org.opendaylight.controller.sal.binding.impl.osgi.Constants.*;
import static extension org.opendaylight.controller.sal.binding.impl.osgi.PropertiesUtils.*;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
+import org.opendaylight.controller.sal.binding.api.BindingAwareProvider.ProviderFunctionality
class OsgiProviderContext extends OsgiConsumerContext implements ProviderContext {
@Property
- val Map<Class<? extends RpcService>, RpcServiceRegistrationImpl<? extends RpcService>> registeredServices
+ val Map<Class<? extends RpcService>, RpcRegistration<? extends RpcService>> registeredServices
new(BundleContext ctx, BindingAwareBrokerImpl broker) {
super(ctx, broker);
_registeredServices = new HashMap();
}
- override def <T extends RpcService> RpcServiceRegistration<T> addRpcImplementation(Class<T> type, T implementation) {
+ override <T extends RpcService> addRpcImplementation(Class<T> type, T implementation) {
// TODO Auto-generated method stub
val properties = new Hashtable<String, String>();
registeredServices.put(type, salReg)
return salReg;
}
+
+ override <T extends RpcService> addMountRpcImplementation(Class<T> type, InstanceIdentifier mount, T implementation) throws IllegalStateException {
+
+ val properties = new Hashtable<String, String>();
+ properties.salServiceType = SAL_SERVICE_TYPE_PROVIDER
+
+ // Fill requirements
+ val salReg = broker.registerMountedRpcImplementation(type, implementation, mount, this, properties)
+ registeredServices.put(type, salReg)
+ return salReg;
+ }
+
+ override <T extends RpcService> addRoutedRpcImplementation(Class<T> type, T implementation) throws IllegalStateException {
+ val properties = new Hashtable<String, String>();
+ properties.salServiceType = SAL_SERVICE_TYPE_PROVIDER
+
+ // Fill requirements
+ val salReg = broker.registerRoutedRpcImplementation(type, implementation, this, properties)
+ registeredServices.put(type, salReg)
+ return salReg;
+ }
+
+ override registerFunctionality(ProviderFunctionality functionality) {
+
+ }
+
+ override unregisterFunctionality(ProviderFunctionality functionality) {
+ }
}
*/
package org.opendaylight.controller.sal.binding.impl
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcServiceRegistration
import org.osgi.framework.ServiceRegistration
import org.opendaylight.yangtools.yang.binding.RpcService
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration
-class RpcServiceRegistrationImpl<T extends RpcService> implements RpcServiceRegistration<T> {
+class RpcServiceRegistrationImpl<T extends RpcService> implements RpcRegistration<T> {
val ServiceRegistration<T> osgiRegistration;
private val T service;
import org.opendaylight.yangtools.yang.common.RpcResult
import org.opendaylight.controller.sal.binding.api.data.RuntimeDataProvider
import java.util.Map
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
class _DataBrokerImpl implements DataProviderService {
def DataProviderContext resolveProvider(DataStoreIdentifier store, Class<? extends DataRoot> root) {
}
+
+ override beginTransaction() {
+ throw new UnsupportedOperationException("TODO: auto-generated method stub")
+ }
+
+ override getConfigurationData(InstanceIdentifier data) {
+ throw new UnsupportedOperationException("TODO: auto-generated method stub")
+ }
+
+ override getData(InstanceIdentifier data) {
+ throw new UnsupportedOperationException("TODO: auto-generated method stub")
+ }
}
--- /dev/null
+package org.opendaylight.controller.sal.binding.spi;
+
+public interface DelegateProxy<T> {
+
+ void setDelegate(T delegate);
+ T getDelegate();
+}
--- /dev/null
+package org.opendaylight.controller.sal.binding.spi;
+
+import org.opendaylight.yangtools.yang.binding.BaseIdentity;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+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.
+ */
+public interface RpcRouter<T extends RpcService> {
+
+ /**
+ * 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> getRpcServiceType();
+
+ /**
+ * Returns a routing table for particular route context
+ *
+ * @param routeContext
+ * @return Routing Table for particular route context.
+ */
+ <C extends BaseIdentity> RpcRoutingTable<C, T> getRoutingTable(Class<C> routeContext);
+
+ /**
+ * Returns an instance of RpcService which is responsible for processing
+ * particular path.
+ *
+ * @param context
+ * Rpc Routing Context
+ * @param path
+ * Instance Identifier which is used as a selector of instance.
+ * @return instance of RpcService which is responsible for processing
+ * particular path.
+ */
+ T getService(Class<? extends BaseIdentity> context, InstanceIdentifier 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();
+
+ /**
+ *
+ */
+ void setDefaultService();
+
+}
--- /dev/null
+package org.opendaylight.controller.sal.binding.spi;
+
+import java.util.Map;
+
+import org.opendaylight.yangtools.yang.binding.BaseIdentity;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.RpcService;
+
+public interface RpcRoutingTable<C extends BaseIdentity,S extends RpcService> {
+
+ Class<C> getContextIdentifier();
+
+ /**
+ * Updates route for particular path to specified instance of {@link RpcService}.
+ *
+ * @param path Path for which RpcService routing is to be updated
+ * @param service Instance of RpcService which is responsible for processing Rpc Requests.
+ */
+ void updateRoute(InstanceIdentifier path,S service);
+
+ /**
+ * Deletes a route for particular path
+ *
+ * @param path Path for which
+ */
+ void deleteRoute(InstanceIdentifier path);
+
+ /**
+ *
+ */
+ S getService(InstanceIdentifier nodeInstance);
+
+ /**
+ *
+ * @return
+ */
+ Map<InstanceIdentifier,S> getRoutes();
+}
--- /dev/null
+/**
+ *
+ */
+/**
+ * @author ttkacik
+ *
+ */
+package org.opendaylight.controller.sal.binding.spi;
\ No newline at end of file
</scm>
<dependencies>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-core-api</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yang-data-api</artifactId>
import java.util.Set;
+import org.opendaylight.controller.sal.core.api.RpcImplementation;
+import org.opendaylight.controller.sal.core.api.notify.NotificationListener;
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
import org.opendaylight.yangtools.yang.model.api.RevisionAwareXPath;
-public interface Connector {
+public interface Connector extends RpcImplementation, NotificationListener {
+
+
+ Set<InstanceIdentifier> getConfigurationPrefixes();
+ Set<InstanceIdentifier> getRuntimePrefixes();
+
+ void registerListener(ConnectorListener listener);
+ void unregisterListener(ConnectorListener listener);
}
--- /dev/null
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.sal.connector.api;
+
+import java.util.Set;
+
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+
+public interface ConnectorListener {
+
+ void onPrefixesAnnounced(Set<InstanceIdentifier> prefixes);
+ void onPrefixesWithdrawn(Set<InstanceIdentifier> prefixes);
+
+}