import Ice.Current;
import VideoStreaming.Stream;
import java.util.ArrayList;
import java.util.List;

public class PortalI extends VideoStreaming._PortalDisp {
    private List<Stream> Streams = new ArrayList<Stream>();

    // Calls from Streaming Servers
    public void register(Stream stream, Current current) {
        Streams.add(stream);
    }

    public void remove(Stream stream, Current current) {
        Streams.remove(stream);
    }

    // Calls from Clients
    public List<Stream> getStreams(Current current) {
        return Streams;
    }
}

@@ -4,19 +4,35 @@
 ort 
-Ice.Current
+Streaming.NotifierPrxHelper
 ;%0Aim
@@ -36,21 +36,16 @@
 %0Aimport 
-Video
 Streamin
@@ -54,16 +54,17 @@
 Stream;%0A
+%0A
 import j
@@ -76,40 +76,96 @@
 til.
-ArrayList;%0Aimport java.util.List
+HashMap;%0Aimport java.util.List;%0Aimport java.util.Map;%0Aimport java.util.stream.Collectors
 ;%0A%0Ap
@@ -196,13 +196,8 @@
 nds 
-Video
 Stre
@@ -232,55 +232,1447 @@
 ate 
-List%3CStream%3E Streams = new ArrayList%3CStream%3E();
+Map%3CStream, Long%3E Streams = new HashMap%3CStream, Long%3E();%0A    Streaming.NotifierPrx Notifier = null;%0A%0A    PortalI() %7B%0A        Ice.ObjectPrx obj = Ice.Application.communicator().propertyToProxy(%22TopicManager.Proxy%22);%0A        IceStorm.TopicManagerPrx manager = IceStorm.TopicManagerPrxHelper.checkedCast(obj);%0A        if (manager == null) %7B%0A            System.err.println(%22Invalid proxy%22);%0A            return;%0A        %7D%0A%0A        IceStorm.TopicPrx topic = null;%0A        while (topic == null) %7B%0A            try %7B%0A                topic = manager.retrieve(%22Streams%22);%0A            %7D catch (IceStorm.NoSuchTopic e) %7B%0A                try %7B%0A                    topic = manager.create(%22Streams%22);%0A                %7D catch (IceStorm.TopicExists ex) %7B%0A                    System.err.println(%22Temporary failure%22);%0A                    return;%0A                %7D%0A            %7D%0A        %7D%0A%0A        Ice.ObjectPrx publisher = topic.getPublisher().ice_oneway();%0A        Notifier = NotifierPrxHelper.uncheckedCast(publisher);%0A%0A        new Thread(() -%3E %7B%0A            while (true) %7B%0A                for (Stream s : Streams.keySet())%0A                    if (System.currentTimeMillis() - Streams.get(s) %3E= 60000)%0A                        Streams.remove(s);%0A                try %7B%0A                    Thread.sleep(60000);%0A                %7D catch (InterruptedException e) %7B%0A                    e.printStackTrace();%0A                %7D%0A            %7D%0A        %7D).start();%0A    %7D
 %0A%0A  
@@ -1737,32 +1737,36 @@
 (Stream stream, 
+Ice.
 Current current)
@@ -1788,18 +1788,130 @@
 ams.
-add(stream
+put(stream, System.currentTimeMillis());%0A        Notifier.inform(String.format(%22%5B%25s: %25s%5D%22, %22New Stream%22, stream.getName())
 );%0A 
@@ -1954,16 +1954,20 @@
 stream, 
+Ice.
 Current 
@@ -2017,113 +2017,597 @@
     
-%7D%0A%0A    // Calls from Clients%0A    public List%3CStream%3E getStreams(Current current) %7B%0A        return Streams
+    Notifier.inform(String.format(%22%5B%25s: %25s%5D%22, %22Removed Stream%22, stream.getName()));%0A    %7D%0A%0A    public void update(Stream stream, Ice.Current current) %7B%0A        if (Streams.get(stream) != null)%0A            Streams.put(stream, System.currentTimeMillis());%0A    %7D%0A%0A    // Calls from Clients%0A    public Stream get(String stream, Ice.Current current) %7B%0A        for (Stream s : Streams.keySet())%0A            if (s.name.equals(stream)) return s;%0A        return null;%0A    %7D%0A%0A    public List%3CStream%3E getAll(Ice.Current current) %7B%0A        return Streams.keySet().stream().collect(Collectors.toList())
 ;%0A  

Implement lots of new methods