Revision 47713

View differences:

tags/org.gvsig.desktop-2.0.443/license.txt
1
gvSIG. Desktop Geographic Information System.
2

  
3
Copyright (C) 2007-2023 gvSIG Association.
4

  
5
This program is free software; you can redistribute it and/or
6
modify it under the terms of the GNU General Public License
7
as published by the Free Software Foundation; either version 3
8
of the License, or (at your option) any later version.
9

  
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
GNU General Public License for more details.
14

  
15
 You should have received a copy of the GNU General Public License 
16
along with this program. If not, see <https://www.gnu.org/licenses/>. 
17

  
18
For any additional information, do not hesitate to contact us
19
at info AT gvsig.com, or visit our website www.gvsig.com.
tags/org.gvsig.desktop-2.0.443/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.main/src/main/java/org/gvsig/installer/main/utils/FrameWizardListener.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
/*
25
 * AUTHORS (In addition to CIT):
26
 * 2010 {Prodevelop}   {Task}
27
 */
28

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

  
31
import javax.swing.JFrame;
32

  
33
import org.gvsig.installer.swing.api.wizard.InstallerWizardActionListener;
34
import org.gvsig.installer.swing.api.wizard.InstallerWizardPanel;
35

  
36
/**
37
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
38
 */
39
public class FrameWizardListener implements InstallerWizardActionListener {
40

  
41
	private JFrame frame = null;
42

  
43
	public FrameWizardListener(JFrame frame) {
44
		super();
45
		this.frame = frame;
46
	}
47

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

  
52
	}
53

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

  
59
}
0 60

  
tags/org.gvsig.desktop-2.0.443/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.main/src/main/java/org/gvsig/installer/main/utils/CreateBoundleFrame.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
/*
25
 * AUTHORS (In addition to CIT):
26
 * 2010 {Prodevelop}   {Task}
27
 */
28

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

  
31
import java.awt.HeadlessException;
32
import java.awt.event.ActionEvent;
33
import java.awt.event.ActionListener;
34
import java.awt.event.WindowEvent;
35
import java.awt.event.WindowListener;
36
import java.io.File;
37
import java.io.FileOutputStream;
38
import java.util.ArrayList;
39
import java.util.List;
40

  
41
import javax.swing.JFrame;
42
import javax.swing.JOptionPane;
43

  
44
import org.gvsig.gui.beans.openfile.FileTextField;
45
import org.gvsig.installer.lib.impl.utils.Compress;
46

  
47
/**
48
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
49
 */
50
public class CreateBoundleFrame extends JFrame implements WindowListener,
51
		ActionListener {
52

  
53
	/**
54
     * 
55
     */
56
	private static final long serialVersionUID = -2128261599641241144L;
57
	private javax.swing.JButton executeButton;
58
	private javax.swing.JLabel inputLabel;
59
	private FileTextField inputText;
60
	private javax.swing.JLabel jLabel2;
61
	private FileTextField outputText;
62

  
63
	public CreateBoundleFrame() throws HeadlessException {
64
		super();
65
		initializeComponents();
66
		this.addWindowListener(this);
67
		executeButton.addActionListener(this);
68
	}
69

  
70
	private void initializeComponents() {
71
		java.awt.GridBagConstraints gridBagConstraints;
72

  
73
		inputLabel = new javax.swing.JLabel();
74
		executeButton = new javax.swing.JButton();
75
		inputText = new FileTextField();
76
		outputText = new FileTextField();
77
		jLabel2 = new javax.swing.JLabel();
78

  
79
		setLayout(new java.awt.GridBagLayout());
80

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

  
89
		executeButton.setText("Execute");
90
		gridBagConstraints = new java.awt.GridBagConstraints();
91
		gridBagConstraints.gridx = 1;
92
		gridBagConstraints.gridy = 2;
93
		gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
94
		gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
95
		add(executeButton, gridBagConstraints);
96

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

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

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

  
125
	}
126

  
127
	public void windowActivated(WindowEvent arg0) {
128
		// TODO Auto-generated method stub
129

  
130
	}
131

  
132
	public void windowClosed(WindowEvent arg0) {
133
		System.exit(0);
134

  
135
	}
136

  
137
	public void windowClosing(WindowEvent arg0) {
138
		// TODO Auto-generated method stub
139

  
140
	}
141

  
142
	public void windowDeactivated(WindowEvent arg0) {
143
		// TODO Auto-generated method stub
144

  
145
	}
146

  
147
	public void windowDeiconified(WindowEvent arg0) {
148
		// TODO Auto-generated method stub
149

  
150
	}
151

  
152
	public void windowIconified(WindowEvent arg0) {
153
		// TODO Auto-generated method stub
154

  
155
	}
156

  
157
	public void windowOpened(WindowEvent arg0) {
158
		// TODO Auto-generated method stub
159

  
160
	}
161

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

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

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

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

  
tags/org.gvsig.desktop-2.0.443/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.main/src/main/java/org/gvsig/installer/main/utils/CreateBundleLauncher.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
/*
25
 * AUTHORS (In addition to CIT):
26
 * 2010 {Prodevelop}   {Task}
27
 */
28

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

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

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

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

  
47
}
0 48

  
tags/org.gvsig.desktop-2.0.443/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.main/src/main/java/org/gvsig/installer/main/execution/InstallPackageWizardFromDefaultDirectoryLauncher.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
/*
25
 * AUTHORS (In addition to CIT):
26
 * 2010 {Prodevelop}   {Task}
27
 */
