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.xml.namespace.QName;
020    
021    import org.w3c.dom.DocumentFragment;
022    
023    /**
024     * Linked endpoints are defined by SA deployment.
025     * They act as proxies for real endpoints.
026     */
027    public class LinkedEndpoint extends AbstractServiceEndpoint {
028    
029        /**
030         * Generated serial version UID
031         */
032        private static final long serialVersionUID = 4615848436197469611L;
033        
034        private final QName fromService;
035        private final String fromEndpoint;
036        private final QName toService;
037        private final String toEndpoint;
038        private final String linkType;
039        
040        public LinkedEndpoint(QName fromService,
041                              String fromEndpoint,
042                              QName toService,
043                              String toEndpoint,
044                              String linkType) {
045            super(null);
046            this.fromService = fromService;
047            this.fromEndpoint = fromEndpoint;
048            this.toService = toService;
049            this.toEndpoint = toEndpoint;
050            this.linkType = linkType;
051        }
052        
053        /* (non-Javadoc)
054         * @see javax.jbi.servicedesc.ServiceEndpoint#getAsReference(javax.xml.namespace.QName)
055         */
056        public DocumentFragment getAsReference(QName operationName) {
057            return EndpointReferenceBuilder.getReference(this);
058        }
059    
060        /* (non-Javadoc)
061         * @see javax.jbi.servicedesc.ServiceEndpoint#getEndpointName()
062         */
063        public String getEndpointName() {
064            return this.fromEndpoint;
065        }
066    
067        /* (non-Javadoc)
068         * @see javax.jbi.servicedesc.ServiceEndpoint#getInterfaces()
069         */
070        public QName[] getInterfaces() {
071            return null;
072        }
073    
074        /* (non-Javadoc)
075         * @see javax.jbi.servicedesc.ServiceEndpoint#getServiceName()
076         */
077        public QName getServiceName() {
078            return this.fromService;
079        }
080    
081        /**
082         * Get the link type.
083         * @return the link type
084         */
085        public String getLinkType() {
086            return linkType;
087        }
088    
089        /**
090         * Get the destination endpoint.
091         * @return the destination endpoint
092         */
093        public String getToEndpoint() {
094            return toEndpoint;
095        }
096    
097        /**
098         * Get the destination service.
099         * @return the destination service
100         */
101        public QName getToService() {
102            return toService;
103        }
104    
105        protected String getClassifier() {
106            return "linked";
107        }
108    
109    }