Revision 32431
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 | ||
---|---|---|
93 | 93 |
} |
94 | 94 |
//Execute the installer |
95 | 95 |
InstallerExecutionProvider installerExecutionProvider = createProvider(pluginToInstallIndex); |
96 |
installerExecutionProvider.setApplicationDirectory(applicationDirectory); |
|
97 |
// |
|
98 | 96 |
Decompress decompress = new Decompress(); |
99 | 97 |
InstallerInfo instalerInfo = installerInfos.get(pluginToInstallIndex); |
100 | 98 |
InputStream is = decompress.searchPlugin(inputStream,zipEntriesMap.get(instalerInfo)); |
101 |
installerExecutionProvider.setInstaller(is); |
|
102 |
installerExecutionProvider.install(); |
|
99 |
installerExecutionProvider.install(applicationDirectory, is); |
|
103 | 100 |
} |
104 | 101 |
|
105 | 102 |
private InstallerExecutionProvider createProvider(int index) throws InstallerExecutionServiceException { |
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/creation/DefaultInstallerCreationService.java | ||
---|---|---|
117 | 117 |
//Deleting the previous files folder |
118 | 118 |
File copiedFilesDirectoryfile = new File(copiedFilesDirectory); |
119 | 119 |
deleteDirectory(copiedFilesDirectoryfile); |
120 |
for (int i=0 ; i<getFileToCopySize() ; i++){ |
|
121 |
String destFile = getFileToCopyAt(i).getAbsolutePath(); |
|
120 |
InstallerInfo installerInfo = getSelectedInstallerInfo(); |
|
121 |
for (int i=0 ; i<installerInfo.getFileToCopySize() ; i++){ |
|
122 |
String destFile = installerInfo.getFileToCopyAt(i).getAbsolutePath(); |
|
122 | 123 |
|
123 | 124 |
String sourceFile = applicationDirectory + File.separator + destFile; |
124 | 125 |
|
... | ... | |
388 | 389 |
reader.close(); |
389 | 390 |
return fileData.toString(); |
390 | 391 |
} |
391 |
|
|
392 |
public void addFileToCopy(File file) { |
|
393 |
selectedFiles.add(file); |
|
394 |
} |
|
395 |
|
|
396 |
public File getFileToCopyAt(int index) { |
|
397 |
return selectedFiles.get(index); |
|
398 |
} |
|
399 |
|
|
400 |
public int getFileToCopySize() { |
|
401 |
return selectedFiles.size(); |
|
402 |
} |
|
403 |
|
|
404 |
public void removeFileToCopy(int index) { |
|
405 |
selectedFiles.remove(index); |
|
406 |
} |
|
407 |
|
|
408 |
public String getAntScript() { |
|
409 |
return antScript; |
|
410 |
} |
|
411 |
|
|
412 |
public void setAnScript(String antScript) { |
|
413 |
this.antScript = antScript; |
|
414 |
} |
|
415 |
|
|
416 | 392 |
} |
417 | 393 |
|
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/test/java/org/gvsig/installer/lib/impl/execution/InstallerExecutionServiceTest.java | ||
---|---|---|
132 | 132 |
InstallerCreationService installerCreationService = |
133 | 133 |
InstallerLocator.getInstallerManager().getInstallerCreationService(); |
134 | 134 |
installerCreationService.setApplicationDirectory(applicationDirectory); |
135 |
Assert.assertEquals(4, installerCreationService.getPluginsSize()); |
|
135 |
Assert.assertEquals(4, installerCreationService.getPluginsSize()); |
|
136 |
} |
|
136 | 137 |
|
138 |
public void testInstallPluginWithAntScript() throws InstallerExecutionServiceException, IOException, LocatorException, InstallerCreationServiceException{ |
|
139 |
File applicationDirectory = super.getApplicationDirectory(); |
|
140 |
File externalInstallationFile = new File(applicationDirectory.getAbsoluteFile() + File.separator + "install" + File.separator + "installer1.zip"); |
|
141 |
|
|
142 |
InstallerExecutionService installerExecutionService = |
|
143 |
InstallerLocator.getInstallerManager().getInstallerExecutionService(); |
|
144 |
installerExecutionService.setApplicationDirectory(applicationDirectory); |
|
145 |
installerExecutionService.addInstaller(new FileInputStream(externalInstallationFile)); |
|
146 |
installerExecutionService.setPluginToInstall("org.gvsig.plugin2"); |
|
147 |
|
|
148 |
|
|
149 |
installerExecutionService.executeInstaller(new FileInputStream(externalInstallationFile)); |
|
150 |
|
|
151 |
//Reading the excution and check that the file is installed |
|
152 |
InstallerCreationService installerCreationService = |
|
153 |
InstallerLocator.getInstallerManager().getInstallerCreationService(); |
|
154 |
installerCreationService.setApplicationDirectory(applicationDirectory); |
|
155 |
Assert.assertEquals(5, installerCreationService.getPluginsSize()); |
|
137 | 156 |
} |
138 | 157 |
|
139 | 158 |
} |
branches/v2_0_0_prep/extensions/org.gvsig.installer/pom.xml | ||
---|---|---|
165 | 165 |
<artifactId>org.gvsig.ui</artifactId> |
166 | 166 |
<version>2.0-SNAPSHOT</version> |
167 | 167 |
</dependency> |
168 |
<dependency> |
|
169 |
<groupId>org.apache.xmlgraphics</groupId> |
|
170 |
<artifactId>batik-gui-util</artifactId> |
|
171 |
<version>1.7</version> |
|
172 |
</dependency> |
|
173 |
<dependency> |
|
174 |
<groupId>org.apache.xmlgraphics</groupId> |
|
175 |
<artifactId>batik-xml</artifactId> |
|
176 |
<version>1.7</version> |
|
177 |
</dependency> |
|
178 |
<dependency> |
|
179 |
<groupId>org.apache.ant</groupId> |
|
180 |
<artifactId>ant</artifactId> |
|
181 |
<version>1.7.0</version> |
|
182 |
</dependency> |
|
168 | 183 |
</dependencies> |
169 | 184 |
</dependencyManagement> |
170 | 185 |
|
Also available in: Unified diff