2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.aaa.authz.srv;
11 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
12 import org.opendaylight.controller.sal.core.api.Broker;
13 import org.opendaylight.controller.sal.core.api.BrokerService;
14 import org.opendaylight.controller.sal.core.api.RpcImplementation;
15 import org.opendaylight.controller.sal.core.api.RpcRegistrationListener;
16 import org.opendaylight.yangtools.concepts.ListenerRegistration;
17 import org.opendaylight.yangtools.yang.common.QName;
18 import org.opendaylight.yangtools.yang.common.RpcResult;
19 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
22 import java.util.concurrent.Future;
25 * Created by wdec on 28/08/2014.
27 public class AuthzProviderContextImpl extends AuthzConsumerContextImpl implements Broker.ProviderSession {
29 private final Broker.ProviderSession realSession;
31 public AuthzProviderContextImpl(Broker.ProviderSession providerSession, AuthzBrokerImpl authzBroker) {
32 super(null, authzBroker);
33 this.realSession = providerSession;
36 public Broker.RpcRegistration addRpcImplementation(QName qName, RpcImplementation rpcImplementation) throws IllegalArgumentException {
37 return realSession.addRpcImplementation(qName, rpcImplementation);
41 public Broker.RoutedRpcRegistration addRoutedRpcImplementation(QName qName, RpcImplementation rpcImplementation) {
42 return realSession.addRoutedRpcImplementation(qName, rpcImplementation);
46 public Broker.RoutedRpcRegistration addMountedRpcImplementation(QName qName, RpcImplementation rpcImplementation) {
47 return realSession.addMountedRpcImplementation(qName, rpcImplementation);
57 public Future<RpcResult<CompositeNode>> rpc(QName qName, CompositeNode compositeNode) {
58 return realSession.rpc(qName, compositeNode);
62 public boolean isClosed() {
63 return realSession.isClosed();
67 public <T extends BrokerService> T getService(Class<T> tClass) {
69 //Check for class and return Authz broker only for DOMBroker
70 if (tClass == DOMDataBroker.class) {
71 t = (T) AuthzDomDataBroker.getInstance();
74 t = realSession.getService(tClass);
76 // AuthzDomDataBroker.getInstance().setDomDataBroker((DOMDataBroker)t);
81 public Set<QName> getSupportedRpcs() {
82 return realSession.getSupportedRpcs();
86 public ListenerRegistration<RpcRegistrationListener> addRpcRegistrationListener(RpcRegistrationListener rpcRegistrationListener) {
87 return realSession.addRpcRegistrationListener(rpcRegistrationListener);