Merge "added generated files to .gitignore"
authorTony Tkacik <ttkacik@cisco.com>
Wed, 12 Mar 2014 09:56:59 +0000 (09:56 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 12 Mar 2014 09:56:59 +0000 (09:56 +0000)
49 files changed:
opendaylight/arphandler/src/main/java/org/opendaylight/controller/arphandler/internal/ArpHandler.java
opendaylight/clustering/services_implementation/src/main/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusterGlobalManager.java
opendaylight/clustering/services_implementation/src/main/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusterManagerCommon.java
opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/ConfigManagerActivator.java
opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/internal/ConnectionManager.java
opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/scheme/AbstractScheme.java
opendaylight/distribution/opendaylight/src/main/resources/configuration/config.ini
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/BindingAwareBroker.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/NotificationListener.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/NotificationProviderService.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/NotificationService.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/RpcConsumerRegistry.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/RpcProviderRegistry.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/data/SynchronizedTransaction.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/rpc/RpcRouter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/NotificationBrokerImpl.xtend
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RpcProviderRegistryImpl.java
opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/AbstractBindingSalConsumerInstance.java
opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/AbstractBindingSalProviderInstance.java
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataModification.java
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractDataModification.java
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/AbstractDataBroker.java
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/AbstractDataTransaction.java
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/TwoPhaseCommit.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/notify/NotificationPublishService.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/MountPointImpl.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/NotificationModule.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/NotificationPublishServiceProxy.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/streams/websockets/WebSocketServer.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/CnSnToXmlAndJsonInstanceIdentifierTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/MediaTypesTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPostOperationTest.java
opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/NotificationServiceImpl.java
opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/transactions/RemoteDataModificationTransaction.java
opendaylight/md-sal/samples/toaster-provider/src/main/java/org/opendaylight/controller/sample/toaster/provider/OpendaylightToaster.java
opendaylight/northbound/archetype-app-northbound/pom.xml [new file with mode: 0644]
opendaylight/northbound/archetype-app-northbound/src/main/resources/META-INF/maven/archetype-metadata.xml [new file with mode: 0644]
opendaylight/northbound/archetype-app-northbound/src/main/resources/archetype-resources/pom.xml [new file with mode: 0644]
opendaylight/northbound/archetype-app-northbound/src/main/resources/archetype-resources/src/main/java/Northbound.java [new file with mode: 0644]
opendaylight/northbound/archetype-app-northbound/src/main/resources/archetype-resources/src/main/resources/WEB-INF/web.xml [new file with mode: 0644]
opendaylight/northbound/archetype-app-northbound/src/test/resources/projects/basic/archetype.properties [new file with mode: 0644]
opendaylight/northbound/archetype-app-northbound/src/test/resources/projects/basic/goal.txt [new file with mode: 0644]
opendaylight/northbound/commons/src/main/java/org/opendaylight/controller/northbound/commons/NorthboundApplication.java
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/DiscoveryService.java
opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/topology/TopoEdgeUpdate.java
opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/NetUtils.java
opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/utils/NetUtilsTest.java
opendaylight/topologymanager/implementation/src/main/java/org/opendaylight/controller/topologymanager/internal/TopologyManagerImpl.java
opendaylight/web/devices/src/main/java/org/opendaylight/controller/devices/web/Devices.java

index 8ae038c30f38bb38410b1c093c7a7a6b791ca507..fa883829cccf6c9f69044f3346e364ea4c2f9c5d 100644 (file)
@@ -172,6 +172,12 @@ public class ArpHandler implements IHostFinder, IListenDataPacket, ICacheUpdateA
         byte[] targetIP = tIP.getAddress();
         ARP arp = createARP(ARP.REPLY, sMAC, senderIP, tMAC, targetIP);
 
+        if(log.isTraceEnabled()) {
+            log.trace("Sending Arp Reply with srcMac {} - srcIp {} - dstMac {} - dstIp {} - outport {}",
+                    HexEncode.bytesToHexString(sMAC),
+                    sIP, HexEncode.bytesToHexString(tMAC), tIP, p);
+        }
+
         Ethernet ethernet = createEthernet(sMAC, tMAC, arp);
 
         RawPacket destPkt = this.dataPacketService.encodeDataPacket(ethernet);
@@ -180,8 +186,28 @@ public class ArpHandler implements IHostFinder, IListenDataPacket, ICacheUpdateA
         this.dataPacketService.transmitDataPacket(destPkt);
     }
 
