001: /**
002: * Licensed to the Apache Software Foundation (ASF) under one
003: * or more contributor license agreements. See the NOTICE file
004: * distributed with this work for additional information
005: * regarding copyright ownership. The ASF licenses this file
006: * to you under the Apache License, Version 2.0 (the
007: * "License"); you may not use this file except in compliance
008: * with 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,
013: * software distributed under the License is distributed on an
014: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015: * KIND, either express or implied. See the License for the
016: * specific language governing permissions and limitations
017: * under the License.
018: */package org.apache.cxf.service.model;
019:
020: import javax.xml.namespace.QName;
021:
022: import org.apache.cxf.ws.addressing.EndpointReferenceType;
023: import org.apache.cxf.wsdl.EndpointReferenceUtils;
024:
025: public class EndpointInfo extends AbstractDescriptionElement {
026: String transportId;
027: ServiceInfo service;
028: BindingInfo binding;
029: QName name;
030: EndpointReferenceType address;
031:
032: public EndpointInfo() {
033: }
034:
035: public EndpointInfo(ServiceInfo serv, String ns) {
036: transportId = ns;
037: service = serv;
038: }
039:
040: public String getTransportId() {
041: return transportId;
042: }
043:
044: public void setTransportId(String tid) {
045: transportId = tid;
046: }
047:
048: public InterfaceInfo getInterface() {
049: return service.getInterface();
050: }
051:
052: public ServiceInfo getService() {
053: return service;
054: }
055:
056: public QName getName() {
057: return name;
058: }
059:
060: public void setName(QName n) {
061: name = n;
062: }
063:
064: public BindingInfo getBinding() {
065: return binding;
066: }
067:
068: public void setBinding(BindingInfo b) {
069: binding = b;
070: }
071:
072: public String getAddress() {
073: return (null != address) ? address.getAddress().getValue()
074: : null;
075: }
076:
077: public void setAddress(String addr) {
078: if (null == address) {
079: address = EndpointReferenceUtils.getEndpointReference(addr);
080: } else {
081: EndpointReferenceUtils.setAddress(address, addr);
082: }
083: }
084:
085: public void setAddress(EndpointReferenceType endpointReference) {
086: address = endpointReference;
087: }
088:
089: @Override
090: public <T> T getTraversedExtensor(T defaultValue, Class<T> type) {
091: T value = getExtensor(type);
092:
093: if (value == null) {
094: if (value == null && binding != null) {
095: value = binding.getExtensor(type);
096: }
097:
098: if (service != null && value == null) {
099: value = service.getExtensor(type);
100: }
101:
102: if (value == null) {
103: value = defaultValue;
104: }
105: }
106:
107: return value;
108: }
109:
110: public EndpointReferenceType getTarget() {
111: return address;
112: }
113: }
|