Project

General

Profile

Download (4.29 KB) Statistics
| Branch: | Revision:
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.cdm.app.tcs;
10

    
11
import java.io.File;
12
import java.net.MalformedURLException;
13
import java.net.URISyntaxException;
14
import java.net.URL;
15

    
16
import org.apache.log4j.Logger;
17

    
18
import eu.etaxonomy.cdm.app.sdd.SDDSources;
19
import eu.etaxonomy.cdm.common.URI;
20

    
21
/**
22
 * @author a.mueller
23
 * @since 20.06.2008
24
 */
25
public class TcsSources {
26

    
27
    private static final Logger logger = Logger.getLogger(TcsSources.class);
28

    
29
	public static URI normalExplicit(){
30
		try {
31
//			URL url = new File(("C:\\localCopy\\eclipse\\cdmlib\\trunk\\app-import\\src\\main\\resources\\excel\\NormalExplicit.xls")).toURL();
32

    
33
			// FIXME what is this????
34
			URL url = new File("D:\\NormalExplicit.xls").toURI().toURL();
35

    
36

    
37
//			URL url = new TcsSources().getClass().getResource("excel/NormalExplicit.xls");
38
			boolean exists = new File(url.getFile()).exists();
39
			if (! exists) {
40
                throw new RuntimeException("File not found: " + url);
41
            }
42
			URI uri = URI.fromUrl(url);
43
			return uri;
44
		} catch (MalformedURLException e1) {
45
			// TODO Auto-generated catch block
46
			e1.printStackTrace();
47
			throw new RuntimeException(e1);
48
		} catch (URISyntaxException e) {
49
			e.printStackTrace();
50
			throw new RuntimeException(e);
51
		}
52
	}
53

    
54
	public static String arecaceae(){
55
		//	Monocots rdf
56
		String sourceUrl = "http://dev.e-taxonomy.eu/trac/attachment/wiki/SampleDataConversion/Monocotyledonae/arecaceae.rdf?format=raw";
57
		logger.debug("TcsSource " +  sourceUrl);
58
		return sourceUrl;
59
	}
60

    
61
	public static String taxonX_local(){
62
		//		Monocots rdf
63
		//String sourceUrl = "file:C:/localCopy/eclipse/cdmlib/app-import/src/main/resources/palm_tn_29336.xml";
64
		URL url = new SDDSources().getClass().getResource("/taxonX/palm_tn_29336.xml");
65
		String sourceUrl = url.toString();
66
		return sourceUrl;
67
	}
68

    
69
	public static File taxonX_localDir(){
70
		//		Monocots rdf
71
		File sourceDir = new File("target/classes/taxonX/"); //palm_tc_14495.xml
72
		return sourceDir;
73
	}
74

    
75
	public static String arecaceae_local(){
76
		//		Monocots rdf
77
		//String sourceUrl = "file:C:/localCopy/eclipse/cdmlib/app-import/src/main/resources/arecaceae.rdf";
78
		URL url = new SDDSources().getClass().getResource("/arecaceae.rdf");
79
		String sourceUrl = url.toString();
80
		return sourceUrl;
81
	}
82

    
83
	public static String tcsXml_cichorium(){
84
		//		tcsXmlTest.xml
85
		URL url = new TcsSources().getClass().getResource("/tcs/Cichorium_tcs.xml");
86
		String sourceUrl = url.toString();
87
		return sourceUrl;
88
	}
89

    
90
	public static String tcsXml_nyctaginaceae(){
91
		try {
92
			File file = new File("\\\\PESIIMPORT3\\caryo\\nyctaginaceae\\ipni-Nyctaginaceae-Caryophyllaceae.xml");
93
			return file.toURI().toURL().toString();
94
		} catch (MalformedURLException e) {
95
			throw new RuntimeException(e);
96
		}
97
	}
98

    
99
	public static String tcsXml_localPath(){
100
		File file = new File("C:\\localCopy\\Data\\tdwg\\Cichorium_tcs.xml");
101
		String sourceUrl;
102
		try{
103
			sourceUrl = file.toURI().toURL().toString();
104
		} catch (MalformedURLException e) {
105
			e.printStackTrace();
106
			throw new RuntimeException(e);
107
		}
108
		return sourceUrl;
109
	}
110

    
111
	public static String tcsXmlTest_local2(){
112
		//		tcsXmlTest.xml
113
		URL url = new TcsSources().getClass().getResource("/TcsXmlImportConfiguratorTest-input.xml");
114
		String sourceUrl = url.toString();
115
		return sourceUrl;
116
	}
117

    
118
	public static String tcsRdf_globis(){
119
		//		globis.rdf.xml
120
		//String sourceUrl = "file:C:/Dokumente und Einstellungen/a.kohlbecker.BGBM/Desktop/globis.rdf.xml";
121
		String sourceUrl = "/globis_valid.rdf.xml";
122
		URL resourceUrl = new TcsSources().getClass().getResource(sourceUrl);
123
		logger.debug("TcsRdfSource " +  resourceUrl.toString());
124
		return resourceUrl.toString();
125
	}
126

    
127
	public static String tcsRdf_test(){
128
		//		globis.rdf.xml
129
		//String sourceUrl = "file:C:/Dokumente und Einstellungen/a.kohlbecker.BGBM/Desktop/globis.rdf.xml";
130
		String sourceUrl = "/test_rdf.xml";
131
		URL resourceUrl = new TcsSources().getClass().getResource(sourceUrl);
132
		logger.debug("TcsRdfSource " +  resourceUrl.toString());
133
		return resourceUrl.toString();
134
	}
135
}
(2-2/3)