Revision 32565

View differences:

branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.prov/org.gvsig.installer.prov.plugin/src/main/java/org/gvsig/installer/prov/plugin/execution/PluginInstallerExecutionProvider.java
32 32

  
33 33
import org.apache.tools.ant.Project;
34 34
import org.apache.tools.ant.ProjectHelper;
35
import org.gvsig.installer.lib.api.execution.InstallerExecutionServiceException;
35
import org.gvsig.installer.lib.api.execution.InstallPackageServiceException;
36 36
import org.gvsig.installer.lib.spi.InstallerProviderLocator;
37 37
import org.gvsig.installer.lib.spi.InstallerProviderManager;
38 38
import org.gvsig.installer.lib.spi.InstallerProviderServices;
......
54 54
		super(providerServices);		
55 55
	}
56 56

  
57
	public void install(File applicationDirectory, InputStream inputStream) throws InstallerExecutionServiceException {
57
	public void install(File applicationDirectory, InputStream inputStream) throws InstallPackageServiceException {
58 58
		this.applicationDirectory = applicationDirectory;
59 59
		pluginsDirectory = new File(applicationDirectory + File.separator + "gvSIG" + File.separator + "extensiones");
60 60
		if (!pluginsDirectory.exists()){
61
			throw new InstallerExecutionServiceException("plugins_directory_not_found");
61
			throw new InstallPackageServiceException("plugins_directory_not_found");
62 62
		}	
63 63
		//Saving all the plugins before to decompress
64 64
		String[] oldPlugins = pluginsDirectory.list();
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.api/src/main/java/org/gvsig/installer/swing/api/execution/InstallerExecutionWizard.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.swing.api.execution;
29

  
30
import java.io.File;
31

  
32
import javax.swing.JPanel;
33

  
34
import org.gvsig.installer.lib.api.execution.InstallerExecutionServiceException;
35

  
36
/**
37
 * <p>
38
 * Wizard that is used to execute an installation file to 
39
 * install one or more plugins in a valid gvSIG directory.
40
 * This class receive a gvSIG directory where gvSIG
41
 * is located and it allows to select from the user interface 
42
 * the installers to install.
43
 * </p>
44
 * 
45
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
46
 */
47
public abstract class InstallerExecutionWizard extends JPanel{
48
	private static final long serialVersionUID = -758246118332926598L;
49

  
50
	/**
51
	 * Sets the directory where gvSIG is located.
52
	 * @param applicationDirectory
53
	 * the gvSIG root directory.
54
	 * @throws InstallerExecutionServiceException
55
	 * If the directory doesn't exist or if is an invalid gvSIG directory
56
	 */
57
	public abstract void setApplicationDirectory(File applicationDirectory) throws InstallerExecutionServiceException;
58
	
59
	/**
60
	 * If this method is selected the first window of the wizard is
61
	 * not visible and the installation process takes the installers
62
	 * form the default directory.
63
	 * @throws InstallerExecutionServiceException 
64
	 */
65
	public abstract void installFromDefaultDirectory() throws InstallerExecutionServiceException;
66
}
67

  
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.api/src/main/java/org/gvsig/installer/swing/api/execution/CreateInstallerExecutionWizardException.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
* 2009 {Iver T.I.}   {Task}
26
*/
27
 
28
package org.gvsig.installer.swing.api.execution;
29

  
30
import org.gvsig.tools.exception.BaseException;
31

  
32
/**
33
 * Base exception for all the exceptions that are thrown by the process
34
 * of execution of an installer using the wizard. 
35
 * 
36
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
37
 */
38
public class CreateInstallerExecutionWizardException extends BaseException{
39
	private static final long serialVersionUID = -5480466569496849255L;
40
	private static final String KEY = "installer_execution_exception";
41
	
42
	/**
43
	 * @see BaseException#BaseException(String, Throwable, String, long)
44
	 */
45
	public CreateInstallerExecutionWizardException(String message, Throwable cause) {
46
		super(message, cause, KEY, serialVersionUID);		
47
	}
48
}
49

  
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.api/src/main/java/org/gvsig/installer/swing/api/execution/InstallPackageWizardException.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
* 2009 {Iver T.I.}   {Task}
26
*/
27
 
28
package org.gvsig.installer.swing.api.execution;
29

  
30
import org.gvsig.tools.exception.BaseException;
31

  
32
/**
33
 * Base exception for all the exceptions that are thrown by the process
34
 * of execution of an installer using the wizard. 
35
 * 
36
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
37
 */
38
public class InstallPackageWizardException extends BaseException{
39
	private static final long serialVersionUID = -5480466569496849255L;
40
	private static final String KEY = "installer_execution_exception";
41
	
42
	/**
43
	 * @see BaseException#BaseException(String, Throwable, String, long)
44
	 */
45
	public InstallPackageWizardException(String message, Throwable cause) {
46
		super(message, cause, KEY, serialVersionUID);		
47
	}
48
}
49

  
0 50

  
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.api/src/main/java/org/gvsig/installer/swing/api/execution/InstallPackageWizard.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.swing.api.execution;
29

  
30
import java.io.File;
31

  
32
import javax.swing.JPanel;
33

  
34
import org.gvsig.installer.lib.api.execution.InstallPackageServiceException;
35

  
36
/**
37
 * <p>
38
 * Wizard that is used to execute an installation file to 
39
 * install one or more plugins in a valid gvSIG directory.
40
 * This class receive a gvSIG directory where gvSIG
41
 * is located and it allows to select from the user interface 
42
 * the installers to install.
43
 * </p>
44
 * 
45
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
46
 */
47
public abstract class InstallPackageWizard extends JPanel{
48
	private static final long serialVersionUID = -758246118332926598L;
49
	protected File applicationDirectory = null;
50

  
51
	public InstallPackageWizard(File applicationDirectory) {
52
		super();
53
		this.applicationDirectory = applicationDirectory;
54
	}	
55
	
56
	public File getApplicationDirectory() {
57
		return applicationDirectory;
58
	}
59

  
60
	/**
61
	 * If this method is selected the first window of the wizard is
62
	 * not visible and the installation process takes the installers
63
	 * form the default directory.
64
	 * @throws InstallPackageServiceException 
65
	 */
66
	public abstract void installFromDefaultDirectory() throws InstallPackageServiceException;
67
}
68

  
0 69

  
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.api/src/main/java/org/gvsig/installer/swing/api/creation/InstallerCreationWizard.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.swing.api.creation;
29

  
30
import java.io.File;
31

  
32
import javax.swing.JPanel;
33

  
34
import org.gvsig.installer.lib.api.InstallerInfo;
35
import org.gvsig.installer.lib.api.creation.InstallerCreationServiceException;
36

  
37
/**
38
 * <p>
39
 * Wizard that is used to create an installation file from a 
40
 * gvSIG directory. This class receive a directory and allows to
41
 * the user to select the plugin that is used to create the 
42
 * installer.
43
 * </p>
44
 * <p>
45
 * The user can also set some plugin properties, like the version of the 
46
 * installer, the build number... The definition of all these properties can
47
 * be found in {@link InstallerInfo}.
48
 * </p>
49
 * 
50
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
51
 */
52
public abstract class InstallerCreationWizard extends JPanel {
53
	private static final long serialVersionUID = 6387360455696226183L;
54

  
55
	/**
56
	 * Sets the directory where gvSIG is located.
57
	 * @param applicationDirectory
58
	 * the gvSIG root directory.
59
	 * @throws InstallerCreationServiceException
60
	 * If the directory doesn't exist or if is an invalid gvSIG directory
61
	 */
62
	public abstract void setApplicationDirectory(File applicationDirectory) throws InstallerCreationServiceException;
63
}
64

  
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.api/src/main/java/org/gvsig/installer/swing/api/creation/CreateInstallerCreationWizardException.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
* 2009 {Iver T.I.}   {Task}
26
*/
27
 
28
package org.gvsig.installer.swing.api.creation;
29

  
30
import org.gvsig.tools.exception.BaseException;
31

  
32
/**
33
 * Base exception for all the exceptions that are thrown by the process
34
 * of creation of an installer using the wizard. 
35
 *  
36
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
37
 */
38
public class CreateInstallerCreationWizardException extends BaseException{
39
	private static final long serialVersionUID = -2058883261679288759L;
40
	private static final String KEY = "installer_creation_exception";	
41
	
42
	/**
43
	 * @see BaseException#BaseException(String, Throwable, String, long)
44
	 */
45
	public CreateInstallerCreationWizardException(String message, Throwable cause) {
46
		super(message, cause, KEY, serialVersionUID);		
47
	}
48
	
49

  
50
}
51

  
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.api/src/main/java/org/gvsig/installer/swing/api/creation/MakePluginPackageWizardException.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
* 2009 {Iver T.I.}   {Task}
26
*/
27
 
28
package org.gvsig.installer.swing.api.creation;
29

  
30
import org.gvsig.tools.exception.BaseException;
31

  
32
/**
33
 * Base exception for all the exceptions that are thrown by the process
34
 * of creation of an installer using the wizard. 
35
 *  
36
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
37
 */
38
public class MakePluginPackageWizardException extends BaseException{
39
	private static final long serialVersionUID = -2058883261679288759L;
40
	private static final String KEY = "installer_creation_exception";	
41
	
42
	/**
43
	 * @see BaseException#BaseException(String, Throwable, String, long)
44
	 */
45
	public MakePluginPackageWizardException(String message, Throwable cause) {
46
		super(message, cause, KEY, serialVersionUID);		
47
	}
48
	
49

  
50
}
51

  
0 52

  
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.api/src/main/java/org/gvsig/installer/swing/api/creation/MakePluginPackageWizard.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.swing.api.creation;
29

  
30
import java.io.File;
31

  
32
import javax.swing.JPanel;
33

  
34
import org.gvsig.installer.lib.api.PackageInfo;
35

  
36
/**
37
 * <p>
38
 * Wizard that is used to create an installation file from a 
39
 * gvSIG directory. This class receive a directory and allows to
40
 * the user to select the plugin that is used to create the 
41
 * installer.
42
 * </p>
43
 * <p>
44
 * The user can also set some plugin properties, like the version of the 
45
 * installer, the build number... The definition of all these properties can
46
 * be found in {@link PackageInfo}.
47
 * </p>
48
 * 
49
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
50
 */
51
public abstract class MakePluginPackageWizard extends JPanel {
52
	private static final long serialVersionUID = 6387360455696226183L;
53
	protected File applicationDirectory = null;
54

  
55
	public MakePluginPackageWizard(File applicationDirectory) {
56
		super();
57
		this.applicationDirectory = applicationDirectory;
58
	}	
59
	
60
	public File getApplicationDirectory() {
61
		return applicationDirectory;
62
	}
63
}
64

  
0 65

  
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.api/src/main/java/org/gvsig/installer/swing/api/SwingInstallerManager.java
27 27
 
28 28
package org.gvsig.installer.swing.api;
29 29

  
30
import java.io.File;
31

  
30 32
import javax.swing.JPanel;
31 33

  
32
import org.gvsig.installer.swing.api.creation.CreateInstallerCreationWizardException;
33
import org.gvsig.installer.swing.api.creation.InstallerCreationWizard;
34
import org.gvsig.installer.swing.api.execution.CreateInstallerExecutionWizardException;
35
import org.gvsig.installer.swing.api.execution.InstallerExecutionWizard;
34
import org.gvsig.installer.swing.api.creation.MakePluginPackageWizard;
35
import org.gvsig.installer.swing.api.creation.MakePluginPackageWizardException;
36
import org.gvsig.installer.swing.api.execution.InstallPackageWizard;
37
import org.gvsig.installer.swing.api.execution.InstallPackageWizardException;
36 38

  
37 39

  
38 40
/**
......
51 53
	 * Registers a class that implements a wizard to create an installer
52 54
	 * of a plugin from a gvSIG installation directory.
53 55
	 * @param clazz
54
	 * Class that inherits of the {@link InstallerCreationWizard} abstract class.
56
	 * Class that inherits of the {@link MakePluginPackageWizard} abstract class.
55 57
	 */
56 58
	@SuppressWarnings(value = "unchecked")
57
	public void registerInstallerCreationWizard(Class clazz);
59
	public void registerMakePluginPackageWizardInstallerCreationWizard(Class clazz);
58 60
	
59 61
	/**
60 62
	 * This method returns a class that is used to create an
61 63
	 * installer from a gvSIG installation directory.
62 64
	 * @return
63 65
	 * The wizard to create an installer.
64
	 * @throws CreateInstallerCreationWizardException
66
	 * @throws MakePluginPackageWizardException
65 67
	 * If there is a problem creating the wizard.
66 68
	 */
67
	public InstallerCreationWizard createInstallerCreationWizard() throws CreateInstallerCreationWizardException;
69
	public MakePluginPackageWizard createMakePluginPackageWizard(File ApplicationDirectory) throws MakePluginPackageWizardException;
68 70
	
69 71
	/**
70 72
	 * Registers a class that implements a wizard to execte an installer
71 73
	 * to install a set of plugins in a gvSIG installation directory.
72 74
	 * @param clazz
73
	 * Class that inherits of the {@link InstallerExecutionWizard} abstract class.
75
	 * Class that inherits of the {@link InstallPackageWizard} abstract class.
74 76
	 */
75 77
	@SuppressWarnings(value = "unchecked")
76
	public void registerInstallerExecutionWizard(Class clazz);
78
	public void registerInstallPackageWizard(Class clazz);
77 79
	
78 80
	/**
79 81
	 * This method returns a class that is used to execute an
80 82
	 * installer to install a set of plugins in a gvSIG installation directory.
81 83
	 * @return
82 84
	 * The wizard to execute  an installer.
83
	 * @throws CreateInstallerExecutionWizardException
85
	 * @throws InstallPackageWizardException
84 86
	 * If there is a problem creating the wizard.
85 87
	 */	
86
	public InstallerExecutionWizard createInstallerExecutionWizard() throws CreateInstallerExecutionWizardException; 
88
	public InstallPackageWizard createInstallPackageWizard(File ApplicationDirectory) throws InstallPackageWizardException; 
87 89
		
88 90
}
89 91

  
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.impl/src/main/java/org/gvsig/installer/swing/impl/DefaultSwingInstallerLibrary.java
29 29

  
30 30
import org.gvsig.installer.swing.api.SwingInstallerLocator;
31 31
import org.gvsig.installer.swing.api.SwingInstallerManager;
32
import org.gvsig.installer.swing.impl.creation.DefaultInstallerCreationWizard;
33
import org.gvsig.installer.swing.impl.execution.DefaultInstallerExecutionWizard;
32
import org.gvsig.installer.swing.impl.creation.DefaultMakePluginPackageWizard;
33
import org.gvsig.installer.swing.impl.execution.DefaultInstallPackageWizard;
34 34
import org.gvsig.tools.library.AbstractLibrary;
35 35
import org.gvsig.tools.library.LibraryException;
36 36

  
......
49 49
		SwingInstallerManager swingInstallerManager = 
50 50
			SwingInstallerLocator.getSwingInstallerManager();
51 51
		
52
		swingInstallerManager.registerInstallerCreationWizard(DefaultInstallerCreationWizard.class);
53
		swingInstallerManager.registerInstallerExecutionWizard(DefaultInstallerExecutionWizard.class);
52
		swingInstallerManager.registerMakePluginPackageWizardInstallerCreationWizard(DefaultMakePluginPackageWizard.class);
53
		swingInstallerManager.registerInstallPackageWizard(DefaultInstallPackageWizard.class);
54 54
	}
