01: package org.objectweb.celtix.bus.management;
02:
03: import org.objectweb.celtix.Bus;
04: import org.objectweb.celtix.BusException;
05:
06: public class MBServerStart {
07: protected MBServerStart() {
08: }
09:
10: public static void main(String[] args) throws BusException {
11: // Create the InstrumentationsManager
12: Bus bus = Bus.init(args);
13: System.out.println("BusID is " + bus.getBusID());
14: //AutomaticWorkQueue awq =
15: bus.getWorkQueueManager().getAutomaticWorkQueue();
16: //need to use awq to run the programe
17: System.out.println("Waiting forever...");
18: try {
19: Thread.sleep(Long.MAX_VALUE);
20: } catch (InterruptedException e) {
21: // TODO Auto-generated catch block
22: e.printStackTrace();
23: }
24:
25: /*MBeanServer server;
26:
27: ObjectName ton = null;
28:
29: ModelMBeanAssembler mbAssembler = new ModelMBeanAssembler();
30:
31: server = ManagementFactory.getPlatformMBeanServer();
32:
33: try {
34: ton = new ObjectName("org.objectweb.celtix:Type=testInstrumentation");
35: } catch (MalformedObjectNameException e) {
36: e.printStackTrace();
37: } catch (NullPointerException e) {
38: e.printStackTrace();
39: }
40:
41: AnnotationTestInstrumentation ati = new AnnotationTestInstrumentation();
42:
43: ModelMBeanInfo mbi = mbAssembler.getModelMbeanInfo(ati.getClass());
44:
45: RunTimeModelMBean rtMBean;
46:
47: try {
48: rtMBean = (RunTimeModelMBean)server.instantiate(
49: "org.objectweb.celtix.bus.management.jmx.export.runtime.RunTimeModelMBean");
50:
51:
52: rtMBean.setModelMBeanInfo(mbi);
53:
54: rtMBean.setManagedResource(ati, "ObjectReference");
55:
56: server.registerMBean(rtMBean, ton);
57:
58: } catch (ReflectionException e) {
59: // TODO Auto-generated catch block
60: e.printStackTrace();
61: } catch (MBeanException e) {
62: // TODO Auto-generated catch block
63: e.printStackTrace();
64: } catch (InstanceNotFoundException e) {
65: // TODO Auto-generated catch block
66: e.printStackTrace();
67: } catch (InvalidTargetObjectTypeException e) {
68: // TODO Auto-generated catch block
69: e.printStackTrace();
70: } catch (InstanceAlreadyExistsException e) {
71: // TODO Auto-generated catch block
72: e.printStackTrace();
73: } catch (NotCompliantMBeanException e) {
74: // TODO Auto-generated catch block
75: e.printStackTrace();
76: }
77:
78: System.out.println("Start the MBServer");
79: try {
80: Thread.sleep(Long.MAX_VALUE);
81: } catch (InterruptedException e) {
82: // TODO Auto-generated catch block
83: e.printStackTrace();
84: }*/
85:
86: }
87: }
|