Revision 37750

View differences:

tags/v2_0_0_Build_2043/extensions/org.gvsig.installer/prepare-workspace.xml
1
<project name="org.gvsig.initial.build" default="prepare-workspace">
2

  
3
	<dirname property="org.gvsig.initial.build.basedir" file="${ant.file.org.gvsig.initial.build}" />
4

  
5
	<property name="workspace.basedir" value="${org.gvsig.initial.build.basedir}/.." />
6
	<property name="build.basedir" value="${workspace.basedir}/org.gvsig.maven.base.build" description="Eclipse workspace location" />
7
	<property name="build.jar.version" value="1.0.8-SNAPSHOT" />
8
	<property name="build.jar.file" value="org.gvsig.maven.base.build-${build.jar.version}.jar" />
9

  
10
	<property name="ant.libs.dir" location="${build.basedir}" description="Additional ant tasks libs folder" />
11

  
12
	<target name="check-maven-base-build-available">
13
		<available file="${user.home}/.m2/repository/org/gvsig/org.gvsig.maven.base.build/${build.jar.version}/${build.jar.file}" property="maven-base-build-available" />
14
	</target>
15

  
16
	<target name="get-maven-base-build-local" depends="check-maven-base-build-available" if="maven-base-build-available">
17
		<!-- Unzip de build jar file from the maven repository into the workspace root folder -->
18
		<copy todir="${workspace.basedir}" preservelastmodified="false" filtering="false">
19
			<zipfileset src="${user.home}/.m2/repository/org/gvsig/org.gvsig.maven.base.build/${build.jar.version}/${build.jar.file}">
20
				<patternset>
21
					<exclude name="META-INF/**" />
22
				</patternset>
23
			</zipfileset>
24
		</copy>
25
	</target>
26

  
27
	<target name="get-maven-base-build-remote" depends="check-maven-base-build-available" unless="maven-base-build-available">
28
		<mkdir dir="target" />
29

  
30
		<!-- Download the build jar file -->
31
		<get src="http://devel.gvsig.org/m2repo/j2se/org/gvsig/org.gvsig.maven.base.build/${build.jar.version}/${build.jar.file}" dest="target/${build.jar.file}" verbose="true" />
32

  
33
		<!-- Unzip de build jar file into the workspace root folder -->
34
		<copy todir="${workspace.basedir}" preservelastmodified="false" filtering="false">
35
			<zipfileset src="target/${build.jar.file}">
36
				<patternset>
37
					<exclude name="META-INF/**" />
38
				</patternset>
39
			</zipfileset>
40
		</copy>
41

  
42
	</target>
43
	
44
	<target name="find.depends.natives.file">
45
	    <condition property="depends.natives.file.exists">
46
            <available file="${org.gvsig.initial.build.basedir}/DEPENDS_ON_NATIVE_LIBRARIES"/>
47
	    </condition>	
48
	</target>
49
	
50
	<target name="find.gvsig.platform.properties.file" 
51
			depends="find.depends.natives.file"
52
			if="depends.natives.file.exists">
53
	    <condition property="gvsig.platform.exists">
54
            <available file="${user.home}/.gvsig.platform.properties"/>
55
	    </condition>	
56
	</target>
57
	
58
	<target name="check.gvsig.platform.properties" 
59
			depends="find.gvsig.platform.properties.file">
60
		<fail if="depends.natives.file.exists" unless="gvsig.platform.exists">
61
ERROR!!
62
	
63
You have to define your gvSIG platform properties, 
64
by creating the file: ${user.home}/.gvsig.platform.properties
65
with the following content:
66

  
67
native_platform=linux
68
native_distribution=all
69
native_compiler=gcc4
70
native_arch=i386
71
native_libraryType=dynamic
72
export native_classifier=${native_platform}-${native_distribution}-${native_compiler}-${native_arch}-${native_libraryType}
73

  
74
Replace the fifth initial variables values with the ones appropiate 
75
to your platform.
76
	
77
If you use maven in the command line, you can use the previous file also
78
to define the MAVEN_OPTS environment variable, by adding to your 
79
.bash_rc file something like this:
80

  
81
if [ -f "${HOME}/.gvsig.platform.properties" ]
82
then
83
    . ${HOME}/.gvsig.platform.properties
84
    export MAVEN_OPTS="-Xmx256M -XX:MaxPermSize=64m -Dnative-classifier=${native_classifier}"
85
else
86
    export MAVEN_OPTS="-Xmx256M -XX:MaxPermSize=64m"
87
fi
88

  
89
It will work if you use the bash shell. In any other case or platform, you'll
90
have to define your MAVEN_OPTS environment variable and set the 
91
"native-classifier" parameter directly.
92
		</fail>			
93
	
94
	</target>
95

  
96
	<target name="prepare-workspace" depends="get-maven-base-build-local,get-maven-base-build-remote,check.gvsig.platform.properties">
97

  
98
		<mkdir dir="target" />
99

  
100
		<chmod dir="${build.basedir}/maven/bin" perm="u+x" includes="m2,mvn,mvnDebug" />
101

  
102
		<!-- Copy the maven launchers to the workspace metadata folder -->
103
		<copy todir="${workspace.basedir}/.metadata">
104
			<fileset dir="${build.basedir}/eclipse-launchers">
