Revision 42435

View differences:

tags/org.gvsig.desktop-2.0.110/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.110/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.110/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.110/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.AbstractInstallPackageWizard;
39
import org.gvsig.installer.swing.api.execution.InstallPackageWizardException;
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 AbstractInstallPackageWizard installerExecutionWizard;
49

  
50
	public InstallPackageServiceFrame(File applicationFolder, File installFolder)
51
			throws LocatorException, InstallPackageWizardException {
52
		super();
53
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
54
		installerExecutionWizard = SwingInstallerLocator
55
				.getSwingInstallerManager().createInstallPackageWizard(
56
						applicationFolder, installFolder);
57
		installerExecutionWizard
58
				.setWizardActionListener(new FrameWizardListener(this));
59
		this.add(installerExecutionWizard);
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.110/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.110/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.110/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);
59
		pack();
60
	}
61

  
62
}
0 63

  
tags/org.gvsig.desktop-2.0.110/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.110/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.110/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.110</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.110/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/pom.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<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/xsd/maven-4.0.0.xsd">
3

  
4
  <modelVersion>4.0.0</modelVersion>
5
  <artifactId>org.gvsig.installer.lib</artifactId>
6
  <packaging>pom</packaging>
7
  <name>org.gvsig.installer.lib</name>
8
  <parent>
9
    <groupId>org.gvsig</groupId>
10
    <artifactId>org.gvsig.installer</artifactId>
11
    <version>2.0.110</version>
12
  </parent>
13
  <modules>
14
    <module>org.gvsig.installer.lib.api</module>
15
    <module>org.gvsig.installer.lib.spi</module>
16
    <module>org.gvsig.installer.lib.impl</module>
17
  </modules>
18
</project>
0 19

  
tags/org.gvsig.desktop-2.0.110/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.api/src/main/java/org/gvsig/installer/lib/api/DependenciesCalculator.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.api;
25

  
26
import java.util.Collection;
27
import java.util.List;
28

  
29
public interface DependenciesCalculator {
30

  
31
	public void addPackageToInstall(PackageInfo packageInfo);
32

  
33
	public void addPackageToInstall(Collection<PackageInfo> packages);
34

  
35
	public void addInstalledPackage(PackageInfo packageInfo);
36

  
37
	public void addInstalledPackage(PackageInfo[] packages);
38

  
39
	public void calculate();
40

  
41
	public List<PackageInfo> getRequiredPackages();
42

  
43
	public List<PackageInfo> getConflictPackages();
44

  
45
	public Dependencies getUnresolvedDependencies();
46

  
47

  
48
}
0 49

  
tags/org.gvsig.desktop-2.0.110/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.api/src/main/java/org/gvsig/installer/lib/api/InstallerLocator.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.api;
30

  
31
import org.gvsig.tools.locator.AbstractLocator;
32
import org.gvsig.tools.locator.Locator;
33
import org.gvsig.tools.locator.LocatorException;
34

  
35
/**
36
 * This Locator provides the entry point for the gvSIG {@link InstallerManager}
37
 * 
38
 * @see {@link Locator}
39
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
40
 */
41
public class InstallerLocator extends AbstractLocator {
42

  
43
	private static final String LOCATOR_NAME = "InstallerLocator";
44
	/**
45
	 * InstallerManager name used by the locator to access the instance
46
	 */
47
	public static final String INSTALLER_MANAGER_NAME = "InstallerManager";
48
	private static final String INSTALLER_MANAGER_DESCRIPTION = "InstallerManager of gvSIG";
49

  
50
	/**
51
	 * Unique instance.
52
	 */
53
	private static final InstallerLocator instance = new InstallerLocator();
54

  
55
	/**
56
	 * @see Locator#getLocatorName()
57
	 */
58
	public String getLocatorName() {
59
		return LOCATOR_NAME;
60
	}
61

  
62
	/**
63
	 * Return a reference to {@link InstallerManager}.
64
	 * 
65
	 * @return a reference to InstallerManager
66
	 * @throws LocatorException
67
	 *             if there is no access to the class or the class cannot be
68
	 *             instantiated
69
	 * @see Locator#get(String)
70
	 */
71
	public static InstallerManager getInstallerManager()
72
			throws LocatorException {
73
		return (InstallerManager) getInstance().get(INSTALLER_MANAGER_NAME);
74
	}
75

  
76
	/**
77
	 * Return the singleton instance.
78
	 * 
79
	 * @return the singleton instance
80
	 */
81
	public static InstallerLocator getInstance() {
82
		return instance;
83
	}
84

  
85
	/**
86
	 * Registers the Class implementing the {@link InstallerManager} interface.
87
	 * 
88
	 * @param clazz
89
	 *            implementing the InstallerManager interface
90
	 */
91
	public static void registerInstallerManager(
92
			Class<? extends InstallerManager> clazz) {
93

  
94
		getInstance().register(INSTALLER_MANAGER_NAME,
95
				INSTALLER_MANAGER_DESCRIPTION, clazz);
96
	}
97
}
0 98

  
tags/org.gvsig.desktop-2.0.110/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.api/src/main/java/org/gvsig/installer/lib/api/InstallerLibrary.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.api;
30

  
31
import org.gvsig.tools.ToolsLibrary;
32
import org.gvsig.tools.library.AbstractLibrary;
33
import org.gvsig.tools.library.LibraryException;
34

  
35
/**
36
 * Library for the installer.
37
 * 
38
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
39
 */
