diff options
Diffstat (limited to 'framework/src/onos/apps/vtn/vtnrsc')
3 files changed, 34 insertions, 8 deletions
diff --git a/framework/src/onos/apps/vtn/vtnrsc/pom.xml b/framework/src/onos/apps/vtn/vtnrsc/pom.xml index 816624cb..a2905909 100644 --- a/framework/src/onos/apps/vtn/vtnrsc/pom.xml +++ b/framework/src/onos/apps/vtn/vtnrsc/pom.xml @@ -21,7 +21,7 @@ <parent> <groupId>org.onosproject</groupId> <artifactId>onos-app-vtn</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.4.0-rc1</version> <relativePath>../pom.xml</relativePath> </parent> diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/FlowClassifierService.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/FlowClassifierService.java index 48438846..e3cbf9ac 100644 --- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/FlowClassifierService.java +++ b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/FlowClassifierService.java @@ -15,14 +15,13 @@ */ package org.onosproject.vtnrsc.flowclassifier; -import org.onosproject.event.ListenerService; import org.onosproject.vtnrsc.FlowClassifier; import org.onosproject.vtnrsc.FlowClassifierId; /** * Provides Services for Flow Classifier. */ -public interface FlowClassifierService extends ListenerService<FlowClassifierEvent, FlowClassifierListener> { +public interface FlowClassifierService { /** * Check whether Flow Classifier is present based on given Flow Classifier @@ -80,4 +79,18 @@ public interface FlowClassifierService extends ListenerService<FlowClassifierEve * false */ boolean removeFlowClassifier(FlowClassifierId id); + + /** + * Adds the specified listener to Flow-Classifier manager. + * + * @param listener Flow-Classifier listener + */ + void addListener(FlowClassifierListener listener); + + /** + * Removes the specified listener to Flow-Classifier manager. + * + * @param listener Flow-Classifier listener + */ + void removeListener(FlowClassifierListener listener); } diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/impl/FlowClassifierManager.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/impl/FlowClassifierManager.java index 18f63b30..b29dc7a3 100644 --- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/impl/FlowClassifierManager.java +++ b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/impl/FlowClassifierManager.java @@ -25,7 +25,6 @@ import org.apache.felix.scr.annotations.Reference; import org.apache.felix.scr.annotations.ReferenceCardinality; import org.apache.felix.scr.annotations.Service; import org.onlab.util.KryoNamespace; -import org.onosproject.event.AbstractListenerManager; import org.onosproject.store.serializers.KryoNamespaces; import org.onosproject.store.service.EventuallyConsistentMap; import org.onosproject.store.service.MultiValuedTimestamp; @@ -33,27 +32,28 @@ import org.onosproject.store.service.StorageService; import org.onosproject.store.service.WallClockTimestamp; import org.onosproject.vtnrsc.FlowClassifierId; import org.onosproject.vtnrsc.FlowClassifier; -import org.onosproject.vtnrsc.flowclassifier.FlowClassifierEvent; import org.onosproject.vtnrsc.flowclassifier.FlowClassifierListener; import org.onosproject.vtnrsc.flowclassifier.FlowClassifierService; import org.slf4j.Logger; +import java.util.Set; + import com.google.common.collect.ImmutableList; +import com.google.common.collect.Sets; /** * Provides implementation of the Flow Classifier Service. */ @Component(immediate = true) @Service -public class FlowClassifierManager extends AbstractListenerManager<FlowClassifierEvent, FlowClassifierListener> - implements FlowClassifierService { +public class FlowClassifierManager implements FlowClassifierService { private static final String FLOW_CLASSIFIER_NOT_NULL = "Flow Classifier cannot be null"; private static final String FLOW_CLASSIFIER_ID_NOT_NULL = "Flow Classifier Id cannot be null"; private static final String LISTENER_NOT_NULL = "Listener cannot be null"; private final Logger log = getLogger(FlowClassifierManager.class); - + private final Set<FlowClassifierListener> listeners = Sets.newCopyOnWriteArraySet(); private EventuallyConsistentMap<FlowClassifierId, FlowClassifier> flowClassifierStore; @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) @@ -75,6 +75,7 @@ public class FlowClassifierManager extends AbstractListenerManager<FlowClassifie @Deactivate protected void deactivate() { flowClassifierStore.destroy(); + listeners.clear(); log.info("Flow Classifier service deactivated"); } @@ -144,4 +145,16 @@ public class FlowClassifierManager extends AbstractListenerManager<FlowClassifie } return true; } + + @Override + public void addListener(FlowClassifierListener listener) { + checkNotNull(listener, LISTENER_NOT_NULL); + listeners.add(listener); + } + + @Override + public void removeListener(FlowClassifierListener listener) { + checkNotNull(listener, LISTENER_NOT_NULL); + listeners.remove(listener); + } } |