Revision 34769

View differences:

tags/org.gvsig.installer/org.gvsig.installer-1.0.0/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/org.gvsig.installer/org.gvsig.installer-1.0.0/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/org.gvsig.installer/org.gvsig.installer-1.0.0/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/org.gvsig.installer/org.gvsig.installer-1.0.0/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/org.gvsig.installer/org.gvsig.installer-1.0.0/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/org.gvsig.installer/org.gvsig.installer-1.0.0/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.InstallPackageWizard;
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 InstallPackageWizard 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/org.gvsig.installer/org.gvsig.installer-1.0.0/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.main.MainInstallerLibrary;
35
import org.gvsig.installer.swing.api.execution.InstallPackageWizardException;
36
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer;
37
import org.gvsig.tools.locator.LocatorException;
38

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

  
45
    public static void main(String[] args) throws LocatorException,
46
        InstallPackageServiceException, InstallPackageWizardException,
47
        IOException {
48
        new DefaultLibrariesInitializer().fullInitialize();
49
        MainInstallerLibrary mainInstallerLibrary = new MainInstallerLibrary();
50
        mainInstallerLibrary.initialize();
51
        mainInstallerLibrary.postInitialize();
52

  
53
        new InstallPackageWizardFromDefaultDirectoryLauncher();
54
    }
55

  
56
    public InstallPackageWizardFromDefaultDirectoryLauncher()
57
        throws LocatorException, InstallPackageWizardException,
58
        InstallPackageServiceException, IOException {
59

  
60
        InstallPackageServiceFrame frame =
61
            new InstallPackageServiceFrame(getApplicationFolder(),
62
                getPluginsFolder(), getInstallFolder());
63
        frame.installFromDefaultDirectory();
64
        frame.setVisible(true);
65
    }
66
}
0 67

  
tags/org.gvsig.installer/org.gvsig.installer-1.0.0/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.main.MainInstallerLibrary;
35
import org.gvsig.installer.swing.api.execution.InstallPackageWizardException;
36
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer;
37
import org.gvsig.tools.locator.LocatorException;
38

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

  
44
    public static void main(String[] args) throws LocatorException,
45
        InstallPackageServiceException, InstallPackageWizardException,
46
        IOException {
47
        new DefaultLibrariesInitializer().fullInitialize();
48
        MainInstallerLibrary mainInstallerLibrary = new MainInstallerLibrary();
49
        mainInstallerLibrary.initialize();
50
        mainInstallerLibrary.postInitialize();
51

  
52
        new InstallPackageWizardLauncher();
53
    }
54

  
55
    public InstallPackageWizardLauncher() throws LocatorException,
56
        InstallPackageWizardException, InstallPackageServiceException,
57
        IOException {
58

  
59
        InstallPackageServiceFrame frame =
60
            new InstallPackageServiceFrame(getApplicationFolder(),
61
                getPluginsFolder(), getInstallFolder());
62
        frame.setVisible(true);
63
    }
64
}
0 65

  
tags/org.gvsig.installer/org.gvsig.installer-1.0.0/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.main.MainInstallerLibrary;
35
import org.gvsig.installer.swing.api.creation.MakePluginPackageWizardException;
36
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer;
37
import org.gvsig.tools.locator.LocatorException;
38

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

  
44
    public static void main(String[] args) throws LocatorException,
45
        MakePluginPackageWizardException, IOException,
46
        MakePluginPackageServiceException {
47
        new DefaultLibrariesInitializer().fullInitialize();
48
        MainInstallerLibrary mainInstallerLibrary = new MainInstallerLibrary();
49
        mainInstallerLibrary.initialize();
50
        mainInstallerLibrary.postInitialize();
51

  
52
        new MakePluginPackageWizardLauncher();
53
    }
54

  
55
    public MakePluginPackageWizardLauncher() throws LocatorException,
56
        MakePluginPackageWizardException, IOException,
57
        MakePluginPackageServiceException {
58

  
59
        MakePluginPackageFrame frame =
60
            new MakePluginPackageFrame(getApplicationFolder(),
61
                getPluginsFolder(), getInstallFolder());
62
        frame.setVisible(true);
63
    }
64

  
65
}
0 66

  
tags/org.gvsig.installer/org.gvsig.installer-1.0.0/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/org.gvsig.installer/org.gvsig.installer-1.0.0/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/org.gvsig.installer/org.gvsig.installer-1.0.0/org.gvsig.installer.main/src/main/java/org/gvsig/installer/main/MainInstallerLibrary.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 org.gvsig.tools.library.AbstractLibrary;
31
import org.gvsig.tools.library.LibraryException;
32

  
33
/**
34
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
35
 */
