svn-gvsig-desktop / 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 @ 32563
History | View | Annotate | Download (4.75 KB)
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 java.io.File; |
31 |
import java.io.InputStream; |
32 |
import java.io.OutputStream; |
33 |
import java.util.List; |
34 |
import java.util.Map; |
35 |
|
36 |
import org.gvsig.installer.lib.api.PackageInfo; |
37 |
import org.gvsig.installer.lib.api.creation.MakePluginPackageServiceException; |
38 |
import org.gvsig.installer.lib.api.execution.InstallPackageServiceException; |
39 |
import org.gvsig.tools.service.spi.ProviderServices; |
40 |
|
41 |
/**
|
42 |
* Services that can be used by the providers to create the installer. It
|
43 |
* contains methods to compress and to decompress files and methods to
|
44 |
* read an install info file from a directory.
|
45 |
*
|
46 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a>
|
47 |
*/
|
48 |
public interface InstallerProviderServices extends ProviderServices{ |
49 |
|
50 |
/**
|
51 |
* It decompress an input stream and write it on a directory.
|
52 |
* @param is
|
53 |
* The input stream to decompress
|
54 |
* @param outputDirectory.
|
55 |
* The output directory.
|
56 |
* @throws InstallPackageServiceException
|
57 |
* If there is a problem decompressing the stream.
|
58 |
*/
|
59 |
public void decompress(InputStream is, File outputDirectory) throws InstallPackageServiceException; |
60 |
|
61 |
/**
|
62 |
* Compress a directory like an zipped outputstream with a concrete name.
|
63 |
* @param directory
|
64 |
* The directory to compress.
|
65 |
* @param fileName
|
66 |
* Name of the zip entry that has the output file.
|
67 |
* The name that have to have
|
68 |
* @param os
|
69 |
* Output stream to write the output.
|
70 |
* @throws MakePluginPackageServiceException
|
71 |
* If there is any problem compressing.
|
72 |
*/
|
73 |
public void compress(File directory, String fileName, OutputStream os) throws MakePluginPackageServiceException; |
74 |
|
75 |
/**
|
76 |
* Reads an installer info from a directory a fills the the properties
|
77 |
* of an installerinfo.
|
78 |
* @param directory
|
79 |
* The root directory that contains the installinfo file
|
80 |
* @param installInfo
|
81 |
* The installinfo file that has to be filled.
|
82 |
* @throws InstallerInfoFileException.
|
83 |
* If there is any problem reading the file
|
84 |
*/
|
85 |
public void readInstallInfo(File directory, PackageInfo installerInfo) throws InstallerInfoFileException; |
86 |
|
87 |
/**
|
88 |
* It reads an installer and parses all the install.info files.
|
89 |
* @param is
|
90 |
* The installer.
|
91 |
* @param installerInfos
|
92 |
* A list of the information of the plugins to install.
|
93 |
* @param zipEntriesMap
|
94 |
* A map to retrieve the zipEntry name for each plugin. This information is necessary to
|
95 |
* select the plugin to decompress.
|
96 |
* @throws InstallPackageServiceException
|
97 |
* If there is a problem reading the installer.
|
98 |
*/
|
99 |
public void readInstallInfo(InputStream is, List<PackageInfo> installerInfos, Map<PackageInfo, String> zipEntriesMap) throws InstallPackageServiceException; |
100 |
|
101 |
/**
|
102 |
* Writes the install.info file in a concrete directory.
|
103 |
* @param directory
|
104 |
* The directory.
|
105 |
* @param installerInfo
|
106 |
* The information to write.
|
107 |
* @throws InstallerInfoFileException
|
108 |
* If there is any problem writing the install.info file.
|
109 |
*/
|
110 |
public void writeInstallInfo(File directory, PackageInfo installerInfo) throws InstallerInfoFileException; |
111 |
|
112 |
/**
|
113 |
* It search a plugin inside an installer file by the zip name and returns
|
114 |
* the stream in this position ready to decompres.
|
115 |
* @param is
|
116 |
* The installer.
|
117 |
* @param zipEntry
|
118 |
* The name of the zip entry.
|
119 |
* @return
|
120 |
* The input stream ready to install.
|
121 |
* @throws InstallPackageServiceException
|
122 |
* If there is a problem reading the stream
|
123 |
*/
|
124 |
public InputStream searchPlugin(InputStream is, String zipEntry) throws InstallPackageServiceException; |
125 |
|
126 |
/**
|
127 |
* It reads a compressed file and retrieve the installer information.
|
128 |
* @param is
|
129 |
* The compressed file
|
130 |
* @return
|
131 |
* The information of the installer
|
132 |
* @throws InstallPackageServiceException
|
133 |
* If there is a problem decompressing the file.
|
134 |
*/
|
135 |
public PackageInfo readCompressedInstallInfo(InputStream is) throws InstallPackageServiceException; |
136 |
} |
137 |
|