105
				<exclude name="**/org.eclipse.jdt.core.prefs" />
106
				<exclude name="**/org.eclipse.core.variables.prefs" />
107
			</fileset>
108
		</copy>
109

  
110
		<concat destfile="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs" append="true">
111
			<filelist dir="${build.basedir}/eclipse-launchers/.plugins/org.eclipse.core.runtime/.settings" files="org.eclipse.jdt.core.prefs" />
112
		</concat>
113
		<concat destfile="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.variables.prefs" append="true">
114
			<filelist dir="${build.basedir}/eclipse-launchers/.plugins/org.eclipse.core.runtime/.settings" files="org.eclipse.core.variables.prefs" />
115
		</concat>
116

  
117
		<!-- Configure the eclipse workspace -->
118
		<ant antfile="${build.basedir}/maven-goals.xml" target="mvn-configure-eclipse-workspace" />
119

  
120
		<!-- Configure the gvSIG profile -->
121
		<ant antfile="${build.basedir}/check-gvsig-profile.xml" />
122

  
123
		<property name="user-settings-file-location" value="${user.home}/.m2/settings.xml" />
124

  
125
		<taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask">
126
			<classpath>
127
				<pathelement location="${ant.libs.dir}/com.oopsconsultancy.xmltask-1.16.1.jar" />
128
			</classpath>
129
		</taskdef>
130

  
131
		<xmltask source="${user-settings-file-location}" dest="${user-settings-file-location}">
132
			<copy path="//:settings/:profiles/:profile[:id/text() = 'gvsig-install']/:properties/:gvsig.install.dir/text()" property="current-gvsig-location" />
133
		</xmltask>
134

  
135
		<replace file="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs" token="@GVSIG_HOME@" value="${current-gvsig-location}" />
136
		<replace file="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.variables.prefs" token="@GVSIG_HOME@" value="${current-gvsig-location}" />
137

  
138
		<!-- Compile, install and generate eclipse projects -->
139
		<ant antfile="${build.basedir}/maven-goals.xml" target="mvn-install-and-eclipse-eclipse" />
140

  
141
		<echo>INFORMATION!!!</echo>
142
		<echo>Restart eclipse and then proceed to import the subprojects contained into the main project</echo>
143

  
144
		<!-- TODO: copiar al proyecto de configuración general -->
145
	</target>
146

  
147
	<target name="clean">
148
		<delete dir="target" />
149
	</target>
150
	
151
</project>
0 152

  
tags/v2_0_0_Build_2043/extensions/org.gvsig.installer/pom.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<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">
3
    <modelVersion>4.0.0</modelVersion>
4
    <artifactId>org.gvsig.installer</artifactId>
5
    <packaging>pom</packaging>
6
    <version>1.0.1-SNAPSHOT</version>
7
    <name>org.gvsig.installer</name>
8
    <description>Project to create installers or install packages in gvSIG</description>
9
    <parent>
10
        <groupId>org.gvsig</groupId>
11
        <artifactId>org.gvsig.maven.base.pom</artifactId>
12
        <version>1.0.8-SNAPSHOT</version>
13
    </parent>
14

  
15
    <scm>
16
        <connection>scm:svn:https://devel.gvsig.org/svn/gvsig-desktop/branches/v2_0_0_prep/extensions/org.gvsig.installer</connection>
17
        <developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-desktop/branches/v2_0_0_prep/extensions/org.gvsig.installer</developerConnection>
18
        <url>https://devel.gvsig.org/redmine/projects/gvsig-desktop/repository/show/branches/v2_0_0_prep/extensions/org.gvsig.installer</url>
19
    </scm>
20

  
21
    <developers>
22
        <developer>
23
            <id>jjdelcerro</id>
24
            <name>Joaquín José del Cerro</name>
25
            <email>jjdelcerro@gvsig.org</email>
26
            <roles>
27
                <role>Architect</role>
28
            </roles>
29
        </developer>
30
        <developer>
31
            <id>jpiera</id>
32
            <name>Jorge Piera Llodrá</name>
33
            <email>jpiera@gvsig.org</email>
34
            <roles>
35
                <role>Architect</role>
36
                <role>Developer</role>
37
            </roles>
38
        </developer>
39
        <developer>
40
            <id>cordinyana</id>
41
            <name>Cèsar Ordiñana</name>
42
            <email>cordinyana@disid.com</email>
43
            <roles>
44
                <role>Architect</role>
45
                <role>Developer</role>
46
            </roles>
47
        </developer>
48
    </developers>
49
    <repositories>
50
        <repository>
51
            <id>gvsig-public-http-repository</id>
52
            <name>gvSIG maven public HTTP repository</name>
53
            <url>http://devel.gvsig.org/m2repo/j2se</url>
54
            <releases>
55
                <enabled>true</enabled>
56
                <updatePolicy>daily</updatePolicy>
57
                <checksumPolicy>warn</checksumPolicy>
58
            </releases>
59
            <snapshots>
60
                <enabled>true</enabled>
61
                <updatePolicy>daily</updatePolicy>
62
                <checksumPolicy>warn</checksumPolicy>
63
            </snapshots>
64
        </repository>
65
    </repositories>
66
    <dependencyManagement>
67
        <dependencies>
68
            <dependency>
69
                <groupId>org.gvsig</groupId>
