Project

General

Profile

Download (1.94 KB) Statistics
| Branch: | Tag: | 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

    
10
package eu.etaxonomy.taxeditor.io;
11

    
12
import org.eclipse.core.runtime.jobs.Job;
13
import org.eclipse.ui.progress.IProgressConstants;
14

    
15
import eu.etaxonomy.cdm.api.application.ICdmRepository;
16
import eu.etaxonomy.cdm.io.common.IIoConfigurator;
17

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

    
29
	protected ICdmRepository applicationConfiguration;
30

    
31
	public static enum TYPE {
32
		Jaxb, Tcs, Excel_Taxa, Endnote, Sdd, Abcd, SpecimenCdmExcel, Excel_Name, SpecimenSearch, Gbif
33
	}
34

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

    
52
	/**
53
	 * Starts the IO process
54
	 *
55
	 * @param configurator
56
	 *            a CONFIGURATOR object.
57
	 */
58
	public void run(final CONFIGURATOR configurator) {
59
	    // create job
60
	    Job job = createIOJob(configurator);
61
	    run(job);
62
	}
63

    
64
	public void run(Job job) {
65
	    // configure the job
66
	    job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
67
	    job.setUser(true);
68
	    // schedule job
69
	    job.schedule();
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
}
(1-1/3)