-
- public void startBindingToDomDataConnector() {
- checkState(baDataImpl != null,"Binding Data Broker needs to be started");
- checkState(biDataImpl != null,"DOM Data Broker needs to be started.");
- checkState(mappingServiceImpl != null,"DOM Mapping Service needs to be started.");
- baConnectDataServiceImpl = new BindingIndependentConnector();
- baConnectDataServiceImpl.setRpcRegistry(baBrokerImpl);
- baConnectDataServiceImpl.setDomRpcRegistry(getDomRpcRegistry());
- baConnectDataServiceImpl.setBaDataService(baDataImpl);
- baConnectDataServiceImpl.setBiDataService(biDataImpl);
- baConnectDataServiceImpl.setMappingService(mappingServiceImpl);
- baConnectDataServiceImpl.start();
+
+ public void startForwarding() {
+ checkState(baDataImpl != null, "Binding Data Broker needs to be started");
+ checkState(biDataImpl != null, "DOM Data Broker needs to be started.");
+ checkState(mappingServiceImpl != null, "DOM Mapping Service needs to be started.");
+
+ baConnectImpl = BindingDomConnectorDeployer.createConnector(getBindingToDomMappingService());
+ baConnectImpl.setDomRpcRegistry(getDomRpcRegistry());
+ baBrokerImpl.setConnector(baConnectImpl);
+ baBrokerImpl.setDomProviderContext(createMockContext());
+ baBrokerImpl.startForwarding();
+ }
+
+ private ProviderSession createMockContext() {
+ // TODO Auto-generated method stub
+ final ClassToInstanceMap<BrokerService> domBrokerServices = ImmutableClassToInstanceMap
+ .<BrokerService> builder()
+ //
+ .put(org.opendaylight.controller.sal.core.api.data.DataProviderService.class, biDataImpl) //
+ .put(RpcProvisionRegistry.class, biBrokerImpl.getRouter()) //
+ .put(MountProvisionService.class, biMountImpl) //
+ .build();
+
+ return new ProviderSession() {
+
+ @Override
+ public Future<RpcResult<CompositeNode>> rpc(QName rpc, CompositeNode input) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public <T extends BrokerService> T getService(Class<T> service) {
+ return domBrokerServices.getInstance(service);
+ }
+
+ @Override
+ public boolean isClosed() {
+ return false;
+ }
+
+ @Override
+ public Set<QName> getSupportedRpcs() {
+ return null;
+ }
+
+ @Override
+ public void close() {
+ }
+
+ @Override
+ public ListenerRegistration<RpcRegistrationListener> addRpcRegistrationListener(
+ RpcRegistrationListener listener) {
+ return null;
+ }
+
+ @Override
+ public RpcRegistration addRpcImplementation(QName rpcType, RpcImplementation implementation)
+ throws IllegalArgumentException {
+ return null;
+ }
+
+ @Override
+ public RoutedRpcRegistration addRoutedRpcImplementation(QName rpcType, RpcImplementation implementation) {
+ return null;
+ }
+
+ @Override
+ public RoutedRpcRegistration addMountedRpcImplementation(QName rpcType, RpcImplementation implementation) {
+ return null;
+ }
+ };