70
                <artifactId>org.gvsig.core.maven.dependencies</artifactId>
71
                <version>2.0.1-SNAPSHOT</version>
72
                <type>pom</type>
73
                <scope>import</scope>
74
            </dependency>
75
        </dependencies>
76
    </dependencyManagement>
77
    <build>
78
        <plugins>
79
            <!-- TODO: MAKE TESTS WORK AND REMOVE THIS OPTION -->
80
            <plugin>
81
                <groupId>org.apache.maven.plugins</groupId>
82
                <artifactId>maven-surefire-plugin</artifactId>
83
                <configuration>
84
                    <skipTests>true</skipTests>
85
                </configuration>
86
            </plugin>
87
        </plugins>
88
    </build>
89
    <profiles>
90
        <profile>
91
            <id>gvsig-install</id>
92
            <activation>
93
                <activeByDefault>true</activeByDefault>
94
            </activation>
95
            <properties>
96
                <!-- gvSIG installation folder -->
97
                <gvsig.install.dir>${basedir}/../build/product
98
                </gvsig.install.dir>
99
            </properties>
100
        </profile>
101
    </profiles>
102
    <modules>
103
        <module>org.gvsig.installer.lib</module>
104
        <module>org.gvsig.installer.prov</module>
105
        <module>org.gvsig.installer.swing</module>
106
        <module>org.gvsig.installer.main</module>
107
        <module>org.gvsig.installer.maven</module>
108
    </modules>
109
</project>
0 110

  
tags/v2_0_0_Build_2043/extensions/org.gvsig.installer/README.txt
1
The first time you checkout the current project to a new workspace, 
2
you have to prepare it to be able to work easily with maven from
3
eclipse itself.
4

  
5
Perform the following steps:
6

  
7
1.- Launch the *prepare-workspace.xml* ant build file. 
8
    You can do it by loading the file into the ant view, 
9
    and running the default task, or right-clicking the 
10
    file from the package explorer or the navigator and
11
    select the option: *Run as > Ant build*. 
12
    
13
2.- Restart eclipse.
14

  
15
3.- Import the subprojects of the project you have just checked out.
16

  
17
Those steps are only needed once per workspace.     
18

  
0 19

  
tags/v2_0_0_Build_2043/extensions/org.gvsig.installer/.project
1
<?xml version="1.0" encoding="UTF-8"?>
2
<projectDescription>
3
	<name>org.gvsig.installer</name>
4
	<comment></comment>
5
	<projects>
6
	</projects>
7
	<buildSpec>
8
	</buildSpec>
9
	<natures>
10
	</natures>
11
</projectDescription>
tags/v2_0_0_Build_2043/extensions/org.gvsig.installer/org.gvsig.installer.main/org.gvsig.plugin2
1
#
2
#Wed Apr 28 12:22:40 CEST 2010
3
version=1.0.0
4
oficial=true
5
name=myplugin
6
type=plugin
7
description=Test
8
code=org.gvsig.myplugin2
9
state=RC1
10
build=1
tags/v2_0_0_Build_2043/extensions/org.gvsig.installer/org.gvsig.installer.main/org.gvsig.plugin3
1
#
2
#Wed Apr 28 12:10:48 CEST 2010
3
version=1.0.0
4
oficial=false
5
name=myplugin
6
type=plugin
7
description=Test
8
code=org.gvsig.plugin3
9
state=RC1
10
build=1
tags/v2_0_0_Build_2043/extensions/org.gvsig.installer/org.gvsig.installer.main/src/main/java/org/gvsig/installer/main/utils/CreateBundleLauncher.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22

  
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2010 {Prodevelop}   {Task}
26
 */
27

  
28
package org.gvsig.installer.main.utils;
29

  
30
/**
31
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
32
 */
33
public class CreateBundleLauncher {
34

  
35
    public static void main(String[] args) {
36
        new CreateBundleLauncher();
37
    }
38

  
39
    public CreateBundleLauncher() {
40
        super();
41
        CreateBoundleFrame createBoundleFrame = new CreateBoundleFrame();
42
        createBoundleFrame.setBounds(0, 0, 500, 150);
43
        createBoundleFrame.setVisible(true);
44
    }
45

  
46
}
0 47

  
tags/v2_0_0_Build_2043/extensions/org.gvsig.installer/org.gvsig.installer.main/src/main/java/org/gvsig/installer/main/utils/FrameWizardListener.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22

  
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2010 {Prodevelop}   {Task}
26
 */
27

  
28
package org.gvsig.installer.main.utils;
29

  
30
import javax.swing.JFrame;
31

  
32
import org.gvsig.installer.swing.api.wizard.InstallerWizardActionListener;
33
import org.gvsig.installer.swing.api.wizard.InstallerWizardPanel;
34

  
35
/**
36
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
37
 */
38
public class FrameWizardListener implements InstallerWizardActionListener {
39

  
40
    private JFrame frame = null;
41

  
42
    public FrameWizardListener(JFrame frame) {
43
        super();
44
        this.frame = frame;
45
    }
46

  
47
    public void cancel(InstallerWizardPanel installerWizard) {
48
        frame.setVisible(false);
49
        System.exit(0);
50

  
51
    }
52

  
53
    public void finish(InstallerWizardPanel installerWizard) {
54
        frame.setVisible(false);
55
        System.exit(0);
56
    }
57

  
58
}
0 59

  
tags/v2_0_0_Build_2043/extensions/org.gvsig.installer/org.gvsig.installer.main/src/main/java/org/gvsig/installer/main/utils/CreateBoundleFrame.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22

  
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2010 {Prodevelop}   {Task}
26
 */