28

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

  
31
import java.io.IOException;
32

  
33
import org.gvsig.installer.lib.api.execution.InstallPackageServiceException;
34
import org.gvsig.installer.main.DefaultLauncher;
35
import org.gvsig.installer.swing.api.execution.InstallPackageWizardException;
36
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer;
37
import org.gvsig.tools.locator.LocatorException;
38

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

  
45
	public static void main(String[] args) throws LocatorException,
46
			InstallPackageServiceException, InstallPackageWizardException,
47
			IOException {
48
		new DefaultLibrariesInitializer().fullInitialize();
49
		new InstallPackageWizardFromDefaultDirectoryLauncher();
50
	}
51

  
52
	public InstallPackageWizardFromDefaultDirectoryLauncher()
53
			throws LocatorException, InstallPackageWizardException,
54
			InstallPackageServiceException, IOException {
55

  
56
		InstallPackageServiceFrame frame = new InstallPackageServiceFrame(
57
				getApplicationFolder(), getInstallFolder());
58
//		frame.installFromDefaultDirectory();
59
		frame.setVisible(true);
60
	}
61
}
0 62

  
tags/org.gvsig.desktop-2.0.443/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.main/src/main/java/org/gvsig/installer/main/execution/InstallPackageWizardLauncher.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
/*
25
 * AUTHORS (In addition to CIT):
26
 * 2010 {Prodevelop}   {Task}
27
 */
28

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

  
31
import java.io.IOException;
32

  
33
import org.gvsig.installer.lib.api.execution.InstallPackageServiceException;
34
import org.gvsig.installer.main.DefaultLauncher;
35
import org.gvsig.installer.swing.api.execution.InstallPackageWizardException;
36
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer;
37
import org.gvsig.tools.locator.LocatorException;
38

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

  
44
	public static void main(String[] args) throws LocatorException,
45
			InstallPackageServiceException, InstallPackageWizardException,
46
			IOException {
47
		new DefaultLibrariesInitializer().fullInitialize();
48
		new InstallPackageWizardLauncher();
49
	}
50

  
51
	public InstallPackageWizardLauncher() throws LocatorException,
52
			InstallPackageWizardException, InstallPackageServiceException,
53
			IOException {
54

  
55
		InstallPackageServiceFrame frame = new InstallPackageServiceFrame(
56
				getApplicationFolder(), getInstallFolder());
57
		frame.setVisible(true);
58
	}
59
}
0 60

  
tags/org.gvsig.desktop-2.0.443/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.main/src/main/java/org/gvsig/installer/main/execution/InstallPackageServiceFrame.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
/*
25
 * AUTHORS (In addition to CIT):
26
 * 2010 {Prodevelop}   {Task}
27
 */
