Revision 43614

View differences:

tags/org.gvsig.desktop-2.0.211/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.211/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.211/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.211/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.211/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.211/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.211/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.211/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.211/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.211/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.211</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.211/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.spi/src/main/java/org/gvsig/installer/lib/spi/InstallerProviderLocator.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.spi;
30

  
31
import org.gvsig.tools.locator.BaseLocator;
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
37
 * {@link InstallerProviderManager}
38
 * 
39
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
40
 */
41
public class InstallerProviderLocator extends BaseLocator {
42

  
43
	private static final String LOCATOR_NAME = "Installer.provider.locator";
44
	public static final String PROVIDER_MANAGER_NAME = "Installer.provider.manager";
45
	public static final String PROVIDER_MANAGER_DESCRIPTION = "Installer Manager";
46

  
47
	/**
48
	 * Unique instance.
49
	 */
50
	private static final InstallerProviderLocator instance = new InstallerProviderLocator();
51

  
52
	/**
53
	 * Return the singleton instance.
54
	 * 
55
	 * @return the singleton instance
56
	 */
57
	public static InstallerProviderLocator getInstance() {
58
		return instance;
59
	}
60

  
61
	/**
62
	 * Return the Locator's name
63
	 * 
64
	 * @return a String with the Locator's name
65
	 */
66
	@Override
67
	public String getLocatorName() {
68
		return LOCATOR_NAME;
69
	}
70

  
71
	/**
72
	 * Return a reference to InstallerProviderManager.
73
	 * 
74
	 * @return a reference to InstallerProviderManager
75
	 * @throws LocatorException
76
	 *             if there is no access to the class or the class cannot be
77
	 *             instantiated
78
	 * @see Locator#get(String)
79
	 */
80
	public static InstallerProviderManager getProviderManager()
81
			throws LocatorException {
82
		return (InstallerProviderManager) getInstance().get(
83
				PROVIDER_MANAGER_NAME);
84
	}
85

  
86
	/**
87
	 * Registers the Class implementing the InstallerProviderManager interface.
88
	 * 
89
	 * @param clazz
90
	 *            implementing the InstallerProviderManager interface
91
	 */
92
	public static void registerInstallerProviderManager(
93
			Class<? extends InstallerProviderManager> clazz) {
94
		getInstance().register(PROVIDER_MANAGER_NAME,
95
				PROVIDER_MANAGER_DESCRIPTION, clazz);
96
	}
97

  
98
}
0 99

  
tags/org.gvsig.desktop-2.0.211/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.spi/src/main/java/org/gvsig/installer/lib/spi/InstallPackageProviderServices.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.spi;
30

  
31
import java.io.File;
32
import java.io.InputStream;
33
import java.io.OutputStream;
34
import java.util.List;
35
import java.util.Map;
36
import java.util.Properties;
37

  
38
import org.gvsig.installer.lib.api.PackageInfo;
39
import org.gvsig.installer.lib.api.creation.MakePluginPackageServiceException;
40
import org.gvsig.installer.lib.api.execution.InstallPackageServiceException;
41
import org.gvsig.tools.service.spi.ProviderServices;
42
import org.gvsig.tools.task.SimpleTaskStatus;
43

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

  
53
	/**
54
	 * It decompress an input stream and write it on a directory.
55
	 * 
56
	 * @param is
57
	 *            The input stream to decompress
58
	 * @param outputDirectory
59
	 *            . The output directory.
60
	 * @throws InstallPackageServiceException
61
	 *             If there is a problem decompressing the stream.
62
	 */
63
	public void decompress(InputStream is, File outputDirectory)
64
			throws InstallPackageServiceException;
65

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

  
83
	/**
84
	 * Compress a plugin folder using the plugin's name as a package.
85
	 * 
86
	 * @param folder
87
	 *            the directory to compress.
88
	 * @param os
89
	 *            output stream to write the output.
90
	 * @throws MakePluginPackageServiceException
91
	 *             if there is any problem compressing.
92
	 */
93
	public void compressPackage(File folder, OutputStream os)
94
			throws MakePluginPackageServiceException;
95

  
96
	/**
97
	 * Compress a plugin folder using the plugin's name as a package, only with
98
	 * the files needed by the package index.
99
	 * 
100
	 * @param folder
101
	 *            the directory to compress.
102
	 * @param os
103
	 *            output stream to write the output.
104
	 * @throws MakePluginPackageServiceException
105
	 *             if there is any problem compressing.
106
	 */
