Revision 33729

View differences:

branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.main/src/main/java/org/gvsig/installer/main/utils/CreateBoundleFrame.java
46 46
/**
47 47
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
48 48
 */
49
public class CreateBoundleFrame extends JFrame implements WindowListener, ActionListener {
50
	private javax.swing.JButton executeButton;
51
	private javax.swing.JLabel inputLabel;
52
	private FileTextField inputText;
53
	private javax.swing.JLabel jLabel2;
54
	private FileTextField outputText;
49
public class CreateBoundleFrame extends JFrame implements WindowListener,
50
    ActionListener {
55 51

  
56
	public CreateBoundleFrame() throws HeadlessException {
57
		super();		
58
		initializeComponents();
59
		this.addWindowListener(this);	
60
		executeButton.addActionListener(this);
61
	}
52
    /**
53
     * 
54
     */
55
    private static final long serialVersionUID = -2128261599641241144L;
56
    private javax.swing.JButton executeButton;
57
    private javax.swing.JLabel inputLabel;
58
    private FileTextField inputText;
59
    private javax.swing.JLabel jLabel2;
60
    private FileTextField outputText;
62 61

  
63
	private void initializeComponents() {
64
		java.awt.GridBagConstraints gridBagConstraints;
62
    public CreateBoundleFrame() throws HeadlessException {
63
        super();
64
        initializeComponents();
65
        this.addWindowListener(this);
66
        executeButton.addActionListener(this);
67
    }
65 68

  
66
		inputLabel = new javax.swing.JLabel();
67
		executeButton = new javax.swing.JButton();
68
		inputText = new FileTextField();
69
		outputText = new FileTextField();
70
		jLabel2 = new javax.swing.JLabel();
69
    private void initializeComponents() {
70
        java.awt.GridBagConstraints gridBagConstraints;
71 71

  
72
		setLayout(new java.awt.GridBagLayout());
72
        inputLabel = new javax.swing.JLabel();
73
        executeButton = new javax.swing.JButton();
74
        inputText = new FileTextField();
75
        outputText = new FileTextField();
76
        jLabel2 = new javax.swing.JLabel();
73 77

  
74
		inputLabel.setText("Input directory");
75
		gridBagConstraints = new java.awt.GridBagConstraints();
76
		gridBagConstraints.gridx = 0;
77
		gridBagConstraints.gridy = 0;
78
		gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
79
		gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
80
		add(inputLabel, gridBagConstraints);
78
        setLayout(new java.awt.GridBagLayout());
81 79

  
82
		executeButton.setText("Execute");
83
		gridBagConstraints = new java.awt.GridBagConstraints();
84
		gridBagConstraints.gridx = 1;
85
		gridBagConstraints.gridy = 2;
86
		gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
87
		gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
88
		add(executeButton, gridBagConstraints);
80
        inputLabel.setText("Input directory");
81
        gridBagConstraints = new java.awt.GridBagConstraints();
82
        gridBagConstraints.gridx = 0;
83
        gridBagConstraints.gridy = 0;
84
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
85
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
86
        add(inputLabel, gridBagConstraints);
89 87

  
90
		gridBagConstraints = new java.awt.GridBagConstraints();
91
		gridBagConstraints.gridx = 1;
92
		gridBagConstraints.gridy = 0;
93
		gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
94
		gridBagConstraints.ipadx = 67;
95
		gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
96
		gridBagConstraints.weightx = 1.0;
97
		gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
98
		add(inputText, gridBagConstraints);
88
        executeButton.setText("Execute");
89
        gridBagConstraints = new java.awt.GridBagConstraints();
90
        gridBagConstraints.gridx = 1;
91
        gridBagConstraints.gridy = 2;
92
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
93
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
94
        add(executeButton, gridBagConstraints);
99 95

  
100
		gridBagConstraints = new java.awt.GridBagConstraints();
101
		gridBagConstraints.gridx = 1;
102
		gridBagConstraints.gridy = 1;
103
		gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
104
		gridBagConstraints.ipadx = 67;
105
		gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
106
		gridBagConstraints.weightx = 1.0;
107
		gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
108
		add(outputText, gridBagConstraints);
96
        gridBagConstraints = new java.awt.GridBagConstraints();
97
        gridBagConstraints.gridx = 1;
98
        gridBagConstraints.gridy = 0;
99
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
100
        gridBagConstraints.ipadx = 67;
101
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
102
        gridBagConstraints.weightx = 1.0;
103
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
104
        add(inputText, gridBagConstraints);
109 105

  
110
		jLabel2.setText("Output");
111
		gridBagConstraints = new java.awt.GridBagConstraints();
112
		gridBagConstraints.gridx = 0;
113
		gridBagConstraints.gridy = 1;
114
		gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
115
		gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
116
		add(jLabel2, gridBagConstraints);
106
        gridBagConstraints = new java.awt.GridBagConstraints();
107
        gridBagConstraints.gridx = 1;
108
        gridBagConstraints.gridy = 1;
109
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
110
        gridBagConstraints.ipadx = 67;
111
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
112
        gridBagConstraints.weightx = 1.0;
113
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
114
        add(outputText, gridBagConstraints);
117 115

  
118
	}
116
        jLabel2.setText("Output");
117
        gridBagConstraints = new java.awt.GridBagConstraints();
118
        gridBagConstraints.gridx = 0;
119
        gridBagConstraints.gridy = 1;
120
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
121
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
122
        add(jLabel2, gridBagConstraints);
119 123

  
120
	public void windowActivated(WindowEvent arg0) {
121
		// TODO Auto-generated method stub
124
    }
122 125

  
123
	}
126
    public void windowActivated(WindowEvent arg0) {
127
        // TODO Auto-generated method stub
124 128

  
125
	public void windowClosed(WindowEvent arg0) {
126
		System.exit(0);
129
    }
127 130

  
128
	}
131
    public void windowClosed(WindowEvent arg0) {
132
        System.exit(0);
129 133

  
130
	public void windowClosing(WindowEvent arg0) {
131
		// TODO Auto-generated method stub
134
    }
132 135

  
133
	}
136
    public void windowClosing(WindowEvent arg0) {
137
        // TODO Auto-generated method stub
134 138

  
135
	public void windowDeactivated(WindowEvent arg0) {
136
		// TODO Auto-generated method stub
139
    }
137 140

  
138
	}
141
    public void windowDeactivated(WindowEvent arg0) {
142
        // TODO Auto-generated method stub
139 143

  
140
	public void windowDeiconified(WindowEvent arg0) {
141
		// TODO Auto-generated method stub
144
    }
142 145

  
143
	}
146
    public void windowDeiconified(WindowEvent arg0) {
147
        // TODO Auto-generated method stub
144 148

  
145
	public void windowIconified(WindowEvent arg0) {
146
		// TODO Auto-generated method stub
149
    }
147 150

  
148
	}
151
    public void windowIconified(WindowEvent arg0) {
152
        // TODO Auto-generated method stub
149 153

  
150
	public void windowOpened(WindowEvent arg0) {
151
		// TODO Auto-generated method stub
154
    }
152 155

  
153
	}
156
    public void windowOpened(WindowEvent arg0) {
157
        // TODO Auto-generated method stub
154 158

  
155
	public void actionPerformed(ActionEvent arg0) {
156
		File inputDirectory = inputText.getSelectedFile();
157
		File outputFile = outputText.getSelectedFile();
158
		
159
		if (!inputDirectory.exists()){
160
			JOptionPane.showMessageDialog(this, "Input directory doesn't exist");
161
			return;
162
		}
163
		
164
		if (outputFile.exists()){
165
			outputFile.delete();
166
		}
167
		
168
		Compress compress = new Compress();
169
		try {
170
			File[] files = inputDirectory.listFiles();
171
			List<File> filesArray = new ArrayList<File>();
172
			List<String> fileNamesArray = new ArrayList<String>();
173
			for (int i=0 ; i<files.length ; i++){
174
				if (!files[i].getName().toUpperCase().equals(".SVN")){
175
					filesArray.add(files[i]);
176
					fileNamesArray.add(files[i].getName());
177
				}
178
			}
179
			compress.compressPlugins(filesArray, fileNamesArray, new FileOutputStream(outputFile));
180
		} catch (Exception e) {
181
			JOptionPane.showMessageDialog(this, e.toString());
182
		}
183
	}
159
    }
160

  
161
    public void actionPerformed(ActionEvent arg0) {
162
        File inputDirectory = inputText.getSelectedFile();
163
        File outputFile = outputText.getSelectedFile();
164

  
165
        if (!inputDirectory.exists()) {
166
            JOptionPane
167
                .showMessageDialog(this, "Input directory doesn't exist");
168
            return;
169
        }
170

  
171
        if (outputFile.exists()) {
172
            outputFile.delete();
173
        }
174

  
175
        Compress compress = new Compress();
176
        try {
177
            File[] files = inputDirectory.listFiles();
178
            List<File> filesArray = new ArrayList<File>();
179
            List<String> fileNamesArray = new ArrayList<String>();
180
            for (int i = 0; i < files.length; i++) {
181
                if (!files[i].getName().toUpperCase().equals(".SVN")) {
182
                    filesArray.add(files[i]);
183
                    fileNamesArray.add(files[i].getName());
184
                }
185
            }
186
            compress.compressPlugins(filesArray, fileNamesArray,
187
                new FileOutputStream(outputFile));
188
        } catch (Exception e) {
189
            JOptionPane.showMessageDialog(this, e.toString());
190
        }
191
    }
184 192
}
185

  
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.main/src/main/java/org/gvsig/installer/main/utils/CreateBundleLauncher.java
26 26
 */
27 27

  
28 28
package org.gvsig.installer.main.utils;
29

  
29 30
/**
30 31
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
31 32
 */
32 33
public class CreateBundleLauncher {
33 34

  
34
	public static void main(String[] args){	
35
		new CreateBundleLauncher();
36
	}
35
    public static void main(String[] args) {
36
        new CreateBundleLauncher();
37
    }
37 38

  
38
	public CreateBundleLauncher() {
39
		super();	
40
		CreateBoundleFrame createBoundleFrame = new CreateBoundleFrame();
41
		createBoundleFrame.setBounds(0, 0, 500, 150);
42
		createBoundleFrame.setVisible(true);		
43
	}
44
	
39
    public CreateBundleLauncher() {
40
        super();
41
        CreateBoundleFrame createBoundleFrame = new CreateBoundleFrame();
42
        createBoundleFrame.setBounds(0, 0, 500, 150);
43
        createBoundleFrame.setVisible(true);
44
    }
45 45

  
46 46
}
47

  
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.main/src/main/java/org/gvsig/installer/main/utils/FrameWizardListener.java
1 1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
* 
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
* 
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
* 
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
* MA  02110-1301, USA.
20
* 
21
*/
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22 22

  
23 23
/*
24
* AUTHORS (In addition to CIT):
25
* 2010 {Prodevelop}   {Task}
26
*/
27
 
24
 * AUTHORS (In addition to CIT):
25
 * 2010 {Prodevelop}   {Task}
26
 */
27

  
28 28
package org.gvsig.installer.main.utils;
29 29

  
30 30
import javax.swing.JFrame;
......
35 35
/**
36 36
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
37 37
 */
38
public class FrameWizardListener implements InstallerWizardActionListener{
39
	private JFrame frame = null;
40
	
41
	public FrameWizardListener(JFrame frame) {
42
		super();
43
		this.frame = frame;
44
	}
38
public class FrameWizardListener implements InstallerWizardActionListener {
45 39

  
46
	public void cancel(InstallerWizardPanel installerWizard) {
47
		frame.setVisible(false);
48
		System.exit(0);
49
		
50
	}
40
    private JFrame frame = null;
51 41

  
52
	public void finish(InstallerWizardPanel installerWizard) {
53
		frame.setVisible(false);
54
		System.exit(0);		
55
	}
42
    public FrameWizardListener(JFrame frame) {
43
        super();
44
        this.frame = frame;
45
    }
56 46

  
47
    public void cancel(InstallerWizardPanel installerWizard) {
48
        frame.setVisible(false);
49
        System.exit(0);
50

  
51
    }
52

  
53
    public void finish(InstallerWizardPanel installerWizard) {
54
        frame.setVisible(false);
55
        System.exit(0);
56
    }
57

  
57 58
}
58

  
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.main/src/main/java/org/gvsig/installer/main/execution/InstallPackageWizardFromDefaultDirectoryLauncher.java
1 1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
* 
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
* 
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
* 
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
* MA  02110-1301, USA.
20
* 
21
*/
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22 22

  
23 23
/*
24
* AUTHORS (In addition to CIT):
25
* 2010 {Prodevelop}   {Task}
26
*/
27
 
24
 * AUTHORS (In addition to CIT):
25
 * 2010 {Prodevelop}   {Task}
26
 */
27

  
28 28
package org.gvsig.installer.main.execution;
29 29

  
30 30
import java.io.File;
......
40 40
/**
41 41
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
42 42
 */
43
public class InstallPackageWizardFromDefaultDirectoryLauncher extends DefaultLauncher{
44
	
45
	public static void main(String[] args) throws LocatorException, InstallPackageServiceException, InstallPackageWizardException, IOException{		
46
		new DefaultLibrariesInitializer().fullInitialize();
47
		MainInstallerLibrary mainInstallerLibrary = new MainInstallerLibrary();
48
		mainInstallerLibrary.initialize();
49
		mainInstallerLibrary.postInitialize();
50
		
51
		new InstallPackageWizardFromDefaultDirectoryLauncher();
52
	}
53
	
54
	public InstallPackageWizardFromDefaultDirectoryLauncher() throws LocatorException, InstallPackageWizardException, InstallPackageServiceException, IOException{
55
		File applicationDirectory = getApplicationDirectory();	
56
		
57
		InstallPackageServiceFrame frame = new InstallPackageServiceFrame(applicationDirectory);		
58
		frame.installFromDefaultDirectory();
59
		frame.setVisible(true);		
60
	}
43
public class InstallPackageWizardFromDefaultDirectoryLauncher extends
44
    DefaultLauncher {
45

  
46
    public static void main(String[] args) throws LocatorException,
47
        InstallPackageServiceException, InstallPackageWizardException,
48
        IOException {
49
        new DefaultLibrariesInitializer().fullInitialize();
50
        MainInstallerLibrary mainInstallerLibrary = new MainInstallerLibrary();
51
        mainInstallerLibrary.initialize();
52
        mainInstallerLibrary.postInitialize();
53

  
54
        new InstallPackageWizardFromDefaultDirectoryLauncher();
55
    }
56

  
57
    public InstallPackageWizardFromDefaultDirectoryLauncher()
58
        throws LocatorException, InstallPackageWizardException,
59
        InstallPackageServiceException, IOException {
60
        File applicationDirectory = getApplicationDirectory();
61

  
62
        InstallPackageServiceFrame frame =
63
            new InstallPackageServiceFrame(applicationDirectory);
64
        frame.installFromDefaultDirectory();
65
        frame.setVisible(true);
66
    }
61 67
}
62

  
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.main/src/main/java/org/gvsig/installer/main/execution/InstallPackageWizardLauncher.java
1 1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
* 
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
* 
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
* 
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
* MA  02110-1301, USA.
20
* 
21
*/
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22 22

  
23 23
/*
24
* AUTHORS (In addition to CIT):
25
* 2010 {Prodevelop}   {Task}
26
*/
27
 
24
 * AUTHORS (In addition to CIT):
25
 * 2010 {Prodevelop}   {Task}
26
 */
27

  
28 28
package org.gvsig.installer.main.execution;
29 29

  
30 30
import java.io.File;
......
40 40
/**
41 41
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
42 42
 */
43
public class InstallPackageWizardLauncher extends DefaultLauncher {	
43
public class InstallPackageWizardLauncher extends DefaultLauncher {
44 44

  
45
	public static void main(String[] args) throws LocatorException, InstallPackageServiceException, InstallPackageWizardException, IOException{		
46
		new DefaultLibrariesInitializer().fullInitialize();
47
		MainInstallerLibrary mainInstallerLibrary = new MainInstallerLibrary();
48
		mainInstallerLibrary.initialize();
49
		mainInstallerLibrary.postInitialize();
50
		
51
		new InstallPackageWizardLauncher();
52
	}
53
	
54
	public InstallPackageWizardLauncher() throws LocatorException, InstallPackageWizardException, InstallPackageServiceException, IOException{
55
		File applicationDirectory = getApplicationDirectory();	
56
		
57
		InstallPackageServiceFrame frame = new InstallPackageServiceFrame(applicationDirectory);		
58
		frame.setVisible(true);		
59
	}
45
    public static void main(String[] args) throws LocatorException,
46
        InstallPackageServiceException, InstallPackageWizardException,
47
        IOException {
48
        new DefaultLibrariesInitializer().fullInitialize();
49
        MainInstallerLibrary mainInstallerLibrary = new MainInstallerLibrary();
50
        mainInstallerLibrary.initialize();
51
        mainInstallerLibrary.postInitialize();
52

  
53
        new InstallPackageWizardLauncher();
54
    }
55

  
56
    public InstallPackageWizardLauncher() throws LocatorException,
57
        InstallPackageWizardException, InstallPackageServiceException,
58
        IOException {
59
        File applicationDirectory = getApplicationDirectory();
60

  
61
        InstallPackageServiceFrame frame =
62
            new InstallPackageServiceFrame(applicationDirectory);
63
        frame.setVisible(true);
64
    }
60 65
}
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.main/src/main/java/org/gvsig/installer/main/execution/InstallPackageServiceFrame.java
1 1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
* 
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
* 
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
* 
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
* MA  02110-1301, USA.
20
* 
21
*/
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22 22

  
23 23
/*
24
* AUTHORS (In addition to CIT):
25
* 2010 {Prodevelop}   {Task}
26
*/
27
 
24
 * AUTHORS (In addition to CIT):
25
 * 2010 {Prodevelop}   {Task}
26
 */
27

  
28 28
package org.gvsig.installer.main.execution;
29 29

  
30 30
import java.io.File;
......
41 41
/**
42 42
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
43 43
 */
44
public class InstallPackageServiceFrame extends JFrame{
44
public class InstallPackageServiceFrame extends JFrame {
45 45

  
46 46
    private static final long serialVersionUID = -5107758157530922356L;
47 47
    private InstallPackageWizard installerExecutionWizard;
48
	
49
	public InstallPackageServiceFrame(File applicationDirectory) throws LocatorException, InstallPackageWizardException
50
	{
51
		super();	
48

  
49
    public InstallPackageServiceFrame(File applicationDirectory)
50
        throws LocatorException, InstallPackageWizardException {
51
        super();
52 52
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
53
		installerExecutionWizard = SwingInstallerLocator.getSwingInstallerManager().createInstallPackageWizard(applicationDirectory);
54
		installerExecutionWizard.setWizardActionListener(new FrameWizardListener(this));
55
		this.add(installerExecutionWizard);
53
        installerExecutionWizard =
54
            SwingInstallerLocator.getSwingInstallerManager()
55
                .createInstallPackageWizard(applicationDirectory);
56
        installerExecutionWizard
57
            .setWizardActionListener(new FrameWizardListener(this));
58
        this.add(installerExecutionWizard);
56 59
        pack();
57
	}	
58
	
59
	public void installFromDefaultDirectory() throws InstallPackageServiceException{
60
		installerExecutionWizard.installFromDefaultDirectory();
61
	}	
62
	
63
	
60
    }
61

  
62
    public void installFromDefaultDirectory()
63
        throws InstallPackageServiceException {
64
        installerExecutionWizard.installFromDefaultDirectory();
65
    }
66

  
64 67
}
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.main/src/main/java/org/gvsig/installer/main/creation/MakePluginPackageWizardLauncher.java
1 1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
* 
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
* 
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
* 
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
* MA  02110-1301, USA.
20
* 
21
*/
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22 22

  
23 23
/*
24
* AUTHORS (In addition to CIT):
25
* 2010 {Prodevelop}   {Task}
26
*/
27
 
24
 * AUTHORS (In addition to CIT):
25
 * 2010 {Prodevelop}   {Task}
26
 */
27

  
28 28
package org.gvsig.installer.main.creation;
29 29

  
30 30
import java.io.File;
......
40 40
/**
41 41
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
42 42
 */
43
public class MakePluginPackageWizardLauncher extends DefaultLauncher{
43
public class MakePluginPackageWizardLauncher extends DefaultLauncher {
44 44

  
45
	public static void main(String[] args) throws LocatorException, MakePluginPackageWizardException, IOException, MakePluginPackageServiceException{		
46
		new DefaultLibrariesInitializer().fullInitialize();
47
		MainInstallerLibrary mainInstallerLibrary = new MainInstallerLibrary();
48
		mainInstallerLibrary.initialize();
49
		mainInstallerLibrary.postInitialize();
50
		
51
		new MakePluginPackageWizardLauncher();
52
	}
53
	
54
	public MakePluginPackageWizardLauncher() throws LocatorException, MakePluginPackageWizardException, IOException, MakePluginPackageServiceException
55
	{	
56
		File applicationDirectory = getApplicationDirectory();	
45
    public static void main(String[] args) throws LocatorException,
46
        MakePluginPackageWizardException, IOException,
47
        MakePluginPackageServiceException {
48
        new DefaultLibrariesInitializer().fullInitialize();
49
        MainInstallerLibrary mainInstallerLibrary = new MainInstallerLibrary();
50
        mainInstallerLibrary.initialize();
51
        mainInstallerLibrary.postInitialize();
57 52

  
58
		MakePluginPackageFrame frame = new MakePluginPackageFrame(applicationDirectory);		
59
		frame.setVisible(true);		
60
	}
53
        new MakePluginPackageWizardLauncher();
54
    }
61 55

  
56
    public MakePluginPackageWizardLauncher() throws LocatorException,
57
        MakePluginPackageWizardException, IOException,
58
        MakePluginPackageServiceException {
59
        File applicationDirectory = getApplicationDirectory();
60

  
61
        MakePluginPackageFrame frame =
62
            new MakePluginPackageFrame(applicationDirectory);
63
        frame.setVisible(true);
64
    }
65

  
62 66
}
63

  
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.main/src/main/java/org/gvsig/installer/main/creation/MakePluginPackageFrame.java
40 40
/**
41 41
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
42 42
 */
43
public class MakePluginPackageFrame extends JFrame{
43
public class MakePluginPackageFrame extends JFrame {
44 44

  
45 45
    private static final long serialVersionUID = 4144834319158286247L;
46 46
    private MakePluginPackageWizard installerCreationWizard;
47
	
48
	public MakePluginPackageFrame(File applicationDirectory) throws LocatorException, MakePluginPackageWizardException
49
	{
50
		super();	
47

  
48
    public MakePluginPackageFrame(File applicationDirectory)
49
        throws LocatorException, MakePluginPackageWizardException {
50
        super();
51 51
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
52
		installerCreationWizard = SwingInstallerLocator.getSwingInstallerManager().createMakePluginPackageWizard(applicationDirectory);
53
		installerCreationWizard.setWizardActionListener(new FrameWizardListener(this));
54
		this.add(installerCreationWizard);
52
        installerCreationWizard =
53
            SwingInstallerLocator.getSwingInstallerManager()
54
                .createMakePluginPackageWizard(applicationDirectory);
55
        installerCreationWizard
56
            .setWizardActionListener(new FrameWizardListener(this));
57
        this.add(installerCreationWizard);
55 58
        pack();
56
	}	
57
	
59
    }
60

  
58 61
}
59

  
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.main/src/main/java/org/gvsig/installer/main/DefaultLauncher.java
1 1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
* 
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
* 
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
* 
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
* MA  02110-1301, USA.
20
* 
21
*/
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22 22

  
23 23
/*
24
* AUTHORS (In addition to CIT):
25
* 2010 {Prodevelop}   {Task}
26
*/
27
 
24
 * AUTHORS (In addition to CIT):
25
 * 2010 {Prodevelop}   {Task}
26
 */
27

  
28 28
package org.gvsig.installer.main;
29 29

  
30 30
import java.io.File;
......
39 39
 */
40 40
public class DefaultLauncher {
41 41

  
42
	public File getApplicationDirectory() throws IOException{
43
		File templateFile = new File(getClass().getClassLoader().getResource("application").getFile());
44
		File applicationDirectory = new File(System.getProperty("java.io.tmpdir") +  File.separator + "tmp_gvsig_installer");		
45
		
46
		copy(templateFile, applicationDirectory);
47
		
48
		return applicationDirectory;
49
	}
50
	
51
	public void copy(File sourceLocation , File targetLocation) throws IOException { 
52
		if (sourceLocation.isDirectory()) {
53
			if (!targetLocation.exists()) {
54
				targetLocation.mkdir();
55
			}
42
    public File getApplicationDirectory() throws IOException {
43
        File templateFile =
44
            new File(getClass().getClassLoader().getResource("application")
45
                .getFile());
46
        File applicationDirectory =
47
            new File(System.getProperty("java.io.tmpdir") + File.separator
48
                + "tmp_gvsig_installer");
56 49

  
57
			String[] children = sourceLocation.list();
58
			for (int i=0; i<children.length; i++) {
59
				copy(new File(sourceLocation, children[i]),
60
						new File(targetLocation, children[i]));
61
			}
62
		} else {
63
			targetLocation.getParentFile().mkdirs();
50
        copy(templateFile, applicationDirectory);
64 51

  
65
			InputStream in = new FileInputStream(sourceLocation);
66
			OutputStream out = new FileOutputStream(targetLocation);
52
        return applicationDirectory;
53
    }
67 54

  
68
			// Copy the bits from instream to outstream
69
			byte[] buf = new byte[1024];
70
			int len;
71
			while ((len = in.read(buf)) > 0) {
72
				out.write(buf, 0, len);
73
			}
74
			in.close();
75
			out.close();
76
		}		 
77
	}
55
    public void copy(File sourceLocation, File targetLocation)
56
        throws IOException {
57
        if (sourceLocation.isDirectory()) {
58
            if (!targetLocation.exists()) {
59
                targetLocation.mkdir();
60
            }
61

  
62
            String[] children = sourceLocation.list();
63
            for (int i = 0; i < children.length; i++) {
64
                copy(new File(sourceLocation, children[i]), new File(
65
                    targetLocation, children[i]));
66
            }
67
        } else {
68
            targetLocation.getParentFile().mkdirs();
69

  
70
            InputStream in = new FileInputStream(sourceLocation);
71
            OutputStream out = new FileOutputStream(targetLocation);
72

  
73
            // Copy the bits from instream to outstream
74
            byte[] buf = new byte[1024];
75
            int len;
76
            while ((len = in.read(buf)) > 0) {
77
                out.write(buf, 0, len);
78
            }
79
            in.close();
80
            out.close();
81
        }
82
    }
78 83
}
79

  
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.main/src/main/java/org/gvsig/installer/main/MainInstallerLibrary.java
1 1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
* 
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
* 
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
* 
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
* MA  02110-1301, USA.
20
* 
21
*/
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22 22

  
23 23
/*
24
* AUTHORS (In addition to CIT):
25
* 2010 {Prodevelop}   {Task}
26
*/
27
 
24
 * AUTHORS (In addition to CIT):
25
 * 2010 {Prodevelop}   {Task}
26
 */
27

  
28 28
package org.gvsig.installer.main;
29 29

  
30 30
import org.gvsig.tools.library.AbstractLibrary;
......
33 33
/**
34 34
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
35 35
 */
36
public class MainInstallerLibrary extends AbstractLibrary{
36
public class MainInstallerLibrary extends AbstractLibrary {
37 37

  
38
	@Override
39
	protected void doInitialize() throws LibraryException {
40
		
41
	}
38
    @Override
39
    protected void doInitialize() throws LibraryException {
42 40

  
43
	@Override
44
	protected void doPostInitialize() throws LibraryException {
45
	
46
	}
47
}
41
    }
42

  
43
    @Override
44
    protected void doPostInitialize() throws LibraryException {
45

  
46
    }
47
}
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.spi/src/main/java/org/gvsig/installer/lib/spi/InstallPackageProviderServices.java
1 1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
* 
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
* 
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
* 
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
* MA  02110-1301, USA.
20
* 
21
*/
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22 22

  
23 23
/*
24
* AUTHORS (In addition to CIT):
25
* 2010 {Prodevelop}   {Task}
26
*/
27
 
24
 * AUTHORS (In addition to CIT):
25
 * 2010 {Prodevelop}   {Task}
26
 */
27

  
28 28
package org.gvsig.installer.lib.spi;
29 29

  
30 30
import java.io.File;
......
39 39
import org.gvsig.tools.service.spi.ProviderServices;
40 40

  
41 41
/**
42
 * Services that can be used by the providers to create or exceute the bundle. It
43
 * contains methods to compress and to decompress files and methods to 
42
 * Services that can be used by the providers to create or exceute the bundle.
43
 * It
44
 * contains methods to compress and to decompress files and methods to
44 45
 * read an install a package file from a directory.
45 46
 * 
46 47
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
47 48
 */
48
public interface InstallPackageProviderServices extends ProviderServices{
49
public interface InstallPackageProviderServices extends ProviderServices {
49 50

  
50
	/**
51
	 * It decompress an input stream and write it on a directory.
52
	 * @param is
53
	 * The input stream to decompress
54
	 * @param outputDirectory.
55
	 * The output directory.
56
	 * @throws InstallPackageServiceException
57
	 * If there is a problem decompressing the stream.
58
	 */
59
	public void decompress(InputStream is, File outputDirectory) throws InstallPackageServiceException;
60
	
61
	/**
62
	 * Compress a directory like an zipped outputstream with a concrete name.
63
	 * @param directory
64
	 * the directory to compress.
65
	 * @param fileName
66
	 * name of the zip entry that has the output file.
67
	 * The name that have to have 
68
	 * @param os
69
	 * output stream to write the output.
70
	 * @throws MakePluginPackageServiceException
71
	 * if there is any problem compressing. 
72
	 */
73
	public void compress(File directory, String fileName, OutputStream os) throws MakePluginPackageServiceException;
74
	
75
	/**
76
	 * Reads the package.info file from a directory a fills the the properties
77
	 * of the {@link PackageInfo} object.
78
	 * @param directory
79
	 * the root directory that contains the installinfo file
80
	 * @param installInfo
81
	 * the installinfo file that has to be filled.
82
	 * @throws InstallerInfoFileException.
83
	 * if there is any problem reading the file
84
	 */
85
	public void readPackageInfo(File directory, PackageInfo installerInfo) throws InstallerInfoFileException;
86
	
87
	/**
88
	 * Reads the package.info file from a bundle fills the the properties
89
	 * of the {@link PackageInfo} objects.
90
	 * @param is
91
	 * the input stream of a bundle.
92
	 * @param packageInfos
93
	 * a list of the information of the packages to install.
94
	 * @param zipEntriesMap
95
	 * a map to retrieve the zipEntry for every package. This information is necessary to
96
	 * select the plugin to decompress.
97
	 * @throws InstallPackageServiceException
98
	 * if there is a problem reading the bundle.
99
	 */
100
	public void readPackageInfo(InputStream is, List<PackageInfo> packageInfos, Map<PackageInfo, String> zipEntriesMap) throws InstallPackageServiceException;
101
	
102
	/**
103
	 * Writes the package.info file in a concrete directory.
104
	 * @param directory
105
	 * the directory.
106
	 * @param packageInfo
107
	 * the information to write.
108
	 * @throws InstallerInfoFileException
109
	 * if there is any problem writing the package.info file. 
110
	 */
111
	public void writePackageInfo(File directory, PackageInfo packageInfo) throws InstallerInfoFileException;
112
	
113
	/**
114
	 * It search a package inside an installer file by the zip name and returns
115
	 * the stream in this position ready to decompres.
116
	 * @param is
117
	 * the input stream of a bundle.
118
	 * @param zipEntry
119
	 * the name of the zip entry.
120
	 * @return
121
	 * the input stream ready to install.
122
	 * @throws InstallPackageServiceException
123
	 * if there is a problem reading the stream 
124
	 */
125
	public InputStream searchPackage(InputStream is, String zipEntry) throws InstallPackageServiceException; 
126
	
127
	/**
128
	 * It reads a compressed file and retrieve the package information.
129
	 * @param is
130
	 * the compressed file
131
	 * @return
132
	 * the information of the package
133
	 * @throws InstallPackageServiceException
134
	 * if there is a problem decompressing the file.
135
	 */
136
	public PackageInfo readCompressedPackageInfo(InputStream is) throws InstallPackageServiceException; 
51
    /**
52
     * It decompress an input stream and write it on a directory.
53
     * 
54
     * @param is
55
     *            The input stream to decompress
56
     * @param outputDirectory
57
     *            .
58
     *            The output directory.
59
     * @throws InstallPackageServiceException
60
     *             If there is a problem decompressing the stream.
61
     */
62
    public void decompress(InputStream is, File outputDirectory)
63
        throws InstallPackageServiceException;
64

  
65
    /**
66
     * Compress a directory like an zipped outputstream with a concrete name.
67
     * 
68
     * @param directory
69
     *            the directory to compress.
70
     * @param fileName
71
     *            name of the zip entry that has the output file.
72
     *            The name that have to have
73
     * @param os
74
     *            output stream to write the output.
75
     * @throws MakePluginPackageServiceException
76
     *             if there is any problem compressing.
77
     */
78
    public void compress(File directory, String fileName, OutputStream os)
79
        throws MakePluginPackageServiceException;
80

  
81
    /**
82
     * Reads the package.info file from a directory a fills the the properties
83
     * of the {@link PackageInfo} object.
84
     * 
85
     * @param directory
86
     *            the root directory that contains the installinfo file
87
     * @param installInfo
88
     *            the installinfo file that has to be filled.
89
     * @throws InstallerInfoFileException.
90
     *         if there is any problem reading the file
91
     */
92
    public void readPackageInfo(File directory, PackageInfo installerInfo)
93
        throws InstallerInfoFileException;
94

  
95
    /**
96
     * Reads the package.info file from a bundle fills the the properties
97
     * of the {@link PackageInfo} objects.
98
     * 
99
     * @param is
100
     *            the input stream of a bundle.
101
     * @param packageInfos
102
     *            a list of the information of the packages to install.
103
     * @param zipEntriesMap
104
     *            a map to retrieve the zipEntry for every package. This
105
     *            information is necessary to
106
     *            select the plugin to decompress.
107
     * @throws InstallPackageServiceException
108
     *             if there is a problem reading the bundle.
109
     */
110
    public void readPackageInfo(InputStream is, List<PackageInfo> packageInfos,
111
        Map<PackageInfo, String> zipEntriesMap)
112
        throws InstallPackageServiceException;
113

  
114
    /**
115
     * Writes the package.info file in a concrete directory.
116
     * 
117
     * @param directory
118
     *            the directory.
119
     * @param packageInfo
120
     *            the information to write.
121
     * @throws InstallerInfoFileException
122
     *             if there is any problem writing the package.info file.
123
     */
124
    public void writePackageInfo(File directory, PackageInfo packageInfo)
125
        throws InstallerInfoFileException;
126

  
127
    /**
128
     * It search a package inside an installer file by the zip name and returns
129
     * the stream in this position ready to decompres.
130
     * 
131
     * @param is
132
     *            the input stream of a bundle.
133
     * @param zipEntry
134
     *            the name of the zip entry.
135
     * @return
136
     *         the input stream ready to install.
137
     * @throws InstallPackageServiceException
138
     *             if there is a problem reading the stream
139
     */
140
    public InputStream searchPackage(InputStream is, String zipEntry)
141
        throws InstallPackageServiceException;
142

  
143
    /**
144
     * It reads a compressed file and retrieve the package information.
145
     * 
146
     * @param is
147
     *            the compressed file
148
     * @return
149
     *         the information of the package
150
     * @throws InstallPackageServiceException
151
     *             if there is a problem decompressing the file.
152
     */
153
    public PackageInfo readCompressedPackageInfo(InputStream is)
154
        throws InstallPackageServiceException;
137 155
}
138

  
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.spi/src/main/java/org/gvsig/installer/lib/spi/InstallerProviderManager.java
1 1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
* 
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
* 
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
* 
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
* MA  02110-1301, USA.
20
* 
21
*/
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22 22

  
23 23
/*
24
* AUTHORS (In addition to CIT):
25
* 2010 {Prodevelop}   {Task}
26
*/
27
 
24
 * AUTHORS (In addition to CIT):
25
 * 2010 {Prodevelop}   {Task}
26
 */
27

  
28 28
package org.gvsig.installer.lib.spi;
29 29

  
30 30
import org.gvsig.installer.lib.api.PackageInfo;
......
34 34

  
35 35
/**
36 36
 * <p>
37
 * The installation process install packages in gvSIG. These packages has a type, 
38
 * that can be a plugin, theme, translation, etc. For every type of package
39
 * the installation process needs a provider for installing the
40
 * packages. 
37
 * The installation process install packages in gvSIG. These packages has a
38
 * type, that can be a plugin, theme, translation, etc. For every type of
39
 * package the installation process needs a provider for installing the
40
 * packages.
41 41
 * </p>
42 42
 * <p>
43
 * All the packages to install have to have some install properties defined
44
 * by the {@link PackageInfo} class. This class is just a set of properties 
45
 * and there is a property named <b>type</b> that can be retrieved by the
46
 * {@link PackageInfo#getType()} method that defines the package type.
47
 * This property is used to create a {@link InstallPackageProvider}
48
 * that is used to install the selected package.
43
 * All the packages to install have to have some install properties defined by
44
 * the {@link PackageInfo} class. This class is just a set of properties and
45
 * there is a property named <b>type</b> that can be retrieved by the
46
 * {@link PackageInfo#getType()} method that defines the package type. This
47
 * property is used to create a {@link InstallPackageProvider} that is used to
48
 * install the selected package.
49 49
 * </p>
50 50
 * <p>
51
 * This manager provides the functionality to register and to create 
52
 * a providers for every package.
51
 * This manager provides the functionality to register and to create a providers
52
 * for every package.
53 53
 * </p>
54 54
 * 
55 55
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
56 56
 */
57 57
public interface InstallerProviderManager extends ProviderManager {
58
	
59
	/**
60
	 * Creates a new provider to execute an installer to add a new package in gvSIG. 
61
	 * @param providerName
62
	 * the provider name used on the registration of the provider. This name is the
63
	 * type attribute defined by {@link PackageInfo}.
64
	 * @return
65
	 * a provider that can be used to install a package.
66
	 * @throws ServiceException
67
	 * if the provider doesn't exist or if there is a problem creating the provider.
68
	 */
69
	public InstallPackageProvider createExecutionProvider(String providerName) throws ServiceException;
70
	
71
	/**
72
	 * Creates the services that be used for the providers to execute or
73
	 * create a new bundle.
74
	 * @return
75
	 * the services used to create or execute an bundle.
76
	 */
77
	public InstallPackageProviderServices createInstallerProviderServices();
78
	
58

  
59
    /**
60
     * Creates a new provider to execute an installer to add a new package in
61
     * gvSIG.
62
     * 
63
     * @param providerName
64
     *            the provider name used on the registration of the provider.
65
     *            This name is the
66
     *            type attribute defined by {@link PackageInfo}.
67
     * @return
68
     *         a provider that can be used to install a package.
69
     * @throws ServiceException
70
     *             if the provider doesn't exist or if there is a problem
71
     *             creating the provider.
72
     */
73
    public InstallPackageProvider createExecutionProvider(String providerName)
74
        throws ServiceException;
75

  
76
    /**
77
     * Creates the services that be used for the providers to execute or
78
     * create a new bundle.
79
     * 
80
     * @return
81
     *         the services used to create or execute an bundle.
82
     */
83
    public InstallPackageProviderServices createInstallerProviderServices();
84

  
79 85
}
80

  
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.spi/src/main/java/org/gvsig/installer/lib/spi/execution/InstallPackageProvider.java
1 1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff