Revision 37746

View differences:

tags/v2_0_0_Build_2043/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/pom.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
4
		 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5

  
6
	<modelVersion>4.0.0</modelVersion>
7
	<artifactId>org.gvsig.exportto.lib</artifactId>
8
	<packaging>pom</packaging>
9
	<name>org.gvsig.exportto.lib</name>
10
	<parent>
11
		<groupId>org.gvsig</groupId>
12
		<artifactId>org.gvsig.exportto</artifactId>
13
		<version>1.0.0-SNAPSHOT</version>
14
	</parent>
15

  
16
	<modules>
17
		<module>org.gvsig.exportto.lib.api</module>
18
		<module>org.gvsig.exportto.lib.impl</module>
19
	</modules>
20
</project>
0 21

  
tags/v2_0_0_Build_2043/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.impl/src/test/resources/README.txt
1
Put into this folder the resources needed by your test classes.
2

  
3
This folder is added to the Tests classpath, so you can load any resources 
4
through the ClassLoader.
5

  
6
By default, in this folder you can find an example of log4j configuration,
7
prepared to log messages through the console, so logging works when you
8
run your tests classes.
0 9

  
tags/v2_0_0_Build_2043/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.impl/src/test/resources/log4j.xml
1
<?xml version="1.0" encoding="ISO-8859-1" ?>
2
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
3

  
4
<!-- 
5
Log4J configuration file for unit tests execution.
6
 -->
7
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
8

  
9
	<!-- Appender configuration to show logging messages through the console -->
10
	<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
11
		<layout class="org.apache.log4j.PatternLayout">
12
			<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n  %m%n" />
13
		</layout>
14
	</appender>
15

  
16
	<!-- 
17
	Activate logging messages of DEBUG level of higher only for the
18
	org.gvsig.tools packages.
19
	You can put full classes names or packages instead, to configure
20
	logging for all the classes and subpackages of the package.
21
	-->
22
	<category name="org.gvsig.tools">
23
		<priority value="DEBUG" />
24
	</category>
25
	<category name="org.gvsig.exportto">
26
		<priority value="DEBUG" />
27
	</category>
28

  
29
	<!-- 
30
	By default, show only logging messages of INFO level or higher, 
31
	through the previously configured CONSOLE appender. 
32
	-->
33
	<root>
34
		<priority value="INFO" />
35
		<appender-ref ref="CONSOLE" />
36
	</root>
37
</log4j:configuration>
0 38

  
tags/v2_0_0_Build_2043/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.impl/src/test/java/org/gvsig/exportto/impl/DefaultExporttoManagerTest.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
package org.gvsig.exportto.impl;
23

  
24
import org.gvsig.exportto.ExporttoManager;
25
import org.gvsig.exportto.ExporttoManagerTest;
26

  
27
/**
28
 * {@link ExporttoManager} API compatibility tests for the
29
 * {@link DefaultExporttoManager} implementation.
30
 * 
31
 * @author gvSIG Team
32
 * @version $Id$
33
 */
34
public class DefaultExporttoManagerTest extends ExporttoManagerTest {
35

  
36
    // Nothing to add
37
}
0 38

  
tags/v2_0_0_Build_2043/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.impl/src/main/java/org/gvsig/exportto/impl/DefaultExporttoService.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
package org.gvsig.exportto.impl;
23

  
24
import org.cresques.cts.IProjection;
25

  
26
import org.gvsig.exportto.ExporttoService;
27
import org.gvsig.exportto.ExporttoServiceException;
28
import org.gvsig.exportto.ExporttoServiceFinishAction;
29
import org.gvsig.fmap.dal.DALLocator;
30
import org.gvsig.fmap.dal.DataManager;
31
import org.gvsig.fmap.dal.DataServerExplorer;
32
import org.gvsig.fmap.dal.NewDataStoreParameters;
33
import org.gvsig.fmap.dal.feature.Feature;
34
import org.gvsig.fmap.dal.feature.FeatureSet;
35
import org.gvsig.fmap.dal.feature.FeatureStore;
36
import org.gvsig.fmap.dal.feature.FeatureType;
37
import org.gvsig.tools.dispose.DisposableIterator;
38
import org.gvsig.tools.dispose.DisposeUtils;
39
import org.gvsig.tools.task.AbstractMonitorableTask;
40

  
41
/**
42
 * Default {@link ExporttoService} implementation.
43
 * 
44
 * @author gvSIG Team
45
 * @version $Id$
46
 */
