Statistics
| Revision:

gvsig-raster / org.gvsig.raster / trunk / org.gvsig.raster / org.gvsig.raster.lib / org.gvsig.raster.lib.impl / src / main / java / org / gvsig / raster / impl / process / RasterTask.java @ 1419

History | View | Annotate | Download (2.54 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.raster.impl.process;
23

    
24
import java.util.EventObject;
25

    
26
import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException;
27
import org.gvsig.fmap.dal.coverage.process.CancelEvent;
28
/**
29
 * Clase que deben contener los procesos de raster. Un proceso debe registrarse
30
 * al arrancar y eliminarse al terminar o ser cancelado. El proceso debe ser
31
 * el encargado de realizar estas acciones.
32
 * 
33
 * @version 30/08/2007
34
 * @author Nacho Brodin (nachobrodin@gmail.com)
35
 */
36
public class RasterTask {
37
        public EventObject activeEvent = null;
38
        public Object      process     = null;
39
        private String     idThread    = "";
40

    
41
        /**
42
         * Asigna la clase que contiene el proceso.
43
         * @param process
44
         */
45
        public RasterTask(Object process) {
46
                idThread = Thread.currentThread().getId() + "";
47
                this.process = process;
48
        }
49
        /**
50
         * Asigna el evento
51
         * @param ev EventObject
52
         */
53
        public void setEvent(EventObject ev) {
54
                activeEvent = ev;
55
        }
56
        
57
        /**
58
         * Obtiene el evento
59
         * @return EventObject
60
         */
61
        public EventObject getEvent() {
62
                return activeEvent;
63
        }
64
        
65
        /**
66
         * Obtiene el identificador ?nico del proceso. 
67
         * @return Identificador del proceso
68
         */
69
        public String getID() {
70
                return idThread;
71
        }
72
        
73
        /**
74
         * Gesti?n de las se?ales. Este m?todo define las acciones por defecto para
75
         * cada se?al. No es necesario utilizar estas. Se puede en cada caso, hacer un m?todo
76
         * manageEvent en el que se gestione las acciones concretas de una se?al.
77
         * 
78
         * @param ev Evento a gestionar
79
         */
80
        public  void manageEvent(EventObject ev) throws ProcessInterruptedException {
81
                if (ev instanceof CancelEvent)
82
                        throw new ProcessInterruptedException("Proceso cancelado por se?al del usuario.");
83
        }
84
}