Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.framework / org.gvsig.andami / src / main / java / org / gvsig / andami / installer / icontheme / IconThemeInstallerFactory.java @ 43067

History | View | Annotate | Download (2.71 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.andami.installer.icontheme;
25

    
26
import org.gvsig.installer.lib.spi.InstallerProviderLocator;
27
import org.gvsig.tools.ToolsLocator;
28
import org.gvsig.tools.dynobject.DynClass;
29
import org.gvsig.tools.dynobject.DynObject;
30
import org.gvsig.tools.dynobject.DynObjectManager;
31
import org.gvsig.tools.service.spi.AbstractProviderFactory;
32
import org.gvsig.tools.service.spi.Provider;
33
import org.gvsig.tools.service.spi.ProviderManager;
34
import org.gvsig.tools.service.spi.ProviderServices;
35
import org.gvsig.tools.util.Callable;
36

    
37
public class IconThemeInstallerFactory extends
38
        AbstractProviderFactory {
39

    
40
    public static final String INSTALLER_NAME = "icontheme";
41
    public static final String INSTALLER_DESCRIPTION = "";
42

    
43
    private DynClass dynclass;
44

    
45
    @Override
46
    protected DynClass createParametersDynClass() {
47
        if ( dynclass == null ) {
48
            initialize();
49
        }
50
        return dynclass;
51
    }
52

    
53
    @Override
54
    protected Provider doCreate(DynObject parameters, ProviderServices services) {
55
        return new IconThemeInstaller(services);
56
    }
57

    
58
    @Override
59
    public void initialize() {
60
        if ( dynclass == null ) {
61
            DynObjectManager dynObjectManager = ToolsLocator.getDynObjectManager();
62
            dynclass = dynObjectManager.createDynClass(
63
                    INSTALLER_NAME,
64
                    INSTALLER_DESCRIPTION
65
            );
66
            dynObjectManager.add(dynclass);
67
        }
68
    }
69

    
70
    public static class RegisterIconThemeInstaller implements Callable {
71

    
72
        @Override
73
        public Object call() throws Exception {
74
            ProviderManager providerManager = InstallerProviderLocator.getProviderManager();
75
            providerManager.addProviderFactory(new IconThemeInstallerFactory());
76
            return true;
77
        }
78
    }
79
}