47
public class DefaultExporttoService extends AbstractMonitorableTask implements ExporttoService {
48

  
49
    private DataServerExplorer dataServerExplorer;   
50
    private NewDataStoreParameters newDataStoreParameters;
51

  
52
    private ExporttoServiceFinishAction exporttoServiceFinishAction;
53

  
54
    /**
55
     * {@link DefaultExporttoService} constructor 
56

  
57
     */
58
    public DefaultExporttoService(DataServerExplorer dataServerExplorer,       
59
        NewDataStoreParameters newDataStoreParameters) { 
60
        super("Exportto"); 
61
        this.dataServerExplorer = dataServerExplorer;
62
        this.newDataStoreParameters = newDataStoreParameters;
63
    }
64

  
65
    public void export(FeatureStore featureStore, IProjection projection,
66
        FeatureSet featureSet) throws ExporttoServiceException {
67
        // TODO Auto-generated method stub
68

  
69
    }
70
    public void export(FeatureSet featureSet) throws ExporttoServiceException {
71

  
72
        String providerName = newDataStoreParameters.getDataStoreName();
73
        String explorerName = dataServerExplorer.getProviderName();
74

  
75
        DisposableIterator it = null;
76
        FeatureStore target = null;
77
        try {
78
            taskStatus.setRangeOfValues(0, featureSet.getSize());
79

  
80
            DataManager dataManager = DALLocator.getDataManager();           
81

  
82
            dataManager.newStore(explorerName, providerName, newDataStoreParameters, true);
83
            target = (FeatureStore) dataManager.openStore(providerName, newDataStoreParameters);
84

  
85
            FeatureType targetType = target.getDefaultFeatureType();
86

  
87
            target.edit(FeatureStore.MODE_APPEND);
88
            it = featureSet.fastIterator();
89

  
90
            long featureCount = 0;
91
            while (it.hasNext()) {
92
                Feature feature = (Feature) it.next();
93
                target.insert(target.createNewFeature(targetType, feature));
94

  
95
                featureCount++;  
96
                this.taskStatus.setCurValue(featureCount);
97

  
98
                if (this.taskStatus.isCancellationRequested()) {
99
                    return;
100
                }
101
            }
102
            target.finishEditing();       
103

  
104
            this.taskStatus.terminate();
105
            this.taskStatus.remove();
106
        } catch (Exception e) {
107
            throw  new ExporttoServiceException(e);
108
        } finally{
109
            if (target != null){
110
                target.dispose();
111
            }
112
            if (it != null){
113
                it.dispose();
114
            }
115
            if (featureSet != null){
116
                featureSet.dispose();
117
            }
118
            DisposeUtils.dispose(it);
119
        }
120

  
121
        if (exporttoServiceFinishAction != null){         
122
            exporttoServiceFinishAction.finished(newDataStoreParameters.getDataStoreName(), newDataStoreParameters);
123
        }
124
    }
125

  
126
    public void setFinishAction(
127
        ExporttoServiceFinishAction exporttoServiceFinishAction) {
128
        this.exporttoServiceFinishAction = exporttoServiceFinishAction;        
129
    }
130

  
131
}
0 132

  
tags/v2_0_0_Build_2043/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.impl/src/main/java/org/gvsig/exportto/impl/package.html
1
<?xml version="1.0" encoding="UTF-8" ?>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml">
4
<head>
5
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
<title>org.gvsig.exportto package documentation</title>
7
</head>
8
<body>
9

  
10
	<p>Exportto library API default implementation.</p>
11

  
12
</body>
13
</html>
0 14

  
tags/v2_0_0_Build_2043/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.impl/src/main/java/org/gvsig/exportto/impl/ExporttoDefaultImplLibrary.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
package org.gvsig.exportto.impl;
23

  
24
import org.gvsig.exportto.ExporttoLibrary;
25
import org.gvsig.exportto.ExporttoLocator;
26
import org.gvsig.tools.library.AbstractLibrary;
27
import org.gvsig.tools.library.LibraryException;
28

  
29
/**
30
 * Library for default implementation initialization and configuration.
31
 * 
32
 * @author gvSIG team
33
 * @version $Id$
34
 */