28

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

  
31
import java.io.File;
32

  
33
import javax.swing.JFrame;
34

  
35
import org.gvsig.installer.lib.api.execution.InstallPackageServiceException;
36
import org.gvsig.installer.main.utils.FrameWizardListener;
37
import org.gvsig.installer.swing.api.SwingInstallerLocator;
38
import org.gvsig.installer.swing.api.execution.InstallPackageWizardException;
39
import org.gvsig.installer.swing.api.execution.InstallWizardPanel;
40
import org.gvsig.tools.locator.LocatorException;
41

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

  
47
	private static final long serialVersionUID = -5107758157530922356L;
48
        private final InstallWizardPanel installerExecutionWizard;
49

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

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

  
68
}
0 69

  
tags/org.gvsig.desktop-2.0.443/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.main/src/main/java/org/gvsig/installer/main/creation/MakePluginPackageWizardLauncher.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
/*
25
 * AUTHORS (In addition to CIT):
26
 * 2010 {Prodevelop}   {Task}
27
 */
28

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

  
31
import java.io.IOException;
32

  
33
import org.gvsig.installer.lib.api.creation.MakePluginPackageServiceException;
34
import org.gvsig.installer.main.DefaultLauncher;
35
import org.gvsig.installer.swing.api.creation.MakePluginPackageWizardException;
36
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer;
37
import org.gvsig.tools.locator.LocatorException;
38

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

  
44
	public static void main(String[] args) throws LocatorException,
45
			MakePluginPackageWizardException, IOException,
46
			MakePluginPackageServiceException {
47
		new DefaultLibrariesInitializer().fullInitialize();
48
		new MakePluginPackageWizardLauncher();
49
	}
50

  
51
	public MakePluginPackageWizardLauncher() throws LocatorException,
52
			MakePluginPackageWizardException, IOException,
53
			MakePluginPackageServiceException {
54

  
55
		MakePluginPackageFrame frame = new MakePluginPackageFrame(
56
				getApplicationFolder(), getInstallFolder());
57
		frame.setVisible(true);
58
	}
59

  
60
}
0 61

  
tags/org.gvsig.desktop-2.0.443/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.main/src/main/java/org/gvsig/installer/main/creation/MakePluginPackageFrame.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
/*
25
 * AUTHORS (In addition to CIT):
26
 * 2010 {Prodevelop}   {Task}
27
 */
28

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

  
31
import java.io.File;
32

  
33
import javax.swing.JFrame;
34

  
35
import org.gvsig.installer.main.utils.FrameWizardListener;
36
import org.gvsig.installer.swing.api.SwingInstallerLocator;
37
import org.gvsig.installer.swing.api.creation.MakePluginPackageWizard;
38
import org.gvsig.installer.swing.api.creation.MakePluginPackageWizardException;
39
import org.gvsig.tools.locator.LocatorException;
40

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

  
46
	private static final long serialVersionUID = 4144834319158286247L;
47
	private MakePluginPackageWizard installerCreationWizard;
48

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

  
62
}
0 63

  
tags/org.gvsig.desktop-2.0.443/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.main/src/main/java/org/gvsig/installer/main/DefaultLauncher.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
/*
25
 * AUTHORS (In addition to CIT):
26
 * 2010 {Prodevelop}   {Task}
27
 */
28

  
29
package org.gvsig.installer.main;
30

  
31
import java.io.File;
32
import java.io.FileInputStream;
33
import java.io.FileOutputStream;
34
import java.io.IOException;
35
import java.io.InputStream;
36
import java.io.OutputStream;
37

  
38
/**
39
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
40
 */
