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 / InstallerExecutionService.java @ 32498

History | View | Annotate | Download (5.36 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.io.InputStream;
32

    
33
import org.gvsig.installer.lib.api.InstallerInfo;
34
import org.gvsig.installer.lib.api.creation.InstallerCreationService;
35
import org.gvsig.installer.lib.api.creation.InstallerCreationServiceException;
36
import org.gvsig.tools.service.Service;
37

    
38
/**
39
 * <p>
40
 * This service is used to read an installer file and install the
41
 * plugins contained in it. It has methods to add installers,
42
 * to read the plugins that can be installed, to select the plugins
43
 * to install and to install them.  
44
 * </p>
45
 * <p>
46
 * The installer stream is a normally a file that has been created using
47
 * the {@link InstallerCreationService} service. It is possible to create
48
 * an installer manually, but it has to have the structure defined by the
49
 * {@link InstallerCreationService} class.
50
 * </p>
51
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
52
 */
53
public interface InstallerExecutionService extends Service{
54
        
55
        /**
56
         * Sets the stream that contains the installer that contains the 
57
         * information to install some plugins. This stream is a zip file
58
         * that has to have the structure defined in the {@link InstallerCreationService}
59
         * documentation.         
60
         * @param inputStream
61
         * The stream that contains the installer information.
62
         * @throws InstallerExecutionServiceException
63
         * It is thrown if there is an exception reading the stream
64
         */
65
        public void addInstaller(InputStream inputStream) throws InstallerExecutionServiceException;
66
        
67
        /**
68
         * It sets the directory where the application is located, that it has to
69
         * be a valid gvSIG root directory. This directory is used to install the plugins.
70
         * @param applicationDirectory
71
         * The directory where the gvSIG is located.
72
         * @throws InstallerExecutionServiceException
73
         * This exception is thrown when the directory doesn't exist or the directory is
74
         * not a valid gvSIG root directory.
75
         */
76
        public void setApplicationDirectory(File applicationDirectory) throws InstallerExecutionServiceException;
77
        
78
        /**
79
         * In the main gvSIG directory there is a directory named <b>install</b> that could
80
         * have some installers that can be used to install new plugins. This method retrieve
81
         * all the information of the installers located in this directory and allows to the 
82
         * user to show this information.
83
         * @throws InstallerExecutionServiceException
84
         * If there is any problem reading the directory or the installers.
85
         */
86
        public void addInstallersFromInstallDirectory() throws InstallerExecutionServiceException;
87
        
88
        /**
89
         * Deletes all the information of the previous loaded installers.
90
         */
91
        public void deleteInstallers();        
92
                
93
        /**
94
         * Sets the plugin to install.
95
         * @param index
96
         * Position of the plugin to install.
97
         * @throws InstallerExecutionServiceException
98
         * If the plugin doesn't exist. 
99
         */
100
        public void setPluginToInstall(int index) throws InstallerExecutionServiceException;
101
        
102
        /**
103
         * Sets the plugin to install.
104
         * @param code
105
         * Code of the plugin to install.
106
         * @throws InstallerExecutionServiceException
107
         * If the plugin doesn't exist. 
108
         */
109
        public void setPluginToInstall(String code) throws InstallerExecutionServiceException;
110
        
111
        /**
112
         * Install the selected plugin. This method only can be executed if the 
113
         * selected plugin is located on the <b>install</b> directory of gvSIG.
114
         * Otherwise the method to use is {{@link #executeInstaller(InputStream)} that
115
         * provides the strem used to install the plugin.
116
         * @throws InstallerExecutionServiceException
117
         * If there is an error installing the plugin.
118
         */
119
        public void executeInstaller() throws InstallerExecutionServiceException;
120
        
121
        /**
122
         * Install the selected plugin. This method provides of a stream that has been
123
         * added before using the {{@link #addInstaller(InputStream)}} method. This stream
124
         * is needed other time because there are some {@link InputStream}'s that don't
125
         * support the {@link InputStream#reset()} method.         * 
126
         * @throws InstallerExecutionServiceException
127
         * If there is an error installing the plugin.         * 
128
         */
129
        public void executeInstaller(InputStream is) throws InstallerExecutionServiceException;
130
                
131
        /**
132
         * @return
133
         * The number of plugins that can be selected to install.
134
         */
135
        public int getPluginsSize();
136
        
137
        /**
138
         * Return the information of a plugin from a concrete position. 
139
         * @param index
140
         * The position of the plugin.
141
         * @return
142
         * The information of a plugin.
143
         */
144
        public InstallerInfo getPluginInfoAt(int index);
145
}
146