Author: alessio.soldano(a)jboss.com
Date: 2012-10-25 10:42:43 -0400 (Thu, 25 Oct 2012)
New Revision: 16948
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/management/WEB-INF/jboss-webservices.xml
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/transport/ServletHelper.java
stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/management/WEB-INF/web.xml
Log:
[JBWS-3561] Moving cxf management conf option to jboss-webservices.xml and updating
testcase
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java 2012-10-24
17:13:44 UTC (rev 16947)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java 2012-10-25
14:42:43 UTC (rev 16948)
@@ -68,9 +68,6 @@
//keep the bus created during deployment and update it with the information coming
from the servlet config
updateAvailableBusWithServletInfo(servletConfig);
-
- //register the InstrumentManagementImpl
- ServletHelper.registerInstrumentManger(bus, getServletContext());
}
private void updateAvailableBusWithServletInfo(ServletConfig servletConfig)
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java 2012-10-24
17:13:44 UTC (rev 16947)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java 2012-10-25
14:42:43 UTC (rev 16948)
@@ -30,6 +30,11 @@
import org.apache.cxf.buslifecycle.BusLifeCycleListener;
import org.apache.cxf.buslifecycle.BusLifeCycleManager;
import org.apache.cxf.configuration.Configurer;
+import org.apache.cxf.management.InstrumentationManager;
+import org.apache.cxf.management.counters.CounterRepository;
+import org.apache.cxf.management.interceptor.ResponseTimeMessageInInterceptor;
+import org.apache.cxf.management.interceptor.ResponseTimeMessageInvokerInterceptor;
+import org.apache.cxf.management.interceptor.ResponseTimeMessageOutInterceptor;
import org.apache.cxf.resource.ResourceManager;
import org.apache.cxf.resource.ResourceResolver;
import org.apache.cxf.transport.DestinationFactoryManager;
@@ -48,6 +53,7 @@
import org.jboss.wsf.stack.cxf.interceptor.EnableDecoupledFaultInterceptor;
import org.jboss.wsf.stack.cxf.interceptor.EndpointAssociationInterceptor;
import org.jboss.wsf.stack.cxf.interceptor.NsCtxSelectorStoreInterceptor;
+import org.jboss.wsf.stack.cxf.management.InstrumentationManagerExtImpl;
/**
* A wrapper of the Bus for performing most of the configurations required on it by
JBossWS
@@ -103,6 +109,7 @@
}
setAdditionalWorkQueues(bus, props);
+ setCXFManagement(bus, props);
}
@@ -200,6 +207,34 @@
}
}
+ protected static void setCXFManagement(Bus bus, Map<String, String> props) {
+ if (props != null && !props.isEmpty()) {
+ final String p = props.get(Constants.CXF_MANAGEMENT_ENABLED);
+ if ("true".equalsIgnoreCase(p) || "1".equalsIgnoreCase(p))
{
+ InstrumentationManagerExtImpl instrumentationManagerImpl = new
InstrumentationManagerExtImpl();
+ instrumentationManagerImpl.setBus(bus);
+ instrumentationManagerImpl.setEnabled(true);
+ instrumentationManagerImpl.initMBeanServer();
+ instrumentationManagerImpl.register();
+ bus.setExtension(instrumentationManagerImpl, InstrumentationManager.class);
+ CounterRepository couterRepository = new CounterRepository();
+ couterRepository.setBus(bus);
+ final String installRespTimeInterceptors =
props.get(Constants.CXF_MANAGEMENT_INSTALL_RESPONSE_TIME_INTERCEPTORS);
+ if (installRespTimeInterceptors == null ||
+ "true".equalsIgnoreCase(installRespTimeInterceptors) ||
+ "1".equalsIgnoreCase(installRespTimeInterceptors)) {
+ ResponseTimeMessageInInterceptor in = new
ResponseTimeMessageInInterceptor();
+ ResponseTimeMessageInvokerInterceptor invoker = new
ResponseTimeMessageInvokerInterceptor();
+ ResponseTimeMessageOutInterceptor out = new
ResponseTimeMessageOutInterceptor();
+ bus.getInInterceptors().add(in);
+ bus.getInInterceptors().add(invoker);
+ bus.getOutInterceptors().add(out);
+ }
+ bus.setExtension(couterRepository, CounterRepository.class);
+ }
+ }
+ }
+
private static AlternativeSelector getAlternativeSelector(Map<String, String>
props) {
//default to MaximalAlternativeSelector on server side [JBWS-3149]
AlternativeSelector selector = new MaximalAlternativeSelector();
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/transport/ServletHelper.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/transport/ServletHelper.java 2012-10-24
17:13:44 UTC (rev 16947)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/transport/ServletHelper.java 2012-10-25
14:42:43 UTC (rev 16948)
@@ -38,11 +38,6 @@
import org.apache.cxf.BusFactory;
import org.apache.cxf.frontend.ServerFactoryBean;
import org.apache.cxf.jaxws.support.JaxWsEndpointImpl;
-import org.apache.cxf.management.InstrumentationManager;
-import org.apache.cxf.management.counters.CounterRepository;
-import org.apache.cxf.management.interceptor.ResponseTimeMessageInInterceptor;
-import org.apache.cxf.management.interceptor.ResponseTimeMessageInvokerInterceptor;
-import org.apache.cxf.management.interceptor.ResponseTimeMessageOutInterceptor;
import org.jboss.ws.common.ObjectNameFactory;
import org.jboss.ws.common.injection.InjectionHelper;
import org.jboss.wsf.spi.SPIProvider;
@@ -55,7 +50,6 @@
import org.jboss.wsf.spi.management.EndpointRegistry;
import org.jboss.wsf.spi.management.EndpointRegistryFactory;
import org.jboss.wsf.stack.cxf.Messages;
-import org.jboss.wsf.stack.cxf.management.InstrumentationManagerExtImpl;
/**
*
@@ -173,33 +167,4 @@
BusFactory.setThreadDefaultBus(null);
}
}
-
- public static void registerInstrumentManger(Bus bus, ServletContext svCtx) throws
ServletException
- {
- if (svCtx.getInitParameter(ENABLE_CXF_MANAGEMENT) != null
- && "true".equalsIgnoreCase((String)
svCtx.getInitParameter(ENABLE_CXF_MANAGEMENT)))
- {
- InstrumentationManagerExtImpl instrumentationManagerImpl = new
InstrumentationManagerExtImpl();
- instrumentationManagerImpl.setBus(bus);
- instrumentationManagerImpl.setEnabled(true);
- instrumentationManagerImpl.initMBeanServer();
- instrumentationManagerImpl.register();
- bus.setExtension(instrumentationManagerImpl, InstrumentationManager.class);
-
- //attach couterRepository
- CounterRepository couterRepository = new CounterRepository();
- couterRepository.setBus(bus);
-
-
- ResponseTimeMessageInInterceptor in = new ResponseTimeMessageInInterceptor();
- ResponseTimeMessageInvokerInterceptor invoker = new
ResponseTimeMessageInvokerInterceptor();
- ResponseTimeMessageOutInterceptor out = new
ResponseTimeMessageOutInterceptor();
-
- bus.getInInterceptors().add(in);
- bus.getInInterceptors().add(invoker);
- bus.getOutInterceptors().add(out);
- bus.setExtension(couterRepository, CounterRepository.class);
-
- }
- }
}
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml 2012-10-24
17:13:44 UTC (rev 16947)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml 2012-10-25
14:42:43 UTC (rev 16948)
@@ -300,6 +300,9 @@
<include
name="org/jboss/test/ws/jaxws/cxf/management/HelloWorldImpl.class" />
<include
name="org/jboss/test/ws/jaxws/cxf/management/HelloWorld.class"/>
</classes>
+ <webinf
dir="${tests.output.dir}/test-resources/jaxws/cxf/management/WEB-INF">
+ <include name="jboss-webservices.xml"/>
+ </webinf>
</war>
<!-- jaxws-cxf-mixtype-->
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/management/WEB-INF/jboss-webservices.xml
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/management/WEB-INF/jboss-webservices.xml
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/management/WEB-INF/jboss-webservices.xml 2012-10-25
14:42:43 UTC (rev 16948)
@@ -0,0 +1,13 @@
+<?xml version="1.1" encoding="UTF-8"?>
+<webservices
+
xmlns="http://www.jboss.com/xml/ns/javaee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ version="1.2"
+
xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee">
+
+ <property>
+ <name>cxf.management.enabled</name>
+ <value>true</value>
+ </property>
+
+</webservices>
\ No newline at end of file
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/management/WEB-INF/web.xml
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/management/WEB-INF/web.xml 2012-10-24
17:13:44 UTC (rev 16947)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/management/WEB-INF/web.xml 2012-10-25
14:42:43 UTC (rev 16948)
@@ -4,10 +4,6 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
- <context-param>
- <param-name>enable.cxf.management</param-name>
- <param-value>true</param-value>
- </context-param>
<servlet>
<servlet-name>HelloWorldService</servlet-name>
<servlet-class>org.jboss.test.ws.jaxws.cxf.management.HelloWorldImpl</servlet-class>