55 55
}
56 56

  
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.impl/src/main/java/org/gvsig/installer/swing/impl/execution/DefaultInstallerExecutionWizard.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.swing.impl.execution;
29

  
30
import java.awt.BorderLayout;
31
import java.io.File;
32
import java.io.InputStream;
33
import java.util.ArrayList;
34
import java.util.List;
35

  
36
import javax.swing.ImageIcon;
37

  
38
import jwizardcomponent.DefaultJWizardComponents;
39

  
40
import org.gvsig.installer.lib.api.InstallerInfo;
41
import org.gvsig.installer.lib.api.InstallerLocator;
42
import org.gvsig.installer.lib.api.execution.InstallerExecutionService;
43
import org.gvsig.installer.lib.api.execution.InstallerExecutionServiceException;
44
import org.gvsig.installer.swing.api.execution.InstallerExecutionWizard;
45
import org.gvsig.installer.swing.impl.InstallerWizardContainer;
46
import org.gvsig.installer.swing.impl.execution.wizard.ProgressWizard;
47
import org.gvsig.installer.swing.impl.execution.wizard.SelectInstallersWizard;
48
import org.gvsig.installer.swing.impl.execution.wizard.SelectPluginsWizard;
49
import org.gvsig.installer.swing.impl.wizard.WizardPanelWithLogo;
50
import org.gvsig.tools.locator.LocatorException;
51
import org.slf4j.Logger;
52
import org.slf4j.LoggerFactory;
53

  
54
/**
55
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
56
 */
