Project

General

Profile

Download (1.98 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, Excel_Name, SpecimenSearch
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
	    run(job);
63
	}
64

    
65
	public void run(Job job) {
66
	    // configure the job
67
	    job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
68
	    job.setUser(true);
69
	    // schedule job
70
	    job.schedule();
71
	}
72

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

    
84
}
(1-1/3)