+    private void logArpPacket(ARP pkt, NodeConnector p) {
+        try {
+            if (pkt.getOpCode() == ARP.REQUEST) {
+                log.trace("Received Arp Request with srcMac {} - srcIp {} - dstMac {} - dstIp {} - inport {}", HexEncode.bytesToHexString(pkt.getSenderHardwareAddress()),
+                        InetAddress.getByAddress(pkt.getSenderProtocolAddress()), HexEncode.bytesToHexString(pkt.getTargetHardwareAddress()),
+                        InetAddress.getByAddress(pkt.getTargetProtocolAddress()), p);
+            } else if(pkt.getOpCode() == ARP.REPLY) {
+                log.trace("Received Arp Reply with srcMac {} - srcIp {} - dstMac {} - dstIp {} - inport {}", HexEncode.bytesToHexString(pkt.getSenderHardwareAddress()),
+                        InetAddress.getByAddress(pkt.getSenderProtocolAddress()), HexEncode.bytesToHexString(pkt.getTargetHardwareAddress()),
+                        InetAddress.getByAddress(pkt.getTargetProtocolAddress()), p);
+            }
+        } catch(UnknownHostException e) {
+            log.warn("Illegal Ip Address in the ARP packet", e);
+        }
+    }
+
     protected void handleARPPacket(Ethernet eHeader, ARP pkt, NodeConnector p) {
 
+        if(log.isTraceEnabled()) {
+            logArpPacket(pkt, p);
+        }
+
         byte[] sourceMAC = eHeader.getSourceMACAddress();
         byte[] targetMAC = eHeader.getDestinationMACAddress();
         /*
@@ -357,6 +383,11 @@ public class ArpHandler implements IHostFinder, IListenDataPacket, ICacheUpdateA
             byte[] targetIPByte = targetIP.getAddress();
             ARP arp = createARP(ARP.REQUEST, getControllerMAC(), senderIP, targetHardwareAddress, targetIPByte);
 
+            if(log.isTraceEnabled()) {
+                log.trace("Sending Broadcast Arp Request with srcMac {} - srcIp {} - dstMac {} - dstIp {} - outport {}", HexEncode.bytesToHexString(getControllerMAC()),
+                        subnet.getNetworkAddress(), HexEncode.bytesToHexString(targetHardwareAddress), targetIP, p);
+            }
+
             byte[] destMACAddress = NetUtils.getBroadcastMACAddr();
             Ethernet ethernet = createEthernet(getControllerMAC(), destMACAddress, arp);
 
@@ -387,6 +418,13 @@ public class ArpHandler implements IHostFinder, IListenDataPacket, ICacheUpdateA
         byte[] targetMAC = host.getDataLayerAddressBytes();
         ARP arp = createARP(ARP.REQUEST, getControllerMAC(), senderIP, targetMAC, targetIP);
 
+        if(log.isTraceEnabled()) {
+            log.trace("Sending Unicast Arp Request with srcMac {} - srcIp {} - dstMac {} - dstIp {} - outport {}",
+                    HexEncode.bytesToHexString(getControllerMAC()),
+                    subnet.getNetworkAddress(), HexEncode.bytesToHexString(targetMAC), host.getNetworkAddress(),
+                    outPort);
+        }
+
         Ethernet ethernet = createEthernet(getControllerMAC(), targetMAC, arp);
 
         RawPacket destPkt = this.dataPacketService.encodeDataPacket(ethernet);
index 34ddb7a207edcd5b262f2de09366fbc11c3dde62..e05f9dfe169555237e4b3469c917e5c09f11b882 100644 (file)
@@ -10,6 +10,7 @@
 package org.opendaylight.controller.clustering.services_implementation.internal;
 
 import java.util.Map;
+
 import org.opendaylight.controller.clustering.services.ICacheUpdateAware;
 import org.opendaylight.controller.clustering.services.IClusterGlobalServices;
 import org.slf4j.Logger;
@@ -22,7 +23,7 @@ public class ClusterGlobalManager
 
     @Override
     void setCacheUpdateAware(Map props, ICacheUpdateAware s) {
-        logger.trace("setCacheUpdateAware");
+        logger.trace("setCacheUpdateAware: {}",s);
         if (props.get("containerName") != null) {
             // If we got a reference with the containerName property
             // that is not what we are looking for, so filter it out.
@@ -33,7 +34,7 @@ public class ClusterGlobalManager
 
     @Override
     void unsetCacheUpdateAware(Map props, ICacheUpdateAware s) {
-        logger.trace("unsetCacheUpdateAware");
+        logger.trace("unsetCacheUpdateAware: {}",s);
         if (props.get("containerName") != null) {
             // If we got a reference with the containerName property
             // that is not what we are looking for, so filter it out.
index 97d9ded6c86b864f06356ff026bd170cc6dbe4d5..06e5bc5b611c0480de04ff4bff814095804048bf 100644 (file)
@@ -58,6 +58,7 @@ public abstract class ClusterManagerCommon implements IClusterServicesCommon {
      * export the interface ICoordinatorChangeAware
      */
     class ListenCoordinatorChange implements IListenRoleChange {
+        @Override
         public void newActiveAvailable() {
             if (coordinatorChangeAware != null) {
                 // Make sure to look the set while walking it
@@ -93,13 +94,9 @@ public abstract class ClusterManagerCommon implements IClusterServicesCommon {
                 logger.trace("cachenames provided below:");
                 for (String cache : caches) {
                     if (this.cacheUpdateAware.get(cache) != null) {
-                        logger.error("cachename:{} on container:{} has " +
-                                     "already a listener", cache,
-                                     this.containerName);
+                        logger.error("cachename:{} on container:{} has already a listener", cache, this.containerName);
                     } else {
-                        GetUpdatesContainer<?, ?> up =
-                            new GetUpdatesContainer(s, this.containerName,
-                                                    cache);
+                        GetUpdatesContainer<?, ?> up = new GetUpdatesContainer(s, this.containerName, cache);
                         if (up != null) {
                             try {
                                 this.clusterService.addListener(this.containerName,
@@ -109,6 +106,7 @@ public abstract class ClusterManagerCommon implements IClusterServicesCommon {
                                              "been registered", cache,
                                              this.containerName);
                             } catch (CacheListenerAddException exc) {
+                                logger.debug("Cache {} didn't exist when {} tried to register to its updates", cache, s);
                                 // Do nothing, the important is that
                                 // we don't register the listener in
                                 // the shadow, and we are not doing
index 02cc5ea1e4a01681e9c6b2fe73b435c1a7699db4..90131fee98ab0877d77e132d69f4752360e0c356 100644 (file)
@@ -34,7 +34,7 @@ public class ConfigManagerActivator implements BundleActivator {
     private ExtensibleBundleTracker<Collection<Registration<YangModuleInfo>>> bundleTracker;
     private ConfigRegistryImpl configRegistry;
     private ConfigRegistryJMXRegistrator configRegistryJMXRegistrator;
-    private ServiceRegistration configRegistryServiceRegistration;
+    private ServiceRegistration<?> configRegistryServiceRegistration;
 
     private final MBeanServer configMBeanServer = ManagementFactory.getPlatformMBeanServer();
 
index 773c6cac508b9b8974846d7d1ad38ad80fadc1fb..ebc56928a23856a158b4247d98c2720af9f98ac6 100644 (file)
@@ -127,17 +127,6 @@ public class ConnectionManager implements IConnectionManager,
     }
 
     public void started() {
-        String schemeStr = System.getProperty("connection.scheme");
-        for (ConnectionMgmtScheme scheme : ConnectionMgmtScheme.values()) {
-            AbstractScheme schemeImpl = SchemeFactory.getScheme(scheme,
-                    clusterServices);
-            if (schemeImpl != null) {
-                schemes.put(scheme, schemeImpl);
-                if (scheme.name().equalsIgnoreCase(schemeStr)) {
-                    activeScheme = scheme;
-                }
-            }
-        }
 
         connectionEventThread.start();
 
@@ -152,6 +141,17 @@ public class ConnectionManager implements IConnectionManager,
                 "ConnectionEvent Thread");
         this.connectionEvents = new LinkedBlockingQueue<ConnectionMgmtEvent>();
         schemes = new ConcurrentHashMap<ConnectionMgmtScheme, AbstractScheme>();
+
+        String schemeStr = System.getProperty("connection.scheme");
+        for (ConnectionMgmtScheme scheme : ConnectionMgmtScheme.values()) {
+            AbstractScheme schemeImpl = SchemeFactory.getScheme(scheme, clusterServices);
+            if (schemeImpl != null) {
+                schemes.put(scheme, schemeImpl);
+                if (scheme.name().equalsIgnoreCase(schemeStr)) {
+                    activeScheme = scheme;
+                }
+            }
+        }
     }
 
     public void stopping() {
@@ -290,7 +290,7 @@ public class ConnectionManager implements IConnectionManager,
     }
 
     /*
-     * Clustering Services' doesnt provide the existing states in the cache
+     * Clustering Services doesn't provide the existing states in the cache
      * update callbacks. Hence, using a scratch local cache to maintain the
      * existing state.
      */
@@ -303,21 +303,17 @@ public class ConnectionManager implements IConnectionManager,
             return;
         Set<InetAddress> existingControllers = existingConnections.get(node);
         if (existingControllers != null) {
-            logger.debug(
-                    "Processing Update for : {} NewControllers : {} existingControllers : {}",
-                    node, newControllers.toString(),
-                    existingControllers.toString());
+            logger.debug("Processing Update for : {} NewControllers : {} existingControllers : {}", node,
+                    newControllers.toString(), existingControllers.toString());
             if (newControllers.size() < existingControllers.size()) {
-                Set<InetAddress> removed = new HashSet<InetAddress>(
-                        existingControllers);
+                Set<InetAddress> removed = new HashSet<InetAddress>(existingControllers);
                 if (removed.removeAll(newControllers)) {
                     logger.debug("notifyNodeDisconnectFromMaster({})", node);
                     notifyNodeDisconnectedEvent(node);
                 }
             }
         } else {
-            logger.debug("Ignoring the Update for : {} NewControllers : {}",
-                    node, newControllers.toString());
+            logger.debug("Ignoring the Update for : {} NewControllers : {}", node, newControllers.toString());
         }
         existingConnections.put(node, newControllers);
     }
@@ -326,7 +322,7 @@ public class ConnectionManager implements IConnectionManager,
     public void entryDeleted(Node key, String cacheName, boolean originLocal) {
         if (originLocal)
             return;
-        logger.debug("Deleted : {} cache : {}", key, cacheName);
+        logger.debug("Deleted entry {} from cache : {}", key, cacheName);
         notifyNodeDisconnectedEvent(key);
     }
 
index 1d0e86ecd167b3191290c269bb861cc08d9e05a7..68d1b233b2ebe7c71663f4341983a98e9938ccc1 100644 (file)
@@ -54,7 +54,7 @@ public abstract class AbstractScheme {
             allocateCaches();
             retrieveCaches();
         } else {
-            log.error("Couldn't retrieve caches for scheme %s. Clustering service unavailable", name);
+            log.error("Couldn't retrieve caches for scheme {}. Clustering service unavailable", name);
         }
     }
 
@@ -335,4 +335,56 @@ public abstract class AbstractScheme {
             log.error("An error occured",e);
         }
     }
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((name == null) ? 0 : name.hashCode());
+        result = prime * result + ((nodeConnections == null) ? 0 : nodeConnections.hashCode());
+        result = prime * result + ((nodeConnectionsCacheName == null) ? 0 : nodeConnectionsCacheName.hashCode());
+        return result;
+    }
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (!(obj instanceof AbstractScheme)) {
+            return false;
+        }
+        AbstractScheme other = (AbstractScheme) obj;
+        if (name == null) {
+            if (other.name != null) {
+                return false;
+            }
+        } else if (!name.equals(other.name)) {
+            return false;
+        }
+        if (nodeConnections == null) {
+            if (other.nodeConnections != null) {
+                return false;
+            }
+        } else if (!nodeConnections.equals(other.nodeConnections)) {
+            return false;
+        }
+        if (nodeConnectionsCacheName == null) {
+            if (other.nodeConnectionsCacheName != null) {
+                return false;
+            }
+        } else if (!nodeConnectionsCacheName.equals(other.nodeConnectionsCacheName)) {
+            return false;
+        }
+        return true;
+    }
 }
index 99f8df358eaab4075aebecfd69e7349e79c5755d..7d45c829359508f18d3000bc9c69220f3e78c409 100644 (file)
@@ -8,7 +8,7 @@ osgi.bundles=\
     reference\:file\:../lib/slf4j-api-1.7.2.jar@1:start,\
     reference\:file\:../lib/logback-classic-1.0.9.jar@1:start,\
     reference\:file\:../lib/logback-core-1.0.9.jar@1:start,\
-    reference\:file\:../lib/logging.bridge-0.4.1-SNAPSHOT@1:start,\
+    reference\:file\:../lib/logging.bridge-0.4.2-SNAPSHOT@1:start,\
     reference\:file\:../lib/jersey-core-1.17.jar@2:start,\
     reference\:file\:../lib/jersey-server-1.17.jar@2:start
 
index db20a13991f8356acf88b3212c4722356aa70fc1..db0d674e63df81febc8de6b7a0eacbbd6f308cb7 100644 (file)
@@ -27,7 +27,7 @@ import org.osgi.framework.BundleContext;
  * removes direct dependencies between providers and consumers.
  * 
  * The Binding-aware broker is also responsible for translation from Java
- * classes modeling the functionality and data to binding-indpenedent form which
+ * classes modeling the functionality and data to binding-independent form which
  * is used in SAL Core.
  * 
  * 
index b3309b7a12b5af7bc15c310bc06c367d51a7772b..dd454c66207f5012f83f5f8426ec33b0dc6c2ff3 100644 (file)
@@ -11,7 +11,21 @@ import java.util.EventListener;
 
 import org.opendaylight.yangtools.yang.binding.Notification;
 
+/**
+ * Interface implemented by objects interested in some sort of Notification. This
+ * class acts as a base interface for specific listeners which usually are a type
+ * capture of this interface.
+ *
+ * @param <T> Notification type
+ */
 public interface NotificationListener<T extends Notification> extends EventListener {
-
+       /**
+        * Invoked to deliver the notification. Note that this method may be invoked
+        * from a shared thread pool, so implementations SHOULD NOT perform CPU-intensive
+        * operations and they definitely MUST NOT invoke any potentially blocking
+        * operations.
+        *
+        * @param notification Notification being delivered.
+        */
     void onNotification(T notification);
 }
index 08029dc52fa2c35fe1ea0f4b7994ef6eecf3fbe2..b94695b83d437e31194e1e862da479b787ba8d80 100644 (file)
@@ -15,24 +15,6 @@ import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.Notification;
 
 public interface NotificationProviderService extends NotificationService, NotificationPublishService<Notification> {
-
-
-    /**
-     * Deprecated. Use {@link #publish(Notification)}.
-     *
-     * @param notification
-     */
-    @Deprecated
-    void notify(Notification notification);
-
-    /**
-     * Deprecated. Use {@link #publish(Notification,ExecutorService)}.
-     *
-     * @param notification
-     */
-    @Deprecated
-    void notify(Notification notification, ExecutorService service);
-
     /**
      * Publishes a notification.
      *
index 24ca2a3de7e13073b0e61e2be930ebabf04d9436..6e8bda56d89e84e5fe0a7920ebcdfd07c2c5b84e 100644 (file)
@@ -11,39 +11,6 @@ import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.binding.Notification;
 
 public interface NotificationService extends BindingAwareService {
-    /**
-     *
-     * Deprecated: use {@link #addNotificationListener(Class, NotificationListener)} istead.
-     *
-     * @param listener
-     */
-    @Deprecated
-    <T extends Notification> void addNotificationListener(Class<T> notificationType, NotificationListener<T> listener);
-
-    /**
-     *
-     * Deprecated: use {@link #addNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener)} istead.
-     *
-     * @param listener
-     */
-    @Deprecated
-    void addNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener);
-
-    /**
-     * Deprecated: use {@link Registration#close()} istead.
-     * @param listener
-     */
-    @Deprecated
-    void removeNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener);
-
-    /**
-     * Deprecated: use {@link Registration#close()} istead.
-     * @param listener
-     */
-    @Deprecated
-    <T extends Notification> void removeNotificationListener(Class<T> notificationType, NotificationListener<T> listener);
-
-
     /**
      * Register a generic listener for specified notification type only.
      *
@@ -54,7 +21,6 @@ public interface NotificationService extends BindingAwareService {
     <T extends Notification> Registration<NotificationListener<T>> registerNotificationListener(
             Class<T> notificationType, NotificationListener<T> listener);
 
-
     /**
      * Register a listener which implements generated notification interfaces derived from
      * {@link org.opendaylight.yangtools.yang.binding.NotificationListener}.
index 69a2108065b7710a658a496486eac9c1f22bc9f7..f71d69b860d5127ee0f01be5c409a319e36cfd6e 100644 (file)
@@ -17,7 +17,7 @@ import org.opendaylight.yangtools.yang.binding.RpcService;
 public interface RpcConsumerRegistry extends BindingAwareService {
     /**
      * Returns a session specific instance (implementation) of requested
-     * YANG module implentation / service provided by consumer.
+     * YANG module implementation / service provided by consumer.
      * 
      * @return Session specific implementation of service
      */
index c64e24c9c232d2aab54847713c7f5f1c7aa236dd..cdf55844b3d94d680a7a21ad052deb9a7aa73ac4 100644 (file)
@@ -25,7 +25,7 @@ public interface RpcProviderRegistry extends //
         RpcConsumerRegistry, //
         RouteChangePublisher<RpcContextIdentifier, InstanceIdentifier<?>> {
     /**
-     * Registers an global RpcService implementation.
+     * Registers a global RpcService implementation.
      *
      * @param type
      * @param implementation
@@ -36,16 +36,15 @@ public interface RpcProviderRegistry extends //
 
     /**
      *
-     * Register an Routed RpcService where routing is determined on annotated
+     * Register a Routed RpcService where routing is determined on annotated
      * (in YANG model) context-reference and value of annotated leaf.
      *
      * @param type
      *            Type of RpcService, use generated interface class, not your
-     *            implementation clas
+     *            implementation class
      * @param implementation
      *            Implementation of RpcService
-     * @return Registration object for routed Rpc which could be used to close
-     *         an
+     * @return Registration object for routed Rpc which could be used to unregister
      *
      * @throws IllegalStateException
      */
index d7cb926775955084d696686611989aa1d2619266..da6d46d499317d647673cfb2b7ef5d60e43b2eae 100644 (file)
@@ -22,21 +22,21 @@ import com.google.common.base.Preconditions;
 
 /**
  * Synchronized wrapper for DataModificationTransaction.
- * 
+ *
  * To get instance of synchronized wrapper use {@link #from(DataModificationTransaction)}
  *
  */
 public final class SynchronizedTransaction implements DataModificationTransaction,Delegator<DataModificationTransaction> {
 
     private final DataModificationTransaction delegate;
-    
+
     private SynchronizedTransaction(DataModificationTransaction delegate) {
         this.delegate = delegate;
     }
 
     /**
      * Returns synchronized wrapper on supplied transaction.
-     * 
+     *
      * @param transaction Transaction for which synchronized wrapper should be created.
      * @return Synchronized wrapper over transaction.
      */
@@ -73,11 +73,6 @@ public final class SynchronizedTransaction implements DataModificationTransactio
         return delegate.getUpdatedOperationalData();
     }
 
-    @Deprecated
-    public synchronized void putRuntimeData(InstanceIdentifier<? extends DataObject> path, DataObject data) {
-        delegate.putRuntimeData(path, data);
-    }
-
     @Override
     public synchronized Object getIdentifier() {
         return delegate.getIdentifier();
@@ -108,11 +103,6 @@ public final class SynchronizedTransaction implements DataModificationTransactio
         return delegate.getUpdatedConfigurationData();
     }
 
-    @Deprecated
-    public synchronized void removeRuntimeData(InstanceIdentifier<? extends DataObject> path) {
-        delegate.removeRuntimeData(path);
-    }
-
     @Override
     public synchronized void removeOperationalData(InstanceIdentifier<? extends DataObject> path) {
         delegate.removeOperationalData(path);
index 81fe39c62e0c927cbe43110fabe76af640b71874..0042998cd19ac7166849322b89883dba02a831b7 100644 (file)
@@ -19,7 +19,7 @@ import org.opendaylight.yangtools.yang.binding.RpcService;
 /**
  * RpcRouter is responsible for selecting RpcService based on provided routing
  * context identifier {@link RpcRoutingTable#getContextIdentifier()} and path in
- * overal data tree (@link {@link InstanceIdentifier}.
+ * overall data tree (@link {@link InstanceIdentifier}.
  *
  *
  * @author Tony Tkacik <ttkacik@cisco.com>
index bf82302e548404cb4969cb01046dfae5b726c330..fe2681f1f768ab6c1f607550d2c637cda1297d4e 100644 (file)
@@ -49,43 +49,10 @@ class NotificationBrokerImpl implements NotificationProviderService, AutoCloseab
         this.executor = executor;\r
     }\r
 \r
-    @Deprecated\r
-    override <T extends Notification> addNotificationListener(Class<T> notificationType,\r
-        NotificationListener<T> listener) {\r
-        listeners.put(notificationType, listener)\r
-    }\r
-\r
-    @Deprecated\r
-    override <T extends Notification> removeNotificationListener(Class<T> notificationType,\r
-        NotificationListener<T> listener) {\r
-        listeners.remove(notificationType, listener)\r
-    }\r
-\r
-    override notify(Notification notification) {\r
-        publish(notification)\r
-    }\r
-\r
     def getNotificationTypes(Notification notification) {\r
         notification.class.interfaces.filter[it != Notification && Notification.isAssignableFrom(it)]\r
     }\r
 \r
-    @Deprecated\r
-    override addNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) {\r
-        throw new UnsupportedOperationException("Deprecated method. Use registerNotificationListener instead.");\r
-\r
-    }\r
-\r
-    @Deprecated\r
-    override removeNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) {\r
-        throw new UnsupportedOperationException(\r
-            "Deprecated method. Use RegisterNotificationListener returned value to close registration.")\r
-    }\r
-\r
-    @Deprecated\r
-    override notify(Notification notification, ExecutorService service) {\r
-        publish(notification, service)\r
-    }\r
-\r
     override publish(Notification notification) {\r
         publish(notification, executor)\r
     }\r
index e98d5b9942c86afb9b76e006662fe02cdf6147c2..e0c7d260b5309c2242045821a1d827ae8931c6f1 100644 (file)
@@ -7,15 +7,6 @@
  */
 package org.opendaylight.controller.sal.binding.impl;
 
-import static com.google.common.base.Preconditions.checkState;
-
-import java.util.EventListener;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.WeakHashMap;
-
 import org.opendaylight.controller.md.sal.common.api.routing.RouteChange;
 import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener;
 import org.opendaylight.controller.md.sal.common.api.routing.RouteChangePublisher;
@@ -37,12 +28,22 @@ import org.opendaylight.yangtools.yang.binding.RpcService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.EventListener;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.WeakHashMap;
+
+import static com.google.common.base.Preconditions.checkState;
+
 public class RpcProviderRegistryImpl implements //
         RpcProviderRegistry, //
         RouteChangePublisher<RpcContextIdentifier, InstanceIdentifier<?>> {
 
     private RuntimeCodeGenerator rpcFactory = SingletonHolder.RPC_GENERATOR_IMPL;
 
+    // publicProxies is a cache of proxy objects where each value in the map corresponds to a specific RpcService
     private final Map<Class<? extends RpcService>, RpcService> publicProxies = new WeakHashMap<>();
     private final Map<Class<? extends RpcService>, RpcRouter<?>> rpcRouters = new WeakHashMap<>();
     private final ListenerRegistry<RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>>> routeChangeListeners = ListenerRegistry
index 64c1ad3ab4035e173858dfacbae6536567aece93..7d7e56dae0ac824d4cacf84f8750a893de549283 100644 (file)
@@ -71,32 +71,6 @@ public abstract class AbstractBindingSalConsumerInstance<D extends DataBrokerSer
         return getRpcRegistryChecked().getRpcService(module);
     }
 
-    @Override
-    @Deprecated
-    public <T extends Notification> void addNotificationListener(Class<T> notificationType,
-            NotificationListener<T> listener) {
-        getNotificationBrokerChecked().addNotificationListener(notificationType, listener);
-    }
-
-    @Override
-    @Deprecated
-    public void addNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) {
-        getNotificationBrokerChecked().addNotificationListener(listener);
-    }
-
-    @Override
-    @Deprecated
-    public void removeNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) {
-        getNotificationBrokerChecked().removeNotificationListener(listener);
-    }
-
-    @Override
-    @Deprecated
-    public <T extends Notification> void removeNotificationListener(Class<T> notificationType,
-            NotificationListener<T> listener) {
-        getNotificationBrokerChecked().removeNotificationListener(notificationType, listener);
-    }
-
     @Override
     public <T extends Notification> Registration<NotificationListener<T>> registerNotificationListener(
             Class<T> notificationType, NotificationListener<T> listener) {
index efa02e0b301303d9a3444771f15afe4df64d1ec0..8f367de6c8976c687600a941b491aff4fcbfeb2f 100644 (file)
@@ -71,18 +71,6 @@ public abstract class AbstractBindingSalProviderInstance<D extends DataProviderS
         return getRpcRegistryChecked().addRoutedRpcImplementation(type, implementation);
     }
 
-    @Override
-    @Deprecated
-    public void notify(Notification notification) {
-        getNotificationBrokerChecked().notify(notification);
-    }
-
-    @Override
-    @Deprecated
-    public void notify(Notification notification, ExecutorService service) {
-        getNotificationBrokerChecked().notify(notification, service);
-    }
-
     @Override
     public void publish(Notification notification) {
         getNotificationBrokerChecked().publish(notification);
index f6662c388aa36e0092cf0ec8b5f262dcf981d163..22c5fa0c1d25eb4a71e19b2b271a5a777dada2e3 100644 (file)
@@ -14,7 +14,6 @@ import org.opendaylight.yangtools.concepts.Path;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 
 public interface DataModification<P extends Path<P>, D> extends DataChange<P, D>, DataReader<P, D> {
-
     /**
      * Returns transaction identifier
      *
@@ -24,16 +23,6 @@ public interface DataModification<P extends Path<P>, D> extends DataChange<P, D>
 
     TransactionStatus getStatus();
 
-    /**
-     *
-     * @deprecated Use {@link #putOperationalData(Object, Object)} instead.
-     *
-     * @param path
-     * @param data
-     */
-    @Deprecated
-    void putRuntimeData(P path, D data);
-
     /**
      * Store a piece of data at specified path. This acts as a merge operation,
      * which is to say that any pre-existing data which is not explicitly
@@ -76,14 +65,6 @@ public interface DataModification<P extends Path<P>, D> extends DataChange<P, D>
      */
     void putConfigurationData(P path, D data);
 
-    /**
-     * @deprecated Use {@link #removeOperationalData(Object)}
-     *
-     * @param path
-     */
-    @Deprecated
-    void removeRuntimeData(P path);
-
     void removeOperationalData(P path);
 
     void removeConfigurationData(P path);
@@ -112,5 +93,4 @@ public interface DataModification<P extends Path<P>, D> extends DataChange<P, D>
      *         {@link TransactionStatus#FAILED} is reached.
      */
     Future<RpcResult<TransactionStatus>> commit();
-
 }
index 4b6a0185ab81ecc1bdaf2799de15b1a6af33ff7b..3ceeb7e44db980855d4afad4b05d1489b0135f96 100644 (file)
@@ -41,7 +41,7 @@ public abstract class AbstractDataModification<P extends Path<P>, D> implements
     private final Map<P, D> unmodifiable_operationalUpdate;
     private final Set<P> unmodifiable_configurationRemove;
     private final Set<P> unmodifiable_OperationalRemove;
-    private DataReader<P, D> reader;
+    private final DataReader<P, D> reader;
 
     public AbstractDataModification(DataReader<P, D> reader) {
         this.reader = reader;
@@ -87,11 +87,6 @@ public abstract class AbstractDataModification<P extends Path<P>, D> implements
         operationalUpdate.put(path, mergeOperationalData(path,original,data));
     }
 
-    @Override
-    public final void putRuntimeData(P path, D data) {
-        putOperationalData(path, data);
-    }
-
     @Override
     public final void removeOperationalData(P path) {
         checkMutable();
@@ -100,11 +95,6 @@ public abstract class AbstractDataModification<P extends Path<P>, D> implements
         operationalRemove.put(path, path);
     }
 
-    @Override
-    public final void removeRuntimeData(P path) {
-        removeOperationalData(path);
-    }
-
     @Override
     public final void removeConfigurationData(P path) {
         checkMutable();
@@ -194,11 +184,11 @@ public abstract class AbstractDataModification<P extends Path<P>, D> implements
         }
         return null;
     }
-    
+
     protected D mergeOperationalData(P path,D stored, D modified) {
         return modified;
     }
-    
+
     protected D mergeConfigurationData(P path,D stored, D modified) {
         return modified;
     }
index ed186dcf314fd0ea075ad81bc3b3e19fb942a48b..82ce44c5e994835ff5e484c951639defca407227 100644 (file)
@@ -406,7 +406,6 @@ public abstract class AbstractDataBroker<P extends Path<P>, D extends Object, DC
 
     final Future<RpcResult<TransactionStatus>> commit(final AbstractDataTransaction<P, D> transaction) {
         Preconditions.checkNotNull(transaction);
-        transaction.changeStatus(TransactionStatus.SUBMITED);
         final TwoPhaseCommit<P, D, DCL> task = new TwoPhaseCommit<P, D, DCL>(transaction, this);
 
         this.getSubmittedTransactionsCount().getAndIncrement();
index c73a62779921d74837d96eb9c06a3f274f06cf1b..b030e6cb5f84b8da49d1780ab51ec2e7ab425ede 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.controller.md.sal.common.impl.service;
 
 import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
 
 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.impl.AbstractDataModification;
@@ -16,33 +17,41 @@ import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-@SuppressWarnings("all")
+import com.google.common.base.Preconditions;
+
 public abstract class AbstractDataTransaction<P extends Path<P>, D extends Object> extends
         AbstractDataModification<P, D> {
     private final static Logger LOG = LoggerFactory.getLogger(AbstractDataTransaction.class);
 
     private final Object identifier;
+    private final long allocationTime;
+    private long readyTime = 0;
+    private long completeTime = 0;
 
-    @Override
-    public Object getIdentifier() {
-        return this.identifier;
-    }
-
-    private TransactionStatus status;
+    private TransactionStatus status = TransactionStatus.NEW;
 
     private final AbstractDataBroker<P, D, ? extends Object> broker;
 
     protected AbstractDataTransaction(final Object identifier,
             final AbstractDataBroker<P, D, ? extends Object> dataBroker) {
         super(dataBroker);
-        this.identifier = identifier;
-        this.broker = dataBroker;
-        this.status = TransactionStatus.NEW;
-        AbstractDataTransaction.LOG.debug("Transaction {} Allocated.", identifier);
+        this.identifier = Preconditions.checkNotNull(identifier);
+        this.broker = Preconditions.checkNotNull(dataBroker);
+        this.allocationTime = System.nanoTime();
+        LOG.debug("Transaction {} Allocated.", identifier);
+    }
+
+    @Override
+    public Object getIdentifier() {
+        return this.identifier;
     }
 
     @Override
     public Future<RpcResult<TransactionStatus>> commit() {
+        readyTime = System.nanoTime();
+        LOG.debug("Transaction {} Ready after {}ms.", identifier, TimeUnit.NANOSECONDS.toMillis(readyTime - allocationTime));
+        changeStatus(TransactionStatus.SUBMITED);
+
         return this.broker.commit(this);
     }
 
@@ -64,8 +73,6 @@ public abstract class AbstractDataTransaction<P extends Path<P>, D extends Objec
         return this.broker.readOperationalData(path);
     }
 
-
-
     @Override
     public int hashCode() {
         final int prime = 31;
@@ -82,7 +89,7 @@ public abstract class AbstractDataTransaction<P extends Path<P>, D extends Objec
             return false;
         if (getClass() != obj.getClass())
             return false;
-        AbstractDataTransaction other = (AbstractDataTransaction) obj;
+        AbstractDataTransaction<?, ?> other = (AbstractDataTransaction<?, ?>) obj;
         if (identifier == null) {
             if (other.identifier != null)
                 return false;
@@ -98,10 +105,20 @@ public abstract class AbstractDataTransaction<P extends Path<P>, D extends Objec
 
     protected abstract void onStatusChange(final TransactionStatus status);
 
-    public void changeStatus(final TransactionStatus status) {
-        Object _identifier = this.getIdentifier();
-        AbstractDataTransaction.LOG
-                .debug("Transaction {} transitioned from {} to {}", _identifier, this.status, status);
+    public void succeeded() {
+        this.completeTime = System.nanoTime();
+        LOG.debug("Transaction {} Committed after {}ms.", identifier, TimeUnit.NANOSECONDS.toMillis(completeTime - readyTime));
+        changeStatus(TransactionStatus.COMMITED);
+    }
+
+    public void failed() {
+        this.completeTime = System.nanoTime();
+        LOG.debug("Transaction {} Failed after {}ms.", identifier, TimeUnit.NANOSECONDS.toMillis(completeTime - readyTime));
+        changeStatus(TransactionStatus.FAILED);
+    }
+
+    private void changeStatus(final TransactionStatus status) {
+        LOG.debug("Transaction {} transitioned from {} to {}", getIdentifier(), this.status, status);
         this.status = status;
         this.onStatusChange(status);
     }
index e201f8835b84182a9f22e9c712a2f8cc0073836f..a51dc64816d0822778ff1b690bd10fdd19268afa 100644 (file)
@@ -64,7 +64,7 @@ public class TwoPhaseCommit<P extends Path<P>, D extends Object, DCL extends Dat
         // The transaction has no effects, let's just shortcut it
         if (changedPaths.isEmpty()) {
             dataBroker.getFinishedTransactionsCount().getAndIncrement();
-            transaction.changeStatus(TransactionStatus.COMMITED);
+            transaction.succeeded();
 
             log.trace("Transaction: {} Finished successfully (no effects).", transactionId);
 
@@ -98,7 +98,7 @@ public class TwoPhaseCommit<P extends Path<P>, D extends Object, DCL extends Dat
         } catch (Exception e) {
             log.error("Transaction: {} Request Commit failed", transactionId, e);
             dataBroker.getFailedTransactionsCount().getAndIncrement();
-            this.transaction.changeStatus(TransactionStatus.FAILED);
+            this.transaction.failed();
             return this.rollback(handlerTransactions, e);
 
         }
@@ -112,13 +112,13 @@ public class TwoPhaseCommit<P extends Path<P>, D extends Object, DCL extends Dat
         } catch (Exception e) {
             log.error("Transaction: {} Finish Commit failed", transactionId, e);
             dataBroker.getFailedTransactionsCount().getAndIncrement();
-            transaction.changeStatus(TransactionStatus.FAILED);
+            transaction.failed();
             return this.rollback(handlerTransactions, e);
         }
 
 
         dataBroker.getFinishedTransactionsCount().getAndIncrement();
-        transaction.changeStatus(TransactionStatus.COMMITED);
+        transaction.succeeded();
 
         log.trace("Transaction: {} Finished successfully.", transactionId);
 
index 652eab10a75e6e4091e934d5f226ba18d181b2fd..aa22b90f65478092374d53d06961e6c09f5fbcd7 100644 (file)
@@ -11,7 +11,6 @@ import org.opendaylight.controller.sal.core.api.Broker;
 import org.opendaylight.controller.sal.core.api.Provider;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
 
-
 /**
  * Notification Publishing Service
  * 
@@ -25,12 +24,8 @@ import org.opendaylight.yangtools.yang.data.api.CompositeNode;
  * <li>For each subscriber {@link Broker} invokes
  * {@link NotificationListener#onNotification(CompositeNode)}
  * </ol>
- * 
- * 
- * 
  */
 public interface NotificationPublishService extends NotificationService {
-
     /**
      * Publishes a notification.
      * 
@@ -41,8 +36,5 @@ public interface NotificationPublishService extends NotificationService {
      * @param notification
      *            Notification to publish
      */
-    @Deprecated
-    void sendNotification(CompositeNode notification);
-
     void publish(CompositeNode notification);
 }
index 5d93f4ee4d162b22a35c610d4f79b35e7cf66fb6..dc554a072769ae0ecadf74601aa059cdbfc2d4eb 100644 (file)
@@ -47,8 +47,8 @@ public class MountPointImpl implements MountProvisionInstance, SchemaContextProv
     private final DataBrokerImpl dataReader;
     private final NotificationRouter notificationRouter;
     private final DataReader<InstanceIdentifier,CompositeNode> readWrapper;
-    
-    
+
+
     private final InstanceIdentifier mountPath;
 
     private SchemaContext schemaContext;
@@ -89,11 +89,13 @@ public class MountPointImpl implements MountProvisionInstance, SchemaContextProv
         return dataReader.readOperationalData(path);
     }
 
+    @Override
     public Registration<DataReader<InstanceIdentifier, CompositeNode>> registerOperationalReader(
             InstanceIdentifier path, DataReader<InstanceIdentifier, CompositeNode> reader) {
         return dataReader.registerOperationalReader(path, reader);
     }
 
+    @Override
     public Registration<DataReader<InstanceIdentifier, CompositeNode>> registerConfigurationReader(
             InstanceIdentifier path, DataReader<InstanceIdentifier, CompositeNode> reader) {
         return dataReader.registerConfigurationReader(path, reader);
@@ -115,15 +117,18 @@ public class MountPointImpl implements MountProvisionInstance, SchemaContextProv
         return rpcs.addRpcImplementation(rpcType, implementation);
     }
 
+    @Override
     public Set<QName> getSupportedRpcs() {
         return rpcs.getSupportedRpcs();
     }
 
-    
+
+    @Override
     public RpcResult<CompositeNode> invokeRpc(QName rpc, CompositeNode input) {
         return rpcs.invokeRpc(rpc, input);
     }
 
+    @Override
     public ListenerRegistration<RpcRegistrationListener> addRpcRegistrationListener(RpcRegistrationListener listener) {
         return rpcs.addRpcRegistrationListener(listener);
     }
@@ -145,27 +150,22 @@ public class MountPointImpl implements MountProvisionInstance, SchemaContextProv
         return dataReader.registerDataChangeListener(path, listener);
     }
 
-    @Override
-    public void sendNotification(CompositeNode notification) {
-        publish(notification);
-    }
-    
     @Override
     public Registration<DataCommitHandler<InstanceIdentifier, CompositeNode>> registerCommitHandler(
             InstanceIdentifier path, DataCommitHandler<InstanceIdentifier, CompositeNode> commitHandler) {
         return dataReader.registerCommitHandler(path, commitHandler);
     }
-    
+
     @Override
     public void removeRefresher(DataStoreIdentifier store, DataRefresher refresher) {
      // NOOP
     }
-    
+
     @Override
     public void addRefresher(DataStoreIdentifier store, DataRefresher refresher) {
      // NOOP
     }
-    
+
     @Override
     public void addValidator(DataStoreIdentifier store, DataValidator validator) {
      // NOOP
@@ -174,18 +174,20 @@ public class MountPointImpl implements MountProvisionInstance, SchemaContextProv
     public void removeValidator(DataStoreIdentifier store, DataValidator validator) {
         // NOOP
     }
-    
+
+    @Override
     public SchemaContext getSchemaContext() {
         return schemaContext;
     }
 
+    @Override
     public void setSchemaContext(SchemaContext schemaContext) {
         this.schemaContext = schemaContext;
     }
 
     class ReadWrapper implements DataReader<InstanceIdentifier, CompositeNode> {
-        
-        
+
+
         private InstanceIdentifier shortenPath(InstanceIdentifier path) {
             InstanceIdentifier ret = null;
             if(mountPath.contains(path)) {
@@ -194,7 +196,7 @@ public class MountPointImpl implements MountProvisionInstance, SchemaContextProv
             }
             return ret;
         }
-        
+
         @Override
         public CompositeNode readConfigurationData(InstanceIdentifier path) {
             InstanceIdentifier newPath = shortenPath(path);
@@ -203,7 +205,7 @@ public class MountPointImpl implements MountProvisionInstance, SchemaContextProv
             }
             return MountPointImpl.this.readConfigurationData(newPath);
         }
-        
+
         @Override
         public CompositeNode readOperationalData(InstanceIdentifier path) {
             InstanceIdentifier newPath = shortenPath(path);
index bbe017f009e445f2ab7e21e7d19b748d3f5365f0..b298a02a633cda2760347417266bb4d06e48dbca 100644 (file)
@@ -171,18 +171,13 @@ public class NotificationModule implements BrokerModule {
             NotificationPublishService {
 
         @Override
-        public void sendNotification(CompositeNode notification) {
+        public void publish(CompositeNode notification) {
             checkSessionState();
             if (notification == null)
                 throw new IllegalArgumentException(
                         "Notification must not be null.");
             NotificationModule.this.sendNotification(notification);
         }
-
-        @Override
-        public void publish(CompositeNode notification) {
-            sendNotification(notification);
-        }
     }
 
     @Override
index 8a15d84f99b4f1936021ade251dc9a6bfc498c03..cd26c4ea5c51f1f8d0283d8fb40803954528e48b 100644 (file)
@@ -21,15 +21,13 @@ public class NotificationPublishServiceProxy extends AbstractBrokerServiceProxy<
         super(ref, delegate);
     }
 
-    public void sendNotification(CompositeNode notification) {
-        getDelegate().sendNotification(notification);
-    }
-
+    @Override
     public Registration<NotificationListener> addNotificationListener(QName notification, NotificationListener listener) {
         return addRegistration(getDelegate().addNotificationListener(notification, listener));
 
     }
 
+    @Override
     public void publish(CompositeNode notification) {
         getDelegate().publish(notification);
     }
index d7b4bd9d9e0754c2bfc71958a845820c39eab8f1..16400354205a68cbf6993760f9dfa3fee04ec37a 100644 (file)
@@ -1,16 +1,15 @@
 package org.opendaylight.controller.sal.streams.websockets;
 
-import org.opendaylight.controller.sal.streams.listeners.Notificator;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import io.netty.bootstrap.ServerBootstrap;
 import io.netty.channel.Channel;
-import io.netty.channel.ChannelPipeline;
 import io.netty.channel.EventLoopGroup;
 import io.netty.channel.nio.NioEventLoopGroup;
 import io.netty.channel.socket.nio.NioServerSocketChannel;
 
+import org.opendaylight.controller.sal.streams.listeners.Notificator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 /**
  * {@link WebSocketServer} is responsible to start and stop web socket server at
  * {@link #PORT}.
index 18b5ce490ff137f7da978052a09819a6a5b4e1d1..0492b3efd4f1b7a1696c1452a5d69ee9fec07c12 100644 (file)
@@ -124,7 +124,7 @@ public class CnSnToXmlAndJsonInstanceIdentifierTest extends YangAndXmlAndDataSch
             if (nextEvent.isStartElement()) {
                 StartElement startElement = (StartElement) nextEvent;
                 if (startElement.getName().getLocalPart().equals("lf111")) {
-                    Iterator prefixes = startElement.getNamespaceContext().getPrefixes("augment:augment:module");
+                    Iterator<?> prefixes = startElement.getNamespaceContext().getPrefixes("augment:augment:module");
 
                     while (prefixes.hasNext() && aaModulePrefix == null) {
                         String prefix = (String) prefixes.next();
@@ -164,7 +164,7 @@ public class CnSnToXmlAndJsonInstanceIdentifierTest extends YangAndXmlAndDataSch
             if (nextEvent.isStartElement()) {
                 StartElement startElement = (StartElement) nextEvent;
                 if (startElement.getName().getLocalPart().equals("lf111")) {
-                    Iterator prefixes = startElement.getNamespaceContext().getPrefixes("augment:module:leaf:list");
+                    Iterator<?> prefixes = startElement.getNamespaceContext().getPrefixes("augment:module:leaf:list");
 
                     while (prefixes.hasNext() && aModuleLfLstPrefix == null) {
                         String prefix = (String) prefixes.next();
@@ -198,14 +198,14 @@ public class CnSnToXmlAndJsonInstanceIdentifierTest extends YangAndXmlAndDataSch
 
         MutableSimpleNode<?> lf111 = NodeFactory.createMutableSimpleNode(TestUtils.buildQName("lf111", "augment:augment:module", "2014-01-17"),
                 lst11, instanceIdentifier,null,null);
-        
-        
+
+
         lst11.getChildren().add(lf111);
         lst11.init();
 
         cont1.getChildren().add(lst11);
         cont1.init();
-        
+
         cont.getChildren().add(cont1);
         cont.init();
 
index 5a2c964b8b15a8eb46c6fea2cc46e77c350cdcdf..2037fd4862f3c71f5f8a180f8c5509f7cbda23a4 100644 (file)
@@ -23,7 +23,6 @@ import java.io.UnsupportedEncodingException;
 import javax.ws.rs.client.Entity;
 import javax.ws.rs.core.Application;
 import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.UriInfo;
 
 import org.glassfish.jersey.server.ResourceConfig;
 import org.glassfish.jersey.test.JerseyTest;
@@ -38,11 +37,11 @@ import org.opendaylight.controller.sal.rest.impl.XmlToCompositeNodeProvider;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
 
 public class MediaTypesTest extends JerseyTest {
-    
+
     private static RestconfService restconfService;
     private static String jsonData;
     private static String xmlData;
-    
+
     @BeforeClass
     public static void init() throws IOException {
         restconfService = mock(RestconfService.class);
@@ -51,7 +50,7 @@ public class MediaTypesTest extends JerseyTest {
         InputStream xmlStream = RestconfImplTest.class.getResourceAsStream("/parts/ietf-interfaces_interfaces.xml");
         xmlData = TestUtils.getDocumentInPrintableForm(TestUtils.loadDocumentFrom(xmlStream));
     }
-    
+
     @Override
     protected Application configure() {
         /* enable/disable Jersey logs to console */
@@ -65,7 +64,7 @@ public class MediaTypesTest extends JerseyTest {
                 JsonToCompositeNodeProvider.INSTANCE);
         return resourceConfig;
     }
-    
+
   @Test
   public void testPostOperationsWithInputDataMediaTypes() throws UnsupportedEncodingException {
       String uriPrefix = "/operations/";
@@ -84,14 +83,14 @@ public class MediaTypesTest extends JerseyTest {
       verify(restconfService, times(5)).invokeRpc(eq(uriPath), any(CompositeNode.class));
       post(uri, null, MediaType.TEXT_XML, xmlData);
       verify(restconfService, times(6)).invokeRpc(eq(uriPath), any(CompositeNode.class));
-      
+
       // negative tests
       post(uri, MediaType.TEXT_PLAIN, MediaType.TEXT_XML, xmlData);
       verify(restconfService, times(6)).invokeRpc(eq(uriPath), any(CompositeNode.class));
       post(uri, MediaType.TEXT_XML, MediaType.TEXT_PLAIN, xmlData);
       verify(restconfService, times(6)).invokeRpc(eq(uriPath), any(CompositeNode.class));
   }
-  
+
     @Test
     public void testGetConfigMediaTypes() throws UnsupportedEncodingException {
         String uriPrefix = "/config/";
@@ -108,12 +107,12 @@ public class MediaTypesTest extends JerseyTest {
         verify(restconfService, times(4)).readConfigurationData(uriPath);
         get(uri, MediaType.TEXT_XML);
         verify(restconfService, times(5)).readConfigurationData(uriPath);
-        
+
         // negative tests
         get(uri, MediaType.TEXT_PLAIN);
         verify(restconfService, times(5)).readConfigurationData(uriPath);
     }
-    
+
     @Test
     public void testGetOperationalMediaTypes() throws UnsupportedEncodingException {
         String uriPrefix = "/operational/";
@@ -130,12 +129,12 @@ public class MediaTypesTest extends JerseyTest {
         verify(restconfService, times(4)).readOperationalData(uriPath);
         get(uri, MediaType.TEXT_XML);
         verify(restconfService, times(5)).readOperationalData(uriPath);
-        
+
         // negative tests
         get(uri, MediaType.TEXT_PLAIN);
         verify(restconfService, times(5)).readOperationalData(uriPath);
     }
-    
+
     @Test
     public void testPutConfigMediaTypes() throws UnsupportedEncodingException {
         String uriPrefix = "/config/";
@@ -155,7 +154,7 @@ public class MediaTypesTest extends JerseyTest {
         put(uri, "fooMediaType", MediaType.TEXT_XML, xmlData);
         verify(restconfService, times(6)).updateConfigurationData(eq(uriPath), any(CompositeNode.class));
     }
-    
+
     @Test
     public void testPostConfigWithPathMediaTypes() throws UnsupportedEncodingException {
         String uriPrefix = "/config/";
@@ -175,7 +174,7 @@ public class MediaTypesTest extends JerseyTest {
         post(uri, "fooMediaType", MediaType.TEXT_XML, xmlData);
         verify(restconfService, times(6)).createConfigurationData(eq(uriPath), any(CompositeNode.class));
     }
-    
+
     @Test
     public void testPostConfigMediaTypes() throws UnsupportedEncodingException {
         String uriPrefix = "/config/";
@@ -194,7 +193,7 @@ public class MediaTypesTest extends JerseyTest {
         post(uri, "fooMediaType", MediaType.TEXT_XML, xmlData);
         verify(restconfService, times(6)).createConfigurationData(any(CompositeNode.class));
     }
-    
+
     @Test
     public void testDeleteConfigMediaTypes() throws UnsupportedEncodingException {
         String uriPrefix = "/config/";
@@ -204,18 +203,18 @@ public class MediaTypesTest extends JerseyTest {
         target(uri).request("fooMediaType").delete();
         verify(restconfService, times(1)).deleteConfigurationData(uriPath);
     }
-    
+
     private int get(String uri, String acceptMediaType) {
         return target(uri).request(acceptMediaType).get().getStatus();
     }
-    
+
     private int put(String uri, String acceptMediaType, String contentTypeMediaType, String data) {
         if (acceptMediaType == null) {
             return target(uri).request().put(Entity.entity(data, contentTypeMediaType)).getStatus();
         }
         return target(uri).request(acceptMediaType).put(Entity.entity(data, contentTypeMediaType)).getStatus();
     }
-    
+
     private int post(String uri, String acceptMediaType, String contentTypeMediaType, String data) {
         if (acceptMediaType == null) {
             if (contentTypeMediaType == null || data == null) {
index 11264e7f860dcdd9c2820f7a8a89b056add4fca8..c6e2f1434371ed9fbd4e294ed7661d2acb5d3c38 100644 (file)
@@ -20,7 +20,6 @@ import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.net.URLEncoder;
 import java.text.ParseException;
 import java.util.Set;
 import java.util.concurrent.Future;
@@ -53,8 +52,6 @@ import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
-import com.google.common.base.Charsets;
-
 public class RestPostOperationTest extends JerseyTest {
 
     private static String xmlDataAbsolutePath;
index 3272ce56707eff0159efbab3d3106f281e188f1a..c08f329f0d81d694e8c4f97a04fd2dfe69c25468 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.controller.sal.restconf.broker.impl;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
-import java.util.concurrent.ExecutorService;
 
 import org.opendaylight.controller.sal.binding.api.NotificationListener;
 import org.opendaylight.controller.sal.binding.api.NotificationService;
@@ -18,101 +17,46 @@ import org.opendaylight.controller.sal.restconf.broker.listeners.RemoteNotificat
 import org.opendaylight.controller.sal.restconf.broker.tools.RemoteStreamTools;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.QName;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.SalRemoteService;
+import org.opendaylight.yangtools.concepts.AbstractListenerRegistration;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.restconf.client.api.RestconfClientContext;
 import org.opendaylight.yangtools.restconf.client.api.event.EventStreamInfo;
 import org.opendaylight.yangtools.yang.binding.Notification;
 
-import com.google.common.collect.HashMultimap;
-import com.google.common.collect.Multimap;
-import com.google.common.collect.Multimaps;
-import com.google.common.collect.SetMultimap;
-
 public class NotificationServiceImpl implements NotificationService {
     private final SalRemoteService salRemoteService;
     private final RestconfClientContext restconfClientContext;
 
-    private final Multimap<Class<? extends Notification>,NotificationListener<? extends Object>> listeners;
-    private ExecutorService _executor;
-
     public NotificationServiceImpl(RestconfClientContext restconfClienetContext){
         this.restconfClientContext = restconfClienetContext;
         this.salRemoteService = this.restconfClientContext.getRpcServiceContext(SalRemoteService.class).getRpcService();
-
-        HashMultimap<Class<? extends Notification>,NotificationListener<? extends Object>> _create = HashMultimap.<Class<? extends Notification>, NotificationListener<? extends Object>>create();
-        SetMultimap<Class<? extends Notification>,NotificationListener<? extends Object>> _synchronizedSetMultimap = Multimaps.<Class<? extends Notification>, NotificationListener<? extends Object>>synchronizedSetMultimap(_create);
-        this.listeners = _synchronizedSetMultimap;
-
-    }
-    public ExecutorService getExecutor() {
-        return this._executor;
-    }
-
-    public void setExecutor(final ExecutorService executor) {
-        this._executor = executor;
-    }
-
-    @Override
-    public <T extends Notification> void addNotificationListener(Class<T> notificationType, NotificationListener<T> listener) {
-        this.listeners.put(notificationType, listener);
-    }
-
-    @Override
-    public void addNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) {
-        UnsupportedOperationException _unsupportedOperationException = new UnsupportedOperationException("Deprecated method. Use registerNotificationListener instead.");
-        throw _unsupportedOperationException;
-    }
-
-    @Override
-    public void removeNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) {
-        UnsupportedOperationException _unsupportedOperationException = new UnsupportedOperationException(
-                "Deprecated method. Use RegisterNotificationListener returned value to close registration.");
-        throw _unsupportedOperationException;
     }
 
     @Override
-    public <T extends Notification> void removeNotificationListener(Class<T> notificationType, NotificationListener<T> listener) {
-        this.listeners.remove(notificationType, listener);
-    }
-
-    @Override
-    public <T extends Notification> Registration<NotificationListener<T>> registerNotificationListener(Class<T> notificationType, NotificationListener<T> listener) {
+    public <T extends Notification> ListenerRegistration<NotificationListener<T>> registerNotificationListener(Class<T> notificationType, NotificationListener<T> listener) {
         //TODO implementation using sal-remote
         List<QName> notifications = new ArrayList<QName>();
         notifications.add(new QName(notificationType.toString()));
         String notificationStreamName = RemoteStreamTools.createNotificationStream(salRemoteService, notifications);
         final Map<String,EventStreamInfo> desiredEventStream = RemoteStreamTools.createEventStream(restconfClientContext, notificationStreamName);
         RemoteNotificationListener remoteNotificationListener = new RemoteNotificationListener(listener);
-        ListenerRegistration<?> listenerRegistration = restconfClientContext.getEventStreamContext(desiredEventStream.get(desiredEventStream.get(notificationStreamName))).registerNotificationListener(remoteNotificationListener);
-        return new SalNotificationRegistration<T>(listenerRegistration);
+
+        final ListenerRegistration<?> listenerRegistration = restconfClientContext.getEventStreamContext(desiredEventStream.get(desiredEventStream.get(notificationStreamName)))
+                .registerNotificationListener(remoteNotificationListener);
+
+        return new AbstractListenerRegistration<NotificationListener<T>>(listener) {
+            @Override
+            protected void removeRegistration() {
+                listenerRegistration.close();
+            }
+        };
     }
 
     @Override
-    public Registration<org.opendaylight.yangtools.yang.binding.NotificationListener> registerNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) {
+    public ListenerRegistration<org.opendaylight.yangtools.yang.binding.NotificationListener> registerNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) {
         //TODO implementation using sal-remote
         String notificationStreamName = RemoteStreamTools.createNotificationStream(salRemoteService, null);
         final Map<String,EventStreamInfo> desiredEventStream = RemoteStreamTools.createEventStream(restconfClientContext, notificationStreamName);
         return restconfClientContext.getEventStreamContext(desiredEventStream.get(desiredEventStream.get(notificationStreamName))).registerNotificationListener(listener);
     }
-
-    private class SalNotificationRegistration<T extends Notification> implements Registration<NotificationListener<T>>{
-        private final Registration<?> registration;
-
-        public SalNotificationRegistration(ListenerRegistration<?> listenerRegistration){
-            this.registration = listenerRegistration;
-        }
-
-        @Override
-        public NotificationListener<T> getInstance() {
-            return this.getInstance();
-        }
-
-        @Override
-        public void close() throws Exception {
-            this.registration.close();
-        }
-    }
-
-
 }
index 7f9cc8f6c4fd3a4e2fae7fc126a20b0e95e51945..c2ff3b8cf6892155bb260a62b4357bb3d6b91737 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.controller.sal.restconf.broker.transactions;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.Future;
+
 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
@@ -30,11 +31,6 @@ public class RemoteDataModificationTransaction implements DataModificationTransa
         return null;
     }
 
-    @Override
-    public void putRuntimeData(InstanceIdentifier<? extends DataObject> path, DataObject data) {
-
-    }
-
     @Override
     public void putOperationalData(InstanceIdentifier<? extends DataObject> path, DataObject data) {
 
@@ -45,11 +41,6 @@ public class RemoteDataModificationTransaction implements DataModificationTransa
 
     }
 
-    @Override
-    public void removeRuntimeData(InstanceIdentifier<? extends DataObject> path) {
-
-    }
-
     @Override
     public void removeOperationalData(InstanceIdentifier<? extends DataObject> path) {
 
index a484154edf1703819b9c7675ace6675b53992470..e1d69800cab5688ab46d7df75baefda1c4361998 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.controller.sample.toaster.provider;
 
 import java.util.Collections;
-
 import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -17,7 +16,6 @@ import java.util.concurrent.atomic.AtomicLong;
 
 import org.opendaylight.controller.config.yang.config.toaster_provider.impl.ToasterProviderRuntimeMXBean;
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
-import org.opendaylight.controller.sal.common.util.Futures;
 import org.opendaylight.controller.sal.common.util.Rpcs;
 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.DisplayString;
 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.MakeToastInput;
@@ -33,13 +31,15 @@ import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.util.concurrent.Futures;
+
 public class OpendaylightToaster implements ToasterData, ToasterService, ToasterProviderRuntimeMXBean {
 
     private static final Logger log = LoggerFactory.getLogger(OpendaylightToaster.class);
 
     private static final DisplayString toasterManufacturer = new DisplayString("Opendaylight");
     private static final DisplayString toasterModelNumber = new DisplayString("Model 1 - Binding Aware");
-    private ToasterStatus toasterStatus;
+    private final ToasterStatus toasterStatus;
 
     private NotificationProviderService notificationProvider;
     private final ExecutorService executor;
@@ -91,7 +91,7 @@ public class OpendaylightToaster implements ToasterData, ToasterService, Toaster
         currentTask.cancel(true);
         ToastDoneBuilder toastDone = new ToastDoneBuilder();
         toastDone.setToastStatus(ToastStatus.Cancelled);
-        notificationProvider.notify(toastDone.build());
+        notificationProvider.publish(toastDone.build());
     }
 
     public void setNotificationProvider(NotificationProviderService salService) {
@@ -125,7 +125,7 @@ public class OpendaylightToaster implements ToasterData, ToasterService, Toaster
 
             ToastDoneBuilder notifyBuilder = new ToastDoneBuilder();
             notifyBuilder.setToastStatus(ToastStatus.Done);
-            notificationProvider.notify(notifyBuilder.build());
+            notificationProvider.publish(notifyBuilder.build());
             log.trace("Toast Done");
             logToastInput(toastRequest);
             currentTask = null;
diff --git a/opendaylight/northbound/archetype-app-northbound/pom.xml b/opendaylight/northbound/archetype-app-northbound/pom.xml
new file mode 100644 (file)
index 0000000..558bf41
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.opendaylight.controller</groupId>
+  <artifactId>app-northbound</artifactId>
+  <version>0.0.1-SNAPSHOT</version>
+  <packaging>maven-archetype</packaging>
+
+  <name>app-northbound</name>
+
+  <build>
+    <extensions>
+      <extension>
+        <groupId>org.apache.maven.archetype</groupId>
+        <artifactId>archetype-packaging</artifactId>
+        <version>2.2</version>
+      </extension>
+    </extensions>
+
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <artifactId>maven-archetype-plugin</artifactId>
+          <version>2.2</version>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+</project>
diff --git a/opendaylight/northbound/archetype-app-northbound/src/main/resources/META-INF/maven/archetype-metadata.xml b/opendaylight/northbound/archetype-app-northbound/src/main/resources/META-INF/maven/archetype-metadata.xml
new file mode 100644 (file)
index 0000000..3c9223d
--- /dev/null
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archetype-descriptor xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd" name="app"
+    xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <fileSets>
+    <fileSet filtered="true" packaged="true" encoding="UTF-8">
+      <directory>src/main/java</directory>
+      <includes>
+        <include>**/*.java</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" encoding="UTF-8">
+      <directory>src/main/resources</directory>
+      <includes>
+        <include>**/*.xml</include>
+      </includes>
+    </fileSet>
+    <fileSet encoding="UTF-8">
+      <directory>.settings</directory>
+      <includes>
+        <include>**/*.prefs</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" encoding="UTF-8">
+      <directory></directory>
+      <includes>
+        <include>.classpath</include>
+        <include>.project</include>
+      </includes>
+    </fileSet>
+  </fileSets>
+</archetype-descriptor>
diff --git a/opendaylight/northbound/archetype-app-northbound/src/main/resources/archetype-resources/pom.xml b/opendaylight/northbound/archetype-app-northbound/src/main/resources/archetype-resources/pom.xml
new file mode 100644 (file)
index 0000000..da1bd41
--- /dev/null
@@ -0,0 +1,63 @@
+#set( $dollar = '$' )
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.opendaylight.controller</groupId>
+    <artifactId>commons.opendaylight</artifactId>
+    <version>1.4.1-SNAPSHOT</version>
+    <relativePath>../../commons/opendaylight</relativePath>
+  </parent>
+
+  <artifactId>${artifactId}</artifactId>
+
+  <groupId>${groupId}</groupId>
+  <packaging>bundle</packaging>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <version>${bundle.plugin.version}</version>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Export-Package></Export-Package>
+            <Import-Package>org.opendaylight.controller.northbound.commons,
+              com.sun.jersey.spi.container.servlet,
+              com.fasterxml.jackson.annotation,
+              javax.ws.rs,
+              javax.ws.rs.core,
+              javax.xml.bind,
+              javax.xml.bind.annotation,
+              org.slf4j,
+              org.apache.catalina.filters,
+              com.fasterxml.jackson.jaxrs.base,
+              com.fasterxml.jackson.jaxrs.json,
+              !org.codehaus.enunciate.jaxrs</Import-Package>
+            <Web-ContextPath>/northbound/${artifactId}</Web-ContextPath>
+            <Jaxrs-Resources>,${dollar}{classes;ANNOTATION;javax.ws.rs.Path}</Jaxrs-Resources>
+          </instructions>
+          <manifestLocation>${project.basedir}/src/main/resources/META-INF</manifestLocation>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <version>${version}</version>
+  <dependencies>
+    <dependency>
+      <groupId>org.codehaus.enunciate</groupId>
+      <artifactId>enunciate-core-annotations</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>commons.northbound</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/opendaylight/northbound/archetype-app-northbound/src/main/resources/archetype-resources/src/main/java/Northbound.java b/opendaylight/northbound/archetype-app-northbound/src/main/resources/archetype-resources/src/main/java/Northbound.java
new file mode 100644 (file)
index 0000000..788dec8
--- /dev/null
@@ -0,0 +1,70 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+package ${package};
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.SecurityContext;
+
+import org.codehaus.enunciate.jaxrs.StatusCodes;
+import org.codehaus.enunciate.jaxrs.TypeHint;
+
+/**
+ * Northbound REST API
+ *
+ * <br>
+ * <br>
+ * Authentication scheme : <b>HTTP Basic</b><br>
+ * Authentication realm : <b>opendaylight</b><br>
+ * Transport : <b>HTTP and HTTPS</b><br>
+ * <br>
+ * HTTPS Authentication is disabled by default.
+ */
+
+@Path("/")
+public class Northbound {
+
+    private String username;
+
+    @Context
+    public void setSecurityContext(SecurityContext context) {
+        if (context != null && context.getUserPrincipal() != null) {
+            username = context.getUserPrincipal().getName();
+        }
+    }
+
+    /**
+     *
+     * Sample REST API call
+     *
+     * @return A response string
+     *
+     *         <pre>
+     * Example:
+     *
+     * Request URL:
+     * http://localhost:8080/northbound/${artifactId}/api
+     *
+     * Response body in XML:
+     * &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
+     * Sample Northbound API
+     *
+     * Response body in JSON:
+     * Sample Northbound API
+     * </pre>
+     */
+    @Path("/api")
+    @GET
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @TypeHint(String.class)
+    @StatusCodes()
+    public String getWidget() {
+        String result = "Sample Northbound API - ${artifactId}";
+        return result;
+    }
+
+}
diff --git a/opendaylight/northbound/archetype-app-northbound/src/main/resources/archetype-resources/src/main/resources/WEB-INF/web.xml b/opendaylight/northbound/archetype-app-northbound/src/main/resources/archetype-resources/src/main/resources/WEB-INF/web.xml
new file mode 100644 (file)
index 0000000..a1d8376
--- /dev/null
@@ -0,0 +1,92 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+  version="3.0">
+  <servlet>
+    <servlet-name>JAXRS${artifactId}</servlet-name>
+    <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
+    <init-param>
+      <param-name>javax.ws.rs.Application</param-name>
+      <param-value>org.opendaylight.controller.northbound.commons.NorthboundApplication</param-value>
+    </init-param>
+    <load-on-startup>1</load-on-startup>
+  </servlet>
+
+  <servlet-mapping>
+    <servlet-name>JAXRS${artifactId}</servlet-name>
+    <url-pattern>/*</url-pattern>
+  </servlet-mapping>
+
+  <filter>
+    <filter-name>CorsFilter</filter-name>
+    <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
+    <init-param>
+      <param-name>cors.allowed.origins</param-name>
+      <param-value>*</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.allowed.methods</param-name>
+      <param-value>GET,POST,HEAD,OPTIONS,PUT,DELETE</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.allowed.headers</param-name>
+      <param-value>Content-Type,X-Requested-With,accept,authorization, origin,Origin,Access-Control-Request-Method,Access-Control-Request-Headers</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.exposed.headers</param-name>
+      <param-value>Access-Control-Allow-Origin,Access-Control-Allow-Credentials</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.support.credentials</param-name>
+      <param-value>true</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.preflight.maxage</param-name>
+      <param-value>10</param-value>
+    </init-param>
+  </filter>
+  <filter-mapping>
+    <filter-name>CorsFilter</filter-name>
+    <url-pattern>/*</url-pattern>
+  </filter-mapping>
+
+  <security-constraint>
+    <web-resource-collection>
+      <web-resource-name>${artifactId}</web-resource-name>
+      <url-pattern>/*</url-pattern>
+      <http-method>POST</http-method>
+      <http-method>GET</http-method>
+      <http-method>PUT</http-method>
+      <http-method>PATCH</http-method>
+      <http-method>DELETE</http-method>
+      <http-method>HEAD</http-method>
+    </web-resource-collection>
+    <auth-constraint>
+      <role-name>System-Admin</role-name>
+      <role-name>Network-Admin</role-name>
+      <role-name>Network-Operator</role-name>
+      <role-name>Container-User</role-name>
+    </auth-constraint>
+  </security-constraint>
+
+  <security-role>
+    <role-name>System-Admin</role-name>
+  </security-role>
+  <security-role>
+    <role-name>Network-Admin</role-name>
+  </security-role>
+  <security-role>
+    <role-name>Network-Operator</role-name>
+  </security-role>
+  <security-role>
+    <role-name>Container-User</role-name>
+  </security-role>
+
+  <login-config>
+    <auth-method>BASIC</auth-method>
+    <realm-name>opendaylight</realm-name>
+  </login-config>
+</web-app>
diff --git a/opendaylight/northbound/archetype-app-northbound/src/test/resources/projects/basic/archetype.properties b/opendaylight/northbound/archetype-app-northbound/src/test/resources/projects/basic/archetype.properties
new file mode 100644 (file)
index 0000000..40d9d65
--- /dev/null
@@ -0,0 +1,5 @@
+#Fri Mar 07 21:17:20 CST 2014
+package=it.pkg
+version=0.1-SNAPSHOT
+groupId=archetype.it
+artifactId=basic
diff --git a/opendaylight/northbound/archetype-app-northbound/src/test/resources/projects/basic/goal.txt b/opendaylight/northbound/archetype-app-northbound/src/test/resources/projects/basic/goal.txt
new file mode 100644 (file)
index 0000000..e69de29
index 47bb3ffd7c72df59e0804527412a5a897dc922db..4393b79f6446463074b869918651c273ff6cfa2a 100644 (file)
@@ -12,14 +12,13 @@ import java.util.Dictionary;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
+
 import javax.ws.rs.core.Application;
 import javax.ws.rs.ext.ContextResolver;
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBException;
 import javax.xml.bind.annotation.XmlRootElement;
 
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
 import org.opendaylight.controller.northbound.bundlescanner.IBundleScanService;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
@@ -30,12 +29,14 @@ import org.osgi.framework.ServiceReference;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
+
 /**
  * Instance of javax.ws.rs.core.Application used to return the classes
  * that will be instantiated for JAXRS processing. This hooks onto the
  * bundle scanner service to provide JAXB classes to JAX-RS for prorcessing.
  */
-@SuppressWarnings("unchecked")
 public class NorthboundApplication extends Application {
     public static final String JAXRS_RESOURCES_MANIFEST_NAME = "Jaxrs-Resources";
     public static final String JAXRS_EXCLUDES_MANIFEST_NAME = "Jaxrs-Exclude-Types";
@@ -97,7 +98,7 @@ public class NorthboundApplication extends Application {
     }
 
     private static final IBundleScanService lookupBundleScanner(BundleContext ctx) {
-        ServiceReference svcRef = ctx.getServiceReference(IBundleScanService.class);
+        ServiceReference<?> svcRef = ctx.getServiceReference(IBundleScanService.class);
         if (svcRef == null) {
             throw new ServiceException("Unable to lookup IBundleScanService");
         }
index b29ce15f5621aa0c09b29bafdf080448b973b628..548bfb1f9fb26eb93ab4ca5bcd456d9bdc4082c3 100644 (file)
@@ -836,8 +836,10 @@ public class DiscoveryService implements IInventoryShimExternalListener, IDataPa
             moveToReadyListHi(dst);
         }
 
+        //checking only OF map, since production edge discovery always overwrites any existing edge
+        UpdateType ut = edgeMap.containsKey(dst) ? UpdateType.CHANGED : UpdateType.ADDED;
         // notify
-        updateEdge(edge, UpdateType.ADDED, props);
+        updateEdge(edge, ut, props);
         logger.trace("Add edge {}", edge);
     }
 
@@ -936,6 +938,7 @@ public class DiscoveryService implements IInventoryShimExternalListener, IDataPa
             return;
         }
 
+
         this.discoveryListener.notifyEdge(edge, type, props);
 
         NodeConnector src = edge.getTailNodeConnector(), dst = edge.getHeadNodeConnector();
index 0208cc7cdac4693a2ffafb42a06d54b0e11e6e71..f972ae6a6679b9b1d4cc55afe39a63b276d17ce0 100644 (file)
@@ -16,6 +16,7 @@ import org.opendaylight.controller.sal.core.UpdateType;
 
 /**
  * The class represents an Edge, the Edge's Property Set and its UpdateType.
+ * If update is on new properties added to an existing edge, appropriate type is CHANGED.
  */
 public class TopoEdgeUpdate {
     private Edge edge;
index dc341625af642395872a3e2860a9d0fcc6f1ce3b..6b303f09f11955a053f7bcf740bf9f647b5df2ce 100644 (file)
@@ -355,9 +355,7 @@ public abstract class NetUtils {
      */
     public static boolean isMulticastMACAddr(byte[] MACAddress) {
         if (MACAddress.length == MACAddrLengthInBytes && !isBroadcastMACAddr(MACAddress)) {
-            if (MACAddress[0] % 2 == 1) {
-                return true;
-            }
+            return (MACAddress[0] & 1) != 0;
         }
         return false;
     }
index a2b12782ac2986f24cfd6fbe8f295f5ef105712d..e5e0a0941b7db0ccb6b647b313096f64def5fa90 100644 (file)
@@ -468,4 +468,35 @@ public class NetUtilsTest {
         Assert.assertEquals(32768, NetUtils.getUnsignedShort((short) 0x8000));
         Assert.assertEquals(65535, NetUtils.getUnsignedShort((short) 0xffff));
     }
+
+    @Test
+    public void testMulticastMACAddr() {
+        byte[] empty = new byte[0];
+        Assert.assertFalse(NetUtils.isUnicastMACAddr(empty));
+        Assert.assertFalse(NetUtils.isMulticastMACAddr(empty));
+
+        byte[] bcast = {
+            (byte)0xff, (byte)0xff, (byte)0xff,
+            (byte)0xff, (byte)0xff, (byte)0xff,
+        };
+        Assert.assertFalse(NetUtils.isUnicastMACAddr(bcast));
+        Assert.assertFalse(NetUtils.isMulticastMACAddr(bcast));
+
+        byte[] firstOctet = {
+            (byte)0x00, (byte)0x20, (byte)0x80, (byte)0xfe,
+        };
+        for (int len = 1; len <= 10; len++) {
+            byte[] ba = new byte[len];
+            boolean valid = (len == 6);
+            for (byte first: firstOctet) {
+                ba[0] = first;
+                Assert.assertFalse(NetUtils.isMulticastMACAddr(ba));
+                Assert.assertEquals(valid, NetUtils.isUnicastMACAddr(ba));
+
+                ba[0] |= (byte)0x01;
+                Assert.assertEquals(valid, NetUtils.isMulticastMACAddr(ba));
+                Assert.assertFalse(NetUtils.isUnicastMACAddr(ba));
+            }
+        }
+    }
 }
index cc1a8b868d3d376c9eb4a66b5443707adbfbff31..ff1c026a344d74efa5aa1f1b57e05e60775cd1a4 100644 (file)
@@ -573,6 +573,13 @@ public class TopologyManagerImpl implements
         switch (type) {
         case ADDED:
 
+
+            if (this.edgesDB.containsKey(e)) {
+                // Avoid redundant updates (e.g. cluster switch-over) as notifications trigger expensive tasks
+                log.trace("Skipping redundant edge addition: {}", e);
+                return null;
+            }
+
             // Make sure the props are non-null or create a copy
             if (props == null) {
                 props = new HashSet<Property>();
@@ -580,19 +587,6 @@ public class TopologyManagerImpl implements
                 props = new HashSet<Property>(props);
             }
 
-            Set<Property> currentProps = this.edgesDB.get(e);
-            if (currentProps != null) {
-
-                if (currentProps.equals(props)) {
-                    // Avoid redundant updates as notifications trigger expensive tasks
-                    log.trace("Skipping redundant edge addition: {}", e);
-                    return null;
-                }
-
-                // In case of node switch-over to a different cluster controller,
-                // let's retain edge props (e.g. creation time)
-                props.addAll(currentProps);
-            }
 
             // Ensure that head node connector exists
             if (!headNodeConnectorExist(e)) {
@@ -654,10 +648,9 @@ public class TopologyManagerImpl implements
         case CHANGED:
             Set<Property> oldProps = this.edgesDB.get(e);
 
-            // When property changes lets make sure we can change it
+            // When property(s) changes lets make sure we can change it
             // all except the creation time stamp because that should
-            // be changed only when the edge is destroyed and created
-            // again
+            // be set only when the edge is created
             TimeStamp timeStamp = null;
             for (Property prop : oldProps) {
                 if (prop instanceof TimeStamp) {
index a118ccfbba70658fd4e2c817ea5a9e60bce7b500..e4bb790676379bfb508ea6b6eec4051a38286636 100644 (file)
@@ -23,7 +23,6 @@ import java.util.concurrent.ConcurrentMap;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import com.fasterxml.jackson.databind.ObjectMapper;
 import org.opendaylight.controller.connectionmanager.IConnectionManager;
 import org.opendaylight.controller.forwarding.staticrouting.IForwardingStaticRouting;
 import org.opendaylight.controller.forwarding.staticrouting.StaticRouteConfig;
@@ -60,6 +59,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
 import com.google.gson.Gson;
 import com.google.gson.reflect.TypeToken;
 
@@ -145,21 +145,21 @@ public class Devices implements IDaylightWeb {
                     for (NodeConnector nodeConnector : nodeConnectorSet) {
                         String nodeConnectorNumberToStr = nodeConnector.getID().toString();
                         Name ncName = ((Name) switchManager.getNodeConnectorProp(nodeConnector, Name.NamePropName));
-                        Config portStatus = ((Config) switchManager.getNodeConnectorProp(nodeConnector,
+                        Config portConfig = ((Config) switchManager.getNodeConnectorProp(nodeConnector,
                                 Config.ConfigPropName));
                         State portState = ((State) switchManager.getNodeConnectorProp(nodeConnector,
                                 State.StatePropName));
                         String nodeConnectorName = (ncName != null) ? ncName.getValue() : "";
                         nodeConnectorName += " (" + nodeConnector.getID() + ")";
 
-                        if (portStatus != null) {
-                            if (portStatus.getValue() == Config.ADMIN_UP) {
-                                if (portState.getValue() == State.EDGE_UP) {
+                        if (portConfig != null) {
+                            if (portConfig.getValue() == Config.ADMIN_UP) {
+                                if (portState != null && portState.getValue() == State.EDGE_UP) {
                                     nodeConnectorName = "<span class='admin-up'>" + nodeConnectorName + "</span>";
-                                } else if (portState.getValue() == State.EDGE_DOWN) {
+                                } else if (portState == null || portState.getValue() == State.EDGE_DOWN) {
                                     nodeConnectorName = "<span class='edge-down'>" + nodeConnectorName + "</span>";
                                 }
-                            } else if (portStatus.getValue() == Config.ADMIN_DOWN) {
+                            } else if (portConfig.getValue() == Config.ADMIN_DOWN) {
                                 nodeConnectorName = "<span class='admin-down'>" + nodeConnectorName + "</span>";
                             }
                         }