Bug 868: Migrated AuthZ to use Forwarding Sessions. 06/16706/1
authorTony Tkacik <ttkacik@cisco.com>
Tue, 17 Mar 2015 15:11:39 +0000 (16:11 +0100)
committerTony Tkacik <ttkacik@cisco.com>
Tue, 17 Mar 2015 15:11:39 +0000 (16:11 +0100)
Change-Id: I65ca5c694694ce52853c2ec7ce69fd73eb0062e2
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
aaa-authz/aaa-authz-service/pom.xml
aaa-authz/aaa-authz-service/src/main/java/org/opendaylight/aaa/authz/srv/AuthzConsumerContextImpl.java
aaa-authz/aaa-authz-service/src/main/java/org/opendaylight/aaa/authz/srv/AuthzProviderContextImpl.java

index 471b79b0bd81ab4e61cfc06a278c98ee51d9f812..d1b7aef2b1c35788b4da0292944fb32a8d7e9f4c 100644 (file)
             <artifactId>sal-core-api</artifactId>
             <version>${mdsal.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>sal-core-spi</artifactId>
+            <version>${mdsal.version}</version>
+        </dependency>
         <dependency>
             <groupId>org.jboss.resteasy</groupId>
             <artifactId>jaxrs-api</artifactId>
index ed1b6f1e669a1c1b2dfe0dc124ce1f93c01f1153..6be19a2e3ea41eb7105724aa2d23cf29403f48ab 100644 (file)
@@ -10,17 +10,14 @@ package org.opendaylight.aaa.authz.srv;
 
 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
 import org.opendaylight.controller.sal.core.api.Broker;
+import org.opendaylight.controller.sal.core.api.Broker.ConsumerSession;
 import org.opendaylight.controller.sal.core.api.BrokerService;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-
-import java.util.concurrent.Future;
+import org.opendaylight.controller.sal.core.spi.ForwardingConsumerSession;
 
 /**
  * Created by wdec on 28/08/2014.
  */
-public class AuthzConsumerContextImpl implements Broker.ConsumerSession {
+public class AuthzConsumerContextImpl extends ForwardingConsumerSession {
 
   private final Broker.ConsumerSession realSession;
 
@@ -28,15 +25,9 @@ public class AuthzConsumerContextImpl implements Broker.ConsumerSession {
     this.realSession = realSession;
   }
 
-
   @Override
-  public Future<RpcResult<CompositeNode>> rpc(QName qName, CompositeNode compositeNode) {
-    return realSession.rpc(qName, compositeNode);
-  }
-
-  @Override
-  public boolean isClosed() {
-    return realSession.isClosed();
+  protected ConsumerSession delegate() {
+    return realSession;
   }
 
   @Override
@@ -53,8 +44,4 @@ public class AuthzConsumerContextImpl implements Broker.ConsumerSession {
     return t;
   }
 
-  @Override
-  public void close() {
-    realSession.close();
-  }
 }
index 712427eb1f6edf4cdd8b97c251f673c2f39a720f..354ac47538cde74fbde77c38a1e9e4ca9570f11c 100644 (file)
@@ -10,57 +10,25 @@ package org.opendaylight.aaa.authz.srv;
 
 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
 import org.opendaylight.controller.sal.core.api.Broker;
+import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
 import org.opendaylight.controller.sal.core.api.BrokerService;
-import org.opendaylight.controller.sal.core.api.RpcImplementation;
-import org.opendaylight.controller.sal.core.api.RpcRegistrationListener;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-
-import java.util.Set;
-import java.util.concurrent.Future;
+import org.opendaylight.controller.sal.core.spi.ForwardingProviderSession;
 
 /**
  * Created by wdec on 28/08/2014.
  */
-public class AuthzProviderContextImpl extends AuthzConsumerContextImpl implements Broker.ProviderSession {
+public class AuthzProviderContextImpl extends ForwardingProviderSession {
 
   private final Broker.ProviderSession realSession;
 
   public AuthzProviderContextImpl(Broker.ProviderSession providerSession, AuthzBrokerImpl authzBroker) {
-    super(null, authzBroker);
     this.realSession = providerSession;
   }
-  @Override
-  public Broker.RpcRegistration addRpcImplementation(QName qName, RpcImplementation rpcImplementation) throws IllegalArgumentException {
-    return realSession.addRpcImplementation(qName, rpcImplementation);
-  }
-
-  @Override
-  public Broker.RoutedRpcRegistration addRoutedRpcImplementation(QName qName, RpcImplementation rpcImplementation) {
-    return realSession.addRoutedRpcImplementation(qName, rpcImplementation);
-  }
-
-  @Override
-  public Broker.RoutedRpcRegistration addMountedRpcImplementation(QName qName, RpcImplementation rpcImplementation) {
-    return realSession.addMountedRpcImplementation(qName, rpcImplementation);
-  }
-
-  @Override
-  public void close() {
-    realSession.close();
-
-  }
-
-  @Override
-  public Future<RpcResult<CompositeNode>> rpc(QName qName, CompositeNode compositeNode) {
-    return realSession.rpc(qName, compositeNode);
-  }
 
   @Override
-  public boolean isClosed() {
-    return realSession.isClosed();
+  protected ProviderSession delegate() {
+    // TODO Auto-generated method stub
+    return realSession;
   }
 
   @Override
@@ -76,14 +44,4 @@ public class AuthzProviderContextImpl extends AuthzConsumerContextImpl implement
    // AuthzDomDataBroker.getInstance().setDomDataBroker((DOMDataBroker)t);
     return t;
   }
-
-  @Override
-  public Set<QName> getSupportedRpcs() {
-    return realSession.getSupportedRpcs();
-  }
-
-  @Override
-  public ListenerRegistration<RpcRegistrationListener> addRpcRegistrationListener(RpcRegistrationListener rpcRegistrationListener) {
-    return realSession.addRpcRegistrationListener(rpcRegistrationListener);
-  }
 }