01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */package org.apache.cxf.bus;
19:
20: import javax.management.JMException;
21: import javax.management.ObjectName;
22:
23: import org.apache.cxf.Bus;
24: import org.apache.cxf.management.ManagedComponent;
25: import org.apache.cxf.management.ManagementConstants;
26: import org.apache.cxf.management.annotation.ManagedOperation;
27: import org.apache.cxf.management.annotation.ManagedResource;
28:
29: @ManagedResource(componentName="Bus",description="Responsible for managing services.")
30: public class ManagedBus implements ManagedComponent {
31: private static final String TYPE_VALUE = "Bus";
32: private final Bus bus;
33:
34: public ManagedBus(Bus b) {
35: bus = b;
36: }
37:
38: @ManagedOperation
39: public void shutdown(boolean wait) {
40: bus.shutdown(wait);
41: }
42:
43: public ObjectName getObjectName() throws JMException {
44: String busId = bus.getId();
45: StringBuffer buffer = new StringBuffer(
46: ManagementConstants.DEFAULT_DOMAIN_NAME + ":");
47: buffer.append(ManagementConstants.BUS_ID_PROP + "=" + busId
48: + ",");
49: buffer.append(ManagementConstants.TYPE_PROP + "=" + TYPE_VALUE);
50:
51: return new ObjectName(buffer.toString());
52: }
53: }
|