35
public class ExporttoDefaultImplLibrary extends AbstractLibrary {
36
    
37
    @Override
38
    public void doRegistration() {
39
        registerAsImplementationOf(ExporttoLibrary.class);
40
    }
41

  
42
    @Override
43
    protected void doInitialize() throws LibraryException {
44
        ExporttoLocator.registerManager(DefaultExporttoManager.class);
45
    }
46

  
47
    @Override
48
    protected void doPostInitialize() throws LibraryException {
49
        // Do nothing
50
    }
51

  
52
}
0 53

  
tags/v2_0_0_Build_2043/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.impl/src/main/java/org/gvsig/exportto/impl/DefaultExporttoManager.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
package org.gvsig.exportto.impl;
23

  
24
import java.io.File;
25
import java.io.FileInputStream;
26
import java.io.FileOutputStream;
27
import java.io.IOException;
28
import java.io.InputStream;
29
import java.io.OutputStream;
30
import java.util.HashMap;
31
import java.util.Iterator;
32
import java.util.Map;
33
import java.util.Properties;
34

  
35
import org.slf4j.Logger;
36
import org.slf4j.LoggerFactory;
37

  
38
import org.gvsig.exportto.ExporttoManager;
39
import org.gvsig.exportto.ExporttoService;
40
import org.gvsig.fmap.dal.DataServerExplorer;
41
import org.gvsig.fmap.dal.NewDataStoreParameters;
42

  
43
/**
44
 * Default {@link ExporttoManager} implementation.
45
 * 
46
 * @author gvSIG Team
47
 * @version $Id$
48
 */
49
public class DefaultExporttoManager implements ExporttoManager {
50
    private static final Logger LOG =
51
        LoggerFactory.getLogger(DefaultExporttoManager.class);
52

  
53
    @SuppressWarnings("rawtypes")
54
    private Map filters = null;
55
    private static final String EXPORTTOFILTERS_FILENAME = "exporttofilters.properties";  
56
    private static final String GVSIGPREFERENCES_FOLDERNAME = "gvSIG";  
57

  
58
    @SuppressWarnings("rawtypes")
59
    public DefaultExporttoManager() {
60
        super(); 
61
        filters = new HashMap();
62
        try {
63
            initializeFilters();
64
        } catch (IOException e) {
65
            LOG.error("Error reading the exporttofilters.properties file");
66
        }       
67
    }
68

  
69
    @SuppressWarnings({ "rawtypes", "unchecked" })
70
    private void initializeFilters() throws IOException {        
71
        String path = System.getProperty("user.home");
72
        path = path + File.separatorChar + GVSIGPREFERENCES_FOLDERNAME;
73
        File directory = new File(path);
74
        if (!directory.exists()){
75
            directory.mkdirs();
76
        }
77
        path = path + File.separatorChar + EXPORTTOFILTERS_FILENAME;
78
        File exporttoFiltersFile = new File(path);
79
        if (!exporttoFiltersFile.exists()){
80
            File templateFile = new File(getClass().getClassLoader().getResource("org/gvsig/exportto/lib/impl/exporttofilters.properties").getFile());
81
            if (!templateFile.exists()){
82
                return;
83
            }            
84
            copy(templateFile, exporttoFiltersFile);           
85
        }
86
        Properties properties = new Properties();
87
        properties.load(new FileInputStream(exporttoFiltersFile));
88
        Iterator it = properties.keySet().iterator();
89
        while (it.hasNext()){
90
            String key = (String)it.next();
91
            filters.put(key, properties.get(key));
92
        }
93
    }
94

  
95
    private void copy(File sourceLocation, File targetLocation)
96
    throws IOException {
97
        if (sourceLocation.isDirectory()) {
98
            if (!targetLocation.exists()) {
99
                targetLocation.mkdir();
100
            }
101

  
102
            String[] children = sourceLocation.list();
103
            for (int i = 0; i < children.length; i++) {
104
                copy(new File(sourceLocation, children[i]), new File(
105
                    targetLocation, children[i]));
106
            }
107
        } else {
108
            targetLocation.getParentFile().mkdirs();
109

  
110
            InputStream in = new FileInputStream(sourceLocation);
111
            OutputStream out = new FileOutputStream(targetLocation);
112

  
113
            // Copy the bits from instream to outstream
114
            byte[] buf = new byte[1024];
115
            int len;
116
            while ((len = in.read(buf)) > 0) {
117
                out.write(buf, 0, len);
118
            }
119
            in.close();
120
            out.close();
121
        }
122
    }
123

  
124
    public ExporttoService getExporttoService(DataServerExplorer dataServerExplorer, NewDataStoreParameters newDataStoreParameters) {
125
        return new DefaultExporttoService(dataServerExplorer, newDataStoreParameters);
126
    }
127

  
128
    @SuppressWarnings("rawtypes")
129
    public Iterator getPredefinedFilters() {        
130
        return filters.keySet().iterator();
131
    }
132

  
133
    public String getFilter(String filterName) {
134
        if (filters.containsKey(filterName)){
135
            return (String)filters.get(filterName);
136
        }
137
        return null;
138
    }
139

  
140
}
0 141

  
tags/v2_0_0_Build_2043/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.impl/src/main/resources/org/gvsig/exportto/lib/impl/exporttofilters.properties
1
#point_geometries_only=
2
#curve_geometries_only=
3
#surface_geometries_only=
4
prov_demo=PROV < '10'
0 5

  
tags/v2_0_0_Build_2043/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.exportto.impl.ExporttoDefaultImplLibrary
tags/v2_0_0_Build_2043/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.impl/pom.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4
	<modelVersion>4.0.0</modelVersion>
