View Javadoc

1   package org.lsst.ccs.command.demo.subsystem;
2   
3   import org.lsst.ccs.command.CommandSetBuilder;
4   import org.lsst.ccs.command.CompositeCommandSet;
5   import org.lsst.ccs.command.RoutingCommandSet;
6   import org.lsst.ccs.command.annotations.Command;
7   import org.lsst.ccs.command.demo.remote.jgroups.JGroupsCommandServer;
8   
9   /**
10   *
11   * @author tonyj
12   */
13  public class Subsystem {
14  
15      private String subsystemName;
16      private Subsystem(String name) {
17          this.subsystemName = name;
18      }
19  
20      @Command(description = "Return the subsystem name")
21      public String showName() {
22          return subsystemName;
23      }
24      
25      public static void main(String[] args) throws Exception {
26          // Create Subsystem itself
27          Subsystem s = new Subsystem("Test");
28          ModuleA a = new ModuleA();
29          ModuleB b = new ModuleB();
30          
31          CommandSetBuilder builder = new CommandSetBuilder();
32  
33          RoutingCommandSet rcs = new RoutingCommandSet();
34          rcs.add("A",builder.buildCommandSet(a));
35          rcs.add("B",builder.buildCommandSet(b));
36          
37          // Build dictionary
38          CompositeCommandSet cs = new CompositeCommandSet();
39          
40          cs.add(builder.buildCommandSet(s));
41          cs.add(rcs);
42          // Publish dictionary on "buses"
43          JGroupsCommandServer server = new JGroupsCommandServer(cs);
44      }
45  }