Changeset 16 for src/main/java


Ignore:
Timestamp:
09/22/20 08:52:08 (4 years ago)
Author:
bart
Message:

Version 1.5.

Location:
src/main/java/geniusweb/profilesserver
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/geniusweb/profilesserver/websocket/GetProfileSocket.java

    r13 r16  
    2828import geniusweb.profile.utilityspace.LinearAdditive;
    2929import geniusweb.profilesserver.Jackson;
    30 import geniusweb.profilesserver.ProfilesFactory;
     30import geniusweb.profilesserver.ProfilesRepository;
    3131import geniusweb.profilesserver.events.ChangeEvent;
    3232import tudelft.utilities.immutablelist.FixedList;
     
    3838 * and profiles. Every time something changes, a new list of domains and
    3939 * profiles is sent. For each new websocket the server will create one of this
    40  * but they all share one {@link ProfilesFactory}.
     40 * but they all share one {@link ProfilesRepository}.
    4141 *
    4242 * <p>
     
    8080                };
    8181                sendupdatedProfile();
    82                 Profiles.factory.addListener(changeListener);
     82                Profiles.repository.addListener(changeListener);
    8383        }
    8484
    8585        private void sendupdatedProfile() {
    86                 Profile newprof = Profiles.factory.getProfile(profilename);
     86                Profile newprof = Profiles.repository.getProfile(profilename);
    8787                // notice, may be null if profile does not exist/was removed.
    8888                if (newprof == null ? prof != null : !newprof.equals(prof)) {
     
    164164        @OnClose
    165165        public void end() throws IOException {
    166                 Profiles.factory.removeListener(changeListener);
     166                Profiles.repository.removeListener(changeListener);
    167167        }
    168168
  • src/main/java/geniusweb/profilesserver/websocket/Profiles.java

    r1 r16  
    11package geniusweb.profilesserver.websocket;
    22
    3 import geniusweb.profilesserver.AutoUpdatingProfilesFactory;
    4 import geniusweb.profilesserver.ProfilesFactory;
     3import geniusweb.profilesserver.AutoUpdatingProfilesRepository;
     4import geniusweb.profilesserver.ProfilesRepository;
    55import tudelft.utilities.logging.ReportToLogger;
    66
    77/**
    8  * Just a shared copy of the profiles factory, for use with all websockets.
     8 * Just a shared copy of the profiles repository, for use with all websockets.
    99 *
    1010 */
    1111class Profiles {
    12         public static final ProfilesFactory factory = new AutoUpdatingProfilesFactory(new ReportToLogger("profilesserver"));
     12        public static final ProfilesRepository repository = new AutoUpdatingProfilesRepository(
     13                        new ReportToLogger("profilesserver"));
    1314}
  • src/main/java/geniusweb/profilesserver/websocket/ProfilesListSocket.java

    r8 r16  
    2525
    2626import geniusweb.profilesserver.Jackson;
    27 import geniusweb.profilesserver.ProfilesFactory;
     27import geniusweb.profilesserver.ProfilesRepository;
    2828import geniusweb.profilesserver.events.ChangeEvent;
    2929import tudelft.utilities.listener.Listener;
     
    3535 * and profiles. Every time something changes, a new list of domains and
    3636 * profiles is sent. For each new websocket the server will create one of this
    37  * but they all share one {@link ProfilesFactory}.
     37 * but they all share one {@link ProfilesRepository}.
    3838 */
    3939@ServerEndpoint("/websocket/liststream")
     
    7171                        }
    7272                };
    73                 Profiles.factory.addListener(changeListener);
     73                Profiles.repository.addListener(changeListener);
    7474        }
    7575
     
    9090        private Map<URI, List<URI>> getDomainsProfiles() {
    9191                Map<URI, List<URI>> allprofiles = new HashMap<>();
    92                 for (String domain : Profiles.factory.getDomains()) {
    93                         List<URI> profiles = Profiles.factory.getProfiles(domain).stream()
     92                for (String domain : Profiles.repository.getDomains()) {
     93                        List<URI> profiles = Profiles.repository.getProfiles(domain).stream()
    9494                                        .map(profile -> makeURI(domain, profile.getName()))
    9595                                        .collect(Collectors.toList());
     
    153153        @OnClose
    154154        public void end() throws IOException {
    155                 Profiles.factory.removeListener(changeListener);
     155                Profiles.repository.removeListener(changeListener);
    156156        }
    157157
Note: See TracChangeset for help on using the changeset viewer.