01: /*
02: * BEGIN_HEADER - DO NOT EDIT
03: *
04: * The contents of this file are subject to the terms
05: * of the Common Development and Distribution License
06: * (the "License"). You may not use this file except
07: * in compliance with the License.
08: *
09: * You can obtain a copy of the license at
10: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
11: * See the License for the specific language governing
12: * permissions and limitations under the License.
13: *
14: * When distributing Covered Code, include this CDDL
15: * HEADER in each file and include the License file at
16: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
17: * If applicable add the following below this CDDL HEADER,
18: * with the fields enclosed by brackets "[]" replaced with
19: * your own identifying information: Portions Copyright
20: * [year] [name of copyright owner]
21: */
22:
23: /*
24: * @(#)BindingComponent.java
25: * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
26: *
27: * END_HEADER - DO NOT EDIT
28: */
29: package java4ant;
30:
31: import java.io.InputStream;
32: import java.io.File;
33: import java.io.FileWriter;
34: import java.text.SimpleDateFormat;
35: import java.util.logging.Logger;
36: import java.util.Date;
37: import java.util.Properties;
38:
39: import javax.jbi.component.Bootstrap;
40: import javax.jbi.component.Component;
41: import javax.jbi.component.ComponentContext;
42: import javax.jbi.component.ComponentLifeCycle;
43: import javax.jbi.component.ServiceUnitManager;
44:
45: import javax.management.StandardMBean;
46: import javax.management.ObjectName;
47:
48: /**
49: * Dummy binding component used to test deployment.
50: *
51: * @author Sun Microsystems, Inc.
52: */
53: public class DummyBindingComponent extends BindingComponent {
54: /**
55: * Register custom MBeans
56: */
57: protected void registerCustomMBeans() throws javax.jbi.JBIException {
58: try {
59:
60: StandardMBean compMBean;
61:
62: DummyConfigurationMBean mbean = new DummyConfiguration();
63: compMBean = new StandardMBean(mbean,
64: DummyConfigurationMBean.class);
65:
66: ObjectName compMBeanName = mContext.getMBeanNames()
67: .createCustomComponentMBeanName("Configuration");
68:
69: mContext.getMBeanServer().registerMBean(compMBean,
70: compMBeanName);
71: } catch (Exception exp) {
72: throw new javax.jbi.JBIException(exp.getMessage());
73: }
74: }
75:
76: /**
77: * Unregister custom MBeans
78: */
79: protected void unregisterCustomMBeans()
80: throws javax.jbi.JBIException {
81: try {
82: ObjectName compMBeanName = mContext.getMBeanNames()
83: .createCustomComponentMBeanName("Configuration");
84:
85: mContext.getMBeanServer().unregisterMBean(compMBeanName);
86: } catch (Exception exp) {
87: throw new javax.jbi.JBIException(exp.getMessage());
88: }
89: }
90: }
|