36
public class MainInstallerLibrary extends AbstractLibrary {
37

  
38
	public MainInstallerLibrary() {
39
		super(MainInstallerLibrary.class, TYPE.IMPL);
40
	}
41

  
42
    @Override
43
    protected void doInitialize() throws LibraryException {
44

  
45
    }
46

  
47
    @Override
48
    protected void doPostInitialize() throws LibraryException {
49

  
50
    }
51
}
0 52

  
tags/org.gvsig.installer/org.gvsig.installer-1.0.0/org.gvsig.installer.main/src/main/resources/application/gvSIG/extensiones/org.gvsig.plugin1/package.info
1
code=org.gvsig.myplugin
2
name=myplugin
3
description=Test
4
version=1.0.0
5
build=2019019
6
state=RC1
7
oficial=true
8
type=plugin
9
state=devel
10
operating-system=all
11
architecture=all
12
gvSIG-version=2.0.0
13
java-versiona-version=j1_5
tags/org.gvsig.installer/org.gvsig.installer-1.0.0/org.gvsig.installer.main/src/main/resources/application/gvSIG/extensiones/org.gvsig.plugin2/package.info
1
code=org.gvsig.myplugin2
2
name=myplugin
3
description=Test
4
version=1.0.0
5
build=2019019
6
state=RC1
7
oficial=true
8
type=plugin
9
state=devel
10
operating-system=all
11
architecture=all
12
gvSIG-version=2.0.0
13
java-versiona-version=j1_5
tags/org.gvsig.installer/org.gvsig.installer-1.0.0/org.gvsig.installer.main/src/main/resources/application/gvSIG/extensiones/org.gvsig.plugin3/package.info
1
code=org.gvsig.plugin3
2
name=myplugin
3
description=Test
4
version=1.0.0
5
build=2019019
6
state=RC1
7
oficial=true
8
type=plugin
9
state=devel
10
operating-system=all
11
architecture=all
12
gvSIG-version=2.0.0
13
java-versiona-version=j1_5
tags/org.gvsig.installer/org.gvsig.installer-1.0.0/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.0</version>
10
	</parent>
11
	<dependencies>
12
		<dependency>
13
			<groupId>org.gvsig</groupId>
14
			<artifactId>org.gvsig.installer.lib.api</artifactId>
15
			<version>1.0.0</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.0</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.0</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.0</version>
37
		</dependency>
38
		<dependency>
39
			<groupId>org.gvsig</groupId>
40
			<artifactId>org.gvsig.installer.swing.api</artifactId>
41
			<version>1.0.0</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.0</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
    <properties>
61
        <super.parent.dir>${basedir}/..</super.parent.dir>
62
    </properties>
63
</project>
0 64

  
tags/org.gvsig.installer/org.gvsig.installer-1.0.0/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/org.gvsig.installer/org.gvsig.installer-1.0.0/org.gvsig.installer.lib/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

  
4
	<modelVersion>4.0.0</modelVersion>
5
	<artifactId>org.gvsig.installer.lib</artifactId>
6
	<packaging>pom</packaging>
7
	<name>org.gvsig.installer.lib</name>
8
	<parent>
9
		<groupId>org.gvsig</groupId>
10
		<artifactId>org.gvsig.installer</artifactId>
11
		<version>1.0.0</version>
12
	</parent>
13
	<modules>
14
		<module>org.gvsig.installer.lib.api</module>
15
		<module>org.gvsig.installer.lib.spi</module>
16
		<module>org.gvsig.installer.lib.impl</module>
17
	</modules>
18
    <properties>
19
        <super.parent.dir>${basedir}/..</super.parent.dir>
20
    </properties>
