You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ni...@apache.org on 2009/02/17 14:25:49 UTC

svn commit: r745043 - in /commons/sandbox/monitoring/branches/modules/instrumentation/src/main/java/org/apache/commons/monitoring/instrumentation/cxf: HttpMonitoringFeature.java MonitoringFeature.java

Author: nicolas
Date: Tue Feb 17 13:25:48 2009
New Revision: 745043

URL: http://svn.apache.org/viewvc?rev=745043&view=rev
Log:
feature CXF - experimental

Added:
    commons/sandbox/monitoring/branches/modules/instrumentation/src/main/java/org/apache/commons/monitoring/instrumentation/cxf/HttpMonitoringFeature.java
    commons/sandbox/monitoring/branches/modules/instrumentation/src/main/java/org/apache/commons/monitoring/instrumentation/cxf/MonitoringFeature.java

Added: commons/sandbox/monitoring/branches/modules/instrumentation/src/main/java/org/apache/commons/monitoring/instrumentation/cxf/HttpMonitoringFeature.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/branches/modules/instrumentation/src/main/java/org/apache/commons/monitoring/instrumentation/cxf/HttpMonitoringFeature.java?rev=745043&view=auto
==============================================================================
--- commons/sandbox/monitoring/branches/modules/instrumentation/src/main/java/org/apache/commons/monitoring/instrumentation/cxf/HttpMonitoringFeature.java (added)
+++ commons/sandbox/monitoring/branches/modules/instrumentation/src/main/java/org/apache/commons/monitoring/instrumentation/cxf/HttpMonitoringFeature.java Tue Feb 17 13:25:48 2009
@@ -0,0 +1,33 @@
+/*
+ * 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.commons.monitoring.instrumentation.cxf;
+
+/**
+ * Variant of MonitoringFeature to enable monitoring of CXF web services EndPoints when deployed as HttpServlet
+ * 
+ * @author <a href="mailto:nicolas@apache.org">Nicolas De Loof</a>
+ */
+public class HttpMonitoringFeature
+    extends MonitoringFeature
+{
+    @Override
+    protected MonitoringInInterceptor getMonitoringInInterceptor()
+    {
+        return new HttpMonitoringInInterceptor();
+    }
+}

Added: commons/sandbox/monitoring/branches/modules/instrumentation/src/main/java/org/apache/commons/monitoring/instrumentation/cxf/MonitoringFeature.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/branches/modules/instrumentation/src/main/java/org/apache/commons/monitoring/instrumentation/cxf/MonitoringFeature.java?rev=745043&view=auto
==============================================================================
--- commons/sandbox/monitoring/branches/modules/instrumentation/src/main/java/org/apache/commons/monitoring/instrumentation/cxf/MonitoringFeature.java (added)
+++ commons/sandbox/monitoring/branches/modules/instrumentation/src/main/java/org/apache/commons/monitoring/instrumentation/cxf/MonitoringFeature.java Tue Feb 17 13:25:48 2009
@@ -0,0 +1,80 @@
+/*
+ * 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.commons.monitoring.instrumentation.cxf;
+
+import org.apache.commons.monitoring.Repository;
+import org.apache.cxf.Bus;
+import org.apache.cxf.feature.AbstractFeature;
+import org.apache.cxf.interceptor.InterceptorProvider;
+
+/**
+ * CXF feature to enable web service monitoring.
+ * 
+ * <pre>
+ * &lt;jaxws:endpoint implementor=&quot;#myServiceBean&quot; address=&quot;/myService&quot; wsdlLocation=&quot;wsdl/myService.wsdl&quot;&gt;
+ *   &lt;jaxws:features&gt;
+ *     &lt;bean class=&quot;org.apache.commons.monitoring.instrumentation.cxf.MonitoringFeature&quot; /&gt;
+ *   &lt;/jaxws:features&gt;
+ * &lt;/jaxws:endpoint&gt;
+ * </pre>
+ * 
+ * @author <a href="mailto:nicolas@apache.org">Nicolas De Loof</a>
+ */
+public class MonitoringFeature
+    extends AbstractFeature
+{
+    private Repository repository;
+
+    private String category = "soap";
+
+    private String domain;
+
+    @Override
+    protected void initializeProvider( InterceptorProvider provider, Bus bus )
+    {
+        MonitoringInInterceptor in = getMonitoringInInterceptor();
+        in.setRepository( repository );
+        in.setCategory( category );
+        in.setDomain( domain );
+        MonitoringOutInterceptor out = new MonitoringOutInterceptor();
+        provider.getInInterceptors().add( in );
+        provider.getInFaultInterceptors().add( in );
+        provider.getOutInterceptors().add( out );
+        provider.getOutFaultInterceptors().add( out );
+    }
+
+    protected MonitoringInInterceptor getMonitoringInInterceptor()
+    {
+        return new MonitoringInInterceptor();
+    }
+
+    public void setRepository( Repository repository )
+    {
+        this.repository = repository;
+    }
+
+    public void setCategory( String category )
+    {
+        this.category = category;
+    }
+
+    public void setDomain( String domain )
+    {
+        this.domain = domain;
+    }
+}