D:\NewZebra\JavaApplications\DesignPatternsProject\src\structural_patterns\composite_tree\CompositeNodeMediator.java |
1
2
3
4
5
6 package structural_patterns.composite_tree;
7
8
9
10 @author
11
12
13
14
15 import java.io.*;
16 import java.text.*;
17 import java.util.*;
18
19
20 public class CompositeNodeMediator implements Mediator {
21
22 Vector dynamicServicesVector = null;
23 CompositeNodeServices serviceHandler;
24 int nextServiceId = CompositeNodeBase.MOD_SERVICE_INTEGER;
25
26
27 public CompositeNodeMediator() {
28 }
29
30
31 public int performService(Object passedObject){
32 return(CompositeNodeBase.NORMAL_RUN);
33 }
34 public int performService(int serviceID, Object passedObject){
35
36 int returnValue = CompositeNodeBase.NOT_NORMAL_RUN;
37 switch(serviceID)
38 {
39 case CompositeNodeBase.STRING_ARRAY_TREE_SERVICE_INDEX:
40 CompositeNodeServices stringArrayTreeServicesHandle = new StringArrayTreeServices();
41 passedObject = (CompositeNode) stringArrayTreeServicesHandle.PollingTree();
42 returnValue = CompositeNodeBase.NORMAL_RUN;
43 break;
44 case CompositeNodeBase.FILE_FOLDER_TREE_SERVICE_INDEX:
45 CompositeNodeServices fileFolderTreeServicesHandle = new FileFolderTreeServices();
46 passedObject = (CompositeNode) fileFolderTreeServicesHandle.PollingTree();
47 returnValue = CompositeNodeBase.NORMAL_RUN;
48 break;
49 case CompositeNodeBase.JNDI_TREE_SERVICE_INDEX:
50 break;
51 case CompositeNodeBase.EMAIL_SERVER_TREE_SERVICE_INDEX:
52 break;
53 default:
54
55
56
57
58
59
60
61
62
63
64
65
66 }
67 return(returnValue);
68 }
69
70
71
72 public int addService(CompositeNodeServices passedCompositeNodeServices){
73 return(CompositeNodeBase.NORMAL_RUN);
74 }
75
76 }
77
78