107
	public void compressPackageIndex(File folder, OutputStream os)
108
			throws MakePluginPackageServiceException;
109

  
110
	/**
111
	 * Reads the package.info file from a directory a fills the the properties
112
	 * of the {@link PackageInfo} object.
113
	 * 
114
	 * @param directory
115
	 *            the root directory that contains the installinfo file
116
	 * @param installInfo
117
	 *            the installinfo file that has to be filled.
118
	 * @throws InstallerInfoFileException. if there is any problem reading the
119
	 *         file
120
	 */
121
	public void readPackageInfo(File directory, PackageInfo installerInfo)
122
			throws InstallerInfoFileException;
123

  
124
	/**
125
	 * Reads the package.info file from a package set and fills the the
126
	 * properties of the {@link PackageInfo} objects.
127
	 * 
128
	 * @param is
129
	 *            the input stream of a bundle.
130
	 * @param packageInfos
131
	 *            a list of the information of the packages to install.
132
	 * @param zipEntriesMap
133
	 *            a map to retrieve the zipEntry for every package. This
134
	 *            information is necessary to select the plugin to decompress.
135
	 * @throws InstallPackageServiceException
136
	 *             if there is a problem reading the bundle.
137
	 */
138
	public void readPackageSetInfo(InputStream is,
139
			List<PackageInfo> packageInfos,
140
			Map<PackageInfo, String> zipEntriesMap, SimpleTaskStatus taskStatus)
141
			throws InstallPackageServiceException;
142

  
143
	/**
144
	 * Reads the package.info file from a bundle fills the the properties of the
145
	 * {@link PackageInfo} objects.
146
	 * 
147
	 * @param is
148
	 *            the input stream of a bundle.
149
	 * @param packageInfos
150
	 *            a list of the information of the packages to install.
151
	 * @param zipEntriesMap
152
	 *            a map to retrieve the zipEntry for every package. This
153
	 *            information is necessary to select the plugin to decompress.
154
	 * @throws InstallPackageServiceException
155
	 *             if there is a problem reading the bundle.
156
	 */
157
	public void readPackageInfo(InputStream is, List<PackageInfo> packageInfos,
158
			Map<PackageInfo, String> zipEntriesMap, String name, SimpleTaskStatus taskStatus)
159
			throws InstallPackageServiceException;
160

  
161
	/**
162
	 * Writes the package.info file in a concrete directory.
163
	 * 
164
	 * @param directory
165
	 *            the directory.
166
	 * @param packageInfo
167
	 *            the information to write.
168
	 * @throws InstallerInfoFileException
169
	 *             if there is any problem writing the package.info file.
170
	 */
171
	public void writePackageInfo(File directory, PackageInfo packageInfo)
172
			throws InstallerInfoFileException;
173

  
174
	/**
175
	 * Writes the package.info file in a concrete directory to be used in a
176
	 * package index.
177
	 * 
178
	 * @param directory
179
	 *            the directory.
180
	 * @param packageInfo
181
	 *            the information to write.
182
	 * @throws InstallerInfoFileException
183
	 *             if there is any problem writing the package.info file.
184
	 */
185
	public void writePackageInfoForIndex(File directory, PackageInfo packageInfo)
186
			throws InstallerInfoFileException;
187

  
188
	/**
189
	 * It search a package inside an installer file by the zip name and returns
190
	 * the stream in this position ready to decompres.
191
	 * 
192
	 * @param is
193
	 *            the input stream of a bundle.
194
	 * @param zipEntry
195
	 *            the name of the zip entry.
196
	 * @return the input stream ready to install.
197
	 * @throws InstallPackageServiceException
198
	 *             if there is a problem reading the stream
199
	 */
200
	public InputStream searchPackage(InputStream is, String zipEntry)
201
			throws InstallPackageServiceException;
202

  
203
	/**
204
	 * It reads a compressed file and retrieve the package information.
205
	 * 
206
	 * @param is
207
	 *            the compressed file
208
	 * @return the information of the package
209
	 * @throws InstallPackageServiceException
210
	 *             if there is a problem decompressing the file.
211
	 */
212
	public PackageInfo readCompressedPackageInfo(InputStream is)
213
			throws InstallPackageServiceException;
214

  
215
	public List<String> getDefaultSelectedPackagesIDs();
216

  
217
        public Properties getProperties();