5
	<artifactId>org.gvsig.exportto.lib.impl</artifactId>
6
	<packaging>jar</packaging>
7
	<name>org.gvsig.exportto.lib.impl</name>
8
	<parent>
9
		<groupId>org.gvsig</groupId>
10
		<artifactId>org.gvsig.exportto.lib</artifactId>
11
		<version>1.0.0-SNAPSHOT</version>
12
	</parent>
13
	<dependencies>
14
		<dependency>
15
			<groupId>org.gvsig</groupId>
16
			<artifactId>org.gvsig.exportto.lib.api</artifactId>
17
			<version>1.0.0-SNAPSHOT</version>
18
		</dependency>
19
		<dependency>
20
			<groupId>org.gvsig</groupId>
21
			<artifactId>org.gvsig.exportto.lib.api</artifactId>
22
			<version>1.0.0-SNAPSHOT</version>
23
			<type>test-jar</type>
24
			<scope>test</scope>
25
		</dependency>
26
		<dependency>
27
            <groupId>org.gvsig</groupId>
28
            <artifactId>org.gvsig.tools.lib</artifactId>
29
            <scope>compile</scope>
30
        </dependency>
31
        <dependency>
32
            <groupId>org.gvsig</groupId>
33
            <artifactId>org.gvsig.metadata.lib.basic.api</artifactId>
34
            <scope>compile</scope>
35
        </dependency>
36
        <dependency>
37
            <groupId>org.gvsig</groupId>
38
            <artifactId>org.gvsig.fmap.dal</artifactId>    
39
            <scope>compile</scope>        
40
        </dependency>
41
        <dependency>
42
            <groupId>org.gvsig</groupId>
43
            <artifactId>org.gvsig.projection</artifactId>
44
            <scope>compile</scope>
45
        </dependency>
46
        <dependency>
47
            <groupId>org.gvsig</groupId>
48
            <artifactId>org.gvsig.projection</artifactId>  
49
            <classifier>cresques-impl</classifier>
50
            <scope>runtime</scope>      
51
        </dependency>   
52
        <dependency>
53
            <groupId>org.gvsig</groupId>
54
            <artifactId>org.gvsig.fmap.geometry</artifactId>            
55
            <classifier>impl</classifier>
56
            <scope>runtime</scope>      
57
        </dependency>
58
        <dependency>
59
            <groupId>org.gvsig</groupId>
60
            <artifactId>org.gvsig.fmap.geometry</artifactId>
61
            <classifier>operation</classifier>      
62
            <scope>runtime</scope>
63
        </dependency>  
64
        <dependency>
65
            <groupId>org.gvsig</groupId>
66
            <artifactId>org.gvsig.fmap.dal</artifactId>         
67
            <classifier>impl</classifier>
68
            <scope>runtime</scope>
69
        </dependency> 
70
         <dependency>
71
            <groupId>org.gvsig</groupId>
72
            <artifactId>org.gvsig.fmap.dal.file</artifactId>           
73
            <scope>test</scope>
74
        </dependency>  
75
         <dependency>
76
            <groupId>org.gvsig</groupId>
77
            <artifactId>org.gvsig.fmap.dal.file</artifactId>
78
            <classifier>store.dbf</classifier>
79
            <scope>test</scope>
80
        </dependency>  
81
        <dependency>
82
            <groupId>org.gvsig</groupId>
83
            <artifactId>org.gvsig.fmap.dal.file</artifactId>
84
            <classifier>store.dbf</classifier>
85
            <scope>test</scope>
86
        </dependency>  
87
         <dependency>
88
            <groupId>org.gvsig</groupId>
89
            <artifactId>org.gvsig.fmap.dal.file</artifactId>
90
            <classifier>store.shp</classifier>
91
            <scope>test</scope>
92
        </dependency>  
93
         <dependency>
94
            <groupId>org.gvsig</groupId>
95
            <artifactId>org.gvsig.symbology.lib.impl</artifactId>           
96
            <scope>test</scope>
97
        </dependency>           
98
        <dependency>
99
            <groupId>org.gvsig</groupId>
100
            <artifactId>org.gvsig.fmap.dal</artifactId>
101
            <classifier>spi</classifier>
102
            <scope>runtime</scope>      
103
        </dependency> 
104
        <dependency>
