BUG-46: Remove deprecated API 66/1466/3
authorRobert Varga <rovarga@cisco.com>
Fri, 27 Sep 2013 15:20:58 +0000 (17:20 +0200)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 27 Sep 2013 20:55:03 +0000 (20:55 +0000)
Removes the old change API, which will be replaced by MD-SAL features.

Change-Id: I38de7ec3f57e5c42d14dcb371e02f498b4d24ad8
Signed-off-by: Robert Varga <rovarga@cisco.com>
bgp/rib-api/pom.xml
bgp/rib-api/src/main/java/org/opendaylight/protocol/bgp/rib/AbstractRIBChangeListener.java [deleted file]
bgp/rib-api/src/main/java/org/opendaylight/protocol/bgp/rib/RIB.java [deleted file]
bgp/rib-api/src/main/java/org/opendaylight/protocol/bgp/rib/RIBChangedEvent.java [deleted file]
bgp/rib-api/src/main/java/org/opendaylight/protocol/bgp/rib/RIBEvent.java [deleted file]
bgp/rib-api/src/main/java/org/opendaylight/protocol/bgp/rib/RIBEventListener.java [deleted file]
bgp/rib-api/src/main/java/org/opendaylight/protocol/bgp/rib/RIBSynchronizedEvent.java [deleted file]
bgp/rib-api/src/test/java/org/opendaylight/protocol/bgp/rib/BGPEventsTest.java [deleted file]
bgp/rib-impl/pom.xml
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/RIBImpl.java

index c3e6c76d92ad5766b8ae52cec4a1de017efbef5e..75bdb820d2a82dcf28993ff81d0a7f31eb2bc921 100644 (file)
                        <artifactId>bgp-concepts</artifactId>
             <version>${project.version}</version>
                </dependency>
-               <dependency>
-                       <groupId>${project.groupId}</groupId>
-                       <artifactId>bgp-linkstate</artifactId>
-            <version>${project.version}</version>
-               </dependency>
-               <dependency>
-                       <groupId>com.google.code.findbugs</groupId>
-                       <artifactId>jsr305</artifactId>
-                       <version>2.0.1</version>
-               </dependency>
-               <dependency>
-                       <groupId>com.google.guava</groupId>
-                       <artifactId>guava</artifactId>
-                       <version>${guava.version}</version>
-        </dependency>
         <dependency>
             <groupId>org.opendaylight.yangtools</groupId>
             <artifactId>yang-binding</artifactId>
             <artifactId>yang-common</artifactId>
             <version>${yangtools.version}</version>
         </dependency>
-               <dependency>
-                       <groupId>junit</groupId>
-                       <artifactId>junit</artifactId>
-                       <version>${junit.version}</version>
-                       <scope>test</scope>
-               </dependency>
        </dependencies>
 
        <build>
                                <extensions>true</extensions>
                                <configuration>
                                        <instructions>
-                                               <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
-                        <Import-Package>
-                            org.opendaylight.protocol.bgp.concepts,
-                            org.opendaylight.protocol.bgp.linkstate, 
-                            org.opendaylight.protocol.bgp.parser, 
-                            org.opendaylight.protocol.concepts,
-                                                       com.google.common.base,
-                                                       com.google.guava,
-                                                       org.slf4j,
-                                               </Import-Package>
-                                               <Export-Package>
-                            org.opendaylight.protocol.bgp.rib,
-                                               </Export-Package>
+                        <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
+                        <Export-Package>
+                            org.opendaylight.yang.gen.*
+                        </Export-Package>
                                        </instructions>
                                </configuration>
                        </plugin>