27

  
28
package org.gvsig.installer.main.utils;
29

  
30
import java.awt.HeadlessException;
31
import java.awt.event.ActionEvent;
32
import java.awt.event.ActionListener;
33
import java.awt.event.WindowEvent;
34
import java.awt.event.WindowListener;
35
import java.io.File;
36
import java.io.FileOutputStream;
37
import java.util.ArrayList;
38
import java.util.List;
39

  
40
import javax.swing.JFrame;
41
import javax.swing.JOptionPane;
42

  
43
import org.gvsig.gui.beans.openfile.FileTextField;
44
import org.gvsig.installer.lib.impl.utils.Compress;
45

  
46
/**
47
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
48
 */
49
public class CreateBoundleFrame extends JFrame implements WindowListener,
50
    ActionListener {
51

  
52
    /**
53
     * 
54
     */
55
    private static final long serialVersionUID = -2128261599641241144L;
56
    private javax.swing.JButton executeButton;
57
    private javax.swing.JLabel inputLabel;
58
    private FileTextField inputText;
59
    private javax.swing.JLabel jLabel2;
60
    private FileTextField outputText;
61

  
62
    public CreateBoundleFrame() throws HeadlessException {
63
        super();
64
        initializeComponents();
65
        this.addWindowListener(this);
66
        executeButton.addActionListener(this);
67
    }
68

  
69
    private void initializeComponents() {
70
        java.awt.GridBagConstraints gridBagConstraints;
71

  
72
        inputLabel = new javax.swing.JLabel();
73
        executeButton = new javax.swing.JButton();
74
        inputText = new FileTextField();
75
        outputText = new FileTextField();
76
        jLabel2 = new javax.swing.JLabel();
77

  
78
        setLayout(new java.awt.GridBagLayout());
79

  
80
        inputLabel.setText("Input directory");
81
        gridBagConstraints = new java.awt.GridBagConstraints();
82
        gridBagConstraints.gridx = 0;
83
        gridBagConstraints.gridy = 0;
84
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
85
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
86
        add(inputLabel, gridBagConstraints);
87

  
88
        executeButton.setText("Execute");
89
        gridBagConstraints = new java.awt.GridBagConstraints();
90
        gridBagConstraints.gridx = 1;
91
        gridBagConstraints.gridy = 2;
92
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
93
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
94
        add(executeButton, gridBagConstraints);
95

  
96
        gridBagConstraints = new java.awt.GridBagConstraints();
97
        gridBagConstraints.gridx = 1;
98
        gridBagConstraints.gridy = 0;
99
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
100
        gridBagConstraints.ipadx = 67;
101
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
102
        gridBagConstraints.weightx = 1.0;
103
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
104
        add(inputText, gridBagConstraints);
105

  
106
        gridBagConstraints = new java.awt.GridBagConstraints();
107
        gridBagConstraints.gridx = 1;
108
        gridBagConstraints.gridy = 1;
109
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
110
        gridBagConstraints.ipadx = 67;
111
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
112
        gridBagConstraints.weightx = 1.0;
113
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
114
        add(outputText, gridBagConstraints);
115

  
116
        jLabel2.setText("Output");
117
        gridBagConstraints = new java.awt.GridBagConstraints();
118
        gridBagConstraints.gridx = 0;
119
        gridBagConstraints.gridy = 1;
120
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
121
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
122
        add(jLabel2, gridBagConstraints);
123

  
124
    }
125

  
126
    public void windowActivated(WindowEvent arg0) {
127
        // TODO Auto-generated method stub
128

  
129
    }
130

  
131
    public void windowClosed(WindowEvent arg0) {
132
        System.exit(0);
133

  
134
    }
135

  
136
    public void windowClosing(WindowEvent arg0) {
137
        // TODO Auto-generated method stub
138

  
139
    }
140

  
141
    public void windowDeactivated(WindowEvent arg0) {
142
        // TODO Auto-generated method stub
143

  
144
    }
145

  
146
    public void windowDeiconified(WindowEvent arg0) {
147
        // TODO Auto-generated method stub
148

  
149
    }
150

  
151
    public void windowIconified(WindowEvent arg0) {
152
        // TODO Auto-generated method stub
153

  
154
    }
155

  
156
    public void windowOpened(WindowEvent arg0) {
157
        // TODO Auto-generated method stub
158

  
159
    }
160

  
161
    public void actionPerformed(ActionEvent arg0) {
162
        File inputDirectory = inputText.getSelectedFile();
163
        File outputFile = outputText.getSelectedFile();
164

  
165
        if (!inputDirectory.exists()) {
166
            JOptionPane
167
                .showMessageDialog(this, "Input directory doesn't exist");
168
            return;
169
        }
170

  
171
        if (outputFile.exists()) {
172
            outputFile.delete();
173
        }
174

  
175
        Compress compress = new Compress();
176
        try {
177
            File[] files = inputDirectory.listFiles();
178
            List<File> filesArray = new ArrayList<File>();
179
            List<String> fileNamesArray = new ArrayList<String>();
180
            for (int i = 0; i < files.length; i++) {
181
                if (!files[i].getName().toUpperCase().equals(".SVN")) {
182
                    filesArray.add(files[i]);
183
                    fileNamesArray.add(files[i].getName());
184
                }
185
            }
186
            compress.compressPluginsAsPackageSet(filesArray, fileNamesArray,
187
                new FileOutputStream(outputFile));
188
        } catch (Exception e) {
189
            JOptionPane.showMessageDialog(this, e.toString());
190
        }
191
    }
192
}
0 193

  
tags/v2_0_0_Build_2043/extensions/org.gvsig.installer/org.gvsig.installer.main/src/main/java/org/gvsig/installer/main/execution/InstallPackageServiceFrame.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22

  
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2010 {Prodevelop}   {Task}
26
 */
