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
8 package org.opendaylight.controller.sal.dom.broker.osgi
10 import org.opendaylight.controller.sal.core.api.BrokerService
11 import org.osgi.framework.ServiceReference
12 import org.opendaylight.controller.sal.core.api.data.DataBrokerService
13 import org.opendaylight.controller.sal.core.api.data.DataProviderService
14 import org.opendaylight.controller.sal.core.api.notify.NotificationPublishService
15 import org.opendaylight.controller.sal.core.api.notify.NotificationService
16 import org.opendaylight.controller.sal.core.api.model.SchemaService
17 import org.opendaylight.controller.sal.core.api.mount.MountProvisionService
18 import org.opendaylight.controller.sal.core.api.RpcProvisionRegistry
22 static def <T extends BrokerService> T createProxy(ServiceReference<T> serviceRef, T service) {
23 return createProxyImpl(serviceRef, service) as T;
26 private static def dispatch createProxyImpl(ServiceReference<?> ref, DataBrokerService service) {
27 new DataBrokerServiceProxy(ref as ServiceReference<DataBrokerService>, service);
30 private static def dispatch createProxyImpl(ServiceReference<?> ref, DataProviderService service) {
31 new DataProviderServiceProxy(ref as ServiceReference<DataProviderService>, service);
34 private static def dispatch createProxyImpl(ServiceReference<?> ref, NotificationPublishService service) {
35 new NotificationPublishServiceProxy(ref as ServiceReference<NotificationPublishService>, service);
38 private static def dispatch createProxyImpl(ServiceReference<?> ref, NotificationService service) {
39 new NotificationServiceProxy(ref as ServiceReference<NotificationService>, service);
42 private static def dispatch createProxyImpl(ServiceReference<?> ref, MountProvisionService service) {
43 new MountProviderServiceProxy(ref as ServiceReference<MountProvisionService>, service);
47 private static def dispatch createProxyImpl(ServiceReference<?> ref, SchemaService service) {
48 new SchemaServiceProxy(ref as ServiceReference<SchemaService>, service);
51 private static def dispatch createProxyImpl(ServiceReference<?> ref, RpcProvisionRegistry service) {
52 new RpcProvisionRegistryProxy(ref as ServiceReference<RpcProvisionRegistry>, service);
55 private static def dispatch createProxyImpl(ServiceReference<?> reference, BrokerService service) {
56 throw new IllegalArgumentException("Not supported class");