diff --git a/bgp/rib-api/src/main/java/org/opendaylight/protocol/bgp/rib/AbstractRIBChangeListener.java b/bgp/rib-api/src/main/java/org/opendaylight/protocol/bgp/rib/AbstractRIBChangeListener.java
deleted file mode 100644 (file)
index f802cd2..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.protocol.bgp.rib;
-
-import javax.annotation.concurrent.ThreadSafe;
-
-import org.opendaylight.protocol.concepts.InitialListenerEvents;
-import org.opendaylight.protocol.concepts.ListenerRegistration;
-
-@ThreadSafe
-public abstract class AbstractRIBChangeListener implements RIBEventListener {
-       @Override
-       synchronized public final void onRIBEvent(final RIBEvent event) {
-               onRIBEventImpl(event);
-       }
-
-       abstract protected void onRIBEventImpl(final RIBEvent event);
-
-       synchronized public final ListenerRegistration<RIBEventListener> register(final RIB rib) {
-               InitialListenerEvents<RIBEventListener, RIBEvent> ile = rib.registerListener(this);
-               for (RIBEvent e : ile.getEvents())
-                       onRIBEvent(e);
-
-               return ile.getRegistration();
-       }
-}
diff --git a/bgp/rib-api/src/main/java/org/opendaylight/protocol/bgp/rib/RIB.java b/bgp/rib-api/src/main/java/org/opendaylight/protocol/bgp/rib/RIB.java
deleted file mode 100644 (file)
index 040f3b0..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * 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.protocol.bgp.rib;
-
-import org.opendaylight.protocol.concepts.InitialListenerEvents;
-
-public interface RIB {
-
-       public InitialListenerEvents<RIBEventListener, RIBEvent> registerListener(RIBEventListener listener);
-
-}
diff --git a/bgp/rib-api/src/main/java/org/opendaylight/protocol/bgp/rib/RIBChangedEvent.java b/bgp/rib-api/src/main/java/org/opendaylight/protocol/bgp/rib/RIBChangedEvent.java
deleted file mode 100644 (file)
index 2eddafc..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.protocol.bgp.rib;
-
-import java.util.Collections;
-import java.util.Map;
-
-import org.opendaylight.protocol.bgp.linkstate.LinkIdentifier;
-import org.opendaylight.protocol.bgp.linkstate.NodeIdentifier;
-import org.opendaylight.protocol.bgp.linkstate.PrefixIdentifier;
-import org.opendaylight.protocol.bgp.parser.BGPLinkState;
-import org.opendaylight.protocol.bgp.parser.BGPNodeState;
-import org.opendaylight.protocol.bgp.parser.BGPPrefixState;
-import org.opendaylight.protocol.bgp.parser.BGPRouteState;
-import org.opendaylight.protocol.concepts.Prefix;
-
-import com.google.common.base.Preconditions;
-
-public final class RIBChangedEvent implements RIBEvent {
-       private final Map<LinkIdentifier, BGPLinkState> links;
-       private final Map<NodeIdentifier, BGPNodeState> nodes;
-       private final Map<PrefixIdentifier<?>, BGPPrefixState> prefixes;
-       private final Map<Prefix<?>, BGPRouteState> routes;
-
-       public RIBChangedEvent(final Map<LinkIdentifier, BGPLinkState> links, final Map<NodeIdentifier, BGPNodeState> nodes,
-                       final Map<PrefixIdentifier<?>, BGPPrefixState> prefixes, final Map<Prefix<?>, BGPRouteState> routes) {
-               super();
-               this.links = Collections.unmodifiableMap(Preconditions.checkNotNull(links));
-               this.nodes = Collections.unmodifiableMap(Preconditions.checkNotNull(nodes));
-               this.prefixes = Collections.unmodifiableMap(Preconditions.checkNotNull(prefixes));
-               this.routes = Collections.unmodifiableMap(Preconditions.checkNotNull(routes));
-       }
-
-       public RIBChangedEvent(final Map<Prefix<?>, BGPRouteState> routes) {
-               this(Collections.<LinkIdentifier, BGPLinkState> emptyMap(), Collections.<NodeIdentifier, BGPNodeState> emptyMap(), Collections.<PrefixIdentifier<?>, BGPPrefixState> emptyMap(), routes);
-       }
-
-       public RIBChangedEvent(final Map<LinkIdentifier, BGPLinkState> links, final Map<NodeIdentifier, BGPNodeState> nodes,
-                       final Map<PrefixIdentifier<?>, BGPPrefixState> prefixes) {
-               this(links, nodes, prefixes, Collections.<Prefix<?>, BGPRouteState> emptyMap());
-       }
-
-       /**
-        * @return the links
-        */
-       public final Map<LinkIdentifier, BGPLinkState> getLinks() {
-               return this.links;
-       }
-
-       /**
-        * @return the nodes
-        */
-       public final Map<NodeIdentifier, BGPNodeState> getNodes() {
-               return this.nodes;
-       }
-
-       /**
-        * @return the prefixes
-        */
-       public final Map<PrefixIdentifier<?>, BGPPrefixState> getPrefixes() {
-               return this.prefixes;
-       }
-
-       /**
-        * @return the routes
-        */
-       public final Map<Prefix<?>, BGPRouteState> getRoutes() {
-               return this.routes;
-       }
-}
diff --git a/bgp/rib-api/src/main/java/org/opendaylight/protocol/bgp/rib/RIBEvent.java b/bgp/rib-api/src/main/java/org/opendaylight/protocol/bgp/rib/RIBEvent.java
deleted file mode 100644 (file)
index 666d852..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * 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.protocol.bgp.rib;
-
-public interface RIBEvent {
-
-}
diff --git a/bgp/rib-api/src/main/java/org/opendaylight/protocol/bgp/rib/RIBEventListener.java b/bgp/rib-api/src/main/java/org/opendaylight/protocol/bgp/rib/RIBEventListener.java
deleted file mode 100644 (file)
index 3475ae3..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * 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.protocol.bgp.rib;
-
-import java.util.EventListener;
-
-public interface RIBEventListener extends EventListener {
-       void onRIBEvent(RIBEvent event);
-}
diff --git a/bgp/rib-api/src/main/java/org/opendaylight/protocol/bgp/rib/RIBSynchronizedEvent.java b/bgp/rib-api/src/main/java/org/opendaylight/protocol/bgp/rib/RIBSynchronizedEvent.java
deleted file mode 100644 (file)
index df876f3..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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.protocol.bgp.rib;
-
-import org.opendaylight.protocol.bgp.concepts.BGPTableType;
-
-public final class RIBSynchronizedEvent implements RIBEvent {
-       private final BGPTableType table;
-
-       public RIBSynchronizedEvent(final BGPTableType table) {
-               this.table = table;
-       }
-
-       public BGPTableType getTable() {
-               return table;
-       }
-}
diff --git a/bgp/rib-api/src/test/java/org/opendaylight/protocol/bgp/rib/BGPEventsTest.java b/bgp/rib-api/src/test/java/org/opendaylight/protocol/bgp/rib/BGPEventsTest.java
deleted file mode 100644 (file)
index bce96e6..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.protocol.bgp.rib;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.util.Collections;
-
-import org.junit.Test;
-import org.opendaylight.protocol.bgp.concepts.BGPTableType;
-import org.opendaylight.protocol.bgp.parser.BGPRouteState;
-import org.opendaylight.protocol.concepts.Prefix;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv6AddressFamily;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.MplsLabeledVpnSubsequentAddressFamily;
-
-public class BGPEventsTest {
-
-       @Test
-       public void testSynchronizedEvent() {
-               final BGPTableType tt = new BGPTableType(Ipv6AddressFamily.class, MplsLabeledVpnSubsequentAddressFamily.class);
-               final RIBSynchronizedEvent event = new RIBSynchronizedEvent(tt);
-               assertEquals(tt, event.getTable());
-       }
-
-       @Test
-       public void testChangedEvent() {
-               final RIBChangedEvent event = new RIBChangedEvent(Collections.<Prefix<?>, BGPRouteState> emptyMap());
-               assertNotNull(event.getLinks());
-               assertNotNull(event.getNodes());
-               assertNotNull(event.getPrefixes());
-               assertNotNull(event.getRoutes());
-       }
-}
index 5a90c8c4977c7ca3512961c0bfeaef6790f05ab1..10034642870f8a9a506f5745eabcf041c8cfada4 100644 (file)
                             org.opendaylight.protocol.bgp.parser.impl,
                             org.opendaylight.protocol.bgp.parser.message,
                             org.opendaylight.protocol.bgp.parser.parameter,