27

  
28
package org.gvsig.installer.main.execution;
29

  
30
import java.io.File;
31

  
32
import javax.swing.JFrame;
33

  
34
import org.gvsig.installer.lib.api.execution.InstallPackageServiceException;
35
import org.gvsig.installer.main.utils.FrameWizardListener;
36
import org.gvsig.installer.swing.api.SwingInstallerLocator;
37
import org.gvsig.installer.swing.api.execution.AbstractInstallPackageWizard;
38
import org.gvsig.installer.swing.api.execution.InstallPackageWizardException;
39
import org.gvsig.tools.locator.LocatorException;
40

  
41
/**
42
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
43
 */
44
public class InstallPackageServiceFrame extends JFrame {
45

  
46
    private static final long serialVersionUID = -5107758157530922356L;
47
    private AbstractInstallPackageWizard installerExecutionWizard;
48

  
49
    public InstallPackageServiceFrame(File applicationFolder,
50
        File pluginsFolder, File installFolder) throws LocatorException,
51
        InstallPackageWizardException {
52
        super();
53
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
54
        installerExecutionWizard =
55
            SwingInstallerLocator.getSwingInstallerManager()
56
                .createInstallPackageWizard(applicationFolder, pluginsFolder,
57
                    installFolder);
58
        installerExecutionWizard
59
            .setWizardActionListener(new FrameWizardListener(this));
60
        this.add(installerExecutionWizard);
61
        pack();
62
    }
63

  
64
    public void installFromDefaultDirectory()
65
        throws InstallPackageServiceException {
66
        installerExecutionWizard.installFromDefaultDirectory();
67
    }
68

  
69
}
0 70

  
tags/v2_0_0_Build_2043/extensions/org.gvsig.installer/org.gvsig.installer.main/src/main/java/org/gvsig/installer/main/execution/InstallPackageWizardFromDefaultDirectoryLauncher.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22

  
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2010 {Prodevelop}   {Task}
26
 */
27

  
28
package org.gvsig.installer.main.execution;
29

  
30
import java.io.IOException;
31

  
32
import org.gvsig.installer.lib.api.execution.InstallPackageServiceException;
33
import org.gvsig.installer.main.DefaultLauncher;
34
import org.gvsig.installer.swing.api.execution.InstallPackageWizardException;
35
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer;
36
import org.gvsig.tools.locator.LocatorException;
37

  
38
/**
39
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
40
 */
41
public class InstallPackageWizardFromDefaultDirectoryLauncher extends
42
    DefaultLauncher {
43

  
44
    public static void main(String[] args) throws LocatorException,
45
        InstallPackageServiceException, InstallPackageWizardException,
46
        IOException {
47
        new DefaultLibrariesInitializer().fullInitialize();
48
        new InstallPackageWizardFromDefaultDirectoryLauncher();
49
    }
50

  
51
    public InstallPackageWizardFromDefaultDirectoryLauncher()
52
        throws LocatorException, InstallPackageWizardException,
53
        InstallPackageServiceException, IOException {
54

  
55
        InstallPackageServiceFrame frame =
56
            new InstallPackageServiceFrame(getApplicationFolder(),
57
                getPluginsFolder(), getInstallFolder());
58
        frame.installFromDefaultDirectory();
59
        frame.setVisible(true);
60
    }
61
}
0 62

  
tags/v2_0_0_Build_2043/extensions/org.gvsig.installer/org.gvsig.installer.main/src/main/java/org/gvsig/installer/main/execution/InstallPackageWizardLauncher.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22

  
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2010 {Prodevelop}   {Task}
26
 */
27

  
28
package org.gvsig.installer.main.execution;
29

  
30
import java.io.IOException;
31

  
32
import org.gvsig.installer.lib.api.execution.InstallPackageServiceException;
33
import org.gvsig.installer.main.DefaultLauncher;
34
import org.gvsig.installer.swing.api.execution.InstallPackageWizardException;
35
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer;
36
import org.gvsig.tools.locator.LocatorException;
37

  
38
/**
39
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
40
 */
