svn-gvsig-desktop / tags / v2_0_0_Build_2021 / extensions / org.gvsig.installer / org.gvsig.installer.swing / org.gvsig.installer.swing.impl / src / main / java / org / gvsig / installer / swing / impl / DefaultSwingInstallerManager.java @ 34107
History | View | Annotate | Download (4.94 KB)
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 |
* of the Valencian Government (CIT)
|
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 2
|
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 |
*/
|
22 |
|
23 |
/*
|
24 |
* AUTHORS (In addition to CIT):
|
25 |
* 2010 {Prodevelop} {Task}
|
26 |
*/
|
27 |
|
28 |
package org.gvsig.installer.swing.impl; |
29 |
|
30 |
import java.io.File; |
31 |
import java.net.URL; |
32 |
|
33 |
import org.gvsig.i18n.Messages; |
34 |
import org.gvsig.installer.lib.api.InstallerLocator; |
35 |
import org.gvsig.installer.lib.api.InstallerManager; |
36 |
import org.gvsig.installer.swing.api.SwingInstallerManager; |
37 |
import org.gvsig.installer.swing.api.creation.MakePluginPackageWizard; |
38 |
import org.gvsig.installer.swing.api.creation.MakePluginPackageWizardException; |
39 |
import org.gvsig.installer.swing.api.execution.InstallPackageWizard; |
40 |
import org.gvsig.installer.swing.api.execution.InstallPackageWizardException; |
41 |
import org.gvsig.tools.ToolsLocator; |
42 |
import org.gvsig.tools.extensionpoint.ExtensionPoint; |
43 |
import org.gvsig.tools.extensionpoint.ExtensionPointManager; |
44 |
|
45 |
/**
|
46 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a>
|
47 |
*/
|
48 |
public class DefaultSwingInstallerManager implements SwingInstallerManager { |
49 |
|
50 |
private static final String SWING_INSTALLER_MANAGER_EXTENSION_POINT = |
51 |
"SwingInstallerManagerExtensionPoint";
|
52 |
private static final String CREATE_INSTALLER_WIZARD_NAME = |
53 |
"CreateInstallerWizard";
|
54 |
private static final String EXECUTE_INSTALLER_WIZARD_NAME = |
55 |
"ExecuteInstallerWizard";
|
56 |
private ExtensionPointManager extensionPoints = ToolsLocator
|
57 |
.getExtensionPointManager(); |
58 |
|
59 |
private String applicationVersion = "1.0.0"; |
60 |
private URL defaultDownloadURL = null; |
61 |
|
62 |
public String getText(String key) { |
63 |
return Messages.getText(key);
|
64 |
} |
65 |
|
66 |
public MakePluginPackageWizard createMakePluginPackageWizard(
|
67 |
File applicationFolder, File pluginsFolder, File installFolder) |
68 |
throws MakePluginPackageWizardException {
|
69 |
ExtensionPoint ep = |
70 |
extensionPoints.add(SWING_INSTALLER_MANAGER_EXTENSION_POINT); |
71 |
try {
|
72 |
Object[] args = new Object[3]; |
73 |
args[0] = applicationFolder;
|
74 |
args[1] = pluginsFolder;
|
75 |
args[2] = installFolder;
|
76 |
return (MakePluginPackageWizard) ep.create(
|
77 |
CREATE_INSTALLER_WIZARD_NAME, args); |
78 |
} catch (Exception e) { |
79 |
throw new MakePluginPackageWizardException( |
80 |
"Error creating the wizard", e);
|
81 |
} |
82 |
} |
83 |
|
84 |
public InstallPackageWizard createInstallPackageWizard(
|
85 |
File applicationFolder, File pluginsFolder, File installFolder) |
86 |
throws InstallPackageWizardException {
|
87 |
ExtensionPoint ep = |
88 |
extensionPoints.add(SWING_INSTALLER_MANAGER_EXTENSION_POINT); |
89 |
try {
|
90 |
Object[] args = new Object[3]; |
91 |
args[0] = applicationFolder;
|
92 |
args[1] = pluginsFolder;
|
93 |
args[2] = installFolder;
|
94 |
return (InstallPackageWizard) ep.create(
|
95 |
EXECUTE_INSTALLER_WIZARD_NAME, args); |
96 |
} catch (Exception e) { |
97 |
throw new InstallPackageWizardException( |
98 |
"Error creating the wizard", e);
|
99 |
} |
100 |
} |
101 |
|
102 |
public void registerMakePluginPackageWizardInstallerCreationWizard( |
103 |
Class<? extends MakePluginPackageWizard> clazz) { |
104 |
ExtensionPoint extensionPoint = |
105 |
extensionPoints.add(SWING_INSTALLER_MANAGER_EXTENSION_POINT, "");
|
106 |
extensionPoint.append(CREATE_INSTALLER_WIZARD_NAME, "", clazz);
|
107 |
} |
108 |
|
109 |
public void registerInstallPackageWizard( |
110 |
Class<? extends InstallPackageWizard> clazz) { |
111 |
ExtensionPoint extensionPoint = |
112 |
extensionPoints.add(SWING_INSTALLER_MANAGER_EXTENSION_POINT, "");
|
113 |
extensionPoint.append(EXECUTE_INSTALLER_WIZARD_NAME, "", clazz);
|
114 |
} |
115 |
|
116 |
public String getApplicationVersion() { |
117 |
return applicationVersion;
|
118 |
} |
119 |
|
120 |
public void setApplicationVersion(String gvSIGVersion) { |
121 |
this.applicationVersion = gvSIGVersion;
|
122 |
} |
123 |
|
124 |
public URL getDefaultDownloadURL() { |
125 |
return defaultDownloadURL;
|
126 |
} |
127 |
|
128 |
public void setDefaultDownloadURL(URL defaultDownloadURL) { |
129 |
this.defaultDownloadURL = defaultDownloadURL;
|
130 |
} |
131 |
|
132 |
public InstallerManager getInstallerManager() {
|
133 |
return InstallerLocator.getInstallerManager();
|
134 |
} |
135 |
} |