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 / creation / InstallerCreationService.java @ 32411

History | View | Annotate | Download (4.71 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.creation;
29

    
30
import java.io.File;
31
import java.io.OutputStream;
32

    
33
import org.gvsig.installer.lib.api.InstallerInfo;
34
import org.gvsig.tools.service.Service;
35

    
36
/**
37
 * <p>
38
 * This service is used to create an installer for a gvSIG plugin. It 
39
 * supports just one plugin for every installer. It contains a method to
40
 * set the plugin path and some methods to set the installer information.
41
 * </p>
42
 * 
43
 * <p>
44
 * It has also methods to load the current installation information (if exists)
45
 * and methods to create the installer file from an {@link OutputStream}.
46
 * </p>
47
 * 
48
 * <p>
49
 * An installer is just a compressed zip file that has a compressed zip file
50
 * for every plugin to install. In this first version it only has a plugin, but
51
 * in a future it is possible to create installers with more that one plugin.
52
 * The structure of an installation file is:
53
 * </p>
54
 * <pre>
55
 * - installer.zip
56
 *                 - org.gvsig.myplugin-[version]-[build].zip
57
 *                         - org.gvsig.myplugin
58
 *                                   - install.info
59
 *                          - install.xml
60
 *                          - files
61
 *                                  - org.gvsig.otherplugin
62
 *                                          - file1
63
 *                                          - file2
64
 * </pre>
65
 * <p>
66
 * installer.zip is the installer file name that has a zip file that 
67
 * contains the plugin to install (org.gvsig.myplugin-[version]-[build].zip).
68
 * This second file has a root directory with the plugin content and with
69
 * some extra files with the installer information. These files are:
70
 * </p>
71
 *  
72
 * <lu>
73
 * <li><b>install.info</b>: file that contains the installer information</li>
74
 * <li><b>install.xml</b>: ant file that is executed in the execution of the installer
75
 * to do some extra actions in the installation process. One of these actions
76
 * is copy all the files located in the files directory</li>
77
 * <li><b>files directory</b>: it contains some files of other extensions that have
78
 * to be copied using the ant script.</li> 
79
 * </lu>
80
 *  
81
 * <p>
82
 * The usage of the ant script to copy files from other plugins is not recommended 
83
 * because it is possible that different installers overrides the same file. The 
84
 * suggestion it that one plugin has to have all the files that it needs to work
85
 * inside the plugin and it never has to override some external files. 
86
 * </p>
87
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
88
 */
89
public interface InstallerCreationService extends Service{
90
        
91
        /**
92
         * It sets the directory where the plugin is located, that it has to
93
         * be a valid gvSIG plugin directory.         
94
         * @param pluginDirectory
95
         * The directory where the gvSIG plugin is located.
96
         * @throws InstallerCreationServiceException
97
         * This exception is thrown when the directory doesn't exist or the directory is
98
         * not a valid gvSIG plugin directory.
99
         */
100
        public void setApplicationDirectory(File applicationDirectory) throws InstallerCreationServiceException;
101
        
102
        /**
103
         * It creates the installer file and copy it in the stream received like
104
         * an argument.
105
         * @param installerStream
106
         * The stream where the the installer is created
107
         * @throws InstallerCreationServiceException
108
         * It is thrown when there is an exception creating the installer.
109
         */
110
        public void createInstaller(OutputStream installerStream) throws InstallerCreationServiceException;        
111
        
112
        
113
        public void setSelectedPlugin(int index) throws InstallerCreationServiceException;
114
        
115
        public void setSelectedPlugin(String code);
116
        
117
        public int getPluginsSize();
118
        
119
        /**
120
         * It returns an instance of an {@link InstallerInfo} class, that is a 
121
         * class that contains all the installer information (plugin name, plugin
122
         * version...).
123
         * @return
124
         * The installer information.
125
         */
126
        public InstallerInfo getPluginInfoAt(int index);
127
        
128
        public InstallerInfo getSelectedPlugin() throws InstallerCreationServiceException;
129
        
130
        public String getDefaultAntScript() throws InstallerCreationServiceException;
131

    
132
}
133