41
public class InstallPackageWizardLauncher extends DefaultLauncher {
42

  
43
    public static void main(String[] args) throws LocatorException,
44
        InstallPackageServiceException, InstallPackageWizardException,
45
        IOException {
46
        new DefaultLibrariesInitializer().fullInitialize();
47
        new InstallPackageWizardLauncher();
48
    }
49

  
50
    public InstallPackageWizardLauncher() throws LocatorException,
51
        InstallPackageWizardException, InstallPackageServiceException,
52
        IOException {
53

  
54
        InstallPackageServiceFrame frame =
55
            new InstallPackageServiceFrame(getApplicationFolder(),
56
                getPluginsFolder(), getInstallFolder());
57
        frame.setVisible(true);
58
    }
59
}
0 60

  
tags/v2_0_0_Build_2043/extensions/org.gvsig.installer/org.gvsig.installer.main/src/main/java/org/gvsig/installer/main/creation/MakePluginPackageWizardLauncher.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22

  
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2010 {Prodevelop}   {Task}
26
 */
27

  
28
package org.gvsig.installer.main.creation;
29

  
30
import java.io.IOException;
31

  
32
import org.gvsig.installer.lib.api.creation.MakePluginPackageServiceException;
33
import org.gvsig.installer.main.DefaultLauncher;
34
import org.gvsig.installer.swing.api.creation.MakePluginPackageWizardException;
35
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer;
36
import org.gvsig.tools.locator.LocatorException;
37

  
38
/**
39
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
40
 */
41
public class MakePluginPackageWizardLauncher extends DefaultLauncher {
42

  
43
    public static void main(String[] args) throws LocatorException,
44
        MakePluginPackageWizardException, IOException,
45
        MakePluginPackageServiceException {
46
        new DefaultLibrariesInitializer().fullInitialize();
47
        new MakePluginPackageWizardLauncher();
48
    }
49

  
50
    public MakePluginPackageWizardLauncher() throws LocatorException,
51
        MakePluginPackageWizardException, IOException,
52
        MakePluginPackageServiceException {
53

  
54
        MakePluginPackageFrame frame =
55
            new MakePluginPackageFrame(getApplicationFolder(),
56
                getPluginsFolder(), getInstallFolder());
57
        frame.setVisible(true);
58
    }
59

  
60
}
0 61

  
tags/v2_0_0_Build_2043/extensions/org.gvsig.installer/org.gvsig.installer.main/src/main/java/org/gvsig/installer/main/creation/MakePluginPackageFrame.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22

  
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2010 {Prodevelop}   {Task}
26
 */
27

  
28
package org.gvsig.installer.main.creation;
29

  
30
import java.io.File;
31

  
32
import javax.swing.JFrame;
33

  
34
import org.gvsig.installer.main.utils.FrameWizardListener;
35
import org.gvsig.installer.swing.api.SwingInstallerLocator;
36
import org.gvsig.installer.swing.api.creation.MakePluginPackageWizard;
37
import org.gvsig.installer.swing.api.creation.MakePluginPackageWizardException;
38
import org.gvsig.tools.locator.LocatorException;
39

  
40
/**
41
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
42
 */
43
public class MakePluginPackageFrame extends JFrame {
44

  
45
    private static final long serialVersionUID = 4144834319158286247L;
46
    private MakePluginPackageWizard installerCreationWizard;
47

  
48
    public MakePluginPackageFrame(File applicationFolder, File pluginsFolder,
49
        File installFolder) throws LocatorException,
50
        MakePluginPackageWizardException {
51
        super();
52
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
53
        installerCreationWizard =
54
            SwingInstallerLocator.getSwingInstallerManager()
55
                .createMakePluginPackageWizard(applicationFolder,
56
                    pluginsFolder, installFolder);
57
        installerCreationWizard
58
            .setWizardActionListener(new FrameWizardListener(this));
59
        this.add(installerCreationWizard);
60
        pack();
61
    }
62

  
63
}
0 64

  
tags/v2_0_0_Build_2043/extensions/org.gvsig.installer/org.gvsig.installer.main/src/main/java/org/gvsig/installer/main/DefaultLauncher.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22

  
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2010 {Prodevelop}   {Task}
26
 */
27

  
28
package org.gvsig.installer.main;
29

  
30
import java.io.File;
31
import java.io.FileInputStream;
32
import java.io.FileOutputStream;
33
import java.io.IOException;
34
import java.io.InputStream;
35
import java.io.OutputStream;
36

  
37
/**
38
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
39
 */
40
public class DefaultLauncher {
41

  
42
    private File appFolder;
43

  
44
    public File getApplicationFolder() throws IOException {
45
        if (appFolder == null) {
46
            File templateFile =
47
                new File(getClass().getClassLoader().getResource("application")
48
                    .getFile());
49
            appFolder =
50
                new File(System.getProperty("java.io.tmpdir") + File.separator
51
                    + "tmp_gvsig_installer");
52

  
53
            copy(templateFile, appFolder);
54
        }
55

  
56
        return appFolder;
57
    }
58

  
59
    public File getPluginsFolder() throws IOException {
60
        return new File(appFolder, "plugins");
61
    }
62

  
63
    public File getInstallFolder() throws IOException {
64
        return new File(appFolder, "install");
65
    }
66

  
67
    public void copy(File sourceLocation, File targetLocation)
68
        throws IOException {
69
        if (sourceLocation.isDirectory()) {
70
            if (!targetLocation.exists()) {
71
                targetLocation.mkdir();
72
            }
73

  
74
            String[] children = sourceLocation.list();
75
            for (int i = 0; i < children.length; i++) {
76
                copy(new File(sourceLocation, children[i]), new File(
77
                    targetLocation, children[i]));
78
            }
79
        } else {
80
            targetLocation.getParentFile().mkdirs();
81

  
82
            InputStream in = new FileInputStream(sourceLocation);
83
            OutputStream out = new FileOutputStream(targetLocation);
84

  
85
            // Copy the bits from instream to outstream
86
            byte[] buf = new byte[1024];
87
            int len;
88
            while ((len = in.read(buf)) > 0) {
89
                out.write(buf, 0, len);
90
            }
91
            in.close();
92
            out.close();
93
        }
94
    }
95
}
0 96

  
tags/v2_0_0_Build_2043/extensions/org.gvsig.installer/org.gvsig.installer.main/pom.xml
1
<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/maven-v4_0_0.xsd">
2
	<modelVersion>4.0.0</modelVersion>
