Revision 74

View differences:

tags/org.gvsig.customize.app-1.2.4/org.gvsig.customize.app.mainplugin/pom.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2

  
3
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4

  
5
    <modelVersion>4.0.0</modelVersion>
6
    <artifactId>org.gvsig.customize.app.mainplugin</artifactId>
7
    <packaging>jar</packaging>
8
    <name>${project.artifactId}</name>
9
    <description>Support to customize gvSIG distribution</description>
10

  
11
    <parent>
12
        <groupId>org.gvsig</groupId>
13
        <artifactId>org.gvsig.customize.app</artifactId>
14
        <version>1.2.4</version>
15
    </parent>
16

  
17
    <dependencies>
18
        <dependency>
19
            <groupId>org.swinglabs.swingx</groupId>
20
            <artifactId>swingx-all</artifactId>
21
            <version>1.6.5-1</version>
22
        </dependency>      
23
        <dependency>
24
            <groupId>commons-io</groupId>
25
            <artifactId>commons-io</artifactId>
26
            <scope>compile</scope>
27
        </dependency>      
28
        <dependency>
29
            <groupId>commons-configuration</groupId>
30
            <artifactId>commons-configuration</artifactId>
31
            <scope>compile</scope>
32
        </dependency>
33
        <dependency>
34
            <groupId>org.apache.commons</groupId>
35
            <artifactId>commons-lang3</artifactId>
36
            <scope>compile</scope>
37
        </dependency>      
38
        <dependency>
39
            <groupId>org.gvsig</groupId>
40
            <artifactId>org.gvsig.tools.lib</artifactId>
41
            <scope>compile</scope>
42
        </dependency>
43
        <dependency>
44
            <groupId>org.gvsig</groupId>
45
            <artifactId>org.gvsig.andami</artifactId>
46
            <scope>compile</scope>
47
        </dependency>
48
        <dependency>
49
            <groupId>org.gvsig</groupId>
50
            <artifactId>org.gvsig.app.mainplugin</artifactId>
51
            <scope>compile</scope>
52
        </dependency>     
53
    </dependencies>
54
    <build>
55
        <plugins>
56
      
57
            <plugin>
58
                <!-- Set java compatibility -->
59
                <groupId>org.apache.maven.plugins</groupId>
60
                <artifactId>maven-compiler-plugin</artifactId>
61
                <configuration>
62
                    <source>1.7</source>
63
                    <target>1.7</target>
64
                    <encoding>ISO-8859-1</encoding>
65
                </configuration>
66
            </plugin>
67
            <plugin>
68
                <groupId>org.codehaus.mojo</groupId>
69
                <artifactId>animal-sniffer-maven-plugin</artifactId>
70
                <executions>
71
                    <execution>
72
                        <id>check-java-api</id>
73
                        <phase>package</phase>
74
                        <goals>
75
                            <goal>check</goal>
76
                        </goals>
77
                        <configuration>
78
                            <skip>false</skip>
79
                            <signature>
80
                                <groupId>org.codehaus.mojo.signature</groupId>
81
                                <artifactId>java17</artifactId>
82
                                <version>1.0</version>
83
                            </signature>
84
                            <ignores>
85
                                <ignore>net.sourceforge.cobertura.coveragedata.TouchCollector</ignore>
86
                            </ignores>
87
                        </configuration>
88
                    </execution>
89
                </executions>
90
            </plugin>      
91
        </plugins>
92
    </build> 
93
   
94
    <properties>
95
        <!-- Package info property values -->
96
        <!-- Default values in org.gvsig.desktop -->
97
        <gvsig.package.info.javaVM>j1_7</gvsig.package.info.javaVM>
98
        <gvsig.package.info.name>Customize gvSIG installation</gvsig.package.info.name>
99
        <gvsig.package.info.state>testing</gvsig.package.info.state>
100
        <gvsig.package.info.official>true</gvsig.package.info.official>
101
        <gvsig.package.info.poolURL>https://devel.gvsig.org/download/projects/gvsig-desktop-customize/pool/</gvsig.package.info.poolURL>
102
        <gvsig.package.info.operatingSystem>all</gvsig.package.info.operatingSystem>
103
        <gvsig.package.info.architecture>all</gvsig.package.info.architecture>
104
    </properties>
105
  
106

  
107
</project>
tags/org.gvsig.customize.app-1.2.4/org.gvsig.customize.app.mainplugin/buildNumber.properties
1
#Fri Oct 09 12:12:10 CEST 2015
2
buildNumber=14
tags/org.gvsig.customize.app-1.2.4/org.gvsig.customize.app.mainplugin/src/main/resources-plugin/plugin-persistence.def
1
<?xml version="1.0"?>
2
<!--
3
Definitions of plugin persistence org.gvsig.editing.  
4
 -->
5
<definitions>
6
  <version>1.0.0</version>
7
  <classes>
8
    <class name="org.gvsig.customize.app.mainplugin">
9
      <description>Persistence for the customize plugin</description>
10
      <fields>
11
        <field name="configureLocale" Label="Apply locale" type="Boolean" defaultValue="true" mandatory="false" group="Apply options">
12
          <description>Apply default locale in next startup</description>
13
        </field>
14
        <field name="configureProjection" Label="Apply projection" type="Boolean" defaultValue="true" mandatory="false" group="Apply options">
15
          <description>Apply default proyection in next startup</description>
16
        </field>
17
        <field name="configureHTTPPproxy" Label="Apply proxy configuration" type="Boolean" defaultValue="true" mandatory="false" group="Apply options">
18
          <description>Apply default proyection in next startup</description>
19
        </field>
20
        <field name="configureOGCServers_WMS" Label="Apply WMS servers" type="Boolean" defaultValue="true" mandatory="false" group="Apply options">
21
          <description>Apply default WMS servers in next startup</description>
22
        </field>
23
        <field name="configureOGCServers_WMTS" Label="Apply WMTS servers" type="Boolean" defaultValue="true" mandatory="false" group="Apply options">
24
          <description>Apply default WMTS servers in next startup</description>
25
        </field>
26
        <field name="configureOGCServers_WCS" Label="Apply WCS servers" type="Boolean" defaultValue="true" mandatory="false" group="Apply options">
27
          <description>Apply default WCS servers in next startup</description>
28
        </field>
29
        <field name="configureOGCServers_WFS" Label="Apply WFS servers" type="Boolean" defaultValue="true" mandatory="false" group="Apply options">
30
          <description>Apply default WFS servers in next startup</description>
31
        </field>
32
        <field name="installAdditionalComponents" Label="Install additional components" type="Boolean" defaultValue="true" mandatory="false" group="Apply options">
33
          <description>Install additional components if required</description>
34
        </field>
35
        
36
        <field name="showCustomizeTools" Label="Show customize tools" type="Boolean" defaultValue="true" mandatory="false" group="Apply options">
37
          <description>Show the tools to customize and create distributions</description>
38
        </field>
39
        
40
        <field name="distributionID" Label="Distribution identifier" type="String" defaultValue="" mandatory="false" group="Create distribution">