105
            <groupId>org.gvsig</groupId>
106
            <artifactId>org.gvsig.compat</artifactId>           
107
            <classifier>se</classifier>     
108
            <scope>runtime</scope>      
109
        </dependency>   
110
	</dependencies>
111
	<build>
112
		<plugins>
113
			<!-- TODO: MAKE TESTS WORK AND REMOVE THIS OPTION -->
114
			<plugin>
115
				<groupId>org.apache.maven.plugins</groupId>
116
				<artifactId>maven-surefire-plugin</artifactId>
117
				<configuration>
118
                    <excludes>
119
                        <exclude>**/**</exclude>
120
                    </excludes>
121
				</configuration>
122
			</plugin>		
123
		</plugins>
124
	</build>
125
</project>
0 126

  
tags/v2_0_0_Build_2043/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/test/java/org/gvsig/exportto/ExporttoServiceTest.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
package org.gvsig.exportto;
23

  
24
import org.gvsig.fmap.dal.DALLocator;
25
import org.gvsig.fmap.dal.DataManager;
26
import org.gvsig.fmap.dal.DataServerExplorer;
27
import org.gvsig.fmap.dal.DataServerExplorerParameters;
28
import org.gvsig.fmap.dal.DataStoreParameters;
29
import org.gvsig.fmap.dal.NewDataStoreParameters;
30
import org.gvsig.fmap.dal.exception.DataException;
31
import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
32
import org.gvsig.fmap.dal.feature.FeatureStore;
33
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
34

  
35
/**
36
 * API compatibility tests for {@link ExporttoService} implementations.
37
 * 
38
 * @author gvSIG Team
39
 * @version $Id$
40
 */
41
public abstract class ExporttoServiceTest extends
42
    AbstractLibraryAutoInitTestCase {
43

  
44
    protected ExporttoManager manager;
45
    protected DataManager dataManager = null;
46
    
47
    @Override
48
    protected void doSetUp() throws Exception {
49
        manager = ExporttoLocator.getManager();
50
        dataManager = DALLocator.getDataManager();
51
    }
52

  
53
    /**
54
     * Returns an instance of the {@link ExporttoService}.
55
     * 
56
     * @return a {@link ExporttoService} instance
57
     * @throws ValidateDataParametersException 
58
     * @throws DataException 
59
     * @throws Exception
60
     *             if there is any error creating the instance
61
     */
62
    protected ExporttoService createService() throws ValidateDataParametersException, DataException{
63
        DataServerExplorerParameters dataServerExplorerParameters = 
64
            dataManager.createServerExplorerParameters("FilesystemExplorer");
65
        DataServerExplorer dataServerExplorer =
66
            dataManager.openServerExplorer("FilesystemExplorer", dataServerExplorerParameters);
67
        NewDataStoreParameters newDataStoreParameters = dataServerExplorer.getAddParameters("Shape"); 
68
        return manager.getExporttoService(dataServerExplorer, newDataStoreParameters);       
69
    }
70

  
71
    /**
72
     * Test for the {@link ExporttoService#export(org.gvsig.fmap.dal.feature.FeatureSet)} method.
73
     */
74
    public void testExporttoServiceCreation() {
75
        ExporttoService exportService;
76
        try {
77
            exportService = createService();
78
            assertNotNull(exportService);
79
            //TODO a test for the export service
80
            //exportService.export(featureSet);
81
            
82
        } catch (ValidateDataParametersException e) {
83
           assertNull(e);
84
        } catch (DataException e) {
85
            assertNull(e);
86
        }      
87
    }  
88
    
89
    @SuppressWarnings("unused")
90
    private FeatureStore createMemoryFeatureStore() throws ValidateDataParametersException, DataException{        
91
        DataStoreParameters memoryParameters = dataManager.createStoreParameters("Memory");    
92
        FeatureStore featureStore = (FeatureStore) dataManager.openStore("Memory", memoryParameters);
93
        return (FeatureStore) featureStore.getFeatureSet();
94
    }
95
}
0 96

  
tags/v2_0_0_Build_2043/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/test/java/org/gvsig/exportto/ExporttoManagerTest.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
package org.gvsig.exportto;
23

  
24
import org.gvsig.fmap.dal.DALLocator;
25
import org.gvsig.fmap.dal.DataManager;
26
import org.gvsig.fmap.dal.DataServerExplorer;
27
import org.gvsig.fmap.dal.DataServerExplorerParameters;
28
import org.gvsig.fmap.dal.NewDataStoreParameters;
29
import org.gvsig.fmap.dal.exception.DataException;
30
import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
31
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
32

  
33
/**
34
 * API compatibility tests for {@link ExporttoManager} implementations.
35
 * 
36
 * @author gvSIG Team
37
 * @version $Id$
38
 */