57
public class DefaultInstallerExecutionWizard extends InstallerExecutionWizard{
58
	private WizardPanelWithLogo wizardPanelWithLogo = null;
59
	private InstallerExecutionService installerExecutionService = null;
60
	private File applicationDirectory = null;
61
	private static final Logger logger = LoggerFactory.getLogger(DefaultInstallerExecutionWizard.class);
62
	private List<InstallerInfo> installersToInstall = null;	
63
		
64
	//Wizards
65
	private SelectInstallersWizard selectInstallersWizard = null;
66
	private SelectPluginsWizard selectPluginsWizard = null;
67
	private ProgressWizard progressWizard = null;
68
	
69
	public DefaultInstallerExecutionWizard()
70
	{
71
		wizardPanelWithLogo = new WizardPanelWithLogo(new ImageIcon(getClass().getClassLoader().getResource("images/createplugininstallicon.png").getFile()));		
72
		
73
		selectInstallersWizard = new SelectInstallersWizard(this);
74
		selectPluginsWizard = new SelectPluginsWizard(this);
75
		progressWizard = new ProgressWizard(this);
76
		
77
		installersToInstall = new ArrayList<InstallerInfo>();
78
		
79
		addWizards();
80

  
81
		this.setLayout(new BorderLayout());
82
		this.add(wizardPanelWithLogo, BorderLayout.CENTER);
83
	}
84
	
85
	private void addWizards(){
86
		getWizardComponents().addWizardPanel(
87
				new InstallerWizardContainer(getWizardComponents(), 
88
					selectInstallersWizard));
89
		
90
		getWizardComponents().addWizardPanel(
91
				new InstallerWizardContainer(getWizardComponents(), 
92
						selectPluginsWizard));	
93
		getWizardComponents().addWizardPanel(
94
				new InstallerWizardContainer(getWizardComponents(), 
95
						progressWizard));			
96
	}
97

  
98
	public DefaultJWizardComponents getWizardComponents()
99
	{
100
		return wizardPanelWithLogo.getWizardComponents();
101
	}
102

  
103
	private void checkInstallerExceutionService() throws InstallerExecutionServiceException{
104
		if (installerExecutionService == null){
105
			try {
106
				installerExecutionService =
107
					InstallerLocator.getInstallerManager().getInstallerExecutionService();					
108
			} catch (LocatorException e) {
109
				throw new InstallerExecutionServiceException("Error getting the execution service", e);				
110
			} 
111
		}
112
	}
113
	
114
	@Override
115
	public void setApplicationDirectory(File applicationDirectory) throws InstallerExecutionServiceException {
116
		checkInstallerExceutionService();
117
		installerExecutionService.setApplicationDirectory(applicationDirectory);
118
	}	
119
	
120
	/**
121
	 * @return the installerExecutionService
122
	 */
123
	public InstallerExecutionService getInstallerExecutionService() {
124
		return installerExecutionService;
125
	}
126
	
127
	
128
	/**
129
	 * @return the installersToInstall
130
	 */
131
	public List<InstallerInfo> getInstallersToInstall() {
132
		return installersToInstall;
133
	}
134
	
135
	public void setNextButtonEnabled(boolean isEnabled){
136
		getWizardComponents().getNextButton().setEnabled(isEnabled);
137
	}
138

  
139
	@Override
140
	public void installFromDefaultDirectory() throws InstallerExecutionServiceException {
141
		getWizardComponents().removeWizardPanel(0);
142
		installerExecutionService.addInstallersFromInstallDirectory();
143
		selectPluginsWizard.updatePanel();
144
	}
145
}
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.impl/src/main/java/org/gvsig/installer/swing/impl/execution/DefaultInstallPackageWizard.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.swing.impl.execution;
29

  
30
import java.awt.BorderLayout;
31
import java.io.File;
32
import java.util.ArrayList;
33
import java.util.List;
34

  
35
import javax.swing.ImageIcon;
36

  
37
import jwizardcomponent.DefaultJWizardComponents;
38

  
39
import org.gvsig.installer.lib.api.InstallerLocator;
40
import org.gvsig.installer.lib.api.PackageInfo;
41
import org.gvsig.installer.lib.api.execution.InstallPackageService;
42
import org.gvsig.installer.lib.api.execution.InstallPackageServiceException;
43
import org.gvsig.installer.swing.api.execution.InstallPackageWizard;
44
import org.gvsig.installer.swing.impl.InstallerWizardContainer;
45
import org.gvsig.installer.swing.impl.execution.wizard.ProgressWizard;
46
import org.gvsig.installer.swing.impl.execution.wizard.SelectInstallersWizard;
47
import org.gvsig.installer.swing.impl.execution.wizard.SelectPluginsWizard;
48
import org.gvsig.installer.swing.impl.wizard.WizardPanelWithLogo;
49
import org.gvsig.tools.locator.LocatorException;
50
import org.slf4j.Logger;
51
import org.slf4j.LoggerFactory;
52

  
53
/**
54
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
55
 */
