001 /**
002 *
003 * Licensed to the Apache Software Foundation (ASF) under one or more
004 * contributor license agreements. See the NOTICE file distributed with
005 * this work for additional information regarding copyright ownership.
006 * The ASF licenses this file to You under the Apache License, Version 2.0
007 * (the "License"); you may not use this file except in compliance with
008 * the License. You may obtain a copy of the License at
009 *
010 * http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018 package org.apache.camel.component.cxf;
019
020 import java.util.Properties;
021
022 import org.apache.camel.Consumer;
023 import org.apache.camel.Processor;
024 import org.apache.camel.Producer;
025 import org.apache.camel.impl.DefaultEndpoint;
026 import org.apache.cxf.Bus;
027 import org.apache.cxf.message.Message;
028
029 /**
030 * The endpoint in the service engine
031 *
032 * @version $Revision: 537816 $
033 */
034 public class CxfInvokeEndpoint extends DefaultEndpoint<CxfExchange> {
035 private CxfBinding binding;
036 private final CxfInvokeComponent component;
037 private boolean inOut = true;
038 private Properties properties;
039
040 public CxfInvokeEndpoint(String uri, CxfInvokeComponent component, Properties properties) {
041 super(uri, component);
042 this.component = component;
043 this.properties = properties;
044 }
045
046 public Producer<CxfExchange> createProducer() throws Exception {
047 return new CxfInvokeProducer(this);
048 }
049
050 public Consumer<CxfExchange> createConsumer(Processor processor) throws Exception {
051 return new CxfInvokeConsumer(this, processor);
052 }
053
054 public CxfExchange createExchange() {
055 return new CxfExchange(getContext(), getBinding());
056 }
057
058 public CxfExchange createExchange(Message inMessage) {
059 return new CxfExchange(getContext(), getBinding(), inMessage);
060 }
061
062 public CxfBinding getBinding() {
063 if (binding == null) {
064 binding = new CxfBinding();
065 }
066 return binding;
067 }
068
069 public void setBinding(CxfBinding binding) {
070 this.binding = binding;
071 }
072
073 public boolean isInOut() {
074 return inOut;
075 }
076
077 public void setInOut(boolean inOut) {
078 this.inOut = inOut;
079 }
080
081 public CxfInvokeComponent getComponent() {
082 return component;
083 }
084
085 public String getProperty(String key) {
086 return properties.getProperty(key);
087 }
088
089 public Bus getBus() {
090 return component.getBus();
091 }
092
093 public boolean isSingleton() {
094 return true;
095 }
096
097 }