41
public class DefaultLauncher {
42

  
43
	private File appFolder;
44

  
45
	public File getApplicationFolder() throws IOException {
46
		if (appFolder == null) {
47
			File templateFile = new File(getClass().getClassLoader()
48
					.getResource("application").getFile());
49
			appFolder = new File(System.getProperty("java.io.tmpdir")
50
					+ File.separator + "tmp_gvsig_installer");
51

  
52
			copy(templateFile, appFolder);
53
		}
54

  
55
		return appFolder;
56
	}
57

  
58
	public File getPluginsFolder() throws IOException {
59
		return new File(appFolder, "plugins");
60
	}
61

  
62
	public File getInstallFolder() throws IOException {
63
		return new File(appFolder, "install");
64
	}
65

  
66
	public void copy(File sourceLocation, File targetLocation)
67
			throws IOException {
68
		if (sourceLocation.isDirectory()) {
69
			if (!targetLocation.exists()) {
70
				targetLocation.mkdir();
71
			}
72

  
73
			String[] children = sourceLocation.list();
74
			for (int i = 0; i < children.length; i++) {
75
				copy(new File(sourceLocation, children[i]), new File(
76
						targetLocation, children[i]));
77
			}
78
		} else {
79
			targetLocation.getParentFile().mkdirs();
80

  
81
			InputStream in = new FileInputStream(sourceLocation);
82
			OutputStream out = new FileOutputStream(targetLocation);
83

  
84
			// Copy the bits from instream to outstream
85
			byte[] buf = new byte[1024];
86
			int len;
87
			while ((len = in.read(buf)) > 0) {
88
				out.write(buf, 0, len);
89
			}
90
			in.close();
91
			out.close();
92
		}
93
	}
94
}
0 95

  
tags/org.gvsig.desktop-2.0.443/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.main/pom.xml
1
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
2
  <modelVersion>4.0.0</modelVersion>
3
  <artifactId>org.gvsig.installer.main</artifactId>
4
  <packaging>jar</packaging>
5
  <name>org.gvsig.installer.main</name>
6
  <parent>
7
    <groupId>org.gvsig</groupId>
8
    <artifactId>org.gvsig.installer</artifactId>
9
    <version>2.0.443</version>
10
  </parent>
11
  <dependencies>
12
    <dependency>
13
      <groupId>org.gvsig</groupId>
14
      <artifactId>org.gvsig.installer.lib.api</artifactId>
15
      <scope>compile</scope>
16
    </dependency>
17
    <dependency>
18
      <groupId>org.gvsig</groupId>
19
      <artifactId>org.gvsig.installer.lib.spi</artifactId>
20
      <scope>compile</scope>
21
    </dependency>
22
    <dependency>
23
      <groupId>org.gvsig</groupId>
24
      <artifactId>org.gvsig.installer.lib.impl</artifactId>
25
    </dependency>
26
    <dependency>
27
      <groupId>org.gvsig</groupId>
28
      <artifactId>org.gvsig.installer.prov.plugin</artifactId>
29
    </dependency>
30
    <dependency>
31
      <groupId>org.gvsig</groupId>
32
      <artifactId>org.gvsig.installer.swing.api</artifactId>
33
      <scope>compile</scope>
34
    </dependency>
35
    <dependency>
36
        <groupId>org.gvsig</groupId>
37
        <artifactId>org.gvsig.installer.swing.impl</artifactId>
38
    </dependency>
39
    <dependency>
40
        <groupId>org.gvsig</groupId>
41
        <artifactId>org.gvsig.tools.lib</artifactId>
42
        <scope>compile</scope>
43
    </dependency>
44
    <dependency>
45
      <groupId>org.gvsig</groupId>
46
      <artifactId>org.gvsig.ui</artifactId>
47
      <scope>compile</scope>
48
    </dependency>
49
  </dependencies>
50
</project>
0 51

  
tags/org.gvsig.desktop-2.0.443/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/test/resources/package.info2
1
code=org.gvsig.myplugin.app.mainplugin
2
code-alias=org.gvsig.myplugin
3
name=myplugin
4
description=Test
5
version=1.0.0
6
build=1
7
state=RC1
8
official=true
9
type=plugin
tags/org.gvsig.desktop-2.0.443/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/test/resources/bundle1/org.gvsig.plugin2/install.xml
1
<!--
2

  
3
    gvSIG. Desktop Geographic Information System.
4

  
5
    Copyright (C) 2007-2013 gvSIG Association.
6

  
7
    This program is free software; you can redistribute it and/or
8
    modify it under the terms of the GNU General Public License
