Changeset 16 for src/main/java/geniusweb
- Timestamp:
- 09/22/20 08:52:08 (4 years ago)
- 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 28 28 import geniusweb.profile.utilityspace.LinearAdditive; 29 29 import geniusweb.profilesserver.Jackson; 30 import geniusweb.profilesserver.Profiles Factory;30 import geniusweb.profilesserver.ProfilesRepository; 31 31 import geniusweb.profilesserver.events.ChangeEvent; 32 32 import tudelft.utilities.immutablelist.FixedList; … … 38 38 * and profiles. Every time something changes, a new list of domains and 39 39 * profiles is sent. For each new websocket the server will create one of this 40 * but they all share one {@link Profiles Factory}.40 * but they all share one {@link ProfilesRepository}. 41 41 * 42 42 * <p> … … 80 80 }; 81 81 sendupdatedProfile(); 82 Profiles. factory.addListener(changeListener);82 Profiles.repository.addListener(changeListener); 83 83 } 84 84 85 85 private void sendupdatedProfile() { 86 Profile newprof = Profiles. factory.getProfile(profilename);86 Profile newprof = Profiles.repository.getProfile(profilename); 87 87 // notice, may be null if profile does not exist/was removed. 88 88 if (newprof == null ? prof != null : !newprof.equals(prof)) { … … 164 164 @OnClose 165 165 public void end() throws IOException { 166 Profiles. factory.removeListener(changeListener);166 Profiles.repository.removeListener(changeListener); 167 167 } 168 168 -
src/main/java/geniusweb/profilesserver/websocket/Profiles.java
r1 r16 1 1 package geniusweb.profilesserver.websocket; 2 2 3 import geniusweb.profilesserver.AutoUpdatingProfiles Factory;4 import geniusweb.profilesserver.Profiles Factory;3 import geniusweb.profilesserver.AutoUpdatingProfilesRepository; 4 import geniusweb.profilesserver.ProfilesRepository; 5 5 import tudelft.utilities.logging.ReportToLogger; 6 6 7 7 /** 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. 9 9 * 10 10 */ 11 11 class Profiles { 12 public static final ProfilesFactory factory = new AutoUpdatingProfilesFactory(new ReportToLogger("profilesserver")); 12 public static final ProfilesRepository repository = new AutoUpdatingProfilesRepository( 13 new ReportToLogger("profilesserver")); 13 14 } -
src/main/java/geniusweb/profilesserver/websocket/ProfilesListSocket.java
r8 r16 25 25 26 26 import geniusweb.profilesserver.Jackson; 27 import geniusweb.profilesserver.Profiles Factory;27 import geniusweb.profilesserver.ProfilesRepository; 28 28 import geniusweb.profilesserver.events.ChangeEvent; 29 29 import tudelft.utilities.listener.Listener; … … 35 35 * and profiles. Every time something changes, a new list of domains and 36 36 * profiles is sent. For each new websocket the server will create one of this 37 * but they all share one {@link Profiles Factory}.37 * but they all share one {@link ProfilesRepository}. 38 38 */ 39 39 @ServerEndpoint("/websocket/liststream") … … 71 71 } 72 72 }; 73 Profiles. factory.addListener(changeListener);73 Profiles.repository.addListener(changeListener); 74 74 } 75 75 … … 90 90 private Map<URI, List<URI>> getDomainsProfiles() { 91 91 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() 94 94 .map(profile -> makeURI(domain, profile.getName())) 95 95 .collect(Collectors.toList()); … … 153 153 @OnClose 154 154 public void end() throws IOException { 155 Profiles. factory.removeListener(changeListener);155 Profiles.repository.removeListener(changeListener); 156 156 } 157 157
Note:
See TracChangeset
for help on using the changeset viewer.