Statistics
| Revision:

svn-gvsig-desktop / branches / v2_0_0_prep / extensions / org.gvsig.installer / org.gvsig.installer.lib / org.gvsig.installer.lib.api / src / main / java / org / gvsig / installer / lib / api / execution / InstallPackageService.java @ 37599

History | View | Annotate | Download (6.47 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.api.execution;
29

    
30
import java.io.File;
31
import java.net.URL;
32
import java.util.List;
33

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

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

    
57
        public void reset();
58

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

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

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

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

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

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

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

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

    
165
        /**
166
         * Download the package and register it in the manager.
167
         * 
168
         * @param packageInfo
169
         */
170
        public void downloadPackage(PackageInfo packageInfo,
171
                        SimpleTaskStatus taskStatus) throws InstallPackageServiceException;
172

    
173
        /**
174
     * 
175
     */
176
        // public void resetPackages();
177

    
178
        /**
179
         * @return
180
         */
181
        public List<String> getDefaultSelectedPackagesIDs();
182

    
183
        /**
184
         * Gets the list of all the categories of *all* the packages.
185
         * 
186
         * @return a list with the categories of all the packages.
187
         */
188
        public List<String> getCategories();
189

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