40
public class InstallerLibrary extends AbstractLibrary {
41

  
42
	@Override
43
	public void doRegistration() {
44
		registerAsAPI(InstallerLibrary.class);
45
		this.require(ToolsLibrary.class);
46
	}
47

  
48
	@Override
49
	protected void doInitialize() throws LibraryException {
50
		// Nothing to do
51
	}
52

  
53
	@Override
54
	protected void doPostInitialize() throws LibraryException {
55
		// Nothing to do
56
	}
57

  
58
}
0 59

  
tags/org.gvsig.desktop-2.0.110/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.api/src/main/java/org/gvsig/installer/lib/api/SimpleProgressStatus.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.api;
25

  
26
/**
27
 * @author gvSIG Team
28
 * @version $Id$
29
 * 
30
 */
31
public interface SimpleProgressStatus {
32

  
33
	public int getCompleted();
34

  
35
	public String getLabel();
36

  
37
	public void requestCancel();
38
}
0 39

  
tags/org.gvsig.desktop-2.0.110/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.api/src/main/java/org/gvsig/installer/lib/api/execution/InstallPackageServiceException.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.api.execution;
30

  
31
import org.gvsig.tools.exception.BaseException;
32

  
33
/**
34
 * Base exception for all the exceptions that are thrown by the process of
35
 * installation of a package. The {@link InstallPackageService} throws this
36
 * exception on its methods.
37
 * 
38
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
39
 */
40
public class InstallPackageServiceException extends BaseException {
41

  
42
	private static final String message = "Error installing a package";
43

  
44
	private static final long serialVersionUID = -7645352975209203727L;
45

  
46
	private static final String KEY = "installer_execution_exception";
47

  
48
	/**
49
	 * @see BaseException#BaseException(String, long)
50
	 */
51
	public InstallPackageServiceException() {
52
		super(message, KEY, serialVersionUID);
53
	}
54

  
55
	/**
56
	 * @see BaseException#BaseException(Throwable, String, long)
57
	 */
58
	public InstallPackageServiceException(Throwable cause) {
59
		super(message, cause, KEY, serialVersionUID);
60
	}
61

  
62
	protected InstallPackageServiceException(String message, Throwable cause,
63
			String key, long code) {
64
		super(message, cause, key, code);
65
	}
66

  
67
	protected InstallPackageServiceException(String message, String key,
68
			long code) {
69
		super(message, key, code);
70
	}
71

  
72
}
0 73

  
tags/org.gvsig.desktop-2.0.110/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.api/src/main/java/org/gvsig/installer/lib/api/execution/InstallPackageService.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.api.execution;
30

  
31
import java.io.File;
32
import java.net.URL;
33
import java.util.List;
34

  
35
import org.gvsig.installer.lib.api.InstallerManager;
36
import org.gvsig.installer.lib.api.PackageInfo;
37
import org.gvsig.installer.lib.api.creation.MakePluginPackageService;
38
import org.gvsig.tools.service.Service;
39
import org.gvsig.tools.task.SimpleTaskStatus;
40

  
41
/**
42
 * <p>
43
 * This service is used to read a bundle file and install the packages contained
44
 * in it. It has methods to read the packages contained in a bundle and to
45
 * install one of them.
46
 * </p>
47
 * <p>
48
 * The bundle is a file that has been created using the
49
 * {@link MakePluginPackageService} service. It is possible to create an
50
 * installer manually, but it has to have the structure defined by the
51
 * {@link InstallerManager} class.
52
 * </p>
53
 * 
54
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
55
 */
