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
21 static def <T extends BrokerService> T createProxy(ServiceReference<T> serviceRef, T service) {
22 return createProxyImpl(serviceRef, service) as T;
25 private static def dispatch createProxyImpl(ServiceReference<?> ref, DataBrokerService service) {
26 new DataBrokerServiceProxy(ref as ServiceReference<DataBrokerService>, service);
29 private static def dispatch createProxyImpl(ServiceReference<?> ref, DataProviderService service) {
30 new DataProviderServiceProxy(ref as ServiceReference<DataProviderService>, service);
33 private static def dispatch createProxyImpl(ServiceReference<?> ref, NotificationPublishService service) {
34 new NotificationPublishServiceProxy(ref as ServiceReference<NotificationPublishService>, service);
37 private static def dispatch createProxyImpl(ServiceReference<?> ref, NotificationService service) {
38 new NotificationServiceProxy(ref as ServiceReference<NotificationService>, service);
41 private static def dispatch createProxyImpl(ServiceReference<?> ref, MountProvisionService service) {
42 new MountProviderServiceProxy(ref as ServiceReference<MountProvisionService>, service);
46 private static def dispatch createProxyImpl(ServiceReference<?> ref, SchemaService service) {
47 new SchemaServiceProxy(ref as ServiceReference<SchemaService>, service);
50 private static def dispatch createProxyImpl(ServiceReference<?> reference, BrokerService service) {
51 throw new IllegalArgumentException("Not supported class");