Revision 32498
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.api/src/main/java/org/gvsig/installer/lib/api/execution/InstallerExecutionService.java | ||
---|---|---|
106 | 106 |
* @throws InstallerExecutionServiceException |
107 | 107 |
* If the plugin doesn't exist. |
108 | 108 |
*/ |
109 |
public void setPluginToInstall(String code) throws InstallerCreationServiceException;
|
|
109 |
public void setPluginToInstall(String code) throws InstallerExecutionServiceException;
|
|
110 | 110 |
|
111 | 111 |
/** |
112 | 112 |
* Install the selected plugin. This method only can be executed if the |
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.spi/src/main/java/org/gvsig/installer/lib/spi/InstallerInfoFileException.java | ||
---|---|---|
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.lib.spi; |
|
29 |
|
|
30 |
import org.gvsig.installer.lib.api.creation.InstallerCreationServiceException; |
|
31 |
import org.gvsig.tools.exception.BaseException; |
|
32 |
|
|
33 |
/** |
|
34 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
35 |
*/ |
|
36 |
public class InstallerInfoFileException extends InstallerCreationServiceException { |
|
37 |
private static final long serialVersionUID = -5388898489108649788L; |
|
38 |
|
|
39 |
private static final String KEY = "install_infofile_exception"; |
|
40 |
|
|
41 |
/** |
|
42 |
* @see BaseException#BaseException(String, String, long) |
|
43 |
*/ |
|
44 |
public InstallerInfoFileException(String message) { |
|
45 |
super(message, KEY, serialVersionUID); |
|
46 |
} |
|
47 |
|
|
48 |
/** |
|
49 |
* @see BaseException#BaseException(String, Throwable) |
|
50 |
*/ |
|
51 |
public InstallerInfoFileException(String message, Throwable cause) { |
|
52 |
super(message, cause, KEY, serialVersionUID); |
|
53 |
} |
|
54 |
|
|
55 |
/** |
|
56 |
* @see BaseException#BaseException(String, String, long) |
|
57 |
*/ |
|
58 |
public InstallerInfoFileException(String message, String key, long code) { |
|
59 |
super(message, key, code); |
|
60 |
} |
|
61 |
|
|
62 |
} |
|
63 |
|
|
0 | 64 |
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.spi/src/main/java/org/gvsig/installer/lib/spi/InstallerProviderLocator.java | ||
---|---|---|
32 | 32 |
import org.gvsig.tools.locator.LocatorException; |
33 | 33 |
|
34 | 34 |
/** |
35 |
* This Locator provides the entry point for the gvSIG {@link InstallerProviderManager} |
|
36 |
* |
|
35 | 37 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
36 | 38 |
*/ |
37 | 39 |
public class InstallerProviderLocator extends BaseLocator{ |
... | ... | |
81 | 83 |
* @param clazz |
82 | 84 |
* implementing the PersistenceManager interface |
83 | 85 |
*/ |
86 |
@SuppressWarnings(value = "unchecked") |
|
84 | 87 |
public static void registerInstallerProviderManager(Class clazz) { |
85 | 88 |
getInstance().register(PROVIDER_MANAGER_NAME, PROVIDER_MANAGER_DESCRIPTION, clazz); |
86 | 89 |
} |
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.spi/src/main/java/org/gvsig/installer/lib/spi/InstallerProviderServices.java | ||
---|---|---|
29 | 29 |
|
30 | 30 |
import java.io.File; |
31 | 31 |
import java.io.InputStream; |
32 |
import java.io.OutputStream; |
|
32 | 33 |
|
33 | 34 |
import org.gvsig.installer.lib.api.InstallerInfo; |
35 |
import org.gvsig.installer.lib.api.creation.InstallerCreationServiceException; |
|
34 | 36 |
import org.gvsig.installer.lib.api.execution.InstallerExecutionServiceException; |
35 | 37 |
import org.gvsig.tools.service.spi.ProviderServices; |
36 | 38 |
|
37 | 39 |
/** |
40 |
* Services that can be used by the providers to create the installer. It |
|
41 |
* contains methods to compress and to decompress files and methods to |
|
42 |
* read an install info file from a directory. |
|
43 |
* |
|
38 | 44 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
39 | 45 |
*/ |
40 | 46 |
public interface InstallerProviderServices extends ProviderServices{ |
41 | 47 |
|
48 |
/** |
|
49 |
* It decompress an input stream and write it on a directory. |
|
50 |
* @param is |
|
51 |
* The input stream to decompress |
|
52 |
* @param outputDirectory. |
|
53 |
* The output directory. |
|
54 |
* @throws InstallerExecutionServiceException |
|
55 |
* If there is a problem decompressing the stream. |
|
56 |
*/ |
|
42 | 57 |
public void decompress(InputStream is, File outputDirectory) throws InstallerExecutionServiceException; |
43 | 58 |
|
59 |
/** |
|
60 |
* Compress a directory like an zipped outputstream with a concrete name. |
|
61 |
* @param directory |
|
62 |
* The directory to compress. |
|
63 |
* @param fileName |
|
64 |
* Name of the zip entry that has the output file. |
|
65 |
* The name that have to have |
|
66 |
* @param os |
|
67 |
* Output stream to write the output. |
|
68 |
* @throws InstallerCreationServiceException |
|
69 |
* If there is any problem compressing. |
|
70 |
*/ |
|
71 |
public void compress(File directory, String fileName, OutputStream os) throws InstallerCreationServiceException; |
|
72 |
|
|
73 |
/** |
|
74 |
* Reads an installer info from a directory a fills the the properties |
|
75 |
* of an installerinfo. |
|
76 |
* @param directory |
|
77 |
* The root directory that contains the installinfo file |
|
78 |
* @param installInfo |
|
79 |
* The installinfo file that has to be filled. |
|
80 |
* @throws InstallerInfoFileException. |
|
81 |
* If there is any problem reading the file |
|
82 |
*/ |
|
83 |
public void readInstallInfo(File directory, InstallerInfo installerInfo) throws InstallerInfoFileException; |
|
84 |
|
|
85 |
/** |
|
86 |
* Writes the install.info file in a concrete directory. |
|
87 |
* @param directory |
|
88 |
* The directory. |
|
89 |
* @param installerInfo |
|
90 |
* The information to write. |
|
91 |
* @throws InstallerInfoFileException |
|
92 |
* If there is any problem writing the install.info file. |
|
93 |
*/ |
|
94 |
public void writeInstallInfo(File directory, InstallerInfo installerInfo) throws InstallerInfoFileException; |
|
95 |
|
|
96 |
/** |
|
97 |
* It search a plugin inside an installer file by the zip name and returns |
|
98 |
* the stream in this position ready to decompres. |
|
99 |
* @param is |
|
100 |
* The installer. |
|
101 |
* @param zipEntry |
|
102 |
* The name of the zip entry. |
|
103 |
* @return |
|
104 |
* The input stream ready to install. |
|
105 |
* @throws InstallerExecutionServiceException |
|
106 |
* If there is a problem reading the stream |
|
107 |
*/ |
|
108 |
public InputStream searchPlugin(InputStream is, String zipEntry) throws InstallerExecutionServiceException; |
|
109 |
|
|
110 |
/** |
|
111 |
* It reads a compressed file and retrieve the installer information. |
|
112 |
* @param is |
|
113 |
* The compressed file |
|
114 |
* @return |
|
115 |
* The information of the installer |
|
116 |
* @throws InstallerExecutionServiceException |
|
117 |
* If there is a problem decompressing the file. |
|
118 |
*/ |
|
44 | 119 |
public InstallerInfo readCompressedInstallInfo(InputStream is) throws InstallerExecutionServiceException; |
45 | 120 |
} |
46 | 121 |
|
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.spi/src/main/java/org/gvsig/installer/lib/spi/InstallerProviderManager.java | ||
---|---|---|
27 | 27 |
|
28 | 28 |
package org.gvsig.installer.lib.spi; |
29 | 29 |
|
30 |
import org.gvsig.installer.lib.api.InstallerInfo; |
|
30 | 31 |
import org.gvsig.installer.lib.spi.execution.InstallerExecutionProvider; |
31 | 32 |
import org.gvsig.tools.service.ServiceException; |
32 | 33 |
import org.gvsig.tools.service.spi.ProviderManager; |
33 | 34 |
|
34 | 35 |
/** |
36 |
* <p> |
|
37 |
* This manager offers to the providers that are executed in an installation process |
|
38 |
* of some functionalities that they need to complete their task. It also offers |
|
39 |
* the functionality to create a new provider using the provider name. |
|
40 |
* </p> |
|
41 |
* <p> |
|
42 |
* All the plugins to install have to have some install properties defined |
|
43 |
* by the {@link InstallerInfo} class. This class is just a set of properties |
|
44 |
* and there is a property named <b>type</b> that can be retrieved by the |
|
45 |
* {@link InstallerInfo#getType()} method that defines the plugin type |
|
46 |
* (a new plugin, theme...). This property is used to create a {@link InstallerExecutionProvider} |
|
47 |
* that is used to install the selected plugin. |
|
48 |
* </p> |
|
49 |
* <p> |
|
50 |
* For each different type of plugin a new provider has to be |
|
51 |
* registered using the plugin type. |
|
52 |
* </p> |
|
53 |
* |
|
35 | 54 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
36 | 55 |
*/ |
37 | 56 |
public interface InstallerProviderManager extends ProviderManager { |
38 | 57 |
|
39 |
|
|
58 |
/** |
|
59 |
* Creates a new provider to execute an installer to add a new plugin in gvSIG. |
|
60 |
* @param providerName |
|
61 |
* The provider name used on the registration of the provider. This name is the |
|
62 |
* type attribute defined by {@link InstallerInfo}. |
|
63 |
* @return |
|
64 |
* A porvider that can be used to install a plugin. |
|
65 |
* @throws ServiceException |
|
66 |
* If the provider doesn't exist or if there is a problem creating the provider. |
|
67 |
*/ |
|
40 | 68 |
public InstallerExecutionProvider createExecutionProvider(String providerName) throws ServiceException; |
41 | 69 |
|
70 |
/** |
|
71 |
* Creates the services that be used for the providers to execute or |
|
72 |
* create a new installer. |
|
73 |
* @return |
|
74 |
* The services used to create or execute an installer. |
|
75 |
*/ |
|
42 | 76 |
public InstallerProviderServices createInstallerProviderServices(); |
43 | 77 |
|
44 | 78 |
} |
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/org.gvsig.wfs | ||
---|---|---|
1 | 1 |
# |
2 |
#Wed Apr 28 14:56:07 CEST 2010
|
|
2 |
#Fri Apr 30 09:44:10 CEST 2010
|
|
3 | 3 |
version=1.0.0 |
4 | 4 |
oficial=true |
5 | 5 |
name=myplugin |
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/DefaultInstallerProviderServices.java | ||
---|---|---|
29 | 29 |
|
30 | 30 |
import java.io.File; |
31 | 31 |
import java.io.InputStream; |
32 |
import java.io.OutputStream; |
|
32 | 33 |
|
33 | 34 |
import org.gvsig.installer.lib.api.InstallerInfo; |
35 |
import org.gvsig.installer.lib.api.creation.InstallerCreationServiceException; |
|
34 | 36 |
import org.gvsig.installer.lib.api.execution.InstallerExecutionServiceException; |
37 |
import org.gvsig.installer.lib.impl.creation.Compress; |
|
35 | 38 |
import org.gvsig.installer.lib.impl.execution.Decompress; |
36 |
import org.gvsig.installer.lib.impl.info.InstallerInfoFileException; |
|
39 |
import org.gvsig.installer.lib.impl.info.InstallerInfoFileReader; |
|
40 |
import org.gvsig.installer.lib.impl.info.InstallerInfoFileWriter; |
|
41 |
import org.gvsig.installer.lib.spi.InstallerInfoFileException; |
|
37 | 42 |
import org.gvsig.installer.lib.spi.InstallerProviderServices; |
38 | 43 |
import org.gvsig.tools.service.spi.AbstractProviderServices; |
39 | 44 |
|
... | ... | |
41 | 46 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
42 | 47 |
*/ |
43 | 48 |
public class DefaultInstallerProviderServices extends AbstractProviderServices implements InstallerProviderServices{ |
44 |
|
|
49 |
private static final String INSTALL_INFO_FILE = "install.info"; |
|
50 |
|
|
45 | 51 |
public void decompress(InputStream is, File outputDirectory) throws InstallerExecutionServiceException { |
46 | 52 |
Decompress decompress = new Decompress(); |
47 | 53 |
decompress.decompressPlugin(is, outputDirectory); |
... | ... | |
56 | 62 |
} |
57 | 63 |
} |
58 | 64 |
|
65 |
public void compress(File directory, String fileName, OutputStream os) |
|
66 |
throws InstallerCreationServiceException { |
|
67 |
Compress compress = new Compress(); |
|
68 |
compress.compressPlugin(directory, fileName, os); |
|
69 |
|
|
70 |
} |
|
71 |
|
|
72 |
public void readInstallInfo(File directory, InstallerInfo installerInfo) throws InstallerInfoFileException { |
|
73 |
File installInfoFile = new File (directory + File.separator + INSTALL_INFO_FILE); |
|
74 |
if (installInfoFile.exists()){ |
|
75 |
InstallerInfoFileReader reader = new InstallerInfoFileReader(); |
|
76 |
reader.read(installerInfo, installInfoFile.getAbsolutePath()); |
|
77 |
}else{ |
|
78 |
installerInfo.setCode(directory.getName()); |
|
79 |
installerInfo.setName(directory.getName()); |
|
80 |
} |
|
81 |
} |
|
82 |
|
|
83 |
public void writeInstallInfo(File directory, InstallerInfo installerInfo) throws InstallerInfoFileException { |
|
84 |
if (!directory.exists()){ |
|
85 |
throw new InstallerInfoFileException("The directory doesn't exist"); |
|
86 |
} |
|
87 |
InstallerInfoFileWriter installerInfoFileWriter = new InstallerInfoFileWriter(); |
|
88 |
installerInfoFileWriter.write(installerInfo, directory);// + File.separator + INSTALL_INFO_FILE); |
|
89 |
} |
|
90 |
|
|
91 |
public InputStream searchPlugin(InputStream is, String zipEntry) throws InstallerExecutionServiceException { |
|
92 |
Decompress decompress = new Decompress(); |
|
93 |
return decompress.searchPlugin(is, zipEntry); |
|
94 |
} |
|
95 |
|
|
59 | 96 |
} |
60 | 97 |
|
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 | ||
---|---|---|
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 |
} |
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/Decompress.java | ||
---|---|---|
44 | 44 |
import org.gvsig.installer.lib.api.execution.InstallerExecutionServiceException; |
45 | 45 |
import org.gvsig.installer.lib.impl.DefaultInstallerInfo; |
46 | 46 |
import org.gvsig.installer.lib.impl.creation.DefaultInstallerCreationService; |
47 |
import org.gvsig.installer.lib.impl.info.InstallerInfoFileException; |
|
48 | 47 |
import org.gvsig.installer.lib.impl.info.InstallerInfoFileReader; |
48 |
import org.gvsig.installer.lib.spi.InstallerInfoFileException; |
|
49 | 49 |
import org.gvsig.installer.lib.spi.InstallerProviderLocator; |
50 | 50 |
import org.gvsig.installer.lib.spi.InstallerProviderManager; |
51 | 51 |
import org.slf4j.Logger; |
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 | ||
---|---|---|
47 | 47 |
import org.gvsig.installer.lib.impl.DefaultInstallerInfo; |
48 | 48 |
import org.gvsig.installer.lib.impl.info.InstallerInfoFileReader; |
49 | 49 |
import org.gvsig.installer.lib.impl.info.InstallerInfoFileWriter; |
50 |
import org.gvsig.installer.lib.spi.InstallerProviderLocator; |
|
51 |
import org.gvsig.installer.lib.spi.InstallerProviderServices; |
|
50 | 52 |
import org.gvsig.tools.service.Manager; |
51 | 53 |
import org.slf4j.Logger; |
52 | 54 |
|
... | ... | |
66 | 68 |
private int pluginToInstallIndex = -1; |
67 | 69 |
protected List<File> selectedFiles = null; |
68 | 70 |
protected String antScript = null; |
69 |
|
|
71 |
private InstallerProviderServices installerProviderServices = null; |
|
72 |
|
|
70 | 73 |
public DefaultInstallerCreationService(Manager manager) { |
71 | 74 |
super(); |
72 | 75 |
this.manager = manager; |
73 | 76 |
installerInfos = new ArrayList<InstallerInfo>(); |
74 | 77 |
directories = new HashMap<InstallerInfo, String>(); |
75 | 78 |
selectedFiles = new ArrayList<File>(); |
79 |
installerProviderServices = InstallerProviderLocator.getProviderManager().createInstallerProviderServices(); |
|
76 | 80 |
} |
77 | 81 |
|
78 | 82 |
public void createInstaller(OutputStream installerStream) |
... | ... | |
93 | 97 |
//Copy the selected files |
94 | 98 |
writeSelectedFiles(); |
95 | 99 |
|
96 |
Compress compress = new Compress(); |
|
100 |
|
|
97 | 101 |
InstallerInfo infInstallerInfo = getSelectedPlugin(); |
98 | 102 |
String pluginFileName = getSelectedPlugin().getCode() + "-" + infInstallerInfo.getVersion() + "-" + infInstallerInfo.getBuild(); |
99 |
compress.compressPlugin(getAbsoluteSelectePluginFile(), pluginFileName, installerStream);
|
|
103 |
installerProviderServices.compress(getAbsoluteSelectePluginFile(), pluginFileName, installerStream);
|
|
100 | 104 |
} |
101 | 105 |
|
102 | 106 |
|
103 | 107 |
private void writeInstallInfo() throws InstallerCreationServiceException{ |
104 |
InstallerInfoFileWriter installerInfoFileWriter = new InstallerInfoFileWriter(); |
|
105 |
installerInfoFileWriter.write(getSelectedInstallerInfo(), new File(directories.get(getSelectedInstallerInfo()))); |
|
108 |
installerProviderServices.writeInstallInfo(new File(directories.get(getSelectedInstallerInfo())), getSelectedInstallerInfo()); |
|
106 | 109 |
} |
107 | 110 |
|
108 | 111 |
private void writeSelectedFiles() throws InstallerCreationServiceException { |
... | ... | |
206 | 209 |
|
207 | 210 |
//Read all the installed plugins |
208 | 211 |
String[] plugins = pluginsDirectory.list(); |
209 |
InstallerInfoFileReader reader = new InstallerInfoFileReader(); |
|
212 |
|
|
210 | 213 |
if (plugins != null) { |
211 | 214 |
for (int i=0; i<plugins.length; i++) |
212 | 215 |
{ |
213 | 216 |
String pluginDirectoryName = plugins[i]; |
214 | 217 |
File pluginDirectory = getAbsolutePluginFile(pluginDirectoryName); |
215 | 218 |
DefaultInstallerInfo installerInfo = new DefaultInstallerInfo(); |
216 |
//Check if the install info file exists |
|
217 |
File installInfoFile = new File(getInstallerInfoFileName(pluginDirectory.getAbsolutePath())); |
|
218 |
if (installInfoFile.exists()){ |
|
219 |
reader.read(installerInfo, installInfoFile); |
|
220 |
}else{ |
|
221 |
installerInfo.setCode(pluginDirectoryName); |
|
222 |
installerInfo.setName(pluginDirectoryName); |
|
223 |
} |
|
219 |
|
|
220 |
installerProviderServices.readInstallInfo(new File(pluginDirectory.getAbsolutePath()), installerInfo); |
|
221 |
|
|
224 | 222 |
//Checks if the ant file exists |
225 | 223 |
File antFile = new File(getAntFileName(pluginDirectory.getAbsolutePath())); |
226 | 224 |
if (antFile.exists()){ |
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/info/InstallerInfoFileException.java | ||
---|---|---|
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.lib.impl.info; |
|
29 |
|
|
30 |
import org.gvsig.installer.lib.api.creation.InstallerCreationServiceException; |
|
31 |
import org.gvsig.tools.exception.BaseException; |
|
32 |
|
|
33 |
/** |
|
34 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
35 |
*/ |
|
36 |
public class InstallerInfoFileException extends InstallerCreationServiceException { |
|
37 |
private static final long serialVersionUID = -5388898489108649788L; |
|
38 |
|
|
39 |
private static final String KEY = "install_infofile_exception"; |
|
40 |
|
|
41 |
/** |
|
42 |
* @see BaseException#BaseException(String, String, long) |
|
43 |
*/ |
|
44 |
public InstallerInfoFileException(String message) { |
|
45 |
super(message, KEY, serialVersionUID); |
|
46 |
} |
|
47 |
|
|
48 |
/** |
|
49 |
* @see BaseException#BaseException(String, Throwable) |
|
50 |
*/ |
|
51 |
public InstallerInfoFileException(String message, Throwable cause) { |
|
52 |
super(message, cause, KEY, serialVersionUID); |
|
53 |
} |
|
54 |
|
|
55 |
/** |
|
56 |
* @see BaseException#BaseException(String, String, long) |
|
57 |
*/ |
|
58 |
public InstallerInfoFileException(String message, String key, long code) { |
|
59 |
super(message, key, code); |
|
60 |
} |
|
61 |
|
|
62 |
} |
|
63 |
|
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/info/InstallerInfoFileWriter.java | ||
---|---|---|
35 | 35 |
import java.util.Properties; |
36 | 36 |
|
37 | 37 |
import org.gvsig.installer.lib.api.InstallerInfo; |
38 |
import org.gvsig.installer.lib.spi.InstallerInfoFileException; |
|
38 | 39 |
|
39 | 40 |
/** |
40 | 41 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
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/info/InstallerInfoFileReader.java | ||
---|---|---|
35 | 35 |
import java.util.Properties; |
36 | 36 |
|
37 | 37 |
import org.gvsig.installer.lib.api.InstallerInfo; |
38 |
import org.gvsig.installer.lib.spi.InstallerInfoFileException; |
|
38 | 39 |
|
39 | 40 |
|
40 | 41 |
/** |
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/info/NotPropertyFoundException.java | ||
---|---|---|
30 | 30 |
import java.util.HashMap; |
31 | 31 |
import java.util.Map; |
32 | 32 |
|
33 |
import org.gvsig.installer.lib.spi.InstallerInfoFileException; |
|
33 | 34 |
|
35 |
|
|
34 | 36 |
/** |
35 | 37 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
36 | 38 |
*/ |
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/info/InstallerInfoFileWriterTest.java | ||
---|---|---|
32 | 32 |
|
33 | 33 |
import org.gvsig.installer.lib.api.InstallerInfo; |
34 | 34 |
import org.gvsig.installer.lib.impl.DefaultInstallerInfo; |
35 |
import org.gvsig.installer.lib.spi.InstallerInfoFileException; |
|
35 | 36 |
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase; |
36 | 37 |
import org.gvsig.tools.locator.LocatorException; |
37 | 38 |
|
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/info/InstallerInfoFileReaderTest.java | ||
---|---|---|
31 | 31 |
import java.io.FileNotFoundException; |
32 | 32 |
|
33 | 33 |
import org.gvsig.installer.lib.impl.DefaultInstallerInfo; |
34 |
import org.gvsig.installer.lib.spi.InstallerInfoFileException; |
|
34 | 35 |
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase; |
35 | 36 |
import org.gvsig.tools.locator.LocatorException; |
36 | 37 |
|
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 | ||
---|---|---|
100 | 100 |
InstallerExecutionService installerExecutionService = |
101 | 101 |
InstallerLocator.getInstallerManager().getInstallerExecutionService(); |
102 | 102 |
installerExecutionService.setApplicationDirectory(applicationDirectory); |
103 |
installerExecutionService.setPluginToInstall("org.gvsig.plugin1"); |
|
104 |
|
|
103 |
|
|
105 | 104 |
Exception exc = null; |
106 | 105 |
try{ |
107 |
installerExecutionService.executeInstaller();
|
|
106 |
installerExecutionService.setPluginToInstall("org.gvsig.plugin1");
|
|
108 | 107 |
}catch(InstallerExecutionServiceException e){ |
109 | 108 |
exc = e; |
110 | 109 |
} |
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.impl/src/main/java/org/gvsig/installer/swing/impl/execution/wizard/ProgressWizard.java | ||
---|---|---|
91 | 91 |
setFinishedText(); |
92 | 92 |
}catch(InstallerExecutionServiceException e){ |
93 | 93 |
setExceptionText(e); |
94 |
} catch (InstallerCreationServiceException e) { |
|
95 |
setExceptionText(e); |
|
96 |
} |
|
94 |
} |
|
97 | 95 |
setProgress(100); |
98 | 96 |
} |
99 | 97 |
} |
Also available in: Unified diff