Previous changeset 26:a6a9d9b94ddb (2013-04-29) Next changeset 28:2a3fdec156e0 (2013-04-29) |
Commit message:
Deleted selected files |
removed:
SMART/Java/File.class SMART/Java/File.java SMART/Java/Files.class SMART/Java/Files.java SMART/Java/FormatType.class SMART/Java/FormatType.java SMART/Java/FormatsContainer.class SMART/Java/FormatsContainer.java SMART/Java/FormatsReader.class SMART/Java/FormatsReader.java SMART/Java/Global.class SMART/Java/Global.java SMART/Java/Installer/Old/PasswordAsker.java SMART/Java/Installer/Old/SmartInstaller.java SMART/Java/Installer/Old/SmartInstallerTask.java SMART/Java/Installer/PasswordAsker.java SMART/Java/Installer/SmartInstaller.jar SMART/Java/Installer/SmartInstaller.java SMART/Java/Installer/SmartInstallerTask.java SMART/Java/Installer/build.sh SMART/Java/Installer/manifest.txt SMART/Java/Installer/s-mart.zip SMART/Java/Program.class SMART/Java/Program.java SMART/Java/ProgramFileReader.class SMART/Java/ProgramFileReader.java SMART/Java/ProgramLauncher.class SMART/Java/ProgramLauncher.java SMART/Java/ProgramOption.class SMART/Java/ProgramOption.java SMART/Java/PythonHelperReader.class SMART/Java/PythonHelperReader.java SMART/Java/PythonProgramFinder.class SMART/Java/PythonProgramFinder.java SMART/Java/Sav/File.java SMART/Java/Sav/Files.java SMART/Java/Sav/FormatType.java SMART/Java/Sav/FormatsContainer.java SMART/Java/Sav/FormatsReader.java SMART/Java/Sav/Global.java SMART/Java/Sav/Program.java SMART/Java/Sav/ProgramFileReader.java SMART/Java/Sav/ProgramLauncher.java SMART/Java/Sav/ProgramOption.java SMART/Java/Sav/PythonHelperReader.java SMART/Java/Sav/PythonProgramFinder.java SMART/Java/Sav/Smart.java SMART/Java/Smart.class SMART/Java/Smart.jar SMART/Java/Smart.java SMART/Java/SmartInstaller.jar SMART/Java/WindowsRegistry.class SMART/Java/WindowsRegistry.java SMART/Java/__init__.pyc SMART/Java/createJar.sh SMART/Java/formats.txt SMART/Java/manifest.txt |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/File.class |
b |
Binary file SMART/Java/File.class has changed |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/File.java --- a/SMART/Java/File.java Mon Apr 29 03:29:31 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,55 +0,0 @@ -/** - * - * Copyright INRA-URGI 2009-2010 - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - * - */ -public class File { - String name; - String formatType; - String format; - - - public File(String name, String type, String format) { - this.name = name; - this.formatType = type; - this.format = format; - } - - public String getName() { - return this.name; - } - - public String getFormatType() { - return this.formatType; - } - - public String getFormat() { - return this.format; - } -} |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/Files.class |
b |
Binary file SMART/Java/Files.class has changed |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/Files.java --- a/SMART/Java/Files.java Mon Apr 29 03:29:31 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,75 +0,0 @@ -/** - * - * Copyright INRA-URGI 2009-2010 - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - * - */ -import java.util.*; - -public class Files { - HashMap <String, File> files; - - public Files () { - files = new HashMap < String, File> (); - } - - public void addFile(String fileName, String type, String format) { - this.addFile(new File(fileName, type, format)); - } - - public void addFile(File file) { - files.put(file.name, file); - } - - public void clear() { - files.clear(); - } - - public String getType(String fileName) { - if (fileName == null) { - System.out.println("Error! Looking for format of empty file name!"); - } - if (! files.containsKey(fileName)) { - System.out.println("Oops! Format type of file " + fileName + " is not found!"); - return null; - } - return files.get(fileName).formatType; - } - - public String getFormat(String fileName) { - if (fileName == null) { - System.out.println("Error! Looking for format of empty file name!"); - } - if (! files.containsKey(fileName)) { - System.out.println("Oops! Format of file " + fileName + " is not found!"); - return null; - } - return files.get(fileName).format; - } -} - |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/FormatType.class |
b |
Binary file SMART/Java/FormatType.class has changed |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/FormatType.java --- a/SMART/Java/FormatType.java Mon Apr 29 03:29:31 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,64 +0,0 @@ -/** - * - * Copyright INRA-URGI 2009-2010 - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - * - */ -import java.util.*; - -public class FormatType { - String type; - Vector < String > formats; - - public FormatType (String type) { - this.type = type; - this.formats = new Vector < String > (); - } - - public String getType () { - return this.type; - } - - public void addFormat (String format) { - formats.add(format); - } - - public boolean containsFormat (String format) { - for (int i = 0; i < formats.size(); i++) { - if (((String) formats.get(i)).compareToIgnoreCase(format) == 0) { - return true; - } - } - return false; - } - - public Vector < String > getFormats () { - return formats; - } -} - |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/FormatsContainer.class |
b |
Binary file SMART/Java/FormatsContainer.class has changed |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/FormatsContainer.java --- a/SMART/Java/FormatsContainer.java Mon Apr 29 03:29:31 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,90 +0,0 @@ -/** - * - * Copyright INRA-URGI 2009-2010 - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - * - */ -import java.util.*; - -public class FormatsContainer { - - HashMap < String, FormatType > formatTypes; - - - public FormatsContainer() { - this.formatTypes = new HashMap < String, FormatType > (); - } - - - public void addFormat(String type, String format) { - FormatType formatType; - if (formatTypes.containsKey(type)) { - formatType = this.formatTypes.get(type); - } - else { - formatType = new FormatType(type); - this.formatTypes.put(type, formatType); - } - formatType.addFormat(format); - } - - - public Vector < String > getFormatTypes () { - Vector < String > v = new Vector < String > (); - v.addAll(this.formatTypes.keySet()); - return v; - } - - - public FormatType getFormats (String type) { - if (! formatTypes.containsKey(type)) { - System.out.print("Format type " + type + " is unavailable. Got: "); - Iterator it = formatTypes.entrySet().iterator(); - while (it.hasNext()) { - Map.Entry pairs = (Map.Entry) it.next(); - System.out.print(pairs.getKey() + " "); - } - System.out.println(); - } - return formatTypes.get(type); - } - - - public String getFormatType (String format) { - for (Iterator it = formatTypes.keySet().iterator(); it.hasNext(); ) { - Object type = it.next(); - Object formatType = formatTypes.get(type); - if (((FormatType) formatType).containsFormat(format)) { - return (String) type; - } - } - return null; - } -} - - |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/FormatsReader.class |
b |
Binary file SMART/Java/FormatsReader.class has changed |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/FormatsReader.java --- a/SMART/Java/FormatsReader.java Mon Apr 29 03:29:31 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,83 +0,0 @@ -/** - * - * Copyright INRA-URGI 2009-2010 - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - * - */ -import java.util.*; -import java.io.File; -import java.io.*; - - -public class FormatsReader { - - String fileName; - Vector < FormatType > formatTypes; - Vector < String > typeNames; - - - public FormatsReader(String fileName) { - this.fileName = fileName; - this.formatTypes = new Vector < FormatType > (); - } - - - public boolean read() { - File file = new File(this.fileName); - - try { - BufferedReader reader = new BufferedReader(new FileReader(file)); - String line = null; - String[] lineElements; - String[] formats; - String typeName; - - while ((line = reader.readLine()) != null) { - if (line.length() > 0) { - lineElements = line.split(":"); - typeName = lineElements[0].trim(); - formats = lineElements[1].split(","); - for (int i = 0; i < formats.length; i++) { - Global.formats.addFormat(typeName, formats[i].trim()); - } - } - } - - reader.close(); - } - catch (FileNotFoundException e) { - return false; - } - catch (IOException e) { - return false; - } - - return true; - } -} - |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/Global.class |
b |
Binary file SMART/Java/Global.class has changed |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/Global.java --- a/SMART/Java/Global.java Mon Apr 29 03:29:31 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,70 +0,0 @@ -/** - * - * Copyright INRA-URGI 2009-2010 - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - * - */ -import java.util.Vector; -import java.util.HashMap; -import javax.swing.DefaultListModel; -import javax.swing.JButton; -import javax.swing.JTextField; - -public class Global { - - public static int logAreaSize = 100; - - public static String smartConfFileName = "smart.conf"; - - public static String smartProgramsFileName = "programs.txt"; - - public static String smartFormatsFileName = "formats.txt"; - - public static String pythonPath = new String(); - - public static String pythonCommand = "python"; - - public static String mysqlCommand = "mysql"; - - public static String rCommand = "R"; - - public static Files files = new Files(); - - public static Vector < String > fileNames = new Vector < String >(); - - public static FormatsContainer formats = new FormatsContainer(); - - public static boolean programRunning = false; - - public static HashMap < JButton, JTextField > otherFilesChooser = new HashMap < JButton, JTextField >(); - - public static HashMap < JButton, JTextField > otherDirectoriesChooser = new HashMap < JButton, JTextField >(); - - public static HashMap < JButton, JTextField > otherFileConcatenationChooser = new HashMap < JButton, JTextField >(); - -} |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/Installer/Old/PasswordAsker.java --- a/SMART/Java/Installer/Old/PasswordAsker.java Mon Apr 29 03:29:31 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,87 +0,0 @@ -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; -import java.util.concurrent.CountDownLatch; - -public class PasswordAsker { - - static String password; - static JFrame frame; - static CountDownLatch latch; - - - public PasswordAsker() { - password = null; - javax.swing.SwingUtilities.invokeLater(new Runnable() { - public void run() { - createAndShowGUI(); - } - }); - latch = new CountDownLatch(1); - } - - - private static void createAndShowGUI() { - //Create and set up the window. - frame = new JFrame("Password"); - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - frame.setContentPane(setMainPane()); - - //Display the window. - frame.pack(); - frame.setVisible(true); - } - - - private static JPanel setMainPane() { - JPanel rootPanel = new JPanel(false); - rootPanel.setLayout(new GridLayout(0, 1)); - - JPanel infoPanel = new JPanel(false); - JLabel infoLabel = new JLabel("Please write here the password that you entered for the mySQL root account.\r\nNo information is stored nor sent. I promise."); - infoPanel.add(infoLabel); - - JPanel passPanel = new JPanel(false); - passPanel.setLayout(new GridLayout(1, 0)); - JLabel passLabel = new JLabel("password"); - final JTextField passText = new JTextField(20); - passLabel.setLabelFor(passText); - passPanel.add(passLabel); - passPanel.add(passText); - - JPanel okPanel = new JPanel(false); - JButton okButton = new JButton("OK"); - okPanel.add(okButton); - - okButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - password = passText.getText(); - frame.setVisible(false); - frame.dispose(); - latch.countDown(); - } - }); - - rootPanel.add(infoPanel); - rootPanel.add(passPanel); - rootPanel.add(okPanel); - - return rootPanel; - } - - - public boolean waitForPassword() { - try { - latch.await(); - } - catch (InterruptedException e) { - return false; - } - return true; - } - - - public String getPassword() { - return password; - } -} |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/Installer/Old/SmartInstaller.java --- a/SMART/Java/Installer/Old/SmartInstaller.java Mon Apr 29 03:29:31 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,167 +0,0 @@ -import java.util.*; -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.*; -import javax.swing.*; -import javax.swing.filechooser.*; -import javax.swing.border.*; -import javax.swing.SwingUtilities; -import java.net.*; - -public class SmartInstaller extends JPanel implements ActionListener { - int BUFFER = 1024; - - JFrame mainFrame; - JTextArea logArea; - - // configuration chooser buttons - String configurations[] = {"32 bits", "64 bits"}; - JRadioButton configurationButtons[]; - - // program chooser buttons - String programChoosers[] = {"R", "R Color Brewer Package", "R HMisc Package", "MySQL", "MySQL account", "Python 2.6", "Python DB", "S-MART"}; - JCheckBox programChooserButtons[]; - - JButton goButton; - - // install directory - JButton installDirectoryChooserButton; - JTextField installDirectoryChooserTextField; - - - public SmartInstaller() { - super(); - - Box box = Box.createVerticalBox(); - - // Header - JPanel headerPanel = new JPanel(false); - JTextArea headerArea = new JTextArea("This is the S-MART installation tool.\r\nIt will download and install the needed softwares, as well as S-MART itself.\r\nYou can unselect the software that you already have installed.\r\nDuring the installation, accept all the default parameters.\r\nPlease remember the root password if you install MySQL!"); - TitledBorder headerBorder = BorderFactory.createTitledBorder("Wellcome to the S-MART installer!"); - headerArea.setEditable(false); - headerArea.setBackground(headerPanel.getBackground()); - headerPanel.add(headerArea); - headerPanel.setBorder(headerBorder); - - - // Configuration - JPanel configurationPanel = new JPanel(false); - configurationPanel.setLayout(new GridLayout(1, 0)); - configurationButtons = new JRadioButton[configurations.length]; - ButtonGroup configurationGroup = new ButtonGroup(); - for (int i = 0; i < configurations.length; i++) { - JRadioButton button = new JRadioButton(configurations[i]); - configurationPanel.add(button); - configurationButtons[i] = button; - configurationGroup.add(button); - } - configurationButtons[0].setSelected(true); - TitledBorder configurationBorder = BorderFactory.createTitledBorder("Configuration"); - configurationPanel.setBorder(configurationBorder); - - - // Program chooser panel - JPanel programPanel = new JPanel(false); - programPanel.setLayout(new GridLayout(0, 1)); - - JLabel programLabel = new JLabel("Choose which programs to install:"); - programPanel.add(programLabel); - programChooserButtons = new JCheckBox[programChoosers.length]; - for (int i = 0; i < programChoosers.length; i++) { - JCheckBox button = new JCheckBox(programChoosers[i]); - button.setSelected(true); - programPanel.add(button); - programChooserButtons[i] = button; - } - TitledBorder programBorder = BorderFactory.createTitledBorder("Programs"); - programPanel.setBorder(programBorder); - - // Install directory chooser - JPanel installDirectoryChooserPanel = new JPanel(false); - installDirectoryChooserPanel.setLayout(new GridLayout(1, 0)); - JLabel installDirectoryChooserLabel = new JLabel("Choose a directory to install S-MART: "); - installDirectoryChooserTextField = new JTextField(); - installDirectoryChooserButton = new JButton("Open..."); - installDirectoryChooserButton.addActionListener(this); - - installDirectoryChooserPanel.add(installDirectoryChooserLabel); - installDirectoryChooserPanel.add(installDirectoryChooserTextField); - installDirectoryChooserPanel.add(installDirectoryChooserButton); - TitledBorder installDirectoryChooserBorder = BorderFactory.createTitledBorder("Installation directory"); - installDirectoryChooserPanel.setBorder(installDirectoryChooserBorder); - - // GO! - JPanel goPanel = new JPanel(false); - goButton = new JButton("GO!"); - goButton.addActionListener(this); - goButton.setSelected(true); - goPanel.add(goButton); - TitledBorder goBorder = BorderFactory.createTitledBorder("Start install"); - goPanel.setBorder(goBorder); - - // Log - logArea = new JTextArea(10, 120); - logArea.setFont(new Font("Monospaced", logArea.getFont().getStyle(), logArea.getFont().getSize())); - JScrollPane logScroll = new JScrollPane(logArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - TitledBorder logBorder = BorderFactory.createTitledBorder("Log"); - logScroll.setBorder(logBorder); - - GridLayout horizontalLayout = new GridLayout(1, 0); - - box.add(headerPanel); - box.add(configurationPanel); - box.add(programPanel); - box.add(installDirectoryChooserPanel); - box.add(goPanel); - box.add(logScroll); - - add(box); - } - - - public void actionPerformed(ActionEvent e) { - - // Install directories chooser - if (e.getSource() == goButton) { - boolean[] selectedPrograms = new boolean[programChoosers.length]; - for (int i = 0; i < programChoosers.length; i++) { - selectedPrograms[i] = programChooserButtons[i].isSelected(); - } - SmartInstallerTask task = new SmartInstallerTask(logArea, selectedPrograms, installDirectoryChooserTextField.getText(), (configurationButtons[0].isSelected())? 0: 1); - task.execute(); - } - // Install directories chooser - else if (e.getSource() == installDirectoryChooserButton) { - JFileChooser chooser = new JFileChooser(); - chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); - if (chooser.showOpenDialog(mainFrame) == JFileChooser.APPROVE_OPTION) { - installDirectoryChooserTextField.setText(chooser.getSelectedFile().getPath()); - } - } - } - - private static void createAndShowGUI() { - // Create and set up the window. - JFrame mainFrame = new JFrame("S-Mart Installer"); - mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - - //Create and set up the content pane. - JComponent newContentPane = new SmartInstaller(); - newContentPane.setOpaque(true); - mainFrame.setContentPane(newContentPane); - - // Display the window. - mainFrame.pack(); - mainFrame.setVisible(true); - } - - - public static void main(String[] args) { - javax.swing.SwingUtilities.invokeLater(new Runnable() { - public void run() { - createAndShowGUI(); - } - }); - } -} |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/Installer/Old/SmartInstallerTask.java --- a/SMART/Java/Installer/Old/SmartInstallerTask.java Mon Apr 29 03:29:31 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,455 +0,0 @@\n-import java.util.*;\n-import java.awt.event.ActionEvent;\n-import java.awt.event.ActionListener;\n-import java.io.*;\n-import javax.swing.*;\n-import javax.swing.filechooser.*;\n-import javax.swing.border.*;\n-import javax.swing.SwingUtilities;\n-import java.net.*;\n-import java.util.Stack;\n-import java.util.zip.ZipEntry;\n-import java.util.zip.ZipInputStream;\n-\n-public class SmartInstallerTask extends SwingWorker<Boolean, String> {\n-\n- int BUFFER = 1024;\n-\n- int architecture = 0;\n- String installDirectoryName = null;\n- JTextArea logArea = null;\n- boolean[] selectedPrograms = null;\n-\n- // program chooser buttons\n- String programChoosers[] = {"R", "R Color Brewer Package", "R HMisc Package", "MySQL", "MySQL account", "Python 2.6", "Python DB", "S-MART"};\n-\n- // Web addresses for the tools\n- String packageAddresses[][] = {\n- {"http://cran.cict.fr/bin/windows/base/R-2.11.0-win32.exe", "http://cran.cict.fr/bin/windows64/base/R-2.11.0-win64.exe"},\n- {"", ""},\n- {"", ""},\n- {"http://mirrors.ircam.fr/pub/mysql/Downloads/MySQL-5.1/mysql-essential-5.1.47-win32.msi", "http://mirrors.ircam.fr/pub/mysql/Downloads/MySQL-5.1/mysql-essential-5.1.47-winx64.msi"},\n- {"", ""},\n- {"http://www.python.org/ftp/python/2.6.5/python-2.6.5.msi", "http://www.python.org/ftp/python/2.6.5/python-2.6.5.amd64.msi"},\n- {"http://www.technicalbard.com/files/MySQL-python-1.2.2.win32-py2.6.exe", "http://www.technicalbard.com/files/MySQL-python-1.2.2.win32-py2.6.exe"},\n- {"http://urgi.versailles.inra.fr/download/s-mart/s-mart.zip", "http://urgi.versailles.inra.fr/download/s-mart/s-mart.zip"}\n- };\n-\n- // Packages to install\n- String rPackages[] = {"RColorBrewer", "Hmisc"};\n-\n- // Script lines\n- String scriptLines[][] = {\n- {"\\"<INSTALLDIR>\\\\R-2.11.0-win32.exe\\"", "\\"<INSTALLDIR>\\\\R-2.11.0-win64.exe\\""},\n- {"\\"<RFILE>\\" CMD BATCH \\"<INSTALLDIR>\\\\installRColorBrewer.R\\"", "\\"<RFILE>\\" CMD BATCH \\"<INSTALLDIR>\\\\installRColorBrewer.R\\""},\n- {"\\"<RFILE>\\" CMD BATCH \\"<INSTALLDIR>\\\\installHmisc.R\\"", "\\"<RFILE>\\" CMD BATCH \\"<INSTALLDIR>\\\\installHmisc.R\\""},\n- {"msiexec /i \\"<INSTALLDIR>\\\\mysql-essential-5.1.47-win32.msi\\"", "msiexec /i \\"<INSTALLDIR>\\\\mysql-essential-5.1.47-winx64.msi\\""},\n- {"", ""},\n- {"msiexec /i \\"<INSTALLDIR>\\\\python-2.6.5.msi\\"", "msiexec /i \\"<INSTALLDIR>\\\\python-2.6.5.amd64.msi\\""},\n- {"<INSTALLDIR>\\\\MySQL-python-1.2.2.win32-py2.6.exe", "<INSTALLDIR>\\\\MySQL-python-1.2.2.win32-py2.6.exe"},\n- {"", ""}\n- };\n-\n- // Files to uncompress\n- String compressedFiles[][] = {\n- {"", ""},\n- {"", ""},\n- {"", ""},\n- {"", ""},\n- {"", ""},\n- {"", ""},\n- {"", ""},\n- {"<INSTALLDIR>\\\\s-mart.zip", "<INSTALLDIR>\\\\s-mart.zip"}\n- };\n-\n-\n- public SmartInstallerTask(JTextArea ta, boolean[] b, String s, int a) {\n- logArea = ta;\n- selectedPrograms = b;\n- installDirectoryName = s;\n- architecture = a;\n- }\n-\n-\n- @Override\n- public Boolean doInBackground() {\n- boolean installOk;\n- publish("Starting install\\n");\n- writeFiles();\n- for (int i = 0; i < selectedPrograms.length; i++) {\n- if (selectedPrograms[i]) {\n- if (! install(i)) {\n- return Boolean.FALSE;\n- }\n- }\n- }\n- removeFiles();\n- setEnvironmentVariables();\n- publish("Ending install\\n");\n- return Boolean.TRUE;\n- }\n-\n-\n- @Override\n- protected void process(List<String> chunks) {\n- for (String chunk: chunks) {\n- logArea.append(chunk);\n- }\n- }\n-\n-\n- private boolean launch(String command) {\n- return realLaunch(new ProcessBuilder(command), command);\n- }\n-\n- private boolean launch(String[] command) {\n- return realLaunch(new ProcessBuilder(command), Arrays.toString(command));\n- }\n-\n- private boolean realLaunch(ProcessBuilder pb, String command) {\n- BufferedReader outputReader;\n- pb = pb.redirectErrorStream(true);\n- Process process '..b' boolean uncompressPackage(int element) {\n- String file = compressedFiles[element][architecture];\n- if (! "".equals(file)) {\n- file = replaceSubstring(file);\n- publish(" Starting uncompressing file \'" + file + "\'\\n");\n- try {\n- FileInputStream fis = new FileInputStream(file);\n- BufferedInputStream bis = new BufferedInputStream(fis);\n- ZipInputStream zis = new ZipInputStream(bis);\n- ZipEntry entry;\n- while ((entry = zis.getNextEntry()) != null) {\n- if (! entry.isDirectory()) {\n- File newFile = new File(installDirectoryName + File.separator + entry.getName());\n- // create parent directories\n- File upDirectory = newFile.getParentFile();\n- while (upDirectory != null){\n- if (! upDirectory.exists()) {\n- upDirectory.mkdir();\n- publish(" Creating directory \'" + upDirectory.getAbsolutePath() + "\'\\n");\n- }\n- upDirectory = upDirectory.getParentFile();\n- }\n- // write the files to the disk\n- publish(" Extracting \'" + entry.getName() + "\' to \'" + newFile.getAbsolutePath() + "\'\\n");\n- int count;\n- byte data[] = new byte[BUFFER];\n- FileOutputStream fos = new FileOutputStream(newFile);\n- BufferedOutputStream bos = new BufferedOutputStream(fos, BUFFER);\n- while ((count = zis.read(data, 0, BUFFER)) != -1){\n- bos.write(data, 0, count);\n- }\n- bos.flush();\n- bos.close();\n- fos.close();\n- }\n- }\n- zis.close();\n- bis.close();\n- fis.close();\n- }\n- catch(FileNotFoundException e) {\n- publish(" !Cannot find file \'" + file + "\'!\\n");\n- return false;\n- }\n- catch(Exception e){\n- publish(" !Cannot uncompress file \'" + file + "\'!\\n");\n- return false;\n- }\n- publish(" Ending uncompressing file \'" + file + "\'\\n");\n- }\n- return true;\n- }\n-\n-\n- private boolean removePackage(int element) {\n- String packageName = packageAddresses[element][architecture];\n- if ("".equals(packageName)) {\n- return true;\n- }\n- String fileName = getLocalName(packageAddresses[element][architecture]);\n- return removeFile(fileName);\n- }\n-\n-\n- private boolean postProcess(int element) {\n- switch (element) {\n- case 4:\n- // Create mySQL user\n- PasswordAsker pa = new PasswordAsker();\n- if (! pa.waitForPassword()) {\n- publish("Problem in the password asker!\\n");\n- return false;\n- }\n- String command = "\\"<MYSQLFILE>\\" --user=root --password=" + pa.getPassword() + " -e \\"source <INSTALLDIR>\\\\createUser.sql\\"";\n- command = replaceSubstring(command);\n- if (! launch(command)) {\n- publish(" !Cannot create SQL accounts!\\n");\n- return false;\n- }\n- return true;\n- case 7:\n- // Move S-MART files to parent directory\n- File installDirectory = new File(installDirectoryName + File.separator + "S-Mart");\n- for (File file: installDirectory.listFiles()) {\n- File destinationFile = new File(file.getParentFile().getParentFile(), file.getName());\n- if (! file.renameTo(destinationFile)) {\n- publish(" !Cannot move \'" + file.getAbsolutePath() + "\' to \'" + destinationFile.getAbsolutePath() + "\'!\\n");\n- }\n- }\n- if (! installDirectory.delete()) {\n- publish(" !Cannot remove installation S-MART directory \'" + installDirectory.getAbsolutePath() + "\'!\\n");\n- }\n- }\n- return true;\n- }\n-\n-\n- private boolean setEnvironmentVariables() {\n- String[] command = {"REG", "ADD", "HKCU\\\\Environment", "/v", "PYTHONPATH", "/t", "REG_SZ", "/d", "\\"" + installDirectoryName + "\\\\Python\\"", "/f"};\n- return launch(command);\n- }\n-}\n-\n' |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/Installer/PasswordAsker.java --- a/SMART/Java/Installer/PasswordAsker.java Mon Apr 29 03:29:31 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,87 +0,0 @@ -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; -import java.util.concurrent.CountDownLatch; - -public class PasswordAsker { - - static String password; - static JFrame frame; - static CountDownLatch latch; - - - public PasswordAsker() { - password = null; - javax.swing.SwingUtilities.invokeLater(new Runnable() { - public void run() { - createAndShowGUI(); - } - }); - latch = new CountDownLatch(1); - } - - - private static void createAndShowGUI() { - //Create and set up the window. - frame = new JFrame("Password"); - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - frame.setContentPane(setMainPane()); - - //Display the window. - frame.pack(); - frame.setVisible(true); - } - - - private static JPanel setMainPane() { - JPanel rootPanel = new JPanel(false); - rootPanel.setLayout(new GridLayout(0, 1)); - - JPanel infoPanel = new JPanel(false); - JLabel infoLabel = new JLabel("Please write here the password that you entered for the mySQL root account.\r\nNo information is stored nor sent. I promise."); - infoPanel.add(infoLabel); - - JPanel passPanel = new JPanel(false); - passPanel.setLayout(new GridLayout(1, 0)); - JLabel passLabel = new JLabel("password"); - final JTextField passText = new JTextField(20); - passLabel.setLabelFor(passText); - passPanel.add(passLabel); - passPanel.add(passText); - - JPanel okPanel = new JPanel(false); - JButton okButton = new JButton("OK"); - okPanel.add(okButton); - - okButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - password = passText.getText(); - frame.setVisible(false); - frame.dispose(); - latch.countDown(); - } - }); - - rootPanel.add(infoPanel); - rootPanel.add(passPanel); - rootPanel.add(okPanel); - - return rootPanel; - } - - - public boolean waitForPassword() { - try { - latch.await(); - } - catch (InterruptedException e) { - return false; - } - return true; - } - - - public String getPassword() { - return password; - } -} |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/Installer/SmartInstaller.jar |
b |
Binary file SMART/Java/Installer/SmartInstaller.jar has changed |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/Installer/SmartInstaller.java --- a/SMART/Java/Installer/SmartInstaller.java Mon Apr 29 03:29:31 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,167 +0,0 @@ -import java.util.*; -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.*; -import javax.swing.*; -import javax.swing.filechooser.*; -import javax.swing.border.*; -import javax.swing.SwingUtilities; -import java.net.*; - -public class SmartInstaller extends JPanel implements ActionListener { - int BUFFER = 1024; - - JFrame mainFrame; - JTextArea logArea; - - // configuration chooser buttons - String configurations[] = {"32 bits", "64 bits"}; - JRadioButton configurationButtons[]; - - // program chooser buttons - String programChoosers[] = {"R", "R Color Brewer Package", "R HMisc Package", "Python 2.6", "S-MART"}; - JCheckBox programChooserButtons[]; - - JButton goButton; - - // install directory - JButton installDirectoryChooserButton; - JTextField installDirectoryChooserTextField; - - - public SmartInstaller() { - super(); - - Box box = Box.createVerticalBox(); - - // Header - JPanel headerPanel = new JPanel(false); - JTextArea headerArea = new JTextArea("This is the S-MART installation tool.\r\nIt will download and install the needed softwares, as well as S-MART itself.\r\nYou can unselect the software that you already have installed.\r\nDuring the installation, accept all the default parameters."); - TitledBorder headerBorder = BorderFactory.createTitledBorder("Welcome to the S-MART installer!"); - headerArea.setEditable(false); - headerArea.setBackground(headerPanel.getBackground()); - headerPanel.add(headerArea); - headerPanel.setBorder(headerBorder); - - - // Configuration - JPanel configurationPanel = new JPanel(false); - configurationPanel.setLayout(new GridLayout(1, 0)); - configurationButtons = new JRadioButton[configurations.length]; - ButtonGroup configurationGroup = new ButtonGroup(); - for (int i = 0; i < configurations.length; i++) { - JRadioButton button = new JRadioButton(configurations[i]); - configurationPanel.add(button); - configurationButtons[i] = button; - configurationGroup.add(button); - } - configurationButtons[0].setSelected(true); - TitledBorder configurationBorder = BorderFactory.createTitledBorder("Configuration"); - configurationPanel.setBorder(configurationBorder); - - - // Program chooser panel - JPanel programPanel = new JPanel(false); - programPanel.setLayout(new GridLayout(0, 1)); - - JLabel programLabel = new JLabel("Choose which programs to install:"); - programPanel.add(programLabel); - programChooserButtons = new JCheckBox[programChoosers.length]; - for (int i = 0; i < programChoosers.length; i++) { - JCheckBox button = new JCheckBox(programChoosers[i]); - button.setSelected(true); - programPanel.add(button); - programChooserButtons[i] = button; - } - TitledBorder programBorder = BorderFactory.createTitledBorder("Programs"); - programPanel.setBorder(programBorder); - - // Install directory chooser - JPanel installDirectoryChooserPanel = new JPanel(false); - installDirectoryChooserPanel.setLayout(new GridLayout(1, 0)); - JLabel installDirectoryChooserLabel = new JLabel("Choose a directory to install S-MART: "); - installDirectoryChooserTextField = new JTextField(); - installDirectoryChooserButton = new JButton("Open..."); - installDirectoryChooserButton.addActionListener(this); - - installDirectoryChooserPanel.add(installDirectoryChooserLabel); - installDirectoryChooserPanel.add(installDirectoryChooserTextField); - installDirectoryChooserPanel.add(installDirectoryChooserButton); - TitledBorder installDirectoryChooserBorder = BorderFactory.createTitledBorder("Installation directory"); - installDirectoryChooserPanel.setBorder(installDirectoryChooserBorder); - - // GO! - JPanel goPanel = new JPanel(false); - goButton = new JButton("GO!"); - goButton.addActionListener(this); - goButton.setSelected(true); - goPanel.add(goButton); - TitledBorder goBorder = BorderFactory.createTitledBorder("Start install"); - goPanel.setBorder(goBorder); - - // Log - logArea = new JTextArea(10, 120); - logArea.setFont(new Font("Monospaced", logArea.getFont().getStyle(), logArea.getFont().getSize())); - JScrollPane logScroll = new JScrollPane(logArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - TitledBorder logBorder = BorderFactory.createTitledBorder("Log"); - logScroll.setBorder(logBorder); - - GridLayout horizontalLayout = new GridLayout(1, 0); - - box.add(headerPanel); - box.add(configurationPanel); - box.add(programPanel); - box.add(installDirectoryChooserPanel); - box.add(goPanel); - box.add(logScroll); - - add(box); - } - - - public void actionPerformed(ActionEvent e) { - - // Install directories chooser - if (e.getSource() == goButton) { - boolean[] selectedPrograms = new boolean[programChoosers.length]; - for (int i = 0; i < programChoosers.length; i++) { - selectedPrograms[i] = programChooserButtons[i].isSelected(); - } - SmartInstallerTask task = new SmartInstallerTask(logArea, selectedPrograms, installDirectoryChooserTextField.getText(), (configurationButtons[0].isSelected())? 0: 1); - task.execute(); - } - // Install directories chooser - else if (e.getSource() == installDirectoryChooserButton) { - JFileChooser chooser = new JFileChooser(); - chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); - if (chooser.showOpenDialog(mainFrame) == JFileChooser.APPROVE_OPTION) { - installDirectoryChooserTextField.setText(chooser.getSelectedFile().getPath()); - } - } - } - - private static void createAndShowGUI() { - // Create and set up the window. - JFrame mainFrame = new JFrame("S-Mart Installer"); - mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - - //Create and set up the content pane. - JComponent newContentPane = new SmartInstaller(); - newContentPane.setOpaque(true); - mainFrame.setContentPane(newContentPane); - - // Display the window. - mainFrame.pack(); - mainFrame.setVisible(true); - } - - - public static void main(String[] args) { - javax.swing.SwingUtilities.invokeLater(new Runnable() { - public void run() { - createAndShowGUI(); - } - }); - } -} |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/Installer/SmartInstallerTask.java --- a/SMART/Java/Installer/SmartInstallerTask.java Mon Apr 29 03:29:31 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,419 +0,0 @@\n-import java.util.*;\n-import java.awt.event.ActionEvent;\n-import java.awt.event.ActionListener;\n-import java.io.*;\n-import javax.swing.*;\n-import javax.swing.filechooser.*;\n-import javax.swing.border.*;\n-import javax.swing.SwingUtilities;\n-import java.net.*;\n-import java.util.Stack;\n-import java.util.zip.ZipEntry;\n-import java.util.zip.ZipInputStream;\n-\n-public class SmartInstallerTask extends SwingWorker<Boolean, String> {\n-\n- int BUFFER = 1024;\n-\n- int architecture = 0;\n- String installDirectoryName = null;\n- JTextArea logArea = null;\n- boolean[] selectedPrograms = null;\n-\n- // program chooser buttons\n- String programChoosers[] = {"R", "R Color Brewer Package", "R HMisc Package", "Python 2.6", "S-MART"};\n-\n- // Web addresses for the tools\n- String packageAddresses[][] = {\n- {"http://cran.cict.fr/bin/windows/base/R-2.11.0-win32.exe", "http://cran.cict.fr/bin/windows64/base/R-2.11.0-win64.exe"},\n- {"", ""},\n- {"", ""},\n- {"http://www.python.org/ftp/python/2.6.5/python-2.6.5.msi", "http://www.python.org/ftp/python/2.6.5/python-2.6.5.amd64.msi"},\n- {"http://urgi.versailles.inra.fr/content/download/1929/17848/file/s-mart-1.0.15.zip", "http://urgi.versailles.inra.fr/content/download/1929/17848/file/s-mart-1.0.15.zip"}\n- };\n-\n- // Packages to install\n- String rPackages[] = {"RColorBrewer", "Hmisc"};\n-\n- // Script lines\n- String scriptLines[][] = {\n- {"\\"<INSTALLDIR>\\\\R-2.11.0-win32.exe\\"", "\\"<INSTALLDIR>\\\\R-2.11.0-win64.exe\\""},\n- {"\\"<RFILE>\\" CMD BATCH \\"<INSTALLDIR>\\\\installRColorBrewer.R\\"", "\\"<RFILE>\\" CMD BATCH \\"<INSTALLDIR>\\\\installRColorBrewer.R\\""},\n- {"\\"<RFILE>\\" CMD BATCH \\"<INSTALLDIR>\\\\installHmisc.R\\"", "\\"<RFILE>\\" CMD BATCH \\"<INSTALLDIR>\\\\installHmisc.R\\""},\n- {"msiexec /i \\"<INSTALLDIR>\\\\python-2.6.5.msi\\"", "msiexec /i \\"<INSTALLDIR>\\\\python-2.6.5.amd64.msi\\""},\n- {"", ""}\n- };\n-\n- // Files to uncompress\n- String compressedFiles[][] = {\n- {"", ""},\n- {"", ""},\n- {"", ""},\n- {"", ""},\n- {"<INSTALLDIR>\\\\s-mart-1.0.15.zip", "<INSTALLDIR>\\\\s-mart-1.0.15.zip"}\n- };\n-\n-\n- public SmartInstallerTask(JTextArea ta, boolean[] b, String s, int a) {\n- logArea = ta;\n- selectedPrograms = b;\n- installDirectoryName = s;\n- architecture = a;\n- }\n-\n-\n- @Override\n- public Boolean doInBackground() {\n- boolean installOk;\n- publish("Starting install\\n");\n- writeFiles();\n- for (int i = 0; i < selectedPrograms.length; i++) {\n- if (selectedPrograms[i]) {\n- if (! install(i)) {\n- return Boolean.FALSE;\n- }\n- }\n- }\n- removeFiles();\n- setEnvironmentVariables();\n- publish("Ending install\\n");\n- return Boolean.TRUE;\n- }\n-\n-\n- @Override\n- protected void process(List<String> chunks) {\n- for (String chunk: chunks) {\n- logArea.append(chunk);\n- }\n- }\n-\n-\n- private boolean launch(String command) {\n- return realLaunch(new ProcessBuilder(command), command);\n- }\n-\n- private boolean launch(String[] command) {\n- return realLaunch(new ProcessBuilder(command), Arrays.toString(command));\n- }\n-\n- private boolean realLaunch(ProcessBuilder pb, String command) {\n- BufferedReader outputReader;\n- pb = pb.redirectErrorStream(true);\n- Process process = null;\n- publish(" Starting command \'" + command + "\'\\n");\n- try {\n- process = pb.start();\n- BufferedInputStream outputStream = new BufferedInputStream(process.getInputStream());\n- InputStream is = process.getInputStream();\n- InputStreamReader isr = new InputStreamReader(is);\n- outputReader = new BufferedReader(isr);\n- }\n- catch (Exception exception) {\n- publish(" !Process cannot be started (command is \'" + command + "\')!\\n");\n- exception.printStackTrace();\n- return false;\n- }\n- if (outputReader == null) {\n- publish(" !Problem in the outp'..b'turn false;\n- }\n- try {\n- process.waitFor();\n- }\n- catch (InterruptedException e) {\n- publish(" !Cannot wait for the end of the command \'" + command + "\'!\\n");\n- return false;\n- }\n- int exitValue = process.exitValue();\n- if (exitValue != 0) {\n- publish(" !Problem during the execution of the command \'" + command + "\'!\\n");\n- return false;\n- }\n- publish(" Ending command \'" + command + "\'\\n");\n- }\n- }\n- return true;\n- }\n-\n-\n- private boolean uncompressPackage(int element) {\n- String file = compressedFiles[element][architecture];\n- if (! "".equals(file)) {\n- file = replaceSubstring(file);\n- publish(" Starting uncompressing file \'" + file + "\'\\n");\n- try {\n- FileInputStream fis = new FileInputStream(file);\n- BufferedInputStream bis = new BufferedInputStream(fis);\n- ZipInputStream zis = new ZipInputStream(bis);\n- ZipEntry entry;\n- while ((entry = zis.getNextEntry()) != null) {\n- if (! entry.isDirectory()) {\n- File newFile = new File(installDirectoryName + File.separator + entry.getName());\n- // create parent directories\n- File upDirectory = newFile.getParentFile();\n- while (upDirectory != null){\n- if (! upDirectory.exists()) {\n- upDirectory.mkdir();\n- publish(" Creating directory \'" + upDirectory.getAbsolutePath() + "\'\\n");\n- }\n- upDirectory = upDirectory.getParentFile();\n- }\n- // write the files to the disk\n- publish(" Extracting \'" + entry.getName() + "\' to \'" + newFile.getAbsolutePath() + "\'\\n");\n- int count;\n- byte data[] = new byte[BUFFER];\n- FileOutputStream fos = new FileOutputStream(newFile);\n- BufferedOutputStream bos = new BufferedOutputStream(fos, BUFFER);\n- while ((count = zis.read(data, 0, BUFFER)) != -1){\n- bos.write(data, 0, count);\n- }\n- bos.flush();\n- bos.close();\n- fos.close();\n- }\n- }\n- zis.close();\n- bis.close();\n- fis.close();\n- }\n- catch(FileNotFoundException e) {\n- publish(" !Cannot find file \'" + file + "\'!\\n");\n- return false;\n- }\n- catch(Exception e){\n- publish(" !Cannot uncompress file \'" + file + "\'!\\n");\n- return false;\n- }\n- publish(" Ending uncompressing file \'" + file + "\'\\n");\n- }\n- return true;\n- }\n-\n-\n- private boolean removePackage(int element) {\n- String packageName = packageAddresses[element][architecture];\n- if ("".equals(packageName)) {\n- return true;\n- }\n- String fileName = getLocalName(packageAddresses[element][architecture]);\n- return removeFile(fileName);\n- }\n-\n-\n- private boolean postProcess(int element) {\n- switch (element) {\n- case 4:\n- // Move S-MART files to parent directory\n- File installDirectory = new File(installDirectoryName + File.separator + "S-Mart");\n- for (File file: installDirectory.listFiles()) {\n- File destinationFile = new File(file.getParentFile().getParentFile(), file.getName());\n- if (! file.renameTo(destinationFile)) {\n- publish(" !Cannot move \'" + file.getAbsolutePath() + "\' to \'" + destinationFile.getAbsolutePath() + "\'!\\n");\n- }\n- }\n- if (! installDirectory.delete()) {\n- publish(" !Cannot remove installation S-MART directory \'" + installDirectory.getAbsolutePath() + "\'!\\n");\n- }\n- }\n- return true;\n- }\n-\n-\n- private boolean setEnvironmentVariables() {\n- String[] command = {"REG", "ADD", "HKCU\\\\Environment", "/v", "PYTHONPATH", "/t", "REG_SZ", "/d", "\\"" + installDirectoryName + "\\\\Python\\"", "/f"};\n- return launch(command);\n- }\n-}\n-\n' |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/Installer/build.sh --- a/SMART/Java/Installer/build.sh Mon Apr 29 03:29:31 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,5 +0,0 @@ -#! /bin/sh - -rm -rf SmartInstaller.jar -javac *.java -jar cvfm SmartInstaller.jar manifest.txt *.class |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/Installer/manifest.txt --- a/SMART/Java/Installer/manifest.txt Mon Apr 29 03:29:31 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Created-By: Matthias Zytnicki -Main-Class: SmartInstaller |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/Installer/s-mart.zip |
b |
Binary file SMART/Java/Installer/s-mart.zip has changed |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/Program.class |
b |
Binary file SMART/Java/Program.class has changed |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/Program.java --- a/SMART/Java/Program.java Mon Apr 29 03:29:31 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,175 +0,0 @@ -/** - * - * Copyright INRA-URGI 2009-2010 - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - * - */ -import java.util.*; -import java.awt.*; -import javax.swing.*; - - -public class Program { - String shortName; - String name; - String section; - String description; - Vector <ProgramOption> options; - JPanel panel; - JButton button; - - - public Program() { - this.shortName = null; - this.name = null; - this.options = new Vector <ProgramOption> (); - } - - - public void setShortName(String shortName) { - this.shortName = shortName; - } - - - public void setName(String name) { - this.name = name; - } - - - public void setSection(String section) { - this.section = section; - } - - public void setDescription(String description) { - this.description = description; - } - - - public void addOption(ProgramOption option) { - options.add(option); - } - - - public String getShortName() { - return this.shortName; - } - - - public String getName() { - return this.name; - } - - - public String getSection() { - return this.section; - } - - public String getDescription() { - return this.description; - } - - - public String checkValues() { - for (int i = 0; i < options.size(); i++) { - String comment = options.get(i).checkValue(); - if (comment != null) { - return comment; - } - } - return null; - } - - - public LinkedList<String> getCommand() { - LinkedList<String> parameterList = new LinkedList<String>(); - parameterList.add(Global.pythonCommand); - parameterList.add("Python" + java.io.File.separator + this.shortName); - for (int i = 0; i < options.size(); i++) { - ProgramOption option = options.get(i); - parameterList.addAll(option.getCommand()); - } - return parameterList; - } - - - public JPanel getPanel() { - if (this.panel != null) { - return this.panel; - } - - this.panel = new JPanel(false); - this.panel.setLayout(new FlowLayout()); - Box box = Box.createVerticalBox(); - - JPanel descriptionPanel = new JPanel(false); - JLabel descriptionLabel = new JLabel(this.description); - descriptionPanel.add(descriptionLabel); - box.add(descriptionPanel); - - for (int i = 0; i < options.size(); i++) { - ProgramOption option = options.get(i); - JPanel panel = option.getPanel(); - if (panel == null) { - System.out.println("Problem with Python program '" + this.shortName + "'."); - return null; - } - box.add(option.getPanel()); - } - - JPanel buttonPanel = new JPanel(false); - this.button = new JButton("GO!"); - - buttonPanel.add(button); - - box.add(buttonPanel); - - this.panel.add(box); - - return this.panel; - } - - - public JButton getButton() { - if (this.button == null) { - this.getPanel(); - } - return this.button; - } - - - public Vector < File > getOutputFiles() { - Vector < File > files = new Vector < File > (); - for (int i = 0; i < options.size(); i++) { - ProgramOption option = options.get(i); - if (! option.isInput()) { - files.add(option.getOutputFile()); - } - } - return files; - } -} |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/ProgramFileReader.class |
b |
Binary file SMART/Java/ProgramFileReader.class has changed |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/ProgramFileReader.java --- a/SMART/Java/ProgramFileReader.java Mon Apr 29 03:29:31 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,174 +0,0 @@ -/** - * - * Copyright INRA-URGI 2009-2010 - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - * - */ -import java.util.*; -import java.io.File; -import java.io.*; - - -public class ProgramFileReader { - String fileName; - Vector <Program> programs; - - - public ProgramFileReader(String fileName) { - this.fileName = fileName; - this.programs = new Vector <Program> (); - } - - - public boolean read() { -// File file = new File(this.fileName); -// Program program = null; -// int step = 0; -// TreeMap <String, ProgramOption> options = new TreeMap <String, ProgramOption> (); - -// try { -// BufferedReader reader = new BufferedReader(new FileReader(file)); -// String line = null; -// String section = null; - -// while ((line = reader.readLine()) != null) { - -// line = line.trim(); - -// if (line.length() == 0) { -// if (program != null) { -// programs.add(program); -// } -// program = null; -// step = 0; -// continue; -// } - -// if ((line.charAt(0) == '[') && (line.charAt(line.length() - 1) == ']')) { -// section = line.substring(1, line.length() - 1).trim(); -// continue; -// } -// switch (step) { -// case 0: -// program = new Program(); -// program.setName(line); -// if (section == null) { -// System.out.println("Error! Section of program '" + line + "' is not set!"); -// } -// program.setSection(section); -// step = 1; -// break; -// case 1: -// program.setShortName(line); -// step = 2; -// break; -// case 2: -// ProgramOption option = new ProgramOption(); - -// String[] elements = line.split(":"); -// boolean input = elements[0].trim().equalsIgnoreCase("input")? true: false; -// String[] subElements = elements[1].split(";"); -// String identifier = subElements[0].trim(); - -// option.setInput(input); - -// if (input) { - -// if (subElements.length < 4) { -// System.out.println("Line '" + line + "' is weird..."); -// } - -// String type = subElements[1].trim(); -// String comment = subElements[2].trim(); -// boolean compulsory = subElements[3].trim().equalsIgnoreCase("0")? false: true; - -// option.setIdentifier(identifier); -// option.setType(type); -// option.setComment(comment); -// option.setCompulsory(compulsory); - -// if ("file".compareToIgnoreCase(type) == 0) { -// if (subElements.length < 5) { -// System.out.println("Line '" + line + "' is weird..."); -// } - -// String formatIdentifier = subElements[4].trim(); -// option.setFormatIdentifier(formatIdentifier); -// } -// else if ("choice".compareToIgnoreCase(type) == 0) { -// if (subElements.length < 5) { -// System.out.println("Line '" + line + "' is weird..."); -// } - -// String[] choices = subElements[4].trim().split(","); -// for (int i = 0; i < choices.length; i++) { -// choices[i] = choices[i].trim(); -// } -// option.setChoices(choices); -// } -// options.put(identifier, option); -// } -// else { -// String format = subElements[1].trim(); - -// option.setFormat(format); -// option.setAssociatedOption(options.get(identifier)); -// } - -// program.addOption(option); - -// break; -// default: -// return false; -// } -// } - -// reader.close(); -// } -// catch (FileNotFoundException e) { -// return false; -// } -// catch (IOException e) { -// return false; -// } - -// if (program != null) { -// programs.add(program); -// } - - return true; - } - - public int getNbPrograms() { - return programs.size(); - } - - public Program getProgram(int i) { - return programs.get(i); - } -} |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/ProgramLauncher.class |
b |
Binary file SMART/Java/ProgramLauncher.class has changed |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/ProgramLauncher.java --- a/SMART/Java/ProgramLauncher.java Mon Apr 29 03:29:31 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,209 +0,0 @@ -/** - * - * Copyright INRA-URGI 2009-2010 - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - * - */ -import java.util.*; -import java.io.*; -import javax.swing.SwingUtilities; -import javax.swing.*; -import java.util.concurrent.CountDownLatch; - -public class ProgramLauncher extends SwingWorker<Boolean, String> { - - String[] command; - JTextArea logArea; - JLabel messageField; - JProgressBar progressBar; - JLabel etaField; - int exitValue; - CountDownLatch latch; - - - - public ProgramLauncher (LinkedList <String> c, JTextArea la, JLabel mf, JProgressBar pb, JLabel ef) { - command = new String[c.size()]; - logArea = la; - messageField = mf; - progressBar = pb; - etaField = ef; - exitValue = -1; - c.toArray(command); - latch = new CountDownLatch(1); - } - - - public ProgramLauncher (String[] c, JTextArea la, JLabel mf, JProgressBar pb, JLabel ef) { - command = c; - logArea = la; - messageField = mf; - progressBar = pb; - etaField = ef; - exitValue = -1; - latch = new CountDownLatch(1); - } - - - @Override - public Boolean doInBackground() { - ProcessBuilder pb = new ProcessBuilder(command); - Process process = null; - BufferedReader outputReader = null; - pb = pb.redirectErrorStream(true); - Map<String, String> env = pb.environment(); - env.put("PYTHONPATH", System.getProperty("user.dir")); - env.put("SMARTPATH", System.getProperty("user.dir") + java.io.File.separator + "SMART" + java.io.File.separator + "Java" + java.io.File.separator + "Python"); - env.put("SMARTMYSQLPATH", Global.mysqlCommand); - env.put("SMARTRPATH", Global.rCommand); - String commandJoined = Arrays.toString(command); - - try { - publish("=== Starting command '" + commandJoined.trim() + "' ===\n"); - process = pb.start(); - - BufferedInputStream outputStream = new BufferedInputStream(process.getInputStream()); - InputStream is = process.getInputStream(); - InputStreamReader isr = new InputStreamReader(is); - outputReader = new BufferedReader(isr); - } - catch (Exception exception) { - publish("!Process cannot be started (command is '" + commandJoined + "')!\n"); - exception.printStackTrace(); - latch.countDown(); - return Boolean.FALSE; - } - if (outputReader == null) { - publish("!Problem in the output of the command!\n"); - latch.countDown(); - return Boolean.FALSE; - } - else { - try { - String line; - while ((line = outputReader.readLine()) != null) { - publish(line + "\n"); - } - } - catch (IOException e) { - e.printStackTrace(); - publish("!Cannot get the output of the command!\n"); - latch.countDown(); - return Boolean.FALSE; - } - } - try { - process.waitFor(); - } - catch (InterruptedException e) { - e.printStackTrace(); - publish("!Cannot wait for the end of the command!\n"); - latch.countDown(); - return Boolean.FALSE; - } - try { - exitValue = process.exitValue(); - } - catch (IllegalThreadStateException e) { - e.printStackTrace(); - publish("!Cannot get the exit value of the command!\n"); - latch.countDown(); - return Boolean.FALSE; - } - if (exitValue != 0) { - publish("!Problem during the execution of the command '" + commandJoined + "'!\n"); - latch.countDown(); - return Boolean.FALSE; - } - publish("=== Ending command '" + commandJoined.trim() + "' ===\n"); - latch.countDown(); - return Boolean.TRUE; - } - - - @Override - protected void process(List<String> chunks) { - String message = ""; - String text = logArea.getText(); - for (String chunk: chunks) { - text += chunk; - } - for (String lineSeparatedByCarriageReturn: text.split("\n")) { - for (String line: lineSeparatedByCarriageReturn.split("\r")) { - boolean progressLine = false; - if (line.matches(".*\\[=*\\s*\\]\\s*\\d*/\\d*\\s*")) { - String[] ratioElements = line.split("\\]")[1].trim().split("/"); - int current = Integer.parseInt(ratioElements[0].trim()); - int aim = Integer.parseInt(ratioElements[1].trim()); - messageField.setText(line.split("\\[")[0].trim()); - progressBar.setValue(current * 100 / aim); - etaField.setText(""); - progressLine = true; - } - else if (line.matches(".*\\[=*\\s*\\]\\s*\\d*/\\d*\\s*ETA:\\s*.*")) { - String[] ratioElements = line.split("\\]")[1].split("E")[0].trim().split("/"); - int current = Integer.parseInt(ratioElements[0].trim()); - int aim = Integer.parseInt(ratioElements[1].trim()); - String eta = line.split("ETA:")[1].trim(); - messageField.setText(line.split("\\[")[0].trim()); - progressBar.setValue(current * 100 / aim); - etaField.setText("ETA: " + eta); - progressLine = true; - } - else if (line.matches(".*\\[=*\\s*\\]\\s*\\d*\\s*completed in.*")) { - String nbElements = line.split("\\]")[1].split("completed")[0].trim(); - String timeSpent = line.split("completed in")[1].trim(); - message += line.split("\\[")[0].trim() + ": " + nbElements + " elements completed in " + timeSpent + "\n"; - messageField.setText(line.split("\\[")[0].trim()); - progressLine = true; - } - if (! progressLine) { - message += line + "\n"; - } - } - } - String lines[] = message.split("\n"); - String toBeWritten = ""; - for (int i = Math.max(0, lines.length - Global.logAreaSize); i < lines.length; i++) { - toBeWritten += lines[i] + "\n"; - } - logArea.setText(toBeWritten); - } - - public int getExitValue() { - try { - latch.await(); - } - catch (InterruptedException e) { - logArea.append("Cannot wait for the end of the process!\n"); - e.printStackTrace(); - return -1; - } - return exitValue; - } -} |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/ProgramOption.class |
b |
Binary file SMART/Java/ProgramOption.class has changed |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/ProgramOption.java --- a/SMART/Java/ProgramOption.java Mon Apr 29 03:29:31 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,358 +0,0 @@\n-/**\n- *\n- * Copyright INRA-URGI 2009-2010\n- * \n- * This software is governed by the CeCILL license under French law and\n- * abiding by the rules of distribution of free software. You can use,\n- * modify and/ or redistribute the software under the terms of the CeCILL\n- * license as circulated by CEA, CNRS and INRIA at the following URL\n- * "http://www.cecill.info".\n- * \n- * As a counterpart to the access to the source code and rights to copy,\n- * modify and redistribute granted by the license, users are provided only\n- * with a limited warranty and the software\'s author, the holder of the\n- * economic rights, and the successive licensors have only limited\n- * liability.\n- * \n- * In this respect, the user\'s attention is drawn to the risks associated\n- * with loading, using, modifying and/or developing or reproducing the\n- * software by the user in light of its specific status of free software,\n- * that may mean that it is complicated to manipulate, and that also\n- * therefore means that it is reserved for developers and experienced\n- * professionals having in-depth computer knowledge. Users are therefore\n- * encouraged to load and test the software\'s suitability as regards their\n- * requirements in conditions enabling the security of their systems and/or\n- * data to be ensured and, more generally, to use and operate it in the\n- * same conditions as regards security.\n- * \n- * The fact that you are presently reading this means that you have had\n- * knowledge of the CeCILL license and that you accept its terms.\n- *\n- */\n-import java.util.*;\n-import java.awt.*;\n-import java.awt.event.ActionEvent;\n-import java.awt.event.ActionListener;\n-import java.io.*;\n-import javax.swing.*;\n-import javax.swing.filechooser.*;\n-import javax.swing.border.*;\n-import javax.swing.SwingUtilities;\n-\n-\n-public class ProgramOption {\n- boolean input;\n- String identifier;\n- String type;\n- String comment;\n- boolean compulsory;\n- String[] format;\n- String formatIdentifier;\n- ProgramOption associatedOption;\n- String defaultValue;\n- String[] choices;\n- JComponent component;\n- JPanel panel;\n-\n-\n- public ProgramOption() {\n- this.input = true;\n- this.identifier = null;\n- this.type = null;\n- this.comment = null;\n- this.compulsory = false;\n- this.format = null;\n- this.formatIdentifier = null;\n- this.associatedOption = null;\n- this.defaultValue = "";\n- this.choices = null;\n- this.component = null;\n- this.panel = null;\n- }\n-\n-\n- public void setInput(boolean input) {\n- this.input = input;\n- }\n-\n-\n- public void setIdentifier(String identifier) {\n- this.identifier = identifier;\n- }\n-\n-\n- public void setType(String type) {\n- this.type = type;\n- }\n-\n-\n- public void setComment(String comment) {\n- this.comment = comment;\n- }\n-\n-\n- public void setCompulsory(boolean compulsory) {\n- this.compulsory = compulsory;\n- }\n-\n-\n- public void setFormat(String[] format) {\n- this.format = format;\n- }\n-\n-\n- public void setFormat(String format) {\n- this.format = new String[1];\n- this.format[0] = format;\n- }\n-\n-\n- public void setFormatIdentifier(String formatIdentifier) {\n- this.formatIdentifier = formatIdentifier;\n- }\n-\n-\n- public void setAssociatedOption(ProgramOption option) {\n- this.associatedOption = option;\n- }\n-\n-\n- public void setChoices(String[] choices) {\n- this.choices = new String[choices.length+1];\n- this.choices[0] = "---";\n- for (int i = 0; i < choices.length; i++) {\n- this.choices[i+1] = choices[i];\n- }\n- }\n-\n-\n- public void setDefault(String defaultValue) {\n- this.defaultValue = defaultValue;\n- }\n-\n-\n- public boolean isInput() {\n- return this.input;\n- }\n-\n-\n- public boolean checkSettings() {\n- if (this.identifier == null) {\n- return false;\n- }\n- if (this.type == nul'..b'{\n- this.component = new JComboBox(this.choices);\n- label.setLabelFor(this.component);\n- this.panel.add(label);\n- this.panel.add(this.component);\n- }\n- else {\n- System.out.println("Do not know how to read type " + this.type);\n- }\n-\n- return this.panel;\n- }\n-\n-\n- public JComponent getComponent() {\n- if (component == null) {\n- this.getPanel();\n- }\n- return this.component;\n- }\n-\n-\n- private String getValue() {\n- if (("int".equals(this.type)) || ("float".equals(this.type)) || ("string".equals(this.type)) || (("file".equals(this.type)) && (! this.input)) || ("directory".equals(this.type)) || ("files".equals(this.type))) {\n- String s = ((JTextField) this.component).getText();\n- if ("None".equals(s)) {\n- return "";\n- }\n- return s;\n- }\n- if ("file".equals(this.type)) {\n- return (String) ((JComboBox) this.component).getSelectedItem();\n- }\n- if ("boolean".equals(this.type)) {\n- return ((JCheckBox) this.component).isSelected()? "true": "false";\n- }\n- if ("format".equals(this.type)) {\n- return (String) ((JComboBox) this.component).getSelectedItem();\n- }\n- if ("choice".equals(this.type)) {\n- String s = (String) ((JComboBox) this.component).getSelectedItem();\n- if ("---".equals(s)) {\n- return "";\n- }\n- return s;\n- }\n- System.out.println("Do not know how to get value of \'" + this.type + "\' (" + this.identifier + ").");\n- return null;\n- }\n-\n-\n- public String checkValue() {\n- String value = this.getValue();\n- if ((this.compulsory) && ((value == null) || ("".equals(value)))) {\n- return "Option \'" + this.comment + "\' has no value... Please specify it.\\n";\n- }\n- if ("int".equals(this.type)) {\n- if ((value != null) && (! "".equals(value)) && (! "None".equals(value))) {\n- try {\n- int i = Integer.parseInt(value);\n- }\n- catch (NumberFormatException e) {\n- return "Option \'" + this.comment + "\' should be an integer... Please correct it.\\n";\n- }\n- }\n- }\n- else if ("float".equals(this.type)) {\n- if ((value != null) && (! "".equals(value))) {\n- try {\n- float i = Float.parseFloat(value);\n- }\n- catch (NumberFormatException e) {\n- return "Option \'" + this.comment + "\' should be a float... Please correct it.\\n";\n- }\n- }\n- }\n- return null;\n- }\n-\n-\n- public LinkedList <String> getCommand() {\n- LinkedList <String> list = new LinkedList <String> ();\n-\n- if (("int".equals(this.type)) || ("float".equals(this.type)) || ("string".equals(this.type)) || (("file".equals(this.type)) && (! this.input)) || ("format".equals(this.type)) || ("directory".equals(this.type)) || ("files".equals(this.type)) || ("choice".equals(this.type))) {\n- String value = this.getValue();\n- if (value.length() == 0) {\n- return list;\n- }\n- list.add(this.identifier);\n- list.add(value);\n- return list;\n- }\n- if ("file".equals(this.type)) {\n- String fileName = (String) ((JComboBox) this.component).getSelectedItem();\n- if (fileName == null) {\n- return list;\n- }\n- list.add(this.identifier);\n- list.add(this.getValue());\n- return list;\n- }\n- if (("boolean".equals(this.type)) || ("bool".equals(this.type))) {\n- if ("true".equals(this.getValue())) {\n- list.add(this.identifier);\n- }\n- return list;\n- }\n- System.out.println("Cannot get type of option " + this.type + " (" + this.identifier + "): " + this.getValue());\n- return null;\n- }\n-\n-\n- public File getOutputFile() {\n- if (this.input) return null;\n- String format = "";\n- if (this.format != null) {\n- format = this.format[0];\n- }\n- if (this.associatedOption != null) {\n- format = this.associatedOption.getValue();\n- }\n- return new File(this.getValue(), Global.formats.getFormatType(format), format);\n- }\n-}\n' |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/PythonHelperReader.class |
b |
Binary file SMART/Java/PythonHelperReader.class has changed |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/PythonHelperReader.java --- a/SMART/Java/PythonHelperReader.java Mon Apr 29 03:29:31 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,336 +0,0 @@\n-/**\n- *\n- * Copyright INRA-URGI 2009-2010\n- * \n- * This software is governed by the CeCILL license under French law and\n- * abiding by the rules of distribution of free software. You can use,\n- * modify and/ or redistribute the software under the terms of the CeCILL\n- * license as circulated by CEA, CNRS and INRIA at the following URL\n- * "http://www.cecill.info".\n- * \n- * As a counterpart to the access to the source code and rights to copy,\n- * modify and redistribute granted by the license, users are provided only\n- * with a limited warranty and the software\'s author, the holder of the\n- * economic rights, and the successive licensors have only limited\n- * liability.\n- * \n- * In this respect, the user\'s attention is drawn to the risks associated\n- * with loading, using, modifying and/or developing or reproducing the\n- * software by the user in light of its specific status of free software,\n- * that may mean that it is complicated to manipulate, and that also\n- * therefore means that it is reserved for developers and experienced\n- * professionals having in-depth computer knowledge. Users are therefore\n- * encouraged to load and test the software\'s suitability as regards their\n- * requirements in conditions enabling the security of their systems and/or\n- * data to be ensured and, more generally, to use and operate it in the\n- * same conditions as regards security.\n- * \n- * The fact that you are presently reading this means that you have had\n- * knowledge of the CeCILL license and that you accept its terms.\n- *\n- */\n-import java.util.*;\n-import java.io.File;\n-import java.io.*;\n-import java.util.regex.*;\n-\n-public class PythonHelperReader {\n-\n- String fileName;\n- Program program;\n- BufferedReader reader;\n- String message;\n-\n- public PythonHelperReader(String fileName) {\n- this.fileName = fileName; \n- this.reader = reader;\n- this.message = null;\n- }\n-\n- public void setReader(BufferedReader reader) {\n- this.reader = reader;\n- }\n- \n- public void run() {\n- this.program = new Program();\n- boolean inBeginning = true;\n- boolean inUsage = false;\n- boolean afterUsage = false;\n- boolean inDescription = false;\n- boolean afterDescription = false;\n- boolean inOptions = false;\n- boolean inOptionBlank = false;\n- boolean inError = false;\n- String usage = null;\n- String description = null;\n- String option = null;\n- Vector <String> options = new Vector < String > ();\n- String[] optionSplitted;\n-\n- // Parse file\n- try {\n- String line = null;\n-\n- while ((line = reader.readLine()) != null) {\n- line = line.trim();\n- if (line.startsWith("Traceback")) {\n- this.message = "Problem with header of \'" + this.fileName + "\':\\n" + line + "\\n";\n- inError = true;\n- inBeginning = false;\n- inUsage = false;\n- afterUsage = false;\n- inDescription = false;\n- afterDescription = false;\n- inOptions = false;\n- inOptionBlank = false;\n- }\n- else if (inError) {\n- this.message += line + "\\n";\n- }\n- else if (inBeginning) {\n- if (line.startsWith("Usage:")) {\n- inUsage = true;\n- inBeginning = false;\n- usage = line;\n- }\n- }\n- else if (inUsage) {\n- if ("".equals(line)) {\n- inUsage = false;\n- afterUsage = true;\n- }\n- else {\n- usage += " " + line;\n- }\n- }\n- else if (afterUsage) {\n- if (! "".equals(line)) {\n- description = line;\n- afterUsage = false;\n- inDescription = true;\n- }\n- '..b' int pos = value.indexOf(" ");\n- currentWord = value.substring(0, pos);\n- rest = value.substring(pos+1);\n- }\n- else {\n- currentWord = value;\n- }\n- // Output file type\n- if ("output".compareToIgnoreCase(currentWord) == 0) {\n- programOption.setInput(false);\n- int pos = rest.indexOf(" ");\n- currentWord = rest.substring(0, pos).trim();\n- rest = rest.substring(pos+1).trim();\n- }\n- // File (input or output file)\n- if ("file".compareToIgnoreCase(currentWord) == 0) {\n- programOption.setType("file");\n- // Format given by an associated option (to be found later)\n- if (rest.startsWith("in format given by ")) {\n- associatedOption.put(programOption, rest.substring(rest.indexOf("format given by ") + "format given by ".length() + 1).trim());\n- }\n- else {\n- if (! rest.startsWith("in ")) {\n- this.message = "Descriptor " + option + " does not have a proper format.\\n";\n- return;\n- }\n- rest = rest.substring("in ".length());\n- int pos = rest.indexOf(" format");\n- if (pos == -1) {\n- this.message = "Descriptor " + option + " does not have a proper format.\\n";\n- return;\n- }\n- programOption.setFormat(rest.substring(0, pos).trim().toLowerCase().split(" or "));\n- }\n- }\n- // Format type\n- else if (rest.endsWith("file format")) {\n- programOption.setFormat((currentWord + " " + rest.substring(0, rest.indexOf("file format"))).trim().toLowerCase().split(" or "));\n- programOption.setType("format");\n- }\n- // Choice type\n- else if ("choice".compareToIgnoreCase(currentWord) == 0) {\n- programOption.setChoices(rest.replace("(", "").replace(")", "").split(", "));\n- programOption.setType("choice");\n- }\n- // Boolean type\n- else if ("bool".compareToIgnoreCase(currentWord) == 0) {\n- programOption.setType("boolean");\n- }\n- // Other type\n- else {\n- if (currentWord == null) {\n- this.message = "Program \'" + this.fileName + "\' has a problem concerning the type of option \'" + identifier + "\'.\\n";\n- return;\n- }\n- programOption.setType(currentWord);\n- }\n- }\n- // Default value\n- else if ("default".compareToIgnoreCase(type) == 0) {\n- programOption.setDefault(value);\n- }\n- else {\n- this.message = "Do not understand option descriptor \'" + inner + "\'.\\n";\n- return;\n- }\n- }\n- else {\n- // Compulsory option\n- if ("compulsory".compareToIgnoreCase(inner) == 0) {\n- programOption.setCompulsory(true);\n- }\n- else {\n- this.message = "Do not understand option descriptor \'" + inner + "\'.\\n";\n- return;\n- }\n- }\n- }\n- if (! programOption.checkSettings()) {\n- this.message = "Program \'" + this.fileName + "\' has a problem concerning option \'" + identifier + "\'.\\n";\n- return;\n- }\n- program.addOption(programOption);\n- }\n-\n- // Set associated option\n- Iterator it = associatedOption.keySet().iterator();\n- while (it.hasNext()) {\n- ProgramOption programOption = (ProgramOption) it.next();\n- programOption.setAssociatedOption(identifierToOptions.get(associatedOption.get(programOption)));\n- }\n- }\n-\n- public String getMessage () {\n- return this.message;\n- }\n-\n- public Program getProgram () {\n- return this.program;\n- }\n-}\n-\n-\n' |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/PythonProgramFinder.class |
b |
Binary file SMART/Java/PythonProgramFinder.class has changed |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/PythonProgramFinder.java --- a/SMART/Java/PythonProgramFinder.java Mon Apr 29 03:29:31 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,92 +0,0 @@ -/** - * - * Copyright INRA-URGI 2009-2010 - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - * - */ -import java.io.*; -import java.util.*; - -public class PythonProgramFinder { - - String dirName; - Vector < Program > programs; - - public PythonProgramFinder(String dirName) { - this.dirName = dirName; - } - - public String findPrograms() { - java.io.File directory = new java.io.File(this.dirName); - String[] files = directory.list(new FilenameFilter() {public boolean accept(java.io.File dir, String name) {return ((! name.startsWith(".")) && (! name.startsWith("test")) && ((new java.io.File(dir, name)).isFile()) && (name.endsWith(".py")) && (name.compareToIgnoreCase("__init__.py") != 0));}}); - this.programs = new Vector < Program > (); - - for (int i = 0; i < files.length; i++) { - String[] commandList = {Global.pythonCommand, "Python" + java.io.File.separator + files[i], "-h"}; - String command = ""; - for (int j = 0; j < commandList.length; j++) { - command += commandList[j] + " "; - } - ProcessBuilder pb = new ProcessBuilder(commandList); - pb = pb.redirectErrorStream(true); - Map<String, String> env = pb.environment(); - env.put("PYTHONPATH", System.getProperty("user.dir") + java.io.File.separator + "Python"); - env.put("SMARTPATH", System.getProperty("user.dir") + java.io.File.separator + "Python"); - env.put("SMARTMYSQLPATH", Global.mysqlCommand); - env.put("SMARTRPATH", Global.rCommand); - - PythonHelperReader helperReader = new PythonHelperReader(files[i]); - try { - final Process process = pb.start(); - InputStream is = process.getInputStream(); - InputStreamReader isr = new InputStreamReader(is); - BufferedReader br = new BufferedReader(isr); - helperReader.setReader(br); - helperReader.run(); - } - catch (IOException e) { - final Writer result = new StringWriter(); - final PrintWriter printWriter = new PrintWriter(result); - e.printStackTrace(printWriter); - return "Command '" + command + "' failed (I/O error)...\n" + result.toString(); - } - String comments = helperReader.getMessage(); - if (comments != null) return comments; - Program program = helperReader.getProgram(); - if (("Personnal".compareToIgnoreCase(program.getSection()) != 0) && ("Personal".compareToIgnoreCase(program.getSection()) != 0)) { - this.programs.add(program); - } - } - return null; - } - - public Vector <Program> getPrograms () { - return this.programs; - } -} - |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/Sav/File.java --- a/SMART/Java/Sav/File.java Mon Apr 29 03:29:31 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,55 +0,0 @@ -/** - * - * Copyright INRA-URGI 2009-2010 - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - * - */ -public class File { - String name; - String formatType; - String format; - - - public File(String name, String type, String format) { - this.name = name; - this.formatType = type; - this.format = format; - } - - public String getName() { - return this.name; - } - - public String getFormatType() { - return this.formatType; - } - - public String getFormat() { - return this.format; - } -} |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/Sav/Files.java --- a/SMART/Java/Sav/Files.java Mon Apr 29 03:29:31 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,71 +0,0 @@ -/** - * - * Copyright INRA-URGI 2009-2010 - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - * - */ -import java.util.*; - -public class Files { - HashMap <String, File> files; - - public Files () { - files = new HashMap < String, File> (); - } - - public void addFile(String fileName, String type, String format) { - this.addFile(new File(fileName, type, format)); - } - - public void addFile(File file) { - files.put(file.name, file); - } - - public String getType(String fileName) { - if (fileName == null) { - System.out.println("Error! Looking for format of empty file name!"); - } - if (! files.containsKey(fileName)) { - System.out.println("Oops! Format type of file " + fileName + " is not found!"); - return null; - } - return files.get(fileName).formatType; - } - - public String getFormat(String fileName) { - if (fileName == null) { - System.out.println("Error! Looking for format of empty file name!"); - } - if (! files.containsKey(fileName)) { - System.out.println("Oops! Format of file " + fileName + " is not found!"); - return null; - } - return files.get(fileName).format; - } -} - |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/Sav/FormatType.java --- a/SMART/Java/Sav/FormatType.java Mon Apr 29 03:29:31 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,64 +0,0 @@ -/** - * - * Copyright INRA-URGI 2009-2010 - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - * - */ -import java.util.*; - -public class FormatType { - String type; - Vector < String > formats; - - public FormatType (String type) { - this.type = type; - this.formats = new Vector < String > (); - } - - public String getType () { - return this.type; - } - - public void addFormat (String format) { - formats.add(format); - } - - public boolean containsFormat (String format) { - for (int i = 0; i < formats.size(); i++) { - if (((String) formats.get(i)).compareToIgnoreCase(format) == 0) { - return true; - } - } - return false; - } - - public Vector < String > getFormats () { - return formats; - } -} - |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/Sav/FormatsContainer.java --- a/SMART/Java/Sav/FormatsContainer.java Mon Apr 29 03:29:31 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,81 +0,0 @@ -/** - * - * Copyright INRA-URGI 2009-2010 - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - * - */ -import java.util.*; - -public class FormatsContainer { - - HashMap < String, FormatType > formatTypes; - - - public FormatsContainer() { - this.formatTypes = new HashMap < String, FormatType > (); - } - - - public void addFormat(String type, String format) { - FormatType formatType; - if (formatTypes.containsKey(type)) { - formatType = this.formatTypes.get(type); - } - else { - formatType = new FormatType(type); - this.formatTypes.put(type, formatType); - } - formatType.addFormat(format); - } - - - public Vector < String > getFormatTypes () { - Vector < String > v = new Vector < String > (); - v.addAll(this.formatTypes.keySet()); - return v; - } - - - public FormatType getFormats (String type) { - return formatTypes.get(type); - } - - - public String getFormatType (String format) { - for (Iterator it = formatTypes.keySet().iterator(); it.hasNext(); ) { - Object type = it.next(); - Object formatType = formatTypes.get(type); - if (((FormatType) formatType).containsFormat(format)) { - return (String) type; - } - } - return null; - } -} - - |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/Sav/FormatsReader.java --- a/SMART/Java/Sav/FormatsReader.java Mon Apr 29 03:29:31 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,83 +0,0 @@ -/** - * - * Copyright INRA-URGI 2009-2010 - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - * - */ -import java.util.*; -import java.io.File; -import java.io.*; - - -public class FormatsReader { - - String fileName; - Vector < FormatType > formatTypes; - Vector < String > typeNames; - - - public FormatsReader(String fileName) { - this.fileName = fileName; - this.formatTypes = new Vector < FormatType > (); - } - - - public boolean read() { - File file = new File(this.fileName); - - try { - BufferedReader reader = new BufferedReader(new FileReader(file)); - String line = null; - String[] lineElements; - String[] formats; - String typeName; - - while ((line = reader.readLine()) != null) { - if (line.length() > 0) { - lineElements = line.split(":"); - typeName = lineElements[0].trim(); - formats = lineElements[1].split(","); - for (int i = 0; i < formats.length; i++) { - Global.formats.addFormat(typeName, formats[i].trim()); - } - } - } - - reader.close(); - } - catch (FileNotFoundException e) { - return false; - } - catch (IOException e) { - return false; - } - - return true; - } -} - |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/Sav/Global.java --- a/SMART/Java/Sav/Global.java Mon Apr 29 03:29:31 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,70 +0,0 @@ -/** - * - * Copyright INRA-URGI 2009-2010 - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - * - */ -import java.util.Vector; -import java.util.HashMap; -import javax.swing.DefaultListModel; -import javax.swing.JButton; -import javax.swing.JTextField; - -public class Global { - - public static int logAreaSize = 100; - - public static String smartConfFileName = "smart.conf"; - - public static String smartProgramsFileName = "programs.txt"; - - public static String smartFormatsFileName = "formats.txt"; - - public static String pythonPath = new String(); - - public static String pythonCommand = "python"; - - public static String mysqlCommand = "mysql"; - - public static String rCommand = "R"; - - public static Files files = new Files(); - - public static DefaultListModel fileNames = new DefaultListModel(); - - public static FormatsContainer formats = new FormatsContainer(); - - public static boolean programRunning = false; - - public static HashMap < JButton, JTextField > otherFilesChooser = new HashMap < JButton, JTextField >(); - - public static HashMap < JButton, JTextField > otherDirectoriesChooser = new HashMap < JButton, JTextField >(); - - public static HashMap < JButton, JTextField > otherFileConcatenationChooser = new HashMap < JButton, JTextField >(); - -} |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/Sav/Program.java --- a/SMART/Java/Sav/Program.java Mon Apr 29 03:29:31 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,175 +0,0 @@ -/** - * - * Copyright INRA-URGI 2009-2010 - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - * - */ -import java.util.*; -import java.awt.*; -import javax.swing.*; - - -public class Program { - String shortName; - String name; - String section; - String description; - Vector <ProgramOption> options; - JPanel panel; - JButton button; - - - public Program() { - this.shortName = null; - this.name = null; - this.options = new Vector <ProgramOption> (); - } - - - public void setShortName(String shortName) { - this.shortName = shortName; - } - - - public void setName(String name) { - this.name = name; - } - - - public void setSection(String section) { - this.section = section; - } - - public void setDescription(String description) { - this.description = description; - } - - - public void addOption(ProgramOption option) { - options.add(option); - } - - - public String getShortName() { - return this.shortName; - } - - - public String getName() { - return this.name; - } - - - public String getSection() { - return this.section; - } - - public String getDescription() { - return this.description; - } - - - public String checkValues() { - for (int i = 0; i < options.size(); i++) { - String comment = options.get(i).checkValue(); - if (comment != null) { - return comment; - } - } - return null; - } - - - public LinkedList<String> getCommand() { - LinkedList<String> parameterList = new LinkedList<String>(); - parameterList.add(Global.pythonCommand); - parameterList.add("Python" + java.io.File.separator + this.shortName); - for (int i = 0; i < options.size(); i++) { - ProgramOption option = options.get(i); - parameterList.addAll(option.getCommand()); - } - return parameterList; - } - - - public JPanel getPanel() { - if (this.panel != null) { - return this.panel; - } - - this.panel = new JPanel(false); - this.panel.setLayout(new FlowLayout()); - Box box = Box.createVerticalBox(); - - JPanel descriptionPanel = new JPanel(false); - JLabel descriptionLabel = new JLabel(this.description); - descriptionPanel.add(descriptionLabel); - box.add(descriptionPanel); - - for (int i = 0; i < options.size(); i++) { - ProgramOption option = options.get(i); - JPanel panel = option.getPanel(); - if (panel == null) { - System.out.println("Problem with Python program '" + this.shortName + "'."); - return null; - } - box.add(option.getPanel()); - } - - JPanel buttonPanel = new JPanel(false); - this.button = new JButton("GO!"); - - buttonPanel.add(button); - - box.add(buttonPanel); - - this.panel.add(box); - - return this.panel; - } - - - public JButton getButton() { - if (this.button == null) { - this.getPanel(); - } - return this.button; - } - - - public Vector < File > getOutputFiles() { - Vector < File > files = new Vector < File > (); - for (int i = 0; i < options.size(); i++) { - ProgramOption option = options.get(i); - if (! option.isInput()) { - files.add(option.getOutputFile()); - } - } - return files; - } -} |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/Sav/ProgramFileReader.java --- a/SMART/Java/Sav/ProgramFileReader.java Mon Apr 29 03:29:31 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,174 +0,0 @@ -/** - * - * Copyright INRA-URGI 2009-2010 - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - * - */ -import java.util.*; -import java.io.File; -import java.io.*; - - -public class ProgramFileReader { - String fileName; - Vector <Program> programs; - - - public ProgramFileReader(String fileName) { - this.fileName = fileName; - this.programs = new Vector <Program> (); - } - - - public boolean read() { -// File file = new File(this.fileName); -// Program program = null; -// int step = 0; -// TreeMap <String, ProgramOption> options = new TreeMap <String, ProgramOption> (); - -// try { -// BufferedReader reader = new BufferedReader(new FileReader(file)); -// String line = null; -// String section = null; - -// while ((line = reader.readLine()) != null) { - -// line = line.trim(); - -// if (line.length() == 0) { -// if (program != null) { -// programs.add(program); -// } -// program = null; -// step = 0; -// continue; -// } - -// if ((line.charAt(0) == '[') && (line.charAt(line.length() - 1) == ']')) { -// section = line.substring(1, line.length() - 1).trim(); -// continue; -// } -// switch (step) { -// case 0: -// program = new Program(); -// program.setName(line); -// if (section == null) { -// System.out.println("Error! Section of program '" + line + "' is not set!"); -// } -// program.setSection(section); -// step = 1; -// break; -// case 1: -// program.setShortName(line); -// step = 2; -// break; -// case 2: -// ProgramOption option = new ProgramOption(); - -// String[] elements = line.split(":"); -// boolean input = elements[0].trim().equalsIgnoreCase("input")? true: false; -// String[] subElements = elements[1].split(";"); -// String identifier = subElements[0].trim(); - -// option.setInput(input); - -// if (input) { - -// if (subElements.length < 4) { -// System.out.println("Line '" + line + "' is weird..."); -// } - -// String type = subElements[1].trim(); -// String comment = subElements[2].trim(); -// boolean compulsory = subElements[3].trim().equalsIgnoreCase("0")? false: true; - -// option.setIdentifier(identifier); -// option.setType(type); -// option.setComment(comment); -// option.setCompulsory(compulsory); - -// if ("file".compareToIgnoreCase(type) == 0) { -// if (subElements.length < 5) { -// System.out.println("Line '" + line + "' is weird..."); -// } - -// String formatIdentifier = subElements[4].trim(); -// option.setFormatIdentifier(formatIdentifier); -// } -// else if ("choice".compareToIgnoreCase(type) == 0) { -// if (subElements.length < 5) { -// System.out.println("Line '" + line + "' is weird..."); -// } - -// String[] choices = subElements[4].trim().split(","); -// for (int i = 0; i < choices.length; i++) { -// choices[i] = choices[i].trim(); -// } -// option.setChoices(choices); -// } -// options.put(identifier, option); -// } -// else { -// String format = subElements[1].trim(); - -// option.setFormat(format); -// option.setAssociatedOption(options.get(identifier)); -// } - -// program.addOption(option); - -// break; -// default: -// return false; -// } -// } - -// reader.close(); -// } -// catch (FileNotFoundException e) { -// return false; -// } -// catch (IOException e) { -// return false; -// } - -// if (program != null) { -// programs.add(program); -// } - - return true; - } - - public int getNbPrograms() { - return programs.size(); - } - - public Program getProgram(int i) { - return programs.get(i); - } -} |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/Sav/ProgramLauncher.java --- a/SMART/Java/Sav/ProgramLauncher.java Mon Apr 29 03:29:31 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,191 +0,0 @@ -/** - * - * Copyright INRA-URGI 2009-2010 - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - * - */ -import java.util.*; -import java.io.*; -import javax.swing.SwingUtilities; -import javax.swing.*; -import java.util.concurrent.CountDownLatch; - -public class ProgramLauncher extends SwingWorker<Boolean, String> { - - String[] command; - JTextArea logArea; - JLabel messageField; - JProgressBar progressBar; - JLabel etaField; - int exitValue; - - - public ProgramLauncher (LinkedList <String> c, JTextArea la, JLabel mf, JProgressBar pb, JLabel ef) { - command = new String[c.size()]; - logArea = la; - messageField = mf; - progressBar = pb; - etaField = ef; - exitValue = -1; - c.toArray(command); - } - - - public ProgramLauncher (String[] c, JTextArea la, JLabel mf, JProgressBar pb, JLabel ef) { - command = c; - logArea = la; - messageField = mf; - progressBar = pb; - etaField = ef; - exitValue = -1; - } - - - @Override - public Boolean doInBackground() { - ProcessBuilder pb = new ProcessBuilder(command); - Process process = null; - BufferedReader outputReader = null; - pb = pb.redirectErrorStream(true); - Map<String, String> env = pb.environment(); - env.put("PYTHONPATH", System.getProperty("user.dir") + java.io.File.separator + "Python"); - env.put("SMARTPATH", System.getProperty("user.dir") + java.io.File.separator + "Python"); - env.put("SMARTMYSQLPATH", Global.mysqlCommand); - env.put("SMARTRPATH", Global.rCommand); - String commandJoined = Arrays.toString(command); - - try { - publish("=== Starting command '" + commandJoined.trim() + "' ===\n"); - process = pb.start(); - - BufferedInputStream outputStream = new BufferedInputStream(process.getInputStream()); - InputStream is = process.getInputStream(); - InputStreamReader isr = new InputStreamReader(is); - outputReader = new BufferedReader(isr); - } - catch (Exception exception) { - publish("!Process cannot be started (command is '" + commandJoined + "')!\n"); - exception.printStackTrace(); - return Boolean.FALSE; - } - if (outputReader == null) { - publish("!Problem in the output of the command!\n"); - return Boolean.FALSE; - } - else { - try { - String line; - while ((line = outputReader.readLine()) != null) { - publish(line + "\n"); - } - } - catch (IOException e) { - e.printStackTrace(); - publish("!Cannot get the output of the command!\n"); - return Boolean.FALSE; - } - } - try { - process.waitFor(); - } - catch (InterruptedException e) { - e.printStackTrace(); - publish("!Cannot wait for the end of the command!\n"); - return Boolean.FALSE; - } - try { - exitValue = process.exitValue(); - System.out.println(exitValue); - } - catch (IllegalThreadStateException e) { - e.printStackTrace(); - publish("!Cannot get the exit value of the command!\n"); - return Boolean.FALSE; - } - if (exitValue != 0) { - publish("!Problem during the execution of the command '" + commandJoined + "'!\n"); - return Boolean.FALSE; - } - publish("=== Ending command '" + commandJoined.trim() + "' ===\n"); - return Boolean.TRUE; - } - - - @Override - protected void process(List<String> chunks) { - String message = ""; - String text = logArea.getText(); - for (String chunk: chunks) { - text += chunk; - } - for (String lineSeparatedByCarriageReturn: text.split("\n")) { - for (String line: lineSeparatedByCarriageReturn.split("\r")) { - boolean progressLine = false; - if (line.matches(".*\\[=*\\s*\\]\\s*\\d*/\\d*\\s*")) { - String[] ratioElements = line.split("\\]")[1].trim().split("/"); - int current = Integer.parseInt(ratioElements[0].trim()); - int aim = Integer.parseInt(ratioElements[1].trim()); - messageField.setText(line.split("\\[")[0].trim()); - progressBar.setValue(current * 100 / aim); - etaField.setText(""); - progressLine = true; - } - else if (line.matches(".*\\[=*\\s*\\]\\s*\\d*/\\d*\\s*ETA:\\s*.*")) { - String[] ratioElements = line.split("\\]")[1].split("E")[0].trim().split("/"); - int current = Integer.parseInt(ratioElements[0].trim()); - int aim = Integer.parseInt(ratioElements[1].trim()); - String eta = line.split("ETA:")[1].trim(); - messageField.setText(line.split("\\[")[0].trim()); - progressBar.setValue(current * 100 / aim); - etaField.setText("ETA: " + eta); - progressLine = true; - } - else if (line.matches(".*\\[=*\\s*\\]\\s*\\d*\\s*completed in.*")) { - String nbElements = line.split("\\]")[1].split("completed")[0].trim(); - String timeSpent = line.split("completed in")[1].trim(); - message += line.split("\\[")[0].trim() + ": " + nbElements + " elements completed in " + timeSpent + "\n"; - messageField.setText(line.split("\\[")[0].trim()); - progressLine = true; - } - if (! progressLine) { - message += line + "\n"; - } - } - } - String lines[] = message.split("\n"); - String toBeWritten = ""; - for (int i = Math.max(0, lines.length - Global.logAreaSize); i < lines.length; i++) { - toBeWritten += lines[i] + "\n"; - } - logArea.setText(toBeWritten); - } - - public int getExitValue() { - return exitValue; - } -} |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/Sav/ProgramOption.java --- a/SMART/Java/Sav/ProgramOption.java Mon Apr 29 03:29:31 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,329 +0,0 @@\n-/**\n- *\n- * Copyright INRA-URGI 2009-2010\n- * \n- * This software is governed by the CeCILL license under French law and\n- * abiding by the rules of distribution of free software. You can use,\n- * modify and/ or redistribute the software under the terms of the CeCILL\n- * license as circulated by CEA, CNRS and INRIA at the following URL\n- * "http://www.cecill.info".\n- * \n- * As a counterpart to the access to the source code and rights to copy,\n- * modify and redistribute granted by the license, users are provided only\n- * with a limited warranty and the software\'s author, the holder of the\n- * economic rights, and the successive licensors have only limited\n- * liability.\n- * \n- * In this respect, the user\'s attention is drawn to the risks associated\n- * with loading, using, modifying and/or developing or reproducing the\n- * software by the user in light of its specific status of free software,\n- * that may mean that it is complicated to manipulate, and that also\n- * therefore means that it is reserved for developers and experienced\n- * professionals having in-depth computer knowledge. Users are therefore\n- * encouraged to load and test the software\'s suitability as regards their\n- * requirements in conditions enabling the security of their systems and/or\n- * data to be ensured and, more generally, to use and operate it in the\n- * same conditions as regards security.\n- * \n- * The fact that you are presently reading this means that you have had\n- * knowledge of the CeCILL license and that you accept its terms.\n- *\n- */\n-import java.util.*;\n-import java.awt.*;\n-import java.awt.event.ActionEvent;\n-import java.awt.event.ActionListener;\n-import java.io.*;\n-import javax.swing.*;\n-import javax.swing.filechooser.*;\n-import javax.swing.border.*;\n-import javax.swing.SwingUtilities;\n-\n-\n-public class ProgramOption {\n- boolean input;\n- String identifier;\n- String type;\n- String comment;\n- boolean compulsory;\n- String[] format;\n- String formatIdentifier;\n- ProgramOption associatedOption;\n- String defaultValue;\n- String[] choices;\n- JComponent component;\n- JPanel panel;\n-\n-\n- public ProgramOption() {\n- this.input = true;\n- this.identifier = null;\n- this.type = null;\n- this.comment = null;\n- this.compulsory = false;\n- this.format = null;\n- this.formatIdentifier = null;\n- this.associatedOption = null;\n- this.defaultValue = "";\n- this.choices = null;\n- this.component = null;\n- this.panel = null;\n- }\n-\n-\n- public void setInput(boolean input) {\n- this.input = input;\n- }\n-\n-\n- public void setIdentifier(String identifier) {\n- this.identifier = identifier;\n- }\n-\n-\n- public void setType(String type) {\n- this.type = type;\n- }\n-\n-\n- public void setComment(String comment) {\n- this.comment = comment;\n- }\n-\n-\n- public void setCompulsory(boolean compulsory) {\n- this.compulsory = compulsory;\n- }\n-\n-\n- public void setFormat(String[] format) {\n- this.format = format;\n- }\n-\n-\n- public void setFormat(String format) {\n- this.format = new String[1];\n- this.format[0] = format;\n- }\n-\n-\n- public void setFormatIdentifier(String formatIdentifier) {\n- this.formatIdentifier = formatIdentifier;\n- }\n-\n-\n- public void setAssociatedOption(ProgramOption option) {\n- this.associatedOption = option;\n- }\n-\n-\n- public void setChoices(String[] choices) {\n- this.choices = choices;\n- }\n-\n-\n- public void setDefault(String defaultValue) {\n- this.defaultValue = defaultValue;\n- }\n-\n-\n- public boolean isInput() {\n- return this.input;\n- }\n-\n-\n- public JPanel getPanel() {\n- if (this.panel != null) {\n- return this.panel;\n- }\n- String comment = this.comment;\n- if (this.compulsory) {\n- comment += " [*]";\n- }\n-\n- GridLayout horizontalLayout = new GridLayout(1, 0);\n- this.panel = ne'..b'component = new JTextField();\n- label.setLabelFor(this.component);\n- this.panel.add(label);\n- JPanel rightPanel = new JPanel(false);\n- rightPanel.setLayout(new BoxLayout(rightPanel, BoxLayout.LINE_AXIS));\n- rightPanel.add(this.component);\n- rightPanel.add(button);\n- this.panel.add(rightPanel);\n- Global.otherDirectoriesChooser.put(button, (JTextField) this.component);\n- }\n- else if ("choice".compareToIgnoreCase(this.type) == 0) {\n- this.component = new JComboBox(this.choices);\n- label.setLabelFor(this.component);\n- this.panel.add(label);\n- this.panel.add(this.component);\n- }\n- else {\n- System.out.println("Do not know how to read type " + this.type);\n- }\n-\n- return this.panel;\n- }\n-\n-\n- public JComponent getComponent() {\n- if (component == null) {\n- this.getPanel();\n- }\n- return this.component;\n- }\n-\n-\n- private String getValue() {\n- if (("int".equals(this.type)) || ("float".equals(this.type)) || ("string".equals(this.type)) || (("file".equals(this.type)) && (! this.input)) || ("directory".equals(this.type)) || ("files".equals(this.type))) {\n- String s = ((JTextField) this.component).getText();\n- if ("None".equals(s)) {\n- return "";\n- }\n- return s;\n- }\n- if ("file".equals(this.type)) {\n- return (String) ((JList) this.component).getSelectedValue();\n- }\n- if ("boolean".equals(this.type)) {\n- return ((JCheckBox) this.component).isSelected()? "true": "false";\n- }\n- if ("format".equals(this.type)) {\n- return (String) ((JComboBox) this.component).getSelectedItem();\n- }\n- return null;\n- }\n-\n-\n- public String checkValue() {\n- String value = this.getValue();\n- if ((this.compulsory) && ((value == null) || ("".equals(value)))) {\n- return "Option \'" + this.comment + "\' has no value... Please specify it.\\n";\n- }\n- if ("int".equals(this.type)) {\n- if ((value != null) && (! "".equals(value)) && (! "None".equals(value))) {\n- try {\n- int i = Integer.parseInt(value);\n- }\n- catch (NumberFormatException e) {\n- return "Option \'" + this.comment + "\' should be an integer... Please correct it.\\n";\n- }\n- }\n- }\n- else if ("float".equals(this.type)) {\n- if ((value != null) && (! "".equals(value))) {\n- try {\n- float i = Float.parseFloat(value);\n- }\n- catch (NumberFormatException e) {\n- return "Option \'" + this.comment + "\' should be a float... Please correct it.\\n";\n- }\n- }\n- }\n- return null;\n- }\n-\n-\n- public LinkedList <String> getCommand() {\n- LinkedList <String> list = new LinkedList <String> ();\n-\n- if (("int".equals(this.type)) || ("float".equals(this.type)) || ("string".equals(this.type)) || (("file".equals(this.type)) && (! this.input)) || ("format".equals(this.type)) || ("directory".equals(this.type)) || ("files".equals(this.type))) {\n- String value = this.getValue();\n- if (value.length() == 0) {\n- return list;\n- }\n- list.add(this.identifier);\n- list.add(value);\n- return list;\n- }\n- if ("file".equals(this.type)) {\n- String fileName = (String) ((JList) this.component).getSelectedValue();\n- if (fileName == null) {\n- return list;\n- }\n- list.add(this.identifier);\n- list.add(this.getValue());\n- return list;\n- }\n- if ("boolean".equals(this.type)) {\n- if ("true".equals(this.getValue())) {\n- list.add(this.identifier);\n- }\n- return list;\n- }\n- return null;\n- }\n-\n-\n- public File getOutputFile() {\n- if (this.input) return null;\n- String format = "";\n- if (this.format != null) {\n- format = this.format[0];\n- }\n- if (this.associatedOption != null) {\n- format = this.associatedOption.getValue();\n- }\n- return new File(this.getValue() + "." + format, Global.formats.getFormatType(format), format);\n- }\n-}\n' |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/Sav/PythonHelperReader.java --- a/SMART/Java/Sav/PythonHelperReader.java Mon Apr 29 03:29:31 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,323 +0,0 @@\n-/**\n- *\n- * Copyright INRA-URGI 2009-2010\n- * \n- * This software is governed by the CeCILL license under French law and\n- * abiding by the rules of distribution of free software. You can use,\n- * modify and/ or redistribute the software under the terms of the CeCILL\n- * license as circulated by CEA, CNRS and INRIA at the following URL\n- * "http://www.cecill.info".\n- * \n- * As a counterpart to the access to the source code and rights to copy,\n- * modify and redistribute granted by the license, users are provided only\n- * with a limited warranty and the software\'s author, the holder of the\n- * economic rights, and the successive licensors have only limited\n- * liability.\n- * \n- * In this respect, the user\'s attention is drawn to the risks associated\n- * with loading, using, modifying and/or developing or reproducing the\n- * software by the user in light of its specific status of free software,\n- * that may mean that it is complicated to manipulate, and that also\n- * therefore means that it is reserved for developers and experienced\n- * professionals having in-depth computer knowledge. Users are therefore\n- * encouraged to load and test the software\'s suitability as regards their\n- * requirements in conditions enabling the security of their systems and/or\n- * data to be ensured and, more generally, to use and operate it in the\n- * same conditions as regards security.\n- * \n- * The fact that you are presently reading this means that you have had\n- * knowledge of the CeCILL license and that you accept its terms.\n- *\n- */\n-import java.util.*;\n-import java.io.File;\n-import java.io.*;\n-import java.util.regex.*;\n-\n-public class PythonHelperReader {\n-\n- String fileName;\n- Program program;\n- BufferedReader reader;\n- String message;\n-\n- public PythonHelperReader(String fileName) {\n- this.fileName = fileName; \n- this.reader = reader;\n- this.message = null;\n- }\n-\n- public void setReader(BufferedReader reader) {\n- this.reader = reader;\n- }\n- \n- public void run() {\n- this.program = new Program();\n- boolean inBeginning = true;\n- boolean inUsage = false;\n- boolean afterUsage = false;\n- boolean inDescription = false;\n- boolean afterDescription = false;\n- boolean inOptions = false;\n- boolean inOptionBlank = false;\n- boolean inError = false;\n- String usage = null;\n- String description = null;\n- String option = null;\n- Vector <String> options = new Vector < String > ();\n- String[] optionSplitted;\n-\n- // Parse file\n- try {\n- String line = null;\n-\n- while ((line = reader.readLine()) != null) {\n- line = line.trim();\n- if (line.startsWith("Traceback")) {\n- this.message = "Problem with header of \'" + this.fileName + "\':\\n" + line + "\\n";\n- inError = true;\n- inBeginning = false;\n- inUsage = false;\n- afterUsage = false;\n- inDescription = false;\n- afterDescription = false;\n- inOptions = false;\n- inOptionBlank = false;\n- }\n- else if (inError) {\n- this.message += line + "\\n";\n- }\n- else if (inBeginning) {\n- if (line.startsWith("Usage:")) {\n- inUsage = true;\n- inBeginning = false;\n- usage = line;\n- }\n- }\n- else if (inUsage) {\n- if ("".equals(line)) {\n- inUsage = false;\n- afterUsage = true;\n- }\n- else {\n- usage += " " + line;\n- }\n- }\n- else if (afterUsage) {\n- if (! "".equals(line)) {\n- description = line;\n- afterUsage = false;\n- inDescription = true;\n- }\n- '..b'her.end()-1);\n- if (inner.contains(":")) {\n- String type = inner.substring(0, inner.indexOf(":")).trim();\n- String value = inner.substring(inner.indexOf(":")+1).trim();\n- // Types of the options\n- if ("format".compareToIgnoreCase(type) == 0) {\n- String currentWord = "";\n- String rest = "";\n- if (value.contains(" ")) {\n- int pos = value.indexOf(" ");\n- currentWord = value.substring(0, pos);\n- rest = value.substring(pos+1);\n- }\n- else {\n- currentWord = value;\n- }\n- // Output file type\n- if ("output".compareToIgnoreCase(currentWord) == 0) {\n- programOption.setInput(false);\n- int pos = rest.indexOf(" ");\n- currentWord = rest.substring(0, pos).trim();\n- rest = rest.substring(pos+1).trim();\n- }\n- // File (input or output file)\n- if ("file".compareToIgnoreCase(currentWord) == 0) {\n- programOption.setType("file");\n- // Format given by an associated option (to be found later)\n- if (rest.startsWith("in format given by ")) {\n- associatedOption.put(programOption, rest.substring(rest.indexOf("format given by ") + "format given by ".length() + 1).trim());\n- }\n- else {\n- if (! rest.startsWith("in ")) {\n- this.message = "Descriptor " + option + " does not have a proper format.";\n- return;\n- }\n- rest = rest.substring("in ".length());\n- int pos = rest.indexOf(" format");\n- if (pos == -1) {\n- this.message = "Descriptor " + option + " does not have a proper format.";\n- return;\n- }\n- programOption.setFormat(rest.substring(0, pos).trim().toLowerCase().split(" or "));\n- }\n- }\n- // Format type\n- else if (rest.endsWith("file format")) {\n- programOption.setFormat((currentWord + " " + rest.substring(0, rest.indexOf("file format"))).trim().toLowerCase().split(" or "));\n- programOption.setType("format");\n- }\n- // Choice type\n- else if ("choice".compareToIgnoreCase(currentWord) == 0) {\n- programOption.setChoices(rest.replace("(", "").replace(")", "").split(", "));\n- programOption.setType("choice");\n- }\n- // Boolean type\n- else if ("bool".compareToIgnoreCase(currentWord) == 0) {\n- programOption.setType("boolean");\n- }\n- // Other type\n- else {\n- programOption.setType(currentWord);\n- }\n- }\n- // Default value\n- else if ("default".compareToIgnoreCase(type) == 0) {\n- programOption.setDefault(value);\n- }\n- else {\n- this.message = "Do not understand option descriptor \'" + inner + "\'.";\n- return;\n- }\n- }\n- else {\n- // Compulsory option\n- if ("compulsory".compareToIgnoreCase(inner) == 0) {\n- programOption.setCompulsory(true);\n- }\n- else {\n- this.message = "Do not understand option descriptor \'" + inner + "\'.";\n- return;\n- }\n- }\n- }\n- program.addOption(programOption);\n- }\n-\n- // Set associated option\n- Iterator it = associatedOption.keySet().iterator();\n- while (it.hasNext()) {\n- ProgramOption programOption = (ProgramOption) it.next();\n- programOption.setAssociatedOption(identifierToOptions.get(associatedOption.get(programOption)));\n- }\n- }\n-\n- public String getMessage () {\n- return this.message;\n- }\n-\n- public Program getProgram () {\n- return this.program;\n- }\n-}\n-\n-\n' |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/Sav/PythonProgramFinder.java --- a/SMART/Java/Sav/PythonProgramFinder.java Mon Apr 29 03:29:31 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,90 +0,0 @@ -/** - * - * Copyright INRA-URGI 2009-2010 - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - * - */ -import java.io.*; -import java.util.*; - -public class PythonProgramFinder { - - String dirName; - Vector < Program > programs; - - public PythonProgramFinder(String dirName) { - this.dirName = dirName; - } - - public String findPrograms() { - java.io.File directory = new java.io.File(this.dirName); - String[] files = directory.list(new FilenameFilter() {public boolean accept(java.io.File dir, String name) {return ((! name.startsWith(".")) && (! name.startsWith("test")) && ((new java.io.File(dir, name)).isFile()) && (name.endsWith(".py")));}}); - this.programs = new Vector < Program > (); - - for (int i = 0; i < files.length; i++) { - String[] commandList = {Global.pythonCommand, "Python" + java.io.File.separator + files[i], "-h"}; - String command = ""; - for (int j = 0; j < commandList.length; j++) { - command += commandList[j] + " "; - } - ProcessBuilder pb = new ProcessBuilder(commandList); - pb = pb.redirectErrorStream(true); - Map<String, String> env = pb.environment(); - env.put("PYTHONPATH", System.getProperty("user.dir") + java.io.File.separator + "Python"); - env.put("SMARTPATH", System.getProperty("user.dir") + java.io.File.separator + "Python"); - env.put("SMARTMYSQLPATH", Global.mysqlCommand); - env.put("SMARTRPATH", Global.rCommand); - - PythonHelperReader helperReader = new PythonHelperReader(files[i]); - try { - final Process process = pb.start(); - InputStream is = process.getInputStream(); - InputStreamReader isr = new InputStreamReader(is); - BufferedReader br = new BufferedReader(isr); - helperReader.setReader(br); - helperReader.run(); - } - catch (IOException e) { - e.printStackTrace(); - return "Command '" + command + "' failed (I/O error)...\n"; - } - String comments = helperReader.getMessage(); - if (comments != null) return comments; - Program program = helperReader.getProgram(); - if ("Personnal".compareToIgnoreCase(program.getSection()) != 0) { - this.programs.add(program); - } - } - return null; - } - - public Vector <Program> getPrograms () { - return this.programs; - } -} - |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/Sav/Smart.java --- a/SMART/Java/Sav/Smart.java Mon Apr 29 03:29:31 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,489 +0,0 @@\n-/**\n- *\n- * Copyright INRA-URGI 2009-2010\n- * \n- * This software is governed by the CeCILL license under French law and\n- * abiding by the rules of distribution of free software. You can use,\n- * modify and/ or redistribute the software under the terms of the CeCILL\n- * license as circulated by CEA, CNRS and INRIA at the following URL\n- * "http://www.cecill.info".\n- * \n- * As a counterpart to the access to the source code and rights to copy,\n- * modify and redistribute granted by the license, users are provided only\n- * with a limited warranty and the software\'s author, the holder of the\n- * economic rights, and the successive licensors have only limited\n- * liability.\n- * \n- * In this respect, the user\'s attention is drawn to the risks associated\n- * with loading, using, modifying and/or developing or reproducing the\n- * software by the user in light of its specific status of free software,\n- * that may mean that it is complicated to manipulate, and that also\n- * therefore means that it is reserved for developers and experienced\n- * professionals having in-depth computer knowledge. Users are therefore\n- * encouraged to load and test the software\'s suitability as regards their\n- * requirements in conditions enabling the security of their systems and/or\n- * data to be ensured and, more generally, to use and operate it in the\n- * same conditions as regards security.\n- * \n- * The fact that you are presently reading this means that you have had\n- * knowledge of the CeCILL license and that you accept its terms.\n- *\n- */\n-import java.util.*;\n-import java.awt.*;\n-import java.awt.event.ActionEvent;\n-import java.awt.event.ActionListener;\n-import java.io.*;\n-import javax.swing.*;\n-import javax.swing.filechooser.*;\n-import javax.swing.border.*;\n-import javax.swing.SwingUtilities;\n-\n-\n-public class Smart extends JPanel implements ActionListener {\n-\n- String version = "1.0.2";\n-\n- JFrame mainFrame;\n- JButton openButton;\n- JButton comparisonGoButton;\n-\n- JComboBox formatTypes;\n- JComboBox fileFormats;\n- String[] emptyFormats = {"Choose a type first..."};\n-\n- JFrame askFrame;\n- JButton pythonButton;\n- JButton mySqlButton;\n- JButton rButton;\n-\n- HashMap <JButton, Program> callingProgram;\n-\n- // comparison\n- JList comparisonFile1List;\n- JList comparisonFile2List;\n- JTextField comparisonOutputTextField;\n- JTextField comparisonFiveQueryExtensionTextField;\n- JCheckBox comparisonColinearCheckBox;\n- JCheckBox comparisonAntisenseCheckBox;\n- JCheckBox comparisonInvertCheckBox;\n-\n- JList fileList;\n- JTextArea logArea;\n-\n- // progress bar\n- JLabel messageField;\n- JProgressBar progressBar;\n- JLabel etaField;\n-\n- // process\n- Program currentProgram;\n- Process process;\n- javax.swing.Timer processTimer;\n-\n-\n- int previousStatus;\n-\n- public Smart() {\n- super(new BorderLayout());\n-\n- callingProgram = new HashMap <JButton, Program> ();\n-\n- previousStatus = -1;\n-\n- processTimer = new javax.swing.Timer(1000, this);\n- processTimer.stop();\n-\n- // Ask frame buttons\n- pythonButton = new JButton("find...");\n- mySqlButton = new JButton("find...");\n- rButton = new JButton("find...");\n-\n- // Get available formats\n- FormatsReader formatReader = new FormatsReader(Global.smartFormatsFileName);\n- if (! formatReader.read()) {\n- System.out.println("Something was wrong while reading file format...");\n- }\n-\n- // Get screen size\n- Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();\n-\n- // Log\n- logArea = new JTextArea(512, Global.logAreaSize);\n- logArea.setPreferredSize(new Dimension(screenSize.width, (int) (screenSize.height * 0.22)));\n- logArea.setFont(new Font("Monospaced", logArea.getFont().getStyle(), logArea.getFont().getSize()));\n- JScrollPane logScroll = new JScrollPane(logArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);\n- TitledBorder logBorder '..b'\\n");\n- }\n- }\n- this.checkConfiguration();\n- }\n- // Format type\n- else if (e.getSource() == formatTypes) {\n- fileFormats.removeAllItems();\n- Vector < String > selectedFormats = Global.formats.getFormats((String) formatTypes.getSelectedItem()).getFormats();\n- for (int i = 0; i < selectedFormats.size(); i++) {\n- fileFormats.addItem(selectedFormats.get(i));\n- }\n- }\n- // Main file chooser\n- else if (e.getSource() == openButton) {\n- JFileChooser chooser = new JFileChooser();\n- if (chooser.showOpenDialog(mainFrame) == JFileChooser.APPROVE_OPTION) {\n- String fileName = chooser.getSelectedFile().getPath();\n- Global.fileNames.addElement(fileName);\n- Global.files.addFile(fileName, (String) formatTypes.getSelectedItem(), (String) fileFormats.getSelectedItem());\n- }\n- }\n- // Other file choosers\n- else if (Global.otherFilesChooser.containsKey(e.getSource())) {\n- JTextField textField = Global.otherFilesChooser.get(e.getSource());\n- JFileChooser chooser = new JFileChooser();\n- if (chooser.showOpenDialog(mainFrame) == JFileChooser.APPROVE_OPTION) {\n- textField.setText(chooser.getSelectedFile().getPath());\n- }\n- }\n- // Other directories choosers\n- else if (Global.otherDirectoriesChooser.containsKey(e.getSource())) {\n- JTextField textField = Global.otherDirectoriesChooser.get(e.getSource());\n- JFileChooser chooser = new JFileChooser();\n- chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);\n- if (chooser.showOpenDialog(mainFrame) == JFileChooser.APPROVE_OPTION) {\n- textField.setText(chooser.getSelectedFile().getPath());\n- }\n- }\n- else if (Global.otherFileConcatenationChooser.containsKey(e.getSource())) {\n- JTextField textField = Global.otherDirectoriesChooser.get(e.getSource());\n- JFileChooser chooser = new JFileChooser();\n- chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);\n- if (chooser.showOpenDialog(mainFrame) == JFileChooser.APPROVE_OPTION) {\n- String text = textField.getText();\n- if ((text == null) || ("".equals(text))) {\n- textField.setText(chooser.getSelectedFile().getPath());\n- }\n- else {\n- textField.setText(text + "," + chooser.getSelectedFile().getPath());\n- }\n- }\n- }\n- // Programs\n- else {\n- currentProgram = callingProgram.get(e.getSource());\n- String comment = currentProgram.checkValues();\n- if (comment != null) {\n- logArea.append(comment);\n- return;\n- }\n- LinkedList <String> command = currentProgram.getCommand();\n- ProgramLauncher launcher = new ProgramLauncher(command, logArea, messageField, progressBar, etaField);\n- launcher.execute();\n- Vector < File > outputFiles = currentProgram.getOutputFiles();\n- for (int i = 0; i < outputFiles.size(); i++) {\n- File file = outputFiles.get(i);\n- if (file.getFormatType().compareToIgnoreCase("other") != 0) {\n- Global.fileNames.addElement(file.getName());\n- Global.files.addFile(file);\n- }\n- }\n- currentProgram = null;\n- }\n- }\n-\n-\n- private static void createAndShowGUI() {\n- // Create and set up the window.\n- JFrame mainFrame = new JFrame("S-Mart");\n- mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n-\n- //Create and set up the content pane.\n- JComponent newContentPane = new Smart();\n- newContentPane.setOpaque(true);\n- mainFrame.setContentPane(newContentPane);\n-\n- // Display the window.\n- mainFrame.pack();\n- mainFrame.setVisible(true);\n- Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();\n- mainFrame.setBounds(0, 0, screenSize.width, screenSize.height);\n- }\n-\n-\n- public static void main(String[] args) {\n- javax.swing.SwingUtilities.invokeLater(new Runnable() {\n- public void run() {\n- createAndShowGUI();\n- }\n- });\n- }\n-}\n' |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/Smart.class |
b |
Binary file SMART/Java/Smart.class has changed |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/Smart.jar |
b |
Binary file SMART/Java/Smart.jar has changed |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/Smart.java --- a/SMART/Java/Smart.java Mon Apr 29 03:29:31 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,668 +0,0 @@\n-/**\n- *\n- * Copyright INRA-URGI 2009-2010\n- * \n- * This software is governed by the CeCILL license under French law and\n- * abiding by the rules of distribution of free software. You can use,\n- * modify and/ or redistribute the software under the terms of the CeCILL\n- * license as circulated by CEA, CNRS and INRIA at the following URL\n- * "http://www.cecill.info".\n- * \n- * As a counterpart to the access to the source code and rights to copy,\n- * modify and redistribute granted by the license, users are provided only\n- * with a limited warranty and the software\'s author, the holder of the\n- * economic rights, and the successive licensors have only limited\n- * liability.\n- * \n- * In this respect, the user\'s attention is drawn to the risks associated\n- * with loading, using, modifying and/or developing or reproducing the\n- * software by the user in light of its specific status of free software,\n- * that may mean that it is complicated to manipulate, and that also\n- * therefore means that it is reserved for developers and experienced\n- * professionals having in-depth computer knowledge. Users are therefore\n- * encouraged to load and test the software\'s suitability as regards their\n- * requirements in conditions enabling the security of their systems and/or\n- * data to be ensured and, more generally, to use and operate it in the\n- * same conditions as regards security.\n- * \n- * The fact that you are presently reading this means that you have had\n- * knowledge of the CeCILL license and that you accept its terms.\n- *\n- */\n-import java.util.*;\n-import java.awt.*;\n-import java.awt.event.ActionEvent;\n-import java.awt.event.ActionListener;\n-import java.awt.event.WindowEvent;\n-import java.awt.event.WindowAdapter;\n-import java.io.*;\n-import javax.swing.*;\n-import javax.swing.filechooser.*;\n-import javax.swing.border.*;\n-import javax.swing.SwingUtilities;\n-import java.util.prefs.BackingStoreException;\n-\n-\n-public class Smart extends JPanel implements ActionListener {\n-\n- String version = "1.1.0";\n-\n- JFrame mainFrame;\n- JButton openButton;\n- JButton resetFileButton;\n-\n- JComboBox formatTypes;\n- JComboBox fileFormats;\n- String[] emptyFormats = {"Choose a type first..."};\n-\n- JFrame askFrame;\n- JButton pythonButton;\n- JButton mySqlButton;\n- JButton rButton;\n-\n- HashMap <JButton, Program> callingProgram;\n-\n- static JList fileList;\n- static JTextArea logArea;\n-\n- // progress bar\n- static JLabel messageField;\n- static JProgressBar progressBar;\n- static JLabel etaField;\n-\n- // process\n- Program currentProgram;\n- Process process;\n- javax.swing.Timer processTimer;\n-\n-\n- int previousStatus;\n-\n- public Smart() {\n- super(new BorderLayout());\n-\n- callingProgram = new HashMap <JButton, Program> ();\n-\n- previousStatus = -1;\n-\n- processTimer = new javax.swing.Timer(1000, this);\n- processTimer.stop();\n-\n- // Ask frame buttons\n- pythonButton = new JButton("find...");\n- mySqlButton = new JButton("find...");\n- rButton = new JButton("find...");\n-\n- // Get available formats\n- FormatsReader formatReader = new FormatsReader(Global.smartFormatsFileName);\n- if (! formatReader.read()) {\n- System.out.println("Something was wrong while reading file format...");\n- }\n-\n- // Get screen size\n- Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();\n-\n- // Log\n- logArea = new JTextArea(512, Global.logAreaSize);\n- logArea.setPreferredSize(new Dimension(screenSize.width, (int) (screenSize.height * 0.22)));\n- logArea.setFont(new Font("Monospaced", logArea.getFont().getStyle(), logArea.getFont().getSize()));\n- JScrollPane logScroll = new JScrollPane(logArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);\n- TitledBorder logBorder = BorderFactory.createTitledBorder("Log");\n- logScroll.setBorder(logBorder);\n- logArea.append("Using S-MART " + version + "\\n");\n-\n- '..b'extField = Global.otherFilesChooser.get(e.getSource());\n- JFileChooser chooser = new JFileChooser();\n- if (chooser.showOpenDialog(mainFrame) == JFileChooser.APPROVE_OPTION) {\n- textField.setText(chooser.getSelectedFile().getPath());\n- }\n- }\n- // Other directories choosers\n- else if (Global.otherDirectoriesChooser.containsKey(e.getSource())) {\n- JTextField textField = Global.otherDirectoriesChooser.get(e.getSource());\n- JFileChooser chooser = new JFileChooser();\n- chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);\n- if (chooser.showOpenDialog(mainFrame) == JFileChooser.APPROVE_OPTION) {\n- textField.setText(chooser.getSelectedFile().getPath());\n- }\n- }\n- else if (Global.otherFileConcatenationChooser.containsKey(e.getSource())) {\n- JTextField textField = Global.otherDirectoriesChooser.get(e.getSource());\n- JFileChooser chooser = new JFileChooser();\n- chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);\n- if (chooser.showOpenDialog(mainFrame) == JFileChooser.APPROVE_OPTION) {\n- String text = textField.getText();\n- if ((text == null) || ("".equals(text))) {\n- textField.setText(chooser.getSelectedFile().getPath());\n- }\n- else {\n- textField.setText(text + "," + chooser.getSelectedFile().getPath());\n- }\n- }\n- }\n- // Programs\n- else {\n- currentProgram = callingProgram.get(e.getSource());\n- String comment = currentProgram.checkValues();\n- if (comment != null) {\n- logArea.append(comment);\n- return;\n- }\n- LinkedList <String> command = currentProgram.getCommand();\n- ProgramLauncher launcher = new ProgramLauncher(command, logArea, messageField, progressBar, etaField);\n- launcher.execute();\n- Vector < File > outputFiles = currentProgram.getOutputFiles();\n- for (int i = 0; i < outputFiles.size(); i++) {\n- File file = outputFiles.get(i);\n- if (file.getFormatType().compareToIgnoreCase("other") != 0) {\n- Global.fileNames.addElement(file.getName());\n- Global.files.addFile(file);\n- }\n- }\n- currentProgram = null;\n- }\n- }\n-\n-\n- private static void removeTmpFiles() {\n- logArea.append("You want to quit already?\\nRemoving temporary files...");\n- String[] command = {Global.pythonCommand, "Python" + java.io.File.separator + "removeAllTmpTables.py"};\n- ProgramLauncher launcher = new ProgramLauncher(command, logArea, messageField, progressBar, etaField);\n- launcher.execute();\n- logArea.append(" done.\\nNow quitting.\\nBye!");\n- }\n-\n-\n- private static void printJavaVersions() {\n- String[] pro = {"java.version", "java.vm.version", "java.runtime.version"};\n-\n- Properties properties = System.getProperties();\n- for (int i = 0; i < pro.length; i++) {\n- logArea.append(pro[i] + ": " + properties.getProperty(pro[i]) + "\\n");\n- }\n- }\n- \n- private static void createAndShowGUI() {\n- // Create and set up the window.\n- JFrame mainFrame = new JFrame("S-Mart");\n- mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n-\n- //Create and set up the content pane.\n- JComponent newContentPane = new Smart();\n- newContentPane.setOpaque(true);\n- mainFrame.setContentPane(newContentPane);\n-\n- // Display the window.\n- mainFrame.pack();\n- mainFrame.setVisible(true);\n- Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();\n- mainFrame.setBounds(0, 0, screenSize.width, screenSize.height);\n- printJavaVersions();\n-\n- // Remove tmp file while quitting.\n- mainFrame.addWindowListener(new WindowAdapter() {\n- @Override\n- public void windowClosing(WindowEvent e) {\n- removeTmpFiles();\n- }\n- });\n- }\n-\n-\n- public static void main(String[] args) {\n- javax.swing.SwingUtilities.invokeLater(new Runnable() {\n- public void run() {\n- createAndShowGUI();\n- }\n- });\n- }\n-}\n' |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/SmartInstaller.jar |
b |
Binary file SMART/Java/SmartInstaller.jar has changed |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/WindowsRegistry.class |
b |
Binary file SMART/Java/WindowsRegistry.class has changed |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/WindowsRegistry.java --- a/SMART/Java/WindowsRegistry.java Mon Apr 29 03:29:31 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,387 +0,0 @@\n-import java.lang.reflect.InvocationTargetException;\n-import java.lang.reflect.Method;\n-import java.util.HashMap;\n-import java.util.Map;\n-import java.util.ArrayList;\n-import java.util.List;\n-import java.util.prefs.Preferences;\n-\n-public class WindowsRegistry {\n- public static final int HKEY_CURRENT_USER = 0x80000001;\n- public static final int HKEY_LOCAL_MACHINE = 0x80000002;\n- public static final int REG_SUCCESS = 0;\n- public static final int REG_NOTFOUND = 2;\n- public static final int REG_ACCESSDENIED = 5;\n-\n- private static final int KEY_ALL_ACCESS = 0xf003f;\n- private static final int KEY_READ = 0x20019;\n- private static Preferences userRoot = Preferences.userRoot();\n- private static Preferences systemRoot = Preferences.systemRoot();\n- private static Class<? extends Preferences> userClass = userRoot.getClass();\n- private static Method regOpenKey = null;\n- private static Method regCloseKey = null;\n- private static Method regQueryValueEx = null;\n- private static Method regEnumValue = null;\n- private static Method regQueryInfoKey = null;\n- private static Method regEnumKeyEx = null;\n- private static Method regCreateKeyEx = null;\n- private static Method regSetValueEx = null;\n- private static Method regDeleteKey = null;\n- private static Method regDeleteValue = null;\n-\n- static {\n- try {\n- regOpenKey = userClass.getDeclaredMethod("WindowsRegOpenKey",\n- new Class[] { int.class, byte[].class, int.class });\n- regOpenKey.setAccessible(true);\n- regCloseKey = userClass.getDeclaredMethod("WindowsRegCloseKey",\n- new Class[] { int.class });\n- regCloseKey.setAccessible(true);\n- regQueryValueEx = userClass.getDeclaredMethod("WindowsRegQueryValueEx",\n- new Class[] { int.class, byte[].class });\n- regQueryValueEx.setAccessible(true);\n- regEnumValue = userClass.getDeclaredMethod("WindowsRegEnumValue",\n- new Class[] { int.class, int.class, int.class });\n- regEnumValue.setAccessible(true);\n- regQueryInfoKey = userClass.getDeclaredMethod("WindowsRegQueryInfoKey1",\n- new Class[] { int.class });\n- regQueryInfoKey.setAccessible(true);\n- regEnumKeyEx = userClass.getDeclaredMethod( \n- "WindowsRegEnumKeyEx", new Class[] { int.class, int.class, \n- int.class }); \n- regEnumKeyEx.setAccessible(true);\n- regCreateKeyEx = userClass.getDeclaredMethod( \n- "WindowsRegCreateKeyEx", new Class[] { int.class, \n- byte[].class }); \n- regCreateKeyEx.setAccessible(true); \n- regSetValueEx = userClass.getDeclaredMethod( \n- "WindowsRegSetValueEx", new Class[] { int.class, \n- byte[].class, byte[].class }); \n- regSetValueEx.setAccessible(true); \n- regDeleteValue = userClass.getDeclaredMethod( \n- "WindowsRegDeleteValue", new Class[] { int.class, \n- byte[].class }); \n- regDeleteValue.setAccessible(true); \n- regDeleteKey = userClass.getDeclaredMethod( \n- "WindowsRegDeleteKey", new Class[] { int.class, \n- byte[].class }); \n- regDeleteKey.setAccessible(true); \n- }\n- catch (Exception e) {\n- e.printStackTrace();\n- }\n- }\n-\n- private WindowsRegistry() { }\n-\n- /**\n- * Read a value from key and value name\n- * @param hkey HKEY_CURRENT_USER/HKEY_LOCAL_MACHINE\n- * @param key\n- * @param valueName\n- * @return the value\n- * @throws IllegalArgumentException\n- * @throws IllegalAccessException\n- * @throws InvocationTargetException\n- */\n- public static String readString(int hkey, String key, String valueName) \n- throws IllegalArgumentException, IllegalAccessException,\n- InvocationTargetException \n- {\n- if (hkey == HKEY_LOCAL_MACHINE) {\n- return readString(systemRoot, hkey, key, valueName);\n- }\n- else if (hkey == HKEY_CURRENT_USER) {\n- return readString(userRoot, hkey, key, valueName);\n- }\n- else {\n- throw new Illeg'..b' return rc; // can REG_NOTFOUND, REG_ACCESSDENIED, REG_SUCCESS\n- }\n-\n- private static String readString(Preferences root, int hkey, String key, String value)\n- throws IllegalArgumentException, IllegalAccessException,\n- InvocationTargetException \n- {\n- int[] handles = (int[]) regOpenKey.invoke(root, new Object[] {\n- new Integer(hkey), toCstr(key), new Integer(KEY_READ) });\n- if (handles[1] != REG_SUCCESS) {\n- return null; \n- }\n- byte[] valb = (byte[]) regQueryValueEx.invoke(root, new Object[] {\n- new Integer(handles[0]), toCstr(value) });\n- regCloseKey.invoke(root, new Object[] { new Integer(handles[0]) });\n- return (valb != null ? new String(valb).trim() : null);\n- }\n-\n- private static Map<String,String> readStringValues\n- (Preferences root, int hkey, String key)\n- throws IllegalArgumentException, IllegalAccessException,\n- InvocationTargetException \n- {\n- HashMap<String, String> results = new HashMap<String,String>();\n- int[] handles = (int[]) regOpenKey.invoke(root, new Object[] {\n- new Integer(hkey), toCstr(key), new Integer(KEY_READ) });\n- if (handles[1] != REG_SUCCESS) {\n- return null;\n- }\n- int[] info = (int[]) regQueryInfoKey.invoke(root,\n- new Object[] { new Integer(handles[0]) });\n-\n- int count = info[2]; // count \n- int maxlen = info[3]; // value length max\n- for(int index=0; index<count; index++) {\n- byte[] name = (byte[]) regEnumValue.invoke(root, new Object[] {\n- new Integer\n- (handles[0]), new Integer(index), new Integer(maxlen + 1)});\n- String value = readString(hkey, key, new String(name));\n- results.put(new String(name).trim(), value);\n- }\n- regCloseKey.invoke(root, new Object[] { new Integer(handles[0]) });\n- return results;\n- }\n-\n- private static List<String> readStringSubKeys\n- (Preferences root, int hkey, String key)\n- throws IllegalArgumentException, IllegalAccessException,\n- InvocationTargetException \n- {\n- List<String> results = new ArrayList<String>();\n- int[] handles = (int[]) regOpenKey.invoke(root, new Object[] {\n- new Integer(hkey), toCstr(key), new Integer(KEY_READ) \n- });\n- if (handles[1] != REG_SUCCESS) {\n- return null;\n- }\n- int[] info = (int[]) regQueryInfoKey.invoke(root,\n- new Object[] { new Integer(handles[0]) });\n-\n- int count = info[2]; // count \n- int maxlen = info[3]; // value length max\n- for(int index=0; index<count; index++) {\n- byte[] name = (byte[]) regEnumKeyEx.invoke(root, new Object[] {\n- new Integer\n- (handles[0]), new Integer(index), new Integer(maxlen + 1)\n- });\n- results.add(new String(name).trim());\n- }\n- regCloseKey.invoke(root, new Object[] { new Integer(handles[0]) });\n- return results;\n- }\n-\n- private static int [] createKey(Preferences root, int hkey, String key)\n- throws IllegalArgumentException, IllegalAccessException,\n- InvocationTargetException \n- {\n- return (int[]) regCreateKeyEx.invoke(root,\n- new Object[] { new Integer(hkey), toCstr(key) });\n- }\n-\n- private static void writeStringValue \n- (Preferences root, int hkey, String key, String valueName, String value) \n- throws IllegalArgumentException, IllegalAccessException,\n- InvocationTargetException \n- {\n- int[] handles = (int[]) regOpenKey.invoke(root, new Object[] {\n- new Integer(hkey), toCstr(key), new Integer(KEY_ALL_ACCESS) });\n-\n- regSetValueEx.invoke(root, \n- new Object[] { \n- new Integer(handles[0]), toCstr(valueName), toCstr(value) \n- }); \n- regCloseKey.invoke(root, new Object[] { new Integer(handles[0]) });\n- }\n-\n- // utility\n- private static byte[] toCstr(String str) {\n- byte[] result = new byte[str.length() + 1];\n-\n- for (int i = 0; i < str.length(); i++) {\n- result[i] = (byte) str.charAt(i);\n- }\n- result[str.length()] = 0;\n- return result;\n- }\n-}\n-\n' |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/__init__.pyc |
b |
Binary file SMART/Java/__init__.pyc has changed |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/createJar.sh --- a/SMART/Java/createJar.sh Mon Apr 29 03:29:31 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,4 +0,0 @@ -#!/bin/bash - -javac Files.java Program.java Program.java FormatsContainer.java FormatType.java ProgramLauncher.java PythonHelperReader.java Smart.java File.java FormatsReader.java Global.java ProgramFileReader.java ProgramOption.java PythonProgramFinder.java WindowsRegistry.java -jar cfm Smart.jar manifest.txt File.class FormatsContainer.class FormatType.class Program.class ProgramLauncher.class PythonHelperReader.class PythonProgramFinder.class Smart\$2.class WindowsRegistry.class Files.class FormatsReader.class Global.class ProgramFileReader.class ProgramOption.class PythonProgramFinder\$1.class Smart\$1.class Smart.class |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/formats.txt --- a/SMART/Java/formats.txt Mon Apr 29 03:29:31 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,4 +0,0 @@ -sequence: fasta, fastq -transcript: bed, gff, gff2, gff3, csv -mapping: axt, blast, bowtie, exo, maq, nucmer, psl, sam, seqmap, shrimp, soap, soap2 -other: txt, wig, png, nclist |
b |
diff -r a6a9d9b94ddb -r 4e7ee5683ef1 SMART/Java/manifest.txt --- a/SMART/Java/manifest.txt Mon Apr 29 03:29:31 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Created-By: Matthias Zytnicki -Main-Class: Smart |