Revision 1960
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.232/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/buildNumber.properties | ||
---|---|---|
1 |
#Sun Dec 17 20:01:32 CET 2023 |
|
2 |
buildNumber=314 |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.232/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/assembly/gvsig-plugin-package.xml | ||
---|---|---|
1 |
<assembly> |
|
2 |
<id>gvsig-plugin-package</id> |
|
3 |
<formats> |
|
4 |
<format>zip</format> |
|
5 |
</formats> |
|
6 |
<baseDirectory>${project.artifactId}</baseDirectory> |
|
7 |
<includeBaseDirectory>true</includeBaseDirectory> |
|
8 |
<files> |
|
9 |
<file> |
|
10 |
<source>target/${project.artifactId}-${project.version}.jar</source> |
|
11 |
<outputDirectory>lib</outputDirectory> |
|
12 |
</file> |
|
13 |
<file> |
|
14 |
<source>target/package.info</source> |
|
15 |
</file> |
|
16 |
</files> |
|
17 |
|
|
18 |
<fileSets> |
|
19 |
<fileSet> |
|
20 |
<directory>src/main/resources-plugin</directory> |
|
21 |
<outputDirectory>.</outputDirectory> |
|
22 |
</fileSet> |
|
23 |
<fileSet> |
|
24 |
<directory>target/abeille</directory> |
|
25 |
<outputDirectory>.</outputDirectory> |
|
26 |
</fileSet> |
|
27 |
</fileSets> |
|
28 |
|
|
29 |
<dependencySets> |
|
30 |
|
|
31 |
<dependencySet> |
|
32 |
<useProjectArtifact>false</useProjectArtifact> |
|
33 |
<useTransitiveDependencies>false</useTransitiveDependencies> |
|
34 |
<outputDirectory>lib</outputDirectory> |
|
35 |
<includes> |
|
36 |
<!-- |
|
37 |
Plugin libraries |
|
38 |
--> |
|
39 |
<include>org.ini4j:ini4j</include> |
|
40 |
<include>net.sourceforge.thinlet:thinlet</include> |
|
41 |
<include>org.gvsig:org.gvsig.scripting.thing</include> |
|
42 |
<include>org.gvsig:org.gvsig.scripting.lib.api</include> |
|
43 |
<include>org.gvsig:org.gvsig.scripting.swing.api</include> |
|
44 |
<include>org.gvsig:org.gvsig.scripting.lib.impl</include> |
|
45 |
<include>org.gvsig:org.gvsig.scripting.swing.impl</include> |
|
46 |
<include>org.apache.tika:tika-core</include> |
|
47 |
|
|
48 |
<!-- |
|
49 |
Utility libraries |
|
50 |
--> |
|
51 |
<!-- JOpenDocument --> |
|
52 |
<include>org.jopendocument:jOpenDocument</include> |
|
53 |
|
|
54 |
<!-- CSSBox webbrowser --> |
|
55 |
<include>net.sf.cssbox:cssbox</include> |
|
56 |
<include>net.sf.cssbox:swingbox</include> |
|
57 |
<include>net.sf.cssbox:jstyleparser</include> |
|
58 |
<include>net.sourceforge.nekohtml:nekohtml</include> |
|
59 |
<include>org.antlr:antlr-runtime</include> |
|
60 |
|
|
61 |
<!-- |
|
62 |
Script engines libraries |
|
63 |
--> |
|
64 |
|
|
65 |
<include>org.codehaus.groovy:groovy-all</include> |
|
66 |
|
|
67 |
<!-- |
|
68 |
<include>org.renjin:renjin-script-engine:jar:jar-with-dependencies</include> |
|
69 |
--> |
|
70 |
|
|
71 |
<include>org.python:${jython.artifactId}</include> |
|
72 |
<include>com.github.tbekolay.jnumeric:jnumeric</include> |
|
73 |
|
|
74 |
</includes> |
|
75 |
</dependencySet> |
|
76 |
|
|
77 |
<dependencySet> |
|
78 |
<useProjectArtifact>false</useProjectArtifact> |
|
79 |
<useTransitiveDependencies>true</useTransitiveDependencies> |
|
80 |
<outputDirectory>lib</outputDirectory> |
|
81 |
<includes> |
|
82 |
<!-- |
|
83 |
JGit support runtime libraries |
|
84 |
--> |
|
85 |
<include>org.eclipse.jgit:org.eclipse.jgit</include> |
|
86 |
<include>com.jcraft:jsch</include> |
|
87 |
<include>com.googlecode.javaewah:JavaEWAH</include> |
|
88 |
<include>org.apache.httpcomponents:httpclient</include> |
|
89 |
<include>org.apache.httpcomponents:httpcore</include> |
|
90 |
</includes> |
|
91 |
</dependencySet> |
|
92 |
|
|
93 |
<dependencySet> |
|
94 |
<useProjectArtifact>false</useProjectArtifact> |
|
95 |
<useTransitiveDependencies>true</useTransitiveDependencies> |
|
96 |
<outputDirectory>lib</outputDirectory> |
|
97 |
<includes> |
|
98 |
<!-- |
|
99 |
ICEPDF support runtime libraries |
|
100 |
--> |
|
101 |
<include>org.icepdf.os:icepdf-viewer</include> |
|
102 |
<include>org.icepdf.os:icepdf-core</include> |
|
103 |
</includes> |
|
104 |
</dependencySet> |
|
105 |
|
|
106 |
<dependencySet> |
|
107 |
<useProjectArtifact>false</useProjectArtifact> |
|
108 |
<useTransitiveDependencies>true</useTransitiveDependencies> |
|
109 |
<outputDirectory>lib</outputDirectory> |
|
110 |
<includes> |
|
111 |
<!-- |
|
112 |
java-diff-utils libraries |
|
113 |
https://github.com/java-diff-utils/java-diff-utils |
|
114 |
--> |
|
115 |
<include>com.sksamuel.diff:diff</include> |
|
116 |
|
|
117 |
</includes> |
|
118 |
</dependencySet> |
|
119 |
|
|
120 |
<dependencySet> |
|
121 |
<useProjectArtifact>false</useProjectArtifact> |
|
122 |
<useTransitiveDependencies>true</useTransitiveDependencies> |
|
123 |
<outputDirectory>lib</outputDirectory> |
|
124 |
<includes> |
|
125 |
<!-- |
|
126 |
flexmark-java, Markdown support libraries |
|
127 |
--> |
|
128 |
<include>com.vladsch.flexmark:flexmark-all</include> |
|
129 |
<include>com.vladsch.flexmark:flexmark</include> |
|
130 |
<include>com.vladsch.flexmark:flexmark-ext-abbreviation</include> |
|
131 |
<include>com.vladsch.flexmark:flexmark-util</include> |
|
132 |
<include>com.vladsch.flexmark:flexmark-ext-admonition</include> |
|
133 |
<include>com.vladsch.flexmark:flexmark-ext-anchorlink</include> |
|
134 |
<include>com.vladsch.flexmark:flexmark-ext-aside</include> |
|
135 |
<include>com.vladsch.flexmark:flexmark-ext-attributes</include> |
|
136 |
<include>com.vladsch.flexmark:flexmark-ext-autolink</include> |
|
137 |
<include>org.nibor.autolink:autolink</include> |
|
138 |
<include>com.vladsch.flexmark:flexmark-ext-definition</include> |
|
139 |
<include>com.vladsch.flexmark:flexmark-ext-emoji</include> |
|
140 |
<include>com.vladsch.flexmark:flexmark-ext-enumerated-reference</include> |
|
141 |
<include>com.vladsch.flexmark:flexmark-ext-escaped-character</include> |
|
142 |
<include>com.vladsch.flexmark:flexmark-ext-footnotes</include> |
|
143 |
<include>com.vladsch.flexmark:flexmark-ext-gfm-issues</include> |
|
144 |
<include>com.vladsch.flexmark:flexmark-ext-gfm-strikethrough</include> |
|
145 |
<include>com.vladsch.flexmark:flexmark-ext-gfm-tasklist</include> |
|
146 |
<include>com.vladsch.flexmark:flexmark-ext-gfm-users</include> |
|
147 |
<include>com.vladsch.flexmark:flexmark-ext-gitlab</include> |
|
148 |
<include>com.vladsch.flexmark:flexmark-ext-jekyll-front-matter</include> |
|
149 |
<include>com.vladsch.flexmark:flexmark-ext-jekyll-tag</include> |
|
150 |
<include>com.vladsch.flexmark:flexmark-ext-media-tags</include> |
|
151 |
<include>com.vladsch.flexmark:flexmark-ext-macros</include> |
|
152 |
<include>com.vladsch.flexmark:flexmark-ext-ins</include> |
|
153 |
<include>com.vladsch.flexmark:flexmark-ext-xwiki-macros</include> |
|
154 |
<include>com.vladsch.flexmark:flexmark-ext-superscript</include> |
|
155 |
<include>com.vladsch.flexmark:flexmark-ext-tables</include> |
|
156 |
<include>com.vladsch.flexmark:flexmark-ext-toc</include> |
|
157 |
<include>com.vladsch.flexmark:flexmark-ext-typographic</include> |
|
158 |
<include>com.vladsch.flexmark:flexmark-ext-wikilink</include> |
|
159 |
<include>com.vladsch.flexmark:flexmark-ext-yaml-front-matter</include> |
|
160 |
<include>com.vladsch.flexmark:flexmark-ext-youtube-embedded</include> |
|
161 |
<include>com.vladsch.flexmark:flexmark-html2md-converter</include> |
|
162 |
<include>org.jsoup:jsoup</include> |
|
163 |
<include>com.vladsch.flexmark:flexmark-jira-converter</include> |
|
164 |
<include>com.vladsch.flexmark:flexmark-pdf-converter</include> |
|
165 |
<include>com.openhtmltopdf:openhtmltopdf-core</include> |
|
166 |
<include>com.openhtmltopdf:openhtmltopdf-pdfbox</include> |
|
167 |
<include>org.apache.pdfbox:xmpbox</include> |
|
168 |
<include>de.rototor.pdfbox:graphics2d</include> |
|
169 |
<include>com.openhtmltopdf:openhtmltopdf-rtl-support</include> |
|
170 |
<include>com.ibm.icu:icu4j</include> |
|
171 |
<include>com.openhtmltopdf:openhtmltopdf-jsoup-dom-converter</include> |
|
172 |
<include>com.vladsch.flexmark:flexmark-profile-pegdown</include> |
|
173 |
<include>com.vladsch.flexmark:flexmark-util-ast</include> |
|
174 |
<include>org.jetbrains:annotations</include> |
|
175 |
<include>com.vladsch.flexmark:flexmark-util-builder</include> |
|
176 |
<include>com.vladsch.flexmark:flexmark-util-collection</include> |
|
177 |
<include>com.vladsch.flexmark:flexmark-util-data</include> |
|
178 |
<include>com.vladsch.flexmark:flexmark-util-dependency</include> |
|
179 |
<include>com.vladsch.flexmark:flexmark-util-format</include> |
|
180 |
<include>com.vladsch.flexmark:flexmark-util-html</include> |
|
181 |
<include>com.vladsch.flexmark:flexmark-util-misc</include> |
|
182 |
<include>com.vladsch.flexmark:flexmark-util-options</include> |
|
183 |
<include>com.vladsch.flexmark:flexmark-util-sequence</include> |
|
184 |
<include>com.vladsch.flexmark:flexmark-util-visitor</include> |
|
185 |
<include>com.vladsch.flexmark:flexmark-youtrack-converter</include> |
|
186 |
<include>org.apache.pdfbox:pdfbox</include> |
|
187 |
<include>org.apache.pdfbox:fontbox</include> |
|
188 |
<include>commons-logging:commons-logging</include> |
|
189 |
</includes> |
|
190 |
</dependencySet> |
|
191 |
|
|
192 |
</dependencySets> |
|
193 |
|
|
194 |
</assembly> |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.232/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/java/org/gvsig/scripting/app/InstallCert.java | ||
---|---|---|
1 |
package org.gvsig.scripting.app; |
|
2 |
|
|
3 |
/* |
|
4 |
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved. |
|
5 |
* |
|
6 |
* Redistribution and use in source and binary forms, with or without |
|
7 |
* modification, are permitted provided that the following conditions |
|
8 |
* are met: |
|
9 |
* |
|
10 |
* - Redistributions of source code must retain the above copyright |
|
11 |
* notice, this list of conditions and the following disclaimer. |
|
12 |
* |
|
13 |
* - Redistributions in binary form must reproduce the above copyright |
|
14 |
* notice, this list of conditions and the following disclaimer in the |
|
15 |
* documentation and/or other materials provided with the distribution. |
|
16 |
* |
|
17 |
* - Neither the name of Sun Microsystems nor the names of its |
|
18 |
* contributors may be used to endorse or promote products derived |
|
19 |
* from this software without specific prior written permission. |
|
20 |
* |
|
21 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS |
|
22 |
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
|
23 |
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
24 |
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
|
25 |
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
|
26 |
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
|
27 |
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
|
28 |
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
|
29 |
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
|
30 |
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
|
31 |
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
32 |
*/ |
|
33 |
/** |
|
34 |
* Originally from: |
|
35 |
* http://blogs.sun.com/andreas/resource/InstallCert.java |
|
36 |
* Use: |
|
37 |
* java InstallCert hostname |
|
38 |
* Example: |
|
39 |
*% java InstallCert ecc.fedora.redhat.com |
|
40 |
*/ |
|
41 |
|
|
42 |
import java.io.BufferedReader; |
|
43 |
import java.io.File; |
|
44 |
import java.io.FileInputStream; |
|
45 |
import java.io.FileOutputStream; |
|
46 |
import java.io.InputStream; |
|
47 |
import java.io.InputStreamReader; |
|
48 |
import java.io.OutputStream; |
|
49 |
import java.security.KeyStore; |
|
50 |
import java.security.MessageDigest; |
|
51 |
import java.security.cert.CertificateException; |
|
52 |
import java.security.cert.X509Certificate; |
|
53 |
|
|
54 |
import javax.net.ssl.SSLContext; |
|
55 |
import javax.net.ssl.SSLException; |
|
56 |
import javax.net.ssl.SSLSocket; |
|
57 |
import javax.net.ssl.SSLSocketFactory; |
|
58 |
import javax.net.ssl.TrustManager; |
|
59 |
import javax.net.ssl.TrustManagerFactory; |
|
60 |
import javax.net.ssl.X509TrustManager; |
|
61 |
|
|
62 |
/** |
|
63 |
* Class used to add the server's certificate to the KeyStore |
|
64 |
* with your trusted certificates. |
|
65 |
* |
|
66 |
* NOTE: modified to install the certificate always into the main cacerts |
|
67 |
* keystore. |
|
68 |
*/ |
|
69 |
public class InstallCert { |
|
70 |
|
|
71 |
public static void install(String host, Integer port, String passphrase) throws Exception { |
|
72 |
if( passphrase==null ) { |
|
73 |
passphrase = "changeit"; |
|
74 |
} |
|
75 |
if( port == null || port <1) { |
|
76 |
port = 443; |
|
77 |
} |
|
78 |
main( |
|
79 |
new String[] { |
|
80 |
host +":"+port, |
|
81 |
passphrase |
|
82 |
} |
|
83 |
); |
|
84 |
} |
|
85 |
|
|
86 |
public static void main(String[] args) throws Exception { |
|
87 |
String host; |
|
88 |
int port; |
|
89 |
char[] passphrase; |
|
90 |
if ((args.length == 1) || (args.length == 2)) { |
|
91 |
String[] c = args[0].split(":"); |
|
92 |
host = c[0]; |
|
93 |
port = (c.length == 1) ? 443 : Integer.parseInt(c[1]); |
|
94 |
String p = (args.length == 1) ? "changeit" : args[1]; |
|
95 |
passphrase = p.toCharArray(); |
|
96 |
} else { |
|
97 |
System.out.println("Usage: java InstallCert [:port] [passphrase]"); |
|
98 |
return; |
|
99 |
} |
|
100 |
|
|
101 |
File file = null; |
|
102 |
// File file = new File("jssecacerts"); |
|
103 |
// if (file.isFile() == false) { |
|
104 |
char SEP = File.separatorChar; |
|
105 |
File dir = |
|
106 |
new File(System.getProperty("java.home") + SEP + "lib" + SEP |
|
107 |
+ "security"); |
|
108 |
// file = new File(dir, "jssecacerts"); |
|
109 |
// if (file.isFile() == false) { |
|
110 |
file = new File(dir, "cacerts"); |
|
111 |
|
|
112 |
if (!file.canWrite()) { |
|
113 |
System.err |
|
114 |
.println("Unable to write in the file " |
|
115 |
+ file |
|
116 |
+ ".\nRun InstallCert as an administrator or a user with " |
|
117 |
+ "privileges to write in the cacerts file"); |
|
118 |
|
|
119 |
System.exit(-1); |
|
120 |
} |
|
121 |
// } |
|
122 |
// } |
|
123 |
System.out.println("Loading KeyStore " + file + "..."); |
|
124 |
InputStream in = new FileInputStream(file); |
|
125 |
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); |
|
126 |
ks.load(in, passphrase); |
|
127 |
in.close(); |
|
128 |
|
|
129 |
SSLContext context = SSLContext.getInstance("TLS"); |
|
130 |
TrustManagerFactory tmf = |
|
131 |
TrustManagerFactory.getInstance(TrustManagerFactory |
|
132 |
.getDefaultAlgorithm()); |
|
133 |
tmf.init(ks); |
|
134 |
X509TrustManager defaultTrustManager = |
|
135 |
(X509TrustManager) tmf.getTrustManagers()[0]; |
|
136 |
SavingTrustManager tm = new SavingTrustManager(defaultTrustManager); |
|
137 |
context.init(null, new TrustManager[] { tm }, null); |
|
138 |
SSLSocketFactory factory = context.getSocketFactory(); |
|
139 |
|
|
140 |
System.out |
|
141 |
.println("Opening connection to " + host + ":" + port + "..."); |
|
142 |
SSLSocket socket = (SSLSocket) factory.createSocket(host, port); |
|
143 |
socket.setSoTimeout(10000); |
|
144 |
try { |
|
145 |
System.out.println("Starting SSL handshake..."); |
|
146 |
socket.startHandshake(); |
|
147 |
socket.close(); |
|
148 |
System.out.println(); |
|
149 |
System.out.println("No errors, certificate is already trusted"); |
|
150 |
} catch (SSLException e) { |
|
151 |
System.out.println(); |
|
152 |
e.printStackTrace(System.out); |
|
153 |
} |
|
154 |
|
|
155 |
X509Certificate[] chain = tm.chain; |
|
156 |
if (chain == null) { |
|
157 |
System.out.println("Could not obtain server certificate chain"); |
|
158 |
return; |
|
159 |
} |
|
160 |
|
|
161 |
BufferedReader reader = |
|
162 |
new BufferedReader(new InputStreamReader(System.in)); |
|
163 |
|
|
164 |
System.out.println(); |
|
165 |
System.out.println("Server sent " + chain.length + " certificate(s):"); |
|
166 |
System.out.println(); |
|
167 |
MessageDigest sha1 = MessageDigest.getInstance("SHA1"); |
|
168 |
MessageDigest md5 = MessageDigest.getInstance("MD5"); |
|
169 |
for (int i = 0; i < chain.length; i++) { |
|
170 |
X509Certificate cert = chain[i]; |
|
171 |
System.out.println(" " + (i + 1) + " Subject " |
|
172 |
+ cert.getSubjectDN()); |
|
173 |
System.out.println(" Issuer " + cert.getIssuerDN()); |
|
174 |
sha1.update(cert.getEncoded()); |
|
175 |
System.out.println(" sha1 " + toHexString(sha1.digest())); |
|
176 |
md5.update(cert.getEncoded()); |
|
177 |
System.out.println(" md5 " + toHexString(md5.digest())); |
|
178 |
System.out.println(); |
|
179 |
} |
|
180 |
|
|
181 |
// int k=0; |
|
182 |
// System.out |
|
183 |
// .println("Enter certificate to add to trusted keystore or 'q' to quit: [1]"); |
|
184 |
// String line = reader.readLine().trim(); |
|
185 |
// try { |
|
186 |
// k = (line.length() == 0) ? 0 : Integer.parseInt(line) - 1; |
|
187 |
// } catch (NumberFormatException e) { |
|
188 |
// System.out.println("KeyStore not changed"); |
|
189 |
// return; |
|
190 |
// } |
|
191 |
|
|
192 |
for( int k=0; k<chain.length; k++ ) { |
|
193 |
X509Certificate cert = chain[k]; |
|
194 |
String alias = host + "-" + (k + 1); |
|
195 |
ks.setCertificateEntry(alias, cert); |
|
196 |
|
|
197 |
// OutputStream out = new FileOutputStream("jssecacerts"); |
|
198 |
OutputStream out = new FileOutputStream(file); |
|
199 |
ks.store(out, passphrase); |
|
200 |
out.close(); |
|
201 |
|
|
202 |
System.out.println(); |
|
203 |
System.out.println(cert); |
|
204 |
System.out.println(); |
|
205 |
System.out |
|
206 |
.println("Added certificate to keystore '" + |
|
207 |
file + "' using alias '" + alias + "'"); |
|
208 |
} |
|
209 |
} |
|
210 |
|
|
211 |
private static final char[] HEXDIGITS = "0123456789abcdef".toCharArray(); |
|
212 |
|
|
213 |
private static String toHexString(byte[] bytes) { |
|
214 |
StringBuilder sb = new StringBuilder(bytes.length * 3); |
|
215 |
for (int b : bytes) { |
|
216 |
b &= 0xff; |
|
217 |
sb.append(HEXDIGITS[b >> 4]); |
|
218 |
sb.append(HEXDIGITS[b & 15]); |
|
219 |
sb.append(' '); |
|
220 |
} |
|
221 |
return sb.toString(); |
|
222 |
} |
|
223 |
|
|
224 |
private static class SavingTrustManager implements X509TrustManager { |
|
225 |
|
|
226 |
private final X509TrustManager tm; |
|
227 |
private X509Certificate[] chain; |
|
228 |
|
|
229 |
SavingTrustManager(X509TrustManager tm) { |
|
230 |
this.tm = tm; |
|
231 |
} |
|
232 |
|
|
233 |
public X509Certificate[] getAcceptedIssuers() { |
|
234 |
throw new UnsupportedOperationException(); |
|
235 |
} |
|
236 |
|
|
237 |
public void checkClientTrusted(X509Certificate[] chain, String authType) |
|
238 |
throws CertificateException { |
|
239 |
throw new UnsupportedOperationException(); |
|
240 |
} |
|
241 |
|
|
242 |
public void checkServerTrusted(X509Certificate[] chain, String authType) |
|
243 |
throws CertificateException { |
|
244 |
this.chain = chain; |
|
245 |
tm.checkServerTrusted(chain, authType); |
|
246 |
} |
|
247 |
} |
|
248 |
} |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.232/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/java/org/gvsig/scripting/app/extension/ScriptingUtils.java | ||
---|---|---|
1 |
package org.gvsig.scripting.app.extension; |
|
2 |
|
|
3 |
import java.awt.event.ActionEvent; |
|
4 |
import java.awt.event.ActionListener; |
|
5 |
import java.io.File; |
|
6 |
import java.io.IOException; |
|
7 |
import java.nio.file.FileVisitOption; |
|
8 |
import static java.nio.file.FileVisitOption.FOLLOW_LINKS; |
|
9 |
import java.nio.file.FileVisitResult; |
|
10 |
import java.nio.file.Files; |
|
11 |
import java.nio.file.Path; |
|
12 |
import java.nio.file.Paths; |
|
13 |
import java.nio.file.SimpleFileVisitor; |
|
14 |
import java.nio.file.attribute.BasicFileAttributes; |
|
15 |
import java.text.MessageFormat; |
|
16 |
import java.util.ArrayList; |
|
17 |
import java.util.Arrays; |
|
18 |
import java.util.Collections; |
|
19 |
import java.util.Comparator; |
|
20 |
import java.util.EnumSet; |
|
21 |
import java.util.List; |
|
22 |
import java.util.function.Predicate; |
|
23 |
import java.util.logging.Level; |
|
24 |
import javax.swing.JOptionPane; |
|
25 |
import javax.swing.SwingUtilities; |
|
26 |
import org.apache.commons.collections4.CollectionUtils; |
|
27 |
import org.apache.commons.io.FileUtils; |
|
28 |
import org.apache.commons.io.FilenameUtils; |
|
29 |
import org.apache.commons.io.IOCase; |
|
30 |
import org.apache.commons.lang3.BooleanUtils; |
|
31 |
import org.apache.commons.lang3.StringUtils; |
|
32 |
import org.gvsig.andami.PluginServices; |
|
33 |
import org.gvsig.andami.PluginsLocator; |
|
34 |
import org.gvsig.andami.PluginsManager; |
|
35 |
import org.gvsig.expressionevaluator.Code; |
|
36 |
import org.gvsig.expressionevaluator.ExpressionUtils; |
|
37 |
import org.gvsig.scripting.DataFolderFound; |
|
38 |
import org.gvsig.scripting.ScriptingBaseScript; |
|
39 |
import org.gvsig.scripting.ScriptingFolder; |
|
40 |
import org.gvsig.scripting.ScriptingLocator; |
|
41 |
import org.gvsig.scripting.ScriptingManager; |
|
42 |
import org.gvsig.scripting.ScriptingScript; |
|
43 |
import org.gvsig.scripting.ScriptingUnit; |
|
44 |
import org.gvsig.scripting.app.extension.messagewait.MessageWait; |
|
45 |
import org.gvsig.scripting.swing.api.JScriptingComposer; |
|
46 |
import org.gvsig.scripting.swing.api.ScriptingSwingLocator; |
|
47 |
import org.gvsig.scripting.swing.api.ScriptingUIManager; |
|
48 |
import static org.gvsig.scripting.swing.api.ScriptingUIManager.SCRIPT_COMPOSER_AUTORUN; |
|
49 |
import org.gvsig.tools.ToolsLocator; |
|
50 |
import org.gvsig.tools.dynobject.DynObject; |
|
51 |
import org.gvsig.tools.exception.BaseException; |
|
52 |
import org.gvsig.tools.i18n.I18nManager; |
|
53 |
import org.gvsig.tools.packageutils.PackageManager; |
|
54 |
import org.gvsig.tools.packageutils.Version; |
|
55 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
56 |
import org.gvsig.tools.swing.api.threadsafedialogs.ThreadSafeDialogsManager; |
|
57 |
import org.gvsig.tools.swing.api.windowmanager.Dialog; |
|
58 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
|
59 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager_v2; |
|
60 |
import org.gvsig.tools.swing.impl.windowmanager.DefaultWindowManager; |
|
61 |
import org.gvsig.tools.task.SimpleTaskStatus; |
|
62 |
import org.gvsig.tools.visitor.VisitCanceledException; |
|
63 |
import org.gvsig.tools.visitor.Visitor; |
|
64 |
import org.slf4j.Logger; |
|
65 |
import org.slf4j.LoggerFactory; |
|
66 |
import org.gvsig.tools.util.FolderSet; |
|
67 |
import org.gvsig.tools.util.impl.DefaultFolderSet; |
|
68 |
/** |
|
69 |
* |
|
70 |
* @author jjdelcerro |
|
71 |
*/ |
|
72 |
@SuppressWarnings("UseSpecificCatch") |
|
73 |
public class ScriptingUtils { |
|
74 |
|
|
75 |
public static final String SKIP_AUTORUNS = "skipAutoruns"; |
|
76 |
|
|
77 |
private static final Logger LOGGER = LoggerFactory.getLogger(ScriptingExtension.class); |
|
78 |
|
|
79 |
private boolean executingAutorunScripts = false; |
|
80 |
private static boolean composer_initialized = false; |
|
81 |
private final MessageWait message; |
|
82 |
|
|
83 |
/* |
|
84 |
* la funcion log y las constantes estan pensadas para usarlas desde los scripts. |
|
85 |
*/ |
|
86 |
public static final int INFO = 0; |
|
87 |
public static final int TRACE = 1; |
|
88 |
public static final int WARN = 2; |
|
89 |
public static final int ERROR = 3; |
|
90 |
|
|
91 |
public static void log(String message) { |
|
92 |
log(INFO, message, null); |
|
93 |
} |
|
94 |
|
|
95 |
public static void log(int level, String message) { |
|
96 |
log(level, message, null); |
|
97 |
} |
|
98 |
|
|
99 |
public static void log(int level, String message, Throwable th) { |
|
100 |
switch( level ) { |
|
101 |
case TRACE: |
|
102 |
LOGGER.trace(message, th); |
|
103 |
break; |
|
104 |
case ERROR: |
|
105 |
LOGGER.error(message, th); |
|
106 |
break; |
|
107 |
case WARN: |
|
108 |
LOGGER.warn(message, th); |
|
109 |
break; |
|
110 |
default: |
|
111 |
case INFO: |
|
112 |
LOGGER.info(message, th); |
|
113 |
break; |
|
114 |
} |
|
115 |
} |
|
116 |
private String appversion; |
|
117 |
private File pluginHomeFolder; |
|
118 |
|
|
119 |
public ScriptingUtils() { |
|
120 |
message = new MessageWait(); |
|
121 |
} |
|
122 |
|
|
123 |
public static File getScriptsHomeFolder(File pluginHomeFolder, String appversion) { |
|
124 |
File scriptsHomeFolder; |
|
125 |
File f = FileUtils.getFile(pluginHomeFolder, "scripts-folder.txt"); |
|
126 |
if( f.exists() ) { |
|
127 |
try { |
|
128 |
List<String> lines = FileUtils.readLines(f); |
|
129 |
for( String line : lines ) { |
|
130 |
line = line.trim(); |
|
131 |
if( !line.startsWith("#") ) { |
|
132 |
scriptsHomeFolder = new File(line); |
|
133 |
if( !scriptsHomeFolder.isAbsolute() ) { |
|
134 |
scriptsHomeFolder = new File(pluginHomeFolder, line); |
|
135 |
} |
|
136 |
scriptsHomeFolder = new File( |
|
137 |
FilenameUtils.normalizeNoEndSeparator( |
|
138 |
scriptsHomeFolder.getAbsolutePath(), |
|
139 |
true |
|
140 |
) |
|
141 |
); |
|
142 |
if( scriptsHomeFolder.exists() ) { |
|
143 |
return scriptsHomeFolder; |
|
144 |
} |
|
145 |
} |
|
146 |
} |
|
147 |
} catch (IOException ex) { |
|
148 |
} |
|
149 |
} else { |
|
150 |
try { |
|
151 |
FileUtils.touch(f); |
|
152 |
} catch (IOException ex) { |
|
153 |
} |
|
154 |
} |
|
155 |
scriptsHomeFolder = FileUtils.getFile(pluginHomeFolder, appversion) ; |
|
156 |
return scriptsHomeFolder; |
|
157 |
} |
|
158 |
|
|
159 |
public void initializaPaths(List<File> pluginsFolder, File installFolder, File pluginHoneFolder, String appversion) { |
|
160 |
|
|
161 |
this.appversion = appversion; |
|
162 |
this.pluginHomeFolder = pluginHoneFolder; |
|
163 |
ScriptingManager manager = ScriptingLocator.getManager(); |
|
164 |
manager.setHomeFolder(getScriptsHomeFolder(pluginHoneFolder, appversion)); |
|
165 |
|
|
166 |
ScriptingFolder folder = manager.createLink( |
|
167 |
"Common", |
|
168 |
manager.getUserFolder(), |
|
169 |
"../../scripts" |
|
170 |
); |
|
171 |
folder.setProperty(ScriptingUtils.SKIP_AUTORUNS, BooleanUtils.toStringTrueFalse(true)); |
|
172 |
folder.save(); |
|
173 |
// manager.createLink( |
|
174 |
// "Previous version", |
|
175 |
// manager.getUserFolder(), |
|
176 |
// "../../../org.gvsig.scripting.app.extension/scripts" |
|
177 |
// ); |
|
178 |
|
|
179 |
List<File> pluginsFolders = new ArrayList<>(); |
|
180 |
for( File f : pluginsFolder ) { |
|
181 |
pluginsFolders.addAll(Arrays.asList(f.listFiles())); |
|
182 |
} |
|
183 |
|
|
184 |
for( File pluginFolder : pluginsFolders ) { |
|
185 |
File scriptsFolder = new File(pluginFolder, "scripting/scripts"); |
|
186 |
if( scriptsFolder.exists() ) { |
|
187 |
manager.registerSystemFolder(pluginFolder.getName(), scriptsFolder); |
|
188 |
} |
|
189 |
File libFolder = new File(pluginFolder, "scripting/lib"); |
|
190 |
if( libFolder.exists() ) { |
|
191 |
manager.addLibFolder(libFolder); |
|
192 |
} |
|
193 |
} |
|
194 |
manager.setPackagesFolder(installFolder); |
|
195 |
|
|
196 |
File localAddonRepositoryFolder = new File(manager.getRootUserFolder(), "addons"); |
|
197 |
if( !localAddonRepositoryFolder.exists() ) { |
|
198 |
try { |
|
199 |
FileUtils.forceMkdir(localAddonRepositoryFolder); |
|
200 |
} catch (IOException ex) { |
|
201 |
LOGGER.info("Can't create addons folder in '" + localAddonRepositoryFolder.getAbsolutePath() + "'.", ex); |
|
202 |
} |
|
203 |
} |
|
204 |
File initAddonFile = new File(localAddonRepositoryFolder, "__init__.py"); |
|
205 |
if( !initAddonFile.exists() ) { |
|
206 |
try { |
|
207 |
FileUtils.touch(initAddonFile); |
|
208 |
} catch (IOException ex) { |
|
209 |
LOGGER.info("Can't create addons __init__ file in '" + localAddonRepositoryFolder.getAbsolutePath() + "'.", ex); |
|
210 |
} |
|
211 |
} |
|
212 |
} |
|
213 |
|
|
214 |
|
|
215 |
public void runScript(String name, Object[] args) { |
|
216 |
if( StringUtils.isBlank(name) ) { |
|
217 |
return; |
|
218 |
} |
|
219 |
String method = null; |
|
220 |
if( name.contains(".") ) { |
|
221 |
String[] ss = StringUtils.split(name, '.'); |
|
222 |
name = ss[0]; |
|
223 |
if( StringUtils.isAlphanumeric(ss[1]) ) { |
|
224 |
method = ss[1]; |
|
225 |
} else { |
|
226 |
try { |
|
227 |
Code.Callable code = (Code.Callable) ExpressionUtils.compile(ss[1]); |
|
228 |
method = code.name(); |
|
229 |
try { |
|
230 |
code.link(); |
|
231 |
List<Object> args2 = new ArrayList<>(); |
|
232 |
for (Code param : code.parameters()) { |
|
233 |
args2.add(((Code.Constant)param).value()); |
|
234 |
} |
|
235 |
if( !CollectionUtils.isEmpty(args2) ) { |
|
236 |
args = args2.toArray(new Object[args2.size()]); |
|
237 |
} |
|
238 |
} catch(Throwable t) { |
|
239 |
LOGGER.warn("Can't process command args ("+name+").",t); |
|
240 |
} |
|
241 |
} catch(Throwable t) { |
|
242 |
LOGGER.warn("Can't process command ("+name+").",t); |
|
243 |
method = StringUtils.left(ss[1], indexOfNonAlphanumeric(ss[1])+1); |
|
244 |
} |
|
245 |
} |
|
246 |
} |
|
247 |
ThreadSafeDialogsManager dialogs = ToolsSwingLocator.getThreadSafeDialogsManager(); |
|
248 |
ScriptingUIManager uimanager = ScriptingSwingLocator.getUIManager(); |
|
249 |
ScriptingBaseScript script = uimanager.getManager().getScript(name); |
|
250 |
if( script != null ) { |
|
251 |
if( StringUtils.isNotBlank(method) && script instanceof ScriptingScript ) { |
|
252 |
try { |
|
253 |
((ScriptingScript)script).invokeFunction(method, args); |
|
254 |
} catch (NoSuchMethodException ex) { |
|
255 |
LOGGER.warn("Can't call method '"+method+"' of script '"+name+"'.", ex); |
|
256 |
dialogs.messageDialog( |
|
257 |
"Can't call method '"+method+"' of script '"+name+"'.", |
|
258 |
"ScriptLaunch", |
|
259 |
JOptionPane.OK_OPTION |
|
260 |
); |
|
261 |
} |
|
262 |
} else { |
|
263 |
script.run(args); |
|
264 |
} |
|
265 |
} else { |
|
266 |
dialogs.messageDialog( |
|
267 |
"Can't locate script '" + name + "'.", |
|
268 |
"ScriptLaunch", |
|
269 |
JOptionPane.OK_OPTION |
|
270 |
); |
|
271 |
} |
|
272 |
} |
|
273 |
|
|
274 |
public void runLauncher() { |
|
275 |
ScriptingUIManager uimanager = ScriptingSwingLocator.getUIManager(); |
|
276 |
WindowManager winmanager = ToolsSwingLocator.getWindowManager(); |
|
277 |
winmanager.showWindow(uimanager.createLauncher().asJComponent(), uimanager.getTranslation("Scripting_Launcher"), WindowManager.MODE.TOOL); |
|
278 |
} |
|
279 |
|
|
280 |
public void runComposer() { |
|
281 |
PluginsManager pluginsManager = PluginsLocator.getPluginsManager(); |
|
282 |
PluginServices plugin = pluginsManager.getPlugin(ScriptingExtension.class); |
|
283 |
if( plugin!=null ) { |
|
284 |
DynObject preferences = plugin.getPluginProperties(); |
|
285 |
if( preferences!=null ) { |
|
286 |
Boolean composerUseHisWindowManager = (Boolean) preferences.getDynValue("ComposerUseHisWindowManager"); |
|
287 |
if( composerUseHisWindowManager!=null && composerUseHisWindowManager ) { |
|
288 |
DefaultWindowManager winmanager = new DefaultWindowManager(); |
|
289 |
ScriptingUIManager uimanager = ScriptingSwingLocator.getUIManager(); |
|
290 |
uimanager.setWindowManager(winmanager); |
|
291 |
} |
|
292 |
} |
|
293 |
} |
|
294 |
|
|
295 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
|
296 |
message.showMessage( |
|
297 |
i18n.getTranslation("_notice"), |
|
298 |
i18n.getTranslation("_Initializing_the_scripting_plugin_Xhorizontal_ellipsisX") + "\n" |
|
299 |
+ i18n.getTranslation("_Waiting_to_terminate"), |
|
300 |
new MessageWait.WaitingCondition() { |
|
301 |
private Thread th = null; |
|
302 |
|
|
303 |
@Override |
|
304 |
public boolean stopWaiting() { |
|
305 |
if (executingAutorunScripts) { |
|
306 |
return false; |
|
307 |
} |
|
308 |
if (composer_initialized) { |
|
309 |
return true; |
|
310 |
} |
|
311 |
if (th == null) { |
|
312 |
th = new Thread(new ExecuteScriptsFromScriptingFolders(null, "scautorun", SCRIPT_COMPOSER_AUTORUN), "StartupScriptingComposer"); |
|
313 |
th.start(); |
|
314 |
} |
|
315 |
return false; |
|
316 |
} |
|
317 |
}, |
|
318 |
new Runnable() { |
|
319 |
@Override |
|
320 |
public void run() { |
|
321 |
showScriptingComposer(); |
|
322 |
} |
|
323 |
} |
|
324 |
); |
|
325 |
|
|
326 |
} |
|
327 |
|
|
328 |
public Runnable getAutorunScriptsOnStartup(List<File> pluginsFolders) { |
|
329 |
return new ExecuteAutorunScriptsOnStartup(pluginsFolders); |
|
330 |
} |
|
331 |
|
|
332 |
private void showScriptingComposer() { |
|
333 |
ScriptingUIManager uimanager = ScriptingSwingLocator.getUIManager(); |
|
334 |
JScriptingComposer composer = uimanager.createComposer(); |
|
335 |
uimanager.showWindow( |
|
336 |
composer.asJComponent(), |
|
337 |
uimanager.getTranslation("Scripting_Composer") |
|
338 |
); |
|
339 |
} |
|
340 |
|
|
341 |
private class ExecuteScriptsFromScriptingFolders extends AbstractExecuteScripts { |
|
342 |
|
|
343 |
public ExecuteScriptsFromScriptingFolders(List<File> pluginsFolders, String title, String patternName) { |
|
344 |
super(pluginsFolders, title, patternName); |
|
345 |
} |
|
346 |
|
|
347 |
@Override |
|
348 |
public void run() { |
|
349 |
ThreadSafeDialogsManager dialogs = ToolsSwingLocator.getThreadSafeDialogsManager(); |
|
350 |
SimpleTaskStatus status = ToolsLocator.getTaskStatusManager().createDefaultSimpleTaskStatus("Scripts startup"); |
|
351 |
status.setIndeterminate(); |
|
352 |
status.setAutoremove(true); |
|
353 |
status.add(); |
|
354 |
final I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
355 |
try { |
|
356 |
LOGGER.info("Searching "+title+" scripts..."); |
|
357 |
dialogs.message( |
|
358 |
i18nManager.getTranslation("_Searching_autorun_scripts_Xhorizontal_ellipsisX"), |
|
359 |
JOptionPane.INFORMATION_MESSAGE |
|
360 |
); |
|
361 |
ScriptingManager manager = ScriptingLocator.getManager(); |
|
362 |
final List<ScriptingScript> scripts = new ArrayList<>(); |
|
363 |
|
|
364 |
Visitor visitor = new Visitor() { |
|
365 |
@Override |
|
366 |
public void visit(Object o) throws VisitCanceledException, BaseException { |
|
367 |
ScriptingUnit unit = (ScriptingUnit) o; |
|
368 |
if( unit instanceof ScriptingScript && |
|
369 |
FilenameUtils.wildcardMatch(unit.getName(), patternName, IOCase.INSENSITIVE) ) { |
|
370 |
ScriptingScript script = (ScriptingScript) unit; |
|
371 |
if( script.isEnabled() ) { |
|
372 |
scripts.add(script); |
|
373 |
} else { |
|
374 |
LOGGER.info("Skip "+title+" script '" + script.getFile().getAbsolutePath() + "'."); |
|
375 |
} |
|
376 |
} |
|
377 |
} |
|
378 |
}; |
|
379 |
Predicate<ScriptingUnit> includeFilter = new Predicate<ScriptingUnit>() { |
|
380 |
@Override |
|
381 |
public boolean test(ScriptingUnit unit) { |
|
382 |
if( unit instanceof ScriptingFolder ) { |
|
383 |
return !BooleanUtils.toBoolean(unit.getProperty(SKIP_AUTORUNS)); |
|
384 |
} |
|
385 |
return false; |
|
386 |
} |
|
387 |
}; |
|
388 |
manager.getSystemFolder().accept(visitor, includeFilter); |
|
389 |
manager.getUserFolder().accept(visitor, includeFilter); |
|
390 |
sortScripts(scripts); |
|
391 |
executeScripts(scripts, status); |
|
392 |
} catch(Throwable th) { |
|
393 |
|
|
394 |
} finally { |
|
395 |
composer_initialized = true; |
|
396 |
LOGGER.info("Running "+title+" scripts terminated."); |
|
397 |
dialogs.message("", JOptionPane.INFORMATION_MESSAGE); |
|
398 |
status.terminate(); |
|
399 |
} |
|
400 |
} |
|
401 |
} |
|
402 |
|
|
403 |
public class ExecuteAutorunScriptsOnStartup implements Runnable { |
|
404 |
|
|
405 |
private final List<File> pluginsFolders; |
|
406 |
|
|
407 |
public ExecuteAutorunScriptsOnStartup(List<File> pluginsFolders) { |
|
408 |
this.pluginsFolders = pluginsFolders; |
|
409 |
} |
|
410 |
|
|
411 |
@Override |
|
412 |
public void run() { |
|
413 |
try { |
|
414 |
Runnable process = new ExecuteScriptsFromFilesystem( |
|
415 |
this.pluginsFolders, |
|
416 |
"autorun", |
|
417 |
"autorun.inf" |
|
418 |
); |
|
419 |
process.run(); |
|
420 |
} catch(Throwable t) { |
|
421 |
LOGGER.error("Problems runing autorun scripts",t); |
|
422 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
|
423 |
ThreadSafeDialogsManager dialogs = ToolsSwingLocator.getThreadSafeDialogsManager(); |
|
424 |
dialogs.messageDialog( |
|
425 |
i18n.getTranslation("_There_was_a_problem_starting_the_application_It_is_convenient_that_you_close_it_and_start_it_again"), |
|
426 |
"gvSIG desktop", |
|
427 |
JOptionPane.ERROR_MESSAGE |
|
428 |
); |
|
429 |
} |
|
430 |
} |
|
431 |
} |
|
432 |
|
|
433 |
private abstract class AbstractExecuteScripts implements Runnable { |
|
434 |
|
|
435 |
protected String patternName; |
|
436 |
protected String title; |
|
437 |
private final List<File> pluginsFolders; |
|
438 |
|
|
439 |
public AbstractExecuteScripts(List<File> pluginsFolders, String title, String patternName) { |
|
440 |
if( pluginsFolders==null ) { |
|
441 |
this.pluginsFolders = Collections.EMPTY_LIST; |
|
442 |
} else { |
|
443 |
this.pluginsFolders = pluginsFolders; |
|
444 |
} |
|
445 |
this.patternName = patternName; |
|
446 |
this.title = title; |
|
447 |
} |
|
448 |
|
|
449 |
protected List<File> getPluginsFolders() { |
|
450 |
return this.pluginsFolders; |
|
451 |
} |
|
452 |
|
|
453 |
private String getScriptOrderKey(ScriptingBaseScript o) { |
|
454 |
int groupOrder = 500; |
|
455 |
String groupName = "default"; |
|
456 |
int scriptOrder = 500; |
|
457 |
String s = o.getProperty("autorun.group.order"); |
|
458 |
if (s != null) { |
|
459 |
try { |
|
460 |
groupOrder = Integer.parseInt(s); |
|
461 |
} catch (Exception ex) { |
|
462 |
// Do nothing. |
|
463 |
} |
|
464 |
} |
|
465 |
s = o.getProperty("autorun.group.name"); |
|
466 |
if (s != null) { |
|
467 |
groupName = s; |
|
468 |
} |
|
469 |
s = o.getProperty("autorun.order"); |
|
470 |
if (s != null) { |
|
471 |
try { |
|
472 |
scriptOrder = Integer.parseInt(s); |
|
473 |
} catch (Exception ex) { |
|
474 |
// Do nothing. |
|
475 |
} |
|
476 |
} |
|
477 |
String key = MessageFormat.format( |
|
478 |
"{0,number,000000}.{1}.{2,number,000000}", |
|
479 |
groupOrder, |
|
480 |
groupName, |
|
481 |
scriptOrder |
|
482 |
); |
|
483 |
return key; |
|
484 |
} |
|
485 |
|
|
486 |
protected void sortScripts(List<ScriptingScript> scripts) { |
|
487 |
Collections.sort(scripts, new Comparator<ScriptingBaseScript>() { |
|
488 |
|
|
489 |
@Override |
|
490 |
public int compare(ScriptingBaseScript o1, ScriptingBaseScript o2) { |
|
491 |
return getScriptOrderKey(o1).compareToIgnoreCase(getScriptOrderKey(o2)); |
|
492 |
} |
|
493 |
}); |
|
494 |
} |
|
495 |
|
|
496 |
protected void executeScripts(List<ScriptingScript> scripts, SimpleTaskStatus status) { |
|
497 |
ThreadSafeDialogsManager dialogs = ToolsSwingLocator.getThreadSafeDialogsManager(); |
|
498 |
final I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
499 |
if (scripts != null && !scripts.isEmpty()) { |
|
500 |
LOGGER.info("Scripts to run:"); |
|
501 |
for (ScriptingBaseScript script : scripts) { |
|
502 |
try { |
|
503 |
LOGGER.info(StringUtils.abbreviateMiddle(script.getFile().getParent(),"...",50) + " (" + getScriptOrderKey(script) + ", " + script.getIsolationGroup() + ")"); |
|
504 |
} catch(Throwable t) { |
|
505 |
LOGGER.info("...Error..."); |
|
506 |
} |
|
507 |
} |
|
508 |
if (status != null) { |
|
509 |
status.setRangeOfValues(0, scripts.size()); |
|
510 |
} |
|
511 |
int n = 0; |
|
512 |
for (ScriptingBaseScript script : scripts) { |
|
513 |
if (status != null) { |
|
514 |
status.setCurValue(n++); |
|
515 |
} |
|
516 |
try { |
|
517 |
if( StringUtils.equals("autorun", title) ) { |
|
518 |
LOGGER.info("running '" + script.getFile().getParent() + "'."); |
|
519 |
} else { |
|
520 |
LOGGER.info("running " + title + " '" + script.getFile().getAbsolutePath() + "'."); |
|
521 |
} |
|
522 |
dialogs.message( |
|
523 |
i18nManager.getTranslation( |
|
524 |
"_Starting_XnameX", |
|
525 |
new String[]{ |
|
526 |
script.getFile().getParentFile().getName()} |
|
527 |
), |
|
528 |
JOptionPane.INFORMATION_MESSAGE |
|
529 |
); |
|
530 |
} catch (Exception ex) { |
|
531 |
// Ignore it |
|
532 |
} |
|
533 |
try { |
|
534 |
// Hacemos un reload por si un sript deshabilito a otro. |
|
535 |
script.reload(); |
|
536 |
if( script.isEnabled() ) { |
|
537 |
script.run(); |
|
538 |
} else { |
|
539 |
LOGGER.info("Skip " + title + " script '" + script.getFile().getAbsolutePath() + "' (" + getScriptOrderKey(script) + ", " + script.getIsolationGroup() + ")."); |
|
540 |
} |
|
541 |
} catch (Exception ex) { |
|
542 |
LOGGER.warn("Can't execute " + title + " from '" + script.getFile().getAbsolutePath() + "'.", ex); |
|
543 |
} |
|
544 |
} |
|
545 |
} |
|
546 |
|
|
547 |
} |
|
548 |
} |
|
549 |
|
|
550 |
private class ExecuteScriptsFromFilesystem extends AbstractExecuteScripts { |
|
551 |
|
|
552 |
public ExecuteScriptsFromFilesystem(List<File> pluginsFolder, String title, String patternName) { |
|
553 |
super(pluginsFolder, title, patternName); |
|
554 |
} |
|
555 |
|
|
556 |
@Override |
|
557 |
public void run() { |
|
558 |
ThreadSafeDialogsManager dialogs = ToolsSwingLocator.getThreadSafeDialogsManager(); |
|
559 |
executingAutorunScripts = true; |
|
560 |
try { |
|
561 |
final ScriptingManager manager = ScriptingLocator.getManager(); |
|
562 |
manager.loadEngines(); |
|
563 |
|
|
564 |
// final PluginsManager pluginManager = PluginsLocator.getManager(); |
|
565 |
final I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
566 |
|
|
567 |
final List<ScriptingScript> scripts = new ArrayList<>(); |
|
568 |
|
|
569 |
List<File> pluginsFolders = new ArrayList<>(); |
|
570 |
for (File pluginsFolders2 : this.getPluginsFolders()) { |
|
571 |
for (File pluginFolder : pluginsFolders2.listFiles()) { |
|
572 |
File f = FileUtils.getFile(pluginFolder, "scripting", "scripts"); |
|
573 |
if (f.exists()) { |
|
574 |
pluginsFolders.add(f); |
|
575 |
} |
|
576 |
} |
|
577 |
} |
|
578 |
|
|
579 |
dialogs.message( |
|
580 |
i18nManager.getTranslation("_Searching_autorun_scripts_Xhorizontal_ellipsisX"), |
|
581 |
JOptionPane.INFORMATION_MESSAGE |
|
582 |
); |
|
583 |
|
|
584 |
SimpleFileVisitor<Path> visitor = new SimpleFileVisitor<Path>() { |
|
585 |
@Override |
|
586 |
public FileVisitResult visitFile(Path path, BasicFileAttributes bfa) throws IOException { |
|
587 |
File file = path.toFile(); |
|
588 |
if (FilenameUtils.wildcardMatch(file.getName(), patternName, IOCase.INSENSITIVE)) { |
|
589 |
if (file.exists()) { |
|
590 |
ScriptingScript script = (ScriptingScript) manager.getScript(file); |
|
591 |
if (script.isEnabled()) { |
|
592 |
scripts.add(script); |
|
593 |
} else { |
|
594 |
LOGGER.info("Skip " + title + " script '" + file.getAbsolutePath() + "'."); |
|
595 |
} |
|
596 |
} |
|
597 |
} |
|
598 |
return FileVisitResult.CONTINUE; |
|
599 |
} |
|
600 |
}; |
|
601 |
try { |
|
602 |
EnumSet<FileVisitOption> opts = EnumSet.of(FOLLOW_LINKS); |
|
603 |
for (File pluginFolder : pluginsFolders) { |
|
604 |
Files.walkFileTree(Paths.get(pluginFolder.toURI()), opts, Integer.MAX_VALUE, visitor); |
|
605 |
} |
|
606 |
Files.walkFileTree(Paths.get(manager.getRootUserFolder().toURI()), opts, Integer.MAX_VALUE, visitor); |
|
607 |
List<ScriptingFolder> folders = manager.getAlternativeUserFolders(); |
|
608 |
for (ScriptingFolder folder : folders) { |
|
609 |
Files.walkFileTree(Paths.get(folder.getFile().toURI()), opts, Integer.MAX_VALUE, visitor); |
|
610 |
} |
|
611 |
} catch (Exception ex) { |
|
612 |
LOGGER.warn("Can't execute " + title + " in home.", ex); |
|
613 |
} |
|
614 |
sortScripts(scripts); |
|
615 |
executeScripts(scripts, null); |
|
616 |
|
|
617 |
} finally { |
|
618 |
LOGGER.info("Running " + title + " scripts terminated."); |
|
619 |
dialogs.message("", JOptionPane.INFORMATION_MESSAGE); |
|
620 |
executingAutorunScripts = false; |
|
621 |
} |
|
622 |
checkDataFoldersVersions(); |
|
623 |
} |
|
624 |
|
|
625 |
} |
|
626 |
|
|
627 |
private void checkDataFoldersVersions() { |
|
628 |
final ScriptingManager manager = ScriptingLocator.getManager(); |
|
629 |
PackageManager versionFactory = ToolsLocator.getPackageManager(); |
|
630 |
Version currentVersion = versionFactory.createVersion(this.appversion); |
|
631 |
FolderSet folders = new DefaultFolderSet(); |
|
632 |
folders.add(this.pluginHomeFolder); |
|
633 |
final List<DataFolderFound> dataFoldersFound = manager.searchOldVersions(currentVersion, folders); |
|
634 |
if( dataFoldersFound == null || dataFoldersFound.isEmpty() ) { |
|
635 |
return; |
|
636 |
} |
|
637 |
Runnable askUser = new Runnable() { |
|
638 |
@Override |
|
639 |
public void run() { |
|
640 |
WindowManager_v2 winManager = (WindowManager_v2) ToolsSwingLocator.getWindowManager(); |
|
641 |
final DataFoldersRecoverPanel panel = new DataFoldersRecoverPanel(dataFoldersFound); |
|
642 |
final Dialog dialog = winManager.createDialog( |
|
643 |
panel, |
|
644 |
"Recuperacion de preferencias", |
|
645 |
null, |
|
646 |
WindowManager_v2.BUTTONS_OK_CANCEL |
|
647 |
); |
|
648 |
dialog.addActionListener(new ActionListener() { |
|
649 |
@Override |
|
650 |
public void actionPerformed(ActionEvent e) { |
|
651 |
if (dialog.getAction() == WindowManager_v2.BUTTON_OK) { |
|
652 |
List<DataFolderFound> toRestore = panel.getSelectedDataFolders(); |
|
653 |
for (DataFolderFound dataFolderFound : dataFoldersFound) { |
|
654 |
if (toRestore.contains(dataFolderFound)) { |
|
655 |
dataFolderFound.restore(); |
|
656 |
} else { |
|
657 |
dataFolderFound.leave(); |
|
658 |
} |
|
659 |
} |
|
660 |
} |
|
661 |
} |
|
662 |
}); |
|
663 |
dialog.show(WindowManager.MODE.WINDOW); |
|
664 |
} |
|
665 |
}; |
|
666 |
if( SwingUtilities.isEventDispatchThread() ) { |
|
667 |
askUser.run(); |
|
668 |
} else { |
|
669 |
SwingUtilities.invokeLater(askUser); |
|
670 |
} |
|
671 |
} |
|
672 |
|
|
673 |
private int indexOfNonAlphanumeric(String s) { |
|
674 |
if( StringUtils.isBlank(s) ) { |
|
675 |
return -1; |
|
676 |
} |
|
677 |
char ch = s.charAt(0); |
|
678 |
if( !Character.isJavaIdentifierStart(ch) ) { |
|
679 |
return -1; |
|
680 |
} |
|
681 |
int i = 0; |
|
682 |
for (; i < s.length(); i++) { |
|
683 |
ch = s.charAt(i); |
|
684 |
if( !Character.isJavaIdentifierPart(ch) ) { |
|
685 |
return i-1; |
|
686 |
} |
|
687 |
} |
|
688 |
return i-1; |
|
689 |
} |
|
690 |
} |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.232/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/java/org/gvsig/scripting/app/extension/ScriptingMain.java | ||
---|---|---|
1 |
package org.gvsig.scripting.app.extension; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.net.URL; |
|
5 |
import java.util.ArrayList; |
|
6 |
import java.util.HashMap; |
|
7 |
import java.util.List; |
|
8 |
import java.util.Map; |
|
9 |
import javax.swing.UIManager; |
|
10 |
import org.apache.commons.cli.CommandLine; |
|
11 |
import org.apache.commons.cli.CommandLineParser; |
|
12 |
import org.apache.commons.cli.Options; |
|
13 |
import org.apache.commons.cli.PosixParser; |
|
14 |
import org.apache.commons.io.FileUtils; |
|
15 |
import org.gvsig.about.AboutLocator; |
|
16 |
import org.gvsig.about.AboutManager; |
|
17 |
import org.gvsig.scripting.ScriptingManager; |
|
18 |
import org.gvsig.scripting.swing.api.ScriptingSwingLocator; |
|
19 |
import org.gvsig.scripting.swing.api.ScriptingUIManager; |
|
20 |
import org.gvsig.tools.ToolsLocator; |
|
21 |
import org.gvsig.tools.exception.BaseException; |
|
22 |
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer; |
|
23 |
import org.gvsig.tools.packageutils.PackageInfo; |
|
24 |
import org.gvsig.tools.packageutils.PackageManager; |
|
25 |
import org.gvsig.tools.packageutils.Version; |
|
26 |
|
|
27 |
/** |
|
28 |
* |
|
29 |
* @author jjdelcerro |
|
30 |
*/ |
|
31 |
public class ScriptingMain { |
|
32 |
|
|
33 |
private File applicationFolder = null; |
|
34 |
private Version applicacionVersion = null; |
|
35 |
private List<File> pluginsFolder = null; |
|
36 |
private File applicationHomeFolder; |
|
37 |
private File installFolder; |
|
38 |
private int applicacionBuildNumber; |
|
39 |
|
|
40 |
private ScriptingUtils utils; |
|
41 |
|
|
42 |
public static void main(String args[]) throws Exception { |
|
43 |
ScriptingMain main = new ScriptingMain(); |
|
44 |
main.doMain(args); |
|
45 |
} |
|
46 |
|
|
47 |
public File getApplicationFolder() { |
|
48 |
if (applicationFolder == null) { |
|
49 |
applicationFolder = new File(System.getProperty("user.dir")); |
|
50 |
} |
|
51 |
return applicationFolder; |
|
52 |
} |
|
53 |
|
|
54 |
public File getApplicationHomeFolder() { |
|
55 |
if (applicationHomeFolder == null) { |
|
56 |
applicationHomeFolder = new File(System.getProperty("user.home")); |
|
57 |
} |
|
58 |
return applicationHomeFolder; |
|
59 |
} |
|
60 |
|
|
61 |
public File getInstallFolder() { |
|
62 |
if (installFolder == null) { |
|
63 |
installFolder = FileUtils.getFile(getApplicationFolder(), "install"); |
|
64 |
} |
|
65 |
return this.installFolder; |
|
66 |
} |
|
67 |
|
|
68 |
public Version getApplicationVersion() throws BaseException { |
|
69 |
if (applicacionVersion == null) { |
|
70 |
PackageManager packageManager = ToolsLocator.getPackageManager(); |
|
71 |
PackageInfo packageInfo = packageManager.createPackageInfo( |
|
72 |
new File(this.applicationFolder, "package.info") |
|
73 |
); |
|
74 |
applicacionVersion = (Version) packageInfo.getVersion(); |
|
75 |
} |
|
76 |
return applicacionVersion; |
|
77 |
} |
|
78 |
|
|
79 |
public int getApplicationBuildNumber() throws BaseException { |
|
80 |
if (applicacionBuildNumber == 0) { |
|
81 |
applicacionBuildNumber = getApplicationVersion().getBuild(); |
|
82 |
} |
|
83 |
return this.applicacionBuildNumber; |
|
84 |
} |
|
85 |
|
|
86 |
public List<File> getPluginsFolder() { |
|
87 |
List<File> folders = new ArrayList<>(); |
|
88 |
folders.add(FileUtils.getFile(this.getApplicationFolder(), "gvSIG", "extensiones")); |
|
89 |
folders.add(FileUtils.getFile(this.getApplicationHomeFolder(), "gvSIG", "installation", "gvSIG", "extensiones")); |
|
90 |
return folders; |
|
91 |
} |
|
92 |
|
|
93 |
public File getPluginHomeFolder() { |
|
94 |
File f = this.getApplicationHomeFolder(); |
|
95 |
f = FileUtils.getFile(f, "gvSIG", "plugins", "org.gvsig.scripting.app.mainplugin"); |
|
96 |
return f; |
|
97 |
} |
|
98 |
|
|
99 |
private void initializeAbout() throws Exception { |
|
100 |
AboutManager aboutManager = AboutLocator.getManager(); |
|
101 |
|
|
102 |
String build = String.valueOf(this.getApplicationBuildNumber()); |
|
103 |
String version = this.getApplicationVersion().toString(); |
|
104 |
|
|
105 |
Map<String, String> gvsig_vars = new HashMap<>(); |
|
106 |
gvsig_vars.put("version", version); |
|
107 |
gvsig_vars.put("build", build); |
|
108 |
aboutManager.setProject( |
|
109 |
"gvSIG Desktop", |
|
110 |
getResource("gvsig.html"), |
|
111 |
null, |
|
112 |
gvsig_vars); |
|
113 |
aboutManager.getProject().set("build", build); |
|
114 |
|
|
115 |
aboutManager.addSponsor( |
|
116 |
"Generalitat Valenciana", |
|
117 |
getResource("gva.html"), |
|
118 |
1); |
|
119 |
|
|
120 |
aboutManager.addDeveloper( |
|
121 |
"gvSIG Asocicion", |
|
122 |
getResource("gvSIG-asociacion.html"), |
|
123 |
2); |
|
124 |
|
|
125 |
} |
|
126 |
|
|
127 |
public void doMain(String args[]) throws Exception { |
|
128 |
|
|
129 |
String lookAndFeel = "com.jgoodies.looks.plastic.PlasticXPLookAndFeel"; |
|
130 |
try { |
|
131 |
UIManager.setLookAndFeel(lookAndFeel); |
|
132 |
} catch(Throwable th) { |
|
133 |
|
|
134 |
} |
|
135 |
|
|
136 |
new DefaultLibrariesInitializer().fullInitialize(); |
|
137 |
|
|
138 |
initializeAbout(); |
|
139 |
|
|
140 |
this.utils = new ScriptingUtils(); |
|
141 |
this.utils.initializaPaths( |
|
142 |
this.getPluginsFolder(), |
|
143 |
this.getInstallFolder(), |
|
144 |
this.getPluginHomeFolder(), |
|
145 |
this.getApplicationVersion().format("%M.%m.%r") |
|
146 |
); |
|
147 |
|
|
148 |
ScriptingUIManager uimanager = ScriptingSwingLocator.getUIManager(); |
|
149 |
ScriptingManager manager = uimanager.getManager(); |
|
150 |
|
|
151 |
Options options = new Options(); |
|
152 |
options.addOption("d", |
|
153 |
"debug", |
|
154 |
false, |
|
155 |
""); |
|
156 |
options.addOption("p", |
|
157 |
"pause", |
|
158 |
false, |
|
159 |
""); |
|
160 |
options.addOption("l", |
|
161 |
"launcher", |
|
162 |
false, |
|
163 |
"Show the launcher window"); |
|
164 |
options.addOption("c", |
|
165 |
"composer", |
|
166 |
false, |
|
167 |
"Show the composer window"); |
|
168 |
options.addOption("r", |
|
169 |
"run", |
|
170 |
true, |
|
171 |
"Run the specified script"); |
|
172 |
options.addOption("h", |
|
173 |
"home", |
|
174 |
true, |
|
175 |
"Specify for the home of the script framework"); |
|
176 |
CommandLineParser parser = new PosixParser(); |
|
177 |
CommandLine line = null; |
|
178 |
boolean runLauncherAtEnd = true; |
|
179 |
|
|
180 |
line = parser.parse(options, args); |
|
181 |
if (line.hasOption("home")) { |
|
182 |
manager.setHomeFolder(new File(line.getOptionValue("home"))); |
|
183 |
} |
|
184 |
if (line.hasOption("composer")) { |
|
185 |
runLauncherAtEnd = false; |
|
186 |
utils.runComposer(); |
|
187 |
} |
|
188 |
if (line.hasOption("run")) { |
|
189 |
runLauncherAtEnd = false; |
|
190 |
utils.runScript(line.getOptionValue("run"), line.getArgs()); |
|
191 |
} |
|
192 |
if( runLauncherAtEnd ) { |
|
193 |
utils.runLauncher(); |
|
194 |
} |
|
195 |
} |
|
196 |
|
|
197 |
private URL getResource(String name) { |
|
198 |
URL resource = this.getClass().getResource(name); |
|
199 |
return resource; |
|
200 |
} |
|
201 |
|
|
202 |
} |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.232/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/java/org/gvsig/scripting/app/extension/DataFoldersRecoverPanelView.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
|
|
3 |
<object classname="com.jeta.forms.store.memento.FormPackage"> |
|
4 |
<at name="fileversion"> |
|
5 |
<object classname="com.jeta.forms.store.memento.FormsVersion2"> |
|
6 |
<at name="major">2</at> |
|
7 |
<at name="minor">0</at> |
|
8 |
<at name="sub">0</at> |
|
9 |
</object> |
|
10 |
</at> |
|
11 |
<at name="form"> |
|
12 |
<object classname="com.jeta.forms.store.memento.FormMemento"> |
|
13 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
14 |
<at name="cellconstraints"> |
|
15 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
16 |
<at name="column">1</at> |
|
17 |
<at name="row">1</at> |
|
18 |
<at name="colspan">1</at> |
|
19 |
<at name="rowspan">1</at> |
|
20 |
<at name="halign">default</at> |
|
21 |
<at name="valign">default</at> |
|
22 |
<at name="insets" object="insets">0,0,0,0</at> |
|
23 |
</object> |
|
24 |
</at> |
|
25 |
<at name="componentclass">com.jeta.forms.gui.form.FormComponent</at> |
|
26 |
</super> |
|
27 |
<at name="id">/home/jjdelcerro/datos/devel/org.gvsig.scripting/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/java/org/gvsig/scripting/app/extension/DataFoldersRecoverPanelView.xml</at> |
|
28 |
<at name="rowspecs">CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE</at> |
|
29 |
<at name="colspecs">FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE</at> |
|
30 |
<at name="components"> |
|
31 |
<object classname="java.util.LinkedList"> |
|
32 |
<item > |
|
33 |
<at name="value"> |
|
34 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
35 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
36 |
<at name="cellconstraints"> |
|
37 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
38 |
<at name="column">2</at> |
|
39 |
<at name="row">2</at> |
|
40 |
<at name="colspan">1</at> |
|
41 |
<at name="rowspan">1</at> |
|
42 |
<at name="halign">default</at> |
|
43 |
<at name="valign">default</at> |
|
44 |
<at name="insets" object="insets">0,0,0,0</at> |
|
45 |
</object> |
|
46 |
</at> |
|
47 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
48 |
</super> |
|
49 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
50 |
<at name="beanclass">com.jeta.forms.components.label.JETALabel</at> |
|
51 |
<at name="beanproperties"> |
|
52 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
53 |
<at name="classname">com.jeta.forms.components.label.JETALabel</at> |
|
54 |
<at name="properties"> |
|
55 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
56 |
<at name="border"> |
|
57 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
58 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
59 |
<at name="name">border</at> |
|
60 |
</super> |
|
61 |
<at name="borders"> |
|
62 |
<object classname="java.util.LinkedList"> |
|
63 |
<item > |
|
64 |
<at name="value"> |
|
65 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
66 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
67 |
<at name="name">border</at> |
|
68 |
</super> |
|
69 |
</object> |
|
70 |
</at> |
|
71 |
</item> |
|
72 |
</object> |
|
73 |
</at> |
|
74 |
</object> |
|
75 |
</at> |
|
76 |
<at name="name">lblMsg1</at> |
|
77 |
<at name="width">583</at> |
|
78 |
<at name="text"><html>Han sido encontradas preferencias de versiones anteriores para algunos complementos.</html></at> |
|
79 |
<at name="fill"> |
|
80 |
<object classname="com.jeta.forms.store.properties.effects.PaintProperty"> |
|
81 |
<at name="name">fill</at> |
|
82 |
</object> |
|
83 |
</at> |
|
84 |
<at name="height">14</at> |
|
85 |
</object> |
|
86 |
</at> |
|
87 |
</object> |
|
88 |
</at> |
|
89 |
</object> |
|
90 |
</at> |
|
91 |
</item> |
|
92 |
<item > |
|
93 |
<at name="value"> |
|
94 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
95 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
96 |
<at name="cellconstraints"> |
|
97 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
98 |
<at name="column">2</at> |
|
99 |
<at name="row">4</at> |
|
100 |
<at name="colspan">1</at> |
|
101 |
<at name="rowspan">1</at> |
|
102 |
<at name="halign">default</at> |
|
103 |
<at name="valign">default</at> |
|
104 |
<at name="insets" object="insets">0,0,0,0</at> |
|
105 |
</object> |
|
106 |
</at> |
|
107 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
108 |
</super> |
|
109 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
110 |
<at name="beanclass">com.jeta.forms.components.label.JETALabel</at> |
|
111 |
<at name="beanproperties"> |
|
112 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
113 |
<at name="classname">com.jeta.forms.components.label.JETALabel</at> |
|
114 |
<at name="properties"> |
|
115 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
116 |
<at name="border"> |
|
117 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
118 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
119 |
<at name="name">border</at> |
|
120 |
</super> |
|
121 |
<at name="borders"> |
|
122 |
<object classname="java.util.LinkedList"> |
|
123 |
<item > |
|
124 |
<at name="value"> |
|
125 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
126 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
127 |
<at name="name">border</at> |
|
128 |
</super> |
|
129 |
</object> |
|
130 |
</at> |
|
131 |
</item> |
|
132 |
</object> |
|
133 |
</at> |
|
134 |
</object> |
Also available in: Unified diff