Revision 44108
tags/org.gvsig.desktop-2.0.238/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á</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.238/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.238/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.238/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.238/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.asJComponent()); |
|
59 |
pack(); |
|
60 |
} |
|
61 |
|
|
62 |
} |
|
0 | 63 |
tags/org.gvsig.desktop-2.0.238/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.238/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.238/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.238/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.238/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.238</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.238/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/test/java/org/gvsig/installer/lib/impl/info/InstallerInfoFileWriterTest.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.ByteArrayInputStream; |
|
32 |
import java.io.ByteArrayOutputStream; |
|
33 |
|
|
34 |
import org.gvsig.installer.lib.api.PackageInfo; |
|
35 |
import org.gvsig.installer.lib.impl.DefaultPackageInfo; |
|
36 |
import org.gvsig.installer.lib.spi.InstallerInfoFileException; |
|
37 |
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase; |
|
38 |
import org.gvsig.tools.locator.LocatorException; |
|
39 |
|
|
40 |
/** |
|
41 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
42 |
*/ |
|
43 |
public class InstallerInfoFileWriterTest extends |
|
44 |
AbstractLibraryAutoInitTestCase { |
|
45 |
|
|
46 |
@Override |
|
47 |
protected void doSetUp() throws Exception { |
|
48 |
// TODO Auto-generated method stub |
|
49 |
|
|
50 |
} |
|
51 |
|
|
52 |
public void testWriteFile() throws LocatorException, |
|
53 |
InstallerInfoFileException { |
|
54 |
DefaultPackageInfo installerInfo = new DefaultPackageInfo(); |
|
55 |
|
|
56 |
installerInfo.setCode("org.gvsig.myplugin"); |
|
57 |
installerInfo.setName("My name"); |
|
58 |
installerInfo.setDescription("My description"); |
|
59 |
installerInfo.setVersion("1.0.0"); |
|
60 |
installerInfo.setBuild(4); |
|
61 |
installerInfo.setState("final"); |
|
62 |
installerInfo.setOfficial(false); |
|
63 |
installerInfo.setType("plugin"); |
|
64 |
|
|
65 |
ByteArrayOutputStream out = new ByteArrayOutputStream(); |
|
66 |
|
|
67 |
InstallerInfoFileWriter installerInfoFileWriter = new InstallerInfoFileWriter(); |
|
68 |
installerInfoFileWriter.write(installerInfo, out); |
|
69 |
|
|
70 |
PackageInfo installerInfo2 = new DefaultPackageInfo(); |
|
71 |
|
|
72 |
InstallerInfoFileReader installerInfoFileReader = new InstallerInfoFileReader(); |
|
73 |
installerInfoFileReader.read(installerInfo2, new ByteArrayInputStream( |
|
74 |
out.toByteArray())); |
|
75 |
|
|
76 |
assertEquals("org.gvsig.myplugin", installerInfo2.getCode()); |
|
77 |
assertEquals("My name", installerInfo2.getName()); |
|
78 |
assertEquals("My description", installerInfo2.getDescription()); |
|
79 |
assertEquals("1.0.0-4", installerInfo2.getVersion().toString()); |
|
80 |
assertEquals(4, installerInfo2.getBuild()); |
|
81 |
assertEquals("final", installerInfo2.getState()); |
|
82 |
assertEquals(false, installerInfo2.isOfficial()); |
|
83 |
} |
|
84 |
} |
|
0 | 85 |
tags/org.gvsig.desktop-2.0.238/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/test/java/org/gvsig/installer/lib/impl/info/InstallerInfoFileReaderTest.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.FileInputStream; |
|
32 |
import java.io.FileNotFoundException; |
|
33 |
|
|
34 |
import org.gvsig.installer.lib.impl.DefaultPackageInfo; |
|
35 |
import org.gvsig.installer.lib.spi.InstallerInfoFileException; |
|
36 |
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase; |
|
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 InstallerInfoFileReaderTest extends |
|
43 |
AbstractLibraryAutoInitTestCase { |
|
44 |
|
|
45 |
@Override |
|
46 |
protected void doSetUp() throws Exception { |
|
47 |
// TODO Auto-generated method stub |
|
48 |
|
|
49 |
} |
|
50 |
|
|
51 |
public void testReadFile() throws LocatorException, |
|
52 |
InstallerInfoFileException, FileNotFoundException { |
|
53 |
FileInputStream fis = new FileInputStream(getClass().getClassLoader() |
|
54 |
.getResource("package.info1").getFile()); |
|
55 |
|
|
56 |
DefaultPackageInfo installerInfo = new DefaultPackageInfo(); |
|
57 |
|
|
58 |
InstallerInfoFileReader installerInfoFileReader = new InstallerInfoFileReader(); |
|
59 |
installerInfoFileReader.read(installerInfo, fis); |
|
60 |
|
|
61 |
assertEquals(installerInfo.getCode(), "org.gvsig.myplugin"); |
|
62 |
assertEquals(installerInfo.getName(), "myplugin"); |
|
63 |
assertEquals(installerInfo.getDescription(), "Test"); |
|
64 |
assertEquals(installerInfo.getVersion().toString(), "1.0.0-1"); |
|
65 |
assertEquals(installerInfo.getBuild(), 1); |
|
66 |
assertEquals(installerInfo.getState(), "RC1"); |
|
67 |
assertEquals(installerInfo.isOfficial(), true); |
|
68 |
} |
|
69 |
|
|
70 |
public void testCodeAlias() throws LocatorException, |
|
71 |
InstallerInfoFileException, FileNotFoundException { |
|
72 |
FileInputStream fis = new FileInputStream(getClass().getClassLoader() |
|
73 |
.getResource("package.info2").getFile()); |
|
74 |
|
|
75 |
DefaultPackageInfo installerInfo = new DefaultPackageInfo(); |
|
76 |
|
|
77 |
InstallerInfoFileReader installerInfoFileReader = new InstallerInfoFileReader(); |
|
78 |
installerInfoFileReader.read(installerInfo, fis); |
|
79 |
|
|
80 |
assertEquals(installerInfo.hasThisCode("org.gvsig.myplugin"),true); |
|
81 |
assertEquals(installerInfo.hasThisCode("org.gvsig.myplugin.app.mainplugin"),true); |
|
82 |
assertEquals(installerInfo.getName(), "myplugin"); |
|
83 |
assertEquals(installerInfo.getDescription(), "Test"); |
|
84 |
assertEquals(installerInfo.getVersion().toString(), "1.0.0-1"); |
|
85 |
assertEquals(installerInfo.getBuild(), 1); |
|
86 |
assertEquals(installerInfo.getState(), "RC1"); |
|
87 |
assertEquals(installerInfo.isOfficial(), true); |
|
88 |
} |
|
89 |
|
|
90 |
} |
|
0 | 91 |
tags/org.gvsig.desktop-2.0.238/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/test/java/org/gvsig/installer/lib/impl/DependencyTest.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 junit.framework.TestCase; |
|
27 |
|
|
28 |
import org.gvsig.installer.lib.api.Dependency; |
|
29 |
|
|
30 |
public class DependencyTest extends TestCase { |
|
31 |
|
|
32 |
public void testParse() { |
|
33 |
Dependency dep = new DefaultDependency(); |
|
34 |
|
|
35 |
dep.parse("required: org.gvsig.app >= 2.0.0-SNAPSHOT-2030"); |
|
36 |
String s = dep.toString(); |
|
37 |
assertEquals("required: org.gvsig.app >= 2.0.0-SNAPSHOT-2030", s); |
|
38 |
} |
|
39 |
} |
|
0 | 40 |
tags/org.gvsig.desktop-2.0.238/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/test/java/org/gvsig/installer/lib/impl/InstallerServiceTest.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; |
|
30 |
|
|
31 |
import java.io.BufferedOutputStream; |
|
32 |
import java.io.DataOutputStream; |
|
33 |
import java.io.File; |
|
34 |
import java.io.FileInputStream; |
|
35 |
import java.io.FileOutputStream; |
|
36 |
import java.io.IOException; |
|
37 |
import java.io.InputStream; |
|
38 |
import java.io.OutputStream; |
|
39 |
|
|
40 |
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase; |
|
41 |
|
|
42 |
/** |
|
43 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
44 |
*/ |
|
45 |
public abstract class InstallerServiceTest extends |
|
46 |
AbstractLibraryAutoInitTestCase { |
|
47 |
|
|
48 |
public File getApplicationDirectory() throws IOException { |
|
49 |
File templateFile = new File(getClass().getClassLoader().getResource( |
|
50 |
"application").getFile()); |
|
51 |
File applicationDirectory = new File(System |
|
52 |
.getProperty("java.io.tmpdir") |
|
53 |
+ File.separator + "tmp_gvsig_installer"); |
|
54 |
|
|
55 |
if (applicationDirectory.exists()) { |
|
56 |
deleteDir(applicationDirectory); |
|
57 |
} |
|
58 |
copy(templateFile, applicationDirectory); |
|
59 |
|
|
60 |
return applicationDirectory; |
|
61 |
} |
|
62 |
|
|
63 |
public File getTemporalFile() { |
|
64 |
return new File(System.getProperty("java.io.tmpdir") + File.separator |
|
65 |
+ "installer" + Math.random()); |
|
66 |
} |
|
67 |
|
|
68 |
public File getInstallersDirectory() throws IOException { |
|
69 |
File applicationDirectory = getApplicationDirectory(); |
|
70 |
return new File(applicationDirectory + File.separator + "install"); |
|
71 |
} |
|
72 |
|
|
73 |
public File getPluginsDirectory() throws IOException { |
|
74 |
File applicationDirectory = getApplicationDirectory(); |
|
75 |
return new File(applicationDirectory + File.separator + "gvSIG" |
|
76 |
+ File.separator + "extensiones"); |
|
77 |
} |
|
78 |
|
|
79 |
public boolean deleteDir(File dir) { |
|
80 |
if (dir.isDirectory()) { |
|
81 |
String[] children = dir.list(); |
|
82 |
for (int i = 0; i < children.length; i++) { |
|
83 |
boolean success = deleteDir(new File(dir, children[i])); |
|
84 |
if (!success) { |
|
85 |
return false; |
|
86 |
} |
|
87 |
} |
|
88 |
} |
|
89 |
return dir.delete(); |
|
90 |
} |
|
91 |
|
|
92 |
public void copy(File sourceLocation, File targetLocation) |
|
93 |
throws IOException { |
|
94 |
if (sourceLocation.isDirectory()) { |
|
95 |
if (!targetLocation.exists()) { |
|
96 |
targetLocation.mkdir(); |
|
97 |
} |
|
98 |
|
|
99 |
String[] children = sourceLocation.list(); |
|
100 |
for (int i = 0; i < children.length; i++) { |
|
101 |
copy(new File(sourceLocation, children[i]), new File( |
|
102 |
targetLocation, children[i])); |
|
103 |
} |
|
104 |
} else { |
|
105 |
targetLocation.getParentFile().mkdirs(); |
|
106 |
|
|
107 |
InputStream in = new FileInputStream(sourceLocation); |
|
108 |
OutputStream out = new FileOutputStream(targetLocation); |
|
109 |
|
|
110 |
// Copy the bits from instream to outstream |
|
111 |
byte[] buf = new byte[1024]; |
|
112 |
int len; |
|
113 |
while ((len = in.read(buf)) > 0) { |
|
114 |
out.write(buf, 0, len); |
|
115 |
} |
|
116 |
in.close(); |
|
117 |
out.close(); |
|
118 |
} |
|
119 |
} |
|
120 |
|
|
121 |
public void writeToFile(InputStream is, File file) { |
|
122 |
try { |
|
123 |
DataOutputStream out = new DataOutputStream( |
|
124 |
new BufferedOutputStream(new FileOutputStream(file))); |
|
125 |
InputStream is2 = is; |
|
126 |
boolean again = true; |
|
127 |
while (again) { |
|
128 |
if (is2.read() > -1) { |
|
129 |
out.writeByte(is.read()); |
|
130 |
} else { |
|
131 |
again = false; |
|
132 |
} |
|
133 |
} |
|
134 |
is.close(); |
|
135 |
out.close(); |
|
136 |
} catch (IOException e) { |
|
137 |
System.err.println("Error Writing/Reading Streams."); |
|
138 |
} |
|
139 |
} |
|
140 |
|
|
141 |
} |
|
0 | 142 |
tags/org.gvsig.desktop-2.0.238/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/test/java/org/gvsig/installer/lib/impl/execution/InstallPackageServiceTest.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
/* |
|
25 |
* AUTHORS (In addition to CIT): |
|
26 |
* 2010 {Prodevelop} {Task} |
|
27 |
*/ |
|
28 |
|
|
29 |
package org.gvsig.installer.lib.impl.execution; |
|
30 |
|
|
31 |
import java.io.File; |
|
32 |
import java.io.IOException; |
|
33 |
|
|
34 |
import junit.framework.Assert; |
|
35 |
|
|
36 |
import org.gvsig.installer.lib.api.InstallerLocator; |
|
37 |
import org.gvsig.installer.lib.api.PackageInfo; |
|
38 |
import org.gvsig.installer.lib.api.creation.MakePluginPackageService; |
|
39 |
import org.gvsig.installer.lib.api.creation.MakePluginPackageServiceException; |
|
40 |
import org.gvsig.installer.lib.api.execution.InstallPackageService; |
|
41 |
import org.gvsig.installer.lib.api.execution.InstallPackageServiceException; |
|
42 |
import org.gvsig.installer.lib.impl.InstallerServiceTest; |
|
43 |
import org.gvsig.tools.locator.LocatorException; |
|
44 |
|
|
45 |
/** |
|
46 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
47 |
*/ |
|
48 |
public class InstallPackageServiceTest extends InstallerServiceTest { |
|
49 |
|
|
50 |
@Override |
|
51 |
protected void doSetUp() throws Exception { |
|
52 |
// TODO Auto-generated method stub |
|
53 |
|
|
54 |
} |
|
55 |
|
|
56 |
public void testReadPlugins() throws LocatorException, |
|
57 |
MakePluginPackageServiceException, InstallPackageServiceException, |
|
58 |
IOException { |
|
59 |
File installersDirectory = super.getInstallersDirectory(); |
|
60 |
|
|
61 |
InstallPackageService installPackageService = InstallerLocator |
|
62 |
.getInstallerManager().getInstallPackageService(); |
|
63 |
installPackageService.addBundlesFromDirectory(installersDirectory, null); |
|
64 |
|
|
65 |
Assert.assertEquals(3, installPackageService.getPackageCount()); |
|
66 |
|
|
67 |
int pluginsNumber = 0; |
|
68 |
for (int i = 0; i < 3; i++) { |
|
69 |
PackageInfo packageInfo = installPackageService.getPackageInfo(i); |
|
70 |
if (packageInfo.getCode().equals("org.gvsig.plugin1")) { |
|
71 |
assertNotNull(packageInfo.getState()); |
|
72 |
pluginsNumber++; |
|
73 |
} else if (packageInfo.getCode().equals("org.gvsig.plugin2")) { |
|
74 |
assertEquals("RC1", packageInfo.getState()); |
|
75 |
pluginsNumber++; |
|
76 |
} else if (packageInfo.getCode().equals("org.gvsig.plugin3")) { |
|
77 |
assertEquals("Testing", packageInfo.getState()); |
|
78 |
pluginsNumber++; |
|
79 |
} |
|
80 |
} |
|
81 |
|
|
82 |
Assert.assertEquals(3, pluginsNumber); |
|
83 |
} |
|
84 |
|
|
85 |
public void testInstallPluginFromApplication() |
|
86 |
throws InstallPackageServiceException, IOException, |
|
87 |
LocatorException, MakePluginPackageServiceException { |
|
88 |
File installersDirectory = super.getInstallersDirectory(); |
|
89 |
File applicationDirectory = super.getApplicationDirectory(); |
|
90 |
|
|
91 |
InstallPackageService installerExecutionService = InstallerLocator |
|
92 |
.getInstallerManager().getInstallPackageService(); |
|
93 |
installerExecutionService.addBundlesFromDirectory(installersDirectory, null); |
|
94 |
|
|
95 |
PackageInfo packageInfo = installerExecutionService |
|
96 |
.getPackageInfo("org.gvsig.plugin1"); |
|
97 |
installerExecutionService.installPackage(applicationDirectory, |
|
98 |
packageInfo); |
|
99 |
|
|
100 |
Assert.assertEquals(3, installerExecutionService.getPackageCount()); |
|
101 |
|
|
102 |
// Reading the excution and check that the file is installed |
|
103 |
MakePluginPackageService installerCreationService = InstallerLocator |
|
104 |
.getInstallerManager().getMakePluginPackageService(); |
|
105 |
Assert |
|
106 |
.assertEquals(4, installerCreationService |
|
107 |
.getPluginPackageCount()); |
|
108 |
} |
|
109 |
|
|
110 |
public void testInstallPluginFromExternal() |
|
111 |
throws InstallPackageServiceException, IOException, |
|
112 |
LocatorException, MakePluginPackageServiceException { |
|
113 |
File applicationDirectory = super.getApplicationDirectory(); |
|
114 |
File externalInstallationFile = new File(applicationDirectory |
|
115 |
.getAbsoluteFile() |
|
116 |
+ File.separator + "install" + File.separator + "bundle1.zip"); |
|
117 |
|
|
118 |
InstallPackageService installerExecutionService = InstallerLocator |
|
119 |
.getInstallerManager().getInstallPackageService(); |
|
120 |
installerExecutionService.addBundle(externalInstallationFile, null); |
|
121 |
|
|
122 |
PackageInfo packageInfo = installerExecutionService |
|
123 |
.getPackageInfo("org.gvsig.plugin1"); |
|
124 |
|
|
125 |
Assert.assertEquals(3, installerExecutionService.getPackageCount()); |
|
126 |
|
|
127 |
installerExecutionService.installPackage(applicationDirectory, |
|
128 |
packageInfo); |
|
129 |
|
|
130 |
// Reading the excution and check that the file is installed |
|
131 |
MakePluginPackageService installerCreationService = InstallerLocator |
|
132 |
.getInstallerManager().getMakePluginPackageService(); |
|
133 |
Assert |
|
134 |
.assertEquals(4, installerCreationService |
|
135 |
.getPluginPackageCount()); |
|
136 |
} |
|
137 |
|
|
138 |
// public void testInstallPluginWithAntScript() throws |
|
139 |
// InstallPackageServiceException, LocatorException, |
|
140 |
// MakePluginPackageServiceException, IOException{ |
|
141 |
// File applicationDirectory = super.getApplicationDirectory(); |
|
142 |
// File installersDirectory = super.getInstallersDirectory(); |
|
143 |
// File pluginsDirectory = super.getPluginsDirectory(); |
|
144 |
// |
|
145 |
// InstallPackageService installerExecutionService = |
|
146 |
// InstallerLocator.getInstallerManager().getInstallPackageService(); |
|
147 |
// installerExecutionService.addBundlesFromDirectory(installersDirectory); |
|
148 |
// |
|
149 |
// PackageInfo packageInfo = |
|
150 |
// installerExecutionService.getPackageInfo("org.gvsig.plugin2"); |
|
151 |
// |
|
152 |
// Assert.assertEquals(3, installerExecutionService.getPackageCount()); |
|
153 |
// |
|
154 |
// installerExecutionService.installPackage(applicationDirectory, |
|
155 |
// packageInfo); |
|
156 |
// |
|
157 |
// //Reading the excution and check that the file is installed |
|
158 |
// MakePluginPackageService installerCreationService = |
|
159 |
// InstallerLocator.getInstallerManager().getMakePluginPackageService(pluginsDirectory); |
|
160 |
// |
|
161 |
// Assert.assertEquals(5, installerCreationService.getPluginPackageCount()); |
|
162 |
// } |
|
163 |
|
|
164 |
} |
|
0 | 165 |
tags/org.gvsig.desktop-2.0.238/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/test/java/org/gvsig/installer/lib/impl/execution/DependencyCalculatorTest.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.installer.lib.impl.execution; |
|
25 |
|
|
26 |
import java.util.ArrayList; |
Also available in: Unified diff