1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package snifos.communication;
21
22 import java.lang.reflect.Constructor;
23
24 import java.util.Properties;
25
26
27 /***
28 * This class represents informations about communication module
29 * read from server configuration file.
30 * @version $Id: CommModuleInfo.java,v 1.2 2004/05/08 21:55:25 mwerla Exp $
31 */
32 public class CommModuleInfo {
33 private Properties properties = new Properties();
34 private Constructor constructor;
35
36 /***
37 * Sets main communication module class name.
38 * @param className Class name to set.
39 * @see CommModule
40 * @throws SecurityException Thrown by the security manager to indicate
41 * a security violation during reflection use.
42 * @throws NoSuchMethodException Thrown when main class does not have
43 * default constructor (without parameters).
44 * @throws ClassNotFoundException Thrown when given class is not found in
45 * classpath.
46 */
47 public void setClassName(String className)
48 throws SecurityException, NoSuchMethodException, ClassNotFoundException {
49 constructor = Class.forName(className).getConstructor(new Class[0]);
50 }
51
52 /***
53 * Sets single property of communication module configuration.
54 * @param name Property name.
55 * @param value Property value.
56 */
57 public void setProperty(String name, String value) {
58 properties.setProperty(name, value);
59 }
60
61 /***
62 * Returns Properties describing communication module configuration.
63 * @return Properties describing communication module configuration.
64 */
65 public Properties getProperties() {
66 return properties;
67 }
68
69 /***
70 * Returns constructor of main communication module class.
71 * @return Constructor of main communication module class.
72 */
73 public Constructor getConstructor() {
74 return constructor;
75 }
76 }