Revision 33680 branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/main/java/org/gvsig/installer/lib/impl/DefaultInstallerManager.java
DefaultInstallerManager.java | ||
---|---|---|
1 | 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 |
*/ |
|
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 | 22 |
|
23 | 23 |
/* |
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2010 {Prodevelop} {Task} |
|
26 |
*/ |
|
27 |
|
|
24 |
* AUTHORS (In addition to CIT):
|
|
25 |
* 2010 {Prodevelop} {Task}
|
|
26 |
*/
|
|
27 |
|
|
28 | 28 |
package org.gvsig.installer.lib.impl; |
29 | 29 |
|
30 | 30 |
import java.io.File; |
... | ... | |
45 | 45 |
/** |
46 | 46 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
47 | 47 |
*/ |
48 |
public class DefaultInstallerManager extends AbstractManager implements InstallerManager{ |
|
49 |
private static final String INSTALLER_MANAGER_EXTENSION_POINT = "InstallerManagerExtensionPoint"; |
|
50 |
private static final String INSTALLER_CREATION_SERVICE_NAME = "InstallerCreationService"; |
|
51 |
private static final String INSTALLER_EXECUTION_SERVICE_NAME = "InstallerExecutionService"; |
|
52 |
private ExtensionPointManager extensionPoints = ToolsLocator.getExtensionPointManager(); |
|
53 |
|
|
54 |
public DefaultInstallerManager() { |
|
55 |
super(new DefaultInstallerProviderManager()); |
|
56 |
} |
|
57 |
|
|
58 |
|
|
59 |
public MakePluginPackageService getMakePluginPackageService(File pluginsDirectory) throws MakePluginPackageServiceException { |
|
60 |
ExtensionPoint ep = extensionPoints.add(INSTALLER_MANAGER_EXTENSION_POINT); |
|
61 |
try { |
|
62 |
Object[] args = new Object[2]; |
|
63 |
args[0] = this; |
|
64 |
args[1] = pluginsDirectory; |
|
65 |
return (MakePluginPackageService)ep.create(INSTALLER_CREATION_SERVICE_NAME, args); |
|
66 |
} catch (Exception e) { |
|
67 |
throw new MakePluginPackageServiceException("Exception creating the installer service to create installers", e); |
|
68 |
} |
|
69 |
} |
|
70 |
|
|
71 |
public InstallPackageService getInstallPackageService() throws InstallPackageServiceException { |
|
72 |
ExtensionPoint ep = extensionPoints.add(INSTALLER_MANAGER_EXTENSION_POINT); |
|
73 |
try { |
|
74 |
Object[] args = new Object[1]; |
|
75 |
args[0] = this; |
|
76 |
return (InstallPackageService)ep.create(INSTALLER_EXECUTION_SERVICE_NAME, args); |
|
77 |
} catch (Exception e) { |
|
78 |
throw new InstallPackageServiceException("Exception creating the installer service to install plugins", e); |
|
79 |
} |
|
80 |
} |
|
81 |
public void registerMakePluginPackageService(Class clazz) { |
|
82 |
if (!MakePluginPackageService.class.isAssignableFrom(clazz)) { |
|
83 |
throw new IllegalArgumentException(clazz.getName() |
|
84 |
+ " must implement the InstallerCreationService interface"); |
|
85 |
} |
|
86 |
ExtensionPoint extensionPoint = extensionPoints.add(INSTALLER_MANAGER_EXTENSION_POINT, ""); |
|
87 |
extensionPoint.append(INSTALLER_CREATION_SERVICE_NAME, "", clazz); |
|
88 |
} |
|
89 |
|
|
90 |
public void registerInstallPackageService(Class clazz) { |
|
91 |
if (!InstallPackageService.class.isAssignableFrom(clazz)) { |
|
92 |
throw new IllegalArgumentException(clazz.getName() |
|
93 |
+ " must implement the InstallerExecutionService interface"); |
|
94 |
} |
|
95 |
ExtensionPoint extensionPoint = extensionPoints.add(INSTALLER_MANAGER_EXTENSION_POINT, ""); |
|
96 |
extensionPoint.append(INSTALLER_EXECUTION_SERVICE_NAME, "", clazz); |
|
97 |
} |
|
48 |
public class DefaultInstallerManager extends AbstractManager implements |
|
49 |
InstallerManager { |
|
98 | 50 |
|
51 |
private static final String INSTALLER_MANAGER_EXTENSION_POINT = |
|
52 |
"InstallerManagerExtensionPoint"; |
|
53 |
private static final String INSTALLER_CREATION_SERVICE_NAME = |
|
54 |
"InstallerCreationService"; |
|
55 |
private static final String INSTALLER_EXECUTION_SERVICE_NAME = |
|
56 |
"InstallerExecutionService"; |
|
57 |
private ExtensionPointManager extensionPoints = ToolsLocator |
|
58 |
.getExtensionPointManager(); |
|
99 | 59 |
|
100 |
public Service getService(DynObject parameters) throws ServiceException { |
|
101 |
return null; |
|
102 |
} |
|
60 |
public DefaultInstallerManager() { |
|
61 |
super(new DefaultInstallerProviderManager()); |
|
62 |
} |
|
63 |
|
|
64 |
public MakePluginPackageService getMakePluginPackageService( |
|
65 |
File pluginsDirectory) throws MakePluginPackageServiceException { |
|
66 |
ExtensionPoint ep = |
|
67 |
extensionPoints.add(INSTALLER_MANAGER_EXTENSION_POINT); |
|
68 |
try { |
|
69 |
Object[] args = new Object[2]; |
|
70 |
args[0] = this; |
|
71 |
args[1] = pluginsDirectory; |
|
72 |
return (MakePluginPackageService) ep.create( |
|
73 |
INSTALLER_CREATION_SERVICE_NAME, args); |
|
74 |
} catch (Exception e) { |
|
75 |
throw new MakePluginPackageServiceException( |
|
76 |
"Exception creating the installer service to create installers", |
|
77 |
e); |
|
78 |
} |
|
79 |
} |
|
80 |
|
|
81 |
public InstallPackageService getInstallPackageService() |
|
82 |
throws InstallPackageServiceException { |
|
83 |
ExtensionPoint ep = |
|
84 |
extensionPoints.add(INSTALLER_MANAGER_EXTENSION_POINT); |
|
85 |
try { |
|
86 |
Object[] args = new Object[1]; |
|
87 |
args[0] = this; |
|
88 |
return (InstallPackageService) ep.create( |
|
89 |
INSTALLER_EXECUTION_SERVICE_NAME, args); |
|
90 |
} catch (Exception e) { |
|
91 |
throw new InstallPackageServiceException( |
|
92 |
"Exception creating the installer service to install plugins", |
|
93 |
e); |
|
94 |
} |
|
95 |
} |
|
96 |
|
|
97 |
public void registerMakePluginPackageService(Class clazz) { |
|
98 |
if (!MakePluginPackageService.class.isAssignableFrom(clazz)) { |
|
99 |
throw new IllegalArgumentException(clazz.getName() |
|
100 |
+ " must implement the InstallerCreationService interface"); |
|
101 |
} |
|
102 |
ExtensionPoint extensionPoint = |
|
103 |
extensionPoints.add(INSTALLER_MANAGER_EXTENSION_POINT, ""); |
|
104 |
extensionPoint.append(INSTALLER_CREATION_SERVICE_NAME, "", clazz); |
|
105 |
} |
|
106 |
|
|
107 |
public void registerInstallPackageService(Class clazz) { |
|
108 |
if (!InstallPackageService.class.isAssignableFrom(clazz)) { |
|
109 |
throw new IllegalArgumentException(clazz.getName() |
|
110 |
+ " must implement the InstallerExecutionService interface"); |
|
111 |
} |
|
112 |
ExtensionPoint extensionPoint = |
|
113 |
extensionPoints.add(INSTALLER_MANAGER_EXTENSION_POINT, ""); |
|
114 |
extensionPoint.append(INSTALLER_EXECUTION_SERVICE_NAME, "", clazz); |
|
115 |
} |
|
116 |
|
|
117 |
public Service getService(DynObject parameters) throws ServiceException { |
|
118 |
return null; |
|
119 |
} |
|
103 | 120 |
} |
104 |
|
Also available in: Unified diff