9
    as published by the Free Software Foundation; either version 3
10
    of the License, or (at your option) any later version.
11

  
12
    This program is distributed in the hope that it will be useful,
13
    but WITHOUT ANY WARRANTY; without even the implied warranty of
14
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
    GNU General Public License for more details.
16

  
17
    You should have received a copy of the GNU General Public License
18
    along with this program; if not, write to the Free Software
19
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20
    MA  02110-1301, USA.
21

  
22
    For any additional information, do not hesitate to contact us
23
    at info AT gvsig.com, or visit our website www.gvsig.com.
24

  
25
-->
26
<project name="org.gvsig.plugin1" default="main" basedir=".">
27
	<target name="main" depends="copy_files"/>
28
    <target name="copy_files">
29
    	<copy todir="${gvsig_dir}">
30
    		<fileset dir="./files" includes="**"/>
31
		</copy>
32
	</target>
33
</project>
0 34

  
tags/org.gvsig.desktop-2.0.443/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/test/resources/application/gvSIG/extensiones/org.gvsig.wfs/install.xml
1
<!--
2

  
3
    gvSIG. Desktop Geographic Information System.
4

  
5
    Copyright (C) 2007-2013 gvSIG Association.
6

  
7
    This program is free software; you can redistribute it and/or
8
    modify it under the terms of the GNU General Public License
9
    as published by the Free Software Foundation; either version 3
10
    of the License, or (at your option) any later version.
11

  
12
    This program is distributed in the hope that it will be useful,
13
    but WITHOUT ANY WARRANTY; without even the implied warranty of
14
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
    GNU General Public License for more details.
16

  
17
    You should have received a copy of the GNU General Public License
18
    along with this program; if not, write to the Free Software
19
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20
    MA  02110-1301, USA.
21

  
22
    For any additional information, do not hesitate to contact us
23
    at info AT gvsig.com, or visit our website www.gvsig.com.
24

  
25
-->
26
<project name="org.gvsig.plugin1" default="main" basedir=".">
27
	<target name="main" depends="copy_files"/>
28
    <target name="copy_files">
29
    	<copy todir="${gvsig_dir}">
30
    		<fileset dir="./files" includes="**"/>
31
		</copy>
32
	</target>
33
</project>
0 34

  
tags/org.gvsig.desktop-2.0.443/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/test/resources/package.info1
1
code=org.gvsig.myplugin
2
name=myplugin
3
description=Test
4
version=1.0.0
5
build=1
6
state=RC1
7
official=true
8
type=plugin
tags/org.gvsig.desktop-2.0.443/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/test/java/org/gvsig/installer/lib/impl/execution/InstallPackageServiceTest.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
/*
25
 * AUTHORS (In addition to CIT):
26
 * 2010 {Prodevelop}   {Task}
27
 */
28

  
29
package org.gvsig.installer.lib.impl.execution;
30

  
31
import java.io.File;
32
import java.io.IOException;
33

  
34
import junit.framework.Assert;
35

  
36
import org.gvsig.installer.lib.api.InstallerLocator;
37
import org.gvsig.installer.lib.api.PackageInfo;
38
import org.gvsig.installer.lib.api.creation.MakePluginPackageService;
39
import org.gvsig.installer.lib.api.creation.MakePluginPackageServiceException;
40
import org.gvsig.installer.lib.api.execution.InstallPackageService;
41
import org.gvsig.installer.lib.api.execution.InstallPackageServiceException;
42
import org.gvsig.installer.lib.impl.InstallerServiceTest;
43
import org.gvsig.tools.locator.LocatorException;
44

  
45
/**
46
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
47
 */
