diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/Artifact.java b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/Artifact.java
deleted file mode 100644
index 841a0d2..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/Artifact.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *   Copyright 2005 The Apache Software Foundation
- *
- *   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 org.apache.felix.framework.installer;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Map;
-
-public interface Artifact
-{
-    public StringProperty getSourceName();
-    public StringProperty getDestinationDirectory();
-    public InputStream getInputStream(Status status) throws IOException;
-    public boolean localize();
-    public boolean process(Status status, Map propMap);
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/BooleanProperty.java b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/BooleanProperty.java
deleted file mode 100644
index 738c94f..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/BooleanProperty.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- *   Copyright 2005 The Apache Software Foundation
- *
- *   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 org.apache.felix.framework.installer;
-
-public interface BooleanProperty extends Property
-{
-    public boolean getBooleanValue();
-    public void setBooleanValue(boolean b);
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/Install.java b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/Install.java
deleted file mode 100644
index 3369d3d..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/Install.java
+++ /dev/null
@@ -1,432 +0,0 @@
-/*
- *   Copyright 2005 The Apache Software Foundation
- *
- *   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 org.apache.felix.framework.installer;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.io.File;
-import java.util.*;
-
-import javax.swing.*;
-import javax.swing.border.BevelBorder;
-
-import org.apache.felix.framework.Felix;
-import org.apache.felix.framework.installer.artifact.*;
-import org.apache.felix.framework.installer.editor.BooleanEditor;
-import org.apache.felix.framework.installer.editor.FileEditor;
-import org.apache.felix.framework.installer.property.*;
-import org.apache.felix.framework.util.FelixConstants;
-
-public class Install extends JFrame
-{
-    private static transient final String PROPERTY_FILE = "property.xml";
-    private static transient final String ARTIFACT_FILE = "artifact.xml";
-
-    public static transient final String JAVA_DIR = "Java directory";
-    public static transient final String INSTALL_DIR = "Install directory";
-
-    private PropertyPanel m_propPanel = null;
-    private JButton m_okayButton = null;
-    private JButton m_cancelButton = null;
-    private JLabel m_statusLabel = null;
-
-    private java.util.List m_propList = null;
-    private java.util.List m_artifactList = null;
-
-    public Install()
-        throws Exception
-    {
-        super("Install");
-
-        // Load properties before resources, because resources
-        // refer to properties.
-        m_propList = loadPropertyList();
-        m_artifactList = loadArtifactList();
-
-        getContentPane().setLayout(new BorderLayout());
-        getContentPane().add(
-            m_propPanel = new PropertyPanel(m_propList), BorderLayout.CENTER);
-        getContentPane().add(createButtonPanel(), BorderLayout.SOUTH);
-        pack();
-        setResizable(true);
-        centerWindow(this);
-
-        // Make window closeable.
-        setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
-        addWindowListener(new WindowAdapter() {
-            public void windowClosing(WindowEvent event)
-            {
-                doCancel();
-            }
-        });
-    }
-
-    public java.util.List loadPropertyList()
-    {
-        String installDir = System.getProperty("user.home");
-        if (!installDir.endsWith(File.separator))
-        {
-            installDir = installDir + File.separator;
-        }
-
-        Property prop = null;
-
-        // Eventually these should be read from a file.
-        java.util.List list = new ArrayList();
-
-        // Add the impl choice property.
-        prop = new BooleanPropertyImpl("Shell", true);
-        prop.setEditor(new BooleanEditor((BooleanProperty) prop, "Text", "GUI"));
-        list.add(prop);
-
-        // Add the java directory property.
-        prop = new StringPropertyImpl(JAVA_DIR, System.getProperty("java.home"));
-        prop.setEditor(new FileEditor((StringProperty) prop, true));
-        list.add(prop);
-
-        // Add the installation directory property.
-        prop = new StringPropertyImpl(INSTALL_DIR, installDir + "Felix");
-        prop.setEditor(new FileEditor((StringProperty) prop, true));
-        list.add(prop);
-
-        // Add the documentation URL property.
-        prop = new BooleanStringPropertyImpl(
-            "User documentation",
-            true,
-            "http://download.forge.objectweb.org/oscar/oscar-doc-"
-           + Felix.getVersion() + ".jar");
-        list.add(prop);
-
-        // Add the documentation URL property.
-        prop = new BooleanStringPropertyImpl(
-            "API documentation",
-            true,
-            "http://download.forge.objectweb.org/oscar/oscar-api-"
-            + Felix.getVersion() + ".jar");
-        list.add(prop);
-
-        return list;
-    }
-
-    public java.util.List loadArtifactList() throws Exception
-    {
-        // Eventually I will changed these to be read from a file.
-        java.util.List list = new ArrayList();
-        list.add(
-            new ArtifactHolder(
-                (BooleanProperty) getProperty("User documentation"),
-                new URLJarArtifact(
-                    (StringProperty) getProperty("User documentation"))));
-        list.add(
-            new ArtifactHolder(
-                (BooleanProperty) getProperty("API documentation"),
-                new URLJarArtifact(
-                    (StringProperty) getProperty("API documentation"))));
-        list.add(
-            new ArtifactHolder(
-                new ResourceJarArtifact(
-                    new StringPropertyImpl("sourceName", "package.jar"))));
-        list.add(
-            new ArtifactHolder(
-                new ResourceFileArtifact(
-                    new StringPropertyImpl("sourceName", "src.jar"))));
-        list.add(
-            new ArtifactHolder(
-                new ResourceFileArtifact(
-                    new StringPropertyImpl("sourceName", "LICENSE.txt"))));
-        list.add(
-            new ArtifactHolder(
-                (BooleanProperty) getProperty("Shell"),
-                new ResourceFileArtifact(
-                    new StringPropertyImpl("sourceName", "config.properties.text"),
-                    new StringPropertyImpl("destName", "config.properties"),
-                    new StringPropertyImpl("destDir", "lib"))));
-        list.add(
-            new ArtifactHolder(
-                new NotBooleanPropertyImpl((BooleanProperty) getProperty("Shell")),
-                new ResourceFileArtifact(
-                    new StringPropertyImpl("sourceName", "config.properties.gui"),
-                    new StringPropertyImpl("destName", "config.properties"),
-                    new StringPropertyImpl("destDir", "lib"))));
-        list.add(
-            new ArtifactHolder(
-                new ResourceFileArtifact(
-                    new StringPropertyImpl("sourceName", "example.policy"))));
-        list.add(
-            new ArtifactHolder(
-                new ResourceFileArtifact(
-                    new StringPropertyImpl("sourceName", "felix.bat"),
-                    new StringPropertyImpl("destName" , "felix.bat"),
-                    new StringPropertyImpl("destDir", ""),
-                    true)));
-        list.add(
-            new ArtifactHolder(
-                new ResourceFileArtifact(
-                    new StringPropertyImpl("sourceName", "felix.sh"),
-                    new StringPropertyImpl("destName" , "felix.sh"),
-                    new StringPropertyImpl("destDir", ""),
-                    true)));
-
-        return list;
-    }
-
-    private Property getProperty(String name)
-    {
-        for (int i = 0; i < m_propList.size(); i++)
-        {
-            Property prop = (Property) m_propList.get(i);
-            if (prop.getName().equals(name))
-            {
-                return prop;
-            }
-        }
-        return null;
-    }
-
-    protected void doOkay()
-    {
-        m_propPanel.setEnabled(false);
-        m_okayButton.setEnabled(false);
-        m_cancelButton.setEnabled(false);
-        new Thread(new InstallRunnable()).start();
-    }
-
-    protected void doCancel()
-    {
-        System.exit(0);
-    }
-
-    protected JPanel createButtonPanel()
-    {
-        JPanel buttonPanel = new JPanel();
-        buttonPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
-
-        // Create and set layout.
-        GridBagLayout grid = new GridBagLayout();
-        GridBagConstraints c = new GridBagConstraints();
-
-        buttonPanel.setLayout(grid);
-
-        // Create labels and fields.
-        c.insets = new Insets(2, 2, 2, 2);
-
-        // Okay button.
-        c.gridx = 0;
-        c.gridy = 0;
-        c.gridwidth = 1;
-        c.gridheight = 1;
-        c.anchor = GridBagConstraints.EAST;
-        grid.setConstraints(m_okayButton = new JButton("OK"), c);
-        buttonPanel.add(m_okayButton);
-        m_okayButton.setDefaultCapable(true);
-        getRootPane().setDefaultButton(m_okayButton);
-
-        // Cancel button.
-        c.gridx = 1;
-        c.gridy = 0;
-        c.gridwidth = 1;
-        c.gridheight = 1;
-        c.anchor = GridBagConstraints.WEST;
-        grid.setConstraints(m_cancelButton = new JButton("Cancel"), c);
-        buttonPanel.add(m_cancelButton);
-
-        // Add action listeners.
-        m_okayButton.addActionListener(new ActionListener() {
-            public void actionPerformed(ActionEvent event)
-            {
-                doOkay();
-            }
-        });
-
-        m_cancelButton.addActionListener(new ActionListener() {
-            public void actionPerformed(ActionEvent event)
-            {
-                doCancel();
-            }
-        });
-
-        // Status label.
-        m_statusLabel = new JLabel("Felix installation");
-        m_statusLabel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
-
-        // Complete panel.
-        JPanel panel = new JPanel(new BorderLayout());
-        panel.add(buttonPanel, BorderLayout.CENTER);
-        panel.add(m_statusLabel, BorderLayout.SOUTH);
-        return panel;
-    }
-
-    public static void centerWindow(Component window)
-    {
-        Toolkit toolkit = Toolkit.getDefaultToolkit();
-        Dimension dim = toolkit.getScreenSize();
-        int screenWidth = dim.width;
-        int screenHeight = dim.height;
-        int x = (screenWidth - window.getSize().width) / 2;
-        int y = (screenHeight - window.getSize().height) / 2;
-        window.setLocation(x, y);
-    }
-
-    public static void main(String[] argv) throws Exception
-    {
-        String msg = "<html>"
-            + "<center><h1>Felix " + Felix.getVersion() + "</h1></center>"
-            + "You can download example bundles at the Felix impl prompt by<br>"
-            + "using the <b><tt>obr</tt></b> command to access the OSGi Bundle Repository;<br>"
-            + "type <b><tt>obr help</tt></b> at the Felix impl prompt for details."
-            + "</html>";
-        JLabel label = new JLabel(msg);
-        label.setFont(new Font("SansSerif", Font.PLAIN, 11));
-        final JDialog dlg = new JDialog((Frame) null, "Felix Install", true);
-        dlg.getContentPane().setLayout(new BorderLayout(10, 10));
-        dlg.getContentPane().add(label, BorderLayout.CENTER);
-        JPanel panel = new JPanel();
-        JButton button = new JButton("OK");
-        button.addActionListener(new ActionListener() {
-            public void actionPerformed(ActionEvent event)
-            {
-                dlg.hide();
-            }
-        });
-        panel.add(button);
-        dlg.getContentPane().add(panel, BorderLayout.SOUTH);
-        // For spacing purposes...
-        dlg.getContentPane().add(new JPanel(), BorderLayout.NORTH);
-        dlg.getContentPane().add(new JPanel(), BorderLayout.EAST);
-        dlg.getContentPane().add(new JPanel(), BorderLayout.WEST);
-        dlg.pack();
-        centerWindow(dlg);
-        dlg.show();
-
-        Install obj = new Install();
-        obj.setVisible(true);
-    }
-
-    class InstallRunnable implements Runnable
-    {
-        public void run()
-        {
-            Map propMap = new HashMap();
-            for (int i = 0; i < m_propList.size(); i++)
-            {
-                Property prop = (Property) m_propList.get(i);
-                propMap.put(prop.getName(), prop);
-            }
-
-            String installDir = ((StringProperty) propMap.get(INSTALL_DIR)).getStringValue();
-
-            // Make sure the install directory ends with separator char.
-            if (!installDir.endsWith(File.separator))
-            {
-                installDir = installDir + File.separator;
-            }
-
-            // Make sure the install directory exists and
-            // that is actually a directory.
-            File file = new File(installDir);
-            if (!file.exists())
-            {
-                if (!file.mkdirs())
-                {
-                    JOptionPane.showMessageDialog(Install.this,
-                        "Unable to create install directory.",
-                        "Error", JOptionPane.ERROR_MESSAGE);
-                    System.exit(-1);
-                }
-            }
-            else if (!file.isDirectory())
-            {
-                JOptionPane.showMessageDialog(Install.this,
-                    "The selected install location is not a directory.",
-                    "Error", JOptionPane.ERROR_MESSAGE);
-                System.exit(-1);
-            }
-
-            // Status updater runnable.
-            StatusRunnable sr = new StatusRunnable();
-
-            // Loop through and process resources.
-            for (int i = 0; i < m_artifactList.size(); i++)
-            {
-                ArtifactHolder ah = (ArtifactHolder) m_artifactList.get(i);
-                if (ah.isIncluded())
-                {
-                    if (!ah.getArtifact().process(sr, propMap))
-                    {
-                        JOptionPane.showMessageDialog(Install.this,
-                            "An error occurred while processing the resources.",
-                            "Error", JOptionPane.ERROR_MESSAGE);
-                        System.exit(-1);
-                    }
-                }
-            }
-
-            System.exit(0);
-        }
-    }
-
-    class StatusRunnable implements Status, Runnable
-    {
-        private String text = null;
-
-        public void setText(String s)
-        {
-            text = s;
-            try {
-                SwingUtilities.invokeAndWait(this);
-            } catch (Exception ex) {
-                // Ignore.
-            }
-        }
-
-        public void run()
-        {
-            m_statusLabel.setText(text);
-        }
-    }
-
-    // Re-usable static member for ResourceHolder inner class.
-    private static BooleanProperty m_trueProp =
-        new BooleanPropertyImpl("mandatory", true);
-
-    class ArtifactHolder
-    {
-        private BooleanProperty m_isIncluded = null;
-        private Artifact m_artifact = null;
-        
-        public ArtifactHolder(Artifact artifact)
-        {
-            this(m_trueProp, artifact);
-        }
-        
-        public ArtifactHolder(BooleanProperty isIncluded, Artifact artifact)
-        {
-            m_isIncluded = isIncluded;
-            m_artifact = artifact;
-        }
-        
-        public boolean isIncluded()
-        {
-            return m_isIncluded.getBooleanValue();
-        }
-        
-        public Artifact getArtifact()
-        {
-            return m_artifact;
-        }
-    }
-}
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/Property.java b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/Property.java
deleted file mode 100644
index 41cdc21..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/Property.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- *   Copyright 2005 The Apache Software Foundation
- *
- *   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 org.apache.felix.framework.installer;
-
-import javax.swing.JComponent;
-
-public interface Property
-{
-    public String getName();
-    public JComponent getEditor();
-    public void setEditor(JComponent comp);
-    public String toString();
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/PropertyPanel.java b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/PropertyPanel.java
deleted file mode 100644
index a90203e..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/PropertyPanel.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- *   Copyright 2005 The Apache Software Foundation
- *
- *   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 org.apache.felix.framework.installer;
-
-import java.awt.*;
-import java.util.*;
-import java.util.List;
-
-import javax.swing.*;
-
-public class PropertyPanel extends JPanel
-{
-    private List m_propList = null;
-    private Map m_propToCompMap = null;
-
-    public PropertyPanel(List paramList)
-    {
-        super();
-        m_propList = paramList;
-        m_propToCompMap = new HashMap();
-        layoutComponents();
-    }
-
-    public void setEnabled(boolean b)
-    {
-        for (int i = 0; i < m_propList.size(); i++)
-        {
-            Property prop = (Property) m_propList.get(i);
-            JComponent comp = (JComponent) m_propToCompMap.get(prop.getName());
-            comp.setEnabled(b);
-        }
-    }
-
-    public List getProperties()
-    {
-        return m_propList;
-    }
-
-    protected void layoutComponents()
-    {
-        // Create the field panel for entering query variables.
-        GridBagLayout grid = new GridBagLayout();
-        GridBagConstraints gbc = new GridBagConstraints();
-        gbc.insets = new Insets(2, 2, 2, 2);
-        setLayout(grid);
-
-        for (int i = 0; i < m_propList.size(); i++)
-        {
-            Property prop = (Property) m_propList.get(i);
-            JLabel label = null;
-            JComponent component = null;
-
-            // Add label.
-            gbc.gridx = 0;
-            gbc.gridy = i;
-            gbc.gridheight = 1;
-            gbc.gridwidth = 1;
-            gbc.anchor = GridBagConstraints.EAST;
-            grid.setConstraints(label = new JLabel(prop.getName()), gbc);
-            add(label);
-
-            gbc.gridx = 1;
-            gbc.gridy = i;
-            gbc.gridheight = 1;
-            gbc.gridwidth = 3;
-            gbc.anchor = GridBagConstraints.WEST;
-            grid.setConstraints(component = prop.getEditor(), gbc);
-            add(component);
-
-            m_propToCompMap.put(prop.getName(), component);
-        }
-    }
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/Status.java b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/Status.java
deleted file mode 100644
index 634c97e..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/Status.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- *   Copyright 2005 The Apache Software Foundation
- *
- *   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 org.apache.felix.framework.installer;
-
-public interface Status
-{
-    public void setText(String s);
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/StringProperty.java b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/StringProperty.java
deleted file mode 100644
index 711ba43..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/StringProperty.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- *   Copyright 2005 The Apache Software Foundation
- *
- *   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 org.apache.felix.framework.installer;
-
-public interface StringProperty extends Property
-{
-    public String getStringValue();
-    public void setStringValue(String s);
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/artifact/AbstractArtifact.java b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/artifact/AbstractArtifact.java
deleted file mode 100644
index b881bc1..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/artifact/AbstractArtifact.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- *   Copyright 2005 The Apache Software Foundation
- *
- *   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 org.apache.felix.framework.installer.artifact;
-
-import java.io.*;
-import java.util.Map;
-
-import org.apache.felix.framework.installer.*;
-import org.apache.felix.framework.installer.property.StringPropertyImpl;
-
-public abstract class AbstractArtifact implements Artifact
-{
-    private StringProperty m_sourceName = null;
-    private StringProperty m_destDir = null;
-    private boolean m_localize = false;
-
-    // This following shared buffer assumes that there is
-    // no concurrency when processing resources.
-    protected static byte[] s_buffer = new byte[2048];
-
-    public AbstractArtifact(
-        StringProperty sourceName, StringProperty destDir, boolean localize)
-    {
-        if (destDir == null)
-        {
-            destDir = new StringPropertyImpl("empty", "");
-        }
-        m_sourceName = sourceName;
-        m_destDir = destDir;
-        m_localize = localize;
-    }
-
-    public StringProperty getSourceName()
-    {
-        return m_sourceName;
-    }
-
-    public StringProperty getDestinationDirectory()
-    {
-        return m_destDir;
-    }
-
-    public boolean localize()
-    {
-        return m_localize;
-    }
-
-    protected static void copy(
-        InputStream is, String installDir, String destName, String destDir)
-        throws IOException
-    {
-        if (destDir == null)
-        {
-            destDir = "";
-        }
-
-        // Make sure the target directory exists and
-        // that is actually a directory.
-        File targetDir = new File(installDir, destDir);
-        if (!targetDir.exists())
-        {
-            if (!targetDir.mkdirs())
-            {
-                throw new IOException("Unable to create target directory: "
-                    + targetDir);
-            }
-        }
-        else if (!targetDir.isDirectory())
-        {
-            throw new IOException("Target is not a directory: "
-                + targetDir);
-        }
-
-        BufferedOutputStream bos = new BufferedOutputStream(
-            new FileOutputStream(new File(targetDir, destName)));
-        int count = 0;
-        while ((count = is.read(s_buffer)) > 0)
-        {
-            bos.write(s_buffer, 0, count);
-        }
-        bos.close();
-    }
-
-    protected static void copyAndLocalize(
-        InputStream is, String installDir, String destName,
-        String destDir, Map propMap)
-        throws IOException
-    {
-        if (destDir == null)
-        {
-            destDir = "";
-        }
-
-        // Make sure the target directory exists and
-        // that is actually a directory.
-        File targetDir = new File(installDir, destDir);
-        if (!targetDir.exists())
-        {
-            if (!targetDir.mkdirs())
-            {
-                throw new IOException("Unable to create target directory: "
-                    + targetDir);
-            }
-        }
-        else if (!targetDir.isDirectory())
-        {
-            throw new IOException("Target is not a directory: "
-                + targetDir);
-        }
-
-        BufferedOutputStream bos = new BufferedOutputStream(
-            new FileOutputStream(new File(targetDir, destName)));
-        int i = 0;
-        while ((i = is.read()) > 0)
-        {
-            // Parameters start with "%%", so check to see if
-            // we have a parameter.
-            if ((char)i == '%')
-            {
-                // One of three possibilities, we have a parameter,
-                // we have an end of file, or we don't have a parameter.
-                int i2 = is.read();
-                if ((char) i2 == '%')
-                {
-                    Object obj = readParameter(is);
-
-                    // If the byte sequence was not a parameter afterall,
-                    // then a byte array is returned, otherwise a string
-                    // containing the parameter m_name is returned.
-                    if (obj instanceof byte[])
-                    {
-                        bos.write(i);
-                        bos.write(i2);
-                        bos.write((byte[]) obj);
-                    }
-                    else
-                    {
-                        Property prop = (Property) propMap.get(obj);
-                        String value = (prop == null) ? "" : prop.toString();
-                        bos.write(value.getBytes());
-                    }
-                }
-                else if (i2 == -1)
-                {
-                    bos.write(i);
-                }
-                else
-                {
-                    bos.write(i);
-                    bos.write(i2);
-                }
-            }
-            else
-            {
-                bos.write(i);
-            }
-        }
-        bos.close();
-    }
-
-    protected static Object readParameter(InputStream is)
-        throws IOException
-    {
-        int count = 0;
-        int i = 0;
-        while ((count < s_buffer.length) && ((i = is.read()) > 0))
-        {
-            if ((char) i == '%')
-            {
-                // One of three possibilities, we have the end of
-                // the parameter, we have an end of file, or we
-                // don't have the parameter end.
-                int i2 = is.read();
-                if ((char) i2 == '%')
-                {
-                    return new String(s_buffer, 0, count);
-                }
-                else if (i2 == -1)
-                {
-                    s_buffer[count] = (byte) i;
-                    byte[] b = new byte[count];
-                    for (int j = 0; j < count; j++)
-                        b[j] = s_buffer[j];
-                    return b;
-                }
-                else
-                {
-                    s_buffer[count++] = (byte) i;
-                    s_buffer[count++] = (byte) i2;
-                }
-            }
-            else
-            {
-                s_buffer[count++] = (byte) i;
-            }
-        }
-
-        byte[] b = new byte[count - 1];
-        for (int j = 0; j < (count - 1); j++)
-            b[j] = s_buffer[j];
-
-        return b;
-    }
-
-    public static String getPath(String s, char separator)
-    {
-        return (s.lastIndexOf(separator) < 0)
-            ? "" : s.substring(0, s.lastIndexOf(separator));
-    }
-
-    public static String getPathHead(String s, char separator)
-    {
-        return (s.lastIndexOf(separator) < 0)
-            ? s : s.substring(s.lastIndexOf(separator) + 1);
-    }
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/artifact/AbstractFileArtifact.java b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/artifact/AbstractFileArtifact.java
deleted file mode 100644
index 261328b..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/artifact/AbstractFileArtifact.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- *   Copyright 2005 The Apache Software Foundation
- *
- *   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 org.apache.felix.framework.installer.artifact;
-
-import java.io.InputStream;
-import java.util.Map;
-
-import org.apache.felix.framework.installer.*;
-
-public abstract class AbstractFileArtifact extends AbstractArtifact
-{
-    private StringProperty m_destName = null;
-
-    public AbstractFileArtifact(StringProperty sourceName)
-    {
-        this(sourceName, sourceName);
-    }
-
-    public AbstractFileArtifact(StringProperty sourceName, StringProperty destName)
-    {
-        this(sourceName, destName, null);
-    }
-
-    public AbstractFileArtifact(
-        StringProperty sourceName, StringProperty destName, StringProperty destDir)
-    {
-        this(sourceName, destName, destDir, false);
-    }
-
-    public AbstractFileArtifact(
-        StringProperty sourceName, StringProperty destName,
-        StringProperty destDir, boolean localize)
-    {
-        super(sourceName, destDir, localize);
-        m_destName = destName;
-    }
-
-    public StringProperty getDestinationName()
-    {
-        return m_destName;
-    }
-
-    public boolean process(Status status, Map propMap)
-    {
-        String installDir =
-            ((StringProperty) propMap.get(Install.INSTALL_DIR)).getStringValue();
-
-        try
-        {
-            InputStream is = getInputStream(status);
-
-            if (is == null)
-            {
-                return true;
-            }
-
-            if (localize())
-            {
-                status.setText("Copying and configuring "
-                    + getSourceName().getStringValue());
-                copyAndLocalize(
-                    is,
-                    installDir,
-                    getDestinationName().getStringValue(),
-                    getDestinationDirectory().getStringValue(),
-                    propMap);
-            }
-            else
-            {
-                status.setText("Copying " + getSourceName().getStringValue());
-                copy(
-                    is,
-                    installDir,
-                    getDestinationName().getStringValue(),
-                    getDestinationDirectory().getStringValue());
-            }
-
-            is.close();
-
-        }
-        catch (Exception ex)
-        {
-            System.err.println(ex);
-            return false;
-        }
-
-        return true;
-    }
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/artifact/AbstractJarArtifact.java b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/artifact/AbstractJarArtifact.java
deleted file mode 100644
index cec33e4..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/artifact/AbstractJarArtifact.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- *   Copyright 2005 The Apache Software Foundation
- *
- *   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 org.apache.felix.framework.installer.artifact;
-
-import java.io.*;
-import java.util.Map;
-import java.util.jar.JarEntry;
-import java.util.jar.JarInputStream;
-
-import org.apache.felix.framework.installer.*;
-
-public abstract class AbstractJarArtifact extends AbstractArtifact
-{
-    public AbstractJarArtifact(StringProperty sourceName)
-    {
-        this(sourceName, null);
-    }
-
-    public AbstractJarArtifact(StringProperty sourceName, StringProperty destDir)
-    {
-        this(sourceName, destDir, false);
-    }
-
-    public AbstractJarArtifact(
-        StringProperty sourceName, StringProperty destDir, boolean localize)
-    {
-        super(sourceName, destDir, localize);
-    }
-
-    public boolean process(Status status, Map propMap)
-    {
-        try
-        {
-            InputStream is = getInputStream(status);
-
-            if (is == null)
-            {
-                return true;
-            }
-
-            JarInputStream jis = new JarInputStream(is);
-            status.setText("Extracting...");
-            unjar(jis, propMap);
-            jis.close();
-        }
-        catch (Exception ex)
-        {
-            System.err.println(this);
-            System.err.println(ex);
-            return false;
-        }
-
-        return true;
-    }
-
-    protected void unjar(JarInputStream jis, Map propMap)
-        throws IOException
-    {
-        String installDir =
-            ((StringProperty) propMap.get(Install.INSTALL_DIR)).getStringValue();
-
-        // Loop through JAR entries.
-        for (JarEntry je = jis.getNextJarEntry();
-             je != null;
-             je = jis.getNextJarEntry())
-        {
-            if (je.getName().startsWith("/"))
-            {
-                throw new IOException("JAR resource cannot contain absolute paths.");
-            }
-
-            File target =
-                new File(installDir, getDestinationDirectory().getStringValue());
-            target = new File(target, je.getName());
-
-            // Check to see if the JAR entry is a directory.
-            if (je.isDirectory())
-            {
-                if (!target.exists())
-                {
-                    if (!target.mkdirs())
-                    {
-                        throw new IOException("Unable to create target directory: "
-                            + target);
-                    }
-                }
-                // Just continue since directories do not have content to copy.
-                continue;
-            }
-
-            int lastIndex = je.getName().lastIndexOf('/');
-            String name = (lastIndex >= 0) ?
-                je.getName().substring(lastIndex + 1) : je.getName();
-            String destination = (lastIndex >= 0) ?
-                je.getName().substring(0, lastIndex) : "";
-
-            // JAR files use '/', so convert it to platform separator.
-            destination = destination.replace('/', File.separatorChar);
-
-            if (localize())
-            {
-                copyAndLocalize(jis, installDir, name, destination, propMap);
-            }
-            else
-            {
-                copy(jis, installDir, name, destination);
-            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/artifact/ResourceFileArtifact.java b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/artifact/ResourceFileArtifact.java
deleted file mode 100644
index 9c90b8a..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/artifact/ResourceFileArtifact.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- *   Copyright 2005 The Apache Software Foundation
- *
- *   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 org.apache.felix.framework.installer.artifact;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.apache.felix.framework.installer.Status;
-import org.apache.felix.framework.installer.StringProperty;
-import org.apache.felix.framework.installer.resource.ResourceLoader;
-
-public class ResourceFileArtifact extends AbstractFileArtifact
-{
-    public ResourceFileArtifact(StringProperty sourceName)
-    {
-        this(sourceName, sourceName);
-    }
-
-    public ResourceFileArtifact(StringProperty sourceName, StringProperty destName)
-    {
-        this(sourceName, destName, null);
-    }
-
-    public ResourceFileArtifact(
-        StringProperty sourceName, StringProperty destName, StringProperty destDir)
-    {
-        this(sourceName, destName, destDir, false);
-    }
-
-    public ResourceFileArtifact(
-        StringProperty sourceName, StringProperty destName,
-        StringProperty destDir, boolean localize)
-    {
-        super(sourceName, destName, destDir, localize);
-    }
-
-    public InputStream getInputStream(Status status)
-        throws IOException
-    {
-        return ResourceLoader.getResourceAsStream(getSourceName().getStringValue());
-    }
-
-    public String toString()
-    {
-        return "RESOURCE FILE: " + getSourceName().getStringValue();
-    }
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/artifact/ResourceJarArtifact.java b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/artifact/ResourceJarArtifact.java
deleted file mode 100644
index 6e5c4c5..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/artifact/ResourceJarArtifact.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- *   Copyright 2005 The Apache Software Foundation
- *
- *   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 org.apache.felix.framework.installer.artifact;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.apache.felix.framework.installer.Status;
-import org.apache.felix.framework.installer.StringProperty;
-import org.apache.felix.framework.installer.resource.ResourceLoader;
-
-public class ResourceJarArtifact extends AbstractJarArtifact
-{
-    public ResourceJarArtifact(StringProperty sourceName)
-    {
-        this(sourceName, null);
-    }
-
-    public ResourceJarArtifact(StringProperty sourceName, StringProperty destDir)
-    {
-        this(sourceName, destDir, false);
-    }
-
-    public ResourceJarArtifact(
-        StringProperty sourceName, StringProperty destDir, boolean localize)
-    {
-        super(sourceName, destDir, localize);
-    }
-
-    public InputStream getInputStream(Status status)
-        throws IOException
-    {
-        return ResourceLoader.getResourceAsStream(getSourceName().getStringValue());
-    }
-
-    public String toString()
-    {
-        return "RESOURCE JAR: " + getSourceName().getStringValue();
-    }
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/artifact/URLFileArtifact.java b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/artifact/URLFileArtifact.java
deleted file mode 100644
index 6c32daa..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/artifact/URLFileArtifact.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- *   Copyright 2005 The Apache Software Foundation
- *
- *   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 org.apache.felix.framework.installer.artifact;
-
-import java.io.*;
-import java.net.URL;
-import java.net.URLConnection;
-
-import org.apache.felix.framework.installer.Status;
-import org.apache.felix.framework.installer.StringProperty;
-
-public class URLFileArtifact extends AbstractFileArtifact
-{
-    public URLFileArtifact(StringProperty sourceName, StringProperty destName)
-    {
-        this(sourceName, destName, null);
-    }
-
-    public URLFileArtifact(
-        StringProperty sourceName, StringProperty destName, StringProperty destDir)
-    {
-        this(sourceName, destName, destDir, false);
-    }
-
-    public URLFileArtifact(
-        StringProperty sourceName, StringProperty destName,
-        StringProperty destDir, boolean localize)
-    {
-        super(sourceName, destName, destDir, localize);
-    }
-
-    public InputStream getInputStream(Status status)
-        throws IOException
-    {
-        String fileName = getSourceName().getStringValue();
-        fileName = (fileName.lastIndexOf('/') > 0)
-            ? fileName.substring(fileName.lastIndexOf('/') + 1)
-            : fileName;
-        
-        status.setText("Connecting...");
-
-        File file = File.createTempFile("felix-install.tmp", null);
-        file.deleteOnExit();
-
-        OutputStream os = new FileOutputStream(file);
-        URLConnection conn = new URL(getSourceName().getStringValue()).openConnection();
-        int total = conn.getContentLength();
-        InputStream is = conn.getInputStream();
-
-        int count = 0;
-        for (int len = is.read(s_buffer); len > 0; len = is.read(s_buffer))
-        {
-            count += len;
-            os.write(s_buffer, 0, len);
-            if (total > 0)
-            {
-                status.setText("Downloading " + fileName
-                    + " ( " + count + " bytes of " + total + " ).");
-            }
-            else
-            {
-                status.setText("Downloading " + fileName + " ( " + count + " bytes ).");
-            }
-        }
-
-        os.close();
-        is.close();
-
-        return new FileInputStream(file);
-    }
-
-    public String toString()
-    {
-        return "URL FILE: " + getSourceName().getStringValue();
-    }
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/artifact/URLJarArtifact.java b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/artifact/URLJarArtifact.java
deleted file mode 100644
index 1c6733b..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/artifact/URLJarArtifact.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- *   Copyright 2005 The Apache Software Foundation
- *
- *   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 org.apache.felix.framework.installer.artifact;
-
-import java.io.*;
-import java.net.URL;
-import java.net.URLConnection;
-
-import org.apache.felix.framework.installer.Status;
-import org.apache.felix.framework.installer.StringProperty;
-
-public class URLJarArtifact extends AbstractJarArtifact
-{
-    public URLJarArtifact(StringProperty sourceName)
-    {
-        this(sourceName, null);
-    }
-
-    public URLJarArtifact(StringProperty sourceName, StringProperty destDir)
-    {
-        this(sourceName, destDir, false);
-    }
-
-    public URLJarArtifact(
-        StringProperty sourceName, StringProperty destDir, boolean localize)
-    {
-        super(sourceName, destDir, localize);
-    }
-
-    public InputStream getInputStream(Status status)
-        throws IOException
-    {
-        String fileName = getSourceName().getStringValue();
-        fileName = (fileName.lastIndexOf('/') > 0)
-            ? fileName.substring(fileName.lastIndexOf('/') + 1)
-            : fileName;
-        
-        status.setText("Connecting...");
-
-        File file = File.createTempFile("felix-install.tmp", null);
-        file.deleteOnExit();
-
-        OutputStream os = new FileOutputStream(file);
-        URLConnection conn = new URL(getSourceName().getStringValue()).openConnection();
-        int total = conn.getContentLength();
-        InputStream is = conn.getInputStream();
-
-        int count = 0;
-        for (int len = is.read(s_buffer); len > 0; len = is.read(s_buffer))
-        {
-            count += len;
-            os.write(s_buffer, 0, len);
-            if (total > 0)
-            {
-                status.setText("Downloading " + fileName
-                    + " ( " + count + " bytes of " + total + " ).");
-            }
-            else
-            {
-                status.setText("Downloading " + fileName + " ( " + count + " bytes ).");
-            }
-        }
-
-        os.close();
-        is.close();
-
-        return new FileInputStream(file);
-    }
-
-    public String toString()
-    {
-        return "URL JAR: " + getSourceName().getStringValue();
-    }
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/editor/BooleanEditor.java b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/editor/BooleanEditor.java
deleted file mode 100644
index 8c70559..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/editor/BooleanEditor.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- *   Copyright 2005 The Apache Software Foundation
- *
- *   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 org.apache.felix.framework.installer.editor;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.*;
-
-import org.apache.felix.framework.installer.BooleanProperty;
-import org.apache.felix.framework.installer.Property;
-
-public class BooleanEditor extends JPanel
-{
-    private BooleanProperty m_prop = null;
-    private JRadioButton m_trueButton = null;
-    private JRadioButton m_falseButton = null;
-    private String m_trueString = null;
-    private String m_falseString = null;
-
-    public BooleanEditor(BooleanProperty prop)
-    {
-        this(prop, "true", "false");
-    }
-
-    public BooleanEditor(BooleanProperty prop, String trueString, String falseString)
-    {
-        m_prop = prop;
-        m_trueString = trueString;
-        m_falseString = falseString;
-        init();
-    }
-
-    public Property getProperty()
-    {
-        return m_prop;
-    }
-
-    public void setEnabled(boolean b)
-    {
-        m_trueButton.setEnabled(b);
-        m_falseButton.setEnabled(b);
-    }
-
-    protected void init()
-    {
-        add(m_trueButton = new JRadioButton(m_trueString));
-        add(m_falseButton = new JRadioButton(m_falseString));
-        ButtonGroup group = new ButtonGroup();
-        group.add(m_trueButton);
-        group.add(m_falseButton);
-        if (m_prop.getBooleanValue())
-        {
-            m_trueButton.setSelected(true);
-        }
-        else
-        {
-            m_falseButton.setSelected(true);
-        }
-
-        // Add action listeners.
-        m_trueButton.addActionListener(new ActionListener() {
-            public void actionPerformed(ActionEvent event)
-            {
-                m_prop.setBooleanValue(true);
-            }
-        });
-        m_falseButton.addActionListener(new ActionListener() {
-            public void actionPerformed(ActionEvent event)
-            {
-                m_prop.setBooleanValue(false);
-            }
-        });
-    }
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/editor/BooleanStringEditor.java b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/editor/BooleanStringEditor.java
deleted file mode 100644
index 5216837..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/editor/BooleanStringEditor.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- *   Copyright 2005 The Apache Software Foundation
- *
- *   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 org.apache.felix.framework.installer.editor;
-
-import java.awt.*;
-import java.awt.event.*;
-
-import javax.swing.*;
-
-import org.apache.felix.framework.installer.*;
-
-public class BooleanStringEditor extends JPanel
-{
-    private Property m_prop = null;
-    private JCheckBox m_includeButton = null;
-    private JTextField m_textField = null;
-
-    public BooleanStringEditor(Property prop)
-    {
-        if ((prop instanceof BooleanProperty) && (prop instanceof StringProperty))
-        {
-            m_prop = prop;
-        }
-        else
-        {
-            throw new IllegalArgumentException(
-                "Property must implement both boolean and string property interfaces.");
-        }
-        init();
-    }
-
-    public Property getProperty()
-    {
-        return m_prop;
-    }
-
-    public void setEnabled(boolean b)
-    {
-        m_includeButton.setEnabled(b);
-        m_textField.setEnabled(b && m_includeButton.isSelected());
-    }
-
-    protected void init()
-    {
-        // Set layout.
-        GridBagLayout grid = new GridBagLayout();
-        GridBagConstraints gbc = new GridBagConstraints();
-        gbc.insets = new Insets(0, 2, 0, 2);
-        setLayout(grid);
-
-        // Add button.
-        gbc.gridx = 0;
-        gbc.gridy = 0;
-        gbc.gridheight = 1;
-        gbc.gridwidth = 1;
-        gbc.anchor = GridBagConstraints.WEST;
-        m_includeButton = new JCheckBox("");
-        grid.setConstraints(m_includeButton, gbc);
-        add(m_includeButton);
-
-        // Add field.
-        gbc.gridx = 1;
-        gbc.gridy = 0;
-        gbc.gridheight = 1;
-        gbc.gridwidth = 3;
-        gbc.anchor = GridBagConstraints.WEST;
-        m_textField = new JTextField(30);
-        m_textField.setText(((StringProperty) m_prop).getStringValue());
-        grid.setConstraints(m_textField, gbc);
-        add(m_textField);
-        m_textField.setEnabled(false);
-
-        // Add action listener.
-        m_includeButton.addActionListener(new ActionListener() {
-            public void actionPerformed(ActionEvent event)
-            {
-                if (m_includeButton.isSelected())
-                {
-                    ((BooleanProperty) m_prop).setBooleanValue(true);
-                    m_textField.setEnabled(true);
-                }
-                else
-                {
-                    ((BooleanProperty) m_prop).setBooleanValue(false);
-                    m_textField.setEnabled(false);
-                }
-            }
-        });
-
-        // Add focus listener.
-        m_textField.addFocusListener(new FocusListener() {
-            public void focusGained(FocusEvent event)
-            {
-            }
-            public void focusLost(FocusEvent event)
-            {
-                if (!event.isTemporary())
-                {
-                    ((StringProperty) m_prop).setStringValue(m_textField.getText());
-                }
-            }
-        });
-
-        // Currently, the button is not selected. If the property
-        // is true, then click once to select button.        
-        if (((BooleanProperty) m_prop).getBooleanValue())
-        {
-            m_includeButton.doClick();
-        }
-    }
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/editor/FileEditor.java b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/editor/FileEditor.java
deleted file mode 100644
index 0d92983..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/editor/FileEditor.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- *   Copyright 2005 The Apache Software Foundation
- *
- *   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 org.apache.felix.framework.installer.editor;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.io.File;
-
-import javax.swing.*;
-
-import org.apache.felix.framework.installer.Property;
-import org.apache.felix.framework.installer.StringProperty;
-
-public class FileEditor extends JPanel
-{
-    private StringProperty m_prop = null;
-    private JTextField m_textField = null;
-    private JButton m_browseButton = null;
-    private boolean m_isDirectory = false;
-
-    public FileEditor(StringProperty prop, boolean isDirectory)
-    {
-        super();
-        m_prop = prop;
-        m_isDirectory = isDirectory;
-        init();
-    }
-
-    public Property getProperty()
-    {
-        return m_prop;
-    }
-
-    public void setEnabled(boolean b)
-    {
-        m_textField.setEnabled(b);
-        m_browseButton.setEnabled(b);
-    }
-
-    protected void init()
-    {
-        // Set layout.
-        GridBagLayout grid = new GridBagLayout();
-        GridBagConstraints gbc = new GridBagConstraints();
-        gbc.insets = new Insets(0, 2, 0, 2);
-        setLayout(grid);
-
-        // Add field.
-        gbc.gridx = 0;
-        gbc.gridy = 0;
-        gbc.gridheight = 1;
-        gbc.gridwidth = 2;
-        gbc.anchor = GridBagConstraints.WEST;
-        m_textField = new JTextField(30);
-        m_textField.setText(m_prop.getStringValue());
-        grid.setConstraints(m_textField, gbc);
-        add(m_textField);
-
-        // Add button.
-        gbc.gridx = 2;
-        gbc.gridy = 0;
-        gbc.gridheight = 1;
-        gbc.gridwidth = 1;
-        gbc.anchor = GridBagConstraints.EAST;
-        m_browseButton = new JButton("Browse...");
-        m_browseButton.setMargin(new Insets(1, 1, 1, 1));
-        grid.setConstraints(m_browseButton, gbc);
-        add(m_browseButton);
-
-        // Add focus listener.
-        m_textField.addFocusListener(new FocusListener() {
-            public void focusGained(FocusEvent event)
-            {
-            }
-            public void focusLost(FocusEvent event)
-            {
-                if (!event.isTemporary())
-                {
-                    // Set the new value.
-                    m_prop.setStringValue(normalizeValue(m_textField.getText()));
-
-                }
-            }
-        });
-
-        // Add action listener.
-        m_browseButton.addActionListener(new ActionListener() {
-            public void actionPerformed(ActionEvent event)
-            {
-                JFileChooser fileDlg = new JFileChooser();
-                if (m_isDirectory)
-                {
-                    fileDlg.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
-                    fileDlg.setDialogTitle("Please select a directory...");
-                }
-                else
-                {
-                    fileDlg.setFileSelectionMode(JFileChooser.FILES_ONLY);
-                    fileDlg.setDialogTitle("Please select a file...");
-                }
-                fileDlg.setApproveButtonText("Select");
-                if (fileDlg.showOpenDialog(FileEditor.this) ==
-                    JFileChooser.APPROVE_OPTION)
-                {
-                    m_textField.setText(fileDlg.getSelectedFile().getAbsolutePath());
-                    m_prop.setStringValue(normalizeValue(m_textField.getText()));
-                }
-            }
-        });
-    }
-
-    private String normalizeValue(String value)
-    {
-        // Make sure that directories never end with a slash,
-        // for consistency.
-        if (m_isDirectory)
-        {
-            if (value.endsWith(File.separator))
-            {
-                value = value.substring(0, value.length() - 1);
-            }
-        }
-        return value;
-    }
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/editor/StringEditor.java b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/editor/StringEditor.java
deleted file mode 100644
index d6c8145..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/editor/StringEditor.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- *   Copyright 2005 The Apache Software Foundation
- *
- *   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 org.apache.felix.framework.installer.editor;
-
-import java.awt.*;
-import java.awt.event.FocusEvent;
-import java.awt.event.FocusListener;
-
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-
-import org.apache.felix.framework.installer.Property;
-import org.apache.felix.framework.installer.StringProperty;
-
-public class StringEditor extends JPanel
-{
-    private StringProperty m_prop = null;
-    private JTextField m_textField = null;
-
-    public StringEditor(StringProperty prop)
-    {
-        m_prop = prop;
-        init();
-    }
-
-    public Property getProperty()
-    {
-        return m_prop;
-    }
-
-    public void setEnabled(boolean b)
-    {
-        m_textField.setEnabled(b);
-    }
-
-    protected void init()
-    {
-        // Set layout.
-        GridBagLayout grid = new GridBagLayout();
-        GridBagConstraints gbc = new GridBagConstraints();
-        gbc.insets = new Insets(0, 2, 0, 2);
-        setLayout(grid);
-
-        // Add field.
-        gbc.gridx = 0;
-        gbc.gridy = 0;
-        gbc.gridheight = 1;
-        gbc.gridwidth = 2;
-        gbc.anchor = GridBagConstraints.WEST;
-        m_textField = new JTextField(20);
-        m_textField.setText(m_prop.getStringValue());
-        grid.setConstraints(m_textField, gbc);
-        add(m_textField);
-
-        // Add focus listener.
-        m_textField.addFocusListener(new FocusListener() {
-            public void focusGained(FocusEvent event)
-            {
-            }
-            public void focusLost(FocusEvent event)
-            {
-                if (!event.isTemporary())
-                {
-                    m_prop.setStringValue(m_textField.getText());
-                }
-            }
-        });
-    }
-}
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/manifest.mf b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/manifest.mf
deleted file mode 100644
index f25e0aa..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/manifest.mf
+++ /dev/null
@@ -1 +0,0 @@
-Main-Class: org.apache.osgi.framework.installer.Install
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/property/BooleanPropertyImpl.java b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/property/BooleanPropertyImpl.java
deleted file mode 100644
index 4be2e6d..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/property/BooleanPropertyImpl.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- *   Copyright 2005 The Apache Software Foundation
- *
- *   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 org.apache.felix.framework.installer.property;
-
-import javax.swing.JComponent;
-
-import org.apache.felix.framework.installer.BooleanProperty;
-import org.apache.felix.framework.installer.editor.BooleanEditor;
-
-public class BooleanPropertyImpl implements BooleanProperty
-{
-    private String m_name = null;
-    private boolean m_value = false;
-    private JComponent m_editor = null;
-
-    public BooleanPropertyImpl(String name, boolean value)
-    {
-        m_name = name;
-        m_value = value;
-    }
-
-    public String getName()
-    {
-        return m_name;
-    }
-
-    public boolean getBooleanValue()
-    {
-        return m_value;
-    }
-
-    public void setBooleanValue(boolean b)
-    {
-        m_value = b;
-    }
-
-    public JComponent getEditor()
-    {
-        if (m_editor == null)
-        {
-            m_editor = new BooleanEditor(this);
-        }
-        return m_editor;
-    }
-
-    public void setEditor(JComponent comp)
-    {
-        m_editor = comp;
-    }
-
-    public String toString()
-    {
-        return (m_value) ? Boolean.TRUE.toString() : Boolean.FALSE.toString();
-    }
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/property/BooleanStringPropertyImpl.java b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/property/BooleanStringPropertyImpl.java
deleted file mode 100644
index 4a2d0de..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/property/BooleanStringPropertyImpl.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- *   Copyright 2005 The Apache Software Foundation
- *
- *   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 org.apache.felix.framework.installer.property;
-
-import javax.swing.JComponent;
-
-import org.apache.felix.framework.installer.BooleanProperty;
-import org.apache.felix.framework.installer.StringProperty;
-import org.apache.felix.framework.installer.editor.BooleanStringEditor;
-
-public class BooleanStringPropertyImpl implements BooleanProperty, StringProperty
-{
-    private String m_name = null;
-    private boolean m_boolean = false;
-    private String m_string = "";
-    private JComponent m_editor = null;
-
-    public BooleanStringPropertyImpl(String name, boolean b, String s)
-    {
-        m_name = name;
-        m_boolean = b;
-        m_string = s;
-    }
-
-    public String getName()
-    {
-        return m_name;
-    }
-
-    public boolean getBooleanValue()
-    {
-        return m_boolean;
-    }
-
-    public void setBooleanValue(boolean b)
-    {
-        m_boolean = b;
-    }
-
-    public String getStringValue()
-    {
-        return m_string;
-    }
-
-    public void setStringValue(String s)
-    {
-        m_string = s;
-    }
-
-    public JComponent getEditor()
-    {
-        if (m_editor == null)
-        {
-            m_editor = new BooleanStringEditor(this);
-        }
-        return m_editor;
-    }
-
-    public void setEditor(JComponent comp)
-    {
-        m_editor = comp;
-    }
-
-    public String toString()
-    {
-        return m_string;
-    }
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/property/NotBooleanPropertyImpl.java b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/property/NotBooleanPropertyImpl.java
deleted file mode 100644
index d780b61..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/property/NotBooleanPropertyImpl.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- *   Copyright 2005 The Apache Software Foundation
- *
- *   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 org.apache.felix.framework.installer.property;
-
-import javax.swing.JComponent;
-
-import org.apache.felix.framework.installer.BooleanProperty;
-import org.apache.felix.framework.installer.editor.BooleanEditor;
-
-public class NotBooleanPropertyImpl implements BooleanProperty
-{
-    private BooleanProperty m_prop = null;
-    private JComponent m_editor = null;
-
-    public NotBooleanPropertyImpl(BooleanProperty prop)
-    {
-        m_prop = prop;
-    }
-
-    public String getName()
-    {
-        return "NOT " + m_prop.getName();
-    }
-
-    public boolean getBooleanValue()
-    {
-        return !m_prop.getBooleanValue();
-    }
-
-    public void setBooleanValue(boolean b)
-    {
-        m_prop.setBooleanValue(!b);
-    }
-
-    public JComponent getEditor()
-    {
-        if (m_editor == null)
-        {
-            m_editor = new BooleanEditor(this);
-        }
-        return m_editor;
-    }
-
-    public void setEditor(JComponent comp)
-    {
-        m_editor = comp;
-    }
-
-    public String toString()
-    {
-        return (getBooleanValue()) ? Boolean.TRUE.toString() : Boolean.FALSE.toString();
-    }
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/property/StringPropertyImpl.java b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/property/StringPropertyImpl.java
deleted file mode 100644
index b2d99e9..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/property/StringPropertyImpl.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- *   Copyright 2005 The Apache Software Foundation
- *
- *   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 org.apache.felix.framework.installer.property;
-
-import javax.swing.JComponent;
-
-import org.apache.felix.framework.installer.StringProperty;
-import org.apache.felix.framework.installer.editor.StringEditor;
-
-public class StringPropertyImpl implements StringProperty
-{
-    private String m_name = null;
-    private String m_value = "";
-    private JComponent m_editor = null;
-
-    public StringPropertyImpl(String name, String value)
-    {
-        m_name = name;
-        m_value = value;
-    }
-
-    public String getName()
-    {
-        return m_name;
-    }
-
-    public String getStringValue()
-    {
-        return m_value;
-    }
-
-    public void setStringValue(String s)
-    {
-        m_value = s;
-    }
-
-    public JComponent getEditor()
-    {
-        if (m_editor == null)
-        {
-            m_editor = new StringEditor(this);
-        }
-        return m_editor;
-    }
-
-    public void setEditor(JComponent comp)
-    {
-        m_editor = comp;
-    }
-
-    public String toString()
-    {
-        return m_value;
-    }
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/resource/ResourceLoader.java b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/resource/ResourceLoader.java
deleted file mode 100644
index c4a4cbf..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/resource/ResourceLoader.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *   Copyright 2005 The Apache Software Foundation
- *
- *   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 org.apache.felix.framework.installer.resource;
-
-import java.io.InputStream;
-import java.net.URL;
-
-public class ResourceLoader
-{
-    public static URL getResource(String name)
-    {
-        return ResourceLoader.class.getResource(name);
-    }
-
-    public static InputStream getResourceAsStream(String name)
-    {
-        return ResourceLoader.class.getResourceAsStream(name);
-    }
-}
\ No newline at end of file
