import java.util.Collections;
import java.util.List;
import java.util.Properties;
+import java.util.logging.Logger;
import net.pterodactylus.util.io.Closer;
+import net.pterodactylus.util.logging.Logging;
/**
* Manages projects, taking care of persistence, lifetime statistics, and other
*/
public class ProjectManager {
+ /** Logger. */
+ private static final Logger logger = Logging.getLogger(ProjectManager.class.getName());
+
/** The directory the projects are stored in. */
private final String directory;
project.setDescription(projectDescription);
project.setPrivateKey(projectPrivateKey);
project.setPublicKey(projectPublicKey);
+ projects.add(project);
+ logger.fine("loaded project “" + project.getName() + "”.");
projectIndex++;
}
}
int projectIndex = 0;
for (Project project: projects) {
String projectPrefix = "projects." + projectIndex;
- projectProperties.setProperty("projects." + projectPrefix + ".name", project.getName());
- projectProperties.setProperty("projects." + projectPrefix + ".description", project.getDescription());
- projectProperties.setProperty("projects." + projectPrefix + ".privateKey", project.getPrivateKey());
- projectProperties.setProperty("projects." + projectPrefix + ".publicKey", project.getPublicKey());
+ projectProperties.setProperty(projectPrefix + ".name", project.getName());
+ projectProperties.setProperty(projectPrefix + ".description", project.getDescription());
+ projectProperties.setProperty(projectPrefix + ".privateKey", project.getPrivateKey());
+ projectProperties.setProperty(projectPrefix + ".publicKey", project.getPublicKey());
projectIndex++;
}
File projectFile = new File(directoryFile, "projects.properties");
project.setPrivateKey(keyPair[0]);
project.setPublicKey(keyPair[1]);
projects.add(project);
- try {
- save();
- } catch (IOException ioe1) {
- /* ignore, save() will be called again on quit. */
- }
return project;
}
}