3
	<artifactId>org.gvsig.installer.main</artifactId>
4
	<packaging>jar</packaging>
5
	<name>org.gvsig.installer.main</name>
6
	<parent>
7
		<groupId>org.gvsig</groupId>
8
		<artifactId>org.gvsig.installer</artifactId>
9
		<version>1.0.1-SNAPSHOT</version>
10
	</parent>
11
	<dependencies>
12
		<dependency>
13
			<groupId>org.gvsig</groupId>
14
			<artifactId>org.gvsig.installer.lib.api</artifactId>
15
			<version>1.0.1-SNAPSHOT</version>
16
            <scope>compile</scope>
17
		</dependency>
18
		<dependency>
19
			<groupId>org.gvsig</groupId>
20
			<artifactId>org.gvsig.installer.lib.spi</artifactId>
21
			<version>1.0.1-SNAPSHOT</version>
22
            <scope>compile</scope>
23
		</dependency>
24
		<dependency>
25
			<groupId>org.gvsig</groupId>
26
			<artifactId>org.gvsig.installer.lib.impl</artifactId>
27
			<version>1.0.1-SNAPSHOT</version>
28
			<!-- The scope is not runtime because there is an utility that uses the Compress class directly
29
			     It will be runtime the day that the API supports this functionality
30
			-->
31
			 <scope>compile</scope>
32
		</dependency>
33
		<dependency>
34
			<groupId>org.gvsig</groupId>
35
			<artifactId>org.gvsig.installer.prov.plugin</artifactId>
36
			<version>1.0.1-SNAPSHOT</version>
37
		</dependency>
38
		<dependency>
39
			<groupId>org.gvsig</groupId>
40
			<artifactId>org.gvsig.installer.swing.api</artifactId>
41
			<version>1.0.1-SNAPSHOT</version>
42
            <scope>compile</scope>
43
		</dependency>
44
        <dependency>
45
            <groupId>org.gvsig</groupId>
46
            <artifactId>org.gvsig.installer.swing.impl</artifactId>
47
            <version>1.0.1-SNAPSHOT</version>
48
        </dependency>
49
        <dependency>
50
            <groupId>org.gvsig</groupId>
51
            <artifactId>org.gvsig.tools.lib</artifactId>
52
            <scope>compile</scope>
53
        </dependency>
54
		<dependency>
55
			<groupId>org.gvsig</groupId>
56
			<artifactId>org.gvsig.ui</artifactId>
57
            <scope>compile</scope>
58
		</dependency>
59
	</dependencies>