56
public class DefaultInstallPackageWizard extends InstallPackageWizard{
57
	private WizardPanelWithLogo wizardPanelWithLogo = null;
58
	private InstallPackageService installerExecutionService = null;	
59
	private static final Logger logger = LoggerFactory.getLogger(DefaultInstallPackageWizard.class);
60
	private List<PackageInfo> installersToInstall = null;	
61
		
62
	//Wizards
63
	private SelectInstallersWizard selectInstallersWizard = null;
64
	private SelectPluginsWizard selectPluginsWizard = null;
65
	private ProgressWizard progressWizard = null;
66
	
67
	public DefaultInstallPackageWizard(File applicationDirectory) throws InstallPackageServiceException
68
	{
69
		super(applicationDirectory);
70
		wizardPanelWithLogo = new WizardPanelWithLogo(new ImageIcon(getClass().getClassLoader().getResource("images/createplugininstallicon.png").getFile()));		
71
		
72
		selectInstallersWizard = new SelectInstallersWizard(this);
73
		selectPluginsWizard = new SelectPluginsWizard(this);
74
		progressWizard = new ProgressWizard(this);
75
		
76
		installersToInstall = new ArrayList<PackageInfo>();
77
		
78
		addWizards();
79

  
80
		this.setLayout(new BorderLayout());
81
		this.add(wizardPanelWithLogo, BorderLayout.CENTER);	
82
		
83
		installerExecutionService =
84
			InstallerLocator.getInstallerManager().getInstallPackageService();	
85
	}
86
	
87
	private void addWizards(){
88
		getWizardComponents().addWizardPanel(
89
				new InstallerWizardContainer(getWizardComponents(), 
90
					selectInstallersWizard));
91
		
92
		getWizardComponents().addWizardPanel(
93
				new InstallerWizardContainer(getWizardComponents(), 
94
						selectPluginsWizard));	
95
		getWizardComponents().addWizardPanel(
96
				new InstallerWizardContainer(getWizardComponents(), 
97
						progressWizard));			
98
	}
99

  
100
	public DefaultJWizardComponents getWizardComponents()
101
	{
102
		return wizardPanelWithLogo.getWizardComponents();
103
	}
104
	
105
	/**
106
	 * @return the installerExecutionService
107
	 */
108
	public InstallPackageService getInstallerExecutionService() {
109
		return installerExecutionService;
110
	}	
111
	
112
	/**
113
	 * @return the installersToInstall
114
	 */
115
	public List<PackageInfo> getInstallersToInstall() {
116
		return installersToInstall;
117
	}
118
	
119
	public void setNextButtonEnabled(boolean isEnabled){
120
		getWizardComponents().getNextButton().setEnabled(isEnabled);
121
	}
122

  
123
	@Override
124
	public void installFromDefaultDirectory() throws InstallPackageServiceException {
125
		getWizardComponents().removeWizardPanel(0);
126
		installerExecutionService.addBundlesFromDirectory(getDefaultInstallersDirectory());
127
		selectPluginsWizard.updatePanel();
128
	}
129
	
130
	public File getDefaultInstallersDirectory()
131
	{
132
		return new File(applicationDirectory.getAbsolutePath() + File.separator + "install");
133
	}
134
}
0 135

  
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.impl/src/main/java/org/gvsig/installer/swing/impl/execution/panel/PluginsTablePanel.java
40 40
import javax.swing.event.ListSelectionListener;
41 41
import javax.swing.table.TableColumnModel;
42 42

  
43
import org.gvsig.installer.lib.api.InstallerInfo;
43
import org.gvsig.installer.lib.api.PackageInfo;
44 44
import org.gvsig.installer.swing.api.SwingInstallerLocator;
45 45
import org.gvsig.installer.swing.impl.DefaultSwingInstallerManager;
46 46
import org.gvsig.installer.swing.impl.execution.model.PluginsTableCellRenderer;
......
77 77
    }   
