svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libTools / src / org / gvsig / tools / operations / AbstractOperation.java @ 24064
History | View | Annotate | Download (1.24 KB)
1 |
package org.gvsig.tools.operations; |
---|---|
2 |
|
3 |
import org.gvsig.tools.ToolsLocator; |
4 |
|
5 |
public abstract class AbstractOperation { |
6 |
|
7 |
protected String name; |
8 |
protected String description; |
9 |
|
10 |
public AbstractOperation(String name, String descrption) { |
11 |
this.description = descrption;
|
12 |
this.name = name;
|
13 |
} |
14 |
|
15 |
public String getName() { |
16 |
return name;
|
17 |
} |
18 |
|
19 |
public String getDescription() { |
20 |
return description;
|
21 |
} |
22 |
|
23 |
/**
|
24 |
* Get the operation code associated to this operation.
|
25 |
*
|
26 |
* Overwrite this method for optimize.
|
27 |
*
|
28 |
* @return the operation code
|
29 |
* @throws OperationNotSupportedException
|
30 |
*/
|
31 |
public int getCode() throws OperationNotSupportedException { |
32 |
OperationManager manager = ToolsLocator.getOperationManager(); |
33 |
return manager.getOperationCode(this.getClass(), name); |
34 |
} |
35 |
|
36 |
/**
|
37 |
* Invokes this operation in the context.
|
38 |
*
|
39 |
* @param self
|
40 |
* the object to which apply this operation
|
41 |
* @param ctx
|
42 |
* Parameter container
|
43 |
* @return Place-holder object that may contain any specific return value.
|
44 |
* @throws OperationException
|
45 |
* The implementation is responsible to throw this exception
|
46 |
* when needed.
|
47 |
*/
|
48 |
public abstract Object invoke(Object self, OperationContext context) |
49 |
throws OperationException;
|
50 |
|
51 |
} |