60
</project>
0 61

  
tags/v2_0_0_Build_2043/extensions/org.gvsig.installer/org.gvsig.installer.main/org.gvsig.wcs
1
#
2
#Wed Apr 28 12:13:53 CEST 2010
3
version=1.0.0
4
oficial=true
5
name=myplugin
6
type=plugin
7
description=Test
8
code=org.gvsig.wcs
9
state=RC1
10
build=1
0 11

  
tags/v2_0_0_Build_2043/extensions/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/main/java/org/gvsig/installer/lib/impl/DefaultVersion.java
1
package org.gvsig.installer.lib.impl;
2

  
3
import java.security.InvalidParameterException;
4
import java.text.MessageFormat;
5

  
6
import org.gvsig.installer.lib.api.Version;
7

  
8
public class DefaultVersion implements Version {
9

  
10
	private int mayor = 0;
11
	private int minor = 0;
12
	private int rev = 0;
13
	private String classifier = null;
14
	private int build = 0;
15

  
16
	public DefaultVersion() {
17
		super();
18
	}
19

  
20
	protected DefaultVersion(int mayor, int minor, int rev,String classifier, int build) {
21
		this();
22
		this.mayor = mayor;
23
		this.minor = minor;
24
		this.rev = rev;
25
		this.classifier = classifier;
26
		this.build = build;
27
	}
28
	
29
	public Version parse(String version) {
30
		// Formato: mayor.minor.rev-classifier-build
31
		
32
		String[] x = version.split("[.]");
33
		int lx = x.length;
34
		if( lx==1 ) {
35
			this.mayor = parseIntClassifierAndBuild(x[0],version);
36
			this.minor = 0;
37
			this.rev = 0;
38
			this.classifier = null;
39
			this.build = 0;
40
		} else if( lx==2 ) {
41
			this.mayor = Integer.parseInt(x[0]);
42
			this.minor = parseIntClassifierAndBuild(x[1],version);
43
			this.rev = 0;
44
			this.classifier = null;
45
			this.build = 0;
46
		} else if( lx==3 ) {
47
			this.mayor = Integer.parseInt(x[0]);
48
			this.minor = Integer.parseInt(x[1]);
49
			this.rev = parseIntClassifierAndBuild(x[2],version);
50
		} else {
51
			throw new InvalidParameterException(version);
52
		}
53
		return this;
54
	}
55

  
56
	private int parseIntClassifierAndBuild(String s, String fullversion) {
57
		int value;
58
		
59
		String[] y = s.split("[-]");
60
		int ly = y.length;
61
		if( ly == 1 ) {
62
			value = Integer.parseInt(y[0]);
63
			this.classifier = null;
64
			this.build = 0;
65
		} else if( ly == 2 ) {
66
			value = Integer.parseInt(y[0]);
67
			try {
68
				this.build = Integer.parseInt(y[1]);
69
				this.classifier = null;
70
			} catch( NumberFormatException e) {
71
				this.build = 0;
72
				this.classifier = y[1];
73
			}
74
		} else if( ly == 3 ) {
75
			value = Integer.parseInt(y[0]);
76
			this.classifier = y[1];
77
			this.build = Integer.parseInt(y[2]);
78
		} else {
79
			throw new InvalidParameterException(fullversion);
80
		}
81
		return value;
82
	}
83
	
84
	
85
	public int getMayor() {
86
		return this.mayor;
87
	}
88

  
89
	public int getMinor() {
90
		return this.minor;
91
	}
92

  
93
	public int getRevision() {
94
		return this.rev;
95
	}
96

  
97
	public String getClassifier() {
98
		return this.classifier;
99
	}
100

  
101
	public int getBuild() {
102
		return this.build;
103
	}
104

  
105
	public boolean check(String op, Version other) {
106
		if( "=".equals(op) || "==".equals(op) || "-eq".equals(op) ) {
107
			return this.fullFormat().compareTo(other.fullFormat()) == 0; 
108
		}
109
		if( ">".equals(op) || "-gt".equals(op) ) {
110
			return this.fullFormat().compareTo(other.fullFormat()) > 0; 
111
		}
112
		if( ">=".equals(op) || "-ge".equals(op) ) {
113
			return this.fullFormat().compareTo(other.fullFormat()) >= 0; 
114
		}
115
		if( "<".equals(op) || "-lt".equals(op) ) {
116
			return this.fullFormat().compareTo(other.fullFormat()) < 0; 
117
		}
118
		if( "<=".equals(op) || "-le".equals(op) ) {
119
			return this.fullFormat().compareTo(other.fullFormat()) <= 0; 
120
		}
121
		return false;
122
	}
123

  
124
	public String toString() {
125
		if( this.classifier==null ) {
126
			return MessageFormat.format("{0}.{1}.{2}-{3,number,####}",
127
					this.mayor,
128
					this.minor,
129
					this.rev,
130
					this.build
131
				);
132
		} else {
133
			return MessageFormat.format("{0}.{1}.{2}-{3}-{4,number,####}",
134
					this.mayor,
135
					this.minor,
136
					this.rev,
137
					this.classifier,
138
					this.build
139
				);
140
		}
141
	}
142
	
143
	public String fullFormat() {
144
		if( this.classifier==null ) {
145
			// classifier AAAA allows compare correctly tow versions
146
			return MessageFormat.format("{0,number,0000}.{1,number,0000}.{2,number,0000}-AAAA-{3,number,0000}",
147
					this.mayor,
148
					this.minor,
149
					this.rev,
150
					this.build
151
				);
152
		} else {
153
			return MessageFormat.format("{0,number,0000}.{1,number,0000}.{2,number,0000}-{3}-{4,number,0000}",
154
					this.mayor,
155
					this.minor,
156
					this.rev,
157
					this.classifier,
158
					this.build
159
				);
160
		}
161
	}
162
	
163
	public Object clone() throws CloneNotSupportedException {
164
		return super.clone();
165
	}
166
	
167
	public boolean equals(Object obj) {
168
		Version other = (Version)obj;
169
		if( this.mayor != other.getMayor() ) {
170
			return false;
171
		}
172
		if( this.minor != other.getMinor() ) {
173
			return false;
174
		}
175
		if( this.rev != other.getRevision() ) {
176
			return false;
177
		}
178
		if( this.build != other.getBuild() ) {
179
			return false;
180
		}
181
		if( this.classifier==null ) {
182
			if( other.getClassifier()==null ) {
183
				return true;
184
			} else {
185
				return false;
186
			}
187
		}
188
		if( !this.classifier.equalsIgnoreCase(other.getClassifier()) ) {
189
			return false;
190
		}
191
		return true;
192
	}
193

  
194
	public Version setBuild(int build) {
195
		this.build = build;
196
		return this;
197
	}
198
}
0 199

  
tags/v2_0_0_Build_2043/extensions/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/main/java/org/gvsig/installer/lib/impl/DefaultDependencies.java
1
package org.gvsig.installer.lib.impl;
2

  
3
import java.util.ArrayList;
4
import java.util.Iterator;
5

  
6
import org.gvsig.installer.lib.api.Dependencies;
7
import org.gvsig.installer.lib.api.Dependency;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff