svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.installer / org.gvsig.installer.lib / org.gvsig.installer.lib.spi / src / main / java / org / gvsig / installer / lib / spi / InstallPackageProviderServices.java @ 43126
History | View | Annotate | Download (7.48 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
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 3
|
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 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
/*
|
25 |
* AUTHORS (In addition to CIT):
|
26 |
* 2010 {Prodevelop} {Task}
|
27 |
*/
|
28 |
|
29 |
package org.gvsig.installer.lib.spi; |
30 |
|
31 |
import java.io.File; |
32 |
import java.io.InputStream; |
33 |
import java.io.OutputStream; |
34 |
import java.util.List; |
35 |
import java.util.Map; |
36 |
import java.util.Properties; |
37 |
|
38 |
import org.gvsig.installer.lib.api.PackageInfo; |
39 |
import org.gvsig.installer.lib.api.creation.MakePluginPackageServiceException; |
40 |
import org.gvsig.installer.lib.api.execution.InstallPackageServiceException; |
41 |
import org.gvsig.tools.service.spi.ProviderServices; |
42 |
import org.gvsig.tools.task.SimpleTaskStatus; |
43 |
|
44 |
/**
|
45 |
* Services that can be used by the providers to create or exceute the bundle.
|
46 |
* It contains methods to compress and to decompress files and methods to read
|
47 |
* an install a package file from a directory.
|
48 |
*
|
49 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a>
|
50 |
*/
|
51 |
public interface InstallPackageProviderServices extends ProviderServices { |
52 |
|
53 |
/**
|
54 |
* It decompress an input stream and write it on a directory.
|
55 |
*
|
56 |
* @param is
|
57 |
* The input stream to decompress
|
58 |
* @param outputDirectory
|
59 |
* . The output directory.
|
60 |
* @throws InstallPackageServiceException
|
61 |
* If there is a problem decompressing the stream.
|
62 |
*/
|
63 |
public void decompress(InputStream is, File outputDirectory) |
64 |
throws InstallPackageServiceException;
|
65 |
|
66 |
/**
|
67 |
* Compress a folder as a zipped package set in the given outputstream with
|
68 |
* a concrete name.
|
69 |
*
|
70 |
* @param folder
|
71 |
* the folder to compress.
|
72 |
* @param fileName
|
73 |
* name of the zip entry that has the output file. The name that
|
74 |
* have to have
|
75 |
* @param os
|
76 |
* output stream to write the output.
|
77 |
* @throws MakePluginPackageServiceException
|
78 |
* if there is any problem compressing.
|
79 |
*/
|
80 |
public void compressPackageSet(File folder, String fileName, OutputStream os) |
81 |
throws MakePluginPackageServiceException;
|
82 |
|
83 |
/**
|
84 |
* Compress a plugin folder using the plugin's name as a package.
|
85 |
*
|
86 |
* @param folder
|
87 |
* the directory to compress.
|
88 |
* @param os
|
89 |
* output stream to write the output.
|
90 |
* @throws MakePluginPackageServiceException
|
91 |
* if there is any problem compressing.
|
92 |
*/
|
93 |
public void compressPackage(File folder, OutputStream os) |
94 |
throws MakePluginPackageServiceException;
|
95 |
|
96 |
/**
|
97 |
* Compress a plugin folder using the plugin's name as a package, only with
|
98 |
* the files needed by the package index.
|
99 |
*
|
100 |
* @param folder
|
101 |
* the directory to compress.
|
102 |
* @param os
|
103 |
* output stream to write the output.
|
104 |
* @throws MakePluginPackageServiceException
|
105 |
* if there is any problem compressing.
|
106 |
*/
|
107 |
public void compressPackageIndex(File folder, OutputStream os) |
108 |
throws MakePluginPackageServiceException;
|
109 |
|
110 |
/**
|
111 |
* Reads the package.info file from a directory a fills the the properties
|
112 |
* of the {@link PackageInfo} object.
|
113 |
*
|
114 |
* @param directory
|
115 |
* the root directory that contains the installinfo file
|
116 |
* @param installInfo
|
117 |
* the installinfo file that has to be filled.
|
118 |
* @throws InstallerInfoFileException. if there is any problem reading the
|
119 |
* file
|
120 |
*/
|
121 |
public void readPackageInfo(File directory, PackageInfo installerInfo) |
122 |
throws InstallerInfoFileException;
|
123 |
|
124 |
/**
|
125 |
* Reads the package.info file from a package set and fills the the
|
126 |
* properties of the {@link PackageInfo} objects.
|
127 |
*
|
128 |
* @param is
|
129 |
* the input stream of a bundle.
|
130 |
* @param packageInfos
|
131 |
* a list of the information of the packages to install.
|
132 |
* @param zipEntriesMap
|
133 |
* a map to retrieve the zipEntry for every package. This
|
134 |
* information is necessary to select the plugin to decompress.
|
135 |
* @throws InstallPackageServiceException
|
136 |
* if there is a problem reading the bundle.
|
137 |
*/
|
138 |
public void readPackageSetInfo(InputStream is, |
139 |
List<PackageInfo> packageInfos,
|
140 |
Map<PackageInfo, String> zipEntriesMap, SimpleTaskStatus taskStatus) |
141 |
throws InstallPackageServiceException;
|
142 |
|
143 |
/**
|
144 |
* Reads the package.info file from a bundle fills the the properties of the
|
145 |
* {@link PackageInfo} objects.
|
146 |
*
|
147 |
* @param is
|
148 |
* the input stream of a bundle.
|
149 |
* @param packageInfos
|
150 |
* a list of the information of the packages to install.
|
151 |
* @param zipEntriesMap
|
152 |
* a map to retrieve the zipEntry for every package. This
|
153 |
* information is necessary to select the plugin to decompress.
|
154 |
* @throws InstallPackageServiceException
|
155 |
* if there is a problem reading the bundle.
|
156 |
*/
|
157 |
public void readPackageInfo(InputStream is, List<PackageInfo> packageInfos, |
158 |
Map<PackageInfo, String> zipEntriesMap, String name, SimpleTaskStatus taskStatus) |
159 |
throws InstallPackageServiceException;
|
160 |
|
161 |
/**
|
162 |
* Writes the package.info file in a concrete directory.
|
163 |
*
|
164 |
* @param directory
|
165 |
* the directory.
|
166 |
* @param packageInfo
|
167 |
* the information to write.
|
168 |
* @throws InstallerInfoFileException
|
169 |
* if there is any problem writing the package.info file.
|
170 |
*/
|
171 |
public void writePackageInfo(File directory, PackageInfo packageInfo) |
172 |
throws InstallerInfoFileException;
|
173 |
|
174 |
/**
|
175 |
* Writes the package.info file in a concrete directory to be used in a
|
176 |
* package index.
|
177 |
*
|
178 |
* @param directory
|
179 |
* the directory.
|
180 |
* @param packageInfo
|
181 |
* the information to write.
|
182 |
* @throws InstallerInfoFileException
|
183 |
* if there is any problem writing the package.info file.
|
184 |
*/
|
185 |
public void writePackageInfoForIndex(File directory, PackageInfo packageInfo) |
186 |
throws InstallerInfoFileException;
|
187 |
|
188 |
/**
|
189 |
* It search a package inside an installer file by the zip name and returns
|
190 |
* the stream in this position ready to decompres.
|
191 |
*
|
192 |
* @param is
|
193 |
* the input stream of a bundle.
|
194 |
* @param zipEntry
|
195 |
* the name of the zip entry.
|
196 |
* @return the input stream ready to install.
|
197 |
* @throws InstallPackageServiceException
|
198 |
* if there is a problem reading the stream
|
199 |
*/
|
200 |
public InputStream searchPackage(InputStream is, String zipEntry) |
201 |
throws InstallPackageServiceException;
|
202 |
|
203 |
/**
|
204 |
* It reads a compressed file and retrieve the package information.
|
205 |
*
|
206 |
* @param is
|
207 |
* the compressed file
|
208 |
* @return the information of the package
|
209 |
* @throws InstallPackageServiceException
|
210 |
* if there is a problem decompressing the file.
|
211 |
*/
|
212 |
public PackageInfo readCompressedPackageInfo(InputStream is) |
213 |
throws InstallPackageServiceException;
|
214 |
|
215 |
public List<String> getDefaultSelectedPackagesIDs(); |
216 |
|
217 |
public Properties getProperties(); |
218 |
} |