| /** |
| * 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.camel.component.cxf.blueprint; |
| |
| import java.util.List; |
| |
| import org.apache.cxf.feature.AbstractFeature; |
| import org.apache.cxf.feature.LoggingFeature; |
| import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean; |
| import org.osgi.framework.BundleContext; |
| import org.osgi.service.blueprint.container.BlueprintContainer; |
| |
| public class RsClientBlueprintBean extends JAXRSClientFactoryBean implements BlueprintSupport, Cloneable { |
| private BlueprintContainer blueprintContainer; |
| private BundleContext bundleContext; |
| private boolean loggingFeatureEnabled; |
| private int loggingSizeLimit; |
| |
| public BlueprintContainer getBlueprintContainer() { |
| return blueprintContainer; |
| } |
| |
| public void setBlueprintContainer(BlueprintContainer blueprintContainer) { |
| this.blueprintContainer = blueprintContainer; |
| } |
| |
| public BundleContext getBundleContext() { |
| return bundleContext; |
| } |
| |
| public void setBundleContext(BundleContext bundleContext) { |
| this.bundleContext = bundleContext; |
| } |
| |
| public boolean isLoggingFeatureEnabled() { |
| return loggingFeatureEnabled; |
| } |
| |
| public void setLoggingFeatureEnabled(boolean loggingFeatureEnabled) { |
| this.loggingFeatureEnabled = loggingFeatureEnabled; |
| } |
| |
| public int getLoggingSizeLimit() { |
| return loggingSizeLimit; |
| } |
| |
| public void setLoggingSizeLimit(int loggingSizeLimit) { |
| this.loggingSizeLimit = loggingSizeLimit; |
| } |
| |
| public List<AbstractFeature> getFeatures() { |
| List<AbstractFeature> answer = super.getFeatures(); |
| if (isLoggingFeatureEnabled()) { |
| if (getLoggingSizeLimit() > 0) { |
| answer.add(new LoggingFeature(getLoggingSizeLimit())); |
| } else { |
| answer.add(new LoggingFeature()); |
| } |
| } |
| return answer; |
| } |
| |
| } |