56
public interface InstallPackageService extends Service {
57

  
58
	public void reset();
59

  
60
	/**
61
	 * Adds a the URI of a bundle that contains some packages to install. A
62
	 * bundle is a compressed zip file with a structure defined in the
63
	 * {@link InstallerManager} class.
64
	 * 
65
	 * @param bundleURI
66
	 *            the URI of a bundle.
67
	 * @throws InstallPackageServiceException
68
	 *             it is thrown if there is an exception reading the URI.
69
	 */
70
	public void addBundle(File bundleFile)
71
			throws InstallPackageServiceException;
72

  
73
	/**
74
	 * Adds a URL of a bundle that contains some packages to install. A bundle
75
	 * is a compressed zip file with a structure defined in the
76
	 * {@link InstallerManager} class.
77
	 * 
78
	 * @param bundleURL
79
	 *            the {@link URL} of a bundle.
80
	 * @throws InstallPackageServiceException
81
	 *             it is thrown if there is an exception reading the {@link URL}
82
	 *             .
83
	 */
84
	public void addBundle(URL bundleURL) throws InstallPackageServiceException;
85

  
86
	/**
87
	 * In reads a directory and reads all the bundles. This method retrieve all
88
	 * the information of the packages located in the bundles and allows to the
89
	 * user to show this information.
90
	 * 
91
	 * @param bundlesDirectory
92
	 *            a directory that contains bundles.
93
	 * @throws InstallPackageServiceException
94
	 *             If there is any problem reading the directory of bundles.
95
	 */
96
	public void addBundlesFromDirectory(File bundlesDirectory)
97
			throws InstallPackageServiceException;
98

  
99
	/**
100
	 * Install a package in a concrete gvSIG installation directory. The
101
	 * selected package has to be contained in one of the bundles that has been
102
	 * previously added using the {@link #addBundle(File)} or the
103
	 * {@link #addBundlesFromDirectory(File)} method.
104
	 * 
105
	 * @param applicationDirectory
106
	 *            a valid root directory where an instance og gvSIG is
107
	 *            installed.
108
	 * @param packageInfo
109
	 *            the package to install.
110
	 * @throws InstallPackageServiceException
111
	 *             If there is an error installing the package.
112
	 */
113
	public void installPackage(File applicationDirectory,
114
			PackageInfo packageInfo) throws InstallPackageServiceException;
115

  
116
	/**
117
	 * Install a package in a concrete gvSIG installation directory. The
118
	 * selected package has to be contained in one of the bundles that has been
119
	 * previously added using the {@link #addBundle(File)} or the
120
	 * {@link #addBundlesFromDirectory(File)} method.
121
	 * 
122
	 * @param applicationDirectory
123
	 *            a valid root directory where an instance og gvSIG is
124
	 *            installed.
125
	 * @param packageCode
126
	 *            the code of the package.
127
	 * @throws InstallPackageServiceException
128
	 *             if there is an error installing the {@link PackageInfo#}
129
	 */
130
	public void installPackage(File applicationDirectory, String packageCode)
131
			throws InstallPackageServiceException;
132

  
133
	/**
134
	 * @return the number of packages that has been loaded form one or more
135
	 *         bundles using the {@link #addBundle(File)} or the
136
	 *         {@link #addBundlesFromDirectory(File)} method.
137
	 */
138
	public int getPackageCount();
139

  
140
	/**
141
	 * Return the package information for a concrete position. All the packages
142
	 * has been loaded form one or more bundles using the
143
	 * {@link #addBundle(File)} or the {@link #addBundlesFromDirectory(File)}
144
	 * method.
145
	 * 
146
	 * @param index
147
	 *            the position of the package.
148
	 * @return the information of a package. returns <code>null</code> if the
149
	 *         package doesn't exist.
150
	 */
151
	public PackageInfo getPackageInfo(int index);
152

  
153
	/**
154
	 * Return the package information for a concrete position. All the packages
155
	 * has been loaded form one or more bundles using the
156
	 * {@link #addBundle(File)} or the {@link #addBundlesFromDirectory(File)}
157
	 * method.
158
	 * 
159
	 * @param packageCode
160
	 *            the code of the package.
161
	 * @return the information of a package. returns <code>null</code> if the
162
	 *         package doesn't exist.
163
	 */
164
	public PackageInfo getPackageInfo(String packageCode);
165

  
166
	/**
167
	 * Download the package and register it in the manager.
168
	 * 
169
	 * @param packageInfo
170
	 */
171
	public void downloadPackage(PackageInfo packageInfo,
172
			SimpleTaskStatus taskStatus) throws InstallPackageServiceException;
173

  
174
	/**
175
     * 
176
     */
177
	// public void resetPackages();
178

  
179
	/**
180
	 * @return
181
	 */
182
	public List<String> getDefaultSelectedPackagesIDs();
183

  
184
	/**
185
	 * Gets the list of all the categories of *all* the packages.
186
	 * 
187
	 * @return a list with the categories of all the packages.
188
	 */
189
	public List<String> getCategories();
190

  
191
	/**
192
	 * Gets the list of different the types of *all* the packages.
193
	 * 
194
	 * @return a list with the types of packages.
195
	 */
196
	public List<String> getTypes();
197
}
0 198

  
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff