Revision 33686
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/PackageInfo.java | ||
---|---|---|
37 | 37 |
* <li> |
38 | 38 |
* <lu><b>Code</b>: unique identifier for the package.</lu> |
39 | 39 |
* <lu><b>Name</b>: name of the package.</lu> |
40 |
* <lu><b>Decription</b>: brief description of the package functionality</lu> * |
|
40 |
* <lu><b>Description</b>: brief description of the package functionality</lu> *
|
|
41 | 41 |
* <lu><b>Version</b>: number of version.</lu> |
42 | 42 |
* <lu><b>Build</b>: build number.</lu> |
43 | 43 |
* <lu><b>State</b>: the state of the package (testing, RC1...).</lu> |
44 |
* <lu><b>Operating system</b>: the operating system supported (lin, win, mac_10_6, ...).</lu> |
|
45 |
* <lu><b>Architecture</b>: the state of the package (testing, RC1, ...).</lu> |
|
46 |
* <lu><b>JavaVM</b>: the minimum java version supported (1.5, 1.6, ...).</lu> |
|
44 | 47 |
* <lu><b>Is Official</b>: if the package is official or if is a not official package.</lu> |
45 | 48 |
* <lu><b>Type</b>: package type (plugin, theme, translation...). Depending of this value a |
46 | 49 |
* different installation provider is selected to control the installation process.</lu> |
... | ... | |
114 | 117 |
|
115 | 118 |
public void setType(String type); |
116 | 119 |
|
120 |
public String getOperatingSystem(); |
|
121 |
|
|
122 |
public void setOperatingSystem(String operatingSystem); |
|
123 |
|
|
124 |
public String getArchitecture(); |
|
125 |
|
|
126 |
public void setArchitecture(String architecture); |
|
127 |
|
|
128 |
public String getJavaVM(); |
|
129 |
|
|
130 |
public void setJavaVM(String javaVM); |
|
131 |
|
|
132 |
public String getGvSIGVersion(); |
|
133 |
|
|
134 |
public void setGvSIGVersion(String gvSIGVersion); |
|
135 |
|
|
117 | 136 |
/** |
118 | 137 |
* Add an external file that have to be copied in the |
119 | 138 |
* installation process. |
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/InstallerManager.java | ||
---|---|---|
84 | 84 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
85 | 85 |
*/ |
86 | 86 |
public interface InstallerManager extends Manager { |
87 |
|
|
88 |
/** |
|
87 |
|
|
88 |
public static interface STATE { |
|
89 |
public static final String DEVEL = "devel"; |
|
90 |
public static final String TESTING = "testing"; |
|
91 |
public static final String PILOT = "pilot"; |
|
92 |
public static final String PROTOTYPE = "prototype"; |
|
93 |
public static final String ALPHA = "alpha"; |
|
94 |
public static final String BETA = "beta"; |
|
95 |
public static final String RC = "RC"; |
|
96 |
public static final String FINAL = "final"; |
|
97 |
} |
|
98 |
|
|
99 |
public static interface OS { |
|
100 |
public static final String ALL = "all"; |
|
101 |
public static final String LINUX = "lin"; |
|
102 |
public static final String WINDOWS = "win"; |
|
103 |
public static final String OSX_10_4 = "osx_10_4"; |
|
104 |
public static final String OSX_10_5 = "osx_10_5"; |
|
105 |
public static final String OSX_10_6 = "osx_10_6"; |
|
106 |
} |
|
107 |
|
|
108 |
public static interface ARCH { |
|
109 |
public static final String ALL = "all"; |
|
110 |
public static final String X86 = "x86"; |
|
111 |
public static final String X86_64 = "x86_64"; |
|
112 |
} |
|
113 |
|
|
114 |
public static interface JVM { |
|
115 |
public static final String J1_5 = "j1_5"; |
|
116 |
public static final String J1_6 = "j1_6"; |
|
117 |
} |
|
118 |
|
|
119 |
/** |
|
89 | 120 |
* It registers a class that implements the service for the creation of |
90 | 121 |
* bundle that contains inside a package of type plugin. The registered class |
91 | 122 |
* have to implement the {@link MakePluginPackageService} interface. |
92 | 123 |
* @param clazz |
93 | 124 |
* class that implements the {@link MakePluginPackageService} interface. |
94 | 125 |
*/ |
95 |
@SuppressWarnings(value = "unchecked")
|
|
96 |
public void registerMakePluginPackageService(Class clazz);
|
|
126 |
public void registerMakePluginPackageService(
|
|
127 |
Class<? extends MakePluginPackageService> clazz);
|
|
97 | 128 |
|
98 | 129 |
/** |
99 | 130 |
* It creates and returns an object that is used to create a bundle |
... | ... | |
106 | 137 |
*/ |
107 | 138 |
public MakePluginPackageService getMakePluginPackageService(File pluginsDirectory) throws MakePluginPackageServiceException; |
108 | 139 |
|
140 |
public String getPackageBundleNameFormat(); |
|
141 |
|
|
142 |
public void setPackageBundleNameFormat(String packageBundleNameFormat); |
|
143 |
|
|
144 |
public String getPackageBundleFileName(PackageInfo info); |
|
145 |
|
|
109 | 146 |
/** |
110 | 147 |
* It registers a class that implements the service for the installation |
111 | 148 |
* of a package that is inside a bundle. This class has to implement |
... | ... | |
113 | 150 |
* @param clazz |
114 | 151 |
* class that implements the {@link InstallPackageService} interface. |
115 | 152 |
*/ |
116 |
@SuppressWarnings("unchecked")
|
|
117 |
public void registerInstallPackageService(Class clazz);
|
|
153 |
public void registerInstallPackageService(
|
|
154 |
Class<? extends InstallPackageService> clazz);
|
|
118 | 155 |
|
119 | 156 |
/** |
120 | 157 |
* It creates and returns an object that is used to install a package |
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/main/java/org/gvsig/installer/lib/impl/info/InstallerInfoFileReader.java | ||
---|---|---|
114 | 114 |
installerInfoResource.setType(properties.getProperty(InstallerInfoTags.TYPE)); |
115 | 115 |
String build = properties.getProperty(InstallerInfoTags.BUILD); |
116 | 116 |
try{ |
117 |
installerInfoResource.setBuild(Integer.parseInt(properties.getProperty(InstallerInfoTags.BUILD)));
|
|
117 |
installerInfoResource.setBuild(Integer.parseInt(build));
|
|
118 | 118 |
}catch(Exception e){ |
119 | 119 |
installerInfoResource.setBuild(0); |
120 | 120 |
} |
121 | 121 |
installerInfoResource.setState(properties.getProperty(InstallerInfoTags.STATE)); |
122 | 122 |
try{ |
123 |
installerInfoResource.setOfficial(Boolean.parseBoolean(properties.getProperty(InstallerInfoTags.OFFCICIAL))); |
|
123 |
installerInfoResource.setOfficial(Boolean.parseBoolean(properties |
|
124 |
.getProperty(InstallerInfoTags.OFFICIAL))); |
|
124 | 125 |
}catch(Exception e){ |
125 | 126 |
installerInfoResource.setOfficial(false); |
126 |
} |
|
127 |
} |
|
128 |
|
|
129 |
String os = properties.getProperty(InstallerInfoTags.OS); |
|
130 |
if (os != null) { |
|
131 |
installerInfoResource.setOperatingSystem(os); |
|
132 |
} |
|
133 |
|
|
134 |
String arch = properties.getProperty(InstallerInfoTags.ARCHITECTURE); |
|
135 |
if (arch != null) { |
|
136 |
installerInfoResource.setArchitecture(arch); |
|
137 |
} |
|
138 |
|
|
139 |
String jvm = properties.getProperty(InstallerInfoTags.JVM); |
|
140 |
if (jvm != null) { |
|
141 |
installerInfoResource.setJavaVM(jvm); |
|
142 |
} |
|
143 |
|
|
144 |
installerInfoResource.setGvSIGVersion(properties |
|
145 |
.getProperty(InstallerInfoTags.GVSIG_VERSION)); |
|
127 | 146 |
} |
128 | 147 |
|
129 | 148 |
} |
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/main/java/org/gvsig/installer/lib/impl/info/InstallerInfoFileWriter.java | ||
---|---|---|
88 | 88 |
properties.setProperty(InstallerInfoTags.VERSION, installInfo.getVersion()); |
89 | 89 |
properties.setProperty(InstallerInfoTags.BUILD, new Integer(installInfo.getBuild()).toString()); |
90 | 90 |
properties.setProperty(InstallerInfoTags.STATE, installInfo.getState()); |
91 |
properties.setProperty(InstallerInfoTags.OFFCICIAL, new Boolean(installInfo.isOfficial()).toString());
|
|
91 |
properties.setProperty(InstallerInfoTags.OFFICIAL, new Boolean(installInfo.isOfficial()).toString()); |
|
92 | 92 |
properties.setProperty(InstallerInfoTags.TYPE, installInfo.getType()); |
93 |
properties.setProperty(InstallerInfoTags.OS, |
|
94 |
installInfo.getOperatingSystem()); |
|
95 |
properties.setProperty(InstallerInfoTags.ARCHITECTURE, |
|
96 |
installInfo.getArchitecture()); |
|
97 |
properties.setProperty(InstallerInfoTags.JVM, |
|
98 |
installInfo.getJavaVM()); |
|
99 |
properties.setProperty(InstallerInfoTags.GVSIG_VERSION, |
|
100 |
installInfo.getGvSIGVersion()); |
|
93 | 101 |
properties.store(os, ""); |
94 | 102 |
os.close(); |
95 | 103 |
} catch (IOException e) { |
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/main/java/org/gvsig/installer/lib/impl/info/InstallerInfoTags.java | ||
---|---|---|
36 | 36 |
public static final String VERSION = "version"; |
37 | 37 |
public static final String BUILD = "build"; |
38 | 38 |
public static final String STATE = "state"; |
39 |
public static final String OFFCICIAL = "oficial";
|
|
39 |
public static final String OFFICIAL = "official";
|
|
40 | 40 |
public static final String TYPE = "type"; |
41 |
public static final String OS = "operating-system"; |
|
42 |
public static final String ARCHITECTURE = "architecture"; |
|
43 |
public static final String JVM = "jmv"; |
|
44 |
public static final String GVSIG_VERSION = "gvSIG-version"; |
|
41 | 45 |
} |
42 | 46 |
|
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/main/java/org/gvsig/installer/lib/impl/DefaultPackageInfo.java | ||
---|---|---|
31 | 31 |
import java.util.ArrayList; |
32 | 32 |
import java.util.List; |
33 | 33 |
|
34 |
import org.gvsig.installer.lib.api.InstallerManager.ARCH; |
|
35 |
import org.gvsig.installer.lib.api.InstallerManager.JVM; |
|
36 |
import org.gvsig.installer.lib.api.InstallerManager.OS; |
|
37 |
import org.gvsig.installer.lib.api.InstallerManager.STATE; |
|
34 | 38 |
import org.gvsig.installer.lib.api.PackageInfo; |
35 | 39 |
|
36 | 40 |
/** |
37 | 41 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
38 | 42 |
*/ |
39 | 43 |
public class DefaultPackageInfo implements PackageInfo{ |
40 |
protected String code = null; |
|
41 |
protected String name = null; |
|
42 |
protected String description = null; |
|
43 |
protected String version = "0.0.1"; |
|
44 |
protected int build = 0; |
|
45 |
protected String state = "Testing"; |
|
46 |
protected boolean official; |
|
47 |
protected List<File> selectedFiles = null; |
|
48 |
protected String antScript = null; |
|
49 |
protected String type = null; |
|
44 |
private String code = null; |
|
45 |
private String name = null; |
|
46 |
private String description = null; |
|
47 |
private String version = "0.0.1"; |
|
48 |
private int build = 0; |
|
49 |
private boolean official; |
|
50 |
private List<File> selectedFiles = null; |
|
51 |
private String antScript = null; |
|
52 |
private String type = null; |
|
53 |
|
|
54 |
private String state = STATE.DEVEL; |
|
55 |
private String operatingSystem = OS.ALL; |
|
56 |
private String architecture = ARCH.ALL; |
|
57 |
private String javaVM = JVM.J1_5; |
|
50 | 58 |
|
59 |
private String gvSIGVersion; |
|
60 |
|
|
51 | 61 |
public DefaultPackageInfo() { |
52 | 62 |
super(); |
53 | 63 |
selectedFiles = new ArrayList<File>(); |
54 | 64 |
} |
55 | 65 |
|
56 |
public String getCode() {
|
|
66 |
public String getCode() {
|
|
57 | 67 |
return code; |
58 | 68 |
} |
59 | 69 |
|
... | ... | |
109 | 119 |
this.official = official; |
110 | 120 |
} |
111 | 121 |
|
112 |
public void addFileToCopy(File file) { |
|
122 |
public String getOperatingSystem() { |
|
123 |
return operatingSystem; |
|
124 |
} |
|
125 |
|
|
126 |
public void setOperatingSystem(String operatingSystem) { |
|
127 |
this.operatingSystem = operatingSystem; |
|
128 |
} |
|
129 |
|
|
130 |
public String getArchitecture() { |
|
131 |
return architecture; |
|
132 |
} |
|
133 |
|
|
134 |
public void setArchitecture(String architecture) { |
|
135 |
this.architecture = architecture; |
|
136 |
} |
|
137 |
|
|
138 |
public String getJavaVM() { |
|
139 |
return javaVM; |
|
140 |
} |
|
141 |
|
|
142 |
public void setJavaVM(String javaVM) { |
|
143 |
this.javaVM = javaVM; |
|
144 |
} |
|
145 |
|
|
146 |
public void addFileToCopy(File file) { |
|
113 | 147 |
selectedFiles.add(file); |
114 | 148 |
} |
115 | 149 |
|
... | ... | |
139 | 173 |
|
140 | 174 |
public void setType(String type) { |
141 | 175 |
this.type = type; |
142 |
}
|
|
176 |
}
|
|
143 | 177 |
|
178 |
public String getGvSIGVersion() { |
|
179 |
return gvSIGVersion; |
|
180 |
} |
|
181 |
|
|
182 |
public void setGvSIGVersion(String gvSIGVersion) { |
|
183 |
this.gvSIGVersion = gvSIGVersion; |
|
184 |
} |
|
185 |
|
|
144 | 186 |
} |
145 | 187 |
|
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/main/java/org/gvsig/installer/lib/impl/DefaultInstallerManager.java | ||
---|---|---|
28 | 28 |
package org.gvsig.installer.lib.impl; |
29 | 29 |
|
30 | 30 |
import java.io.File; |
31 |
import java.text.MessageFormat; |
|
31 | 32 |
|
32 | 33 |
import org.gvsig.installer.lib.api.InstallerManager; |
34 |
import org.gvsig.installer.lib.api.PackageInfo; |
|
33 | 35 |
import org.gvsig.installer.lib.api.creation.MakePluginPackageService; |
34 | 36 |
import org.gvsig.installer.lib.api.creation.MakePluginPackageServiceException; |
35 | 37 |
import org.gvsig.installer.lib.api.execution.InstallPackageService; |
... | ... | |
57 | 59 |
private ExtensionPointManager extensionPoints = ToolsLocator |
58 | 60 |
.getExtensionPointManager(); |
59 | 61 |
|
62 |
public static final int FIELD_GVSIG_VERSION = 0; |
|
63 |
public static final int FIELD_NAME = 1; |
|
64 |
public static final int FIELD_VERSION = 2; |
|
65 |
public static final int FIELD_BUILD = 3; |
|
66 |
public static final int FIELD_STATE = 4; |
|
67 |
public static final int FIELD_OS = 5; |
|
68 |
public static final int FIELD_ARCH = 6; |
|
69 |
public static final int FIELD_JVM = 7; |
|
70 |
private String packageBundleNameFormat = |
|
71 |
"gvSIG-desktop-{0}-{1}-{2}-{3}-{4}-{5}-{6}-{7}.zip"; |
|
72 |
|
|
60 | 73 |
public DefaultInstallerManager() { |
61 | 74 |
super(new DefaultInstallerProviderManager()); |
62 | 75 |
} |
63 | 76 |
|
77 |
public String getPackageBundleNameFormat() { |
|
78 |
return packageBundleNameFormat; |
|
79 |
} |
|
80 |
|
|
81 |
public void setPackageBundleNameFormat(String packageBundleNameFormat) { |
|
82 |
this.packageBundleNameFormat = packageBundleNameFormat; |
|
83 |
} |
|
84 |
|
|
64 | 85 |
public MakePluginPackageService getMakePluginPackageService( |
65 | 86 |
File pluginsDirectory) throws MakePluginPackageServiceException { |
66 | 87 |
ExtensionPoint ep = |
... | ... | |
94 | 115 |
} |
95 | 116 |
} |
96 | 117 |
|
97 |
public void registerMakePluginPackageService(Class clazz) { |
|
98 |
if (!MakePluginPackageService.class.isAssignableFrom(clazz)) { |
|
99 |
throw new IllegalArgumentException(clazz.getName() |
|
100 |
+ " must implement the InstallerCreationService interface"); |
|
101 |
} |
|
118 |
public void registerMakePluginPackageService( |
|
119 |
Class<? extends MakePluginPackageService> clazz) { |
|
102 | 120 |
ExtensionPoint extensionPoint = |
103 | 121 |
extensionPoints.add(INSTALLER_MANAGER_EXTENSION_POINT, ""); |
104 | 122 |
extensionPoint.append(INSTALLER_CREATION_SERVICE_NAME, "", clazz); |
105 | 123 |
} |
106 | 124 |
|
107 |
public void registerInstallPackageService(Class clazz) { |
|
108 |
if (!InstallPackageService.class.isAssignableFrom(clazz)) { |
|
109 |
throw new IllegalArgumentException(clazz.getName() |
|
110 |
+ " must implement the InstallerExecutionService interface"); |
|
111 |
} |
|
125 |
public void registerInstallPackageService( |
|
126 |
Class<? extends InstallPackageService> clazz) { |
|
112 | 127 |
ExtensionPoint extensionPoint = |
113 | 128 |
extensionPoints.add(INSTALLER_MANAGER_EXTENSION_POINT, ""); |
114 | 129 |
extensionPoint.append(INSTALLER_EXECUTION_SERVICE_NAME, "", clazz); |
... | ... | |
117 | 132 |
public Service getService(DynObject parameters) throws ServiceException { |
118 | 133 |
return null; |
119 | 134 |
} |
135 |
|
|
136 |
public String getPackageBundleFileName(PackageInfo info) { |
|
137 |
Object[] parameters = new Object[8]; |
|
138 |
parameters[FIELD_GVSIG_VERSION] = info.getGvSIGVersion(); |
|
139 |
parameters[FIELD_NAME] = info.getCode(); |
|
140 |
parameters[FIELD_VERSION] = info.getVersion(); |
|
141 |
parameters[FIELD_BUILD] = info.getBuild(); |
|
142 |
parameters[FIELD_STATE] = info.getState(); |
|
143 |
parameters[FIELD_OS] = info.getOperatingSystem(); |
|
144 |
parameters[FIELD_ARCH] = info.getArchitecture(); |
|
145 |
parameters[FIELD_JVM] = info.getJavaVM(); |
|
146 |
return MessageFormat.format(getPackageBundleNameFormat(), parameters); |
|
147 |
} |
|
120 | 148 |
} |
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/main/java/org/gvsig/installer/lib/impl/creation/DefaultMakePluginPackageService.java | ||
---|---|---|
41 | 41 |
import java.util.List; |
42 | 42 |
import java.util.Map; |
43 | 43 |
|
44 |
import org.slf4j.Logger; |
|
45 |
|
|
46 |
import org.gvsig.installer.lib.api.InstallerManager; |
|
44 | 47 |
import org.gvsig.installer.lib.api.PackageInfo; |
45 | 48 |
import org.gvsig.installer.lib.api.creation.MakePluginPackageService; |
46 | 49 |
import org.gvsig.installer.lib.api.creation.MakePluginPackageServiceException; |
... | ... | |
48 | 51 |
import org.gvsig.installer.lib.spi.InstallPackageProviderServices; |
49 | 52 |
import org.gvsig.installer.lib.spi.InstallerProviderLocator; |
50 | 53 |
import org.gvsig.tools.service.Manager; |
51 |
import org.slf4j.Logger; |
|
52 | 54 |
|
53 | 55 |
/** |
54 | 56 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
55 | 57 |
*/ |
56 |
public class DefaultMakePluginPackageService implements MakePluginPackageService { |
|
57 |
public static final String ANT_FILE_NAME = "install.xml"; |
|
58 |
public static final String COPIED_FILES_DIRECTORY_NAME = "files"; |
|
59 |
private File pluginsDirectory; |
|
60 |
private static final Logger logger = org.slf4j.LoggerFactory.getLogger(DefaultMakePluginPackageService.class); |
|
61 |
private Manager manager = null; |
|
58 |
public class DefaultMakePluginPackageService implements |
|
59 |
MakePluginPackageService { |
|
62 | 60 |
|
63 |
private List<PackageInfo> installerInfos = null; |
|
64 |
private Map<PackageInfo, String> directories = null; |
|
61 |
public static final String ANT_FILE_NAME = "install.xml"; |
|
62 |
public static final String COPIED_FILES_DIRECTORY_NAME = "files"; |
|
63 |
private File pluginsDirectory; |
|
64 |
private static final Logger logger = org.slf4j.LoggerFactory |
|
65 |
.getLogger(DefaultMakePluginPackageService.class); |
|
66 |
private final InstallerManager manager; |
|
65 | 67 |
|
66 |
protected List<File> selectedFiles = null; |
|
67 |
protected String antScript = null; |
|
68 |
private InstallPackageProviderServices installerProviderServices = null; |
|
68 |
private List<PackageInfo> installerInfos = null; |
|
69 |
private Map<PackageInfo, String> directories = null; |
|
69 | 70 |
|
70 |
public DefaultMakePluginPackageService(Manager manager, File pluginsDirectory) throws MakePluginPackageServiceException { |
|
71 |
super(); |
|
72 |
this.manager = manager; |
|
73 |
installerInfos = new ArrayList<PackageInfo>(); |
|
74 |
directories = new HashMap<PackageInfo, String>(); |
|
75 |
selectedFiles = new ArrayList<File>(); |
|
76 |
installerProviderServices = InstallerProviderLocator.getProviderManager().createInstallerProviderServices(); |
|
77 |
initialize(pluginsDirectory); |
|
78 |
} |
|
71 |
protected List<File> selectedFiles = null; |
|
72 |
protected String antScript = null; |
|
73 |
private InstallPackageProviderServices installerProviderServices = null; |
|
79 | 74 |
|
80 |
private void initialize(File pluginsDirectory) throws MakePluginPackageServiceException { |
|
81 |
if ((!pluginsDirectory.exists()) || (!pluginsDirectory.isDirectory())){ |
|
82 |
throw new MakePluginPackageServiceException("The plugins directory does't exists or not is a directory"); |
|
83 |
} |
|
84 |
this.pluginsDirectory = pluginsDirectory; |
|
75 |
public DefaultMakePluginPackageService(InstallerManager manager, |
|
76 |
File pluginsDirectory) throws MakePluginPackageServiceException { |
|
77 |
super(); |
|
78 |
this.manager = manager; |
|
79 |
installerInfos = new ArrayList<PackageInfo>(); |
|
80 |
directories = new HashMap<PackageInfo, String>(); |
|
81 |
selectedFiles = new ArrayList<File>(); |
|
82 |
installerProviderServices = |
|
83 |
InstallerProviderLocator.getProviderManager() |
|
84 |
.createInstallerProviderServices(); |
|
85 |
initialize(pluginsDirectory); |
|
86 |
} |
|
85 | 87 |
|
86 |
//Read all the installed plugins |
|
87 |
String[] plugins = pluginsDirectory.list(); |
|
88 |
private void initialize(File pluginsDirectory) |
|
89 |
throws MakePluginPackageServiceException { |
|
90 |
if ((!pluginsDirectory.exists()) || (!pluginsDirectory.isDirectory())) { |
|
91 |
throw new MakePluginPackageServiceException( |
|
92 |
"The plugins directory does't exists or not is a directory"); |
|
93 |
} |
|
94 |
this.pluginsDirectory = pluginsDirectory; |
|
88 | 95 |
|
89 |
if (plugins != null) { |
|
90 |
for (int i=0; i<plugins.length; i++) |
|
91 |
{ |
|
92 |
String pluginDirectoryName = plugins[i]; |
|
93 |
File pluginDirectoryFile = getAbsolutePluginPackageDirectory(pluginDirectoryName); |
|
94 |
DefaultPackageInfo packageInfo = new DefaultPackageInfo(); |
|
96 |
// Read all the installed plugins |
|
97 |
String[] plugins = pluginsDirectory.list(); |
|
95 | 98 |
|
96 |
installerProviderServices.readPackageInfo(new File(pluginDirectoryFile.getAbsolutePath()), packageInfo); |
|
99 |
if (plugins != null) { |
|
100 |
for (int i = 0; i < plugins.length; i++) { |
|
101 |
String pluginDirectoryName = plugins[i]; |
|
102 |
File pluginDirectoryFile = |
|
103 |
getAbsolutePluginPackageDirectory(pluginDirectoryName); |
|
104 |
DefaultPackageInfo packageInfo = new DefaultPackageInfo(); |
|
97 | 105 |
|
98 |
//Checks if the ant file exists |
|
99 |
File antFile = getAntFile(pluginDirectoryFile); |
|
100 |
if (antFile.exists()){ |
|
101 |
try { |
|
102 |
packageInfo.setAnScript(readFileAsString(antFile.getAbsolutePath())); |
|
103 |
} catch (IOException e) { |
|
104 |
logger.error("Not possible to read the ant file"); |
|
105 |
} |
|
106 |
} |
|
106 |
installerProviderServices.readPackageInfo(new File( |
|
107 |
pluginDirectoryFile.getAbsolutePath()), packageInfo); |
|
107 | 108 |
|
108 |
//Checks if there are files to copy |
|
109 |
File copiedFilesDirectory = getCopiedFilesDirectory(pluginDirectoryFile); |
|
110 |
if (copiedFilesDirectory.exists()){ |
|
111 |
loadCopiedFiles(copiedFilesDirectory, copiedFilesDirectory, packageInfo); |
|
112 |
} |
|
109 |
// Checks if the ant file exists |
|
110 |
File antFile = getAntFile(pluginDirectoryFile); |
|
111 |
if (antFile.exists()) { |
|
112 |
try { |
|
113 |
packageInfo.setAnScript(readFileAsString(antFile |
|
114 |
.getAbsolutePath())); |
|
115 |
} catch (IOException e) { |
|
116 |
logger.error("Not possible to read the ant file"); |
|
117 |
} |
|
118 |
} |
|
113 | 119 |
|
114 |
installerInfos.add(packageInfo); |
|
115 |
directories.put(packageInfo, pluginDirectoryName); |
|
116 |
} |
|
117 |
} |
|
118 |
} |
|
120 |
// Checks if there are files to copy |
|
121 |
File copiedFilesDirectory = |
|
122 |
getCopiedFilesDirectory(pluginDirectoryFile); |
|
123 |
if (copiedFilesDirectory.exists()) { |
|
124 |
loadCopiedFiles(copiedFilesDirectory, copiedFilesDirectory, |
|
125 |
packageInfo); |
|
126 |
} |
|
119 | 127 |
|
120 |
private void loadCopiedFiles(File file, File filesDirectory, PackageInfo packageInfo) throws MakePluginPackageServiceException{ |
|
121 |
if (file.isDirectory()){ |
|
122 |
File[] files = file.listFiles(); |
|
123 |
for (int i=0 ; i<files.length ; i++){ |
|
124 |
loadCopiedFiles(files[i], filesDirectory, packageInfo); |
|
125 |
} |
|
126 |
}else{ |
|
127 |
//Removing the plugin prefix |
|
128 |
installerInfos.add(packageInfo); |
|
129 |
directories.put(packageInfo, pluginDirectoryName); |
|
130 |
} |
|
131 |
} |
|
132 |
} |
|
128 | 133 |
|
129 |
String pluginFileName = file.getAbsolutePath().substring((int)filesDirectory.getAbsolutePath().length(), file.getAbsolutePath().length()); |
|
134 |
private void loadCopiedFiles(File file, File filesDirectory, |
|
135 |
PackageInfo packageInfo) throws MakePluginPackageServiceException { |
|
136 |
if (file.isDirectory()) { |
|
137 |
File[] files = file.listFiles(); |
|
138 |
for (int i = 0; i < files.length; i++) { |
|
139 |
loadCopiedFiles(files[i], filesDirectory, packageInfo); |
|
140 |
} |
|
141 |
} else { |
|
142 |
// Removing the plugin prefix |
|
130 | 143 |
|
131 |
//Ading the root directory |
|
132 |
File pluginFile = new File(pluginsDirectory.getParentFile().getParentFile().getAbsolutePath() + pluginFileName); |
|
144 |
String pluginFileName = |
|
145 |
file.getAbsolutePath().substring( |
|
146 |
filesDirectory.getAbsolutePath().length(), |
|
147 |
file.getAbsolutePath().length()); |
|
133 | 148 |
|
134 |
packageInfo.addFileToCopy(pluginFile); |
|
135 |
} |
|
136 |
} |
|
149 |
// Ading the root directory |
|
150 |
File pluginFile = |
|
151 |
new File(pluginsDirectory.getParentFile().getParentFile() |
|
152 |
.getAbsolutePath() |
|
153 |
+ pluginFileName); |
|
137 | 154 |
|
155 |
packageInfo.addFileToCopy(pluginFile); |
|
156 |
} |
|
157 |
} |
|
138 | 158 |
|
139 |
public void createPluginPackage(PackageInfo packageInfo, OutputStream installerStream)
|
|
140 |
throws MakePluginPackageServiceException {
|
|
159 |
public void createPluginPackage(PackageInfo packageInfo,
|
|
160 |
OutputStream installerStream) throws MakePluginPackageServiceException {
|
|
141 | 161 |
|
142 |
//Write the package.info file
|
|
143 |
writePackageInfo(packageInfo);
|
|
162 |
// Write the package.info file
|
|
163 |
writePackageInfo(packageInfo);
|
|
144 | 164 |
|
145 |
if (packageInfo.getAntScript() != null){
|
|
146 |
//Create the ant file
|
|
147 |
writeAntFile(packageInfo);
|
|
165 |
if (packageInfo.getAntScript() != null) {
|
|
166 |
// Create the ant file
|
|
167 |
writeAntFile(packageInfo);
|
|
148 | 168 |
|
149 |
//Copy the selected files
|
|
150 |
writeSelectedFiles(packageInfo);
|
|
151 |
}
|
|
169 |
// Copy the selected files
|
|
170 |
writeSelectedFiles(packageInfo);
|
|
171 |
}
|
|
152 | 172 |
|
173 |
String pluginFileName = manager.getPackageBundleFileName(packageInfo); |
|
174 |
installerProviderServices.compress( |
|
175 |
getAbsolutePluginPackageDirectory(packageInfo), pluginFileName, |
|
176 |
installerStream); |
|
177 |
} |
|
153 | 178 |
|
154 |
String pluginFileName = packageInfo.getCode() + "-" + packageInfo.getVersion() + "-" + packageInfo.getBuild(); |
|
155 |
installerProviderServices.compress(getAbsolutePluginPackageDirectory(packageInfo), pluginFileName, installerStream); |
|
156 |
} |
|
179 |
private void writePackageInfo(PackageInfo packageInfo) |
|
180 |
throws MakePluginPackageServiceException { |
|
181 |
installerProviderServices.writePackageInfo( |
|
182 |
getAbsolutePluginPackageDirectory(packageInfo), packageInfo); |
|
183 |
} |
|
157 | 184 |
|
185 |
private void writeAntFile(PackageInfo packageInfo) |
|
186 |
throws MakePluginPackageServiceException { |
|
187 |
try { |
|
188 |
ByteArrayInputStream in = |
|
189 |
new ByteArrayInputStream(packageInfo.getAntScript().getBytes()); |
|
190 |
OutputStream out = |
|
191 |
new FileOutputStream(getAbsoluteAntFile(packageInfo)); |
|
158 | 192 |
|
159 |
private void writePackageInfo(PackageInfo packageInfo) throws MakePluginPackageServiceException{ |
|
160 |
installerProviderServices.writePackageInfo(getAbsolutePluginPackageDirectory(packageInfo), packageInfo); |
|
161 |
} |
|
193 |
// Copy the bits from instream to outstream |
|
194 |
byte[] buf = new byte[1024]; |
|
195 |
int len; |
|
196 |
while ((len = in.read(buf)) > 0) { |
|
197 |
out.write(buf, 0, len); |
|
198 |
} |
|
199 |
in.close(); |
|
200 |
out.close(); |
|
201 |
} catch (IOException e) { |
|
202 |
throw new MakePluginPackageServiceException( |
|
203 |
"Exception writing the ant file"); |
|
204 |
} |
|
162 | 205 |
|
163 |
private void writeAntFile(PackageInfo packageInfo) throws MakePluginPackageServiceException { |
|
164 |
try{ |
|
165 |
ByteArrayInputStream in = new ByteArrayInputStream(packageInfo.getAntScript().getBytes()); |
|
166 |
OutputStream out = new FileOutputStream(getAbsoluteAntFile(packageInfo)); |
|
206 |
} |
|
167 | 207 |
|
168 |
// Copy the bits from instream to outstream |
|
169 |
byte[] buf = new byte[1024]; |
|
170 |
int len; |
|
171 |
while ((len = in.read(buf)) > 0) { |
|
172 |
out.write(buf, 0, len); |
|
173 |
} |
|
174 |
in.close(); |
|
175 |
out.close(); |
|
176 |
}catch(IOException e){ |
|
177 |
throw new MakePluginPackageServiceException("Exception writing the ant file"); |
|
178 |
} |
|
208 |
private void writeSelectedFiles(PackageInfo packageInfo) |
|
209 |
throws MakePluginPackageServiceException { |
|
210 |
try { |
|
211 |
String copiedFilesDirectoryName = |
|
212 |
getAbsoulteCopiedFilesDirectoryName(packageInfo); |
|
179 | 213 |
|
180 |
} |
|
214 |
// Deleting the previous files folder |
|
215 |
File copiedFilesDirectoryfile = new File(copiedFilesDirectoryName); |
|
216 |
deleteDirectory(copiedFilesDirectoryfile); |
|
181 | 217 |
|
218 |
// It works if the plugins directory is in the folder |
|
219 |
// "gvSIG/extensiones" |
|
220 |
String applicationDirectory = |
|
221 |
pluginsDirectory.getParentFile().getParent(); |
|
182 | 222 |
|
183 |
private void writeSelectedFiles(PackageInfo packageInfo) throws MakePluginPackageServiceException {
|
|
184 |
try{
|
|
185 |
String copiedFilesDirectoryName = getAbsoulteCopiedFilesDirectoryName(packageInfo);
|
|
223 |
for (int i = 0; i < packageInfo.getFileToCopySize(); i++) {
|
|
224 |
String sourceFile =
|
|
225 |
packageInfo.getFileToCopyAt(i).getAbsolutePath();
|
|
186 | 226 |
|
187 |
//Deleting the previous files folder |
|
188 |
File copiedFilesDirectoryfile = new File(copiedFilesDirectoryName); |
|
189 |
deleteDirectory(copiedFilesDirectoryfile); |
|
227 |
// Create the final path |
|
228 |
String destFile = |
|
229 |
sourceFile.substring(applicationDirectory.length(), |
|
230 |
sourceFile.length()); |
|
231 |
destFile = copiedFilesDirectoryName + destFile; |
|
190 | 232 |
|
191 |
//It works if the plugins directory is in the folder "gvSIG/extensiones" |
|
192 |
String applicationDirectory = pluginsDirectory.getParentFile().getParent(); |
|
233 |
// Copy the files |
|
234 |
copy(new File(sourceFile), new File(destFile)); |
|
235 |
} |
|
236 |
} catch (IOException e) { |
|
237 |
throw new MakePluginPackageServiceException( |
|
238 |
"Exception copying the files"); |
|
239 |
} |
|
240 |
} |
|
193 | 241 |
|
194 |
for (int i=0 ; i<packageInfo.getFileToCopySize() ; i++){ |
|
195 |
String sourceFile = packageInfo.getFileToCopyAt(i).getAbsolutePath(); |
|
242 |
static public boolean deleteDirectory(File path) { |
|
243 |
if (path.exists()) { |
|
244 |
File[] files = path.listFiles(); |
|
245 |
for (int i = 0; i < files.length; i++) { |
|
246 |
if (files[i].isDirectory()) { |
|
247 |
deleteDirectory(files[i]); |
|
248 |
} else { |
|
249 |
files[i].delete(); |
|
250 |
} |
|
251 |
} |
|
252 |
} |
|
253 |
return (path.delete()); |
|
254 |
} |
|
196 | 255 |
|
197 |
//Create the final path |
|
198 |
String destFile = sourceFile.substring(applicationDirectory.length(), sourceFile.length()); |
|
199 |
destFile = copiedFilesDirectoryName + destFile; |
|
256 |
void copy(File sourceLocation, File targetLocation) throws IOException { |
|
257 |
if (sourceLocation.isDirectory()) { |
|
258 |
if (!targetLocation.exists()) { |
|
259 |
targetLocation.mkdir(); |
|
260 |
} |
|
200 | 261 |
|
262 |
String[] children = sourceLocation.list(); |
|
263 |
for (int i = 0; i < children.length; i++) { |
|
264 |
copy(new File(sourceLocation, children[i]), new File( |
|
265 |
targetLocation, children[i])); |
|
266 |
} |
|
267 |
} else { |
|
268 |
targetLocation.getParentFile().mkdirs(); |
|
201 | 269 |
|
202 |
//Copy the files |
|
203 |
copy(new File(sourceFile), new File(destFile)); |
|
204 |
} |
|
205 |
}catch(IOException e){ |
|
206 |
throw new MakePluginPackageServiceException("Exception copying the files"); |
|
207 |
} |
|
208 |
} |
|
270 |
InputStream in = new FileInputStream(sourceLocation); |
|
271 |
OutputStream out = new FileOutputStream(targetLocation); |
|
209 | 272 |
|
273 |
// Copy the bits from instream to outstream |
|
274 |
byte[] buf = new byte[1024]; |
|
275 |
int len; |
|
276 |
while ((len = in.read(buf)) > 0) { |
|
277 |
out.write(buf, 0, len); |
|
278 |
} |
|
279 |
in.close(); |
|
280 |
out.close(); |
|
281 |
} |
|
282 |
} |
|
210 | 283 |
|
284 |
private String getPluginPackageDirectory(PackageInfo packageInfo) { |
|
285 |
return directories.get(packageInfo); |
|
286 |
} |
|
211 | 287 |
|
212 |
static public boolean deleteDirectory(File path) { |
|
213 |
if( path.exists() ) { |
|
214 |
File[] files = path.listFiles(); |
|
215 |
for(int i=0; i<files.length; i++) { |
|
216 |
if(files[i].isDirectory()) { |
|
217 |
deleteDirectory(files[i]); |
|
218 |
} |
|
219 |
else { |
|
220 |
files[i].delete(); |
|
221 |
} |
|
222 |
} |
|
223 |
} |
|
224 |
return( path.delete() ); |
|
225 |
} |
|
288 |
private String getCopiedFilesDirectoryName(PackageInfo packageInfo) |
|
289 |
throws MakePluginPackageServiceException { |
|
290 |
return getPluginPackageDirectory(packageInfo) + File.separator |
|
291 |
+ COPIED_FILES_DIRECTORY_NAME; |
|
292 |
} |
|
226 | 293 |
|
294 |
private File getCopiedFilesDirectory(File pluginDirectory) |
|
295 |
throws MakePluginPackageServiceException { |
|
296 |
return new File(pluginDirectory.getAbsolutePath() + File.separator |
|
297 |
+ COPIED_FILES_DIRECTORY_NAME); |
|
298 |
} |
|
227 | 299 |
|
228 |
void copy(File sourceLocation , File targetLocation) throws IOException {
|
|
229 |
if (sourceLocation.isDirectory()) {
|
|
230 |
if (!targetLocation.exists()) {
|
|
231 |
targetLocation.mkdir();
|
|
232 |
}
|
|
300 |
private String getAbsoulteCopiedFilesDirectoryName(PackageInfo packageInfo)
|
|
301 |
throws MakePluginPackageServiceException {
|
|
302 |
return getAbsolutePluginPackageDirectory(packageInfo).getAbsolutePath()
|
|
303 |
+ File.separator + COPIED_FILES_DIRECTORY_NAME;
|
|
304 |
}
|
|
233 | 305 |
|
234 |
String[] children = sourceLocation.list(); |
|
235 |
for (int i=0; i<children.length; i++) { |
|
236 |
copy(new File(sourceLocation, children[i]), |
|
237 |
new File(targetLocation, children[i])); |
|
238 |
} |
|
239 |
} else { |
|
240 |
targetLocation.getParentFile().mkdirs(); |
|
306 |
private String getAntFileName(PackageInfo packageInfo) |
|
307 |
throws MakePluginPackageServiceException { |
|
308 |
return getPluginPackageDirectory(packageInfo) + File.separator |
|
309 |
+ ANT_FILE_NAME; |
|
310 |
} |
|
241 | 311 |
|
242 |
InputStream in = new FileInputStream(sourceLocation); |
|
243 |
OutputStream out = new FileOutputStream(targetLocation); |
|
312 |
private File getAntFile(File pluginDirectory) |
|
313 |
throws MakePluginPackageServiceException { |
|
314 |
return new File(pluginDirectory.getAbsolutePath() + File.separator |
|
315 |
+ ANT_FILE_NAME); |
|
316 |
} |
|
244 | 317 |
|
245 |
// Copy the bits from instream to outstream |
|
246 |
byte[] buf = new byte[1024]; |
|
247 |
int len; |
|
248 |
while ((len = in.read(buf)) > 0) { |
|
249 |
out.write(buf, 0, len); |
|
250 |
} |
|
251 |
in.close(); |
|
252 |
out.close(); |
|
253 |
} |
|
254 |
} |
|
318 |
private File getAbsoluteAntFile(PackageInfo packageInfo) |
|
319 |
throws MakePluginPackageServiceException { |
|
320 |
return new File(pluginsDirectory.getAbsolutePath() + File.separator |
|
321 |
+ getAntFileName(packageInfo)); |
|
322 |
} |
|
255 | 323 |
|
256 |
private String getPluginPackageDirectory(PackageInfo packageInfo){ |
|
257 |
return directories.get(packageInfo); |
|
258 |
} |
|
324 |
private File getAbsolutePluginPackageDirectory(PackageInfo packageInfo) |
|
325 |
throws MakePluginPackageServiceException { |
|
326 |
return new File(pluginsDirectory.getAbsolutePath() + File.separator |
|
327 |
+ getPluginPackageDirectory(packageInfo)); |
|
328 |
} |
|
259 | 329 |
|
260 |
private String getCopiedFilesDirectoryName(PackageInfo packageInfo) throws MakePluginPackageServiceException{ |
|
261 |
return getPluginPackageDirectory(packageInfo) + File.separator + COPIED_FILES_DIRECTORY_NAME; |
|
262 |
} |
|
330 |
private File getAbsolutePluginPackageDirectory(String pluginDirectory) |
|
331 |
throws MakePluginPackageServiceException { |
|
332 |
return new File(pluginsDirectory.getAbsolutePath() + File.separator |
|
333 |
+ pluginDirectory); |
|
334 |
} |
|
263 | 335 |
|
264 |
private File getCopiedFilesDirectory(File pluginDirectory) throws MakePluginPackageServiceException{
|
|
265 |
return new File(pluginDirectory.getAbsolutePath() + File.separator + COPIED_FILES_DIRECTORY_NAME);
|
|
266 |
}
|
|
336 |
public Manager getManager() {
|
|
337 |
return this.manager;
|
|
338 |
}
|
|
267 | 339 |
|
268 |
private String getAbsoulteCopiedFilesDirectoryName(PackageInfo packageInfo) throws MakePluginPackageServiceException{ |
|
269 |
return getAbsolutePluginPackageDirectory(packageInfo).getAbsolutePath() + File.separator + COPIED_FILES_DIRECTORY_NAME; |
|
270 |
} |
|
340 |
public PackageInfo getPluginPackageInfo(int index) { |
|
341 |
if (index >= installerInfos.size()) { |
|
342 |
return null; |
|
343 |
} |
|
344 |
return installerInfos.get(index); |
|
345 |
} |
|
271 | 346 |
|
272 |
private String getAntFileName(PackageInfo packageInfo) throws MakePluginPackageServiceException{ |
|
273 |
return getPluginPackageDirectory(packageInfo) + File.separator + ANT_FILE_NAME; |
|
274 |
} |
|
347 |
public PackageInfo getPluginPackageInfo(String code) { |
|
348 |
for (int i = 0; i < getPluginPackageCount(); i++) { |
|
349 |
if (installerInfos.get(i).getCode().equals(code)) { |
|
350 |
return installerInfos.get(i); |
|
351 |
} |
|
352 |
} |
|
353 |
return null; |
|
354 |
} |
|
275 | 355 |
|
276 |
private File getAntFile(File pluginDirectory) throws MakePluginPackageServiceException{
|
|
277 |
return new File(pluginDirectory.getAbsolutePath() + File.separator + ANT_FILE_NAME);
|
|
278 |
}
|
|
356 |
public int getPluginPackageCount() {
|
|
357 |
return installerInfos.size();
|
|
358 |
}
|
|
279 | 359 |
|
280 |
private File getAbsoluteAntFile(PackageInfo packageInfo) throws MakePluginPackageServiceException{ |
|
281 |
return new File(pluginsDirectory.getAbsolutePath() + File.separator + getAntFileName(packageInfo)); |
|
282 |
} |
|
360 |
public String getDefaultAntScript() |
|
361 |
throws MakePluginPackageServiceException { |
|
362 |
try { |
|
363 |
return readFileAsString(getClass().getClassLoader() |
|
364 |
.getResource(ANT_FILE_NAME).getFile()); |
|
365 |
} catch (IOException e) { |
|
366 |
throw new MakePluginPackageServiceException( |
|
367 |
"Impossible to read the default ant file", e); |
|
368 |
} |
|
369 |
} |
|
283 | 370 |
|
284 |
private File getAbsolutePluginPackageDirectory(PackageInfo packageInfo) throws MakePluginPackageServiceException{ |
|
285 |
return new File(pluginsDirectory.getAbsolutePath() + File.separator + getPluginPackageDirectory(packageInfo)); |
|
286 |
} |
|
371 |
private String readFileAsString(String filePath) throws java.io.IOException { |
|
372 |
StringBuffer fileData = new StringBuffer(1000); |
|
373 |
BufferedReader reader = new BufferedReader(new FileReader(filePath)); |
|
374 |
char[] buf = new char[1024]; |
|
375 |
int numRead = 0; |
|
376 |
while ((numRead = reader.read(buf)) != -1) { |
|
377 |
String readData = String.valueOf(buf, 0, numRead); |
|
378 |
fileData.append(readData); |
|
379 |
buf = new char[1024]; |
|
380 |
} |
|
381 |
reader.close(); |
|
382 |
return fileData.toString(); |
|
383 |
} |
|
287 | 384 |
|
288 |
private File getAbsolutePluginPackageDirectory(String pluginDirectory) throws MakePluginPackageServiceException{ |
|
289 |
return new File(pluginsDirectory.getAbsolutePath() + File.separator + pluginDirectory); |
|
290 |
} |
|
291 |
|
|
292 |
|
|
293 |
|
|
294 |
public Manager getManager() { |
|
295 |
return this.manager; |
|
296 |
} |
|
297 |
|
|
298 |
public PackageInfo getPluginPackageInfo(int index) { |
|
299 |
if (index >= installerInfos.size()){ |
|
300 |
return null; |
|
301 |
} |
|
302 |
return installerInfos.get(index); |
|
303 |
} |
|
304 |
|
|
305 |
public PackageInfo getPluginPackageInfo(String code) { |
|
306 |
for (int i=0 ; i<getPluginPackageCount() ; i++){ |
|
307 |
if (installerInfos.get(i).getCode().equals(code)){ |
|
308 |
return installerInfos.get(i); |
|
309 |
} |
|
310 |
} |
|
311 |
return null; |
|
312 |
} |
|
313 |
|
|
314 |
public int getPluginPackageCount() { |
|
315 |
return installerInfos.size(); |
|
316 |
} |
|
317 |
|
|
318 |
|
|
319 |
public String getDefaultAntScript() throws MakePluginPackageServiceException { |
|
320 |
try { |
|
321 |
return readFileAsString(getClass().getClassLoader().getResource(ANT_FILE_NAME).getFile()); |
|
322 |
} catch (IOException e) { |
|
323 |
throw new MakePluginPackageServiceException("Impossible to read the default ant file", e); |
|
324 |
} |
|
325 |
} |
|
326 |
|
|
327 |
private String readFileAsString(String filePath) |
|
328 |
throws java.io.IOException{ |
|
329 |
StringBuffer fileData = new StringBuffer(1000); |
|
330 |
BufferedReader reader = new BufferedReader( |
|
331 |
new FileReader(filePath)); |
|
332 |
char[] buf = new char[1024]; |
|
333 |
int numRead=0; |
|
334 |
while((numRead=reader.read(buf)) != -1){ |
|
335 |
String readData = String.valueOf(buf, 0, numRead); |
|
336 |
fileData.append(readData); |
|
337 |
buf = new char[1024]; |
|
338 |
} |
|
339 |
reader.close(); |
|
340 |
return fileData.toString(); |
|
341 |
} |
|
342 |
|
|
343 |
|
|
344 |
public File getPluginsDirectory() { |
|
345 |
return pluginsDirectory; |
|
346 |
} |
|
385 |
public File getPluginsDirectory() { |
|
386 |
return pluginsDirectory; |
|
387 |
} |
|
347 | 388 |
} |
348 |
|
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.api/src/main/java/org/gvsig/installer/swing/api/creation/MakePluginPackageWizard.java | ||
---|---|---|
55 | 55 |
public abstract class MakePluginPackageWizard extends AbstractInstallerWizard { |
56 | 56 |
private static final long serialVersionUID = 6387360455696226183L; |
57 | 57 |
|
58 |
public MakePluginPackageWizard(File applicationDirectory) {
|
|
59 |
super(applicationDirectory);
|
|
60 |
}
|
|
58 |
public MakePluginPackageWizard(File applicationDirectory) {
|
|
59 |
super(applicationDirectory);
|
|
60 |
}
|
|
61 | 61 |
} |
62 | 62 |
|
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.api/src/main/java/org/gvsig/installer/swing/api/SwingInstallerManager.java | ||
---|---|---|
66 | 66 |
* @throws MakePluginPackageWizardException |
67 | 67 |
* If there is a problem creating the wizard. |
68 | 68 |
*/ |
69 |
public MakePluginPackageWizard createMakePluginPackageWizard(File ApplicationDirectory) throws MakePluginPackageWizardException; |
|
69 |
public MakePluginPackageWizard createMakePluginPackageWizard( |
|
70 |
File applicationDirectory) throws MakePluginPackageWizardException; |
|
70 | 71 |
|
71 | 72 |
/** |
72 | 73 |
* Registers a class that implements a wizard to execte an installer |
... | ... | |
85 | 86 |
* @throws InstallPackageWizardException |
86 | 87 |
* If there is a problem creating the wizard. |
87 | 88 |
*/ |
88 |
public InstallPackageWizard createInstallPackageWizard(File ApplicationDirectory) throws InstallPackageWizardException; |
|
89 |
|
|
89 |
public InstallPackageWizard createInstallPackageWizard( |
|
90 |
File applicationDirectory) throws InstallPackageWizardException; |
|
91 |
|
|
92 |
/** |
|
93 |
* Returns the default installers folder into the application folder. |
|
94 |
* |
|
95 |
* @param applicationFolder |
|
96 |
* to install in |
|
97 |
* @return the default installers folder |
|
98 |
*/ |
|
99 |
public File getDefaultInstallersFolder(File applicationFolder); |
|
100 |
|
|
101 |
/** |
|
102 |
* Returns the current gvSIG version. |
|
103 |
* |
|
104 |
* @return the current gvSIG version |
|
105 |
*/ |
|
106 |
public String getGvSIGVersion(); |
|
107 |
|
|
108 |
/** |
|
109 |
* Sets the current gvSIG version. |
|
110 |
* |
|
111 |
* @param gvSIGVersion |
|
112 |
* the current gvSIG version |
|
113 |
*/ |
|
114 |
public void setGvSIGVersion(String gvSIGVersion); |
|
115 |
|
|
90 | 116 |
} |
91 | 117 |
|
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.impl/src/main/java/org/gvsig/installer/swing/impl/execution/model/PackagesTableModel.java | ||
---|---|---|
75 | 75 |
} |
76 | 76 |
|
77 | 77 |
public int getColumnCount() { |
78 |
return 6;
|
|
78 |
return 10;
|
|
79 | 79 |
} |
80 | 80 |
|
81 | 81 |
public String getColumnName(int columnIndex) { |
... | ... | |
92 | 92 |
return swingInstallerManager.getText("version"); |
93 | 93 |
case 5: |
94 | 94 |
return swingInstallerManager.getText("build"); |
95 |
case 6: |
|
96 |
return swingInstallerManager.getText("operating_system"); |
|
97 |
case 7: |
|
98 |
return swingInstallerManager.getText("architecture"); |
|
99 |
case 8: |
|
100 |
return swingInstallerManager.getText("java_version"); |
|
101 |
case 9: |
|
102 |
return swingInstallerManager.getText("gvSIG_version"); |
|
95 | 103 |
default: |
96 | 104 |
return ""; |
97 | 105 |
} |
... | ... | |
116 | 124 |
return installerInfo.getVersion(); |
117 | 125 |
case 5: |
118 | 126 |
return installerInfo.getBuild(); |
127 |
case 6: |
|
128 |
return installerInfo.getOperatingSystem(); |
|
129 |
case 7: |
|
130 |
return installerInfo.getArchitecture(); |
|
131 |
case 8: |
|
132 |
return installerInfo.getJavaVM(); |
|
133 |
case 9: |
|
134 |
return installerInfo.getGvSIGVersion(); |
|
119 | 135 |
default: |
120 | 136 |
return ""; |
121 | 137 |
|
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.impl/src/main/java/org/gvsig/installer/swing/impl/execution/DefaultInstallPackageWizard.java | ||
---|---|---|
36 | 36 |
|
37 | 37 |
import jwizardcomponent.DefaultJWizardComponents; |
38 | 38 |
|
39 |
import org.slf4j.Logger; |
|
40 |
import org.slf4j.LoggerFactory; |
|
41 |
|
|
39 | 42 |
import org.gvsig.gui.beans.wizard.WizardPanel; |
40 | 43 |
import org.gvsig.gui.beans.wizard.WizardPanelActionListener; |
41 | 44 |
import org.gvsig.gui.beans.wizard.WizardPanelWithLogo; |
... | ... | |
43 | 46 |
import org.gvsig.installer.lib.api.PackageInfo; |
44 | 47 |
import org.gvsig.installer.lib.api.execution.InstallPackageService; |
45 | 48 |
import org.gvsig.installer.lib.api.execution.InstallPackageServiceException; |
49 |
import org.gvsig.installer.swing.api.SwingInstallerLocator; |
|
46 | 50 |
import org.gvsig.installer.swing.api.execution.InstallPackageWizard; |
47 | 51 |
import org.gvsig.installer.swing.impl.execution.wizard.ProgressWizard; |
48 | 52 |
import org.gvsig.installer.swing.impl.execution.wizard.SelectBundlesWizard; |
49 | 53 |
import org.gvsig.installer.swing.impl.execution.wizard.SelectPackagesWizard; |
50 | 54 |
import org.gvsig.installer.swing.impl.wizard.WizardListenerAdapter; |
51 |
import org.slf4j.Logger; |
|
52 |
import org.slf4j.LoggerFactory; |
|
53 | 55 |
|
54 | 56 |
/** |
55 | 57 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
... | ... | |
138 | 140 |
|
139 | 141 |
public File getDefaultInstallersDirectory() |
140 | 142 |
{ |
141 |
return new File(applicationDirectory.getAbsolutePath() + File.separator + "install"); |
|
143 |
return SwingInstallerLocator.getSwingInstallerManager() |
|
144 |
.getDefaultInstallersFolder(applicationDirectory); |
|
142 | 145 |
} |
143 | 146 |
|
144 | 147 |
public WizardPanelActionListener getWizardPanelActionListener() { |
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.impl/src/main/java/org/gvsig/installer/swing/impl/creation/DefaultMakePluginPackageWizard.java | ||
---|---|---|
74 | 74 |
|
75 | 75 |
private WizardListenerAdapter wizardListenerAdapter = null; |
76 | 76 |
|
77 |
public DefaultMakePluginPackageWizard(File applicationDirectory) throws LocatorException, MakePluginPackageServiceException |
|
77 |
public DefaultMakePluginPackageWizard(File applicationDirectory) |
|
78 |
throws LocatorException, MakePluginPackageServiceException |
|
78 | 79 |
{ |
79 |
super(applicationDirectory);
|
|
80 |
super(applicationDirectory);
|
|
80 | 81 |
wizardPanelWithLogo = new WizardPanelWithLogo(new ImageIcon(getClass().getClassLoader().getResource("images/installpackageicon.png").getFile())); |
81 | 82 |
|
82 | 83 |
advancedModeSelectionWizard = new AdvancedModeSelectionWizard(this); |
83 | 84 |
antScriptWizard = new AntScriptWizard(this); |
84 |
pluginDescriptionWizard = new PluginDescriptionWizard(this);
|
|
85 |
pluginDescriptionWizard = new PluginDescriptionWizard(this);
|
|
85 | 86 |
progressWizard = new ProgressWizard(this); |
86 | 87 |
selectFilesWizard = new SelectFilesWizard(this); |
87 | 88 |
selectOutputFileWizard = new SelectOutputFileWizard(this); |
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.impl/src/main/java/org/gvsig/installer/swing/impl/creation/panel/SelectOutputFilePanel.java | ||
---|---|---|
42 | 42 |
/** |
43 | 43 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
44 | 44 |
*/ |
45 |
public class SelectOutputFilePanel extends JPanel{
|
|
45 |
public abstract class SelectOutputFilePanel extends JPanel {
|
|
46 | 46 |
protected DefaultSwingInstallerManager swingInstallerManager = null; |
47 | 47 |
private JLabel fileLabel; |
48 |
private FileTextField fileTextField;
|
|
48 |
protected FileTextField fileTextField;
|
|
49 | 49 |
private javax.swing.JPanel northPanel; |
50 | 50 |
|
51 | 51 |
public SelectOutputFilePanel() { |
... | ... | |
64 | 64 |
|
65 | 65 |
northPanel = new JPanel(); |
66 | 66 |
fileLabel = new JLabel(); |
67 |
fileTextField = new FileTextField(); |
|
67 |
fileTextField = new FileTextField(getClass().getName());
|
|
68 | 68 |
|
69 | 69 |
setLayout(new BorderLayout()); |
70 | 70 |
|
... | ... | |
85 | 85 |
public File getSelectedFile(){ |
86 | 86 |
return fileTextField.getSelectedFile(); |
87 | 87 |
} |
88 |
|
|
89 |
protected void setSelectedFile(File selectedFile) { |
|
90 |
fileTextField.setSelectedFile(selectedFile); |
|
91 |
} |
|
88 | 92 |
} |
89 | 93 |
|
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.impl/src/main/java/org/gvsig/installer/swing/impl/creation/panel/PluginDescriptionPanel.java | ||
---|---|---|
39 | 39 |
import javax.swing.JTextArea; |
40 | 40 |
import javax.swing.JTextField; |
41 | 41 |
|
42 |
import org.gvsig.installer.lib.api.InstallerManager.ARCH; |
|
43 |
import org.gvsig.installer.lib.api.InstallerManager.JVM; |
|
44 |
import org.gvsig.installer.lib.api.InstallerManager.OS; |
|
45 |
import org.gvsig.installer.lib.api.InstallerManager.STATE; |
|
42 | 46 |
import org.gvsig.installer.swing.api.SwingInstallerLocator; |
43 | 47 |
import org.gvsig.installer.swing.impl.DefaultSwingInstallerManager; |
44 | 48 |
|
45 | 49 |
/** |
46 | 50 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
47 | 51 |
*/ |
48 |
public class PluginDescriptionPanel extends JPanel{ |
|
49 |
protected DefaultSwingInstallerManager swingInstallerManager = null; |
|
52 |
public abstract class PluginDescriptionPanel extends JPanel { |
|
53 |
|
|
54 |
private static final long serialVersionUID = 3220127550495628087L; |
|
55 |
|
|
56 |
protected DefaultSwingInstallerManager swingInstallerManager = null; |
|
50 | 57 |
private JLabel buildLabel; |
51 | 58 |
private JTextField buildText; |
52 | 59 |
private JLabel codeLabel; |
... | ... | |
54 | 61 |
private JTextArea descriptionArea; |
55 | 62 |
private JLabel descriptionLabel; |
56 | 63 |
private JScrollPane descriptionScrollPane; |
57 |
private JTextField naemText;
|
|
64 |
private JTextField nameText;
|
|
58 | 65 |
private JLabel nameLabel; |
59 |
private JLabel offcialLabel; |
|
60 |
private JCheckBox offcicialCheckBox;
|
|
66 |
private JLabel officialLabel;
|
|
67 |
private JCheckBox officialCheckBox; |
|
61 | 68 |
private JComboBox statusCombo; |
62 | 69 |
private JLabel statusLabel; |
63 | 70 |
private JLabel versionLabel; |
64 | 71 |
private JTextField versionText; |
72 |
private JLabel operatingSystemLabel; |
|
73 |
private JComboBox operatingSystemCombo; |
|
74 |
private JLabel architectureLabel; |
|
75 |
private JComboBox architectureCombo; |
|
76 |
private JLabel javaVMLabel; |
|
77 |
private JComboBox javaVMCombo; |
|
78 |
private JLabel gvSIGVersionLabel; |
|
79 |
private JTextField gvSIGVersionText; |
|
65 | 80 |
|
66 | 81 |
public PluginDescriptionPanel() { |
67 | 82 |
super(); |
... | ... | |
71 | 86 |
} |
72 | 87 |
|
73 | 88 |
private void initCombos() { |
74 |
statusCombo.addItem("Final"); |
|
75 |
statusCombo.addItem("RC4"); |
|
76 |
statusCombo.addItem("RC3"); |
|
77 |
statusCombo.addItem("RC2"); |
|
78 |
statusCombo.addItem("RC1"); |
|
79 |
statusCombo.addItem("Testing"); |
|
89 |
statusCombo.addItem(STATE.DEVEL); |
|
90 |
statusCombo.addItem(STATE.TESTING); |
|
91 |
statusCombo.addItem(STATE.PILOT); |
|
92 |
statusCombo.addItem(STATE.PROTOTYPE); |
|
93 |
statusCombo.addItem(STATE.ALPHA.concat("1")); |
|
94 |
statusCombo.addItem(STATE.ALPHA.concat("2")); |
|
95 |
statusCombo.addItem(STATE.ALPHA.concat("3")); |
|
96 |
statusCombo.addItem(STATE.BETA.concat("1")); |
|
97 |
statusCombo.addItem(STATE.BETA.concat("2")); |
|
98 |
statusCombo.addItem(STATE.BETA.concat("3")); |
|
99 |
statusCombo.addItem(STATE.RC.concat("1")); |
|
100 |
statusCombo.addItem(STATE.RC.concat("2")); |
|
101 |
statusCombo.addItem(STATE.RC.concat("3")); |
|
102 |
statusCombo.addItem(STATE.FINAL); |
|
103 |
|
|
104 |
operatingSystemCombo.addItem(OS.ALL); |
|
105 |
operatingSystemCombo.addItem(OS.LINUX); |
|
106 |
operatingSystemCombo.addItem(OS.WINDOWS); |
|
107 |
operatingSystemCombo.addItem(OS.OSX_10_4); |
|
108 |
operatingSystemCombo.addItem(OS.OSX_10_5); |
|
109 |
operatingSystemCombo.addItem(OS.OSX_10_6); |
|
110 |
|
|
111 |
architectureCombo.addItem(ARCH.ALL); |
|
112 |
architectureCombo.addItem(ARCH.X86); |
|
113 |
architectureCombo.addItem(ARCH.X86_64); |
|
114 |
|
|
115 |
javaVMCombo.addItem(JVM.J1_5); |
|
116 |
javaVMCombo.addItem(JVM.J1_6); |
|
80 | 117 |
} |
81 | 118 |
|
82 | 119 |
private void initComponents() { |
83 | 120 |
java.awt.GridBagConstraints gridBagConstraints; |
84 | 121 |
|
85 | 122 |
nameLabel = new JLabel(); |
86 |
naemText = new JTextField();
|
|
123 |
nameText = new JTextField();
|
|
87 | 124 |
descriptionScrollPane = new JScrollPane(); |
88 | 125 |
descriptionArea = new JTextArea(); |
89 | 126 |
descriptionLabel = new JLabel(); |
... | ... | |
92 | 129 |
buildLabel = new JLabel(); |
93 | 130 |
buildText = new JTextField(); |
94 | 131 |
statusLabel = new JLabel(); |
95 |
offcialLabel = new javax.swing.JLabel(); |
|
96 | 132 |
statusCombo = new JComboBox(); |
97 |
offcicialCheckBox = new JCheckBox(); |
|
133 |
officialLabel = new javax.swing.JLabel(); |
|
134 |
officialCheckBox = new JCheckBox(); |
|
98 | 135 |
codeLabel = new JLabel(); |
99 | 136 |
codeText = new JTextField(); |
137 |
|
|
138 |
operatingSystemLabel = new JLabel(); |
|
139 |
operatingSystemCombo = new JComboBox(); |
|
140 |
architectureLabel = new JLabel(); |
|
141 |
architectureCombo = new JComboBox(); |
|
142 |
javaVMLabel = new JLabel(); |
|
143 |
javaVMCombo = new JComboBox(); |
|
144 |
gvSIGVersionLabel = new JLabel(); |
|
145 |
gvSIGVersionText = new JTextField(); |
|
100 | 146 |
|
101 | 147 |
setLayout(new java.awt.GridBagLayout()); |
102 | 148 |
|
... | ... | |
113 | 159 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; |
114 | 160 |
gridBagConstraints.weightx = 1.0; |
115 | 161 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
116 |
add(naemText, gridBagConstraints);
|
|
162 |
add(nameText, gridBagConstraints);
|
|
117 | 163 |
|
118 | 164 |
descriptionArea.setColumns(20); |
119 | 165 |
descriptionArea.setRows(5); |
... | ... | |
132 | 178 |
gridBagConstraints = new GridBagConstraints(); |
133 | 179 |
gridBagConstraints.gridx = 0; |
134 | 180 |
gridBagConstraints.gridy = 2; |
135 |
gridBagConstraints.anchor = GridBagConstraints.NORTH;
|
|
181 |
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
|
136 | 182 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
137 | 183 |
add(descriptionLabel, gridBagConstraints); |
138 | 184 |
|
... | ... | |
168 | 214 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
169 | 215 |
add(buildText, gridBagConstraints); |
170 | 216 |
|
217 |
officialLabel.setText(swingInstallerManager.getText("is_official")); |
|
218 |
gridBagConstraints = new GridBagConstraints(); |
|
219 |
gridBagConstraints.gridx = 0; |
|
220 |
gridBagConstraints.gridy = 6; |
|
221 |
gridBagConstraints.anchor = GridBagConstraints.EAST; |
|
222 |
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); |
|
223 |
add(officialLabel, gridBagConstraints); |
|
224 |
|
|
171 | 225 |
statusLabel.setText(swingInstallerManager.getText("status")); |
172 | 226 |
gridBagConstraints = new GridBagConstraints(); |
173 | 227 |
gridBagConstraints.gridx = 0; |
... | ... | |
176 | 230 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
177 | 231 |
add(statusLabel, gridBagConstraints); |
178 | 232 |
|
179 |
offcialLabel.setText(swingInstallerManager.getText("is_official")); |
|
180 |
gridBagConstraints = new GridBagConstraints(); |
|
181 |
gridBagConstraints.gridx = 0; |
|
182 |
gridBagConstraints.gridy = 6; |
|
183 |
gridBagConstraints.anchor = GridBagConstraints.EAST; |
|
184 |
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); |
|
185 |
add(offcialLabel, gridBagConstraints); |
|
186 |
|
|
187 | 233 |
statusCombo.setPreferredSize(new java.awt.Dimension(100, 27)); |
188 | 234 |
gridBagConstraints = new GridBagConstraints(); |
189 | 235 |
gridBagConstraints.gridx = 1; |
... | ... | |
191 | 237 |
gridBagConstraints.anchor = GridBagConstraints.WEST; |
192 | 238 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
193 | 239 |
add(statusCombo, gridBagConstraints); |
240 |
|
|
194 | 241 |
gridBagConstraints = new GridBagConstraints(); |
195 | 242 |
gridBagConstraints.gridx = 1; |
196 | 243 |
gridBagConstraints.gridy = 6; |
197 | 244 |
gridBagConstraints.anchor = GridBagConstraints.WEST; |
198 | 245 |
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); |
199 |
add(offcicialCheckBox, gridBagConstraints);
|
|
246 |
add(officialCheckBox, gridBagConstraints); |
|
200 | 247 |
|
201 | 248 |
codeLabel.setText(swingInstallerManager.getText("code")); |
202 | 249 |
gridBagConstraints = new GridBagConstraints(); |
... | ... | |
208 | 255 |
gridBagConstraints.weightx = 1.0; |
209 | 256 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
210 | 257 |
add(codeText, gridBagConstraints); |
258 |
|
|
259 |
operatingSystemLabel.setText(swingInstallerManager |
|
260 |
.getText("operating_system")); |
|
261 |
gridBagConstraints = new GridBagConstraints(); |
|
262 |
gridBagConstraints.gridx = 0; |
|
263 |
gridBagConstraints.gridy = 7; |
|
264 |
gridBagConstraints.anchor = GridBagConstraints.EAST; |
|
265 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
|
266 |
add(operatingSystemLabel, gridBagConstraints); |
|
267 |
|
|
268 |
operatingSystemCombo.setPreferredSize(new java.awt.Dimension(100, 27)); |
|
269 |
gridBagConstraints = new GridBagConstraints(); |
|
270 |
gridBagConstraints.gridx = 1; |
|
271 |
gridBagConstraints.gridy = 7; |
|
272 |
gridBagConstraints.anchor = GridBagConstraints.WEST; |
|
273 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
|
274 |
add(operatingSystemCombo, gridBagConstraints); |
|
275 |
|
|
276 |
architectureLabel |
|
277 |
.setText(swingInstallerManager.getText("architecture")); |
|
278 |
gridBagConstraints = new GridBagConstraints(); |
|
279 |
gridBagConstraints.gridx = 0; |
|
280 |
gridBagConstraints.gridy = 8; |
|
281 |
gridBagConstraints.anchor = GridBagConstraints.EAST; |
|
282 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
|
283 |
add(architectureLabel, gridBagConstraints); |
|
284 |
|
|
285 |
architectureCombo.setPreferredSize(new java.awt.Dimension(100, 27)); |
|
286 |
gridBagConstraints = new GridBagConstraints(); |
|
287 |
gridBagConstraints.gridx = 1; |
|
288 |
gridBagConstraints.gridy = 8; |
|
289 |
gridBagConstraints.anchor = GridBagConstraints.WEST; |
|
290 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
|
291 |
add(architectureCombo, gridBagConstraints); |
|
292 |
|
|
293 |
javaVMLabel.setText(swingInstallerManager.getText("java_version")); |
|
294 |
gridBagConstraints = new GridBagConstraints(); |
|
295 |
gridBagConstraints.gridx = 0; |
|
296 |
gridBagConstraints.gridy = 9; |
|
297 |
gridBagConstraints.anchor = GridBagConstraints.EAST; |
|
298 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
|
299 |
add(javaVMLabel, gridBagConstraints); |
|
300 |
|
|
301 |
javaVMCombo.setPreferredSize(new java.awt.Dimension(100, 27)); |
|
302 |
gridBagConstraints = new GridBagConstraints(); |
|
303 |
gridBagConstraints.gridx = 1; |
|
304 |
gridBagConstraints.gridy = 9; |
|
305 |
gridBagConstraints.anchor = GridBagConstraints.WEST; |
|
306 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
|
307 |
add(javaVMCombo, gridBagConstraints); |
|
308 |
|
|
309 |
gvSIGVersionLabel.setText(swingInstallerManager |
|
310 |
.getText("gvSIG_desktop_version")); |
|
311 |
gridBagConstraints = new GridBagConstraints(); |
|
312 |
gridBagConstraints.gridx = 0; |
|
313 |
gridBagConstraints.gridy = 10; |
|
314 |
gridBagConstraints.anchor = GridBagConstraints.EAST; |
|
315 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
|
316 |
add(gvSIGVersionLabel, gridBagConstraints); |
|
317 |
|
|
318 |
gvSIGVersionText.setText(findCurrentGvSIGVersion()); |
|
319 |
gridBagConstraints = new GridBagConstraints(); |
|
320 |
gridBagConstraints.gridx = 1; |
|
321 |
gridBagConstraints.gridy = 10; |
|
322 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; |
|
323 |
gridBagConstraints.weightx = 1.0; |
|
324 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
|
325 |
add(gvSIGVersionText, gridBagConstraints); |
|
211 | 326 |
} |
212 | 327 |
|
213 |
/** |
|
214 |
* @return the build |
|
215 |
*/ |
|
328 |
protected abstract String findCurrentGvSIGVersion(); |
|
329 |
|
|
330 |
/** |
|
331 |
* @return the build |
|
332 |
*/ |
|
216 | 333 |
public Integer getBuild() { |
217 | 334 |
try{ |
218 | 335 |
return Integer.parseInt(buildText.getText()); |
... | ... | |
246 | 363 |
* @return the naem |
247 | 364 |
*/ |
248 | 365 |
public String getName() { |
249 |
return naemText.getText();
|
|
366 |
return nameText.getText();
|
|
250 | 367 |
} |
251 | 368 |
|
252 | 369 |
/** |
253 | 370 |
* @param naem the naem to set |
254 | 371 |
*/ |
255 | 372 |
public void setName(String name) { |
256 |
this.naemText.setText(name);
|
|
373 |
this.nameText.setText(name);
|
|
257 | 374 |
} |
258 | 375 |
|
259 | 376 |
/** |
260 | 377 |
* @return the offcicial |
261 | 378 |
*/ |
262 | 379 |
public boolean isOfficial() { |
263 |
return offcicialCheckBox.isSelected();
|
|
380 |
return officialCheckBox.isSelected(); |
|
264 | 381 |
} |
265 | 382 |
|
266 | 383 |
/** |
267 | 384 |
* @param offcicial the offcicial to set |
268 | 385 |
*/ |
269 |
public void setOffcicial(boolean isOffcicial) { |
Also available in: Unified diff