X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-binding-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fbinding%2Fapi%2FAbstractBindingAwareProvider.java;h=0b9c604c2b95b3fe004539b4b9852064a6d5ec7e;hb=a81d98f692b80c45bce3fe6a87e731abfb012a9f;hp=994d3f40a85946299693d285d61e79f308f01e6e;hpb=526185d061ed50c75890b31a376e9495144b660a;p=controller.git diff --git a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/AbstractBindingAwareProvider.java b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/AbstractBindingAwareProvider.java index 994d3f40a8..0b9c604c2b 100644 --- a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/AbstractBindingAwareProvider.java +++ b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/AbstractBindingAwareProvider.java @@ -1,66 +1,20 @@ +/* + * Copyright (c) 2013 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.controller.sal.binding.api; -import java.util.Collection; - import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext; -import org.opendaylight.yangtools.yang.binding.RpcService; -import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceReference; - -public abstract class AbstractBindingAwareProvider implements BindingAwareProvider, BundleActivator { - - @Override - public final void start(BundleContext context) throws Exception { - ServiceReference brokerRef = context.getServiceReference(BindingAwareBroker.class); - BindingAwareBroker broker = context.getService(brokerRef); - - ProviderContext ctx = broker.registerProvider(this, context); - registerRpcImplementations(ctx); - registerFunctionality(ctx); - - startImpl(context); - } - - private void registerFunctionality(ProviderContext ctx) { - Collection functionality = this.getFunctionality(); - if(functionality == null || functionality.isEmpty()) { - return; - } - for (ProviderFunctionality providerFunctionality : functionality) { - ctx.registerFunctionality(providerFunctionality); - } - - } - private void registerRpcImplementations(ProviderContext ctx) { - Collection rpcs = this.getImplementations(); - if(rpcs == null || rpcs.isEmpty()) { - return; - } - for (RpcService rpcService : rpcs) { - //ctx.addRpcImplementation(type, implementation); - } - - } +@Deprecated +public abstract class AbstractBindingAwareProvider extends AbstractBrokerAwareActivator implements BindingAwareProvider { - protected void startImpl(BundleContext context) { - // NOOP - } - - @Override - public final void stop(BundleContext context) throws Exception { - - - } - - @Override - public Collection getFunctionality() { - return null; - } - @Override - public Collection getImplementations() { - return null; + protected final void onBrokerAvailable(BindingAwareBroker broker, BundleContext context) { + ProviderContext ctx = broker.registerProvider(this, context); } }