41
          <description>Identifier to use to generate the distribution, only letters and numbers</description>
42
        </field>
43
        <field name="onlineInstaller" Label="Online installer" type="File" defaultValue="" mandatory="false" group="Create distribution">
44
          <description>Last online installer used to generate the distribution</description>
45
        </field>        
46
        <field name="packageSet" Label="Package set" type="File" defaultValue="" mandatory="false" group="Create distribution">
47
          <description>Last package set used to generate the distribution</description>
48
        </field>        
49
        <field name="WorkingFolder" Label="Working folder" type="File" defaultValue="" mandatory="false" group="Create distribution">
50
          <description>Last working folder used to generate the distribution</description>
51
        </field>        
52
        <field name="includeCustomizePlugin" Label="Include customize plugin" type="Boolean" defaultValue="true" mandatory="false" group="Create distribution">
53
          <description>Last value used for the flag of include customize plugins used to generate the distribution</description>
54
        </field>        
55
      </fields>
56
    </class>
57
  </classes>
58
</definitions>  
tags/org.gvsig.customize.app-1.2.4/org.gvsig.customize.app.mainplugin/src/main/resources-plugin/installkit/main.tcl
1
proc main { } {
2
        global argc
3
        global argv
4

  
5
        if {$argc < 1} {
6
                help
7
                return 1
8
        }
9
        if {$::installkit::wrapped} {
10
                puts "Script embebido en el binario"
11
                # Cuando se da esta condicion he palmado el argv de 0,
12
                # y no se de donde sacarlo., con lo que se perdio el command
13
                puts "argv: $argv"
14
                puts "tcl_argv: $::tcl_argv"
15
        }
16

  
17
        set cmd [lindex $argv 0]
18
        # puts "command: $cmd"
19
        #puts "argv: $argv"
20
        #puts "tcl_argv: $::tcl_argv"
21
        switch $cmd {
22
                "help" {
23
                        help
24
                }
25
                "ls" {
26
                        set install_file  [ lindex $argv 1 ]
27
                        ls $install_file
28
                }
29
                "addmain" {
30
                        set install_file  [ lindex $argv 1 ]
31
                        set main_file  [ lindex $argv 2 ]
32
                        addmain $install_file $main_file
33
                }
34
                "addpks" {
35
                        set install_file  [ lindex $argv 1 ]
36
                        set package_set  [ lindex $argv 2 ]
37
                        addpks $install_file $package_set
38
                }
39
                "addjrelin" {
40
                        set install_file  [ lindex $argv 1 ]
41
                        set jre_installer  [ lindex $argv 2 ]
42
                        addjrelin $install_file $jre_installer
43
                }
44
                "addjrewin" {
45
                        set install_file  [ lindex $argv 1 ]
46
                        set jre_installer  [ lindex $argv 2 ]
47
                        addjrewin $install_file $jre_installer
48
                }
49
                "extractpks" {
50
                        set install_file  [ lindex $argv 1 ]
51
                        set folder  [ lindex $argv 2 ]
52
                        extractpks $install_file $folder
53
                }
54
                "extractjrelin" {
55
                        set install_file  [ lindex $argv 1 ]
56
                        set folder  [ lindex $argv 2 ]
57
                        extractjrelin $install_file $folder
58
                }
59
               "extractjrewin" {
60
                        set install_file  [ lindex $argv 1 ]
61
                        set folder  [ lindex $argv 2 ]
62
                        extractjrewin $install_file $folder
63
                }
64
                default {
65
                        puts "unknow command $cmd"
66
                        help
67
                }
68
        }
69
}
70

  
71

  
72
proc help {} {
73
        global argv0
74
        puts "Usage: [ file tail $argv0 ] command args"
75
        puts "Command are:"
76
        ls_help
77
        addpks_help
78
        addmain_help
79
        addjrelin_help
80
        addjrewin_help
81
        extractpks_help
82
        extractjrelin_help
83
        extractjrewin_help
84
}
85

  
86
proc addmain_help {} {
87
        puts ""
88
        puts "addmain installkit main-file"
89
        puts "  Add the main file to the installkit"
90
        puts "  If main.tcl already in installkit it is replaced"
91
}
92

  
93
proc addmain { installkit_file main_file } {
94
	addfile $install_file $main_file "main.tcl" "Main"
95
}
96

  
97
proc addpks_help {} {
98
        puts ""
99
        puts "addpks gvsig-install-program package-set"
100
        puts "  Add the specified package set to the installation program"
101
        puts "  If package.gvspks was already previously added, it will be replaced"
102
}
103

  
104
proc addpks { install_file package_set } {
105
	addfile $install_file $package_set "package.gvspks" "Package set"
106
}
107

  
108
proc addjrelin_help {} {
109
        puts ""
110
        puts "addjrelin gvsig-install-program jre-installer"
111
        puts "  Add the specified jre linux installer to the installation program"
112
        puts "  If the jre installer was already previously added, it will be replaced"
113
}
114

  
115
proc addjrelin { install_file jre_installer } {
116
	addfile $install_file $jre_installer "jre-installer-lin.bin" "JRE installer"
117
}
118

  
119
proc addjrewin_help {} {
120
        puts ""
121
        puts "addjrewin gvsig-install-program jre-installer"
122
        puts "  Add the specified jre windows installer to the installation program"
123
        puts "  If the jre installer was already previously added, it will be replaced"
124
}
125

  
126
proc addjrewin { install_file jre_installer } {
127
	addfile $install_file $jre_installer "jre-installer-win.exe" "JRE installer"
128
}
129

  
130
proc addfile { install_file file_to_add file_name file_description } {
131
        if { [file writable $install_file] != 1 } {
132
                puts "Write access unavailable to the file $install_file"
133
                return
134
        }
135
        if { [file isfile $file_to_add] !=1 } {
136
                puts "The file to add is not a file: $file_to_add"
137
                return
138
        }
139
        set fp [ ::miniarc::open crap "$install_file" a ]
140
        ::miniarc::addfile $fp "$file_to_add"  -name "$file_name"
141
        ::miniarc::close $fp
142
        puts "$file_description added to installation program."
143
}
144

  
145
proc ls_help {} {
146
        puts ""
147
        puts "ls gvsig-install-program "
148
        puts "  list the files attached to the installkit or installation program especified"
149
}
150

  
151
proc ls { install_file } {
152
        if { [file isfile $install_file] != 1 } {
153
                puts "Can't access to file $install_file"
154
                return
155
        }
156
        set root /installkitunpackvfs
157
        crapvfs::mount $install_file $root
158

  
159
        set dirs [glob -nocomplain -type d $root/*]
160
        if { [llength $dirs] > 0 } {
161
            puts "Directories:"
162
            foreach d [lsort $dirs] {
163
                puts "    $d"
164
            }
165
        } else {
166
            puts "(no subdirectories)"
167
        }
168

  
169
        set files [glob -nocomplain -type f $root/*]
170
        if { [llength $files] > 0 } {
171
            puts "Files:"
172
            foreach f [lsort $files] {
173
                puts "    [file size $f] - $f"
174
            }
175
        } else {
176
            puts "(no files)"
177
        }
178

  
179
        crapvfs::unmount $root
180
}
181

  
182

  
183
proc extractpks_help {} {
184
        puts ""
185
        puts "extractpks gvsig-install-program folder"
186
        puts "  Extract the package set from the installation program to the especified folder"
187
        puts "  If the installation program has not a package set do nothing."
188
}
189

  
190
proc extractpks { install_file folder } {
191
        if { [file isfile $install_file] != 1 } {
192
                puts "Can't access to file $install_file"
193
                return
194
        }
195
        if { [file isdirectory $folder] !=1 } {
196
                puts "Can't access to folder $folder"
197
                return
198
        }
199
        set root /installkitunpackvfs
200
        set already_mounted true
201
        if { [file isdirectory $root] !=1 } {
202
                crapvfs::mount $install_file $root
203
                set already_mounted false
204
        }
205

  
206
        if { [file isfile "$root/package.gvspks"] == 1 } {
207
                file copy "$root/package.gvspks" "$folder/package.gvspks"
208
        }
209

  
210
        if { $already_mounted == false } {
211
                crapvfs::unmount $root
212
        }
213
        puts "Package set extracted to folder $folder"
214
}
215

  
216
proc extractjrelin_help {} {
217
        puts ""
218
        puts "extractjrelin gvsig-install-program folder"
219
        puts "  Extract the jre linux installer from the installation program to the especified folder"
220
        puts "  If the installation program has not a jre installer do nothing."
221
}
222

  
223
proc extractjrelin { install_file folder } {
224
        if { [file isfile $install_file] != 1 } {
225
                puts "Can't access to file $install_file"
226
                return
227
        }
228
        if { [file isdirectory $folder] !=1 } {
229
                puts "Can't access to folder $folder"
230
                return
231
        }
232
        set root /installkitunpackvfs
233
        set already_mounted true
234
        if { [file isdirectory $root] !=1 } {
235
                crapvfs::mount $install_file $root
236
                set already_mounted false
237
        }
238

  
239
        if { [file isfile "$root/jre-installer-lin.bin"] == 1 } {
240
                file copy "$root/jre-installer-lin.bin" "$folder/jre-installer-lin.bin"
241
                puts "JRE installer extracted to folder $folder"
242
        } else {
243
            puts "JRE installer (jre-installer-lin.bin) not available to be extracted"
244
        }
245

  
246
        if { $already_mounted == false } {
247
                crapvfs::unmount $root
248
        }
249
}
250

  
251
proc extractjrewin_help {} {
252
        puts ""
253
        puts "extractjrewin gvsig-install-program folder"
254
        puts "  Extract the jre windows installer from the installation program to the especified folder"
255
        puts "  If the installation program has not a jre installer do nothing."
256
}
257

  
258
proc extractjrewin { install_file folder } {
259
        if { [file isfile $install_file] != 1 } {
260
                puts "Can't access to file $install_file"
261
                return
262
        }
263
        if { [file isdirectory $folder] !=1 } {
264
                puts "Can't access to folder $folder"
265
                return
266
        }
267
        set root /installkitunpackvfs
268
        set already_mounted true
269
        if { [file isdirectory $root] !=1 } {
270
                crapvfs::mount $install_file $root
271
                set already_mounted false
272
        }
273

  
274
        if { [file isfile "$root/jre-installer-win.exe"] == 1 } {
275
                file copy "$root/jre-installer-win.exe" "$folder/jre-installer-win.exe"
276
            puts "JRE installer extracted to folder $folder"
277
        } else {
278
            puts "JRE installer (jre-installer-win.exe) not available to be extracted"
279
        }
280

  
281
        if { $already_mounted == false } {
282
                crapvfs::unmount $root
283
        }
284
}
285

  
286
main
tags/org.gvsig.customize.app-1.2.4/org.gvsig.customize.app.mainplugin/src/main/resources-plugin/i18n/text.properties
1
_Configuring_installation=Configurando la instalaci\u00f3n
2
_Close=Cerrar
3
_Terminating_installation=Terminando la instalaci\u00f3n
4
_Preparing_additional_components_installation=Preparando la instalaci\u00f3n de componentes adicionales
5
_Searching_available_packages=Buscando los paquetes disponibles
6
_Installing_{0}=Instalando {0}
7
_Installation_terminated=Instalaci\u00f3n terminada
8
_Additional_components_installed_succesfully_Restart_applicaction=Componentes adicionales instalados correctamente. Reinicie la aplicaci\u00f3n.
9
_Additional_components_installed_succesfully=Componentes adicionales instalados correctamente.
10
_Problems_installing_additional_components=Han habido problemas instalando los componentes adicionales.
11
_Installing_additional_components=Instalando componentes adicionales
tags/org.gvsig.customize.app-1.2.4/org.gvsig.customize.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties
1
_Configuring_installation=Configuring installation
2
_Close=Close
3
_Terminating_installation=Terminating installation
4
_Preparing_additional_components_installation=Preparing additional components installation
5
_Searching_available_packages=Searching available packages
6
_Installing_{0}=Installing {0}
7
_Installation_terminated=Installation terminated
8
_Additional_components_installed_succesfully_Restart_applicaction=Additional components installed succesfully. Restart_applicaction.
9
_Additional_components_installed_succesfully=Additional components installed succesfully.
10
_Problems_installing_additional_components=Problems installing additional components.
11
_Installing_additional_components=Installing additional components
tags/org.gvsig.customize.app-1.2.4/org.gvsig.customize.app.mainplugin/src/main/resources-plugin/theme/andami-theme.xml
1
<!--
2

  
3
    gvSIG. Desktop Geographic Information System.
4

  
5
    Copyright (C) 2007-2013 gvSIG Association.
6

  
7
    This program is free software; you can redistribute it and/or
8
    modify it under the terms of the GNU General Public License
9
    as published by the Free Software Foundation; either version 3
10
    of the License, or (at your option) any later version.
11

  
12
    This program is distributed in the hope that it will be useful,
13
    but WITHOUT ANY WARRANTY; without even the implied warranty of
14
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
    GNU General Public License for more details.
16

  
17
    You should have received a copy of the GNU General Public License
18
    along with this program; if not, write to the Free Software
19
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20
    MA  02110-1301, USA.
21

  
22
    For any additional information, do not hesitate to contact us
23
    at info AT gvsig.com, or visit our website www.gvsig.com.
24

  
25
-->
26
<AndamiProperties>
27
    <ApplicationImages>
28
        <SplashImages>
29
            <Splash
30
                path="splash.png"
31
                timer="10000"
32
                x="225" y="50"
33
                fontsize="16" color="80,170,240"
34
                version="${version}.${buildNumber} ${state}"/>
35
        </SplashImages>		
36
        <!--
37
        <BackgroundImage path="wallpaper.png"/>
38
        -->
39
        <!--
40
        <BackgroundColor color="0,0,0"/>
41
        -->
42
        <WallpaperType value="CENTERED"/>
43
        <Icon path="icon16x16.png"/>
44
    </ApplicationImages>
45
    <ApplicationName value="gvSIG ${version}.${buildNumber} ${state}"/>
46
    <priority value="1000"/>
47
</AndamiProperties>
tags/org.gvsig.customize.app-1.2.4/org.gvsig.customize.app.mainplugin/src/main/resources-plugin/configure.form
1
<?xml version="1.0"?>
2
<definitions>
3
  <version>1.0.0</version>
4
  <classes>
5

  
6
    <class name="ScriptAction">
7
      <description></description>
8
      <fields>
9
        <field name="name" label="Name" type="String" defaultValue="" mandatory="false">
10
          <description></description>
11
        </field>
12

  
13
        <field name="script" label="Script name" type="String" defaultValue="" mandatory="false">
14
          <description></description>
15
        </field>
16

  
17
        <field name="label" label="Label" type="String" defaultValue="" mandatory="false">
18
          <description></description>
19
        </field>
20

  
21
        <field name="icon" label="Icon name" type="String" defaultValue="" mandatory="false">
22
          <description></description>
23
        </field>
24

  
25
        <field name="position" label="Position" type="long" defaultValue="0" mandatory="false">
26
          <description></description>
27
        </field>
28

  
29
        <field name="tip" label="Tip" type="String" defaultValue="" mandatory="false">
30
          <description></description>
31
        </field>
32

  
33
      </fields>
34
    </class>
35

  
36
    <class name="ViewTocAction">
37
      <description></description>
38
      <fields>
39
        <field name="name" label="Action name" type="String" defaultValue="" mandatory="false">
40
          <description></description>
41
        </field>
42

  
43
        <field name="group" label="Group" type="String" defaultValue="" mandatory="false">
44
          <description></description>
45
        </field>
46

  
47
        <field name="grouporder" label="Group order" type="integer" defaultValue="0" mandatory="false">
48
          <description></description>
49
        </field>
50

  
51
      </fields>
52
    </class>
53

  
54
    <class name="ToolAction">
55
      <description></description>
56
      <fields>
57
        <field name="name" label="Action name" type="String" defaultValue="" mandatory="false">
58
          <description></description>
59
        </field>
60

  
61
        <field name="toolbarName" label="Toolbar name" type="String" defaultValue="" mandatory="false">
62
          <description></description>
63
        </field>
64

  
65
      </fields>
66
    </class>
67

  
68
    <class name="MenuAction">
69
      <description></description>
70
      <fields>
71
        <field name="name" label="Action name" type="String" defaultValue="" mandatory="false">
72
          <description></description>
73
        </field>
74

  
75
        <field name="text" label="Menu entry" type="String" defaultValue="" mandatory="false">
76
          <description></description>
77
        </field>
78

  
79
      </fields>
80
    </class>
81

  
82
    <class name="ServerURL">
83
      <description></description>
84
      <fields>
85
        <field name="remove" label="Remove" type="Boolean" defaultValue="false" mandatory="false">
86
          <description></description>
87
            <tags>
88
                    <value name="dynform.width" value="30" />
89
            </tags>
90
        </field>
91

  
92
        <field name="url" label="URL" type="String" defaultValue="" mandatory="false">
93
            <description></description>
94
        </field>
95

  
96
      </fields>
97
    </class>
98

  
99
    <class name="ProxyConfiguration">
100
      <description></description>
101
      <fields>
102
        <field name="host" label="Host" type="String" defaultValue="" mandatory="false">
103
          <description></description>
104
        </field>
105
        <field name="port" label="Port" type="String" defaultValue="" mandatory="false">
106
          <description></description>
107
        </field>
108
        <field name="username" label="User name" type="String" defaultValue="" mandatory="false">
109
          <description></description>
110
        </field>
111
        <field name="password" label="Password" type="String" defaultValue="" mandatory="false">
112
          <description></description>
113
        </field>
114
        <field name="nonProxyHosts" label="Non proxy hosts" type="String" defaultValue="" mandatory="false">
115
          <description></description>
116
        </field>
117
        <field name="promptUserAndPassword" label="Prompt user and password" type="boolean" defaultValue="false" mandatory="false">
118
          <description></description>
119
        </field>
120
        <field name="enabled" label="Enabled" type="boolean" defaultValue="false" mandatory="false">
121
          <description></description>
122
        </field>
123
      </fields>
124
    </class>
125

  
126
    <class name="CRSConfiguration">
127
      <description></description>
128
      <fields>
129
        <field name="default_projection" label="Default projection" type="CRS" defaultValue="EPSG:4326" mandatory="false">
130
          <description>Default projection to use in gvSIG</description>
131
        </field>
132
        <field name="recent11" label="Recent projection 1" type="Object" classOfValue="org.cresques.cts.IProjection" type="CRS" defaultValue="" mandatory="false">
133
          <description>Projection to add to recent used projections</description>
134
        </field>
135
        <field name="recent2" label="Recent projection 2" type="CRS" defaultValue="" mandatory="false">
136
          <description>Projection to add to recent used projections</description>
137
        </field>
138
        <field name="recent3" label="Recent projection 3" type="CRS" defaultValue="" mandatory="false">
139
          <description>Projection to add to recent used projections</description>
140
        </field>
141
        <field name="recent4" label="Recent projection 4" type="CRS" defaultValue="" mandatory="false">
142
          <description>Projection to add to recent used projections</description>
143
        </field>
144
      </fields>
145
    </class>
146

  
147
    <class name="ThemeConfiguration">
148
      <description></description>
149
      <fields>
150
        <field name="applicationname" label="Application title" type="String" defaultValue="gvSIG ${version}.${buildNumber} ${state}" mandatory="false">
151
          <description></description>
152
        </field>
153
        <field name="icon" label="Icon image" type="File" defaultValue="icon16x16.png" mandatory="false">
154
          <description></description>
155
        </field>
156
        <field name="splash_image" label="Splash image" type="File" defaultValue="splash.png" mandatory="false">
157
          <description></description>
158
        </field>
159
        <field name="splash_version" label="Version" type="String" defaultValue="${version}.${buildNumber} ${state}" mandatory="false">
160
          <description></description>
161
        </field>
162
        <field name="splash_x" label="Version position X" type="Integer" defaultValue="225" mandatory="false">
163
          <description></description>
164
        </field>
165
        <field name="splash_y" label="Version position Y" type="Integer" defaultValue="50" mandatory="false">
166
          <description></description>
167
        </field>
168
        <field name="splash_font_size" label="Version font size" type="integer" defaultValue="16" mandatory="false">
169
          <description></description>
170
        </field>
171
        <field name="splash_font_color" label="Version font color" type="String" defaultValue="80,170,240" mandatory="false">
172
          <description></description>
173
        </field>
174

  
175
        <field name="wallpaper_image" label="Wallpaper image" type="File" defaultValue="" mandatory="false">
176
          <description></description>
177
        </field>
178
        <field name="wallpaper_mode" label="Wallpaper mode" type="String" defaultValue="CENTERED" mandatory="false">
179
            <description></description>
180
            <availableValues>
181
                    <value label="Centered">CENTERED</value>
182
                    <value label="Expand">EXPAND</value>
183
                    <value label="Mosaic">MOSAIC</value>
184
            </availableValues>
185
        </field>
186
        <field name="background_color" label="Background color" type="String" defaultValue="" mandatory="false">
187
          <description></description>
188
        </field>
189
      </fields>
190
    </class>
191

  
192
    <class name="Configuration">
193
      <description>Customize plugin configuration</description>
194
      <fields>
195
        <field name="default_locale" label="Default locale" type="String" subtype="locale" defaultValue="" mandatory="false" group="Locale">
196
          <description>Default locale to use in gvSIG</description>
197
        </field>
198

  
199
        <field name="crs" type="DynObject" classOfValue="CRSConfiguration" defaultValue="" mandatory="false" group="CRS">
200
          <description></description>
201
            <tags>
202
                    <value name="dynform.label.empty" value="true" />
203
            </tags>
204
        </field>
205

  
206
        <field name="httpproxy" type="DynObject" classOfValue="ProxyConfiguration" defaultValue="" mandatory="false" group="Proxy">
207
          <description></description>
208
            <tags>
209
                    <value name="dynform.label.empty" value="true" />
210
            </tags>
211
        </field>
212

  
213
        <field name="wmsUrls" label="WMS URLs" type="List" subtype="DynObject" typeOfItems="DynObject" classOfItems="ServerURL" defaultValue="" mandatory="false" group="WMS">
214
            <description></description>
215
            <tags>
216
                    <value name="dynform.height" value="300" />
217
                    <value name="ViewMode" value="SimpleTable" />
218
                    <value name="dynform.label.empty" value="true" />
219
            </tags>
220
        </field>
221

  
222
        <field name="wmtsUrls" label="WMTS URLs" type="List" subtype="DynObject" typeOfItems="DynObject" classOfItems="ServerURL" defaultValue="" mandatory="false" group="WMTS">
223
            <description></description>
224
            <tags>
225
                    <value name="dynform.height" value="300" />
226
                    <value name="ViewMode" value="SimpleTable" />
227
                    <value name="dynform.label.empty" value="true" />
228
            </tags>
229
        </field>
230

  
231
        <field name="wcsUrls" label="WCS URLs" type="List" subtype="DynObject" typeOfItems="DynObject" classOfItems="ServerURL" defaultValue="" mandatory="false" group="WCS">
232
            <description></description>
233
            <tags>
234
                    <value name="dynform.height" value="300" />
235
                    <value name="ViewMode" value="SimpleTable" />
236
                    <value name="dynform.label.empty" value="true" />
237
            </tags>
238
        </field>
239

  
240
        <field name="wfsUrls" label="WFS URLs" type="List" subtype="DynObject" typeOfItems="DynObject" classOfItems="ServerURL" defaultValue="" mandatory="false" group="WFS">
241
            <description></description>
242
            <tags>
243
                    <value name="dynform.height" value="300" />
244
                    <value name="ViewMode" value="SimpleTable" />
245
                    <value name="dynform.label.empty" value="true" />
246
            </tags>
247
        </field>
248

  
249
        <field name="theme" type="DynObject" classOfValue="ThemeConfiguration" defaultValue="" mandatory="false" group="Theme">
250
          <description></description>
251
            <tags>
252
                    <value name="dynform.label.empty" value="true" />
253
            </tags>
254
        </field>
255

  
256
        <field name="scriptActions" type="List" subtype="DynObject" typeOfItems="DynObject" classOfItems="ScriptAction"
257
                mandatory="false" defaultValue="" group="Script actions">
258
                <description></description>
259
                <tags>
260
                        <value name="dynform.label.empty" value="true" />
261
                        <value name="dynform.border.empty" value="true" />
262
                        <value name="allowNew" value="true" />
263
                        <value name="allowDelete" value="true" />
264
                        <value name="allowUpdate" value="true" />
265
                        <value name="allowSearch" value="false" />
266
                        <value name="allowClose" value="false" />
267
                </tags>
268
        </field>
269

  
270
        <field name="viewTocActions" type="List" subtype="DynObject" typeOfItems="DynObject" classOfItems="ViewTocAction"
271
                mandatory="false" defaultValue="" group="View TOC actions">
272
                <description></description>
273
                <tags>
274
                        <value name="dynform.label.empty" value="true" />
275
                        <value name="dynform.border.empty" value="true" />
276
                        <value name="allowNew" value="true" />
277
                        <value name="allowDelete" value="true" />
278
                        <value name="allowUpdate" value="true" />
279
                        <value name="allowSearch" value="false" />
280
                        <value name="allowClose" value="false" />
281
                </tags>
282
        </field>
283

  
284
        <field name="toolActions" type="List" subtype="DynObject" typeOfItems="DynObject" classOfItems="ToolAction"
285
                mandatory="false" defaultValue="" group="Tool actions">
286
                <description></description>
287
                <tags>
288
                        <value name="dynform.label.empty" value="true" />
289
                        <value name="dynform.border.empty" value="true" />
290
                        <value name="allowNew" value="true" />
291
                        <value name="allowDelete" value="true" />
292
                        <value name="allowUpdate" value="true" />
293
                        <value name="allowSearch" value="false" />
294
                        <value name="allowClose" value="false" />
295
                </tags>
296
        </field>
297

  
298
        <field name="menuActions" type="List" subtype="DynObject" typeOfItems="DynObject" classOfItems="MenuAction"
299
                mandatory="false" defaultValue="" group="Menu actions">
300
                <description></description>
301
                <tags>
302
                        <value name="dynform.label.empty" value="true" />
303
                        <value name="dynform.border.empty" value="true" />
304
                        <value name="dynform.action.new" value="true" />
305
                        <value name="allowNew" value="true" />
306
                        <value name="allowDelete" value="true" />
307
                        <value name="allowUpdate" value="true" />
308
                        <value name="allowSearch" value="false" />
309
                        <value name="allowClose" value="false" />
310
                </tags>
311
        </field>
312

  
313
      </fields>
314
    </class>
315
  </classes>
316
</definitions>  
tags/org.gvsig.customize.app-1.2.4/org.gvsig.customize.app.mainplugin/src/main/resources-plugin/config.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<plugin-config>
3
    <libraries library-dir="lib/"/>
4
    <depends plugin-name="org.gvsig.app.mainplugin"/>
5
    <resourceBundle name="text"/>
6
    <extensions>
7

  
8
        <extension class-name="org.gvsig.customize.CustomizeExtension" active="true">
9

  
10
            <action 
11
                name="tools-customize-create-distribution" 
12
                label="_Create_distribution"
13
                tooltip="_Create_distribution" 
14
                action-command="tools-customize-create-distribution"
15
                icon="tools-customize-create-distribution" 
16
                position="900400050" 
17
                accelerator="" 
18
            />
19
            <action 
20
                name="tools-customize-edit-configuration" 
21
                label="_Edit_configuration"
22
                tooltip="_Edit_configuration" 
23
                action-command="tools-customize-edit-configuration"
24
                icon="tools-customize-edit-configuration" 
25
                position="900400060" 
26
                accelerator="" 
27
            />
28
            <menu
29
                name="tools-customize-edit-configuration" 
30
                text="tools/Customize/_Edit_configuration"
31
            />
32
            <menu
33
                name="tools-customize-create-distribution" 
34
                text="tools/Customize/_Create_distribution"
35
            />
36
        </extension>  
37
    </extensions>
38
</plugin-config>
39

  
tags/org.gvsig.customize.app-1.2.4/org.gvsig.customize.app.mainplugin/src/main/assembly/gvsig-plugin-package.xml
1
<!--
2

  
3
    gvSIG. Desktop Geographic Information System.
4

  
5
    Copyright (C) 2007-2013 gvSIG Association.
6

  
7
    This program is free software; you can redistribute it and/or
8
    modify it under the terms of the GNU General Public License
9
    as published by the Free Software Foundation; either version 3
10
    of the License, or (at your option) any later version.
11

  
12
    This program is distributed in the hope that it will be useful,
13
    but WITHOUT ANY WARRANTY; without even the implied warranty of
14
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
    GNU General Public License for more details.
16

  
17
    You should have received a copy of the GNU General Public License
18
    along with this program; if not, write to the Free Software
19
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20
    MA  02110-1301, USA.
21

  
22
    For any additional information, do not hesitate to contact us
23
    at info AT gvsig.com, or visit our website www.gvsig.com.
24

  
25
-->
26
<assembly>
27
  <id>gvsig-plugin-package</id>
28
  <formats>
29
    <format>zip</format>
30
  </formats>
31
  <baseDirectory>${project.artifactId}</baseDirectory>
32
  <includeBaseDirectory>true</includeBaseDirectory>
33
  <files>
34
    <file>
35
      <source>target/${project.artifactId}-${project.version}.jar</source>
36
      <outputDirectory>lib</outputDirectory>
37
    </file>
38
    <file>
39
      <source>target/package.info</source>
40
    </file>
41
  </files>
42

  
43
  <fileSets>
44
    <fileSet>
45
      <directory>src/main/resources-plugin</directory>
46
      <outputDirectory>.</outputDirectory>
47
    </fileSet>
48
  </fileSets>
49
  
50

  
51
<!--
52
    Si le quito los comentarios y dejo la seccion includes vacia, me incluye
53
    si o si, todas depedencias, como si no hiciese caso del parametro 
54
    useTransitiveDependencies
55
  <dependencySets>
56
    <dependencySet>
57
      <useProjectArtifact>false</useProjectArtifact>
58
      <useTransitiveDependencies>false</useTransitiveDependencies>
59
      <outputDirectory>lib</outputDirectory>
60
      <includes>
61
      </includes>
62
    </dependencySet>
63
  </dependencySets>
64
-->
65

  
66
</assembly>
67

  
tags/org.gvsig.customize.app-1.2.4/org.gvsig.customize.app.mainplugin/src/main/java/org/gvsig/customize/CustomizeTask.java
1
package org.gvsig.customize;
2

  
3
import java.io.File;
4
import java.io.IOException;
5
import java.util.ArrayList;
6
import java.util.Date;
7
import java.util.HashSet;
8
import java.util.Iterator;
9
import java.util.List;
10
import java.util.Locale;
11
import java.util.Set;
12
import java.util.logging.Level;
13
import java.util.regex.Matcher;
14
import java.util.regex.Pattern;
15
import javax.swing.JComponent;
16
import javax.swing.JOptionPane;
17
import javax.swing.SwingUtilities;
18
import org.apache.commons.io.FileUtils;
19
import org.apache.commons.lang.BooleanUtils;
20
import org.apache.commons.lang3.LocaleUtils;
21
import org.apache.commons.lang3.StringUtils;
22
import org.cresques.cts.IProjection;
23
import org.gvsig.andami.LocaleManager;
24
import org.gvsig.andami.PluginServices;
25
import org.gvsig.andami.PluginsLocator;
26
import org.gvsig.andami.PluginsManager;
27
import org.gvsig.andami.actioninfo.ActionInfo;
28
import org.gvsig.andami.actioninfo.ActionInfoManager;
29
import org.gvsig.andami.firewall.FirewallConfiguration;
30
import org.gvsig.andami.persistence.serverData.ServerDataPersistence;
31
import org.gvsig.andami.ui.mdiFrame.MainFrame;
32
import org.gvsig.app.ApplicationLocator;
33
import org.gvsig.app.ApplicationManager;
34
import org.gvsig.app.project.ProjectManager;
35
import org.gvsig.app.project.ProjectPreferences;
36
import org.gvsig.app.project.documents.view.ViewManager;
37
import org.gvsig.installer.lib.api.InstallerLocator;
38
import org.gvsig.installer.lib.api.InstallerManager;
39
import org.gvsig.installer.lib.api.PackageInfo;
40
import org.gvsig.installer.lib.api.execution.InstallPackageService;
41
import org.gvsig.tools.ToolsLocator;
42
import org.gvsig.tools.dynobject.DynObject;
43
import org.gvsig.tools.i18n.I18nManager;
44
import org.gvsig.tools.observer.ObservableHelper;
45
import org.gvsig.tools.packageutils.PackageManager;
46
import org.gvsig.tools.swing.api.ToolsSwingLocator;
47
import org.gvsig.tools.swing.api.windowmanager.WindowManager;
48
import org.gvsig.tools.task.SimpleTaskStatus;
49
import org.gvsig.tools.task.impl.BaseTaskStatus;
50
import org.gvsig.utils.swing.jcomboServer.ServerData;
51
import org.slf4j.Logger;
52
import org.slf4j.LoggerFactory;
53

  
54
public class CustomizeTask implements Runnable {
55

  
56
    private final static Logger logger = LoggerFactory.getLogger(CustomizeExtension.class);
57

  
58
    private static final String PROXY_SECTION = "httpproxy";
59
    private static final String CRS_SECTION = "crs";
60
    private static final String THEME_SECTION = "theme";
61

  
62
    private int errorCount = 0;
63
    private DynObject pluginProperties = null;
64
    private Class scriptingExtension = null;
65
    private PluginServices plugin = null;
66

  
67
    public CustomizeTask() {
68
    }
69

  
70
    private void showWindow(final JComponent component, final String title, final WindowManager.MODE mode) {
71
        if (!SwingUtilities.isEventDispatchThread()) {
72
            SwingUtilities.invokeLater(new Runnable() {
73
                @Override
74
                public void run() {
75
                    showWindow(component, title, mode);
76
                }
77
            });
78
            try {
79
                Thread.sleep(10);
80
            } catch (InterruptedException ex) {
81
                // Do nothing
82
            }
83
            return;
84
        }
85
        ToolsSwingLocator.getWindowManager().showWindow(
86
                component,
87
                title,
88
                mode
89
        );
90
    }
91

  
92
    private static class MyServerData {
93

  
94
        private final ServerDataPersistence serversDataPersistence;
95

  
96
        public MyServerData(ServerDataPersistence serversDataPersistence) {
97
            this.serversDataPersistence = serversDataPersistence;
98
        }
99

  
100
        public List<ServerData> getServerData() {
101
            return this.serversDataPersistence.getServerData();
102
        }
103

  
104
        public void remove(String serverAddress) {
105
            if (StringUtils.isBlank(serverAddress)) {
106
                return;
107
            }
108
            Iterator<ServerData> it = getServerData().iterator();
109
            while (it.hasNext()) {
110
                ServerData x = it.next();
111
                if (serverAddress.equalsIgnoreCase(x.getServerAddress())) {
112
                    it.remove();
113
                    return;
114
                }
115
            }
116
        }
117

  
118
        public void add(String server, String protocol) {
119
            if (StringUtils.isBlank(server)) {
120
                return;
121
            }
122
            this.add(new ServerData(server, protocol));
123
        }
124

  
125
        public void add(ServerData server) {
126
            String address = server.getServerAddress().trim();
127
            for (int i = 0; i < getServerData().size(); i++) {
128
                ServerData sd = getServerData().get(i);
129
                if (sd.getServerAddress().trim().equals(address)) {
130
                    getServerData().set(i, server);
131
                    return;
132
                }
133
            }
134
            getServerData().add(server);
135
        }
136

  
137
        public boolean contains(String serverAddress) {
138
            if (StringUtils.isBlank(serverAddress)) {
139
                return false;
140
            }
141
            serverAddress = serverAddress.trim();
142
            for (int i = 0; i < getServerData().size(); i++) {
143
                String address = getServerData().get(i).getServerAddress().trim();
144
                if (serverAddress.equalsIgnoreCase(address)) {
145
                    return true;
146
                }
147
            }
148
            return false;
149
        }
150
    }
151

  
152
    private PluginServices getPlugin() {
153
        if (this.plugin == null) {
154
            PluginsManager pluginsManager = PluginsLocator.getManager();
155
            this.plugin = pluginsManager.getPlugin(this);
156
        }
157
        return this.plugin;
158
    }
159

  
160
    protected PluginServices getPlugin(String name) {
161
        PluginsManager pluginsManager = PluginsLocator.getManager();
162
        return pluginsManager.getPlugin(name);
163
    }
164

  
165
    private Class getScriptingExtension() {
166
        if (this.scriptingExtension == null) {
167
            try {
168
                this.scriptingExtension = Class.forName("org.gvsig.scripting.app.extension.ScriptingExtension");
169
            } catch (Throwable ex) {
170
                return null;
171
            }
172
        }
173
        return this.scriptingExtension;
174
    }
175

  
176
    protected void errors_add(String message, Throwable th) {
177
        errorCount++;
178
        logger.warn(message, th);
179
    }
180

  
181
    protected int errors_count() {
182
        return errorCount;
183
    }
184

  
185
    protected void errors_reset() {
186
        this.errorCount = 0;
187
    }
188

  
189
    protected DynObject getPluginProperties() {
190
        if (this.pluginProperties == null) {
191
            this.pluginProperties = this.getPlugin().getPluginProperties();
192
        }
193
        return this.pluginProperties;
194
    }
195

  
196
    protected void setProperty(String name, Object value) {
197
        this.getPluginProperties().setDynValue(name, value);
198
    }
199

  
200
    protected Object getProperty(String name) {
201
        return this.getPluginProperties().getDynValue(name);
202
    }
203

  
204
    protected String getPropertyString(String name) {
205
        return (String) this.getProperty(name);
206
    }
207

  
208
    protected int getPropertyInt(String name) {
209
        return ((Integer) this.getProperty(name)).intValue();
210
    }
211

  
212
    protected boolean getPropertyBoolean(String name) {
213
        return ((Boolean) this.getProperty(name)).booleanValue();
214
    }
215

  
216
    protected void setValue(DynObject config, String section, String option, String value) {
217
        Object subconfig = config.getDynValue(section);
218
        if (subconfig instanceof DynObject) {
219
            ((DynObject) subconfig).setDynValue(option, value);
220
        } else {
221
            config.setDynValue(option, value);
222
        }
223
    }
224

  
225
    protected String getValue(DynObject config, String section, String option, String defaultValue) {
226
        String value = null;
227
        Object subconfig = null;
228
        if (!StringUtils.isBlank(section)) {
229
            subconfig = config.getDynValue(section);
230
        }
231
        if (subconfig instanceof DynObject) {
232
            Object v = ((DynObject) subconfig).getDynValue(option);
233
            if (v != null) {
234
                value = v.toString();
235
            }
236
        } else {
237
            Object v = config.getDynValue(option);
238
            if (v != null) {
239
                value = v.toString();
240
            }
241
        }
242
        if (StringUtils.isBlank(value)) {
243
            return defaultValue;
244
        }
245
        if (THEME_SECTION.equalsIgnoreCase(section)) {
246
            return value;
247
        }
248
        if (value.contains("${")) {
249
            value = expand(config, section, value);
250
        }
251
        return value;
252
    }
253
    private static final Pattern VARIABLE = Pattern.compile("[$][{]([a-zA-Z0-9_/]+)[}]");
254

  
255
    private String expand(DynObject config, String section, String s) {
256
        String s2 = s;
257
        String v = null;
258
        Matcher m = VARIABLE.matcher(s);
259
        while (m.find()) {
260
            String name = m.group(1);
261
            String[] ss = name.split("/");
262
            switch (ss.length) {
263
                case 2:
264
                    v = getValue(config, ss[0], ss[1], "");
265
                    break;
266
                case 1:
267
                    v = getValue(config, section, ss[0], "");
268
                    break;
269
                default:
270
                    v = name;
271
            }
272
            s2 = m.replaceFirst(v);
273
            m = VARIABLE.matcher(s2);
274
        }
275

  
276
        return s2;
277
    }
278

  
279
    private void configureLocale(DynObject config) {
280
        if (!BooleanUtils.isTrue((Boolean) getProperty("configureLocale"))) {
281
            return;
282
        }
283
        try {
284
            LocaleManager localeManager = PluginsLocator.getLocaleManager();
285
            String localeCode = getValue(config, null, "default_locale", null);
286
            if( localeCode != null ) {
287
                Locale locale = LocaleUtils.toLocale(localeCode);
288
                localeManager.setCurrentLocale(locale);
289

  
290
                logger.info("Set default locale to '" + localeCode + "'.");
291
                setProperty("configureLocale", Boolean.FALSE);
292
            }
293
        } catch (Exception ex) {
294
            errors_add("Can't apply locale configuration.", ex);
295
        }
296
    }
297

  
298
    private void configureHttpproxy(DynObject config) {
299
        if (!BooleanUtils.isTrue((Boolean) getProperty("configureHTTPPproxy"))) {
300
            return;
301
        }
302
        try {
303
            FirewallConfiguration conf = getFirewallConfiguration();
304
            String host = getValue(config, "httpproxy", "host", "");
305
            String port = getValue(config, "httpproxy", "port", "");
306
            String nonProxyHosts = getValue(config, "httpproxy", "nonProxyHosts", "");
307
            String userName = getValue(config, "httpproxy", "username", "");
308
            String password = getValue(config, "httpproxy", "password", "");
309
            String enabled = getValue(config, "httpproxy", "enabled", "false");
310
            conf.setHost(host, port);
311
            conf.setNonProxyHosts(nonProxyHosts);
312
            if (!StringUtils.isBlank(userName)) {
313
                conf.setUserName(userName);
314
            }
315
            if (!StringUtils.isBlank(password)) {
316
                conf.setPassword(password);
317
            }
318
            conf.setEnabled(BooleanUtils.toBoolean(enabled));
319
            conf.apply();
320
            logger.info("Set httpproxy host:port to '" + host + ":" + port + "', enabled " + BooleanUtils.toBoolean(enabled) + ".");
321
            setProperty("configureHTTPPproxy", Boolean.FALSE);
322
        } catch (Exception ex) {
323
            errors_add("Can't apply proxy configuration.", ex);
324
        }
325
    }
326

  
327
    private FirewallConfiguration getFirewallConfiguration() {
328
        FirewallConfiguration conf = (FirewallConfiguration) ToolsLocator.getInstance().get(ToolsLocator.FIREWALL_MANAGER_NAME);
329
//        FirewallConfiguration conf = PluginsLocator.getManager().getFirewallConfiguration();
330
        return conf;
331
    }
332

  
333
    private boolean configureHttpproxyUser(DynObject config) {
334
        try {
335
            FirewallConfiguration conf = getFirewallConfiguration();
336
            String userName = conf.getUserName();
337
            String password = conf.getPassword();
338

  
339
            HttpProxyLoginDialog dialog = new HttpProxyLoginDialog();
340
            if (StringUtils.isBlank(userName)) {
341
                userName = getValue(config, "httpproxy", "username", "");
342
            }
343
            if (StringUtils.isBlank(password)) {
344
                password = getValue(config, "httpproxy", "password", "");
345
            }
346

  
347
            dialog.setUserName(userName);
348
            dialog.setPassword(password);
349
            if (dialog.login()) {
350
                conf.setUserName(dialog.getUserName());
351
                conf.setPassword(dialog.getPassword());
352
                conf.setEnabled(true);
353
                conf.apply();
354
            } else {
355
                conf.setUserName(dialog.getUserName());
356
                conf.setPassword("");
357
                conf.setEnabled(false);
358
                conf.apply();
359
            }
360
            logger.info("Set httpproxy user to '" + conf.getUserName() + "'.");
361
            logger.info("Set httpproxy password.");
362
            // Set values in config to allow variable sustitution
363
            setValue(config, "httpproxy", "username", conf.getUserName());
364
            setValue(config, "httpproxy", "password", conf.getPassword());
365
            return true;
366
        } catch (Exception ex) {
367
            errors_add("Can't apply username/password proxy configuration.", ex);
368
            return false;
369
        }
370
    }
371

  
372
    private void configureCRS(DynObject config) {
373
        if (!BooleanUtils.isTrue((Boolean) getProperty("configureProjection"))) {
374
            return;
375
        }
376
        try {
377
            ProjectManager projectManager = ApplicationLocator.getProjectManager();
378
            ProjectPreferences projectPreferences = projectManager.getProjectPreferences();
379
            DynObject crsOptions = (DynObject) config.getDynValue("CRS");
380
            IProjection proj = (IProjection) crsOptions.getDynValue("default_projection");
381
            projectPreferences.setDefaultProjection(proj.getFullCode());
382
            logger.info("Set default projection to '" + proj.getFullCode() + "'.");
383
            setProperty("configureProjection", Boolean.FALSE);
384
        } catch (Exception ex) {
385
            errors_add("Can't apply CRS configuration.", ex);
386
        }
387
    }
388

  
389
    private void configureServers(String protocol, String pluginName, List<DynObject> servers) {
390
        if (!getPropertyBoolean("configureOGCServers_" + protocol)) {
391
            return;
392
        }
393
        if( servers==null ) {
394
            logger.info("No servers specifieds for protocol "+protocol+".");
395
            return;
396
        }
397
        if (pluginName == null) {
398
            logger.info("Skip '" + pluginName + "' servers configurations..");
399
            return;
400
        }
401
        PluginServices plugin = getPlugin(pluginName);
402
        if (plugin == null) {
403
            logger.info("Skip '" + pluginName + "' servers configurations. Plugin not installed.");
404
            return;
405
        }
406
        ServerDataPersistence serversDataPersistence = (ServerDataPersistence) plugin.getPluginProperties().getDynValue("Servers");
407
        if (serversDataPersistence == null) {
408
            serversDataPersistence = new ServerDataPersistence(protocol);
409
            plugin.getPluginProperties().setDynValue("Servers", serversDataPersistence);
410
        }
411
        MyServerData serversData = new MyServerData(serversDataPersistence);
412
        
413
        for (int i = 0; i < servers.size(); i++) {
414
            String server = (String) servers.get(i).getDynValue("url");
415
            boolean remove = BooleanUtils.isTrue((Boolean) servers.get(i).getDynValue("remove"));
416
            if (remove) {
417
                serversData.remove(server);
418
                logger.info("Remove '" + protocol + "' server '" + server + "'.");
419
            } else {
420
                if (!serversData.contains(server)) {
421
                    serversData.add(server, protocol);
422
                    logger.info("Insert '" + protocol + "' server '" + server + "'.");
423
                }
424
            }
425
        }
426
        plugin.savePluginProperties();
427
        logger.info("Save properties of plugin '" + pluginName + "'.");
428
        setProperty("configureOGCServers_" + protocol, Boolean.FALSE);
429

  
430
    }
431

  
432
    private void createActionsScripts(DynObject config) {
433
        List<DynObject> scriptActions = (List<DynObject>) config.getDynValue("scriptActions");
434
        if (scriptActions == null) {
435
            return;
436
        }
437
        ActionInfoManager actionManager = PluginsLocator.getActionInfoManager();
438

  
439
        for (int i = 0; i < scriptActions.size(); i++) {
440
            DynObject scriptAction = scriptActions.get(i);
441
            String name = (String) scriptAction.getDynValue("name");
442
            ActionInfo action = actionManager.getAction(name);
443
            if (action == null) {
444
                String script = (String) scriptAction.getDynValue("script");
445
                String label = (String) scriptAction.getDynValue("label");
446
                String icon = (String) scriptAction.getDynValue("icon");
447
                long position = ((Long) (scriptAction.getDynValue("position"))).longValue();
448
                String tip = (String) scriptAction.getDynValue("tip");
449
                createActionScript(name, script, label, icon, position, tip);
450
            } else {
451
                logger.info("Can't create action script, action '" + name + "' already defined.");
452
            }
453
        }
454
    }
455

  
456
    private void addTOCActions(DynObject config) {
457
        List<DynObject> viewTOCActions = (List<DynObject>) config.getDynValue("viewTocActions");
458
        if (viewTOCActions == null) {
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff