Move event and metadata handling into abstract base class.
[sonitus.git] / src / main / java / net / pterodactylus / sonitus / data / filter / DummyFilter.java
index 4b23c06..ae6899d 100644 (file)
@@ -31,9 +31,7 @@ import net.pterodactylus.sonitus.data.AbstractControlledComponent;
 import net.pterodactylus.sonitus.data.Controller;
 import net.pterodactylus.sonitus.data.Filter;
 import net.pterodactylus.sonitus.data.Metadata;
-import net.pterodactylus.sonitus.data.event.MetadataUpdated;
 
-import com.google.common.eventbus.EventBus;
 import com.google.common.io.Closeables;
 
 /**
@@ -43,32 +41,20 @@ import com.google.common.io.Closeables;
  */
 public class DummyFilter extends AbstractControlledComponent implements Filter {
 
-       /** The name of this filter. */
-       private final String name;
-
-       /** The event bus. */
-       private final EventBus eventBus;
-
        /** The input stream from which to read. */
        private InputStream inputStream;
 
        /** The output stream to which to write. */
        private OutputStream outputStream;
 
-       /** The current metadata. */
-       private Metadata metadata;
-
        /**
         * Creates a new dummy filter with the given name.
         *
-        * @param eventBus
-        *              The event bus
         * @param name
         *              The name of the filter
         */
-       public DummyFilter(EventBus eventBus, String name) {
-               this.eventBus = eventBus;
-               this.name = name;
+       public DummyFilter(String name) {
+               super(name);
        }
 
        //
@@ -76,11 +62,6 @@ public class DummyFilter extends AbstractControlledComponent implements Filter {
        //
 
        @Override
-       public String name() {
-               return name;
-       }
-
-       @Override
        public List<Controller<?>> controllers() {
                return Collections.emptyList();
        }
@@ -107,18 +88,6 @@ public class DummyFilter extends AbstractControlledComponent implements Filter {
        }
 
        @Override
-       public Metadata metadata() {
-               return metadata;
-       }
-
-       @Override
-       public void metadataUpdated(Metadata metadata) {
-               this.metadata = metadata;
-               fireMetadataUpdated(metadata);
-               eventBus.post(new MetadataUpdated(this, metadata));
-       }
-
-       @Override
        public void process(byte[] buffer) throws IOException {
                outputStream.write(buffer);
                outputStream.flush();