Author: ningjiang
Date: Mon Feb 13 08:38:37 2012
New Revision: 1243432
URL: http://svn.apache.org/viewvc?rev=1243432&view=rev
Log:
CXF-4098 JMX management supports of the CXF WS-Notification service
Added:
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/CreatePullPointMBean.java
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/EndpointMBean.java
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/NotificationBrokerMBean.java
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/JaxwsCreatePullPointMBean.java
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/JaxwsNotificationBrokerMBean.java
Modified:
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/AbstractCreatePullPoint.java
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/AbstractEndpoint.java
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/AbstractNotificationBroker.java
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/jms/JmsCreatePullPoint.java
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/JaxwsCreatePullPoint.java
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/JaxwsNotificationBroker.java
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/Service.java
Modified:
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/AbstractCreatePullPoint.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/AbstractCreatePullPoint.java?rev=1243432&r1=1243431&r2=1243432&view=diff
==============================================================================
---
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/AbstractCreatePullPoint.java
(original)
+++
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/AbstractCreatePullPoint.java
Mon Feb 13 08:38:37 2012
@@ -18,6 +18,8 @@
*/
package org.apache.cxf.wsn;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
@@ -37,7 +39,8 @@ import org.oasis_open.docs.wsn.bw_2.Unab
import org.oasis_open.docs.wsn.bw_2.UnableToDestroyPullPointFault;
@WebService(endpointInterface = "org.oasis_open.docs.wsn.bw_2.CreatePullPoint")
-public abstract class AbstractCreatePullPoint extends AbstractEndpoint
implements CreatePullPoint {
+public abstract class AbstractCreatePullPoint extends AbstractEndpoint
+ implements CreatePullPoint, CreatePullPointMBean {
private static final Logger LOGGER =
LogUtils.getL7dLogger(AbstractCreatePullPoint.class);
@@ -58,6 +61,14 @@ public abstract class AbstractCreatePull
public void destroy() throws Exception {
unregister();
}
+
+ public List<String> getPullEndpoints() {
+ return new ArrayList<String>(pullPoints.keySet());
+ }
+
+ public EndpointMBean getPullEndpoint(String name) {
+ return pullPoints.get(name);
+ }
@WebMethod(operationName = "CreatePullPoint")
@WebResult(name = "CreatePullPointResponse",
Modified:
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/AbstractEndpoint.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/AbstractEndpoint.java?rev=1243432&r1=1243431&r2=1243432&view=diff
==============================================================================
---
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/AbstractEndpoint.java
(original)
+++
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/AbstractEndpoint.java
Mon Feb 13 08:38:37 2012
@@ -20,7 +20,7 @@ package org.apache.cxf.wsn;
import javax.xml.ws.wsaddressing.W3CEndpointReference;
-public abstract class AbstractEndpoint {
+public abstract class AbstractEndpoint implements EndpointMBean {
protected final String name;
Modified:
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/AbstractNotificationBroker.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/AbstractNotificationBroker.java?rev=1243432&r1=1243431&r2=1243432&view=diff
==============================================================================
---
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/AbstractNotificationBroker.java
(original)
+++
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/AbstractNotificationBroker.java
Mon Feb 13 08:38:37 2012
@@ -19,6 +19,8 @@
package org.apache.cxf.wsn;
import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
@@ -72,7 +74,7 @@ import org.oasis_open.docs.wsrf.rw_2.Res
@WebService(endpointInterface =
"org.oasis_open.docs.wsn.brw_2.NotificationBroker")
public abstract class AbstractNotificationBroker extends AbstractEndpoint
- implements NotificationBroker, GetResourceProperty {
+ implements NotificationBroker, NotificationBrokerMBean,
GetResourceProperty {
public static final String NAMESPACE_URI =
"http://docs.oasis-open.org/wsn/b-2";
public static final String PREFIX = "wsnt";
@@ -110,6 +112,26 @@ public abstract class AbstractNotificati
anonymousPublisher.destroy();
unregister();
}
+
+ public List<String> getPublisher() {
+ return new ArrayList<String>(publishers.keySet());
+ }
+
+ public List<String> getSubscriptions() {
+ return new ArrayList<String>(subscriptions.keySet());
+ }
+
+ public EndpointMBean getPublisher(String name) {
+ return publishers.get(name);
+ }
+
+ public EndpointMBean getSubscription(String name) {
+ return subscriptions.get(name);
+ }
+
+ public EndpointMBean getAnonymousPublisher() {
+ return anonymousPublisher;
+ }
/**
*
Added:
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/CreatePullPointMBean.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/CreatePullPointMBean.java?rev=1243432&view=auto
==============================================================================
---
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/CreatePullPointMBean.java
(added)
+++
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/CreatePullPointMBean.java
Mon Feb 13 08:38:37 2012
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.wsn;
+
+import java.util.List;
+
+public interface CreatePullPointMBean extends EndpointMBean {
+
+
+ List<String> getPullEndpoints();
+
+ EndpointMBean getPullEndpoint(String name);
+
+
+}
Added:
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/EndpointMBean.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/EndpointMBean.java?rev=1243432&view=auto
==============================================================================
---
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/EndpointMBean.java
(added)
+++
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/EndpointMBean.java
Mon Feb 13 08:38:37 2012
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.wsn;
+
+public interface EndpointMBean {
+
+ String getName();
+
+ String getAddress();
+
+ void register() throws EndpointRegistrationException;
+
+ void unregister() throws EndpointRegistrationException;
+
+
+}
Added:
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/NotificationBrokerMBean.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/NotificationBrokerMBean.java?rev=1243432&view=auto
==============================================================================
---
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/NotificationBrokerMBean.java
(added)
+++
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/NotificationBrokerMBean.java
Mon Feb 13 08:38:37 2012
@@ -0,0 +1,35 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.wsn;
+
+import java.util.List;
+
+public interface NotificationBrokerMBean extends EndpointMBean {
+
+ List<String> getPublisher();
+
+ List<String> getSubscriptions();
+
+ EndpointMBean getPublisher(String name);
+
+ EndpointMBean getSubscription(String name);
+
+ EndpointMBean getAnonymousPublisher();
+
+}
Modified:
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/jms/JmsCreatePullPoint.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/jms/JmsCreatePullPoint.java?rev=1243432&r1=1243431&r2=1243432&view=diff
==============================================================================
---
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/jms/JmsCreatePullPoint.java
(original)
+++
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/jms/JmsCreatePullPoint.java
Mon Feb 13 08:38:37 2012
@@ -79,5 +79,5 @@ public class JmsCreatePullPoint extends
public void setConnectionFactory(ConnectionFactory connectionFactory) {
this.connectionFactory = connectionFactory;
}
-
+
}
Modified:
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/JaxwsCreatePullPoint.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/JaxwsCreatePullPoint.java?rev=1243432&r1=1243431&r2=1243432&view=diff
==============================================================================
---
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/JaxwsCreatePullPoint.java
(original)
+++
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/JaxwsCreatePullPoint.java
Mon Feb 13 08:38:37 2012
@@ -31,7 +31,8 @@ import org.apache.cxf.wsn.jms.JmsCreateP
serviceName = "CreatePullPoint",
portName = "CreatePullPointPort")
@BindingType(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING)
-public class JaxwsCreatePullPoint extends JmsCreatePullPoint {
+public class JaxwsCreatePullPoint extends JmsCreatePullPoint
+ implements JaxwsCreatePullPointMBean {
public JaxwsCreatePullPoint(String name) {
super(name);
Added:
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/JaxwsCreatePullPointMBean.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/JaxwsCreatePullPointMBean.java?rev=1243432&view=auto
==============================================================================
---
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/JaxwsCreatePullPointMBean.java
(added)
+++
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/JaxwsCreatePullPointMBean.java
Mon Feb 13 08:38:37 2012
@@ -0,0 +1,25 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.wsn.services;
+
+import org.apache.cxf.wsn.CreatePullPointMBean;
+
+public interface JaxwsCreatePullPointMBean extends CreatePullPointMBean {
+
+}
Modified:
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/JaxwsNotificationBroker.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/JaxwsNotificationBroker.java?rev=1243432&r1=1243431&r2=1243432&view=diff
==============================================================================
---
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/JaxwsNotificationBroker.java
(original)
+++
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/JaxwsNotificationBroker.java
Mon Feb 13 08:38:37 2012
@@ -31,7 +31,8 @@ import org.apache.cxf.wsn.jms.JmsSubscri
serviceName = "NotificationBroker",
portName = "NotificationBrokerPort")
@BindingType(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING)
-public class JaxwsNotificationBroker extends JmsNotificationBroker {
+public class JaxwsNotificationBroker extends JmsNotificationBroker
+ implements JaxwsNotificationBrokerMBean {
public JaxwsNotificationBroker(String name) {
super(name);
@@ -52,4 +53,5 @@ public class JaxwsNotificationBroker ext
protected JmsPublisher createJmsPublisher(String name) {
return new JaxwsPublisher(name, this);
}
+
}
Added:
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/JaxwsNotificationBrokerMBean.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/JaxwsNotificationBrokerMBean.java?rev=1243432&view=auto
==============================================================================
---
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/JaxwsNotificationBrokerMBean.java
(added)
+++
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/JaxwsNotificationBrokerMBean.java
Mon Feb 13 08:38:37 2012
@@ -0,0 +1,25 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.wsn.services;
+
+import org.apache.cxf.wsn.NotificationBrokerMBean;
+
+public interface JaxwsNotificationBrokerMBean extends NotificationBrokerMBean {
+
+}
Modified:
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/Service.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/Service.java?rev=1243432&r1=1243431&r2=1243432&view=diff
==============================================================================
---
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/Service.java
(original)
+++
cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/Service.java
Mon Feb 13 08:38:37 2012
@@ -19,6 +19,11 @@
package org.apache.cxf.wsn.services;
+import java.lang.management.ManagementFactory;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.cxf.wsn.AbstractCreatePullPoint;
import org.apache.cxf.wsn.AbstractNotificationBroker;
@@ -29,6 +34,7 @@ import org.apache.cxf.wsn.AbstractNotifi
public class Service {
String rootURL = "http://0.0.0.0:9000/wsn";
String activeMqUrl = "vm:(broker:(tcp://localhost:6000)?persistent=false)";
+ boolean jmxEnable = true;
AbstractCreatePullPoint createPullPointServer;
AbstractNotificationBroker notificationBrokerServer;
@@ -39,6 +45,8 @@ public class Service {
activeMqUrl = args[++x];
} else if ("-rootUrl".equals(args[x])) {
rootURL = args[++x];
+ } else if ("-jmxEnable".equals(args[x])) {
+ jmxEnable = Boolean.valueOf(args[++x]);
}
}
@@ -62,6 +70,21 @@ public class Service {
createPullPointServer = new JaxwsCreatePullPoint("CreatePullPoint",
activemq);
createPullPointServer.setAddress(rootURL + "/CreatePullPoint");
createPullPointServer.init();
+
+ if (jmxEnable) {
+
+ MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
+
+ ObjectName nbServerName =
+ new
ObjectName("org.apache.cxf.service.mbeans:type=WSNotificationBroker");
+
+ ObjectName cpServerName = new
ObjectName("org.apache.cxf.service.mbeans:type=CreatePullPoint");
+
+ mbs.registerMBean(notificationBrokerServer, nbServerName);
+
+ mbs.registerMBean(createPullPointServer, cpServerName);
+
+ }
}
}