Revision 32498 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/execution/DefaultInstallerExecutionService.java
DefaultInstallerExecutionService.java | ||
---|---|---|
41 | 41 |
import org.gvsig.installer.lib.api.execution.InstallerExecutionService; |
42 | 42 |
import org.gvsig.installer.lib.api.execution.InstallerExecutionServiceException; |
43 | 43 |
import org.gvsig.installer.lib.impl.DefaultInstallerManager; |
44 |
import org.gvsig.installer.lib.spi.InstallerProviderLocator; |
|
44 | 45 |
import org.gvsig.installer.lib.spi.InstallerProviderManager; |
46 |
import org.gvsig.installer.lib.spi.InstallerProviderServices; |
|
45 | 47 |
import org.gvsig.installer.lib.spi.execution.InstallerExecutionProvider; |
46 | 48 |
import org.gvsig.tools.service.Manager; |
47 | 49 |
import org.gvsig.tools.service.ServiceException; |
... | ... | |
59 | 61 |
private int pluginToInstallIndex = -1; |
60 | 62 |
private File applicationDirectory; |
61 | 63 |
private static final Logger logger = LoggerFactory.getLogger(DefaultInstallerExecutionService.class); |
64 |
private InstallerProviderServices installerProviderServices = null; |
|
62 | 65 |
|
63 | 66 |
public DefaultInstallerExecutionService(DefaultInstallerManager manager) { |
64 | 67 |
super(); |
... | ... | |
66 | 69 |
installFilesMap = new HashMap<InstallerInfo, File>(); |
67 | 70 |
installerInfos = new ArrayList<InstallerInfo>(); |
68 | 71 |
zipEntriesMap = new HashMap<InstallerInfo, String>(); |
72 |
installerProviderServices = InstallerProviderLocator.getProviderManager().createInstallerProviderServices(); |
|
69 | 73 |
} |
70 | 74 |
|
71 | 75 |
public void executeInstaller() |
... | ... | |
93 | 97 |
} |
94 | 98 |
//Execute the installer |
95 | 99 |
InstallerExecutionProvider installerExecutionProvider = createProvider(pluginToInstallIndex); |
96 |
Decompress decompress = new Decompress(); |
|
97 | 100 |
InstallerInfo instalerInfo = installerInfos.get(pluginToInstallIndex); |
98 |
InputStream is = decompress.searchPlugin(inputStream,zipEntriesMap.get(instalerInfo));
|
|
101 |
InputStream is = installerProviderServices.searchPlugin(inputStream,zipEntriesMap.get(instalerInfo));
|
|
99 | 102 |
installerExecutionProvider.install(applicationDirectory, is); |
100 | 103 |
} |
101 | 104 |
|
... | ... | |
187 | 190 |
return this.manager; |
188 | 191 |
} |
189 | 192 |
|
190 |
public void setPluginToInstall(String code) throws InstallerCreationServiceException {
|
|
193 |
public void setPluginToInstall(String code) throws InstallerExecutionServiceException {
|
|
191 | 194 |
int selectedCode = -1; |
192 | 195 |
for (int i=0 ; i<getPluginsSize() ; i++){ |
193 | 196 |
if (installerInfos.get(i).getCode().equals(code)){ |
... | ... | |
196 | 199 |
} |
197 | 200 |
} |
198 | 201 |
if (selectedCode == -1){ |
199 |
throw new InstallerCreationServiceException("The plugin doesn't exist");
|
|
202 |
throw new InstallerExecutionServiceException("The plugin doesn't exist");
|
|
200 | 203 |
} |
201 | 204 |
pluginToInstallIndex = selectedCode; |
202 | 205 |
} |
Also available in: Unified diff