version 0.4.8 0.4.8
authorDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Fri, 11 Aug 2006 09:36:28 +0000 (09:36 +0000)
committerDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Fri, 11 Aug 2006 09:36:28 +0000 (09:36 +0000)
remove edition project
add copy-uri-to-clipboard button
parse edition from resulting uri

12 files changed:
src/de/todesbaum/jsite/application/EditionProject.java [deleted file]
src/de/todesbaum/jsite/application/Project.java
src/de/todesbaum/jsite/application/ProjectInserter.java
src/de/todesbaum/jsite/gui/ProjectFilesPage.java
src/de/todesbaum/jsite/gui/ProjectInsertPage.java
src/de/todesbaum/jsite/gui/ProjectPage.java
src/de/todesbaum/jsite/i18n/jSite.properties
src/de/todesbaum/jsite/i18n/jSite_de.properties
src/de/todesbaum/jsite/main/CLI.java
src/de/todesbaum/jsite/main/Configuration.java
src/de/todesbaum/jsite/main/Version.java
src/de/todesbaum/util/freenet/fcp2/Connection.java

diff --git a/src/de/todesbaum/jsite/application/EditionProject.java b/src/de/todesbaum/jsite/application/EditionProject.java
deleted file mode 100644 (file)
index df06111..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * jSite - a tool for uploading websites into Freenet
- * Copyright (C) 2006 David Roden
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-package de.todesbaum.jsite.application;
-
-/**
- * Project extension for edition-based projects. In Freenet 0.7 this is
- * currently the only project type.
- * 
- * @author David Roden &lt;droden@gmail.com&gt;
- * @version $Id$
- */
-public class EditionProject extends Project {
-
-       /** The edition to insert to. */
-       private int edition;
-
-       /**
-        * Creates a new edition-based project.
-        */
-       public EditionProject() {
-       }
-
-       /**
-        * Clones the specified project as an edition-based project.
-        * 
-        * @param project
-        *            The project to clone
-        */
-       public EditionProject(Project project) {
-               super(project);
-               if (project instanceof EditionProject) {
-                       edition = ((EditionProject) project).edition;
-               }
-       }
-
-       /**
-        * Returns the edition of the project.
-        * 
-        * @return The edition of the project
-        */
-       public int getEdition() {
-               return edition;
-       }
-
-       /**
-        * Sets the edition of the project.
-        * 
-        * @param edition
-        *            The edition to set
-        */
-       public void setEdition(int edition) {
-               this.edition = edition;
-       }
-
-       /**
-        * Constructs the final request URI including the edition number.
-        * 
-        * @return The final request URI
-        */
-       @Override
-       public String getFinalRequestURI(int offset) {
-               return "freenet:USK@" + requestURI + "/" + path + "/" + (edition + offset) + "/";
-       }
-
-}
index 807385a..7604259 100644 (file)
@@ -30,7 +30,7 @@ import de.todesbaum.util.mime.DefaultMIMETypes;
  * @author David Roden <dr@todesbaum.dyndns.org>
  * @version $Id$
  */
