package net.pterodactylus.jsite.project;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
* @version $Id$
*/
-public class ProjectManager {
+public class ProjectManager implements PropertyChangeListener {
/** Logger. */
private static final Logger logger = Logging.getLogger(ProjectManager.class.getName());
byte[] idBytes = new byte[16];
random.nextBytes(idBytes);
project.setId(Hex.toHex(idBytes));
+ project.setName("");
+ project.setDescription("");
project.setPrivateKey(keyPair[0]);
project.setPublicKey(keyPair[1]);
projects.add(project);
+ project.addPropertyChangeListener(this);
+ try {
+ save();
+ } catch (IOException ioe1) {
+ /* ignore. */
+ }
return project;
}
+
+ //
+ // INTERFACE PropertyChangeListener
+ //
+
+ /**
+ * {@inheritDoc}
+ */
+ public void propertyChange(PropertyChangeEvent propertyChangeEvent) {
+ try {
+ save();
+ } catch (IOException ioe1) {
+ /* ignore. */
+ }
+ }
+
}