Author: gnodet
Date: Thu Jun 24 09:24:58 2010
New Revision: 957468
URL: http://svn.apache.org/viewvc?rev=957468&view=rev
Log:
FELIX-2442: JDK 1.5 build issue - StandardEmitterMBean is JDK 1.6 specific
Added:
felix/trunk/karaf/features/management/src/main/java/org/apache/felix/karaf/features/management/internal/StandardEmitterMBean.java
Modified:
felix/trunk/karaf/features/management/src/main/java/org/apache/felix/karaf/features/management/internal/FeaturesServiceMBeanImpl.java
Modified:
felix/trunk/karaf/features/management/src/main/java/org/apache/felix/karaf/features/management/internal/FeaturesServiceMBeanImpl.java
URL:
http://svn.apache.org/viewvc/felix/trunk/karaf/features/management/src/main/java/org/apache/felix/karaf/features/management/internal/FeaturesServiceMBeanImpl.java?rev=957468&r1=957467&r2=957468&view=diff
==============================================================================
---
felix/trunk/karaf/features/management/src/main/java/org/apache/felix/karaf/features/management/internal/FeaturesServiceMBeanImpl.java
(original)
+++
felix/trunk/karaf/features/management/src/main/java/org/apache/felix/karaf/features/management/internal/FeaturesServiceMBeanImpl.java
Thu Jun 24 09:24:58 2010
@@ -22,10 +22,10 @@ import java.util.List;
import javax.management.MBeanNotificationInfo;
import javax.management.MBeanRegistration;
import javax.management.MBeanServer;
+import javax.management.NotCompliantMBeanException;
import javax.management.Notification;
import javax.management.NotificationBroadcasterSupport;
import javax.management.ObjectName;
-import javax.management.StandardEmitterMBean;
import javax.management.openmbean.TabularData;
import org.apache.felix.karaf.features.Feature;
@@ -60,29 +60,33 @@ public class FeaturesServiceMBeanImpl ex
private FeaturesService featuresService;
- public FeaturesServiceMBeanImpl() {
- super(FeaturesServiceMBean.class, new NotificationBroadcasterSupport(
- getBroadcastInfo()));
+ public FeaturesServiceMBeanImpl() throws NotCompliantMBeanException {
+ super(FeaturesServiceMBean.class, new NotificationBroadcasterSupport()
{
+ @Override
+ public MBeanNotificationInfo[] getNotificationInfo() {
+ return getBroadcastInfo();
+ }
+ });
}
- @Override
public ObjectName preRegister(MBeanServer server, ObjectName name) throws
Exception {
objectName = name;
this.server = server;
return name;
}
- @Override
public void postRegister(Boolean registrationDone) {
registration =
bundleContext.registerService(FeaturesListener.class.getName(),
getFeaturesListener(), new Hashtable());
}
- @Override
public void preDeregister() throws Exception {
registration.unregister();
}
+ public void postDeregister() {
+ }
+
/**
* {...@inheritdoc}
*/
Added:
felix/trunk/karaf/features/management/src/main/java/org/apache/felix/karaf/features/management/internal/StandardEmitterMBean.java
URL:
http://svn.apache.org/viewvc/felix/trunk/karaf/features/management/src/main/java/org/apache/felix/karaf/features/management/internal/StandardEmitterMBean.java?rev=957468&view=auto
==============================================================================
---
felix/trunk/karaf/features/management/src/main/java/org/apache/felix/karaf/features/management/internal/StandardEmitterMBean.java
(added)
+++
felix/trunk/karaf/features/management/src/main/java/org/apache/felix/karaf/features/management/internal/StandardEmitterMBean.java
Thu Jun 24 09:24:58 2010
@@ -0,0 +1,59 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy
of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
under
+ * the License.
+ */
+package org.apache.felix.karaf.features.management.internal;
+
+import javax.management.*;
+
+public class StandardEmitterMBean extends StandardMBean implements
NotificationEmitter {
+
+ private NotificationBroadcasterSupport emitter;
+
+ public StandardEmitterMBean(Class mbeanInterface,
NotificationBroadcasterSupport emitter) throws NotCompliantMBeanException {
+ super(mbeanInterface);
+ this.emitter = emitter;
+ }
+
+ public void sendNotification(Notification notification) {
+ emitter.sendNotification(notification);
+ }
+
+
+ public void removeNotificationListener(NotificationListener listener,
NotificationFilter filter, Object handback) throws ListenerNotFoundException {
+ emitter.removeNotificationListener(listener, filter, handback);
+ }
+
+ public void addNotificationListener(NotificationListener listener,
NotificationFilter filter, Object handback) throws IllegalArgumentException {
+ emitter.addNotificationListener(listener, filter, handback);
+ }
+
+ public void removeNotificationListener(NotificationListener listener)
throws ListenerNotFoundException {
+ emitter.removeNotificationListener(listener);
+ }
+
+ public MBeanNotificationInfo[] getNotificationInfo() {
+ return emitter.getNotificationInfo();
+ }
+
+ @Override
+ public MBeanInfo getMBeanInfo() {
+ MBeanInfo mbeanInfo = super.getMBeanInfo();
+ if (mbeanInfo != null) {
+ MBeanNotificationInfo[] notificationInfo = getNotificationInfo();
+ mbeanInfo = new MBeanInfo(mbeanInfo.getClassName(),
mbeanInfo.getDescription(), mbeanInfo.getAttributes(),
+ mbeanInfo.getConstructors(), mbeanInfo.getOperations(),
notificationInfo);
+ }
+ return mbeanInfo;
+ }
+
+}