Merge "Fix junit dependencies in poms. Reuse existing from parent, add missing ones."
[bgpcep.git] / topology / provider-bgp / src / main / java / org / opendaylight / bgpcep / topology / provider / bgp / LocRIBListeners.java
1 package org.opendaylight.bgpcep.topology.provider.bgp;
2
3 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.AddressFamily;
4 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.SubsequentAddressFamily;
5 import org.osgi.framework.BundleContext;
6 import org.osgi.framework.ServiceRegistration;
7
8 public final class LocRIBListeners {
9         public interface Subscribtion {
10                 public Class<? extends AddressFamily> getAfi();
11                 public Class<? extends SubsequentAddressFamily> getSafi();
12                 public LocRIBListener getLocRIBListener();
13         }
14
15         private LocRIBListeners() {
16
17         }
18
19         public static ServiceRegistration<Subscribtion> subscribe(final BundleContext context,
20                         final Class<? extends AddressFamily> afi, final Class<? extends SubsequentAddressFamily> safi, final LocRIBListener listener) {
21                 return context.registerService(Subscribtion.class,
22                                 new Subscribtion() {
23                         @Override
24                         public Class<? extends AddressFamily> getAfi() {
25                                 return afi;
26                         }
27
28                         @Override
29                         public Class<? extends SubsequentAddressFamily> getSafi() {
30                                 return safi;
31                         }
32
33                         @Override
34                         public LocRIBListener getLocRIBListener() {
35                                 return listener;
36                         }
37                 }, null);
38         }
39 }