-public abstract class Project implements Comparable {
+public class Project implements Comparable {
 
        protected String name;
        protected String description;
@@ -42,6 +42,8 @@ public abstract class Project implements Comparable {
        protected String localPath;
        protected String path;
        protected long lastInsertionTime;
+       /** The edition to insert to. */
+       protected int edition;
 
        protected Map<String, FileOption> fileOptions = new HashMap<String, FileOption>();
 
@@ -59,6 +61,7 @@ public abstract class Project implements Comparable {
                insertURI = project.insertURI;
                requestURI = project.requestURI;
                path = project.path;
+               edition = project.edition;
                localPath = project.localPath;
                indexFile = project.indexFile;
                lastInsertionTime = project.lastInsertionTime;
@@ -197,6 +200,9 @@ public abstract class Project implements Comparable {
                if (uri.startsWith("SSK@")) {
                        uri = uri.substring("SSK@".length());
                }
+               if (uri.startsWith("USK@")) {
+                       uri = uri.substring("USK@".length());
+               }
                if (uri.endsWith("/")) {
                        uri = uri.substring(0, uri.length() - 1);
                }
@@ -247,10 +253,6 @@ public abstract class Project implements Comparable {
                this.fileOptions.putAll(fileOptions);
        }
        
-       public String getFinalRequestURI(int offset) {
-               return "freenet:USK@" + requestURI + "/" + path + "/";
-       }
-
        /**
         * {@inheritDoc}
         */
@@ -258,4 +260,32 @@ public abstract class Project implements Comparable {
                return name.compareToIgnoreCase(((Project) o).name);
        }
 
+       /**
+        * Returns the edition of the project.
+        * 
+        * @return The edition of the project
+        */
+       public int getEdition() {
+               return edition;
+       }
+
+       /**
+        * Sets the edition of the project.
+        * 
+        * @param edition
+        *            The edition to set
+        */
+       public void setEdition(int edition) {
+               this.edition = edition;
+       }
+
+       /**
+        * Constructs the final request URI including the edition number.
+        * 
+        * @return The final request URI
+        */
+       public String getFinalRequestURI(int offset) {
+               return "freenet:USK@" + requestURI + "/" + path + "/" + (edition + offset) + "/";
+       }
+
 }
index ced3008..0fcddcc 100644 (file)
@@ -266,7 +266,7 @@ public class ProjectInserter implements FileScannerListener, Runnable {
                createContainers(files, containers, containerFiles);
 
                /* collect files */
-               int edition = ((EditionProject) project).getEdition();
+               int edition = project.getEdition();
                String dirURI = "freenet:USK@" + project.getInsertURI() + "/" + project.getPath() + "/" + edition + "/";
                ClientPutComplexDir putDir = new ClientPutComplexDir("dir-" + counter++, dirURI);
                putDir.setDefaultName(project.getIndexFile());
@@ -288,6 +288,7 @@ public class ProjectInserter implements FileScannerListener, Runnable {
                }
 
                /* parse progress and success messages */
+               String finalURI = null;
                boolean success = false;
                boolean finished = false;
                boolean disconnected = false;
@@ -300,7 +301,8 @@ public class ProjectInserter implements FileScannerListener, Runnable {
                        if (!finished) {
                                String messageName = message.getName();
                                if ("URIGenerated".equals(messageName)) {
-                                       fireProjectURIGenerated(message.get("URI"));
+                                       finalURI = message.get("URI");
+                                       fireProjectURIGenerated(finalURI);
                                }
                                if ("SimpleProgress".equals(messageName)) {
                                        int total = Integer.parseInt(message.get("Total"));
@@ -318,9 +320,9 @@ public class ProjectInserter implements FileScannerListener, Runnable {
                /* post-insert work */
                fireProjectInsertFinished(success, disconnected ? new IOException("Connection terminated") : null);
                if (success) {
-                       if (project instanceof EditionProject) {
-                               ((EditionProject) project).setEdition(edition + 1);
-                       }
+                       String editionPart = finalURI.substring(finalURI.lastIndexOf('/') + 1);
+                       int newEdition = Integer.parseInt(editionPart);
+                       project.setEdition(newEdition);
                }
        }
 
index b256e51..c1a8eae 100644 (file)
@@ -61,7 +61,6 @@ import javax.swing.event.ListSelectionListener;
 import javax.swing.text.BadLocationException;
 import javax.swing.text.Document;
 
-import de.todesbaum.jsite.application.EditionProject;
 import de.todesbaum.jsite.application.FileOption;
 import de.todesbaum.jsite.application.Project;
 import de.todesbaum.jsite.i18n.I18n;
@@ -443,7 +442,7 @@ public class ProjectFilesPage extends TWizardPage implements ActionListener, Lis
                addContainerAction.setEnabled(enabled);
                editContainerAction.setEnabled(enabled);
                deleteContainerAction.setEnabled(enabled);
-               replacementCheckBox.setEnabled(enabled && insert && (project instanceof EditionProject));
+               replacementCheckBox.setEnabled(enabled && insert);
                if (filename != null) {
                        FileOption fileOption = project.getFileOption(filename);
                        defaultFileCheckBox.setSelected(filename.equals(project.getIndexFile()));
index c2b42b0..1c7089d 100644 (file)
@@ -23,10 +23,20 @@ import java.awt.BorderLayout;
 import java.awt.GridBagConstraints;
 import java.awt.GridBagLayout;
 import java.awt.Insets;
+import java.awt.Toolkit;
+import java.awt.datatransfer.Clipboard;
+import java.awt.datatransfer.ClipboardOwner;
+import java.awt.datatransfer.StringSelection;
+import java.awt.datatransfer.Transferable;
+import java.awt.event.ActionEvent;
+import java.awt.event.KeyEvent;
 import java.text.DateFormat;
 import java.text.MessageFormat;
 import java.util.Date;
 
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.JButton;
 import javax.swing.JComponent;
 import javax.swing.JLabel;
 import javax.swing.JOptionPane;
@@ -47,11 +57,12 @@ import de.todesbaum.util.swing.TWizardPage;
  * @author David Roden &lt;droden@gmail.com&gt;
  * @version $Id$
  */
-public class ProjectInsertPage extends TWizardPage implements InsertListener {
+public class ProjectInsertPage extends TWizardPage implements InsertListener, ClipboardOwner {
 
        protected TWizard wizard;
        protected ProjectInserter projectInserter;
 
+       protected Action copyURIAction;
        protected JTextField requestURITextField;
        protected JLabel startTimeLabel;
        protected JProgressBar progressBar;
@@ -59,12 +70,24 @@ public class ProjectInsertPage extends TWizardPage implements InsertListener {
 
        public ProjectInsertPage() {
                super();
+               createActions();
                pageInit();
                setHeading(I18n.getMessage("jsite.insert.heading"));
                setDescription(I18n.getMessage("jsite.insert.description"));
                projectInserter = new ProjectInserter();
                projectInserter.addInsertListener(this);
        }
+       
+       private void createActions() {
+               copyURIAction = new AbstractAction(I18n.getMessage("jsite.project.action.copy-uri")) {
+                       public void actionPerformed(ActionEvent actionEvent) {
+                               actionCopyURI();
+                       }
+               };
+               copyURIAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.copy-uri.tooltip"));
+               copyURIAction.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_U);
+               copyURIAction.setEnabled(false);
+       }
 
        private void pageInit() {
                setLayout(new BorderLayout(12, 12));
@@ -90,6 +113,7 @@ public class ProjectInsertPage extends TWizardPage implements InsertListener {
                projectInsertPanel.add(startTimeLabel, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
                projectInsertPanel.add(new JLabel(I18n.getMessage("jsite.insert.progress") + ":"), new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(6, 18, 0, 0), 0, 0));
                projectInsertPanel.add(progressBar, new GridBagConstraints(1, 3, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
+               projectInsertPanel.add(new JButton(copyURIAction), new GridBagConstraints(0, 4, 2, 1, 0.0, 0.0, GridBagConstraints.LINE_END, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
 
                return projectInsertPanel;
        }
@@ -103,6 +127,7 @@ public class ProjectInsertPage extends TWizardPage implements InsertListener {
                wizard.setPreviousEnabled(false);
                wizard.setNextEnabled(false);
                wizard.setQuitEnabled(false);
+               copyURIAction.setEnabled(false);
                progressBar.setValue(0);
                projectInserter.start();
        }
@@ -156,6 +181,7 @@ public class ProjectInsertPage extends TWizardPage implements InsertListener {
        public void projectURIGenerated(Project project, final String uri) {
                SwingUtilities.invokeLater(new Runnable() {
                        public void run() {
+                               copyURIAction.setEnabled(true);
                                requestURITextField.setText(uri);
                        }
                });
@@ -190,10 +216,30 @@ public class ProjectInsertPage extends TWizardPage implements InsertListener {
                SwingUtilities.invokeLater(new Runnable() {
 
                        public void run() {
+                               progressBar.setValue(progressBar.getMaximum());
                                wizard.setNextEnabled(true);
                                wizard.setQuitEnabled(true);
                        }
                });
        }
+       
+       //
+       // ACTIONS
+       //
+       
+       protected void actionCopyURI() {
+               Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
+               clipboard.setContents(new StringSelection(requestURITextField.getText()), this);
+       }
+
+       //
+       // INTERFACE ClipboardOwner
+       //
+       
+       /**
+        * {@inheritDoc}
+        */
+       public void lostOwnership(Clipboard clipboard, Transferable contents) {
+       }
 
 }
index 0ff7b3c..8afd696 100644 (file)
@@ -25,6 +25,11 @@ import java.awt.FlowLayout;
 import java.awt.GridBagConstraints;
 import java.awt.GridBagLayout;
 import java.awt.Insets;
+import java.awt.Toolkit;
+import java.awt.datatransfer.Clipboard;
+import java.awt.datatransfer.ClipboardOwner;
+import java.awt.datatransfer.StringSelection;
+import java.awt.datatransfer.Transferable;
 import java.awt.event.ActionEvent;
 import java.awt.event.KeyEvent;
 import java.io.IOException;
@@ -40,14 +45,9 @@ import javax.swing.JList;
 import javax.swing.JOptionPane;
 import javax.swing.JPanel;
 import javax.swing.JScrollPane;
-import javax.swing.JSpinner;
 import javax.swing.JTextField;
 import javax.swing.ListSelectionModel;
-import javax.swing.SpinnerNumberModel;
-import javax.swing.JSpinner.NumberEditor;
 import javax.swing.border.EmptyBorder;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
 import javax.swing.event.DocumentEvent;
 import javax.swing.event.DocumentListener;
 import javax.swing.event.ListSelectionEvent;
@@ -55,7 +55,6 @@ import javax.swing.event.ListSelectionListener;
 import javax.swing.text.BadLocationException;
 import javax.swing.text.Document;
 
-import de.todesbaum.jsite.application.EditionProject;
 import de.todesbaum.jsite.application.Freenet7Interface;
 import de.todesbaum.jsite.application.Project;
 import de.todesbaum.jsite.i18n.I18n;
@@ -68,7 +67,7 @@ import de.todesbaum.util.swing.TWizardPage;
  * @author David Roden &lt;droden@gmail.com&gt;
  * @version $Id$
  */
-public class ProjectPage extends TWizardPage implements ListSelectionListener, ChangeListener, DocumentListener {
+public class ProjectPage extends TWizardPage implements ListSelectionListener, DocumentListener, ClipboardOwner {
 
        private Freenet7Interface freenetInterface;
 
@@ -76,6 +75,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, C
        private Action projectAddAction;
        private Action projectDeleteAction;
        private Action projectCloneAction;
+       private Action projectCopyURIAction;
 
        private JFileChooser pathChooser;
        private SortedListModel projectListModel;
@@ -170,6 +170,15 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, C
                projectCloneAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.clone-project.tooltip"));
                projectCloneAction.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_L);
                projectCloneAction.setEnabled(false);
+               
+               projectCopyURIAction = new AbstractAction(I18n.getMessage("jsite.project.action.copy-uri")) {
+                       public void actionPerformed(ActionEvent actionEvent) {
+                               actionCopyURI();
+                       }
+               };
+               projectCopyURIAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.copy-uri.tooltip"));
+               projectCopyURIAction.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_U);
+               projectCopyURIAction.setEnabled(false);
        }
 
        private JComponent createInformationPanel() {
@@ -182,6 +191,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, C
                functionButtons.add(new JButton(projectAddAction));
                functionButtons.add(new JButton(projectDeleteAction));
                functionButtons.add(new JButton(projectCloneAction));
+               functionButtons.add(new JButton(projectCopyURIAction));
 
                informationPanel.add(functionButtons, BorderLayout.PAGE_START);
                informationPanel.add(informationTable, BorderLayout.CENTER);
@@ -319,7 +329,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, C
                        JOptionPane.showMessageDialog(this, MessageFormat.format(I18n.getMessage("jsite.project.keygen.io-error"), ioe1.getMessage()), null, JOptionPane.ERROR_MESSAGE);
                        return;
                }
-               EditionProject newProject = new EditionProject();
+               Project newProject = new Project();
                newProject.setName(I18n.getMessage("jsite.project.new-project.name"));
                newProject.setInsertURI(keyPair[0]);
                newProject.setRequestURI(keyPair[1]);
@@ -344,16 +354,21 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, C
        protected void actionClone() {
                int selectedIndex = projectList.getSelectedIndex();
                if (selectedIndex > -1) {
-                       Project newProject = null;
-                       Project selectedProject = (Project) projectList.getSelectedValue();
-                       if (selectedProject instanceof EditionProject) {
-                               newProject = new EditionProject(selectedProject);
-                       } // else { /* BUG! */ }
+                       Project newProject = new Project((Project) projectList.getSelectedValue());
                        newProject.setName(MessageFormat.format(I18n.getMessage("jsite.project.action.clone-project.copy"), newProject.getName()));
                        projectListModel.add(newProject);
                        projectList.setSelectedIndex(projectListModel.indexOf(newProject));
                }
        }
+       
+       protected void actionCopyURI() {
+               int selectedIndex = projectList.getSelectedIndex();
+               if (selectedIndex > -1) {
+                       Project selectedProject = (Project) projectList.getSelectedValue();
+                       Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
+                       clipboard.setContents(new StringSelection(selectedProject.getFinalRequestURI(0)), this);
+               }
+       }
 
        //
        // INTERFACE ListSelectionListener
@@ -374,6 +389,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, C
                projectLocalPathBrowseAction.setEnabled(selectedRow > -1);
                projectDeleteAction.setEnabled(selectedRow > -1);
                projectCloneAction.setEnabled(selectedRow > -1);
+               projectCopyURIAction.setEnabled(selectedRow > -1);
                if (selectedRow > -1) {
                        projectNameTextField.setText(selectedProject.getName());
                        projectDescriptionTextField.setText(selectedProject.getDescription());
@@ -381,9 +397,6 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, C
                        projectPublicKeyTextField.setText(selectedProject.getRequestURI());
                        projectPrivateKeyTextField.setText(selectedProject.getInsertURI());
                        projectPathTextField.setText(selectedProject.getPath());
-                       if (selectedProject instanceof EditionProject) {
-                               EditionProject editionProject = (EditionProject) selectedProject;
-                       }
                } else {
                        projectNameTextField.setText("");
                        projectDescriptionTextField.setText("");
@@ -398,23 +411,6 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, C
        // INTERFACE ChangeListener
        //
 
-       /**
-        * {@inheritDoc}
-        */
-       public void stateChanged(ChangeEvent changeEvent) {
-               Object source = changeEvent.getSource();
-               if (source instanceof JSpinner) {
-                       JSpinner spinner = (JSpinner) source;
-                       Project currentProject = (Project) projectList.getSelectedValue();
-                       if (currentProject == null) {
-                               return;
-                       }
-                       if ("project.edition".equals(spinner.getName())) {
-                               ((EditionProject) currentProject).setEdition((Integer) spinner.getValue());
-                       }
-               }
-       }
-
        //
        // INTERFACE DocumentListener
        //
@@ -439,5 +435,15 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, C
        public void changedUpdate(DocumentEvent documentEvent) {
                setTextField(documentEvent);
        }
+       
+       //
+       // INTERFACE ClipboardOwner
+       //
+
+       /**
+        * {@inheritDoc}
+        */
+       public void lostOwnership(Clipboard clipboard, Transferable contents) {
+       }
 
 }
index c09e05a..f3a0f2a 100644 (file)
@@ -77,6 +77,8 @@ jsite.project.action.delete-project.confirm=<html><b>Confirm deletion</b><br><br
 jsite.project.action.clone-project=Clone project
 jsite.project.action.clone-project.copy=Copy of {0}
 jsite.project.action.clone-project.tooltip=Clone the selected project
+jsite.project.action.copy-uri=Copy URI to Clipboard
+jsite.project.action.copy-uri.tooltip=Copies the URI of the project to the clipboard
 jsite.project.project.information=Project Information
 jsite.project.project.name=Name
 jsite.project.project.description=Description
index 9db0e47..11b7519 100644 (file)
@@ -77,6 +77,8 @@ jsite.project.action.delete-project.confirm=<html><b>L
 jsite.project.action.clone-project=Projekt duplizieren
 jsite.project.action.clone-project.copy=Kopie von {0}
 jsite.project.action.clone-project.tooltip=Das ausgewählte Projekt duplizieren
+jsite.project.action.copy-uri=URI kopieren
+jsite.project.action.copy-uri.tooltip=Kopiert die URI des ausgewählten Projektes in die Zwischenablage
 jsite.project.project.information=Projektinformation
 jsite.project.project.name=Name
 jsite.project.project.description=Beschreibung
index 1533c11..4359028 100644 (file)
@@ -21,7 +21,6 @@ package de.todesbaum.jsite.main;
 
 import java.io.PrintWriter;
 
-import de.todesbaum.jsite.application.EditionProject;
 import de.todesbaum.jsite.application.Freenet7Interface;
 import de.todesbaum.jsite.application.InsertListener;
 import de.todesbaum.jsite.application.Node;
@@ -115,12 +114,7 @@ public class CLI implements InsertListener {
                                        outputWriter.println("You can't specify --edition before --project.");
                                        return;
                                }
-                               if (currentProject instanceof EditionProject) {
-                                       ((EditionProject) currentProject).setEdition(Integer.parseInt(value));
-                               } else {
-                                       outputWriter.println("Project \"" + currentProject.getName() + "\" is not an edition-based project.");
-                                       return;
-                               }
+                               currentProject.setEdition(Integer.parseInt(value));
                        } else {
                                outputWriter.println("Unknown parameter: " + argument);
                                return;
@@ -203,11 +197,6 @@ public class CLI implements InsertListener {
        public void projectInsertFinished(Project project, boolean success, Throwable cause) {
                outputWriter.println("Request URI: " + project.getFinalRequestURI(0));
                finished = true;
-               if (success) {
-                       if (project instanceof EditionProject) {
-                               ((EditionProject) project).setEdition(((EditionProject) project).getEdition() + 1);
-                       }
-               }
                this.success = success;
                synchronized (lockObject) {
                        lockObject.notify();
index e4e0510..f14ed01 100644 (file)
@@ -34,7 +34,6 @@ import java.util.Locale;
 import java.util.Map;
 import java.util.Map.Entry;
 
-import de.todesbaum.jsite.application.EditionProject;
 import de.todesbaum.jsite.application.FileOption;
 import de.todesbaum.jsite.application.Node;
 import de.todesbaum.jsite.application.Project;
@@ -234,13 +233,7 @@ public class Configuration {
                        SimpleXML[] projectNodes = projectsNode.getNodes("project");
                        for (SimpleXML projectNode: projectNodes) {
                                try {
-                                       Project project = null;
-                                       SimpleXML typeNode = projectNode.getNode("type");
-                                       if ("edition".equals(typeNode.getValue())) {
-                                               EditionProject editionProject = new EditionProject();
-                                               project = editionProject;
-                                               editionProject.setEdition(Integer.parseInt(projectNode.getNode("edition").getValue()));
-                                       }
+                                       Project project = new Project();
                                        projects.add(project);
                                        project.setDescription(projectNode.getNode("description").getValue());
                                        project.setIndexFile(projectNode.getNode("index-file").getValue());
@@ -248,6 +241,7 @@ public class Configuration {
                                        project.setLocalPath(projectNode.getNode("local-path").getValue());
                                        project.setName(projectNode.getNode("name").getValue());
                                        project.setPath(projectNode.getNode("path").getValue());
+                                       project.setEdition(Integer.parseInt(projectNode.getNode("edition").getValue()));
                                        project.setInsertURI(projectNode.getNode("insert-uri").getValue());
                                        project.setRequestURI(projectNode.getNode("request-uri").getValue());
                                        SimpleXML fileOptionsNode = projectNode.getNode("file-options");
@@ -281,10 +275,7 @@ public class Configuration {
                SimpleXML projectsNode = new SimpleXML("project-list");
                for (Project project: projects) {
                        SimpleXML projectNode = projectsNode.append("project");
-                       if (project instanceof EditionProject) {
-                               projectNode.append("type", "edition");
-                               projectNode.append("edition", String.valueOf(((EditionProject) project).getEdition()));
-                       }
+                       projectNode.append("edition", String.valueOf(project.getEdition()));
                        projectNode.append("description", project.getDescription());
                        projectNode.append("index-file", project.getIndexFile());
                        projectNode.append("last-insertion-time", String.valueOf(project.getLastInsertionTime()));
index 1088679..d4e36c9 100644 (file)
@@ -25,7 +25,7 @@ package de.todesbaum.jsite.main;
  */
 public class Version {
 
-       private static final String VERSION = "0.4.7";
+       private static final String VERSION = "0.4.8";
 
        public static final String getVersion() {
                return VERSION;
index 1109aec..848ee86 100644 (file)
@@ -294,7 +294,7 @@ public class Connection {
                                Message message = null;
                                while (line != null) {
                                        line = nodeReader.readLine();
-                                        System.err.println("> " + line);
+                                       // System.err.println("> " + line);
                                        if (line == null) {
                                                break;
                                        }