svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.installer / org.gvsig.installer.lib / org.gvsig.installer.lib.api / src / main / java / org / gvsig / installer / lib / api / execution / InstallPackageService.java @ 40560
History | View | Annotate | Download (6.51 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.api.execution; |
30 |
|
31 |
import java.io.File; |
32 |
import java.net.URL; |
33 |
import java.util.List; |
34 |
|
35 |
import org.gvsig.installer.lib.api.InstallerManager; |
36 |
import org.gvsig.installer.lib.api.PackageInfo; |
37 |
import org.gvsig.installer.lib.api.creation.MakePluginPackageService; |
38 |
import org.gvsig.tools.service.Service; |
39 |
import org.gvsig.tools.task.SimpleTaskStatus; |
40 |
|
41 |
/**
|
42 |
* <p>
|
43 |
* This service is used to read a bundle file and install the packages contained
|
44 |
* in it. It has methods to read the packages contained in a bundle and to
|
45 |
* install one of them.
|
46 |
* </p>
|
47 |
* <p>
|
48 |
* The bundle is a file that has been created using the
|
49 |
* {@link MakePluginPackageService} service. It is possible to create an
|
50 |
* installer manually, but it has to have the structure defined by the
|
51 |
* {@link InstallerManager} class.
|
52 |
* </p>
|
53 |
*
|
54 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a>
|
55 |
*/
|
56 |
public interface InstallPackageService extends Service { |
57 |
|
58 |
public void reset(); |
59 |
|
60 |
/**
|
61 |
* Adds a the URI of a bundle that contains some packages to install. A
|
62 |
* bundle is a compressed zip file with a structure defined in the
|
63 |
* {@link InstallerManager} class.
|
64 |
*
|
65 |
* @param bundleURI
|
66 |
* the URI of a bundle.
|
67 |
* @throws InstallPackageServiceException
|
68 |
* it is thrown if there is an exception reading the URI.
|
69 |
*/
|
70 |
public void addBundle(File bundleFile) |
71 |
throws InstallPackageServiceException;
|
72 |
|
73 |
/**
|
74 |
* Adds a URL of a bundle that contains some packages to install. A bundle
|
75 |
* is a compressed zip file with a structure defined in the
|
76 |
* {@link InstallerManager} class.
|
77 |
*
|
78 |
* @param bundleURL
|
79 |
* the {@link URL} of a bundle.
|
80 |
* @throws InstallPackageServiceException
|
81 |
* it is thrown if there is an exception reading the {@link URL}
|
82 |
* .
|
83 |
*/
|
84 |
public void addBundle(URL bundleURL) throws InstallPackageServiceException; |
85 |
|
86 |
/**
|
87 |
* In reads a directory and reads all the bundles. This method retrieve all
|
88 |
* the information of the packages located in the bundles and allows to the
|
89 |
* user to show this information.
|
90 |
*
|
91 |
* @param bundlesDirectory
|
92 |
* a directory that contains bundles.
|
93 |
* @throws InstallPackageServiceException
|
94 |
* If there is any problem reading the directory of bundles.
|
95 |
*/
|
96 |
public void addBundlesFromDirectory(File bundlesDirectory) |
97 |
throws InstallPackageServiceException;
|
98 |
|
99 |
/**
|
100 |
* Install a package in a concrete gvSIG installation directory. The
|
101 |
* selected package has to be contained in one of the bundles that has been
|
102 |
* previously added using the {@link #addBundle(File)} or the
|
103 |
* {@link #addBundlesFromDirectory(File)} method.
|
104 |
*
|
105 |
* @param applicationDirectory
|
106 |
* a valid root directory where an instance og gvSIG is
|
107 |
* installed.
|
108 |
* @param packageInfo
|
109 |
* the package to install.
|
110 |
* @throws InstallPackageServiceException
|
111 |
* If there is an error installing the package.
|
112 |
*/
|
113 |
public void installPackage(File applicationDirectory, |
114 |
PackageInfo packageInfo) throws InstallPackageServiceException;
|
115 |
|
116 |
/**
|
117 |
* Install a package in a concrete gvSIG installation directory. The
|
118 |
* selected package has to be contained in one of the bundles that has been
|
119 |
* previously added using the {@link #addBundle(File)} or the
|
120 |
* {@link #addBundlesFromDirectory(File)} method.
|
121 |
*
|
122 |
* @param applicationDirectory
|
123 |
* a valid root directory where an instance og gvSIG is
|
124 |
* installed.
|
125 |
* @param packageCode
|
126 |
* the code of the package.
|
127 |
* @throws InstallPackageServiceException
|
128 |
* if there is an error installing the {@link PackageInfo#}
|
129 |
*/
|
130 |
public void installPackage(File applicationDirectory, String packageCode) |
131 |
throws InstallPackageServiceException;
|
132 |
|
133 |
/**
|
134 |
* @return the number of packages that has been loaded form one or more
|
135 |
* bundles using the {@link #addBundle(File)} or the
|
136 |
* {@link #addBundlesFromDirectory(File)} method.
|
137 |
*/
|
138 |
public int getPackageCount(); |
139 |
|
140 |
/**
|
141 |
* Return the package information for a concrete position. All the packages
|
142 |
* has been loaded form one or more bundles using the
|
143 |
* {@link #addBundle(File)} or the {@link #addBundlesFromDirectory(File)}
|
144 |
* method.
|
145 |
*
|
146 |
* @param index
|
147 |
* the position of the package.
|
148 |
* @return the information of a package. returns <code>null</code> if the
|
149 |
* package doesn't exist.
|
150 |
*/
|
151 |
public PackageInfo getPackageInfo(int index); |
152 |
|
153 |
/**
|
154 |
* Return the package information for a concrete position. All the packages
|
155 |
* has been loaded form one or more bundles using the
|
156 |
* {@link #addBundle(File)} or the {@link #addBundlesFromDirectory(File)}
|
157 |
* method.
|
158 |
*
|
159 |
* @param packageCode
|
160 |
* the code of the package.
|
161 |
* @return the information of a package. returns <code>null</code> if the
|
162 |
* package doesn't exist.
|
163 |
*/
|
164 |
public PackageInfo getPackageInfo(String packageCode); |
165 |
|
166 |
/**
|
167 |
* Download the package and register it in the manager.
|
168 |
*
|
169 |
* @param packageInfo
|
170 |
*/
|
171 |
public void downloadPackage(PackageInfo packageInfo, |
172 |
SimpleTaskStatus taskStatus) throws InstallPackageServiceException;
|
173 |
|
174 |
/**
|
175 |
*
|
176 |
*/
|
177 |
// public void resetPackages();
|
178 |
|
179 |
/**
|
180 |
* @return
|
181 |
*/
|
182 |
public List<String> getDefaultSelectedPackagesIDs(); |
183 |
|
184 |
/**
|
185 |
* Gets the list of all the categories of *all* the packages.
|
186 |
*
|
187 |
* @return a list with the categories of all the packages.
|
188 |
*/
|
189 |
public List<String> getCategories(); |
190 |
|
191 |
/**
|
192 |
* Gets the list of different the types of *all* the packages.
|
193 |
*
|
194 |
* @return a list with the types of packages.
|
195 |
*/
|
196 |
public List<String> getTypes(); |
197 |
} |