package io.tracee.cxf.client;

import io.tracee.Tracee;
import io.tracee.TraceeBackend;
import io.tracee.cxf.interceptor.*;
import org.apache.cxf.Bus;
import org.apache.cxf.feature.AbstractFeature;
import org.apache.cxf.interceptor.InterceptorProvider;

public class TraceeCxfFeature extends AbstractFeature {

	private String profile;
	private TraceeBackend backend;

	public TraceeCxfFeature() {
		this(Tracee.getBackend());
	}

	public TraceeCxfFeature(TraceeBackend backend) {
		this.backend = backend;
	}

	public TraceeCxfFeature(String profile) {
		this.profile = profile;
	}

	@Override
	protected void initializeProvider(InterceptorProvider provider, Bus bus) {
		final TraceeRequestInInterceptor requestInInterceptor = new TraceeRequestInInterceptor(backend, profile);
		final TraceeResponseInInterceptor responseInInterceptor = new TraceeResponseInInterceptor(backend, profile);
		final TraceeRequestOutInterceptor requestOutInterceptor = new TraceeRequestOutInterceptor(backend, profile);
		final TraceeResponseOutInterceptor responseOutInterceptor = new TraceeResponseOutInterceptor(backend, profile);

		provider.getInInterceptors().add(requestInInterceptor);
		provider.getInInterceptors().add(responseInInterceptor);

		provider.getOutInterceptors().add(requestOutInterceptor);
		provider.getOutInterceptors().add(responseOutInterceptor);

		provider.getInFaultInterceptors().add(requestInInterceptor);
		provider.getOutFaultInterceptors().add(responseOutInterceptor);
	}
}

@@ -1363,18 +1363,19 @@
 ider.get
-In
+Out
 FaultInt
@@ -1384,39 +1384,41 @@
 ceptors().add(re
-questIn
+sponseOut
 Interceptor);%0A%09%09
@@ -1421,35 +1421,34 @@
 ;%0A%09%09provider.get
-Out
+In
 FaultInterceptor
@@ -1453,33 +1453,31 @@
 ors().add(re
-sponseOut
+questIn
 Interceptor)

Switch lines to clarify request/response handling