218
}
0 219

  
tags/org.gvsig.desktop-2.0.211/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.spi/src/main/java/org/gvsig/installer/lib/spi/InstallerProviderManager.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.spi;
30

  
31
import org.gvsig.installer.lib.api.PackageInfo;
32
import org.gvsig.installer.lib.spi.execution.InstallPackageProvider;
33
import org.gvsig.tools.service.ServiceException;
34
import org.gvsig.tools.service.spi.ProviderManager;
35
import org.gvsig.tools.service.spi.ProviderManager_WithGetFactories;
36

  
37
/**
38
 * <p>
39
 * The installation process install packages in gvSIG. These packages has a
40
 * type, that can be a plugin, theme, translation, etc. For every type of
41
 * package the installation process needs a provider for installing the
42
 * packages.
43
 * </p>
44
 * <p>
45
 * All the packages to install have to have some install properties defined by
46
 * the {@link PackageInfo} class. This class is just a set of properties and
47
 * there is a property named <b>type</b> that can be retrieved by the
48
 * {@link PackageInfo#getType()} method that defines the package type. This
49
 * property is used to create a {@link InstallPackageProvider} that is used to
50
 * install the selected package.
51
 * </p>
52
 * <p>
53
 * This manager provides the functionality to register and to create a providers
54
 * for every package.
55
 * </p>
56
 * 
57
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
58
 */
59
public interface InstallerProviderManager extends ProviderManager, ProviderManager_WithGetFactories {
60

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

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

  
85
	/**
86
	 * Returns the name to use for the package info file.
87
	 * 
88
	 * @return the name of the package info file
89
	 */
90
	public String getPackageInfoFileName();
91
}
0 92

  
tags/org.gvsig.desktop-2.0.211/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.spi/src/main/java/org/gvsig/installer/lib/spi/execution/InstallPackageProvider.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.spi.execution;
30

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

  
35
import org.gvsig.installer.lib.api.PackageInfo;
36
import org.gvsig.installer.lib.api.execution.InstallPackageServiceException;
37

  
38
/**
39
 * <p>
40
 * Provider that manage the installation process of a concrete package. There is
41
 * a different provider for each package type that is supported. The provider
42
 * just have a method to install the package in gvSIG
43
 * </p>
44
 * 
45
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
46
 */
47
public interface InstallPackageProvider {
48

  
49
	/**
50
	 * This method install a package in a valid gvSIG directory.
51
	 * 
52
	 * @param applicationDirectory
53
	 *            the directory where gvSIG is located.
54
	 * @param inputStream
55
	 *            the stream that contains the package information.
56
	 * @param taskStatus
57
	 * @throws InstallPackageServiceException
58
	 *             if there is a problem reading the stream or installing the
59
	 *             package.
60
	 */
61
	public void install(File applicationDirectory, InputStream inputStream,
62
			PackageInfo packageInfo) throws InstallPackageServiceException;
63

  
64
	public void installLater(File applicationDirectory,
65
			InputStream inputStream, PackageInfo packageInfo)
66
			throws InstallPackageServiceException, IOException;
67

  
68
}
0 69

  
tags/org.gvsig.desktop-2.0.211/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.spi/src/main/java/org/gvsig/installer/lib/spi/InstallerInfoFileException.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.spi;
30

  
31
import org.gvsig.installer.lib.api.creation.MakePluginPackageServiceException;
32
import org.gvsig.tools.exception.BaseException;
33

  
34
/**
35
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
36
 */
37
public class InstallerInfoFileException extends
38
		MakePluginPackageServiceException {
39

  
40
	private static final long serialVersionUID = -5388898489108649788L;
41

  
42
	private static final String KEY = "install_infofile_exception";
43

  
44
	/**
45
	 * @see BaseException#BaseException(String, String, long)
46
	 */
47
	public InstallerInfoFileException(String message) {
48
		super(message, KEY, serialVersionUID);
49
	}
50

  
51
	/**
52
	 * @see BaseException#BaseException(String, Throwable)
53
	 */
54
	public InstallerInfoFileException(String message, Throwable cause) {
55
		super(message, cause, KEY, serialVersionUID);
56
	}
57

  
58
	/**
59
	 * @see BaseException#BaseException(String, String, long)
60
	 */
61
	public InstallerInfoFileException(String message, String key, long code) {
62
		super(message, key, code);
63
	}
64

  
65
}
0 66

  
tags/org.gvsig.desktop-2.0.211/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.spi/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.lib.spi</artifactId>
4
  <packaging>jar</packaging>
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff