// Path: core/src/main/java/edu/jhuapl/dorset/users/User.java
// public class User {
// 
//     public static String ID = "Dorset-id";
//     public static String USERNAME = "Dorset-userName";
//     public static String FIRSTNAME = "Dorset-firstName";
//     public static String LASTNAME = "Dorset-lastName";
//     public static String LOCATION = "Dorset-location";
//     public static String EMAIL = "Dorset-email";
//     public static String DOB = "Dorset-dob";
// 
//     protected Map<String, String> userInformation = new HashMap<String, String>();
// 
//     public String getId() {
//         return userInformation.get(ID);
//     }
// 
//     public void setId(String id) {
//         this.setUserInformation(ID, id);
//     }
// 
//     public String getUserName() {
//         return userInformation.get(USERNAME);
//     }
// 
//     public void setUserName(String userName) {
//         this.setUserInformation(USERNAME, userName);
//     }
// 
//     public String getFirstName() {
//         return userInformation.get(FIRSTNAME);
//     }
// 
//     public void setFirstName(String firstName) {
//         this.setUserInformation(FIRSTNAME, firstName);
//     }
// 
//     public String getLastName() {
//         return userInformation.get(LASTNAME);
//     }
// 
//     public void setLastName(String lastName) {
//         this.setUserInformation(LASTNAME, lastName);
//     }
// 
//     public String getLocation() {
//         return userInformation.get(LOCATION);
//     }
// 
//     public void setLocation(String location) {
//         this.setUserInformation(LOCATION, location);
//     }
// 
//     public String getEmail() {
//         return userInformation.get(EMAIL);
//     }
// 
//     public void setEmail(String email) {
//         this.setUserInformation(EMAIL, email);
//     }
// 
//     public String getDob() {
//         return userInformation.get(DOB);
//     }
// 
//     public void setDob(String dob) {
//         this.setUserInformation(DOB, dob);
//     }
// 
//     public void setUserInformation(String key, String value) {
//         userInformation.put(key, value);
//     }
// 
//     public String getUserInformation(String key) {
//         return userInformation.get(key);
//     }
// 
//     public Set<String> getUserInformationKeys() {
//         return userInformation.keySet();
//     }
//     
//     public void removeUserInformation(String key) {
//         userInformation.remove(key);
//     }
// }
// 
// Path: core/src/main/java/edu/jhuapl/dorset/users/UserException.java
// public class UserException extends Exception {
// 
//     private static final long serialVersionUID = 1L;
// 
//     public UserException(String errorMessage) {
//         super(errorMessage);
//     }
// 
// }
// 
// Path: core/src/main/java/edu/jhuapl/dorset/users/UserService.java
// public interface UserService {
// 
//     public String create(User user) throws UserException;
// 
//     public String retrieve(Properties properties) throws UserException;
//     
//     public void update(String id, User user) throws UserException;
// 
//     public void delete(String id);
//     
//     public User getUser(String id);
//     
// }


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import edu.jhuapl.dorset.users.User;
import edu.jhuapl.dorset.users.UserException;
import edu.jhuapl.dorset.users.UserService;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
/*
 * Copyright 2016 The Johns Hopkins University Applied Physics Laboratory LLC
 * All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package edu.jhuapl.dorset.fileuserservice;





/**
 * FileUserService userservice
 *
 * FileUserService is a file-based UserService that leverages property files to maintain a set of
 * Users. All User files are stored in a single directory and each User has a single User file. The
 * naming convention for the set of files includes a base name that is uniform across all users then
 * a dash followed by the corresponding Username. Example:
 * "path/to/user/files/example-jdoe.properties."
 */
public class FileUserService implements UserService {
    private static final Logger logger = LoggerFactory.getLogger(FileUserService.class);

// Path: core/src/main/java/edu/jhuapl/dorset/users/User.java
// public class User {
// 
//     public static String ID = "Dorset-id";
//     public static String USERNAME = "Dorset-userName";
//     public static String FIRSTNAME = "Dorset-firstName";
//     public static String LASTNAME = "Dorset-lastName";
//     public static String LOCATION = "Dorset-location";
//     public static String EMAIL = "Dorset-email";
//     public static String DOB = "Dorset-dob";
// 
//     protected Map<String, String> userInformation = new HashMap<String, String>();
// 
//     public String getId() {
//         return userInformation.get(ID);
//     }
// 
//     public void setId(String id) {
//         this.setUserInformation(ID, id);
//     }
// 
//     public String getUserName() {
//         return userInformation.get(USERNAME);
//     }
// 
//     public void setUserName(String userName) {
//         this.setUserInformation(USERNAME, userName);
//     }
// 
//     public String getFirstName() {
//         return userInformation.get(FIRSTNAME);
//     }
// 
//     public void setFirstName(String firstName) {
//         this.setUserInformation(FIRSTNAME, firstName);
//     }
// 
//     public String getLastName() {
//         return userInformation.get(LASTNAME);
//     }
// 
//     public void setLastName(String lastName) {
//         this.setUserInformation(LASTNAME, lastName);
//     }
// 
//     public String getLocation() {
//         return userInformation.get(LOCATION);
//     }
// 
//     public void setLocation(String location) {
//         this.setUserInformation(LOCATION, location);
//     }
// 
//     public String getEmail() {
//         return userInformation.get(EMAIL);
//     }
// 
//     public void setEmail(String email) {
//         this.setUserInformation(EMAIL, email);
//     }
// 
//     public String getDob() {
//         return userInformation.get(DOB);
//     }
// 
//     public void setDob(String dob) {
//         this.setUserInformation(DOB, dob);
//     }
// 
//     public void setUserInformation(String key, String value) {
//         userInformation.put(key, value);
//     }
// 
//     public String getUserInformation(String key) {
//         return userInformation.get(key);
//     }
// 
//     public Set<String> getUserInformationKeys() {
//         return userInformation.keySet();
//     }
//     
//     public void removeUserInformation(String key) {
//         userInformation.remove(key);
//     }
// }
// 
// Path: core/src/main/java/edu/jhuapl/dorset/users/UserException.java
// public class UserException extends Exception {
// 
//     private static final long serialVersionUID = 1L;
// 
//     public UserException(String errorMessage) {
//         super(errorMessage);
//     }
// 
// }
// 
// Path: core/src/main/java/edu/jhuapl/dorset/users/UserService.java
// public interface UserService {
// 
//     public String create(User user) throws UserException;
// 
//     public String retrieve(Properties properties) throws UserException;
//     
//     public void update(String id, User user) throws UserException;
// 
//     public void delete(String id);
//     
//     public User getUser(String id);
//     
// }


// Path: components/user-service/src/main/java/edu/jhuapl/dorset/fileuserservice/FileUserService.java
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import edu.jhuapl.dorset.users.User;
import edu.jhuapl.dorset.users.UserException;
import edu.jhuapl.dorset.users.UserService;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import java.util.Set;

/*
 * Copyright 2016 The Johns Hopkins University Applied Physics Laboratory LLC
 * All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package edu.jhuapl.dorset.fileuserservice;





/**
 * FileUserService userservice
 *
 * FileUserService is a file-based UserService that leverages property files to maintain a set of
 * Users. All User files are stored in a single directory and each User has a single User file. The
 * naming convention for the set of files includes a base name that is uniform across all users then
 * a dash followed by the corresponding Username. Example:
 * "path/to/user/files/example-jdoe.properties."
 */
public class FileUserService implements UserService {
    private static final Logger logger = LoggerFactory.getLogger(FileUserService.class);

    private Map<String, User> users;