blob: 07ba51cd90708818b79f3dd47aaae37d497b19d9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
/*
* Copyright (c) 2014 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.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.controller.sal.core.spi.ForwardingConsumerSession;
/**
* Created by wdec on 28/08/2014.
*/
public class AuthzConsumerContextImpl extends ForwardingConsumerSession {
private final Broker.ConsumerSession realSession;
public AuthzConsumerContextImpl(Broker.ConsumerSession realSession, AuthzBrokerImpl authzBroker) {
this.realSession = realSession;
}
@Override
protected ConsumerSession delegate() {
return realSession;
}
@Override
public <T extends BrokerService> T getService(Class<T> tClass) {
T t;
// Check for class and return Authz broker only for DOMBroker
if (tClass == DOMDataBroker.class) {
t = (T) AuthzDomDataBroker.getInstance();
} else {
t = realSession.getService(tClass);
}
// AuthzDomDataBroker.getInstance().setDomDataBroker((DOMDataBroker)t);
return t;
}
}
|