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

History | View | Annotate | Download (4.78 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

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

    
129
}
130