svn-gvsig-desktop / branches / v2_0_0_prep / extensions / org.gvsig.installer / org.gvsig.installer.prov / org.gvsig.installer.prov.plugin / src / main / java / org / gvsig / installer / prov / plugin / execution / PluginInstallerExecutionProvider.java @ 32401
History | View | Annotate | Download (3.18 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.prov.plugin.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.InstallerLocator; |
35 |
import org.gvsig.installer.lib.api.execution.InstallerExecutionServiceException; |
36 |
import org.gvsig.installer.lib.spi.InstallerProviderLocator; |
37 |
import org.gvsig.installer.lib.spi.InstallerProviderManager; |
38 |
import org.gvsig.installer.lib.spi.InstallerProviderServices; |
39 |
import org.gvsig.installer.lib.spi.execution.InstallerExecutionProvider; |
40 |
import org.gvsig.tools.service.spi.AbstractProvider; |
41 |
import org.gvsig.tools.service.spi.ProviderServices; |
42 |
|
43 |
/**
|
44 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a>
|
45 |
*/
|
46 |
public class PluginInstallerExecutionProvider extends AbstractProvider implements InstallerExecutionProvider { |
47 |
private File pluginsDirectory = null; |
48 |
private InputStream inputStream = null; |
49 |
private static final InstallerProviderManager installerProviderManager = InstallerProviderLocator.getProviderManager(); |
50 |
|
51 |
public PluginInstallerExecutionProvider(ProviderServices providerServices) {
|
52 |
super(providerServices);
|
53 |
} |
54 |
|
55 |
public InstallerInfo getInstalledInstallerInfo() {
|
56 |
// TODO Auto-generated method stub
|
57 |
return null; |
58 |
} |
59 |
|
60 |
public InstallerInfo getInstallerInfo() {
|
61 |
// TODO Auto-generated method stub
|
62 |
return null; |
63 |
} |
64 |
|
65 |
public void install() throws InstallerExecutionServiceException { |
66 |
InstallerProviderServices installerProviderServices = installerProviderManager.createInstallerProviderServices(); |
67 |
installerProviderServices.decompress(inputStream, pluginsDirectory); |
68 |
} |
69 |
|
70 |
public boolean isInstalled() { |
71 |
// TODO Auto-generated method stub
|
72 |
return false; |
73 |
} |
74 |
|
75 |
public boolean isUpdated() { |
76 |
// TODO Auto-generated method stub
|
77 |
return false; |
78 |
} |
79 |
|
80 |
public void setInstaller(InputStream inputStream) |
81 |
throws InstallerExecutionServiceException {
|
82 |
this.inputStream = inputStream;
|
83 |
} |
84 |
|
85 |
public void setApplicationDirectory(File applicationDirectory) throws InstallerExecutionServiceException { |
86 |
pluginsDirectory = new File(applicationDirectory + File.separator + "gvSIG" + File.separator + "extensiones"); |
87 |
if (!pluginsDirectory.exists()){
|
88 |
throw new InstallerExecutionServiceException("plugins_directory_not_found"); |
89 |
} |
90 |
} |
91 |
} |
92 |
|