-                            org.opendaylight.protocol.bgp.rib,
                             org.opendaylight.protocol.bgp.util,
                             org.opendaylight.protocol.util,
                                                        org.slf4j,
index ee53a8467edce61e72707ea021c9f0538d37582b..ee4b1c861da5cd675f60adc3a94cc950ef944e9f 100644 (file)
@@ -7,9 +7,7 @@
  */
 package org.opendaylight.protocol.bgp.rib.impl;
 
-import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
@@ -28,12 +26,6 @@ import org.opendaylight.protocol.bgp.parser.BGPPrefix;
 import org.opendaylight.protocol.bgp.parser.BGPPrefixState;
 import org.opendaylight.protocol.bgp.parser.BGPRoute;
 import org.opendaylight.protocol.bgp.parser.BGPRouteState;
-import org.opendaylight.protocol.bgp.rib.RIB;
-import org.opendaylight.protocol.bgp.rib.RIBChangedEvent;
-import org.opendaylight.protocol.bgp.rib.RIBEvent;
-import org.opendaylight.protocol.bgp.rib.RIBEventListener;
-import org.opendaylight.protocol.concepts.InitialListenerEvents;
-import org.opendaylight.protocol.concepts.ListenerRegistration;
 import org.opendaylight.protocol.concepts.Prefix;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev130918.LinkstateAddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv4AddressFamily;
