root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / IntializeApplicationExtension.java @ 9212
History | View | Annotate | Download (3.62 KB)
1 |
package com.iver.cit.gvsig; |
---|---|
2 |
|
3 |
import java.io.File; |
4 |
import java.io.IOException; |
5 |
import java.io.StringWriter; |
6 |
import java.security.KeyException; |
7 |
import java.util.Properties; |
8 |
|
9 |
import org.apache.log4j.Logger; |
10 |
|
11 |
import com.iver.andami.Launcher; |
12 |
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 |
import com.iver.utiles.extensionPoints.ExtensionPoint; |
16 |
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 |
private static Logger logger = Logger.getLogger("gvSIG"); |
23 |
|
24 |
public void initialize() { |
25 |
|
26 |
addToLogInfo(); |
27 |
//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 |
try {
|
33 |
((ExtensionPoint)this.extensionPoints.get("Layers")).addAlias(FLayerFileVectorial.class.getName(), "FileVectorial"); |
34 |
((ExtensionPoint)this.extensionPoints.get("Layers")).addAlias(FLayerGenericVectorial.class.getName(), "GenericVectorial"); |
35 |
} catch (KeyException e) { |
36 |
// TODO Auto-generated catch block
|
37 |
e.printStackTrace(); |
38 |
} |
39 |
} |
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 |
|
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 |
|
66 |
Properties props = System.getProperties(); |
67 |
|
68 |
try {
|
69 |
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 |
} |
77 |
try {
|
78 |
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 |
} |
86 |
|
87 |
|
88 |
|
89 |
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 |
//if (props.get("os.name").toLowerCase().equals("linux"))
|
101 |
return writer.toString();
|
102 |
} |
103 |
|
104 |
} |