78 78
    
79 79
    
80
    public void addInstallersToExecute(List<InstallerInfo> installerInfosToInstall){
80
    public void addInstallersToExecute(List<PackageInfo> installerInfosToInstall){
81 81
    	((PluginsTableModel)pluginsTable.getModel()).addInstallersToExecute(installerInfosToInstall);      	
82 82
	}
83 83
    
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.impl/src/main/java/org/gvsig/installer/swing/impl/execution/panel/SelectPluginsPanel.java
34 34
import javax.swing.JPanel;
35 35
import javax.swing.JTabbedPane;
36 36

  
37
import org.gvsig.installer.lib.api.InstallerInfo;
37
import org.gvsig.installer.lib.api.PackageInfo;
38 38
import org.gvsig.installer.swing.api.SwingInstallerLocator;
39 39
import org.gvsig.installer.swing.impl.DefaultSwingInstallerManager;
40 40
import org.gvsig.installer.swing.impl.execution.model.PluginsTableModel;
......
78 78
         add(officialTabbedPane, gridBagConstraints);   	
79 79
    }
80 80
    
81
    public void addInstallersToExecute(List<InstallerInfo> installerInfosToInstall){
81
    public void addInstallersToExecute(List<PackageInfo> installerInfosToInstall){
82 82
		officialPluginsTablePanel.addInstallersToExecute(installerInfosToInstall);
83 83
		notOfficialPluginsTablePanel.addInstallersToExecute(installerInfosToInstall);
84 84
	}
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.impl/src/main/java/org/gvsig/installer/swing/impl/execution/model/PluginsTableModel.java
33 33
import javax.swing.event.TableModelListener;
34 34
import javax.swing.table.TableModel;
35 35

  
36
import org.gvsig.installer.lib.api.InstallerInfo;
37
import org.gvsig.installer.lib.api.execution.InstallerExecutionService;
36
import org.gvsig.installer.lib.api.PackageInfo;
37
import org.gvsig.installer.lib.api.execution.InstallPackageService;
38 38
import org.gvsig.installer.swing.impl.DefaultSwingInstallerManager;
39 39

  
40 40
/**
......
42 42
 */
43 43
public class PluginsTableModel implements TableModel{
44 44
	private DefaultSwingInstallerManager swingInstallerManager = null;	
45
	private List<InstallerInfo> installerInfos = null;
45
	private List<PackageInfo> installerInfos = null;
46 46
	private List<Boolean> selected = null;
47 47

  
48
	public PluginsTableModel(DefaultSwingInstallerManager swingInstallerManager, InstallerExecutionService installerExecutionService, boolean isOfficial) {
48
	public PluginsTableModel(DefaultSwingInstallerManager swingInstallerManager, InstallPackageService installerExecutionService, boolean isOfficial) {
49 49
		super();
50 50
		this.swingInstallerManager = swingInstallerManager;
51 51

  
52
		installerInfos = new ArrayList<InstallerInfo>();
52
		installerInfos = new ArrayList<PackageInfo>();
53 53
		selected = new ArrayList<Boolean>();
54
		for (int i=0 ; i<installerExecutionService.getPluginsSize() ; i++){
55
			InstallerInfo installerInfo = installerExecutionService.getPluginInfoAt(i);
54
		for (int i=0 ; i<installerExecutionService.getPackageCount() ; i++){
55
			PackageInfo installerInfo = installerExecutionService.getPackageInfo(i);
56 56
			if (installerInfo.isOfficial() == isOfficial){
57 57
				installerInfos.add(installerInfo);
58 58
				selected.add(false);
......
102 102
	}
103 103

  
104 104
	public Object getValueAt(int rowIndex, int columnIndex) {
105
		InstallerInfo installerInfo = installerInfos.get(rowIndex);
105
		PackageInfo installerInfo = installerInfos.get(rowIndex);
106 106
		switch (columnIndex){
107 107
		case 0:
108 108
			return selected.get(rowIndex);
......
143 143
		selected.add(rowIndex,(Boolean)aValue);
144 144
	}
145 145
	
146
	public void addInstallersToExecute(List<InstallerInfo> installerInfosToInstall){
146
	public void addInstallersToExecute(List<PackageInfo> installerInfosToInstall){
147 147
		for (int i=0 ; i<installerInfos.size() ; i++){
148 148
			if (selected.get(i)){
149 149
				installerInfosToInstall.add(installerInfos.get(i));
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.impl/src/main/java/org/gvsig/installer/swing/impl/execution/wizard/SelectInstallersWizard.java
28 28
package org.gvsig.installer.swing.impl.execution.wizard;
29 29

  
30 30
import java.io.File;
31
import java.io.FileInputStream;
32
import java.io.FileNotFoundException;
33 31

  
34 32
import javax.swing.JOptionPane;
35 33
import javax.swing.JPanel;
36 34

  
37
import org.gvsig.installer.lib.api.execution.InstallerExecutionService;
38
import org.gvsig.installer.lib.api.execution.InstallerExecutionServiceException;
35
import org.gvsig.installer.lib.api.execution.InstallPackageService;
36
import org.gvsig.installer.lib.api.execution.InstallPackageServiceException;
39 37
import org.gvsig.installer.swing.impl.InstallerWizardPanel;
40
import org.gvsig.installer.swing.impl.execution.DefaultInstallerExecutionWizard;
38
import org.gvsig.installer.swing.impl.execution.DefaultInstallPackageWizard;
41 39
import org.gvsig.installer.swing.impl.execution.panel.SelectInstallersPanel;
42 40
import org.slf4j.Logger;
43 41
import org.slf4j.LoggerFactory;
......
46 44
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
47 45
 */
48 46
public class SelectInstallersWizard extends SelectInstallersPanel implements InstallerWizardPanel {
49
	private DefaultInstallerExecutionWizard installerExecutionWizard;
47
	private DefaultInstallPackageWizard installerExecutionWizard;
50 48
	private static final Logger logger = LoggerFactory.getLogger(SelectInstallersWizard.class);
51 49
	
52
	public SelectInstallersWizard(DefaultInstallerExecutionWizard installerExecutionWizard) {
50
	public SelectInstallersWizard(DefaultInstallPackageWizard installerExecutionWizard) {
53 51
		super();
54 52
		this.installerExecutionWizard = installerExecutionWizard;	
55 53
	}
......
68 66
	}
69 67

  
70 68
	public void nextPanel() {
71
		InstallerExecutionService installerExecutionService =
72
			installerExecutionWizard.getInstallerExecutionService();
73
		installerExecutionService.deleteInstallers();
69
		InstallPackageService installerExecutionService =
70
			installerExecutionWizard.getInstallerExecutionService();		
74 71
		try{	
75 72
			if (isStandardSelected()){
76
				installerExecutionService.addInstallersFromInstallDirectory();
73
				installerExecutionService.addBundlesFromDirectory(installerExecutionWizard.getDefaultInstallersDirectory());
77 74
			}else{
78 75
				File file = getSelectedFile();
79 76
				if ((file != null) && (file.exists())){
80
					installerExecutionService.addInstaller(new FileInputStream(getSelectedFile()));
77
					installerExecutionService.addBundle(getSelectedFile().toURI());
81 78
				}else{
82 79
					logger.error("The selected file doesn't exist");
83 80
				}
84 81
			}
85
		}catch(InstallerExecutionServiceException e){
82
		}catch(InstallPackageServiceException e){
86 83
			logger.error("Error adding installer info", e);
87 84
			JOptionPane.showMessageDialog(installerExecutionWizard, 
88 85
					swingInstallerManager.getText("execute_adding_error"));
89
		}catch (FileNotFoundException e) {
90
			logger.error("The selected file doesn't exist", e);
91 86
		}
92 87
	}	
93 88

  
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.impl/src/main/java/org/gvsig/installer/swing/impl/execution/wizard/SelectPluginsWizard.java
29 29

  
30 30
import javax.swing.JPanel;
31 31

  
32
import org.gvsig.installer.lib.api.execution.InstallerExecutionService;
32
import org.gvsig.installer.lib.api.execution.InstallPackageService;
33 33
import org.gvsig.installer.swing.impl.InstallerWizardPanel;
34
import org.gvsig.installer.swing.impl.execution.DefaultInstallerExecutionWizard;
34
import org.gvsig.installer.swing.impl.execution.DefaultInstallPackageWizard;
35 35
import org.gvsig.installer.swing.impl.execution.model.PluginsTableModel;
36 36
import org.gvsig.installer.swing.impl.execution.panel.SelectPluginsPanel;
37 37

  
......
39 39
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
40 40
 */
41 41
public class SelectPluginsWizard extends SelectPluginsPanel implements InstallerWizardPanel {
42
	private DefaultInstallerExecutionWizard installerExecutionWizard;
42
	private DefaultInstallPackageWizard installerExecutionWizard;
43 43
	
44
		public SelectPluginsWizard(DefaultInstallerExecutionWizard installerExecutionWizard) {
44
		public SelectPluginsWizard(DefaultInstallPackageWizard installerExecutionWizard) {
45 45
		super();
46 46
		this.installerExecutionWizard = installerExecutionWizard;
47 47
	}
......
65 65
	}
66 66

  
67 67
	public void updatePanel() {
68
		InstallerExecutionService installerExecutionService = 
68
		InstallPackageService installerExecutionService = 
69 69
			installerExecutionWizard.getInstallerExecutionService();
70 70
		PluginsTableModel officialPluginsTableModel = new PluginsTableModel(swingInstallerManager,
71 71
				installerExecutionService, true);
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.impl/src/main/java/org/gvsig/installer/swing/impl/execution/wizard/ProgressWizard.java
31 31

  
32 32
import javax.swing.JPanel;
33 33

  
34
import org.gvsig.installer.lib.api.InstallerInfo;
35
import org.gvsig.installer.lib.api.creation.InstallerCreationServiceException;
36
import org.gvsig.installer.lib.api.execution.InstallerExecutionService;
37
import org.gvsig.installer.lib.api.execution.InstallerExecutionServiceException;
34
import org.gvsig.installer.lib.api.PackageInfo;
35
import org.gvsig.installer.lib.api.execution.InstallPackageService;
36
import org.gvsig.installer.lib.api.execution.InstallPackageServiceException;
38 37
import org.gvsig.installer.swing.impl.InstallerWizardPanel;
39
import org.gvsig.installer.swing.impl.execution.DefaultInstallerExecutionWizard;
38
import org.gvsig.installer.swing.impl.execution.DefaultInstallPackageWizard;
40 39
import org.gvsig.installer.swing.impl.panel.ProgressPanel;
41 40
import org.slf4j.Logger;
42 41
import org.slf4j.LoggerFactory;
......
45 44
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
46 45
 */
47 46
public class ProgressWizard extends ProgressPanel implements InstallerWizardPanel{
48
	private DefaultInstallerExecutionWizard installerExecutionWizard;
47
	private DefaultInstallPackageWizard installerExecutionWizard;
49 48
	private static final Logger logger = LoggerFactory.getLogger(ProgressWizard.class);
50 49

  
51
	public ProgressWizard(DefaultInstallerExecutionWizard installerExecutionWizard) {
50
	public ProgressWizard(DefaultInstallPackageWizard installerExecutionWizard) {
52 51
		super();
53 52
		this.installerExecutionWizard = installerExecutionWizard;
54 53
	}
......
72 71
	}
73 72

  
74 73
	public void updatePanel() {
75
		InstallerExecutionService installerExecutionService = 
74
		InstallPackageService installerExecutionService = 
76 75
			installerExecutionWizard.getInstallerExecutionService();
77 76

  
78
		List<InstallerInfo> installersToInstall = installerExecutionWizard.getInstallersToInstall();
77
		List<PackageInfo> installersToInstall = installerExecutionWizard.getInstallersToInstall();
79 78
		int progressWidth = 100/installersToInstall.size();
80 79
		int progress = 0;
81 80
		try{
82 81
			for (int i=0 ; i<installersToInstall.size() ; i++){
83 82
				setProgress(progress);
84
				InstallerInfo installerInfo = installersToInstall.get(i);
85
				setPluginText(installerInfo.getName());	
86
				installerExecutionService.setPluginToInstall(installerInfo.getCode());
87
				installerExecutionService.executeInstaller();
83
				PackageInfo installerInfo = installersToInstall.get(i);
84
				setPluginText(installerInfo.getName());				
85
				installerExecutionService.installPackage(installerExecutionWizard.getApplicationDirectory(),
86
						installerInfo);
88 87
				progress = progress + progressWidth;
89 88
			}			
90 89
			//Set the finished text
91 90
			setFinishedText();
92
		}catch(InstallerExecutionServiceException e){
91
		}catch(InstallPackageServiceException e){
93 92
			setExceptionText(e);
94 93
		} 
95 94
		setProgress(100);
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.impl/src/main/java/org/gvsig/installer/swing/impl/creation/DefaultInstallerCreationWizard.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.swing.impl.creation;
29

  
30
import java.awt.BorderLayout;
31
import java.io.File;
32
import java.io.OutputStream;
33

  
34
import javax.swing.ImageIcon;
35

  
36
import jwizardcomponent.DefaultJWizardComponents;
37

  
38
import org.gvsig.installer.lib.api.InstallerLocator;
39
import org.gvsig.installer.lib.api.creation.InstallerCreationService;
40
import org.gvsig.installer.lib.api.creation.InstallerCreationServiceException;
41
import org.gvsig.installer.swing.api.creation.InstallerCreationWizard;
42
import org.gvsig.installer.swing.impl.InstallerWizardContainer;
43
import org.gvsig.installer.swing.impl.creation.wizard.AdvancedModeSelectionWizard;
44
import org.gvsig.installer.swing.impl.creation.wizard.AntScriptWizard;
45
import org.gvsig.installer.swing.impl.creation.wizard.PluginDescriptionWizard;
46
import org.gvsig.installer.swing.impl.creation.wizard.ProgressWizard;
47
import org.gvsig.installer.swing.impl.creation.wizard.SelectFilesWizard;
48
import org.gvsig.installer.swing.impl.creation.wizard.SelectOutputFileWizard;
49
import org.gvsig.installer.swing.impl.creation.wizard.SelectPlugintoInstallWizard;
50
import org.gvsig.installer.swing.impl.wizard.WizardPanelWithLogo;
51
import org.gvsig.tools.locator.LocatorException;
52

  
53
/**
54
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
55
 */
56
public class DefaultInstallerCreationWizard extends InstallerCreationWizard{
57
	private WizardPanelWithLogo wizardPanelWithLogo = null;
58
	private InstallerCreationService installercreationService = null;
59
	private OutputStream outputStream = null;
60

  
61
	//Wizards
62
	private AdvancedModeSelectionWizard advancedModeSelectionWizard = null;
63
	private AntScriptWizard antScriptWizard = null;
64
	private PluginDescriptionWizard pluginDescriptionWizard = null;
65
	private ProgressWizard progressWizard = null;
66
	private SelectFilesWizard selectFilesWizard = null;
67
	private SelectOutputFileWizard selectOutputFileWizard = null;
68
	private SelectPlugintoInstallWizard selectPlugintoInstallWizard = null;
69

  
70
	public DefaultInstallerCreationWizard() throws LocatorException, InstallerCreationServiceException
71
	{		
72
		wizardPanelWithLogo = new WizardPanelWithLogo(new ImageIcon(getClass().getClassLoader().getResource("images/createplugininstallicon.png").getFile()));	
73

  
74
		advancedModeSelectionWizard = new AdvancedModeSelectionWizard(this);
75
		antScriptWizard = new AntScriptWizard(this);
76
		pluginDescriptionWizard = new PluginDescriptionWizard(this);
77
		progressWizard = new ProgressWizard(this);
78
		selectFilesWizard = new SelectFilesWizard(this);
79
		selectOutputFileWizard = new SelectOutputFileWizard(this);
80
		selectPlugintoInstallWizard = new SelectPlugintoInstallWizard(this);
81

  
82
		addWizards();
83

  
84
		this.setLayout(new BorderLayout());
85
		this.add(wizardPanelWithLogo, BorderLayout.CENTER);
86
		
87
		installercreationService = InstallerLocator.getInstallerManager().getInstallerCreationService();			
88
	}
89

  
90
	private void addWizards(){
91
		getWizardComponents().addWizardPanel(
92
				new InstallerWizardContainer(getWizardComponents(), 
93
						selectPlugintoInstallWizard));	
94
		getWizardComponents().addWizardPanel(
95
				new InstallerWizardContainer(getWizardComponents(), 
96
						pluginDescriptionWizard));	
97
		getWizardComponents().addWizardPanel(
98
				new InstallerWizardContainer(getWizardComponents(), 
99
						advancedModeSelectionWizard));	
100
		addLastWizards();		
101
	}
102

  
103
	private void addLastWizards(){
104
		getWizardComponents().addWizardPanel(
105
				new InstallerWizardContainer(getWizardComponents(), 
106
						selectOutputFileWizard));	
107
		getWizardComponents().addWizardPanel(
108
				new InstallerWizardContainer(getWizardComponents(), 
109
						progressWizard));	
110
	}
111
	
112
	private void addAdvancedWizards(){
113
		getWizardComponents().addWizardPanel(
114
				new InstallerWizardContainer(getWizardComponents(), 
115
						selectFilesWizard));	
116
		getWizardComponents().addWizardPanel(
117
				new InstallerWizardContainer(getWizardComponents(), 
118
						antScriptWizard));	
119
	}
120

  
121

  
122
	private DefaultJWizardComponents getWizardComponents()
123
	{
124
		return wizardPanelWithLogo.getWizardComponents();
125
	}
126

  
127
	public void setNextButtonEnabled(boolean isEnabled){
128
		getWizardComponents().getNextButton().setEnabled(isEnabled);
129
	}
130

  
131
	@Override
132
	public void setApplicationDirectory(File applicationDirectory) throws InstallerCreationServiceException {
133
		installercreationService.setApplicationDirectory(applicationDirectory);
134
		selectPlugintoInstallWizard.setPluginsDirectory(installercreationService);	
135
		selectFilesWizard.setPluginsDirectory(applicationDirectory);
136
	}	
137

  
138

  
139

  
140
	public void setAdvancedModeSelected(boolean advancedModeSelected) {
141
		for (int i=getWizardComponents().getWizardPanelList().size()-1 ; i>=3 ; i--){
142
			getWizardComponents().removeWizardPanel(i);
143
		}		
144
		if (advancedModeSelected){
145
			addAdvancedWizards();
146
		}
147
		addLastWizards();
148
	}
149
	
150

  
151
	/**
152
	 * @return the installercreationService
153
	 */
154
	public InstallerCreationService getInstallerCreationService() {
155
		return installercreationService;
156
	}
157

  
158
	/**
159
	 * @return the outputStream
160
	 */
161
	public OutputStream getOutputStream() {
162
		return outputStream;
163
	}
164

  
165
	/**
166
	 * @param outputStream the outputStream to set
167
	 */
168
	public void setOutputStream(OutputStream outputStream) {
169
		this.outputStream = outputStream;
170
	}
171
}
172

  
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.impl/src/main/java/org/gvsig/installer/swing/impl/creation/DefaultMakePluginPackageWizard.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.swing.impl.creation;
29

  
30
import java.awt.BorderLayout;
31
import java.io.File;
32
import java.io.OutputStream;
33

  
34
import javax.swing.ImageIcon;
35

  
36
import jwizardcomponent.DefaultJWizardComponents;
37

  
38
import org.gvsig.installer.lib.api.InstallerLocator;
39
import org.gvsig.installer.lib.api.PackageInfo;
40
import org.gvsig.installer.lib.api.creation.MakePluginPackageService;
41
import org.gvsig.installer.lib.api.creation.MakePluginPackageServiceException;
42
import org.gvsig.installer.swing.api.creation.MakePluginPackageWizard;
43
import org.gvsig.installer.swing.impl.InstallerWizardContainer;
44
import org.gvsig.installer.swing.impl.creation.wizard.AdvancedModeSelectionWizard;
45
import org.gvsig.installer.swing.impl.creation.wizard.AntScriptWizard;
46
import org.gvsig.installer.swing.impl.creation.wizard.PluginDescriptionWizard;
47
import org.gvsig.installer.swing.impl.creation.wizard.ProgressWizard;
48
import org.gvsig.installer.swing.impl.creation.wizard.SelectFilesWizard;
49
import org.gvsig.installer.swing.impl.creation.wizard.SelectOutputFileWizard;
50
import org.gvsig.installer.swing.impl.creation.wizard.SelectPlugintoInstallWizard;
51
import org.gvsig.installer.swing.impl.wizard.WizardPanelWithLogo;
52
import org.gvsig.tools.locator.LocatorException;
53

  
54
/**
55
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
56
 */
57
public class DefaultMakePluginPackageWizard extends MakePluginPackageWizard{
58
	private WizardPanelWithLogo wizardPanelWithLogo = null;
59
	private MakePluginPackageService makePluginPackageService = null;
60
	private OutputStream outputStream = null;
61
	private File pluginsDirectory = null;
62
	private PackageInfo selectedPackageInfo = null;
63

  
64
	//Wizards
65
	private AdvancedModeSelectionWizard advancedModeSelectionWizard = null;
66
	private AntScriptWizard antScriptWizard = null;
67
	private PluginDescriptionWizard pluginDescriptionWizard = null;
68
	private ProgressWizard progressWizard = null;
69
	private SelectFilesWizard selectFilesWizard = null;
70
	private SelectOutputFileWizard selectOutputFileWizard = null;
71
	private SelectPlugintoInstallWizard selectPlugintoInstallWizard = null;
72

  
73
	public DefaultMakePluginPackageWizard(File applicationDirectory) throws LocatorException, MakePluginPackageServiceException
74
	{		
75
		super(applicationDirectory);
76
		wizardPanelWithLogo = new WizardPanelWithLogo(new ImageIcon(getClass().getClassLoader().getResource("images/createplugininstallicon.png").getFile()));	
77

  
78
		advancedModeSelectionWizard = new AdvancedModeSelectionWizard(this);
79
		antScriptWizard = new AntScriptWizard(this);
80
		pluginDescriptionWizard = new PluginDescriptionWizard(this);
81
		progressWizard = new ProgressWizard(this);
82
		selectFilesWizard = new SelectFilesWizard(this);
83
		selectOutputFileWizard = new SelectOutputFileWizard(this);
84
		selectPlugintoInstallWizard = new SelectPlugintoInstallWizard(this);
85

  
86
		addWizards();
87

  
88
		this.setLayout(new BorderLayout());
89
		this.add(wizardPanelWithLogo, BorderLayout.CENTER);
90
		
91
		pluginsDirectory = new File(applicationDirectory.getAbsolutePath() + File.separator + "gvSIG" + File.separator + "extensiones");
92
		
93
		makePluginPackageService = InstallerLocator.getInstallerManager().getMakePluginPackageService(pluginsDirectory);
94
		selectPlugintoInstallWizard.setPluginsDirectory(makePluginPackageService);	
95
		selectFilesWizard.setApplicationDirectory(applicationDirectory);
96
	}
97

  
98
	private void addWizards(){
99
		getWizardComponents().addWizardPanel(
100
				new InstallerWizardContainer(getWizardComponents(), 
101
						selectPlugintoInstallWizard));	
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff