1
2
3
4
5
6
7
8
9 package it.imolinfo.jbi4corba.jbi.component.runtime;
10
11 import it.imolinfo.jbi4corba.jbi.Messages;
12 import javax.jbi.component.Bootstrap;
13 import javax.jbi.component.InstallationContext;
14 import javax.jbi.JBIException;
15 import javax.jbi.component.ComponentContext;
16 import javax.jbi.management.MBeanNames;
17 import javax.management.MBeanServer;
18 import javax.management.ObjectName;
19 import javax.management.StandardMBean;
20
21 import it.imolinfo.jbi4corba.Logger;
22 import it.imolinfo.jbi4corba.LoggerFactory;
23
24
25
26
27
28
29
30
31
32
33
34
35 public class ComponentInstaller implements Bootstrap {
36
37
38 private static final Logger LOG =
39 LoggerFactory.getLogger(ComponentInstaller.class);
40 private static final Messages MESSAGES =
41 Messages.getMessages(ComponentInstaller.class);
42
43
44
45
46
47 @SuppressWarnings("unused")
48 private InstallationContext mContext;
49
50
51 ObjectName mInstallerExtName;
52
53
54
55
56 public ComponentInstaller() {}
57
58
59
60
61
62 public void cleanUp()
63 throws javax.jbi.JBIException {
64 LOG.info("CRB000431_Component_Installer_Cleaned_up" );
65 }
66
67
68
69
70
71
72 public void init(InstallationContext installContext)
73 throws javax.jbi.JBIException {
74
75 if ( installContext == null ) {
76 LOG.info("CRB000432_Null_Installation_Context_received_in_init_Component_Bootstrap_initialization");
77 }
78
79 this.mContext = installContext;
80
81 ComponentContext ctx = installContext.getContext();
82 MBeanServer mbServer = ctx.getMBeanServer();
83 MBeanNames mbNames = ctx.getMBeanNames();
84
85 mInstallerExtName = mbNames.createCustomComponentMBeanName(MBeanNames.BOOTSTRAP_EXTENSION);
86
87 InstallerExtMBean installerExt = new InstallerExt();
88
89 try {
90 if (!mbServer.isRegistered(mInstallerExtName)) {
91 StandardMBean installerExtMBean = new StandardMBean(installerExt, InstallerExtMBean.class);
92 mbServer.registerMBean(installerExtMBean, mInstallerExtName);
93 }
94 } catch (Exception ex) {
95 String msg=MESSAGES.getString("CRB000423_InstallerMBean_registration_failed");
96 LOG.error(msg,ex);
97 throw new JBIException(msg,ex);
98 }
99 LOG.info("CRB000433_Received_MBean", new Object[]{mInstallerExtName});
100
101 LOG.info("CRB000434_Component_Installer_initialized");
102 }
103
104
105
106
107
108
109 public javax.management.ObjectName getExtensionMBeanName() {
110 return null;
111 }
112
113
114
115
116
117 public void onInstall()
118 throws javax.jbi.JBIException {
119 LOG.info("CRB000435_Component_Installed");
120 }
121
122
123
124
125
126
127 public void onUninstall()
128 throws javax.jbi.JBIException {
129 LOG.info("CRB000436_Component_Uninstalled");
130 }
131
132 }