1 17 package org.apache.servicemix.common; 18 19 import org.apache.commons.logging.Log; 20 import org.w3c.dom.Document ; 21 22 import javax.jbi.messaging.MessageExchange; 23 import javax.jbi.messaging.MessageExchange.Role; 24 import javax.wsdl.Definition; 25 import javax.xml.namespace.QName ; 26 27 public abstract class Endpoint { 28 29 protected QName service; 30 protected String endpoint; 31 protected QName interfaceName; 32 protected Document description; 33 protected Definition definition; 34 protected ServiceUnit serviceUnit; 35 protected Log logger; 36 37 public Endpoint() { 38 } 39 40 public Endpoint(ServiceUnit serviceUnit, QName service, String endpoint) { 41 this.serviceUnit = serviceUnit; 42 this.service = service; 43 this.endpoint = endpoint; 44 } 45 46 49 public String getEndpoint() { 50 return endpoint; 51 } 52 55 public void setEndpoint(String endpoint) { 56 this.endpoint = endpoint; 57 } 58 61 public QName getService() { 62 return service; 63 } 64 67 public void setService(QName service) { 68 this.service = service; 69 } 70 73 public abstract Role getRole(); 74 77 public Document getDescription() { 78 return description; 79 } 80 83 public void setDescription(Document description) { 84 this.description = description; 85 } 86 89 public QName getInterfaceName() { 90 return interfaceName; 91 } 92 95 public void setInterfaceName(QName interfaceName) { 96 this.interfaceName = interfaceName; 97 } 98 101 public ServiceUnit getServiceUnit() { 102 return serviceUnit; 103 } 104 105 108 public void setServiceUnit(ServiceUnit serviceUnit) { 109 this.serviceUnit = serviceUnit; 110 this.logger = serviceUnit.component.logger; 111 } 112 113 public boolean isExchangeOkay(MessageExchange exchange) { 114 return true; 116 } 117 118 public abstract void activate() throws Exception ; 119 120 public abstract void deactivate() throws Exception ; 121 122 public abstract ExchangeProcessor getProcessor(); 123 124 public String toString() { 125 return "Endpoint[service: " + service + ", " + 126 "endpoint: " + endpoint + ", " + 127 "role: " + (getRole() == Role.PROVIDER ? "provider" : "consumer") + "]"; 128 } 129 130 public Definition getDefinition() { 131 return definition; 132 } 133 134 public void setDefinition(Definition definition) { 135 this.definition = definition; 136 } 137 138 } 139 | Popular Tags |