1 17 package org.apache.servicemix.jbi.container; 18 19 import org.apache.servicemix.jbi.messaging.PojoMarshaler; 20 import org.apache.servicemix.jbi.resolver.EndpointChooser; 21 import org.apache.servicemix.jbi.resolver.EndpointResolver; 22 import org.apache.servicemix.jbi.resolver.InterfaceNameEndpointResolver; 23 import org.apache.servicemix.jbi.resolver.ServiceAndEndpointNameResolver; 24 import org.apache.servicemix.jbi.resolver.ServiceNameEndpointResolver; 25 import org.apache.servicemix.jbi.resolver.URIResolver; 26 27 import javax.xml.namespace.QName ; 28 29 import java.io.Serializable ; 30 31 39 public class ActivationSpec implements Serializable { 40 41 static final long serialVersionUID = 8458586342841647313L; 42 private String id; 43 private String componentName; 44 private Object component; 45 private QName service; 46 private QName interfaceName; 47 private QName operation; 48 private String endpoint; 49 private transient EndpointResolver destinationResolver; 50 private transient EndpointChooser interfaceChooser; 51 private transient EndpointChooser serviceChooser; 52 private QName destinationService; 53 private QName destinationInterface; 54 private QName destinationOperation; 55 private String destinationEndpoint; 56 private transient PojoMarshaler marshaler; 57 private SubscriptionSpec[] subscriptions = {}; 58 private boolean failIfNoDestinationEndpoint = true; 59 private Boolean persistent; 60 private String destinationUri; 61 62 63 public ActivationSpec() { 64 } 65 66 public ActivationSpec(Object component) { 67 this.component = component; 68 } 69 70 public ActivationSpec(String id, Object component) { 71 this.id = id; 72 this.component = component; 73 } 74 75 80 public String getId() { 81 return id; 82 } 83 84 89 public void setId(String id) { 90 this.id = id; 91 } 92 93 public String getComponentName() { 94 return componentName; 95 } 96 97 public void setComponentName(String componentName) { 98 this.componentName = componentName; 99 } 100 101 105 public Object getComponent() { 106 return component; 107 } 108 109 public void setComponent(Object component) { 110 this.component = component; 111 } 112 113 116 public QName getService() { 117 return service; 118 } 119 120 public void setService(QName service) { 121 this.service = service; 122 } 123 124 127 public String getEndpoint() { 128 return endpoint; 129 } 130 131 public void setEndpoint(String endpoint) { 132 this.endpoint = endpoint; 133 } 134 135 public QName getInterfaceName() { 136 return interfaceName; 137 } 138 139 public void setInterfaceName(QName interfaceName) { 140 this.interfaceName = interfaceName; 141 } 142 143 public QName getOperation() { 144 return operation; 145 } 146 147 public void setOperation(QName operation) { 148 this.operation = operation; 149 } 150 151 157 public EndpointResolver getDestinationResolver() { 158 if (destinationResolver == null) { 159 destinationResolver = createEndpointResolver(); 160 } 161 return destinationResolver; 162 } 163 164 170 public void setDestinationResolver(EndpointResolver destinationResolver) { 171 this.destinationResolver = destinationResolver; 172 } 173 174 175 public EndpointChooser getInterfaceChooser() { 176 return interfaceChooser; 177 } 178 179 public void setInterfaceChooser(EndpointChooser interfaceChooser) { 180 this.interfaceChooser = interfaceChooser; 181 } 182 183 public EndpointChooser getServiceChooser() { 184 return serviceChooser; 185 } 186 187 public void setServiceChooser(EndpointChooser serviceChooser) { 188 this.serviceChooser = serviceChooser; 189 } 190 191 194 public QName getDestinationService() { 195 return destinationService; 196 } 197 198 public void setDestinationService(QName destinationService) { 199 this.destinationService = destinationService; 200 } 201 202 205 public QName getDestinationInterface() { 206 return destinationInterface; 207 } 208 209 public void setDestinationInterface(QName destinationInterface) { 210 this.destinationInterface = destinationInterface; 211 } 212 213 216 public QName getDestinationOperation() { 217 return destinationOperation; 218 } 219 220 public void setDestinationOperation(QName destinationOperation) { 221 this.destinationOperation = destinationOperation; 222 } 223 224 227 public String getDestinationEndpoint() { 228 return destinationEndpoint; 229 } 230 231 public void setDestinationEndpoint(String destinationEndpoint) { 232 this.destinationEndpoint = destinationEndpoint; 233 } 234 235 public PojoMarshaler getMarshaler() { 236 return marshaler; 237 } 238 239 public void setMarshaler(PojoMarshaler marshaler) { 240 this.marshaler = marshaler; 241 } 242 243 public SubscriptionSpec[] getSubscriptions() { 244 return subscriptions; 245 } 246 247 public void setSubscriptions(SubscriptionSpec[] subscriptions) { 248 this.subscriptions = subscriptions; 249 } 250 251 public boolean isFailIfNoDestinationEndpoint() { 252 return failIfNoDestinationEndpoint; 253 } 254 255 262 public void setFailIfNoDestinationEndpoint(boolean failIfNoDestinationEndpoint) { 263 this.failIfNoDestinationEndpoint = failIfNoDestinationEndpoint; 264 } 265 266 269 protected EndpointResolver createEndpointResolver() { 270 if (destinationService != null) { 272 if (destinationEndpoint != null) { 273 return new ServiceAndEndpointNameResolver(destinationService, destinationEndpoint); 274 } 275 else { 276 return new ServiceNameEndpointResolver(destinationService); 277 } 278 } 279 else if (destinationInterface != null) { 280 return new InterfaceNameEndpointResolver(destinationInterface); 281 } else if (destinationUri != null) { 282 return new URIResolver(destinationUri); 283 } 284 return null; 285 } 286 287 public Boolean getPersistent() { 288 return persistent; 289 } 290 291 298 public void setPersistent(Boolean persistent) { 299 this.persistent = persistent; 300 } 301 302 305 public String getDestinationUri() { 306 return destinationUri; 307 } 308 309 312 public void setDestinationUri(String destinationUri) { 313 this.destinationUri = destinationUri; 314 } 315 316 317 } 318 | Popular Tags |