The installer package is no longer necessary since we now have new installers.
git-svn-id: https://svn.apache.org/repos/asf/incubator/felix/trunk@384514 13f79535-47bb-0310-9956-ffa450edef68
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