001 /*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017 package org.apache.servicemix.jbi.servicedesc;
018
019 import javax.jbi.servicedesc.ServiceEndpoint;
020 import javax.xml.namespace.QName;
021
022 import org.w3c.dom.DocumentFragment;
023
024 import org.apache.servicemix.jbi.framework.ComponentNameSpace;
025
026 /**
027 * Dynamic endpoints are used to route exchanges using endpoint references.
028 */
029 public class DynamicEndpoint extends AbstractServiceEndpoint {
030
031 /**
032 * Generated serial version UID
033 */
034 private static final long serialVersionUID = -9084647509619730734L;
035
036 private final QName serviceName;
037 private final String endpointName;
038 private final transient DocumentFragment epr;
039
040 public DynamicEndpoint(ComponentNameSpace componentName,
041 ServiceEndpoint endpoint,
042 DocumentFragment epr) {
043 super(componentName);
044 this.serviceName = endpoint.getServiceName();
045 this.endpointName = endpoint.getEndpointName();
046 this.epr = epr;
047 }
048
049 /* (non-Javadoc)
050 * @see javax.jbi.servicedesc.ServiceEndpoint#getAsReference(javax.xml.namespace.QName)
051 */
052 public DocumentFragment getAsReference(QName operationName) {
053 return epr;
054 }
055
056 /* (non-Javadoc)
057 * @see javax.jbi.servicedesc.ServiceEndpoint#getEndpointName()
058 */
059 public String getEndpointName() {
060 return endpointName;
061 }
062
063 /* (non-Javadoc)
064 * @see javax.jbi.servicedesc.ServiceEndpoint#getInterfaces()
065 */
066 public QName[] getInterfaces() {
067 return null;
068 }
069
070 /* (non-Javadoc)
071 * @see javax.jbi.servicedesc.ServiceEndpoint#getServiceName()
072 */
073 public QName getServiceName() {
074 return serviceName;
075 }
076
077 protected String getClassifier() {
078 return "dynamic";
079 }
080
081 }