Revision 41404
tags/org.gvsig.desktop-2.0.37/org.gvsig.desktop.library/org.gvsig.installer/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 |
<modelVersion>4.0.0</modelVersion> |
|
4 |
<artifactId>org.gvsig.installer</artifactId> |
|
5 |
<packaging>pom</packaging> |
|
6 |
<description>Project to create installers or install packages in gvSIG</description> |
|
7 |
<name>${project.artifactId}</name> |
|
8 |
<parent> |
|
9 |
<groupId>org.gvsig</groupId> |
|
10 |
<artifactId>org.gvsig.desktop.library</artifactId> |
|
11 |
<version>2.0.37</version> |
|
12 |
</parent> |
|
13 |
|
|
14 |
<modules> |
|
15 |
<module>org.gvsig.installer.lib</module> |
|
16 |
<module>org.gvsig.installer.prov</module> |
|
17 |
<module>org.gvsig.installer.swing</module> |
|
18 |
<module>org.gvsig.installer.main</module> |
|
19 |
<module>org.gvsig.installer.maven</module> |
|
20 |
</modules> |
|
21 |
</project> |
|
0 | 22 |
tags/org.gvsig.desktop-2.0.37/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.37</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.37/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á</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.37/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á</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.37/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á</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.37/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á</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.37/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á</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.37/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á</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.37/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á</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.37/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á</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.37/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á</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.37/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.installer.lib.impl.DefaultInstallerLibrary |
tags/org.gvsig.desktop-2.0.37/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/main/resources/org/gvsig/installer/lib/impl/creation/install.xml | ||
---|---|---|
1 |
<!-- |
|
2 |
|
|
3 |
gvSIG. Desktop Geographic Information System. |
|
4 |
|
|
5 |
Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
|
|
7 |
This program is free software; you can redistribute it and/or |
|
8 |
modify it under the terms of the GNU General Public License |
|
9 |
as published by the Free Software Foundation; either version 3 |
|
10 |
of the License, or (at your option) any later version. |
|
11 |
|
|
12 |
This program is distributed in the hope that it will be useful, |
|
13 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
GNU General Public License for more details. |
|
16 |
|
|
17 |
You should have received a copy of the GNU General Public License |
|
18 |
along with this program; if not, write to the Free Software |
|
19 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
MA 02110-1301, USA. |
|
21 |
|
|
22 |
For any additional information, do not hesitate to contact us |
|
23 |
at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
|
|
25 |
--> |
|
26 |
<project name="org.gvsig.plugin1" default="main" basedir="."> |
|
27 |
<!-- |
|
28 |
Predefined properties: |
|
29 |
gvsig_dir = gvSIG application root installation directory |
|
30 |
extensions_dir = gvSIG extensions directory |
|
31 |
--> |
|
32 |
<taskdef resource="net/sf/antcontrib/antlib.xml"> |
|
33 |
<classpath> |
|
34 |
<pathelement location="${gvsig_dir}/lib/ant-contrib-1.0b3.jar" /> |
|
35 |
</classpath> |
|
36 |
</taskdef> |
|
37 |
<target name="main" depends="copy_files"/> |
|
38 |
<target name="copy_files"> |
|
39 |
<copy todir="${gvsig_dir}"> |
|
40 |
<fileset dir="./files" includes="**"/> |
|
41 |
</copy> |
|
42 |
</target> |
|
43 |
</project> |
|
0 | 44 |
tags/org.gvsig.desktop-2.0.37/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/main/java/org/gvsig/installer/lib/impl/DefaultVersion.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.installer.lib.impl; |
|
25 |
|
|
26 |
import java.security.InvalidParameterException; |
|
27 |
import java.text.MessageFormat; |
|
28 |
|
|
29 |
import org.gvsig.installer.lib.api.Version; |
|
30 |
|
|
31 |
public class DefaultVersion implements Version { |
|
32 |
|
|
33 |
private int mayor = 0; |
|
34 |
private int minor = 0; |
|
35 |
private int rev = 0; |
|
36 |
private String classifier = null; |
|
37 |
private int build = 0; |
|
38 |
|
|
39 |
public DefaultVersion() { |
|
40 |
super(); |
|
41 |
} |
|
42 |
|
|
43 |
protected DefaultVersion(int mayor, int minor, int rev, String classifier, |
|
44 |
int build) { |
|
45 |
this(); |
|
46 |
this.mayor = mayor; |
|
47 |
this.minor = minor; |
|
48 |
this.rev = rev; |
|
49 |
this.classifier = classifier; |
|
50 |
this.build = build; |
|
51 |
} |
|
52 |
|
|
53 |
public Version parse(String version) { |
|
54 |
// Formato: mayor.minor.rev-classifier-build |
|
55 |
|
|
56 |
String[] x = version.split("[.]"); |
|
57 |
int lx = x.length; |
|
58 |
if (lx == 1) { |
|
59 |
this.mayor = parseIntClassifierAndBuild(x[0], version); |
|
60 |
this.minor = 0; |
|
61 |
this.rev = 0; |
|
62 |
this.classifier = null; |
|
63 |
this.build = 0; |
|
64 |
} else if (lx == 2) { |
|
65 |
this.mayor = Integer.parseInt(x[0]); |
|
66 |
this.minor = parseIntClassifierAndBuild(x[1], version); |
|
67 |
this.rev = 0; |
|
68 |
this.classifier = null; |
|
69 |
this.build = 0; |
|
70 |
} else if (lx == 3) { |
|
71 |
this.mayor = Integer.parseInt(x[0]); |
|
72 |
this.minor = Integer.parseInt(x[1]); |
|
73 |
this.rev = parseIntClassifierAndBuild(x[2], version); |
|
74 |
} else { |
|
75 |
throw new InvalidParameterException(version); |
|
76 |
} |
|
77 |
return this; |
|
78 |
} |
|
79 |
|
|
80 |
private int parseIntClassifierAndBuild(String s, String fullversion) { |
|
81 |
int value; |
|
82 |
|
|
83 |
String[] y = s.split("[-]"); |
|
84 |
int ly = y.length; |
|
85 |
if (ly == 1) { |
|
86 |
value = Integer.parseInt(y[0]); |
|
87 |
this.classifier = null; |
|
88 |
this.build = 0; |
|
89 |
} else if (ly == 2) { |
|
90 |
value = Integer.parseInt(y[0]); |
|
91 |
try { |
|
92 |
this.build = Integer.parseInt(y[1]); |
|
93 |
this.classifier = null; |
|
94 |
} catch (NumberFormatException e) { |
|
95 |
this.build = 0; |
|
96 |
this.classifier = y[1]; |
|
97 |
} |
|
98 |
} else if (ly == 3) { |
|
99 |
value = Integer.parseInt(y[0]); |
|
100 |
this.classifier = y[1]; |
|
101 |
this.build = Integer.parseInt(y[2]); |
|
102 |
} else { |
|
103 |
throw new InvalidParameterException(fullversion); |
|
104 |
} |
|
105 |
return value; |
|
106 |
} |
|
107 |
|
|
108 |
public int getMayor() { |
|
109 |
return this.mayor; |
|
110 |
} |
|
111 |
|
|
112 |
|
|
113 |
public int getMajor() { |
|
114 |
return this.mayor; |
|
115 |
} |
|
116 |
|
|
117 |
public int getMinor() { |
|
118 |
return this.minor; |
|
119 |
} |
|
120 |
|
|
121 |
public int getRevision() { |
|
122 |
return this.rev; |
|
123 |
} |
|
124 |
|
|
125 |
public String getClassifier() { |
|
126 |
return this.classifier; |
|
127 |
} |
|
128 |
|
|
129 |
public int getBuild() { |
|
130 |
return this.build; |
|
131 |
} |
|
132 |
|
|
133 |
public boolean check(String op, Version other) { |
|
134 |
if ("=".equals(op) || "==".equals(op) || "-eq".equals(op)) { |
|
135 |
return this.fullFormat().compareTo(other.fullFormat()) == 0; |
|
136 |
} |
|
137 |
if (">".equals(op) || "-gt".equals(op)) { |
|
138 |
return this.fullFormat().compareTo(other.fullFormat()) > 0; |
|
139 |
} |
|
140 |
if (">=".equals(op) || "-ge".equals(op)) { |
|
141 |
return this.fullFormat().compareTo(other.fullFormat()) >= 0; |
|
142 |
} |
|
143 |
if ("<".equals(op) || "-lt".equals(op)) { |
|
144 |
return this.fullFormat().compareTo(other.fullFormat()) < 0; |
|
145 |
} |
|
146 |
if ("<=".equals(op) || "-le".equals(op)) { |
|
147 |
return this.fullFormat().compareTo(other.fullFormat()) <= 0; |
|
148 |
} |
|
149 |
return false; |
|
150 |
} |
|
151 |
|
|
152 |
@Override |
|
153 |
public String toString() { |
|
154 |
if (this.classifier == null) { |
|
155 |
return MessageFormat.format("{0}.{1}.{2}-{3,number,####}", |
|
156 |
this.mayor, this.minor, this.rev, this.build); |
|
157 |
} else { |
|
158 |
return MessageFormat.format("{0}.{1}.{2}-{3}-{4,number,####}", |
|
159 |
this.mayor, this.minor, this.rev, this.classifier, |
|
160 |
this.build); |
|
161 |
} |
|
162 |
} |
|
163 |
|
|
164 |
public String fullFormat() { |
|
165 |
if (this.classifier == null) { |
|
166 |
// classifier ZZZZ allows compare correctly tow versions |
|
167 |
return MessageFormat |
|
168 |
.format( |
|
169 |
"{0,number,0000}.{1,number,0000}.{2,number,0000}-ZZZZ-{3,number,0000}", |
|
170 |
this.mayor, this.minor, this.rev, this.build); |
|
171 |
} else { |
|
172 |
return MessageFormat |
|
173 |
.format( |
|
174 |
"{0,number,0000}.{1,number,0000}.{2,number,0000}-{3}-{4,number,0000}", |
|
175 |
this.mayor, this.minor, this.rev, this.classifier, |
|
176 |
this.build); |
|
177 |
} |
|
178 |
} |
|
179 |
|
|
180 |
public int compareTo(Object arg0) { |
|
181 |
Version other = (Version)arg0; |
|
182 |
return this.fullFormat().compareTo(other.fullFormat()); |
|
183 |
} |
|
184 |
|
|
185 |
@Override |
|
186 |
public Object clone() throws CloneNotSupportedException { |
|
187 |
return super.clone(); |
|
188 |
} |
|
189 |
|
|
190 |
@Override |
|
191 |
public boolean equals(Object obj) { |
|
192 |
Version other = (Version) obj; |
|
193 |
if (this.mayor != other.getMayor()) { |
|
194 |
return false; |
|
195 |
} |
|
196 |
if (this.minor != other.getMinor()) { |
|
197 |
return false; |
|
198 |
} |
|
199 |
if (this.rev != other.getRevision()) { |
|
200 |
return false; |
|
201 |
} |
|
202 |
if (this.build != other.getBuild()) { |
|
203 |
return false; |
|
204 |
} |
|
205 |
if (this.classifier == null) { |
|
206 |
if (other.getClassifier() == null) { |
|
207 |
return true; |
|
208 |
} else { |
|
209 |
return false; |
|
210 |
} |
|
211 |
} |
|
212 |
if (!this.classifier.equalsIgnoreCase(other.getClassifier())) { |
|
213 |
return false; |
|
214 |
} |
|
215 |
return true; |
|
216 |
} |
|
217 |
|
|
218 |
public int hashCode() { |
|
219 |
return (classifier == null ? 0 : classifier.hashCode()) + |
|
220 |
(mayor<<13) + (minor<<19) + (rev<<25) + build; |
|
221 |
} |
|
222 |
|
|
223 |
public Version setBuild(int build) { |
|
224 |
this.build = build; |
|
225 |
return this; |
|
226 |
} |
|
227 |
|
|
228 |
public String format(String fmt) { |
|
229 |
String s = fmt; |
|
230 |
s = s.replaceAll("%M", String.valueOf(this.mayor)); |
|
231 |
s = s.replaceAll("%m", String.valueOf(this.minor)); |
|
232 |
s = s.replaceAll("%r", String.valueOf(this.rev)); |
|
233 |
s = s.replaceAll("%c", this.classifier); |
|
234 |
s = s.replaceAll("%b", String.valueOf(this.build)); |
|
235 |
return s; |
|
236 |
} |
|
237 |
} |
|
0 | 238 |
tags/org.gvsig.desktop-2.0.37/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/main/java/org/gvsig/installer/lib/impl/DefaultDependencies.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.installer.lib.impl; |
|
25 |
|
|
26 |
import java.util.ArrayList; |
|
27 |
import java.util.Iterator; |
|
28 |
import java.util.List; |
|
29 |
|
|
30 |
import org.gvsig.installer.lib.api.Dependencies; |
|
31 |
import org.gvsig.installer.lib.api.Dependency; |
|
32 |
import org.gvsig.installer.lib.api.Version; |
|
33 |
import org.gvsig.tools.packageutils.StringWithAlias; |
|
34 |
|
|
35 |
public class DefaultDependencies extends ArrayList implements |
|
36 |
Dependencies { |
|
37 |
|
|
38 |
/** |
|
39 |
* |
|
40 |
*/ |
|
41 |
private static final long serialVersionUID = -6743931124069465522L; |
|
42 |
|
|
43 |
private Dependency createDependency() { |
|
44 |
// InstallerManager manager = InstallerLocator.getInstallerManager(); |
|
45 |
// return manager.createDependency(); |
|
46 |
return new DefaultDependency(); |
|
47 |
} |
|
48 |
|
|
49 |
public Dependencies parse(String dependecies) { |
|
50 |
if (dependecies == null) { |
|
51 |
this.clear(); |
|
52 |
return this; |
|
53 |
} |
|
54 |
dependecies = dependecies.trim(); |
|
55 |
if (dependecies.equals("")) { |
|
56 |
this.clear(); |
|
57 |
return this; |
|
58 |
} |
|
59 |
|
|
60 |
String[] x = dependecies.split(","); |
|
61 |
for (int i = 0; i < x.length; i++) { |
|
62 |
this.add(createDependency().parse(x[i])); |
|
63 |
} |
|
64 |
return this; |
|
65 |
} |
|
66 |
|
|
67 |
@Override |
|
68 |
public String toString() { |
|
69 |
StringBuffer s = null; |
|
70 |
Iterator<Dependency> it = this.iterator(); |
|
71 |
while (it.hasNext()) { |
|
72 |
if (s == null) { |
|
73 |
s = new StringBuffer(); |
|
74 |
} else { |
|
75 |
s.append(", "); |
|
76 |
} |
|
77 |
s.append(it.next().toString()); |
|
78 |
} |
|
79 |
if (s == null) { |
|
80 |
return ""; |
|
81 |
} |
|
82 |
return s.toString(); |
|
83 |
} |
|
84 |
|
|
85 |
@Override |
|
86 |
public boolean contains(Object o) { |
|
87 |
if (!(o instanceof Dependency)) { |
|
88 |
return false; |
|
89 |
} |
|
90 |
Iterator<Dependency> it = this.iterator(); |
|
91 |
while (it.hasNext()) { |
|
92 |
Dependency dep = it.next(); |
|
93 |
if (dep.equals(o)) { |
|
94 |
return true; |
|
95 |
} |
|
96 |
} |
|
97 |
return false; |
|
98 |
} |
|
99 |
|
|
100 |
public boolean match(String type, String code, Version version) { |
|
101 |
Iterator<Dependency> it = this.iterator(); |
|
102 |
while (it.hasNext()) { |
|
103 |
Dependency dependency = it.next(); |
|
104 |
if (dependency.match(type, code, version)) { |
|
105 |
return true; |
|
106 |
} |
|
107 |
} |
|
108 |
return false; |
|
109 |
} |
|
110 |
|
|
111 |
public Dependency find(String type, String code, Version version) { |
|
112 |
Iterator<Dependency> it = this.iterator(); |
|
113 |
while (it.hasNext()) { |
|
114 |
Dependency dependency = it.next(); |
|
115 |
if (dependency.match(type, code, version)) { |
|
116 |
return dependency; |
|
117 |
} |
|
118 |
} |
|
119 |
return null; |
|
120 |
} |
|
121 |
|
|
122 |
public List findAll(String type, String code, Version version) { |
|
123 |
|
|
124 |
List<Dependency> resp = null; |
|
125 |
Iterator<Dependency> it = this.iterator(); |
|
126 |
while (it.hasNext()) { |
|
127 |
Dependency dependency = it.next(); |
|
128 |
if (dependency.match(type, code, version)) { |
|
129 |
if (resp == null) { |
|
130 |
resp = new ArrayList<Dependency>(); |
|
131 |
} |
|
132 |
resp.add(dependency); |
|
133 |
} |
|
134 |
} |
|
135 |
return resp; |
|
136 |
} |
|
137 |
|
|
138 |
public boolean match(String type, StringWithAlias code, Version version) { |
|
139 |
Iterator<Dependency> it = this.iterator(); |
|
140 |
while (it.hasNext()) { |
|
141 |
Dependency dependency = it.next(); |
|
142 |
if (dependency.match(type, code, version)) { |
|
143 |
return true; |
|
144 |
} |
|
145 |
} |
|
146 |
return false; |
|
147 |
} |
|
148 |
|
|
149 |
public Dependency find(String type, StringWithAlias code, Version version) { |
|
150 |
Iterator<Dependency> it = this.iterator(); |
|
151 |
while (it.hasNext()) { |
|
152 |
Dependency dependency = it.next(); |
|
153 |
if (dependency.match(type, code, version)) { |
|
154 |
return dependency; |
|
155 |
} |
|
156 |
} |
|
157 |
return null; |
|
158 |
} |
|
159 |
|
|
160 |
public List findAll(String type, StringWithAlias code, Version version) { |
|
161 |
|
|
162 |
List<Dependency> resp = null; |
|
163 |
Iterator<Dependency> it = this.iterator(); |
|
164 |
while (it.hasNext()) { |
|
165 |
Dependency dependency = it.next(); |
|
166 |
if (dependency.match(type, code, version)) { |
|
167 |
if (resp == null) { |
|
168 |
resp = new ArrayList<Dependency>(); |
|
169 |
} |
|
170 |
resp.add(dependency); |
|
171 |
} |
|
172 |
} |
|
173 |
return resp; |
|
174 |
} |
|
175 |
|
|
176 |
|
|
177 |
|
|
178 |
|
|
179 |
} |
|
0 | 180 |
tags/org.gvsig.desktop-2.0.37/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/main/java/org/gvsig/installer/lib/impl/info/InstallerInfoFileReader.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
/* |
|
25 |
* AUTHORS (In addition to CIT): |
|
26 |
* 2010 {Prodevelop} {Task} |
|
27 |
*/ |
|
28 |
|
|
29 |
package org.gvsig.installer.lib.impl.info; |
|
30 |
|
|
31 |
import java.io.File; |
|
32 |
import java.io.FileInputStream; |
|
33 |
import java.io.FileNotFoundException; |
|
34 |
import java.io.IOException; |
|
35 |
import java.io.InputStream; |
|
36 |
import java.net.MalformedURLException; |
|
37 |
import java.net.URL; |
|
38 |
import java.util.Properties; |
|
39 |
|
|
40 |
import org.slf4j.Logger; |
|
41 |
import org.slf4j.LoggerFactory; |
|
42 |
|
|
43 |
import org.gvsig.installer.lib.api.PackageInfo; |
|
44 |
import org.gvsig.installer.lib.api.PackageInfoReader; |
|
45 |
import org.gvsig.installer.lib.spi.InstallerInfoFileException; |
|
46 |
|
|
47 |
/** |
|
48 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
49 |
*/ |
|
50 |
public class InstallerInfoFileReader implements PackageInfoReader { |
|
51 |
|
|
52 |
private static final Logger LOG = LoggerFactory |
|
53 |
.getLogger(InstallerInfoFileReader.class); |
|
54 |
|
|
55 |
/** |
|
56 |
* Reads and parses the install.info file and creates one object that |
|
57 |
* contains the information. |
Also available in: Unified diff