Revision 42955
tags/org.gvsig.desktop-2.0.150/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.api/src/main/java/org/gvsig/installer/lib/api/DependenciesCalculator.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.installer.lib.api; |
|
25 |
|
|
26 |
import java.util.Collection; |
|
27 |
import java.util.List; |
|
28 |
|
|
29 |
public interface DependenciesCalculator { |
|
30 |
|
|
31 |
public void addPackageToInstall(PackageInfo packageInfo); |
|
32 |
|
|
33 |
public void addPackageToInstall(Collection<PackageInfo> packages); |
|
34 |
|
|
35 |
public void addInstalledPackage(PackageInfo packageInfo); |
|
36 |
|
|
37 |
public void addInstalledPackage(PackageInfo[] packages); |
|
38 |
|
|
39 |
public void calculate(); |
|
40 |
|
|
41 |
public List<PackageInfo> getRequiredPackages(); |
|
42 |
|
|
43 |
public List<PackageInfo> getConflictPackages(); |
|
44 |
|
|
45 |
public Dependencies getUnresolvedDependencies(); |
|
46 |
|
|
47 |
|
|
48 |
} |
|
0 | 49 |
tags/org.gvsig.desktop-2.0.150/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.api/src/main/java/org/gvsig/installer/lib/api/InstallerLocator.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
/* |
|
25 |
* AUTHORS (In addition to CIT): |
|
26 |
* 2010 {Prodevelop} {Task} |
|
27 |
*/ |
|
28 |
|
|
29 |
package org.gvsig.installer.lib.api; |
|
30 |
|
|
31 |
import org.gvsig.tools.locator.AbstractLocator; |
|
32 |
import org.gvsig.tools.locator.Locator; |
|
33 |
import org.gvsig.tools.locator.LocatorException; |
|
34 |
|
|
35 |
/** |
|
36 |
* This Locator provides the entry point for the gvSIG {@link InstallerManager} |
|
37 |
* |
|
38 |
* @see {@link Locator} |
|
39 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
40 |
*/ |
|
41 |
public class InstallerLocator extends AbstractLocator { |
|
42 |
|
|
43 |
private static final String LOCATOR_NAME = "InstallerLocator"; |
|
44 |
/** |
|
45 |
* InstallerManager name used by the locator to access the instance |
|
46 |
*/ |
|
47 |
public static final String INSTALLER_MANAGER_NAME = "InstallerManager"; |
|
48 |
private static final String INSTALLER_MANAGER_DESCRIPTION = "InstallerManager of gvSIG"; |
|
49 |
|
|
50 |
/** |
|
51 |
* Unique instance. |
|
52 |
*/ |
|
53 |
private static final InstallerLocator instance = new InstallerLocator(); |
|
54 |
|
|
55 |
/** |
|
56 |
* @see Locator#getLocatorName() |
|
57 |
*/ |
|
58 |
public String getLocatorName() { |
|
59 |
return LOCATOR_NAME; |
|
60 |
} |
|
61 |
|
|
62 |
/** |
|
63 |
* Return a reference to {@link InstallerManager}. |
|
64 |
* |
|
65 |
* @return a reference to InstallerManager |
|
66 |
* @throws LocatorException |
|
67 |
* if there is no access to the class or the class cannot be |
|
68 |
* instantiated |
|
69 |
* @see Locator#get(String) |
|
70 |
*/ |
|
71 |
public static InstallerManager getInstallerManager() |
|
72 |
throws LocatorException { |
|
73 |
return (InstallerManager) getInstance().get(INSTALLER_MANAGER_NAME); |
|
74 |
} |
|
75 |
|
|
76 |
/** |
|
77 |
* Return the singleton instance. |
|
78 |
* |
|
79 |
* @return the singleton instance |
|
80 |
*/ |
|
81 |
public static InstallerLocator getInstance() { |
|
82 |
return instance; |
|
83 |
} |
|
84 |
|
|
85 |
/** |
|
86 |
* Registers the Class implementing the {@link InstallerManager} interface. |
|
87 |
* |
|
88 |
* @param clazz |
|
89 |
* implementing the InstallerManager interface |
|
90 |
*/ |
|
91 |
public static void registerInstallerManager( |
|
92 |
Class<? extends InstallerManager> clazz) { |
|
93 |
|
|
94 |
getInstance().register(INSTALLER_MANAGER_NAME, |
|
95 |
INSTALLER_MANAGER_DESCRIPTION, clazz); |
|
96 |
} |
|
97 |
} |
|
0 | 98 |
tags/org.gvsig.desktop-2.0.150/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.api/src/main/java/org/gvsig/installer/lib/api/InstallerLibrary.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
/* |
|
25 |
* AUTHORS (In addition to CIT): |
|
26 |
* 2010 {Prodevelop} {Task} |
|
27 |
*/ |
|
28 |
|
|
29 |
package org.gvsig.installer.lib.api; |
|
30 |
|
|
31 |
import org.gvsig.tools.ToolsLibrary; |
|
32 |
import org.gvsig.tools.library.AbstractLibrary; |
|
33 |
import org.gvsig.tools.library.LibraryException; |
|
34 |
|
|
35 |
/** |
|
36 |
* Library for the installer. |
|
37 |
* |
|
38 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
39 |
*/ |
|
40 |
public class InstallerLibrary extends AbstractLibrary { |
|
41 |
|
|
42 |
@Override |
|
43 |
public void doRegistration() { |
|
44 |
registerAsAPI(InstallerLibrary.class); |
|
45 |
this.require(ToolsLibrary.class); |
|
46 |
} |
|
47 |
|
|
48 |
@Override |
|
49 |
protected void doInitialize() throws LibraryException { |
|
50 |
// Nothing to do |
|
51 |
} |
|
52 |
|
|
53 |
@Override |
|
54 |
protected void doPostInitialize() throws LibraryException { |
|
55 |
// Nothing to do |
|
56 |
} |
|
57 |
|
|
58 |
} |
|
0 | 59 |
tags/org.gvsig.desktop-2.0.150/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.api/src/main/java/org/gvsig/installer/lib/api/SimpleProgressStatus.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.installer.lib.api; |
|
25 |
|
|
26 |
/** |
|
27 |
* @author gvSIG Team |
|
28 |
* @version $Id$ |
|
29 |
* |
|
30 |
*/ |
|
31 |
public interface SimpleProgressStatus { |
|
32 |
|
|
33 |
public int getCompleted(); |
|
34 |
|
|
35 |
public String getLabel(); |
|
36 |
|
|
37 |
public void requestCancel(); |
|
38 |
} |
|
0 | 39 |
tags/org.gvsig.desktop-2.0.150/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.api/src/main/java/org/gvsig/installer/lib/api/execution/InstallPackageServiceException.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
/* |
|
25 |
* AUTHORS (In addition to CIT): |
|
26 |
* 2010 {Prodevelop} {Task} |
|
27 |
*/ |
|
28 |
|
|
29 |
package org.gvsig.installer.lib.api.execution; |
|
30 |
|
|
31 |
import org.gvsig.tools.exception.BaseException; |
|
32 |
|
|
33 |
/** |
|
34 |
* Base exception for all the exceptions that are thrown by the process of |
|
35 |
* installation of a package. The {@link InstallPackageService} throws this |
|
36 |
* exception on its methods. |
|
37 |
* |
|
38 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
39 |
*/ |
|
40 |
public class InstallPackageServiceException extends BaseException { |
|
41 |
|
|
42 |
private static final String message = "Error installing a package"; |
|
43 |
|
|
44 |
private static final long serialVersionUID = -7645352975209203727L; |
|
45 |
|
|
46 |
private static final String KEY = "installer_execution_exception"; |
|
47 |
|
|
48 |
/** |
|
49 |
* @see BaseException#BaseException(String, long) |
|
50 |
*/ |
|
51 |
public InstallPackageServiceException() { |
|
52 |
super(message, KEY, serialVersionUID); |
|
53 |
} |
|
54 |
|
|
55 |
/** |
|
56 |
* @see BaseException#BaseException(Throwable, String, long) |
|
57 |
*/ |
|
58 |
public InstallPackageServiceException(Throwable cause) { |
|
59 |
super(message, cause, KEY, serialVersionUID); |
|
60 |
} |
|
61 |
|
|
62 |
protected InstallPackageServiceException(String message, Throwable cause, |
|
63 |
String key, long code) { |
|
64 |
super(message, cause, key, code); |
|
65 |
} |
|
66 |
|
|
67 |
protected InstallPackageServiceException(String message, String key, |
|
68 |
long code) { |
|
69 |
super(message, key, code); |
|
70 |
} |
|
71 |
|
|
72 |
} |
|
0 | 73 |
tags/org.gvsig.desktop-2.0.150/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.api/src/main/java/org/gvsig/installer/lib/api/execution/InstallPackageService.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
/* |
|
25 |
* AUTHORS (In addition to CIT): |
|
26 |
* 2010 {Prodevelop} {Task} |
|
27 |
*/ |
|
28 |
|
|
29 |
package org.gvsig.installer.lib.api.execution; |
|
30 |
|
|
31 |
import java.io.File; |
|
32 |
import java.net.URL; |
|
33 |
import java.util.List; |
|
34 |
|
|
35 |
import org.gvsig.installer.lib.api.InstallerManager; |
|
36 |
import org.gvsig.installer.lib.api.PackageInfo; |
|
37 |
import org.gvsig.installer.lib.api.creation.MakePluginPackageService; |
|
38 |
import org.gvsig.tools.service.Service; |
|
39 |
import org.gvsig.tools.task.SimpleTaskStatus; |
|
40 |
|
|
41 |
/** |
|
42 |
* <p> |
|
43 |
* This service is used to read a bundle file and install the packages contained |
|
44 |
* in it. It has methods to read the packages contained in a bundle and to |
|
45 |
* install one of them. |
|
46 |
* </p> |
|
47 |
* <p> |
|
48 |
* The bundle is a file that has been created using the |
|
49 |
* {@link MakePluginPackageService} service. It is possible to create an |
|
50 |
* installer manually, but it has to have the structure defined by the |
|
51 |
* {@link InstallerManager} class. |
|
52 |
* </p> |
|
53 |
* |
|
54 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
55 |
*/ |
|
56 |
public interface InstallPackageService extends Service { |
|
57 |
|
|
58 |
public void reset(); |
|
59 |
|
|
60 |
/** |
|
61 |
* Adds a the URI of a bundle that contains some packages to install. A |
|
62 |
* bundle is a compressed zip file with a structure defined in the |
|
63 |
* {@link InstallerManager} class. |
|
64 |
* |
|
65 |
* @param bundleURI |
|
66 |
* the URI of a bundle. |
|
67 |
* @throws InstallPackageServiceException |
|
68 |
* it is thrown if there is an exception reading the URI. |
|
69 |
*/ |
|
70 |
public void addBundle(File bundleFile) |
|
71 |
throws InstallPackageServiceException; |
|
72 |
|
|
73 |
/** |
|
74 |
* Adds a URL of a bundle that contains some packages to install. A bundle |
|
75 |
* is a compressed zip file with a structure defined in the |
|
76 |
* {@link InstallerManager} class. |
|
77 |
* |
|
78 |
* @param bundleURL |
|
79 |
* the {@link URL} of a bundle. |
|
80 |
* @throws InstallPackageServiceException |
|
81 |
* it is thrown if there is an exception reading the {@link URL} |
|
82 |
* . |
|
83 |
*/ |
|
84 |
public void addBundle(URL bundleURL) throws InstallPackageServiceException; |
|
85 |
|
|
86 |
/** |
|
87 |
* In reads a directory and reads all the bundles. This method retrieve all |
|
88 |
* the information of the packages located in the bundles and allows to the |
|
89 |
* user to show this information. |
|
90 |
* |
|
91 |
* @param bundlesDirectory |
|
92 |
* a directory that contains bundles. |
|
93 |
* @throws InstallPackageServiceException |
|
94 |
* If there is any problem reading the directory of bundles. |
|
95 |
*/ |
|
96 |
public void addBundlesFromDirectory(File bundlesDirectory) |
|
97 |
throws InstallPackageServiceException; |
|
98 |
|
|
99 |
/** |
|
100 |
* Install a package in a concrete gvSIG installation directory. The |
|
101 |
* selected package has to be contained in one of the bundles that has been |
|
102 |
* previously added using the {@link #addBundle(File)} or the |
|
103 |
* {@link #addBundlesFromDirectory(File)} method. |
|
104 |
* |
|
105 |
* @param applicationDirectory |
|
106 |
* a valid root directory where an instance og gvSIG is |
|
107 |
* installed. |
|
108 |
* @param packageInfo |
|
109 |
* the package to install. |
|
110 |
* @throws InstallPackageServiceException |
|
111 |
* If there is an error installing the package. |
|
112 |
*/ |
|
113 |
public void installPackage(File applicationDirectory, |
|
114 |
PackageInfo packageInfo) throws InstallPackageServiceException; |
|
115 |
|
|
116 |
/** |
|
117 |
* Install a package in a concrete gvSIG installation directory. The |
|
118 |
* selected package has to be contained in one of the bundles that has been |
|
119 |
* previously added using the {@link #addBundle(File)} or the |
|
120 |
* {@link #addBundlesFromDirectory(File)} method. |
|
121 |
* |
|
122 |
* @param applicationDirectory |
|
123 |
* a valid root directory where an instance og gvSIG is |
|
124 |
* installed. |
|
125 |
* @param packageCode |
|
126 |
* the code of the package. |
|
127 |
* @throws InstallPackageServiceException |
|
128 |
* if there is an error installing the {@link PackageInfo#} |
|
129 |
*/ |
|
130 |
public void installPackage(File applicationDirectory, String packageCode) |
|
131 |
throws InstallPackageServiceException; |
|
132 |
|
|
133 |
/** |
|
134 |
* @return the number of packages that has been loaded form one or more |
|
135 |
* bundles using the {@link #addBundle(File)} or the |
|
136 |
* {@link #addBundlesFromDirectory(File)} method. |
|
137 |
*/ |
|
138 |
public int getPackageCount(); |
|
139 |
|
|
140 |
/** |
|
141 |
* Return the package information for a concrete position. All the packages |
|
142 |
* has been loaded form one or more bundles using the |
|
143 |
* {@link #addBundle(File)} or the {@link #addBundlesFromDirectory(File)} |
|
144 |
* method. |
|
145 |
* |
|
146 |
* @param index |
|
147 |
* the position of the package. |
|
148 |
* @return the information of a package. returns <code>null</code> if the |
|
149 |
* package doesn't exist. |
|
150 |
*/ |
|
151 |
public PackageInfo getPackageInfo(int index); |
|
152 |
|
|
153 |
/** |
|
154 |
* Return the package information for a concrete position. All the packages |
|
155 |
* has been loaded form one or more bundles using the |
|
156 |
* {@link #addBundle(File)} or the {@link #addBundlesFromDirectory(File)} |
|
157 |
* method. |
|
158 |
* |
|
159 |
* @param packageCode |
|
160 |
* the code of the package. |
|
161 |
* @return the information of a package. returns <code>null</code> if the |
|
162 |
* package doesn't exist. |
|
163 |
*/ |
|
164 |
public PackageInfo getPackageInfo(String packageCode); |
|
165 |
|
|
166 |
/** |
|
167 |
* Download the package and register it in the manager. |
|
168 |
* |
|
169 |
* @param packageInfo |
|
170 |
*/ |
|
171 |
public void downloadPackage(PackageInfo packageInfo, |
|
172 |
SimpleTaskStatus taskStatus) throws InstallPackageServiceException; |
|
173 |
|
|
174 |
/** |
|
175 |
* |
|
176 |
*/ |
|
177 |
// public void resetPackages(); |
|
178 |
|
|
179 |
/** |
|
180 |
* @return |
|
181 |
*/ |
|
182 |
public List<String> getDefaultSelectedPackagesIDs(); |
|
183 |
|
|
184 |
/** |
|
185 |
* Gets the list of all the categories of *all* the packages. |
|
186 |
* |
|
187 |
* @return a list with the categories of all the packages. |
|
188 |
*/ |
|
189 |
public List<String> getCategories(); |
|
190 |
|
|
191 |
/** |
|
192 |
* Gets the list of different the types of *all* the packages. |
|
193 |
* |
|
194 |
* @return a list with the types of packages. |
|
195 |
*/ |
|
196 |
public List<String> getTypes(); |
|
197 |
} |
|
0 | 198 |
tags/org.gvsig.desktop-2.0.150/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.api/src/main/java/org/gvsig/installer/lib/api/PackageInfoWriter.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.installer.lib.api; |
|
25 |
|
|
26 |
import java.io.OutputStream; |
|
27 |
|
|
28 |
import org.gvsig.tools.exception.BaseException; |
|
29 |
|
|
30 |
/** |
|
31 |
* @author gvSIG Team |
|
32 |
* @version $Id$ |
|
33 |
* |
|
34 |
*/ |
|
35 |
public interface PackageInfoWriter { |
|
36 |
|
|
37 |
public void write(PackageInfo installInfo, OutputStream os) |
|
38 |
throws BaseException; |
|
39 |
|
|
40 |
} |
|
0 | 41 |
tags/org.gvsig.desktop-2.0.150/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.api/src/main/java/org/gvsig/installer/lib/api/creation/MakePluginPackageServiceException.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
/* |
|
25 |
* AUTHORS (In addition to CIT): |
|
26 |
* 2010 {Prodevelop} {Task} |
|
27 |
*/ |
|
28 |
|
|
29 |
package org.gvsig.installer.lib.api.creation; |
|
30 |
|
|
31 |
import org.gvsig.tools.exception.BaseException; |
|
32 |
|
|
33 |
/** |
|
34 |
* Base exception for all the exceptions that are thrown by the process of |
|
35 |
* creation of an installer for a package of a plugin. The |
|
36 |
* {@link MakePluginPackageService} throws this exception on its methods. |
|
37 |
* |
|
38 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
39 |
*/ |
|
40 |
public class MakePluginPackageServiceException extends |
|
41 |
MakePackageServiceException { |
|
42 |
|
|
43 |
private static final long serialVersionUID = 4388665353519171171L; |
|
44 |
|
|
45 |
private static final String KEY = "make_plugin_package_exception"; |
|
46 |
|
|
47 |
/** |
|
48 |
* @see BaseException#BaseException(String, String, long) |
|
49 |
*/ |
|
50 |
public MakePluginPackageServiceException(String message) { |
|
51 |
super(message, KEY, serialVersionUID); |
|
52 |
} |
|
53 |
|
|
54 |
/** |
|
55 |
* @see BaseException#BaseException(String, Throwable, String, long) |
|
56 |
*/ |
|
57 |
public MakePluginPackageServiceException(String message, Throwable cause) { |
|
58 |
super(message, cause, KEY, serialVersionUID); |
|
59 |
} |
|
60 |
|
|
61 |
/** |
|
62 |
* @see BaseException#BaseException(String, String, long) |
|
63 |
*/ |
|
64 |
public MakePluginPackageServiceException(String message, String key, |
|
65 |
long serialVersion) { |
|
66 |
super(message, key, serialVersion); |
|
67 |
} |
|
68 |
|
|
69 |
/** |
|
70 |
* @see BaseException#BaseException(String, Throwable, String, long) |
|
71 |
*/ |
|
72 |
public MakePluginPackageServiceException(String message, Throwable cause, |
|
73 |
String key, long serialVersion) { |
|
74 |
super(message, cause, key, serialVersion); |
|
75 |
} |
|
76 |
|
|
77 |
} |
|
0 | 78 |
tags/org.gvsig.desktop-2.0.150/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.api/src/main/java/org/gvsig/installer/lib/api/creation/MakePackageServiceException.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
/* |
|
25 |
* AUTHORS (In addition to CIT): |
|
26 |
* 2010 {Prodevelop} {Task} |
|
27 |
*/ |
|
28 |
|
|
29 |
package org.gvsig.installer.lib.api.creation; |
|
30 |
|
|
31 |
import org.gvsig.tools.exception.BaseException; |
|
32 |
|
|
33 |
/** |
|
34 |
* Base exception for all the exceptions that are thrown by the process of |
|
35 |
* creation of an installer for a package of a plugin. The |
|
36 |
* {@link MakePluginPackageService} throws this exception on its methods. |
|
37 |
* |
|
38 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
39 |
*/ |
|
40 |
public class MakePackageServiceException extends BaseException { |
|
41 |
|
|
42 |
/** |
|
43 |
* |
|
44 |
*/ |
|
45 |
private static final long serialVersionUID = -5549105047582975720L; |
|
46 |
private static final String KEY = "make_package_exception"; |
|
47 |
private static final String MSG = "_Cant_create_package"; |
|
48 |
|
|
49 |
/** |
|
50 |
* @see BaseException#BaseException(String, String, long) |
|
51 |
*/ |
|
52 |
public MakePackageServiceException() { |
|
53 |
super(MSG, KEY, serialVersionUID); |
|
54 |
} |
|
55 |
|
|
56 |
/** |
|
57 |
* @see BaseException#BaseException(String, Throwable, String, long) |
|
58 |
*/ |
|
59 |
public MakePackageServiceException(Throwable cause) { |
|
60 |
super(MSG, cause, KEY, serialVersionUID); |
|
61 |
} |
|
62 |
|
|
63 |
/** |
|
64 |
* @see BaseException#BaseException(String, String, long) |
|
65 |
*/ |
|
66 |
protected MakePackageServiceException(String message, String key, |
|
67 |
long serialVersion) { |
|
68 |
super(message, key, serialVersion); |
|
69 |
} |
|
70 |
|
|
71 |
/** |
|
72 |
* @see BaseException#BaseException(String, Throwable, String, long) |
|
73 |
*/ |
|
74 |
protected MakePackageServiceException(String message, Throwable cause, |
|
75 |
String key, long serialVersion) { |
|
76 |
super(message, cause, key, serialVersion); |
|
77 |
} |
|
78 |
|
|
79 |
} |
|
0 | 80 |
tags/org.gvsig.desktop-2.0.150/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.api/src/main/java/org/gvsig/installer/lib/api/creation/MakePluginPackageService.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
/* |
|
25 |
* AUTHORS (In addition to CIT): |
|
26 |
* 2010 {Prodevelop} {Task} |
|
27 |
*/ |
|
28 |
|
|
29 |
package org.gvsig.installer.lib.api.creation; |
|
30 |
|
|
31 |
import java.io.File; |
|
32 |
import java.io.OutputStream; |
|
33 |
|
|
34 |
import org.gvsig.installer.lib.api.InstallerManager; |
|
35 |
import org.gvsig.installer.lib.api.PackageInfo; |
|
36 |
import org.gvsig.tools.service.Service; |
|
37 |
|
|
38 |
/** |
|
39 |
* <p> |
|
40 |
* This service is used to create a bundle that contains a package of plugin |
|
41 |
* type. It supports just one package for every installer. It contains a method |
|
42 |
* to set the plugin path and some methods to set the installer information. |
|
43 |
* </p> |
|
44 |
* <p> |
|
45 |
* It has also methods to load the installed plugins from a directory (if |
|
46 |
* exists) and methods to create the bundle file in an {@link OutputStream}. |
|
47 |
* </p> |
|
48 |
* <p> |
|
49 |
* A plugin package has the same structure of a standard package defined in |
|
50 |
* {@link InstallerManager} but it adds some new files. An example of the |
|
51 |
* structure of a bundle with a plugin package could be: |
|
52 |
* </p> |
|
53 |
* |
|
54 |
* <pre> |
|
55 |
* - bundle (compressed file) |
|
56 |
* - org.gvsig.plugin1-1_0_0-23 (compressed file) |
|
57 |
* - org.gvsig.plugin1 |
|
58 |
* - package.info |
|
59 |
* - install.xml |
|
60 |
* - files |
|
61 |
* - gvSIG |
|
62 |
* - extensiones |
|
63 |
* - org.gvsig.plugin2 |
|
64 |
* - file1 |
|
65 |
* - file2 |
|
66 |
* </pre> |
|
67 |
* <p> |
|
68 |
* This structure has some extra files: |
|
69 |
* </p> |
|
70 |
* <lu> <li><b>install.xml</b>: ant file that is executed in the execution of |
|
71 |
* the installer to do some extra actions in the installation process. One of |
|
72 |
* these actions is copy all the files located in the files directory</li> <li> |
|
73 |
* <b>files directory</b>: it contains some files of other extensions that have |
|
74 |
* to be copied using the ant script.</li> </lu> |
|
75 |
* <p> |
|
76 |
* The usage of the ant script to copy files from other plugins is not |
|
77 |
* recommended because it is possible that different installers overrides the |
|
78 |
* same file. The suggestion it that one plugin has to have all the files that |
|
79 |
* it needs to work inside the plugin and it never has to override some external |
|
80 |
* files. |
|
81 |
* </p> |
|
82 |
* <p> |
|
83 |
* The implementations of this interface have to have a constructor with a File |
|
84 |
* parameter that is the directory when the plugins are located. If the |
|
85 |
* directory doens't exists the creation throws an exception. |
|
86 |
* </p> |
|
87 |
* |
|
88 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
89 |
*/ |
|
90 |
public interface MakePluginPackageService extends Service { |
|
91 |
|
|
92 |
/** |
|
93 |
* It creates a package set with a single plugin package inside. |
|
94 |
* |
|
95 |
* @param packageInfo |
|
96 |
* the information of the plugin that has to be included in the |
|
97 |
* package set |
|
98 |
* @param packageStream |
|
99 |
* the stream where the the package set will be created |
|
100 |
* @throws MakePluginPackageServiceException |
|
101 |
* it is thrown when there is an exception creating the package |
|
102 |
* set |
|
103 |
*/ |
|
104 |
public void createPackageSet(PackageInfo packageInfo, |
|
105 |
OutputStream packageStream) |
|
106 |
throws MakePluginPackageServiceException; |
|
107 |
|
|
108 |
/** |
|
109 |
* It creates a package of a plugin. |
|
110 |
* |
|
111 |
* @param packageInfo |
|
112 |
* the information of the plugin that has to be included in the |
|
113 |
* package |
|
114 |
* @param packageStream |
|
115 |
* the stream where the the package will be created |
|
116 |
* @throws MakePluginPackageServiceException |
|
117 |
* it is thrown when there is an exception creating the package |
|
118 |
*/ |
|
119 |
public void createPackage(PackageInfo packageInfo, |
|
120 |
OutputStream packageStream) |
|
121 |
throws MakePluginPackageServiceException; |
|
122 |
|
|
123 |
/** |
|
124 |
* Prepares and copies the needed files for the package. It is used to copy |
|
125 |
* the ant build file and the additional external files to be included in |
|
126 |
* the package. |
|
127 |
* |
|
128 |
* @param newPackageInfo |
|
129 |
* the information of the new plugin. |
|
130 |
* @param originalPackageInfo |
|
131 |
* the information of the original plugin. |
|
132 |
* @throws MakePluginPackageServiceException |
|
133 |
* it is thrown when there is an exception preparing the package |
|
134 |
*/ |
|
135 |
public void preparePackage(PackageInfo packageInfo, |
|
136 |
File originalPackageFolder) |
|
137 |
throws MakePluginPackageServiceException; |
|
138 |
|
|
139 |
/** |
|
140 |
* It creates the index for a package of a plugin. This file may be used to |
|
141 |
* be included in the main gvSIG remote index, or downloaded as it is. |
|
142 |
* |
|
143 |
* @param packageInfo |
|
144 |
* the information of the plugin that has to be included in the |
|
145 |
* package index |
|
146 |
* @param packageStream |
|
147 |
* the stream where the the package index will be created |
|
148 |
* @throws MakePluginPackageServiceException |
|
149 |
* it is thrown when there is an exception creating the package |
|
150 |
*/ |
|
151 |
public void createPackageIndex(PackageInfo packageInfo, |
|
152 |
OutputStream packageStream) |
|
153 |
throws MakePluginPackageServiceException; |
|
154 |
|
|
155 |
/** |
|
156 |
* Writes a package info file with the information provided. |
|
157 |
* |
|
158 |
* @param packageInfo |
|
159 |
* the package that has to be written into the file |
|
160 |
* @param folder |
|
161 |
* the folder where the file is to be created |
|
162 |
* @throws MakePluginPackageServiceException |
|
163 |
* it is thrown when there is an exception writing the file |
|
164 |
*/ |
|
165 |
public void writePackageInfo(PackageInfo packageInfo, File folder) |
|
166 |
throws MakePluginPackageServiceException; |
|
167 |
|
|
168 |
/** |
|
169 |
* Writes a package info file with the information provided. |
|
170 |
* |
|
171 |
* @param packageInfo |
|
172 |
* the package that has to be written into the file |
|
173 |
* @param folder |
|
174 |
* the folder where the file is to be created |
|
175 |
* @throws MakePluginPackageServiceException |
|
176 |
* it is thrown when there is an exception writing the file |
|
177 |
*/ |
|
178 |
public void writePackageInfoForIndex(PackageInfo packageInfo, File folder) |
|
179 |
throws MakePluginPackageServiceException; |
|
180 |
|
|
181 |
/** |
|
182 |
* It returns the number of plugin packages that are installed in the folder |
|
183 |
* that has been added using the constructor. It can be used in an iteration |
|
184 |
* process combined with the {@link #getPluginPackageInfo(int)} method to |
|
185 |
* know all the installed plugins. |
|
186 |
* |
|
187 |
* @return the number of plugins installed in a directory. |
|
188 |
*/ |
|
189 |
public int getPluginPackageCount(); |
|
190 |
|
|
191 |
/** |
|
192 |
* It returns an instance of an {@link PackageInfo} class, that is a class |
|
193 |
* that contains all the package information (name, version...). |
|
194 |
* |
|
195 |
* @param index |
|
196 |
* the position of the plugin that has to be retrieved. |
|
197 |
* @return the installer information of a plugin package. Returns |
|
198 |
* <code>null</code> if the package doesn't exist. |
|
199 |
*/ |
|
200 |
public PackageInfo getPluginPackageInfo(int index); |
|
201 |
|
|
202 |
/** |
|
203 |
* It returns an instance of an {@link PackageInfo} class, that is a class |
|
204 |
* that contains all the package information (name, version...). |
|
205 |
* |
|
206 |
* @param code |
|
207 |
* code of the plugin, defined in the <b>package.info</b> file |
|
208 |
* like a property. |
|
209 |
* @return the installer information of a plugin package. Returns |
|
210 |
* <code>null</code> if the package doesn't exist. |
|
211 |
*/ |
|
212 |
public PackageInfo getPluginPackageInfo(String code); |
|
213 |
|
|
214 |
/** |
|
215 |
* This method returns the default ant script that will be used by some |
|
216 |
* plugins to copy some external files in the installation process. |
|
217 |
* |
|
218 |
* @return a string that contains the standard ant script |
|
219 |
* @throws MakePluginPackageServiceException |
|
220 |
* if there is a problem reading the file |
|
221 |
*/ |
|
222 |
public String getDefaultAntScript() |
|
223 |
throws MakePluginPackageServiceException; |
|
224 |
|
|
225 |
/** |
|
226 |
* Returns the list of packages already installed in the application. |
|
227 |
* |
|
228 |
* @return the list of packages already installed in the application |
|
229 |
* @throws MakePluginPackageServiceException |
|
230 |
* if there is an error getting the installed packages |
|
231 |
*/ |
|
232 |
public PackageInfo[] getInstalledPackages() |
|
233 |
throws MakePluginPackageServiceException; |
|
234 |
|
|
235 |
/** |
|
236 |
* Returns the folder where a plugin is located. |
|
237 |
* |
|
238 |
* @param selectedPackageInfo |
|
239 |
* the info of theplugin to look for |
|
240 |
* @return the plugin's folder |
|
241 |
* @throws MakePluginPackageServiceException |
|
242 |
* if there is an error locating the folder |
|
243 |
*/ |
|
244 |
public File getPluginFolder(PackageInfo packageInfo) |
|
245 |
throws MakePluginPackageServiceException; |
|
246 |
|
|
247 |
/** |
|
248 |
* @param folder |
|
249 |
* @return |
|
250 |
*/ |
|
251 |
public boolean deleteDir(File folder); |
|
252 |
|
|
253 |
} |
|
0 | 254 |
tags/org.gvsig.desktop-2.0.150/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.api/src/main/java/org/gvsig/installer/lib/api/creation/MakePackageService.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.installer.lib.api.creation; |
|
25 |
|
|
26 |
import java.io.OutputStream; |
|
27 |
import java.net.URL; |
|
28 |
|
|
29 |
import org.gvsig.tools.service.Manager; |
|
30 |
|
|
31 |
/** |
|
32 |
* @author gvSIG Team |
|
33 |
* @version $Id$ |
|
34 |
* |
|
35 |
*/ |
|
36 |
public interface MakePackageService { |
|
37 |
|
|
38 |
public static final String ANT_FILE_NAME = "install.xml"; |
|
39 |
|
|
40 |
public abstract Manager getManager(); |
|
41 |
|
|
42 |
public abstract void preparePackage() throws MakePackageServiceException; |
|
43 |
|
|
44 |
public abstract void createPackage(OutputStream packageStream) |
|
45 |
throws MakePackageServiceException; |
|
46 |
|
|
47 |
public abstract void createPackageIndex(URL downloadurl, |
|
48 |
OutputStream packageStream) throws MakePackageServiceException; |
|
49 |
|
|
50 |
public abstract void createPackageSet(OutputStream packageStream) |
|
51 |
throws MakePackageServiceException; |
|
52 |
|
|
53 |
public void createPackageIndexSet(URL downloadurl, |
|
54 |
OutputStream packageStream) throws MakePackageServiceException; |
|
55 |
|
|
56 |
public abstract String getDefaultAntScript() |
|
57 |
throws MakePackageServiceException; |
|
58 |
|
|
59 |
} |
|
0 | 60 |
tags/org.gvsig.desktop-2.0.150/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.api/src/main/java/org/gvsig/installer/lib/api/InstallerManager.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
/* |
|
25 |
* AUTHORS (In addition to CIT): |
|
26 |
* 2010 {Prodevelop} {Task} |
|
27 |
*/ |
|
28 |
|
|
29 |
package org.gvsig.installer.lib.api; |
|
30 |
|
|
31 |
import java.io.File; |
|
32 |
import java.io.IOException; |
|
33 |
import java.io.InputStream; |
|
34 |
import java.net.URL; |
|
35 |
import java.text.MessageFormat; |
|
36 |
import java.util.List; |
|
37 |
|
|
38 |
import org.gvsig.installer.lib.api.creation.MakePackageService; |
|
39 |
import org.gvsig.installer.lib.api.creation.MakePluginPackageService; |
|
40 |
import org.gvsig.installer.lib.api.creation.MakePluginPackageServiceException; |
|
41 |
import org.gvsig.installer.lib.api.execution.InstallPackageService; |
|
42 |
import org.gvsig.installer.lib.api.execution.InstallPackageServiceException; |
|
43 |
import org.gvsig.tools.exception.BaseException; |
|
44 |
import org.gvsig.tools.service.Manager; |
|
45 |
|
|
46 |
/** |
|
47 |
* <p> |
|
48 |
* This manager is used to register and create the services that are used to |
|
49 |
* manage the creation and the execution of installers. An installer is a file |
|
50 |
* called <b>bundle</b> that is composed of a set <b>packages</b>. |
|
51 |
* </p> |
|
52 |
* <p> |
|
53 |
* A package has some information that is defined by the {@link PackageInfo} |
|
54 |
* class and is composed of a set of attributes. One of these attributes, the |
|
55 |
* type, denotes if the package is a plugin, theme, translation, etc. |
|
56 |
* </p> |
|
57 |
* <p> |
|
58 |
* In practice a bundle is just a compressed zip file that has a compressed zip |
|
59 |
* file for every package to install. The structure of a bundle file with two |
|
60 |
* packages of type plugin could be: |
|
61 |
* </p> |
|
62 |
* |
|
63 |
* <pre> |
|
64 |
* - bundle (compressed file) |
|
65 |
* - org.gvsig.plugin1-1_0_0-23 (compressed file) |
|
66 |
* - org.gvsig.plugin1 |
|
67 |
* - package.info |
|
68 |
* - org.gvsig.plugin2-2_0_1-35 (compressed file) |
|
69 |
* - org.gvsig.plugin1 |
|
70 |
* - package.info |
|
71 |
* </pre> |
|
72 |
* <p> |
|
73 |
* <b>bundle</b> is the compressed file that contains a zip entry for every |
|
74 |
* package to install. The name of the zip entry follows next pattern: |
|
75 |
* </p> |
|
76 |
* |
|
77 |
* <pre> |
|
78 |
* [package code]-[version]-[build] |
|
79 |
* </pre> |
|
80 |
* <p> |
|
81 |
* Every zip entry contains a main folder inside that contains all the package |
|
82 |
* files that are used in the installation process. Depending of the type of |
|
83 |
* packages, the information inside this folder can be different, but all the |
|
84 |
* types of packages have to have the <b>package.info</b>file that has all the |
|
85 |
* package information. To see the <b>package.info</b> description see |
|
86 |
* {@link PackageInfo}. |
|
87 |
* <p> |
|
88 |
* </p> |
|
89 |
* The services that offers this managers are basically two: the creation of |
|
90 |
* bundles for just one package of plugin type and a service for the |
|
91 |
* installation of packages from a bundle. </p> |
|
92 |
* |
|
93 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
94 |
*/ |
|
95 |
public interface InstallerManager extends Manager { |
|
96 |
|
|
97 |
public static final String PACKAGE_INDEX_EXTENSION = ".gvspki"; |
|
98 |
public static final String PACKAGE_SET_EXTENSION = ".gvspks"; |
|
99 |
public static final String PACKAGE_EXTENSION = ".gvspkg"; |
|
100 |
|
|
101 |
public static final String PACKAGE_INFO_FILE_NAME = "package.info"; |
|
102 |
/** |
|
103 |
* Package state default values. |
|
104 |
*/ |
|
105 |
public static interface STATE { |
|
106 |
|
|
107 |
static final String DEVEL = "devel"; |
|
108 |
static final String TESTING = "testing"; |
|
109 |
static final String PILOT = "pilot"; |
|
110 |
static final String PROTOTYPE = "prototype"; |
|
111 |
static final String ALPHA = "alpha"; |
|
112 |
static final String BETA = "beta"; |
|
113 |
static final String RC = "RC"; |
|
114 |
static final String FINAL = "final"; |
|
115 |
} |
|
116 |
|
|
117 |
/** |
|
118 |
* Supported operating system default values. |
|
119 |
*/ |
|
120 |
public static interface OS { |
|
121 |
|
|
122 |
static final String ALL = "all"; |
|
123 |
static final String LINUX = "lin"; |
|
124 |
static final String WINDOWS = "win"; |
|
125 |
static final String DARWIN = "darwin"; |
|
126 |
} |
|
127 |
|
|
128 |
/** |
|
129 |
* Supported architecture default values. |
|
130 |
*/ |
|
131 |
public static interface ARCH { |
|
132 |
|
|
133 |
static final String ALL = "all"; |
|
134 |
static final String X86 = "x86"; |
|
135 |
static final String X86_64 = "x86_64"; |
|
136 |
} |
|
137 |
|
|
138 |
/** |
|
139 |
* Supported Java virtual machine version default values. |
|
140 |
*/ |
|
141 |
public static interface JVM { |
|
142 |
|
|
143 |
static final String J1_5 = "j1_5"; |
|
144 |
static final String J1_6 = "j1_6"; |
|
145 |
static final String J1_7 = "j1_7"; |
|
146 |
static final String J1_8 = "j1_8"; |
|
147 |
static final String J1_9 = "j1_9"; |
|
148 |
} |
|
149 |
|
|
150 |
/** |
|
151 |
* Fields into the bundle file name message format. |
|
152 |
* |
|
153 |
* @see InstallerManager#getPackageSetNameFormat() |
|
154 |
* @see InstallerManager#setPackageSetNameFormat(String) |
|
155 |
*/ |
|
156 |
public static interface PACKAGE_FILE_NAME_FIELDS { |
|
157 |
|
|
158 |
static final int GVSIG_VERSION = 0; |
|
159 |
static final int NAME = 1; |
|
160 |
static final int VERSION = 2; |
|
161 |
static final int BUILD = 3; |
|
162 |
static final int STATE = 4; |
|
163 |
static final int OS = 5; |
|
164 |
static final int ARCH = 6; |
|
165 |
static final int JVM = 7; |
|
166 |
} |
|
167 |
|
|
168 |
/** |
|
169 |
* It registers a class that implements the service for the creation of |
|
170 |
* bundle that contains inside a package of type plugin. The registered |
|
171 |
* class have to implement the {@link MakePluginPackageService} interface. |
|
172 |
* |
|
173 |
* @param clazz |
|
174 |
* class that implements the {@link MakePluginPackageService} |
|
175 |
* interface. |
|
176 |
*/ |
|
177 |
public void registerMakePluginPackageService( |
|
178 |
Class<? extends MakePluginPackageService> clazz); |
|
179 |
|
|
180 |
// /** |
|
181 |
// * It creates and returns an object that is used to create a bundle that |
|
182 |
// * contains inside a package of type plugin. All the parameters are set |
|
183 |
// * using the {@link MakePluginPackageService} interface. * |
|
184 |
// * |
|
185 |
// * @return an object that is used to create a plugin installer |
|
186 |
// * @throws MakePluginPackageServiceException |
|
187 |
// * when there is a problem creating the service |
|
188 |
// */ |
|
189 |
// public MakePluginPackageService getMakePluginPackageService( |
|
190 |
// File pluginsDirectory) throws MakePluginPackageServiceException; |
|
191 |
|
|
192 |
/** |
|
193 |
* It creates and returns an object that is used to create a bundle that |
|
194 |
* contains inside a package of type plugin. All the parameters are set |
|
195 |
* using the {@link MakePluginPackageService} interface. * |
|
196 |
* |
|
197 |
* @return an object that is used to create a plugin installer |
|
198 |
* @throws MakePluginPackageServiceException |
|
199 |
* @throws MakePluginPackageServiceException |
|
200 |
* when there is a problem creating the service |
|
201 |
*/ |
|
202 |
public MakePluginPackageService getMakePluginPackageService() |
|
203 |
throws MakePluginPackageServiceException; |
|
204 |
|
|
205 |
/** |
|
206 |
* Returns a list of package infos for the already installed plugins. |
|
207 |
* |
|
208 |
* @param pluginsDirectory |
|
209 |
* where to look for the installed plugins |
|
210 |
* @return the list of package infos for the already installed plugins |
|
211 |
* @throws MakePluginPackageServiceException |
|
212 |
* if there is an error loading the information of the installed |
|
213 |
* plugins |
|
214 |
* @deprecated use getInstalledPackages() without parameters |
|
215 |
*/ |
|
216 |
public PackageInfo[] getInstalledPackages(File pluginsDirectory) |
|
217 |
throws MakePluginPackageServiceException; |
|
218 |
|
|
219 |
/** |
|
220 |
* Returns a list of package infos for the already installed plugins. |
|
221 |
* |
|
222 |
* @return the list of package infos for the already installed plugins |
|
223 |
* @throws MakePluginPackageServiceException |
|
224 |
* if there is an error loading the information of the installed |
|
225 |
* plugins |
|
226 |
*/ |
|
227 |
public PackageInfo[] getInstalledPackages() |
|
228 |
throws MakePluginPackageServiceException; |
|
229 |
|
|
230 |
/** |
|
231 |
* Returns the package bundle file name format. |
|
232 |
* <p> |
|
233 |
* The string has to use a suitable {@link MessageFormat} format, and the |
|
234 |
* available field numbers are the ones defined in the |
|
235 |
* BUNDLE_FILE_NAME_FIELDS interface. |
|
236 |
* </p> |
|
237 |
* |
|
238 |
* @return the package bundle file name format. |
|
239 |
*/ |
|
240 |
public String getPackageSetNameFormat(); |
|
241 |
|
|
242 |
/** |
|
243 |
* Sets the package bundle file name format. |
|
244 |
* |
|
245 |
* @see InstallerManager#getPackageSetNameFormat() |
|
246 |
* @param packageBundleNameFormat |
|
247 |
* the package bundle file name format. |
|
248 |
*/ |
|
249 |
public void setPackageSetNameFormat(String packageBundleNameFormat); |
|
250 |
|
|
251 |
/** |
|
252 |
* Returns the name of the package set file for a given package info. |
|
253 |
* |
|
254 |
* @param info |
|
255 |
* of the plugin |
|
256 |
* @return the name of the package set file |
|
257 |
*/ |
|
258 |
public String getPackageSetFileName(PackageInfo info); |
|
259 |
|
|
260 |
/** |
|
261 |
* Returns the name of the package file for a given package info. |
|
262 |
* |
|
263 |
* @param info |
|
264 |
* of the plugin |
|
265 |
* @return the name of the package file |
|
266 |
*/ |
|
267 |
public String getPackageFileName(PackageInfo info); |
|
268 |
|
|
269 |
/** |
|
270 |
* Returns the name of the package index file for a given package info. |
|
271 |
* |
|
272 |
* @param info |
|
273 |
* of the plugin |
|
274 |
* @return the name of the package index file |
|
275 |
*/ |
|
276 |
public String getPackageIndexFileName(PackageInfo info); |
|
277 |
|
|
278 |
/** |
|
279 |
* It registers a class that implements the service for the installation of |
|
280 |
* a package that is inside a bundle. This class has to implement the |
|
281 |
* {@link InstallPackageService} interface. |
|
282 |
* |
|
283 |
* @param clazz |
|
284 |
* class that implements the {@link InstallPackageService} |
|
285 |
* interface. |
|
286 |
*/ |
|
287 |
public void registerInstallPackageService( |
|
288 |
Class<? extends InstallPackageService> clazz); |
|
289 |
|
|
290 |
/** |
|
291 |
* It creates and returns an object that is used to install a package in |
|
292 |
* gvSIG. All the parameters are set using the {@link InstallPackageService} |
|
293 |
* interface. |
|
294 |
* |
|
295 |
* @return an object that is used to install the package. |
|
296 |
* @throws InstallPackageServiceException |
|
297 |
* when there is a problem creating the service. |
|
298 |
*/ |
|
299 |
public InstallPackageService getInstallPackageService() |
|
300 |
throws InstallPackageServiceException; |
|
301 |
|
|
302 |
/** |
|
303 |
* Returns the default extensions of the package files. |
|
304 |
* |
|
305 |
* @return the default extensions of the package files |
|
306 |
*/ |
|
307 |
public String getDefaultPackageFileExtension(); |
|
308 |
|
|
309 |
/** |
|
310 |
* Returns the default extensions of the package set files. |
|
311 |
* |
|
312 |
* @return the default extensions of the package set files |
|
313 |
*/ |
|
314 |
public String getDefaultPackageSetFileExtension(); |
|
315 |
|
|
316 |
/** |
|
317 |
* Returns the default extensions of the index set files. |
|
318 |
* |
|
319 |
* @return the default extensions of the index set files |
|
320 |
*/ |
|
321 |
public String getDefaultIndexSetFileExtension(); |
|
322 |
|
|
323 |
/** |
|
324 |
* Return the OS code of the system |
|
325 |
* |
|
326 |
* @return os code of the system |
|
327 |
*/ |
|
328 |
public String getOperatingSystem(); |
|
329 |
public String getOperatingSystemFamily(); |
|
330 |
public String getOperatingSystemName(); |
|
331 |
public String getOperatingSystemVersion(); |
|
332 |
/** |
|
333 |
* Returns the Architecture code of the system |
|
334 |
* |
|
335 |
* @return architecture code of the system |
|
336 |
*/ |
|
337 |
public String getArchitecture(); |
|
338 |
|
|
339 |
/** |
|
340 |
* Create a empty dependency object. |
|
341 |
* |
|
342 |
* @return the dependency |
|
343 |
*/ |
|
344 |
public Dependency createDependency(); |
|
345 |
|
|
346 |
/** |
|
347 |
* Create a dependency instance with the data of the package. |
|
348 |
* |
|
349 |
* @param packageInfo |
|
350 |
* @return a dependency of the package |
|
351 |
*/ |
|
352 |
public Dependency createDependency(PackageInfo packageInfo); |
|
353 |
|
|
354 |
/** |
|
355 |
* Create a dependencies calculator. |
|
356 |
* |
|
357 |
* @return the dependencias calculator |
Also available in: Unified diff