39
public abstract class ExporttoManagerTest extends
40
    AbstractLibraryAutoInitTestCase {
41

  
42
    protected ExporttoManager manager;
43
    protected DataManager dataManager = null;
44
    
45
    @Override
46
    protected void doSetUp() throws Exception {
47
        manager = ExporttoLocator.getManager();
48
        dataManager = DALLocator.getDataManager();
49
    }
50

  
51
    /**
52
     * Test for the {@link ExporttoManager#getExporttoService()}
53
     * method.
54
     * 
55
     * @throws Exception
56
     *             if there is any error in the tests
57
     */
58
    public void testGetExporttoService() throws Exception {
59
        ExporttoService exportService;
60
        try {
61
            exportService = createService();
62
            assertNotNull(exportService);
63
        } catch (ValidateDataParametersException e) {
64
           assertNull(e);
65
        } catch (DataException e) {
66
            assertNull(e);
67
        }       
68
    }
69
    
70
    protected ExporttoService createService() throws ValidateDataParametersException, DataException{
71
        DataServerExplorerParameters dataServerExplorerParameters = 
72
            dataManager.createServerExplorerParameters("FilesystemExplorer");
73
        DataServerExplorer dataServerExplorer =
74
            dataManager.openServerExplorer("FilesystemExplorer", dataServerExplorerParameters);
75
        NewDataStoreParameters newDataStoreParameters = dataServerExplorer.getAddParameters("Shape");      
76
        return manager.getExporttoService(dataServerExplorer, newDataStoreParameters);       
77
    }
78

  
79
}
0 80

  
tags/v2_0_0_Build_2043/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/resources/filters.txt
1
point_geometries_only=
2
curve_geometries_only=
3
surface_geometries_only=
0 4

  
tags/v2_0_0_Build_2043/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.exportto.ExporttoLibrary
tags/v2_0_0_Build_2043/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/java/org/gvsig/exportto/package.html
1
<?xml version="1.0" encoding="UTF-8" ?>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml">
4
<head>
5
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
<title>org.gvsig.exportto package documentation</title>
7
</head>
8
<body>
9

  
10
	<p>Exportto library API.</p>
11
	
12
	<p>
13
	It allows to get new Exportto and get their text.
14
	</p>
15

  
16
</body>
17
</html>
0 18

  
tags/v2_0_0_Build_2043/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/java/org/gvsig/exportto/ExporttoManager.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
package org.gvsig.exportto;
23

  
24
import java.util.Iterator;
25

  
26
import org.gvsig.fmap.dal.DataServerExplorer;
27
import org.gvsig.fmap.dal.NewDataStoreParameters;
28
import org.gvsig.tools.service.ServiceException;
29

  
30
/**
31
 * This class is responsible of the management of the library's business logic.
32
 * It is the library's main entry point, and provides all the services to manage
33
 * {@link ExporttoService}s.
34
 * 
35
 * @see ExporttoService
36
 * @author gvSIG team
37
 * @version $Id$
38
 */
39
public interface ExporttoManager {
40

  
41
    /**
42
     * Create an instance of a {@link ExporttoService}.
43
     * @return {@link ExporttoService}
44
     * @throws ServiceException
45
     *             if there is an error getting the service
46
     */
47
    public ExporttoService getExporttoService(DataServerExplorer dataServerExplorer, NewDataStoreParameters newDataStoreParameters);
48
     
49
    @SuppressWarnings("rawtypes")
50
    public Iterator getPredefinedFilters();
51
    
52
    public String getFilter(String filterName);
53

  
54
}
0 55

  
tags/v2_0_0_Build_2043/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/java/org/gvsig/exportto/ExporttoException.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
package org.gvsig.exportto;
23

  
24
import org.gvsig.tools.exception.BaseException;
25

  
26
/**
27
 * Generic exception thrown in the Exportto API when the exception or error
28
 * may be dealt by the program or the user of the program which is a client of
29
 * the Exportto API.
30
 * 
31
 * @see {@link ExporttoService}
32
 * @see {@link ExporttoManager}
33
 * @author gvSIG team.
34
 * @version $Id$
35
 */
