Changeset 9 for profileconnection


Ignore:
Timestamp:
11/28/19 14:40:48 (5 years ago)
Author:
bart
Message:

Release 1.1.0

Location:
profileconnection
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • profileconnection/pom.xml

    r6 r9  
    66        <groupId>geniusweb</groupId>
    77        <artifactId>profileconnection</artifactId>
    8         <version>1.0.0</version>
     8        <version>1.1.0</version>
    99        <packaging>jar</packaging>
    1010
     
    1616                <basedir>.</basedir>
    1717                <passwd>${env.ARTIFACTORY_PASS}</passwd>
    18                 <jackson-2-version>2.9.6</jackson-2-version>
     18                <jackson-2-version>2.9.10</jackson-2-version>
    1919        </properties>
    2020
     
    3131                        <groupId>geniusweb</groupId>
    3232                        <artifactId>profile</artifactId>
    33                         <version>1.0.0</version>
     33                        <version>1.1.0</version>
    3434                </dependency>
    3535
  • profileconnection/src/main/java/geniusweb/profileconnection/FileProfileConnector.java

    r2 r9  
    1010
    1111import geniusweb.profile.Profile;
     12import tudelft.utilities.listener.DefaultListenable;
    1213
    1314/**
    1415 * ProfileInterface based on a plain filesystem UTF8 file.
    1516 */
    16 public class FileProfileConnector implements ProfileInterface {
     17public class FileProfileConnector extends DefaultListenable<Profile>
     18                implements ProfileInterface {
    1719        private final static ObjectMapper jackson = new ObjectMapper();
    1820        private final Profile profile;
     
    2527        public FileProfileConnector(String filename) throws IOException {
    2628                Path path = new File(filename).toPath();
    27                 String serialized = new String(Files.readAllBytes(path), StandardCharsets.UTF_8);
     29                String serialized = new String(Files.readAllBytes(path),
     30                                StandardCharsets.UTF_8);
    2831                profile = jackson.readValue(serialized, Profile.class);
    2932        }
  • profileconnection/src/main/java/geniusweb/profileconnection/ProfileInterface.java

    r1 r9  
    22
    33import geniusweb.profile.Profile;
     4import tudelft.utilities.listener.Listenable;
    45
    56/**
    67 * A container holding a modifyable profile. This interface allows testing.
    78 */
    8 public interface ProfileInterface {
     9public interface ProfileInterface extends Listenable<Profile> {
    910
    1011        /**
  • profileconnection/src/main/java/geniusweb/profileconnection/WebsocketProfileConnector.java

    r1 r9  
    1515
    1616import geniusweb.profile.Profile;
     17import tudelft.utilities.listener.DefaultListenable;
    1718import tudelft.utilities.logging.Reporter;
    1819
     
    2122 */
    2223@ClientEndpoint
    23 public class WebsocketProfileConnector implements ProfileInterface {
     24public class WebsocketProfileConnector extends DefaultListenable<Profile>
     25                implements ProfileInterface {
    2426        private final static ObjectMapper jackson = new ObjectMapper();
    2527        private static final int TIMEOUT_MS = 2000;
     
    5658                // this will be called every time the profile changes.
    5759                logger.log(Level.FINE, "Received profile: " + message);
    58                 this.profile = jackson.readValue(message, Profile.class);
     60                profile = jackson.readValue(message, Profile.class);
     61                notifyListeners(profile);
    5962        }
    6063
Note: See TracChangeset for help on using the changeset viewer.