@@ -42,21 +34,17 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.type
 import com.google.common.base.Objects;
 import com.google.common.base.Objects.ToStringHelper;
 import com.google.common.base.Preconditions;
-import com.google.common.eventbus.EventBus;
-import com.google.common.eventbus.Subscribe;
 
 @ThreadSafe
-public final class RIBImpl implements RIB {
+public final class RIBImpl {
        private final RIBTable<LinkIdentifier, BGPLinkState> links = new RIBTable<>();
        private final RIBTable<NodeIdentifier, BGPNodeState> nodes = new RIBTable<>();
        private final RIBTable<PrefixIdentifier<?>, BGPPrefixState> prefixes = new RIBTable<>();
        private final RIBTable<Prefix<?>, BGPRouteState> routes = new RIBTable<>();
-       private final EventBus bus;
        private final String name;
 
        public RIBImpl(final String name) {
                this.name = Preconditions.checkNotNull(name);
-               this.bus = new EventBus(name);
        }
 
        synchronized void updateTables(final BGPPeer peer, final Set<BGPObject> addedObjects, final Set<?> removedObjects) {
@@ -97,47 +85,19 @@ public final class RIBImpl implements RIB {
                        }
                }
 
-               if (!l.isEmpty() || !n.isEmpty() || !p.isEmpty() || !r.isEmpty()) {
-                       this.bus.post(new RIBChangedEvent(l, n, p, r));
-               }
+               // FIXME: push into MD SAL
        }
 
        synchronized void clearTable(final BGPPeer peer, final BGPTableType t) {
                if (Ipv4AddressFamily.class == t.getAddressFamily() || Ipv6AddressFamily.class == t.getAddressFamily()) {
-                       this.bus.post(new RIBChangedEvent(this.routes.clear(peer)));
+                       this.routes.clear(peer);
                } else if (LinkstateAddressFamily.class == t.getAddressFamily()) {
-                       this.bus.post(new RIBChangedEvent(this.links.clear(peer), this.nodes.clear(peer), this.prefixes.clear(peer)));
+                       this.links.clear(peer);
+                       this.nodes.clear(peer);
+                       this.prefixes.clear(peer);
                }
        }
 
-       @Override
-       synchronized public InitialListenerEvents<RIBEventListener, RIBEvent> registerListener(final RIBEventListener listener) {
-               final List<RIBEvent> events = new ArrayList<>();
-
-               events.add(new RIBChangedEvent(this.routes.currentState()));
-               events.add(new RIBChangedEvent(this.links.currentState(), this.nodes.currentState(), this.prefixes.currentState()));
-
-               final Object wrapper = new Object() {
-                       @Subscribe
-                       public void notifyListener(final RIBChangedEvent event) {
-                               listener.onRIBEvent(event);
-                       }
-               };
-               this.bus.register(wrapper);
-
-               return new InitialListenerEvents<RIBEventListener, RIBEvent>(new ListenerRegistration<RIBEventListener>() {
-                       @Override
-                       public void close() {
-                               RIBImpl.this.bus.unregister(wrapper);
-                       }
-
-                       @Override
-                       public RIBEventListener getListener() {
-                               return listener;
-                       }
-               }, events);
-       }
-
        @Override
        public final String toString() {
                return addToStringAttributes(Objects.toStringHelper(this)).toString();