21
</project>
0 22

  
tags/org.gvsig.installer/org.gvsig.installer-1.0.0/org.gvsig.installer.lib/org.gvsig.installer.lib.api/src/main/java/org/gvsig/installer/lib/api/InstallerManager.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.lib.api;
29

  
30
import java.io.File;
31
import java.text.MessageFormat;
32

  
33
import org.gvsig.installer.lib.api.creation.MakePluginPackageService;
34
import org.gvsig.installer.lib.api.creation.MakePluginPackageServiceException;
35
import org.gvsig.installer.lib.api.execution.InstallPackageService;
36
import org.gvsig.installer.lib.api.execution.InstallPackageServiceException;
37
import org.gvsig.tools.service.Manager;
38

  
39
/**
40
 * <p>
41
 * This manager is used to register and create the services that are used to
42
 * manage the creation and the execution of installers. An installer is a file
43
 * called <b>bundle</b> that is composed of a set <b>packages</b>.
44
 * </p>
45
 * <p>
46
 * A package has some information that is defined by the {@link PackageInfo}
47
 * class and is composed of a set of attributes. One of these attributes, the
48
 * type, denotes if the package is a plugin, theme, translation, etc.
49
 * </p>
50
 * <p>
51
 * In practice a bundle is just a compressed zip file that has a compressed zip
52
 * file for every package to install. The structure of a bundle file with two
53
 * packages of type plugin could be:
54
 * </p>
55
 * 
56
 * <pre>
57
 * - bundle (compressed file)
58
 * 		- org.gvsig.plugin1-1_0_0-23 (compressed file)
59
 * 			- org.gvsig.plugin1
60
 * 			  	- package.info   			
61
 *  	- org.gvsig.plugin2-2_0_1-35 (compressed file)
62
 *  		- org.gvsig.plugin1
63
 *  			- package.info
64
 * </pre>
65
 * <p>
66
 * <b>bundle</b> is the compressed file that contains a zip entry for every
67
 * package to install. The name of the zip entry follows next pattern:
68
 * </p>
69
 * 
70
 * <pre>
71
 * 		[package code]-[version]-[build]
72
 * </pre>
73
 * <p>
74
 * Every zip entry contains a main folder inside that contains all the package
75
 * files that are used in the installation process. Depending of the type of
76
 * packages, the information inside this folder can be different, but all the
77
 * types of packages have to have the <b>package.info</b>file that has all the
78
 * package information. To see the <b>package.info</b> description see
79
 * {@link PackageInfo}.
80
 * <p>
81
 * </p>
82
 * The services that offers this managers are basically two: the creation of
83
 * bundles for just one package of plugin type and a service for the
84
 * installation of packages from a bundle.
85
 * </p>
86
 * 
87
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
88
 */
