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.Broker.ConsumerSession;
14 import org.opendaylight.controller.sal.core.api.BrokerService;
15 import org.opendaylight.controller.sal.core.spi.ForwardingConsumerSession;
18 * Created by wdec on 28/08/2014.
20 public class AuthzConsumerContextImpl extends ForwardingConsumerSession {
22 private final Broker.ConsumerSession realSession;
24 public AuthzConsumerContextImpl(Broker.ConsumerSession realSession, AuthzBrokerImpl authzBroker) {
25 this.realSession = realSession;
29 protected ConsumerSession delegate() {
34 public <T extends BrokerService> T getService(Class<T> tClass) {
36 // Check for class and return Authz broker only for DOMBroker
37 if (tClass == DOMDataBroker.class) {
38 t = (T) AuthzDomDataBroker.getInstance();
40 t = realSession.getService(tClass);
42 // AuthzDomDataBroker.getInstance().setDomDataBroker((DOMDataBroker)t);