Merge "Topology Manager to avoid redundant edge updates"
authorAlessandro Boch <aboch@cisco.com>
Tue, 11 Mar 2014 15:47:57 +0000 (15:47 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 11 Mar 2014 15:47:57 +0000 (15:47 +0000)
22 files changed:
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/data/SynchronizedTransaction.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/NotificationBrokerImpl.xtend
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-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-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]

index 08029dc..b94695b 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 24ca2a3..6e8bda5 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 d7cb926..da6d46d 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 bf82302..fe2681f 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 64c1ad3..7d7e56d 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 efa02e0..8f367de 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 f6662c3..22c5fa0 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 4b6a018..3ceeb7e 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 652eab1..aa22b90 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 5d93f4e..dc554a0 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 bbe017f..b298a02 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 8a15d84..cd26c4e 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 3272ce5..c08f329 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 7f9cc8f..c2ff3b8 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 a484154..e1d6980 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

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.