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 @ 40560
History | View | Annotate | Download (7.3 KB)
1 | 40560 | jjdelcerro | /**
|
---|---|---|---|
2 | * gvSIG. Desktop Geographic Information System.
|
||
3 | 40435 | jjdelcerro | *
|
4 | 40560 | jjdelcerro | * Copyright (C) 2007-2013 gvSIG Association.
|
5 | *
|
||
6 | 40435 | jjdelcerro | * This program is free software; you can redistribute it and/or
|
7 | * modify it under the terms of the GNU General Public License
|
||
8 | 40560 | jjdelcerro | * as published by the Free Software Foundation; either version 3
|
9 | 40435 | jjdelcerro | * of the License, or (at your option) any later version.
|
10 | 40560 | jjdelcerro | *
|
11 | 40435 | jjdelcerro | * 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 | 40560 | jjdelcerro | *
|
16 | 40435 | jjdelcerro | * 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 | 40560 | jjdelcerro | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 | 40435 | jjdelcerro | * MA 02110-1301, USA.
|
20 | 40560 | jjdelcerro | *
|
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 | 40435 | jjdelcerro | */
|
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 | |||
37 | import org.gvsig.installer.lib.api.PackageInfo; |
||
38 | import org.gvsig.installer.lib.api.creation.MakePluginPackageServiceException; |
||
39 | import org.gvsig.installer.lib.api.execution.InstallPackageServiceException; |
||
40 | import org.gvsig.tools.service.spi.ProviderServices; |
||
41 | |||
42 | /**
|
||
43 | * Services that can be used by the providers to create or exceute the bundle.
|
||
44 | * It contains methods to compress and to decompress files and methods to read
|
||
45 | * an install a package file from a directory.
|
||
46 | *
|
||
47 | * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a>
|
||
48 | */
|
||
49 | public interface InstallPackageProviderServices extends ProviderServices { |
||
50 | |||
51 | /**
|
||
52 | * It decompress an input stream and write it on a directory.
|
||
53 | *
|
||
54 | * @param is
|
||
55 | * The input stream to decompress
|
||
56 | * @param outputDirectory
|
||
57 | * . The output directory.
|
||
58 | * @throws InstallPackageServiceException
|
||
59 | * If there is a problem decompressing the stream.
|
||
60 | */
|
||
61 | public void decompress(InputStream is, File outputDirectory) |
||
62 | throws InstallPackageServiceException;
|
||
63 | |||
64 | /**
|
||
65 | * Compress a folder as a zipped package set in the given outputstream with
|
||
66 | * a concrete name.
|
||
67 | *
|
||
68 | * @param folder
|
||
69 | * the folder to compress.
|
||
70 | * @param fileName
|
||
71 | * name of the zip entry that has the output file. The name that
|
||
72 | * have to have
|
||
73 | * @param os
|
||
74 | * output stream to write the output.
|
||
75 | * @throws MakePluginPackageServiceException
|
||
76 | * if there is any problem compressing.
|
||
77 | */
|
||
78 | public void compressPackageSet(File folder, String fileName, OutputStream os) |
||
79 | throws MakePluginPackageServiceException;
|
||
80 | |||
81 | /**
|
||
82 | * Compress a plugin folder using the plugin's name as a package.
|
||
83 | *
|
||
84 | * @param folder
|
||
85 | * the directory to compress.
|
||
86 | * @param os
|
||
87 | * output stream to write the output.
|
||
88 | * @throws MakePluginPackageServiceException
|
||
89 | * if there is any problem compressing.
|
||
90 | */
|
||
91 | public void compressPackage(File folder, OutputStream os) |
||
92 | throws MakePluginPackageServiceException;
|
||
93 | |||
94 | /**
|
||
95 | * Compress a plugin folder using the plugin's name as a package, only with
|
||
96 | * the files needed by the package index.
|
||
97 | *
|
||
98 | * @param folder
|
||
99 | * the directory to compress.
|
||
100 | * @param os
|
||
101 | * output stream to write the output.
|
||
102 | * @throws MakePluginPackageServiceException
|
||
103 | * if there is any problem compressing.
|
||
104 | */
|
||
105 | public void compressPackageIndex(File folder, OutputStream os) |
||
106 | throws MakePluginPackageServiceException;
|
||
107 | |||
108 | /**
|
||
109 | * Reads the package.info file from a directory a fills the the properties
|
||
110 | * of the {@link PackageInfo} object.
|
||
111 | *
|
||
112 | * @param directory
|
||
113 | * the root directory that contains the installinfo file
|
||
114 | * @param installInfo
|
||
115 | * the installinfo file that has to be filled.
|
||
116 | * @throws InstallerInfoFileException. if there is any problem reading the
|
||
117 | * file
|
||
118 | */
|
||
119 | public void readPackageInfo(File directory, PackageInfo installerInfo) |
||
120 | throws InstallerInfoFileException;
|
||
121 | |||
122 | /**
|
||
123 | * Reads the package.info file from a package set and fills the the
|
||
124 | * properties of the {@link PackageInfo} objects.
|
||
125 | *
|
||
126 | * @param is
|
||
127 | * the input stream of a bundle.
|
||
128 | * @param packageInfos
|
||
129 | * a list of the information of the packages to install.
|
||
130 | * @param zipEntriesMap
|
||
131 | * a map to retrieve the zipEntry for every package. This
|
||
132 | * information is necessary to select the plugin to decompress.
|
||
133 | * @throws InstallPackageServiceException
|
||
134 | * if there is a problem reading the bundle.
|
||
135 | */
|
||
136 | public void readPackageSetInfo(InputStream is, |
||
137 | List<PackageInfo> packageInfos,
|
||
138 | Map<PackageInfo, String> zipEntriesMap) |
||
139 | throws InstallPackageServiceException;
|
||
140 | |||
141 | /**
|
||
142 | * Reads the package.info file from a bundle fills the the properties of the
|
||
143 | * {@link PackageInfo} objects.
|
||
144 | *
|
||
145 | * @param is
|
||
146 | * the input stream of a bundle.
|
||
147 | * @param packageInfos
|
||
148 | * a list of the information of the packages to install.
|
||
149 | * @param zipEntriesMap
|
||
150 | * a map to retrieve the zipEntry for every package. This
|
||
151 | * information is necessary to select the plugin to decompress.
|
||
152 | * @throws InstallPackageServiceException
|
||
153 | * if there is a problem reading the bundle.
|
||
154 | */
|
||
155 | public void readPackageInfo(InputStream is, List<PackageInfo> packageInfos, |
||
156 | Map<PackageInfo, String> zipEntriesMap, String name) |
||
157 | throws InstallPackageServiceException;
|
||
158 | |||
159 | /**
|
||
160 | * Writes the package.info file in a concrete directory.
|
||
161 | *
|
||
162 | * @param directory
|
||
163 | * the directory.
|
||
164 | * @param packageInfo
|
||
165 | * the information to write.
|
||
166 | * @throws InstallerInfoFileException
|
||
167 | * if there is any problem writing the package.info file.
|
||
168 | */
|
||
169 | public void writePackageInfo(File directory, PackageInfo packageInfo) |
||
170 | throws InstallerInfoFileException;
|
||
171 | |||
172 | /**
|
||
173 | * Writes the package.info file in a concrete directory to be used in a
|
||
174 | * package index.
|
||
175 | *
|
||
176 | * @param directory
|
||
177 | * the directory.
|
||
178 | * @param packageInfo
|
||
179 | * the information to write.
|
||
180 | * @throws InstallerInfoFileException
|
||
181 | * if there is any problem writing the package.info file.
|
||
182 | */
|
||
183 | public void writePackageInfoForIndex(File directory, PackageInfo packageInfo) |
||
184 | throws InstallerInfoFileException;
|
||
185 | |||
186 | /**
|
||
187 | * It search a package inside an installer file by the zip name and returns
|
||
188 | * the stream in this position ready to decompres.
|
||
189 | *
|
||
190 | * @param is
|
||
191 | * the input stream of a bundle.
|
||
192 | * @param zipEntry
|
||
193 | * the name of the zip entry.
|
||
194 | * @return the input stream ready to install.
|
||
195 | * @throws InstallPackageServiceException
|
||
196 | * if there is a problem reading the stream
|
||
197 | */
|
||
198 | public InputStream searchPackage(InputStream is, String zipEntry) |
||
199 | throws InstallPackageServiceException;
|
||
200 | |||
201 | /**
|
||
202 | * It reads a compressed file and retrieve the package information.
|
||
203 | *
|
||
204 | * @param is
|
||
205 | * the compressed file
|
||
206 | * @return the information of the package
|
||
207 | * @throws InstallPackageServiceException
|
||
208 | * if there is a problem decompressing the file.
|
||
209 | */
|
||
210 | public PackageInfo readCompressedPackageInfo(InputStream is) |
||
211 | throws InstallPackageServiceException;
|
||
212 | |||
213 | public List<String> getDefaultSelectedPackagesIDs(); |
||
214 | |||
215 | } |