89
public interface InstallerManager extends Manager {
90

  
91
    /**
92
     * Package state default values.
93
     */
94
    public static interface STATE {
95

  
96
        static final String DEVEL = "devel";
97
        static final String TESTING = "testing";
98
        static final String PILOT = "pilot";
99
        static final String PROTOTYPE = "prototype";
100
        static final String ALPHA = "alpha";
101
        static final String BETA = "beta";
102
        static final String RC = "RC";
103
        static final String FINAL = "final";
104
    }
105

  
106
    /**
107
     * Supported operating system default values.
108
     */
109
    public static interface OS {
110

  
111
        static final String ALL = "all";
112
        static final String LINUX = "lin";
113
        static final String WINDOWS = "win";
114
        static final String OSX_10_4 = "osx_10_4";
115
        static final String OSX_10_5 = "osx_10_5";
116
        static final String OSX_10_6 = "osx_10_6";
117
    }
118

  
119
    /**
120
     * Supported architecture default values.
121
     */
122
    public static interface ARCH {
123

  
124
        static final String ALL = "all";
125
        static final String X86 = "x86";
126
        static final String X86_64 = "x86_64";
127
    }
128

  
129
    /**
130
     * Supported Java virtual machine version default values.
131
     */
132
    public static interface JVM {
133

  
134
        static final String J1_5 = "j1_5";
135
        static final String J1_6 = "j1_6";
136
    }
137

  
138
    /**
139
     * Fields into the bundle file name message format.
140
     * 
141
     * @see InstallerManager#getPackageSetNameFormat()
142
     * @see InstallerManager#setPackageSetNameFormat(String)
143
     */
144
    public static interface PACKAGE_FILE_NAME_FIELDS {
145

  
146
        static final int GVSIG_VERSION = 0;
147
        static final int NAME = 1;
148
        static final int VERSION = 2;
149
        static final int BUILD = 3;
150
        static final int STATE = 4;
151
        static final int OS = 5;
152
        static final int ARCH = 6;
153
        static final int JVM = 7;
154
    }
155

  
156
    /**
157
     * It registers a class that implements the service for the creation of
158
     * bundle that contains inside a package of type plugin. The registered
159
     * class
160
     * have to implement the {@link MakePluginPackageService} interface.
161
     * 
162
     * @param clazz
163
     *            class that implements the {@link MakePluginPackageService}
164
     *            interface.
165
     */
166
    public void registerMakePluginPackageService(
167
        Class<? extends MakePluginPackageService> clazz);
168

  
169
    /**
170
     * It creates and returns an object that is used to create a bundle
171
     * that contains inside a package of type plugin. All the parameters
172
     * are set using the {@link MakePluginPackageService} interface. *
173
     * 
174
     * @return
175
     *         an object that is used to create a plugin installer
176
     * @throws MakePluginPackageServiceException
177
     *             when there is a problem creating the service
178
     */
179
    public MakePluginPackageService getMakePluginPackageService(
180
        File pluginsDirectory) throws MakePluginPackageServiceException;
181

  
182
    /**
183
     * Returns a list of package infos for the already installed plugins.
184
     * 
185
     * @param pluginsDirectory
186
     *            where to look for the installed plugins
187
     * @return the list of package infos for the already installed plugins
188
     * @throws MakePluginPackageServiceException
189
     *             if there is an error loading
190
     *             the information of the installed plugins
191
     */
192
    public PackageInfo[] getInstalledPackages(File pluginsDirectory)
193
        throws MakePluginPackageServiceException;
194

  
195
    /**
196
     * Returns the package bundle file name format.
197
     * <p>
198
     * The string has to use a suitable {@link MessageFormat} format, and the
199
     * available field numbers are the ones defined in the
200
     * BUNDLE_FILE_NAME_FIELDS interface.
201
     * </p>
202
     * 
203
     * @return the package bundle file name format.
204
     */
205
    public String getPackageSetNameFormat();
206

  
207
    /**
208
     * Sets the package bundle file name format.
209
     * 
210
     * @see InstallerManager#getPackageSetNameFormat()
211
     * @param packageBundleNameFormat
212
     *            the package bundle file name format.
213
     */
214
    public void setPackageSetNameFormat(String packageBundleNameFormat);
215

  
216
    /**
217
     * Returns the name of the package set file for a given package info.
218
     * 
219
     * @param info
220
     *            of the plugin
221
     * @return the name of the package set file
222
     */
223
    public String getPackageSetFileName(PackageInfo info);
224

  
225
    /**
226
     * Returns the name of the package file for a given package info.
227
     * 
228
     * @param info
229
     *            of the plugin
230
     * @return the name of the package file
231
     */
232
    public String getPackageFileName(PackageInfo info);
233

  
234
    /**
235
     * Returns the name of the package index file for a given package info.
236
     * 
237
     * @param info
238
     *            of the plugin
239
     * @return the name of the package index file
240
     */
241
    public String getPackageIndexFileName(PackageInfo info);
242

  
243
    /**
244
     * It registers a class that implements the service for the installation
245
     * of a package that is inside a bundle. This class has to implement
246
     * the {@link InstallPackageService} interface.
247
     * 
248
     * @param clazz
249
     *            class that implements the {@link InstallPackageService}
250
     *            interface.
251
     */
252
    public void registerInstallPackageService(
253
        Class<? extends InstallPackageService> clazz);
254

  
255
    /**
256
     * It creates and returns an object that is used to install a package
257
     * in gvSIG. All the parameters are set using the
258
     * {@link InstallPackageService} interface.
259
     * 
260
     * @return
261
     *         an object that is used to install the package.
262
     * @throws InstallPackageServiceException
263
     *             when there is a problem creating the service.
264
     */
265
    public InstallPackageService getInstallPackageService()
266
        throws InstallPackageServiceException;
267

  
268
    /**
269
     * Returns the default extensions of the package files.
270
     * 
271
     * @return the default extensions of the package files
272
     */
273
    public String getDefaultPackageFileExtension();
274

  
275
    /**
276
     * Returns the default extensions of the package set files.
277
     * 
278
     * @return the default extensions of the package set files
279
     */
280
    public String getDefaultPackageSetFileExtension();
281
}
0 282

  
tags/org.gvsig.installer/org.gvsig.installer-1.0.0/org.gvsig.installer.lib/org.gvsig.installer.lib.api/src/main/java/org/gvsig/installer/lib/api/InstallerLocator.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.lib.api;
29

  
30
import org.gvsig.tools.locator.AbstractLocator;
31
import org.gvsig.tools.locator.Locator;
32
import org.gvsig.tools.locator.LocatorException;
33

  
34
/**
35
 * This Locator provides the entry point for the gvSIG {@link InstallerManager}
36
 * 
37
 * @see {@link Locator}
38
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
39
 */
40
public class InstallerLocator extends AbstractLocator {
41

  
42
    private static final String LOCATOR_NAME = "InstallerLocator";
43
    /**
44
     * InstallerManager name used by the locator to access the instance
45
     */
46
    public static final String INSTALLER_MANAGER_NAME = "InstallerManager";
47
    private static final String INSTALLER_MANAGER_DESCRIPTION =
48
        "InstallerManager of gvSIG";
49

  
50
    /**
51
     * Unique instance.
52
     */
53
    private static final InstallerLocator instance = new InstallerLocator();
54

  
55
    /**
56
     * @see Locator#getLocatorName()
57
     */
58
    public String getLocatorName() {
59
        return LOCATOR_NAME;
60
    }
61

  
62
    /**
63
     * Return a reference to {@link InstallerManager}.
64
     * 
65
     * @return a reference to InstallerManager
66
     * @throws LocatorException
67
     *             if there is no access to the class or the class cannot be
68
     *             instantiated
69
     * @see Locator#get(String)
70
     */
71
    public static InstallerManager getInstallerManager()
72
        throws LocatorException {
73
        return (InstallerManager) getInstance().get(INSTALLER_MANAGER_NAME);
74
    }
75

  
76
    /**
77
     * Return the singleton instance.
78
     * 
79
     * @return the singleton instance
80
     */
81
    public static InstallerLocator getInstance() {
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff