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     * External endpoints are wrapper for endpoints registered
028     * by {@link javax.jbi.component.ComponentContext#registerExternalEndpoint(ServiceEndpoint)}.
029     * These endpoints can not be used to address message exchanges.
030     * 
031     * TODO: this class should be serializable
032     */
033    public class ExternalEndpoint extends AbstractServiceEndpoint {
034    
035        /**
036         * Generated serial version UID
037         */
038        private static final long serialVersionUID = 4257588916448457889L;
039        
040        protected final ServiceEndpoint se;
041        
042        public ExternalEndpoint(ComponentNameSpace cns, ServiceEndpoint se) {
043            super(cns);
044            this.se = se;
045        }
046        
047        /* (non-Javadoc)
048         * @see javax.jbi.servicedesc.ServiceEndpoint#getAsReference(javax.xml.namespace.QName)
049         */
050        public DocumentFragment getAsReference(QName operationName) {
051            return se.getAsReference(operationName);
052        }
053    
054        /* (non-Javadoc)
055         * @see javax.jbi.servicedesc.ServiceEndpoint#getEndpointName()
056         */
057        public String getEndpointName() {
058            return se.getEndpointName();
059        }
060    
061        /* (non-Javadoc)
062         * @see javax.jbi.servicedesc.ServiceEndpoint#getInterfaces()
063         */
064        public QName[] getInterfaces() {
065            return se.getInterfaces();
066        }
067    
068        /* (non-Javadoc)
069         * @see javax.jbi.servicedesc.ServiceEndpoint#getServiceName()
070         */
071        public QName getServiceName() {
072            return se.getServiceName();
073        }
074    
075        protected String getClassifier() {
076            return "external";
077        }
078    
079    }