root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / IntializeApplicationExtension.java @ 9212
History | View | Annotate | Download (3.62 KB)
1 | 6764 | jmvivo | package com.iver.cit.gvsig; |
---|---|---|---|
2 | |||
3 | 8185 | jmvivo | import java.io.File; |
4 | import java.io.IOException; |
||
5 | import java.io.StringWriter; |
||
6 | 6790 | jmvivo | import java.security.KeyException; |
7 | 8185 | jmvivo | import java.util.Properties; |
8 | 6790 | jmvivo | |
9 | 8185 | jmvivo | import org.apache.log4j.Logger; |
10 | |||
11 | import com.iver.andami.Launcher; |
||
12 | 6764 | jmvivo | import com.iver.andami.plugins.Extension; |
13 | import com.iver.cit.gvsig.fmap.layers.FLayerFileVectorial; |
||
14 | import com.iver.cit.gvsig.fmap.layers.FLayerGenericVectorial; |
||
15 | 6790 | jmvivo | import com.iver.utiles.extensionPoints.ExtensionPoint; |
16 | 6764 | jmvivo | import com.iver.utiles.extensionPoints.ExtensionPoints; |
17 | import com.iver.utiles.extensionPoints.ExtensionPointsSingleton; |
||
18 | |||
19 | public class IntializeApplicationExtension extends Extension { |
||
20 | private ExtensionPoints extensionPoints =
|
||
21 | ExtensionPointsSingleton.getInstance(); |
||
22 | 8185 | jmvivo | private static Logger logger = Logger.getLogger("gvSIG"); |
23 | 6764 | jmvivo | |
24 | 8185 | jmvivo | public void initialize() { |
25 | |||
26 | addToLogInfo(); |
||
27 | 6764 | jmvivo | //this.extensionPoints.add("Layers","FileVectorial", FLayerFileVectorial.class);
|
28 | this.extensionPoints.add("Layers",FLayerFileVectorial.class.getName(), FLayerFileVectorial.class); |
||
29 | |||
30 | //this.extensionPoints.add("Layers","GenericVectorial", FLayerGenericVectorial.class);
|
||
31 | this.extensionPoints.add("Layers",FLayerGenericVectorial.class.getName(), FLayerGenericVectorial.class); |
||
32 | 6790 | jmvivo | try {
|
33 | 6801 | fjp | ((ExtensionPoint)this.extensionPoints.get("Layers")).addAlias(FLayerFileVectorial.class.getName(), "FileVectorial"); |
34 | ((ExtensionPoint)this.extensionPoints.get("Layers")).addAlias(FLayerGenericVectorial.class.getName(), "GenericVectorial"); |
||
35 | 6790 | jmvivo | } catch (KeyException e) { |
36 | // TODO Auto-generated catch block
|
||
37 | e.printStackTrace(); |
||
38 | } |
||
39 | 6764 | jmvivo | } |
40 | |||
41 | public void execute(String actionCommand) { |
||
42 | |||
43 | } |
||
44 | |||
45 | public boolean isEnabled() { |
||
46 | return false; |
||
47 | } |
||
48 | |||
49 | public boolean isVisible() { |
||
50 | return false; |
||
51 | } |
||
52 | 8185 | jmvivo | |
53 | private void addToLogInfo() { |
||
54 | String info[] = this.getStringInfo().split("\n"); |
||
55 | for (int i=0;i< info.length;i++) { |
||
56 | logger.info(info[i]); |
||
57 | } |
||
58 | } |
||
59 | |||
60 | public String getStringInfo() { |
||
61 | StringWriter writer = new StringWriter(); |
||
62 | String andamiPath;
|
||
63 | String extensionsPath;
|
||
64 | String jaiVersion;
|
||
65 | 8233 | jmvivo | |
66 | Properties props = System.getProperties(); |
||
67 | |||
68 | 8185 | jmvivo | try {
|
69 | 8233 | jmvivo | try {
|
70 | andamiPath = (new File(Launcher.class.getResource(".").getFile() + File.separator + ".." + File.separator + ".." + File.separator +"..")).getCanonicalPath(); |
||
71 | } catch (IOException e) { |
||
72 | andamiPath = (new File(Launcher.class.getResource(".").getFile() + File.separator + ".." + File.separator + ".." + File.separator +"..")).getAbsolutePath(); |
||
73 | } |
||
74 | } catch (Exception e1) { |
||
75 | andamiPath = (String)props.get("user.dir"); |
||
76 | 8185 | jmvivo | } |
77 | try {
|
||
78 | 8233 | jmvivo | try {
|
79 | extensionsPath = (new File(Launcher.getAndamiConfig().getPluginsDirectory())).getCanonicalPath(); |
||
80 | } catch (IOException e) { |
||
81 | extensionsPath = (new File(Launcher.getAndamiConfig().getPluginsDirectory())).getAbsolutePath(); |
||
82 | } |
||
83 | } catch (Exception e1) { |
||
84 | extensionsPath = "???";
|
||
85 | 8185 | jmvivo | } |
86 | |||
87 | |||
88 | 8233 | jmvivo | |
89 | 8185 | jmvivo | writer.write("gvSIG version: " + Version.longFormat() + "\n"); |
90 | writer.write(" gvSIG app exec path: " + andamiPath + "\n"); |
||
91 | writer.write(" gvSIG user app home: " + Launcher.getAppHomeDir() + "\n"); |
||
92 | writer.write(" gvSIG extension path: " + extensionsPath + "\n"); |
||
93 | writer.write(" gvSIG locale language: " + Launcher.getAndamiConfig().getLocaleLanguage() + "\n"); |
||
94 | writer.write("OS name: " + props.get("os.name") + "\n"); |
||
95 | writer.write(" arch:" + props.get("os.arch") + "\n"); |
||
96 | writer.write(" version:"+ props.get("os.version") + "\n"); |
||
97 | writer.write("JAVA vendor: " + props.get("java.vendor") + "\n"); |
||
98 | writer.write(" version:" +props.get("java.version")+ "\n"); |
||
99 | writer.write(" home: " + props.get("java.home") + "\n"); |
||
100 | 8233 | jmvivo | //if (props.get("os.name").toLowerCase().equals("linux"))
|
101 | 8185 | jmvivo | return writer.toString();
|
102 | } |
||
103 | 6764 | jmvivo | |
104 | } |