-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathModule.java
More file actions
149 lines (124 loc) · 3.6 KB
/
Module.java
File metadata and controls
149 lines (124 loc) · 3.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
package modules;
import java.io.IOException;
import java.util.Map;
import java.util.Properties;
import common.parallelization.CallbackProcess;
/**
* Defines an abstract view of any processing module.
* @author Marcel Boeing
*
*/
public interface Module extends CallbackProcess {
public static final int STATUSCODE_SUCCESS = 0;
public static final int STATUSCODE_FAILURE = 1;
public static final int STATUSCODE_RUNNING = 2;
public static final int STATUSCODE_NOTYETRUN = 3;
public static final String[] STATUSMESSAGES = new String[]{"successful","failed","running","idle"};
/**
* Returns a map of available input ports (key=identifier).
* @return List of ports
*/
public Map<String,InputPort> getInputPorts();
/**
* Returns a map of available output ports (key=identifier).
* @return List of ports
*/
public Map<String,OutputPort> getOutputPorts();
/**
* Starts the process.
* @return True if the process ended successfully.
* @throws Exception When something goes wrong, duh.
*/
public boolean process() throws Exception;
/**
* Outputs the name of the module.
* @return Name
*/
public String getName();
/**
* Sets the name of the module.
* @param name Name
*/
public void setName(String name);
/**
* Outputs the description of the module.
* @return Description
*/
public String getDescription();
/**
* Sets the description of the module.
* @param desc Description
*/
public void setDescription(String desc);
/**
* Outputs the properties used by this module instance.
* @return properties
*/
public Properties getProperties();
/**
* Sets the properties used by this module instance.
* @param properties properties to set
* @throws Exception when properties are invalid
*/
public void setProperties(Properties properties) throws Exception;
/**
* Returns a map containing all valid property keys of this module
* with a short description as value.
* @return Map
*/
public Map<String,String> getPropertyDescriptions();
/**
* Returns a map containing available default values for properties of this module.
* @return Map
*/
public Map<String,String> getPropertyDefaultValues();
/**
* Returns a code indicating the status of the module (see static vars in this class)
* @return status code
*/
public int getStatus();
/**
* Applies all relevant properties to this instance. Subclasses should
* override this, apply the properties they use themselves and call
* super().applyProperties() afterwards.
*
* @throws Exception
* when something goes wrong (property cannot be applied etc.)
*/
public void applyProperties() throws Exception;
/**
* Resets all outputs.
* @throws IOException Thrown if something goes wrong
*/
public void resetOutputs() throws IOException;
/**
* Returns the category name associated with this module.
* @return Category name
*/
public String getCategory();
/**
* Set category name.
* @param category Category name
*/
public void setCategory(String category);
/**
* Gives detail information about the module's current status (may be null).
* @return String with status details or null
*/
public String getStatusDetail();
/**
* Set detail information about the module's current status (may be null).
* @param statusDetail String with status details or null
*/
public void setStatusDetail(String statusDetail);
/**
* Returns a map containing metadata.
* @return Map
*/
public Map<String,Object> getMetadata();
/**
* Set map containing metadata.
* @param metadata Map to set
*/
public void setMetadata(Map<String,Object> metadata);
}