Project

General

Profile

Download (1.89 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 org.eclipse.core.runtime.jobs.Job;
14
import org.eclipse.ui.progress.IProgressConstants;
15

    
16
import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
17
import eu.etaxonomy.cdm.io.common.IIoConfigurator;
18

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

    
30
	protected ICdmApplicationConfiguration applicationConfiguration;
31

    
32
	public static enum TYPE {
33
		Jaxb, Tcs, Excel_Taxa, Endnote, Sdd, Abcd, SpecimenCdmExcel
34
	}
35

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

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

    
68
	}
69

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