Statistics
| Revision:

root / org.gvsig.legend.urbanhorizontalsignage / trunk / org.gvsig.legend.urbanhorizontalsignage.lib / org.gvsig.legend.urbanhorizontalsignage.lib.impl / src / main / java / org / gvsig / legend / urbanhorizontalsignage / lib / impl / UrbanHorizontalSignageLibraryImpl.java @ 5087

History | View | Annotate | Download (3.33 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright ? 2007-2015 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 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
 * 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

    
25
package org.gvsig.legend.urbanhorizontalsignage.lib.impl;
26

    
27
import java.io.InputStream;
28
import java.util.Map;
29
import org.gvsig.fmap.mapcontext.MapContextLibrary;
30
import org.gvsig.fmap.mapcontext.MapContextLocator;
31
import org.gvsig.fmap.mapcontext.MapContextManager;
32
import org.gvsig.legend.urbanhorizontalsignage.lib.api.UrbanHorizontalSignageLibrary;
33
import org.gvsig.legend.urbanhorizontalsignage.lib.api.UrbanHorizontalSignageLocator;
34
import org.gvsig.symbology.impl.SymbologyDefaultImplLibrary;
35
import org.gvsig.tools.ToolsLocator;
36
import org.gvsig.tools.dynobject.DynStruct;
37
import org.gvsig.tools.library.AbstractLibrary;
38
import org.gvsig.tools.library.LibraryException;
39
import org.gvsig.tools.persistence.PersistenceManager;
40

    
41
public class UrbanHorizontalSignageLibraryImpl extends AbstractLibrary {
42

    
43
    @Override
44
    public void doRegistration() {
45
        registerAsImplementationOf(UrbanHorizontalSignageLibrary.class);
46
        this.require(MapContextLibrary.class);
47
        this.require(SymbologyDefaultImplLibrary.class);
48
    }
49

    
50
    @Override
51
    protected void doInitialize() throws LibraryException {
52
        UrbanHorizontalSignageLocator.registerUrbanHorizontalSignageManager(DefaultUrbanHorizontalSignageManager.class);
53
        MapContextManager mcmanager = MapContextLocator.getMapContextManager();
54
        mcmanager.registerLegend("UrbanHorizontalSignageLegend", DefaultUrbanHorizontalSignageLegend.class);
55
    }
56

    
57
    @Override
58
    protected void doPostInitialize() throws LibraryException {
59
        PersistenceManager persistenceManager = ToolsLocator.getPersistenceManager();
60
        InputStream is = this.getClass().getResourceAsStream("UrbanHorizontalSignagePersistence.xml");
61
        Map<String,DynStruct> definitions;
62
        try {
63
            definitions = ToolsLocator.getDynObjectManager().importDynClassDefinitions(is, this.getClass().getClassLoader());
64
        } catch (Exception ex) {
65
            throw new LibraryException(this.getClass(), ex);
66
        }
67
        
68
        persistenceManager.addDefinition(
69
                DefaultUrbanHorizontalSignageLegend.class,
70
                "DefaultUrbanHorizontalSignageLegend",
71
                definitions,
72
                null,
73
                null);
74
        persistenceManager.addDefinition(
75
                UrbanHorizontalSignageSymbol.class,
76
                "UrbanHorizontalSignageSymbol",
77
                definitions,
78
                null,
79
                null);
80
    }
81

    
82
}