36
public class ExporttoException extends BaseException {
37

  
38
    private static final long serialVersionUID = 6756475060924237176L;
39

  
40
    private static final String MESSAGE =
41
        "An error has been produced in the Exportto library";
42

  
43
    private static final String KEY = "_ExporttoException";
44

  
45
    /**
46
     * Constructor to be used in rare cases, usually you must create a new child
47
     * exception class for each case.
48
     * <strong>Don't use this constructor in child classes.</strong>
49
     */
50
    public ExporttoException() {
51
        super(MESSAGE, KEY, serialVersionUID);
52
    }
53

  
54
    /**
55
     * Constructor to be used in rare cases, usually you must create a new child
56
     * exception class for each case.
57
     * <p>
58
     * <strong>Don't use this constructor in child classes.</strong>
59
     * </p>
60
     * 
61
     * @param cause
62
     *            the original cause of the exception
63
     */
64
    public ExporttoException(Exception cause) {
65
        super(MESSAGE, cause, KEY, serialVersionUID);
66
    }
67

  
68
    /**
69
     * @see BaseException#BaseException(String, String, long).
70
     * @param message
71
     *            the default messageFormat to describe the exception
72
     * @param key
73
     *            the key to use to search a localized messageFormnata
74
     * @param code
75
     *            the unique code to identify the exception
76
     */
77
    protected ExporttoException(String message, String key, long code) {
78
        super(message, key, code);
79
    }
80

  
81
    /**
82
     * @see BaseException#BaseException(String, Throwable, String, long).
83
     * @param message
84
     *            the default messageFormat to describe the exception
85
     * @param cause
86
     *            the original cause of the exception
87
     * @param key
88
     *            the key to use to search a localized messageFormnata
89
     * @param code
90
     *            the unique code to identify the exception
91
     */
92
    protected ExporttoException(String message, Throwable cause,
93
        String key, long code) {
94
        super(message, cause, key, code);
95
    }
96
}
0 97

  
tags/v2_0_0_Build_2043/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/java/org/gvsig/exportto/ExporttoServiceException.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
package org.gvsig.exportto;
23

  
24
import org.gvsig.tools.service.ServiceException;
25

  
26
/**
27
 * Exception thrown when there is an error getting a Exportto message.
28
 * 
29
 * @author gvSIG team
30
 * @version $Id$
31
 */
32
public class ExporttoServiceException extends ServiceException {
33
    private static final long serialVersionUID = -7423501876634702709L;
34

  
35
    private static final String MESSAGE =
36
        "An error has been produced exporting a store";
37

  
38
    private static final String KEY = "_ExporttoServiceException";
39

  
40
    /**
41
     * Creates a new {@link ExporttoServiceException}.
42
     * 
43
     * @param cause
44
     *            the original cause
45
     */
46
    public ExporttoServiceException(Throwable cause) {
47
        super(MESSAGE, cause, KEY, serialVersionUID);
48
    }
49
    
50
    public ExporttoServiceException(String message, Throwable cause) {
51
        super(message, cause, KEY, serialVersionUID);
52
    }
53
}
0 54

  
tags/v2_0_0_Build_2043/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/java/org/gvsig/exportto/ExporttoServiceFinishAction.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
package org.gvsig.exportto;
23

  
24
import org.gvsig.fmap.dal.DataStoreParameters;
25
import org.gvsig.fmap.dal.feature.FeatureStore;
26

  
27
/**
28
 * Action that can be executed at the end of the export process. 
29
 * An example of action can be load the destination {@link FeatureStore}
30
 * like a layer in a view.
31
 * 
32
 * @author gvSIG Team
33
 * @version $Id$
34
 *
35
 */
36
public interface ExporttoServiceFinishAction {
37
    
38
    /**
39
     * This method is called at the end of an export process.
40
     * @param layerName
41
     *          name of the new layer that can be added to gvSIG.
42
     * @param dataStoreParameters
43
     *          the parameters that can be used to create the exported store.
44
     */
45
    public void finished(String layerName, DataStoreParameters dataStoreParameters);
46
}
0 47

  
tags/v2_0_0_Build_2043/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/java/org/gvsig/exportto/ExporttoService.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
package org.gvsig.exportto;
24

  
25
import org.gvsig.fmap.dal.feature.FeatureSet;
26
import org.gvsig.fmap.dal.feature.FeatureStore;
27
import org.gvsig.tools.task.MonitorableTask;
28

  
29
/**
30
 * <p>
31
 * This service is used to export a source {@link FeatureStore} to a
32
 * target {@link FeatureStore}. 
33
 * </p>
34
 * <p>
35
 * It inherits if {@link MonitorableTask}, and it means that the export 
36
 * process can be monitorized by one or more observers that can listen
37
 * all the export events.
38
 * <p>
39
 * @author gvSIG team
40
 * @version $Id$
41
 */
