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

History | View | Annotate | Download (6.1 KB)

1 32269 jpiera
/* gvSIG. Geographic Information System of the Valencian Government
2 33692 cordinyana
 *
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 32269 jpiera
23
/*
24 33692 cordinyana
 * AUTHORS (In addition to CIT):
25
 * 2010 {Prodevelop}   {Task}
26
 */
27
28 32269 jpiera
package org.gvsig.installer.lib.api.execution;
29
30
import java.io.File;
31 33982 cordinyana
import java.net.URL;
32 32269 jpiera
33 32597 jpiera
import org.gvsig.installer.lib.api.InstallerManager;
34 32562 jpiera
import org.gvsig.installer.lib.api.PackageInfo;
35
import org.gvsig.installer.lib.api.creation.MakePluginPackageService;
36 32400 jpiera
import org.gvsig.tools.service.Service;
37 32269 jpiera
38
/**
39 32333 jpiera
 * <p>
40 33692 cordinyana
 * This service is used to read a bundle file and install the packages contained
41
 * in it. It has methods to read the packages contained in a bundle and to
42
 * install one of them.
43 32333 jpiera
 * </p>
44
 * <p>
45 33692 cordinyana
 * The bundle is a file that has been created using the
46
 * {@link MakePluginPackageService} service. It is possible to create an
47
 * installer manually, but it has to have the structure defined by the
48
 * {@link InstallerManager} class.
49 32333 jpiera
 * </p>
50 33692 cordinyana
 *
51 32269 jpiera
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
52
 */
53 33692 cordinyana
public interface InstallPackageService extends Service {
54
55
    /**
56
     * Adds a the URI of a bundle that contains some packages to install. A
57
     * bundle
58
     * is a compressed zip file with a structure defined in the
59
     * {@link InstallerManager} class.
60
     *
61
     * @param bundleURI
62
     *            the URI of a bundle.
63
     * @throws InstallPackageServiceException
64
     *             it is thrown if there is an exception reading the URI.
65
     */
66 33743 cordinyana
    public void addBundle(File bundleFile)
67
        throws InstallPackageServiceException;
68 33692 cordinyana
69
    /**
70 33982 cordinyana
     * Adds a URL of a bundle that contains some packages to install. A
71
     * bundle is a compressed zip file with a structure defined in the
72
     * {@link InstallerManager} class.
73
     *
74
     * @param bundleURL
75
     *            the {@link URL} of a bundle.
76
     * @throws InstallPackageServiceException
77
     *             it is thrown if there is an exception reading the {@link URL}
78
     *             .
79
     */
80
    public void addBundle(URL bundleURL) throws InstallPackageServiceException;
81
82
    /**
83 33692 cordinyana
     * In reads a directory and reads all the bundles. This method retrieve
84
     * all the information of the packages located in the bundles and allows to
85
     * the
86
     * user to show this information.
87
     *
88
     * @param bundlesDirectory
89
     *            a directory that contains bundles.
90
     * @throws InstallPackageServiceException
91
     *             If there is any problem reading the directory of bundles.
92
     */
93
    public void addBundlesFromDirectory(File bundlesDirectory)
94
        throws InstallPackageServiceException;
95
96
    /**
97
     * Install a package in a concrete gvSIG installation directory. The
98
     * selected
99
     * package has to be contained in one of the bundles that has been
100
     * previously
101 33743 cordinyana
     * added using the {@link #addBundle(File)} or the
102 33692 cordinyana
     * {@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
118
     * package has to be contained in one of the bundles that has been
119
     * previously
120 33743 cordinyana
     * added using the {@link #addBundle(File)} or the
121 33692 cordinyana
     * {@link #addBundlesFromDirectory(File)} method.
122
     *
123
     * @param applicationDirectory
124
     *            a valid root directory where an instance og gvSIG is
125
     *            installed.
126
     * @param packageCode
127
     *            the code of the package.
128
     * @throws InstallPackageServiceException
129
     *             if there is an error installing the {@link PackageInfo#}
130
     */
131
    public void installPackage(File applicationDirectory, String packageCode)
132
        throws InstallPackageServiceException;
133
134
    /**
135
     * @return
136
     *         the number of packages that has been loaded form one or more
137
     *         bundles
138 33743 cordinyana
     *         using the {@link #addBundle(File)} or the
139 33692 cordinyana
     *         {@link #addBundlesFromDirectory(File)} method.
140
     */
141
    public int getPackageCount();
142
143
    /**
144
     * Return the package information for a concrete position. All
145
     * the packages has been loaded form one or more bundles
146 33743 cordinyana
     * using the {@link #addBundle(File)} or the
147 33692 cordinyana
     * {@link #addBundlesFromDirectory(File)} method.
148
     *
149
     * @param index
150
     *            the position of the package.
151
     * @return
152
     *         the information of a package.
153
     *         returns <code>null</code> if the package doesn't exist.
154
     */
155
    public PackageInfo getPackageInfo(int index);
156
157
    /**
158
     * Return the package information for a concrete position. All
159
     * the packages has been loaded form one or more bundles
160 33743 cordinyana
     * using the {@link #addBundle(File)} or the
161 33692 cordinyana
     * {@link #addBundlesFromDirectory(File)} method.
162
     *
163
     * @param packageCode
164
     *            the code of the package.
165
     * @return
166
     *         the information of a package.
167
     *         returns <code>null</code> if the package doesn't exist.
168
     */
169
    public PackageInfo getPackageInfo(String packageCode);
170 34005 cordinyana
171 32269 jpiera
}