48
public class InstallPackageServiceTest extends InstallerServiceTest {
49

  
50
	@Override
51
	protected void doSetUp() throws Exception {
52
		// TODO Auto-generated method stub
53

  
54
	}
55

  
56
	public void testReadPlugins() throws LocatorException,
57
			MakePluginPackageServiceException, InstallPackageServiceException,
58
			IOException {
59
		File installersDirectory = super.getInstallersDirectory();
60

  
61
		InstallPackageService installPackageService = InstallerLocator
62
				.getInstallerManager().getInstallPackageService();
63
		installPackageService.addBundlesFromDirectory(installersDirectory, null);
64

  
65
		Assert.assertEquals(3, installPackageService.getPackageCount());
66

  
67
		int pluginsNumber = 0;
68
		for (int i = 0; i < 3; i++) {
69
			PackageInfo packageInfo = installPackageService.getPackageInfo(i);
70
			if (packageInfo.getCode().equals("org.gvsig.plugin1")) {
71
				assertNotNull(packageInfo.getState());
72
				pluginsNumber++;
73
			} else if (packageInfo.getCode().equals("org.gvsig.plugin2")) {
74
				assertEquals("RC1", packageInfo.getState());
75
				pluginsNumber++;
76
			} else if (packageInfo.getCode().equals("org.gvsig.plugin3")) {
77
				assertEquals("Testing", packageInfo.getState());
78
				pluginsNumber++;
79
			}
80
		}
81

  
82
		Assert.assertEquals(3, pluginsNumber);
83
	}
84

  
85
	public void testInstallPluginFromApplication()
86
			throws InstallPackageServiceException, IOException,
87
			LocatorException, MakePluginPackageServiceException {
88
		File installersDirectory = super.getInstallersDirectory();
89
		File applicationDirectory = super.getApplicationDirectory();
90

  
91
		InstallPackageService installerExecutionService = InstallerLocator
92
				.getInstallerManager().getInstallPackageService();
93
		installerExecutionService.addBundlesFromDirectory(installersDirectory, null);
94

  
95
		PackageInfo packageInfo = installerExecutionService
96
				.getPackageInfo("org.gvsig.plugin1");
97
		installerExecutionService.installPackage(applicationDirectory,
98
				packageInfo);
99

  
100
		Assert.assertEquals(3, installerExecutionService.getPackageCount());
101

  
102
		// Reading the excution and check that the file is installed
103
		MakePluginPackageService installerCreationService = InstallerLocator
104
				.getInstallerManager().getMakePluginPackageService();
105
		Assert
106
				.assertEquals(4, installerCreationService
107
						.getPluginPackageCount());
108
	}
109

  
110
	public void testInstallPluginFromExternal()
111
			throws InstallPackageServiceException, IOException,
112
			LocatorException, MakePluginPackageServiceException {
113
		File applicationDirectory = super.getApplicationDirectory();
114
		File externalInstallationFile = new File(applicationDirectory
115
				.getAbsoluteFile()
116
				+ File.separator + "install" + File.separator + "bundle1.zip");
117

  
118
		InstallPackageService installerExecutionService = InstallerLocator
119
				.getInstallerManager().getInstallPackageService();
120
		installerExecutionService.addBundle(externalInstallationFile, null);
121

  
122
		PackageInfo packageInfo = installerExecutionService
123
				.getPackageInfo("org.gvsig.plugin1");
124

  
125
		Assert.assertEquals(3, installerExecutionService.getPackageCount());
126

  
127
		installerExecutionService.installPackage(applicationDirectory,
128
				packageInfo);
129

  
130
		// Reading the excution and check that the file is installed
131
		MakePluginPackageService installerCreationService = InstallerLocator
132
				.getInstallerManager().getMakePluginPackageService();
133
		Assert
134
				.assertEquals(4, installerCreationService
135
						.getPluginPackageCount());
136
	}
137

  
138
	// public void testInstallPluginWithAntScript() throws
139
	// InstallPackageServiceException, LocatorException,
140
	// MakePluginPackageServiceException, IOException{
141
	// File applicationDirectory = super.getApplicationDirectory();
142
	// File installersDirectory = super.getInstallersDirectory();
143
	// File pluginsDirectory = super.getPluginsDirectory();
144
	//
145
	// InstallPackageService installerExecutionService =
146
	// InstallerLocator.getInstallerManager().getInstallPackageService();
147
	// installerExecutionService.addBundlesFromDirectory(installersDirectory);
148
	//
149
	// PackageInfo packageInfo =
150
	// installerExecutionService.getPackageInfo("org.gvsig.plugin2");
151
	//
152
	// Assert.assertEquals(3, installerExecutionService.getPackageCount());
153
	//
154
	// installerExecutionService.installPackage(applicationDirectory,
155
	// packageInfo);
156
	//
157
	// //Reading the excution and check that the file is installed
158
	// MakePluginPackageService installerCreationService =
159
	// InstallerLocator.getInstallerManager().getMakePluginPackageService(pluginsDirectory);
160
	//
161
	// Assert.assertEquals(5, installerCreationService.getPluginPackageCount());
162
	// }
163

  
164
}
0 165

  
tags/org.gvsig.desktop-2.0.443/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/test/java/org/gvsig/installer/lib/impl/execution/DependencyCalculatorTest.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.installer.lib.impl.execution;
25

  
26
import java.util.ArrayList;
27
import java.util.LinkedHashMap;
28
import java.util.List;
29
import java.util.Map;
30

  
31
import junit.framework.TestCase;
32

  
33
import org.gvsig.installer.lib.api.PackageInfo;
34
import org.gvsig.installer.lib.api.Version;
35
import org.gvsig.installer.lib.impl.DefaultDependenciesCalculator;
36
import org.gvsig.installer.lib.impl.DefaultPackageInfo;
37
import org.gvsig.installer.lib.impl.DefaultVersion;
38

  
39
public class DependencyCalculatorTest extends TestCase {
40

  
41
	private MyInstallPackageService getInstallService() {
42
		MyInstallPackageService serv = new MyInstallPackageService();
43
		serv.addPackage("p1", "1.0.0", null);
44
		serv.addPackage("p1", "2.0.0", null);
45
		serv.addPackage("p1", "3.0.0", null);
46
		serv.addPackage("p2", "3.0.0", null);
47
		serv.addPackage("p2", "5.0.0", null);
48
		serv.addPackage("p2", "9.0.0", null);
49
		serv.addPackage("p3", "1.0.0", null);
50
		serv.addPackage("p4", "1.0.0", null);
51
		serv.addPackage("p5", "1.0.0", "required: p2 -ge 5.0.0");
52
		serv.addPackage("p6", "1.0.0", "required: p1 >= 1.0.0");
53
		serv.addPackage("p7", "1.0.0", "required: p1 -ge 2.0.0");
54
		serv.addPackage("p8", "1.0.0", "required: p2 >= 1, required: p6 -ge 1");
55
		serv.addPackage("p9", "1.0.0",
56
				"required: p8 >= 1.0.0, required: p7 >= 1.0.0");
57
		return serv;
58
	}
59

  
60
	public void testCalculate() {
61
		MyInstallPackageService installService = this.getInstallService();
62
		DefaultDependenciesCalculator calculator = new DefaultDependenciesCalculator(
63
				installService);
64

  
65
		calculator.addInstalledPackage(installService.getPackageInfo("p1",
66
				"1.0.0"));
67
		calculator.addInstalledPackage(installService.getPackageInfo("p2",
68
				"3.0.0"));
69
		calculator.addInstalledPackage(installService.getPackageInfo("p5",
70
				"1.0.0"));
71

  
72
		calculator.addPackageToInstall(installService.getPackageInfo("p7",
73
				"1.0.0"));
74
		calculator.addPackageToInstall(installService.getPackageInfo("p9",
75
				"1.0.0"));
76

  
77
		calculator.calculate();
78

  
79
		List<PackageInfo> requireds = calculator.getRequiredPackages();
80

  
81
		/*
82
		 * required packages plugin p1 3.0.0-0 devel all all j1_5 null plugin p2
83
		 * 9.0.0-0 devel all all j1_5 null plugin p6 1.0.0-0 devel all all j1_5
84
		 * required: p1 >= 1.0.0-0 plugin p8 1.0.0-0 devel all all j1_5
85
		 * required: p2 >= 1.0.0-0, required: p6 -ge 1.0.0-0
86
		 */
87
		PackageInfo pkg;
88
		assertEquals(4, requireds.size());
89
		pkg = requireds.get(0);
90
		assertEquals("p1", pkg.getCode());
91
		assertEquals("3.0.0-0", pkg.getVersion().toString());
92
		pkg = requireds.get(1);
93
		assertEquals("p2", pkg.getCode());
94
		assertEquals("9.0.0-0", pkg.getVersion().toString());
95
		pkg = requireds.get(2);
96
		assertEquals("p6", pkg.getCode());
97
		assertEquals("1.0.0-0", pkg.getVersion().toString());
98
		pkg = requireds.get(3);
99
		assertEquals("p8", pkg.getCode());
100
		assertEquals("1.0.0-0", pkg.getVersion().toString());
101
	}
102

  
103
	private class MyInstallPackageService extends InstallPackageServiceDumb {
104

  
105
		Map<String, PackageInfo> packages = new LinkedHashMap<String, PackageInfo>();
106
		List<PackageInfo> pacakgesList = null;
107

  
108
		MyInstallPackageService() {
109

  
110
		}
111

  
112
		public void addPackage(String code, String version, String dependencies) {
113
			DefaultPackageInfo pkg = new DefaultPackageInfo();
114
			pkg.setCode(code);
115
			pkg.setType("plugin");
116
			pkg.setVersion(new DefaultVersion().parse(version));
117
			pkg.setDependencies(dependencies);
118
			pkg.setName(code + " (name)");
119
			pkg.setDescription(code + " (description)");
120

  
121
			packages.put(pkg.getCode() + "-" + pkg.getVersion().fullFormat(),
122
					pkg);
123
		}
124

  
125
		public PackageInfo getPackageInfo(String code, String version) {
126
			Version ver = new DefaultVersion().parse(version);
127
			return packages.get(code + "-" + ver.fullFormat());
128
		}
129

  
130
		@Override
131
		public int getPackageCount() {
132
			if (pacakgesList == null) {
133
				pacakgesList = new ArrayList<PackageInfo>();
134
				pacakgesList.addAll(packages.values());
135
			}
136
			return pacakgesList.size();
137
		}
138

  
139
		@Override
140
		public PackageInfo getPackageInfo(int index) {
141
			if (pacakgesList == null) {
142
				pacakgesList = new ArrayList<PackageInfo>();
143
				pacakgesList.addAll(packages.values());
144
			}
145
			return pacakgesList.get(index);
146
		}
147
	}
148

  
149
}
0 150

  
tags/org.gvsig.desktop-2.0.443/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/test/java/org/gvsig/installer/lib/impl/execution/InstallPackageServiceDumb.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.installer.lib.impl.execution;
25

  
26
import java.io.File;
27
import java.net.URL;
28
import java.util.List;
29
import java.util.Properties;
30

  
31
import org.gvsig.installer.lib.api.PackageInfo;
32
import org.gvsig.installer.lib.api.execution.InstallPackageService;
33
import org.gvsig.installer.lib.api.execution.InstallPackageServiceException;
34
import org.gvsig.tools.service.Manager;
35
import org.gvsig.tools.task.SimpleTaskStatus;
36

  
37
public class InstallPackageServiceDumb implements InstallPackageService {
38

  
39
        @Override
40
	public Manager getManager() {
41
		return null;
42
	}
43

  
44
        @Override
45
	public void reset() {
46
	}
47

  
48
        @Override
49
	public void addBundle(File bundleFile, SimpleTaskStatus taskStatus)
50
			throws InstallPackageServiceException {
51
	}
52

  
53
        @Override
54
	public void addBundle(URL bundleURL, SimpleTaskStatus taskStatus) throws InstallPackageServiceException {
55
	}
56

  
57
        @Override
58
	public void addBundlesFromDirectory(File bundlesDirectory, SimpleTaskStatus taskStatus)
59
			throws InstallPackageServiceException {
60
	}
61

  
62
        @Override
63
	public void installPackage(File applicationDirectory,
64
			PackageInfo packageInfo) throws InstallPackageServiceException {
65
	}
66

  
67
        @Override
68
	public void installPackage(File applicationDirectory, String packageCode)
69
			throws InstallPackageServiceException {
70
	}
71

  
72
        @Override
73
	public int getPackageCount() {
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff