Project

General

Profile

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

    
11
package eu.etaxonomy.taxeditor.io;
12

    
13
import java.io.File;
14

    
15
import org.eclipse.core.runtime.jobs.Job;
16
import org.eclipse.ui.progress.IProgressConstants;
17

    
18
import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
19
import eu.etaxonomy.cdm.io.common.IIoConfigurator;
20

    
21
/**
22
 * <p>
23
 * Abstract AbstractIOHandler class.
24
 * </p>
25
 *
26
 * @author n.hoffmann
27
 * @created Sep 11, 2009
28
 * @version 1.0
29
 */
30
public abstract class AbstractIOManager<CONFIGURATOR extends IIoConfigurator> {
31

    
32
	protected ICdmApplicationConfiguration applicationConfiguration;
33

    
34
	public static enum TYPE {
35
		Jaxb, Tcs, Excel_Taxa, Endnote, Sdd, Abcd, SpecimenCdmExcel, Excel_Name
36
	}
37

    
38
	/**
39
	 * <p>
40
	 * Constructor for AbstractIOHandler.
41
	 * </p>
42
	 *
43
	 * @param applicationController
44
	 *            a
45
	 *            {@link eu.etaxonomy.cdm.api.application.CdmApplicationController}
46
	 *            object.
47
	 * @param <CONFIGURATOR>
48
	 *            a CONFIGURATOR object.
49
	 */
50
	protected AbstractIOManager(
51
			ICdmApplicationConfiguration applicationConfiguration) {
52
		this.applicationConfiguration = applicationConfiguration;
53
	}
54

    
55
	/**
56
	 * Starts the IO process
57
	 *
58
	 * @param configurator
59
	 *            a CONFIGURATOR object.
60
	 */
61
	public void run(final CONFIGURATOR configurator) {
62
		// create job
63
		Job job = createIOJob(configurator);
64
		// configure the job
65
		job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
66
		job.setUser(true);
67
		// schedule job
68
		job.schedule();
69

    
70
	}
71

    
72
	/**
73
	 * <p>
74
	 * createIOJob
75
	 * </p>
76
	 *
77
	 * @param configurator
78
	 *            a CONFIGURATOR object.
79
	 * @return a {@link org.eclipse.core.runtime.jobs.Job} object.
80
	 */
81
	protected abstract Job createIOJob(CONFIGURATOR configurator);
82

    
83
	public abstract Job createIOServiceJob(CONFIGURATOR configurator, File ioFile);
84
}
(1-1/3)