Statistics
| Revision:

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 @ 43126

History | View | Annotate | Download (7 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
import java.util.Properties;
35

    
36
import org.gvsig.installer.lib.api.InstallerManager;
37
import org.gvsig.installer.lib.api.PackageInfo;
38
import org.gvsig.installer.lib.api.creation.MakePluginPackageService;
39
import org.gvsig.tools.service.Service;
40
import org.gvsig.tools.task.SimpleTaskStatus;
41

    
42
/**
43
 * <p>
44
 * This service is used to read a bundle file and install the packages contained
45
 * in it. It has methods to read the packages contained in a bundle and to
46
 * install one of them.
47
 * </p>
48
 * <p>
49
 * The bundle is a file that has been created using the
50
 * {@link MakePluginPackageService} service. It is possible to create an
51
 * installer manually, but it has to have the structure defined by the
52
 * {@link InstallerManager} class.
53
 * </p>
54
 * 
55
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
56
 */
57
public interface InstallPackageService extends Service {
58

    
59
        public void reset();
60

    
61
        /**
62
         * Adds a the URI of a bundle that contains some packages to install. A
63
         * bundle is a compressed zip file with a structure defined in the
64
         * {@link InstallerManager} class.
65
         * 
66
         * @param bundleFile
67
         * @param taskStatus
68
         * @throws InstallPackageServiceException
69
         *             it is thrown if there is an exception reading the URI.
70
         */
71
        public void addBundle(File bundleFile, SimpleTaskStatus taskStatus)
72
                        throws InstallPackageServiceException;
73

    
74
        /**
75
         * Adds a URL of a bundle that contains some packages to install. A bundle
76
         * is a compressed zip file with a structure defined in the
77
         * {@link InstallerManager} class.
78
         * 
79
         * @param bundleURL
80
         *            the {@link URL} of a bundle.
81
         * @param taskStatus
82
         * @throws InstallPackageServiceException
83
         *             it is thrown if there is an exception reading the {@link URL}
84
         *             .
85
         */
86
        public void addBundle(URL bundleURL, SimpleTaskStatus taskStatus) throws InstallPackageServiceException;
87

    
88
        /**
89
         * In reads a directory and reads all the bundles. This method retrieve all
90
         * the information of the packages located in the bundles and allows to the
91
         * user to show this information.
92
         * 
93
         * @param bundlesDirectory
94
         *            a directory that contains bundles.
95
         * @param taskStatus
96
         * @throws InstallPackageServiceException
97
         *             If there is any problem reading the directory of bundles.
98
         */
99
        public void addBundlesFromDirectory(File bundlesDirectory, SimpleTaskStatus taskStatus)
100
                        throws InstallPackageServiceException;
101

    
102
        /**
103
         * Install a package in a concrete gvSIG installation directory. The
104
         * selected package has to be contained in one of the bundles that has been
105
         * previously added using the {@link #addBundle(File)} or the
106
         * {@link #addBundlesFromDirectory(File)} method.
107
         * 
108
         * @param applicationDirectory
109
         *            a valid root directory where an instance og gvSIG is
110
         *            installed.
111
         * @param packageInfo
112
         *            the package to install.
113
         * @throws InstallPackageServiceException
114
         *             If there is an error installing the package.
115
         */
116
        public void installPackage(File applicationDirectory,
117
                        PackageInfo packageInfo) throws InstallPackageServiceException;
118

    
119
        /**
120
         * Install a package in a concrete gvSIG installation directory. The
121
         * selected package has to be contained in one of the bundles that has been
122
         * previously added using the {@link #addBundle(File)} or the
123
         * {@link #addBundlesFromDirectory(File)} method.
124
         * 
125
         * @param applicationDirectory
126
         *            a valid root directory where an instance og gvSIG is
127
         *            installed.
128
         * @param packageCode
129
         *            the code of the package.
130
         * @throws InstallPackageServiceException
131
         *             if there is an error installing the {@link PackageInfo#}
132
         */
133
        public void installPackage(File applicationDirectory, String packageCode)
134
                        throws InstallPackageServiceException;
135

    
136
        /**
137
         * @return the number of packages that has been loaded form one or more
138
         *         bundles using the {@link #addBundle(File)} or the
139
         *         {@link #addBundlesFromDirectory(File)} method.
140
         */
141
        public int getPackageCount();
142

    
143
        /**
144
         * Return the package information for a concrete position. All the packages
145
         * has been loaded form one or more bundles using the
146
         * {@link #addBundle(File)} or the {@link #addBundlesFromDirectory(File)}
147
         * method.
148
         * 
149
         * @param index
150
         *            the position of the package.
151
         * @return the information of a package. returns <code>null</code> if the
152
         *         package doesn't exist.
153
         */
154
        public PackageInfo getPackageInfo(int index);
155

    
156
        /**
157
         * Return the package information for a concrete position. All the packages
158
         * has been loaded form one or more bundles using the
159
         * {@link #addBundle(File)} or the {@link #addBundlesFromDirectory(File)}
160
         * method.
161
         * 
162
         * @param packageCode
163
         *            the code of the package.
164
         * @return the information of a package. returns <code>null</code> if the
165
         *         package doesn't exist.
166
         */
167
        public PackageInfo getPackageInfo(String packageCode);
168

    
169
        /**
170
         * Download the package and register it in the manager.
171
         * 
172
         * @param packageInfo
173
         */
174
        public void downloadPackage(PackageInfo packageInfo,
175
                        SimpleTaskStatus taskStatus) throws InstallPackageServiceException;
176

    
177
        /**
178
         * @return
179
         */
180
        public List<String> getDefaultSelectedPackagesIDs();
181
        
182
        /**
183
         * Get the proprties associates to this bundle.
184
         * Return an empty Propertis if the bundle dont have a properties.
185
         * 
186
         * @return 
187
         */
188
        public Properties getProperties();
189

    
190
        /**
191
         * Gets the list of all the categories of *all* the packages.
192
         * 
193
         * @return a list with the categories of all the packages.
194
         */
195
        public List<String> getCategories();
196

    
197
        /**
198
         * Gets the list of different the types of *all* the packages.
199
         * 
200
         * @return a list with the types of packages.
201
         */
202
        public List<String> getTypes();
203
        
204
        public boolean needInstallPackageProviders();
205
        
206
        public void installPackageProviders(SimpleTaskStatus taskStatus);
207
}