42
public interface ExporttoService extends MonitorableTask {
43

  
44
    /**
45
     * This method export a {@link FeatureSet} to other {@link FeatureSet}. 
46
     * The other necessary parameters to make this conversion are specific
47
     * for every {@link ExporttoService}. e.g: a shape exporter needs a 
48
     * file and a projection, a database exporter needs a connection parameters...
49
     * @param featureSet
50
     *          the set of features hat have to be exported.     
51
     * @throws ExporttoServiceException
52
     *          if there is any exception in the exporting process
53
     */
54
    public void export(FeatureSet featureSet) throws ExporttoServiceException;
55
       
56
    /**
57
     * Sets the {@link ExporttoServiceFinishAction} that is used at the end
58
     * of the {@link ExporttoService}. 
59
     * @param exporttoServiceFinishAction
60
     *          it contains an action that can be executed at the end of the export process
61
     * 
62
     */
63
    public void setFinishAction(ExporttoServiceFinishAction exporttoServiceFinishAction);
64
    
65
   
66
}
0 67

  
tags/v2_0_0_Build_2043/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/java/org/gvsig/exportto/ExporttoLocator.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
package org.gvsig.exportto;
23

  
24
import org.gvsig.tools.locator.BaseLocator;
25
import org.gvsig.tools.locator.Locator;
26
import org.gvsig.tools.locator.LocatorException;
27

  
28
/**
29
 * This locator is the entry point for the Exportto library, providing
30
 * access to all Exportto services through the {@link ExporttoManager}
31
 * .
32
 * 
33
 * @author gvSIG team
34
 * @version $Id$
35
 */
36
public class ExporttoLocator extends BaseLocator {
37

  
38
    /**
39
     * Exportto manager name.
40
     */
41
    public static final String MANAGER_NAME = "Exportto.manager";
42

  
43
    /**
44
     * Exportto manager description.
45
     */
46
    public static final String MANAGER_DESCRIPTION = "Exportto Manager";
47

  
48
    private static final String LOCATOR_NAME = "Exportto.locator";
49

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

  
56
    /**
57
     * Return the singleton instance.
58
     * 
59
     * @return the singleton instance
60
     */
61
    public static ExporttoLocator getInstance() {
62
        return INSTANCE;
63
    }
64

  
65
    /**
66
     * Return the Locator's name.
67
     * 
68
     * @return a String with the Locator's name
69
     */
70
    public final String getLocatorName() {
71
        return LOCATOR_NAME;
72
    }
73

  
74
    /**
75
     * Return a reference to the ExporttoManager.
76
     * 
77
     * @return a reference to the ExporttoManager
78
     * @throws LocatorException
79
     *             if there is no access to the class or the class cannot be
80
     *             instantiated
81
     * @see Locator#get(String)
82
     */
83
    public static ExporttoManager getManager() throws LocatorException {
84
        return (ExporttoManager) getInstance().get(MANAGER_NAME);
85
    }
86

  
87
    /**
88
     * Registers the Class implementing the ExporttoManager interface.
89
     * 
90
     * @param clazz
91
     *            implementing the ExporttoManager interface
92
     */
93
    public static void registerManager(
94
        Class<? extends ExporttoManager> clazz) {
95
        getInstance().register(MANAGER_NAME, MANAGER_DESCRIPTION, clazz);
96
    }
97

  
98
}
0 99

  
tags/v2_0_0_Build_2043/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/java/org/gvsig/exportto/ExporttoLibrary.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
package org.gvsig.exportto;
23

  
24
import org.gvsig.tools.library.AbstractLibrary;
25
import org.gvsig.tools.library.LibraryException;
26
import org.gvsig.tools.locator.ReferenceNotRegisteredException;
27

  
28
/**
29
 * Library for API initialization and configuration.
30
 * 
31
 * @author gvSIG team
32
 * @version $Id$
33
 */
34
public class ExporttoLibrary extends AbstractLibrary {
35
       
36
    @Override
37
    public void doRegistration() {
38
        registerAsAPI(ExporttoLibrary.class);
39
    }
40

  
41
    @Override
42
    protected void doInitialize() throws LibraryException {
43
        // Do nothing
44
    }
45

  
46
    @Override
47
    protected void doPostInitialize() throws LibraryException {
48
        // Validate there is any implementation registered.
49
        ExporttoManager manager = ExporttoLocator.getManager();
50
        if (manager == null) {
51
            throw new ReferenceNotRegisteredException(
52
                ExporttoLocator.MANAGER_NAME, ExporttoLocator
53
                    .getInstance());
54
        }
55
    }
56

  
57
}
0 58

  
tags/v2_0_0_Build_2043/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/pom.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4
	<modelVersion>4.0.0</modelVersion>
5
	<artifactId>org.gvsig.exportto.lib.api</artifactId>
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff