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

History | View | Annotate | Download (5.58 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
32 32597 jpiera
import org.gvsig.installer.lib.api.InstallerManager;
33 32562 jpiera
import org.gvsig.installer.lib.api.PackageInfo;
34
import org.gvsig.installer.lib.api.creation.MakePluginPackageService;
35 32400 jpiera
import org.gvsig.tools.service.Service;
36 32269 jpiera
37
/**
38 32333 jpiera
 * <p>
39 33692 cordinyana
 * This service is used to read a bundle file and install the packages contained
40
 * in it. It has methods to read the packages contained in a bundle and to
41
 * install one of them.
42 32333 jpiera
 * </p>
43
 * <p>
44 33692 cordinyana
 * The bundle is a file that has been created using the
45
 * {@link MakePluginPackageService} service. It is possible to create an
46
 * installer manually, but it has to have the structure defined by the
47
 * {@link InstallerManager} class.
48 32333 jpiera
 * </p>
49 33692 cordinyana
 *
50 32269 jpiera
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
51
 */
52 33692 cordinyana
public interface InstallPackageService extends Service {
53
54
    /**
55
     * Adds a the URI of a bundle that contains some packages to install. A
56
     * bundle
57
     * is a compressed zip file with a structure defined in the
58
     * {@link InstallerManager} class.
59
     *
60
     * @param bundleURI
61
     *            the URI of a bundle.
62
     * @throws InstallPackageServiceException
63
     *             it is thrown if there is an exception reading the URI.
64
     */
65 33743 cordinyana
    public void addBundle(File bundleFile)
66
        throws InstallPackageServiceException;
67 33692 cordinyana
68
    /**
69
     * In reads a directory and reads all the bundles. This method retrieve
70
     * all the information of the packages located in the bundles and allows to
71
     * the
72
     * user to show this information.
73
     *
74
     * @param bundlesDirectory
75
     *            a directory that contains bundles.
76
     * @throws InstallPackageServiceException
77
     *             If there is any problem reading the directory of bundles.
78
     */
79
    public void addBundlesFromDirectory(File bundlesDirectory)
80
        throws InstallPackageServiceException;
81
82
    /**
83
     * Install a package in a concrete gvSIG installation directory. The
84
     * selected
85
     * package has to be contained in one of the bundles that has been
86
     * previously
87 33743 cordinyana
     * added using the {@link #addBundle(File)} or the
88 33692 cordinyana
     * {@link #addBundlesFromDirectory(File)} method.
89
     *
90
     * @param applicationDirectory
91
     *            a valid root directory where an instance og gvSIG is
92
     *            installed.
93
     * @param packageInfo
94
     *            the package to install.
95
     * @throws InstallPackageServiceException
96
     *             If there is an error installing the package.
97
     */
98
    public void installPackage(File applicationDirectory,
99
        PackageInfo packageInfo) throws InstallPackageServiceException;
100
101
    /**
102
     * Install a package in a concrete gvSIG installation directory. The
103
     * selected
104
     * package has to be contained in one of the bundles that has been
105
     * previously
106 33743 cordinyana
     * added using the {@link #addBundle(File)} or the
107 33692 cordinyana
     * {@link #addBundlesFromDirectory(File)} method.
108
     *
109
     * @param applicationDirectory
110
     *            a valid root directory where an instance og gvSIG is
111
     *            installed.
112
     * @param packageCode
113
     *            the code of the package.
114
     * @throws InstallPackageServiceException
115
     *             if there is an error installing the {@link PackageInfo#}
116
     */
117
    public void installPackage(File applicationDirectory, String packageCode)
118
        throws InstallPackageServiceException;
119
120
    /**
121
     * @return
122
     *         the number of packages that has been loaded form one or more
123
     *         bundles
124 33743 cordinyana
     *         using the {@link #addBundle(File)} or the
125 33692 cordinyana
     *         {@link #addBundlesFromDirectory(File)} method.
126
     */
127
    public int getPackageCount();
128
129
    /**
130
     * Return the package information for a concrete position. All
131
     * the packages has been loaded form one or more bundles
132 33743 cordinyana
     * using the {@link #addBundle(File)} or the
133 33692 cordinyana
     * {@link #addBundlesFromDirectory(File)} method.
134
     *
135
     * @param index
136
     *            the position of the package.
137
     * @return
138
     *         the information of a package.
139
     *         returns <code>null</code> if the package doesn't exist.
140
     */
141
    public PackageInfo getPackageInfo(int index);
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 packageCode
150
     *            the code 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(String packageCode);
156 32269 jpiera
}