1
2
3
4
5
6
7
8 package it.imolinfo.jbi4corba.jbi.endpoint;
9
10 import it.imolinfo.jbi4corba.Logger;
11 import it.imolinfo.jbi4corba.LoggerFactory;
12 import it.imolinfo.jbi4corba.exception.ClassGenerationException;
13 import it.imolinfo.jbi4corba.exception.Jbi4CorbaDeployException;
14 import it.imolinfo.jbi4corba.exception.Jbi4CorbaException;
15 import it.imolinfo.jbi4corba.exception.ServiceActivationException;
16 import it.imolinfo.jbi4corba.exception.ServiceCreationException;
17 import it.imolinfo.jbi4corba.jbi.Messages;
18 import it.imolinfo.jbi4corba.jbi.component.runtime.RuntimeContext;
19 import it.imolinfo.jbi4corba.jbi.processor.ConsumerExchangeProcessor;
20 import it.imolinfo.jbi4corba.jbi.processor.ExchangeProcessor;
21 import it.imolinfo.jbi4corba.jbi.wsdl.Jbi4CorbaExtensionUtils;
22 import it.imolinfo.jbi4corba.webservice.descriptor.ConsumerServiceDescriptor;
23 import it.imolinfo.jbi4corba.webservice.generator.ConsumerServiceClassesGenerator;
24 import it.imolinfo.jbi4corba.webservice.generator.ServerCorbaClassesHolder;
25 import it.imolinfo.jbi4corba.webservice.runtime.ConsumerServiceCreator;
26
27 import java.io.File;
28 import java.io.FileWriter;
29 import java.io.IOException;
30 import java.util.Iterator;
31 import java.util.List;
32 import java.util.Map;
33
34 import javax.jbi.component.ComponentContext;
35 import javax.jbi.management.DeploymentException;
36 import javax.jbi.messaging.DeliveryChannel;
37 import javax.jbi.messaging.MessageExchange;
38 import javax.jbi.messaging.MessagingException;
39 import javax.jbi.messaging.MessageExchange.Role;
40 import javax.jbi.servicedesc.ServiceEndpoint;
41 import javax.wsdl.Binding;
42 import javax.wsdl.BindingFault;
43 import javax.wsdl.BindingInput;
44 import javax.wsdl.BindingOperation;
45 import javax.wsdl.BindingOutput;
46 import javax.wsdl.Definition;
47 import javax.wsdl.Fault;
48 import javax.wsdl.Input;
49 import javax.wsdl.Operation;
50 import javax.wsdl.Output;
51 import javax.wsdl.Port;
52 import javax.wsdl.PortType;
53 import javax.wsdl.Service;
54 import javax.wsdl.WSDLException;
55 import javax.wsdl.extensions.ExtensionRegistry;
56 import javax.wsdl.extensions.ExtensionSerializer;
57 import javax.wsdl.extensions.soap.SOAPAddress;
58 import javax.wsdl.extensions.soap.SOAPBinding;
59 import javax.wsdl.extensions.soap.SOAPBody;
60 import javax.wsdl.extensions.soap.SOAPOperation;
61 import javax.wsdl.factory.WSDLFactory;
62 import javax.wsdl.xml.WSDLWriter;
63 import javax.xml.namespace.QName;
64
65 import org.omg.CORBA.ORB;
66
67 import com.ibm.wsdl.extensions.PopulatedExtensionRegistry;
68 import com.ibm.wsdl.extensions.soap.SOAPBodyImpl;
69 import com.ibm.wsdl.extensions.soap.SOAPConstants;
70
71
72
73
74 @SuppressWarnings("unchecked")
75 public class ConsumerEndpoint extends Jbi4CorbaEndpoint {
76
77
78 private static final long serialVersionUID = -8507941260052862451L;
79
80
81
82
83 private static final String SOAP_NAMESPACE_PREFIX = "soap";
84
85
86
87
88 private static final Logger LOG = LoggerFactory
89 .getLogger(ConsumerEndpoint.class);
90
91
92
93
94 private static final Messages MESSAGES = Messages
95 .getMessages(ConsumerEndpoint.class);
96
97 private ConsumerExchangeProcessor consumerExchangeProcessor;
98
99 private ConsumerServiceDescriptor consumerServiceDescriptor;
100
101
102
103
104
105 public ConsumerEndpoint(QName serviceName, String endpointName,
106 ConsumerServiceDescriptor consumerServiceDescriptor) {
107 super(serviceName, endpointName);
108 this.consumerServiceDescriptor = consumerServiceDescriptor;
109 consumerServiceDescriptor.setEndpoint(this);
110 consumerExchangeProcessor = new ConsumerExchangeProcessor(this);
111 }
112
113
114
115
116
117
118
119 public void activate() throws Jbi4CorbaException {
120
121 startServiceAndOrb();
122
123 LOG.debug("consumer endpoint: " + this + " activated.");
124
125 }
126
127
128
129
130
131
132
133
134
135
136
137
138
139 public void sendAsynch(MessageExchange me, DeliveryChannel channel)
140 throws MessagingException {
141
142 LOG.debug("Sending directly (JBI API)");
143 channel.send(me);
144 }
145
146
147
148
149
150
151
152 private void startServiceAndOrb() throws ServiceActivationException {
153 ConsumerServiceCreator consumerServiceCreator = new ConsumerServiceCreator();
154
155 consumerServiceCreator
156 .registerAndActivateService(consumerServiceDescriptor);
157 final ORB orb = consumerServiceDescriptor.getOrb();
158
159 Thread thread = new Thread(new Runnable() {
160 public void run() {
161 LOG.debug("Activating orb.Thread: "
162 + Thread.currentThread().getName());
163
164 orb.run();
165
166 LOG.debug("Exiting orb.Thread: "
167 + Thread.currentThread().getName());
168 }
169 }, "ORB Runner for service: " + this);
170
171 thread.setContextClassLoader(consumerServiceDescriptor
172 .getServerCorbaClassesHolder().getOriginalClassLoader());
173 thread.start();
174 }
175
176
177
178
179
180
181
182 public void deactivate() {
183 stopServiceAndOrb();
184 }
185
186
187
188
189
190 private void stopServiceAndOrb() {
191
192 consumerServiceDescriptor.getOrb().shutdown(true);
193 }
194
195
196
197
198
199
200
201
202 public ExchangeProcessor getProcessor() {
203 return consumerExchangeProcessor;
204 }
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222 public void registerService() throws Jbi4CorbaDeployException {
223
224 Definition wsdl;
225
226 consumerServiceDescriptor.setComponentRootPath(RuntimeContext
227 .getInstance().getComponentContext().getInstallRoot());
228
229 ServiceEndpoint proxiedService = retrieveProxiedEndpointDefinition();
230 consumerServiceDescriptor.setProxiedService(proxiedService);
231
232 LOG.debug("Component root:"
233 + consumerServiceDescriptor.getComponentRootPath());
234
235
236 try {
237 Jbi4CorbaExtensionUtils.removeCorbaElements(this.getDefinition());
238 } catch (WSDLException e) {
239 String msg = MESSAGES.getString(
240 "CRB000139_Error_removing_JBI4CORBA_elements", e
241 .getMessage());
242 LOG.error(msg, e);
243 throw new Jbi4CorbaDeployException(msg, e);
244 }
245
246
247
248
249 try {
250 wsdl = addSoapElements(consumerServiceDescriptor);
251
252 } catch (WSDLException e) {
253 String msg = MESSAGES.getString(
254 "CRB000138_Error_adding_SOAP_elements", e.getMessage());
255
256 LOG.error(msg, e);
257 throw new Jbi4CorbaDeployException(msg, e);
258 }
259 writeWSDLDocument(wsdl);
260
261 ConsumerServiceClassesGenerator consumerServiceClassesGenerator = new ConsumerServiceClassesGenerator();
262 String wsdlFileName = "file://"
263 + consumerServiceDescriptor.getWsdlFileName();
264
265 ServerCorbaClassesHolder serverCorbaClassesHolder;
266 LOG.debug("consumerServiceDescriptor.getRootPath():"
267 + consumerServiceDescriptor.getRootPath()
268 + "; consumerServiceDescriptor.getComponentRootPath():"
269 + consumerServiceDescriptor.getComponentRootPath());
270 try {
271
272 serverCorbaClassesHolder = consumerServiceClassesGenerator
273 .generateConsumerServiceClasses(wsdlFileName,
274 consumerServiceDescriptor.getRootPath(),
275 consumerServiceDescriptor.getComponentRootPath(),
276 consumerServiceDescriptor.getJbiServiceDescriptor());
277
278 } catch (ClassGenerationException e) {
279 String msg = MESSAGES.getString(
280 "CRB000103_Unable_to_create_service_classes", wsdlFileName,
281 e.getMessage());
282
283 LOG.error(msg, e);
284 throw new Jbi4CorbaDeployException(msg, e);
285 }
286
287 consumerServiceDescriptor
288 .setServerCorbaClassesHolder(serverCorbaClassesHolder);
289
290 ConsumerServiceCreator consumerServiceCreator = new ConsumerServiceCreator();
291 try {
292 consumerServiceCreator.createJbiService(consumerServiceDescriptor);
293 } catch (ServiceCreationException e) {
294 String msg = MESSAGES.getString(
295 "CRB000104_Unable_to_create_jbi_service_consumer",
296 consumerServiceDescriptor, e.getMessage());
297
298 LOG.error(msg, e);
299 throw new Jbi4CorbaDeployException(msg, e);
300 }
301
302 }
303
304
305
306
307
308
309
310
311
312
313
314
315 private static Definition addSoapElements(
316
317 ConsumerServiceDescriptor consumerServiceDescriptor) throws WSDLException {
318
319 Definition def = consumerServiceDescriptor.getServiceWSDLDefinition();
320
321 ExtensionRegistry extReg = def.getExtensionRegistry();
322
323 LOG.debug("Definition=" + def);
324 boolean soapFound = false;
325 LOG.debug("finding soap address ...");
326 Port port = null;
327
328 WSDLFactory factory = WSDLFactory.newInstance();
329
330 LOG.debug("Factory class:" + factory.getClass().getName());
331
332 ExtensionSerializer bindingSerializer = extReg.querySerializer(
333 Binding.class, SOAPConstants.Q_ELEM_SOAP_BINDING);
334
335 def.setExtensionRegistry(new PopulatedExtensionRegistry());
336 LOG.debug("ExtensionRegistry:" + extReg.getClass().getName());
337 LOG.debug("BINDING SERIALIZER: " + bindingSerializer);
338
339 WSDLWriter writer = factory.newWSDLWriter();
340
341 LOG.debug("addSoapElements[PRE]. soapFound=" + soapFound + "; Port="
342 + port + "; factory=" + factory + "; writer=" + writer);
343
344 if (def.getBindings() == null || def.getBindings().size() == 0) {
345
346 LOG.debug("The CONCRETE part of the wsdl is missing.");
347 Definition newDef = addSOAPExtensionsToWSDL(def);
348 consumerServiceDescriptor.setServiceWSDLDefinition(newDef);
349 return newDef;
350
351 } else {
352 LOG.debug("The CONCRETE part of the wsdl is present.");
353 }
354
355 def.addNamespace(SOAP_NAMESPACE_PREFIX, SOAPConstants.NS_URI_SOAP);
356
357 for (Object serviceAsObject : def.getServices().values()) {
358 Service service = (Service) serviceAsObject;
359 LOG.debug("Service=" + service + "; Service.QName="
360 + service.getQName());
361
362 for (Object obj : service.getPorts().values()) {
363 port = (Port) obj;
364 for (Object element : port.getExtensibilityElements()) {
365 if (element instanceof SOAPAddress) {
366 soapFound = true;
367 break;
368 } else {
369 LOG.debug("The elemente is NOT a SOAPAddress");
370 }
371
372 }
373 }
374 }
375 LOG.debug("addSoapElements[POST]. soapFound=" + soapFound + "; Port="
376 + port + "; factory=" + factory + "; writer=" + writer);
377
378 if (!soapFound) {
379 LOG.debug("SORRY. soap NOT found.");
380
381 LOG.debug("Port class:" + port.getClass().getName());
382
383 SOAPAddress soapAddress = (SOAPAddress) extReg.createExtension(
384 Port.class, SOAPConstants.Q_ELEM_SOAP_ADDRESS);
385
386 LOG.debug("creating soapAddress=" + soapAddress);
387 SOAPBinding soapBinding = (SOAPBinding) extReg.createExtension(
388 Binding.class, SOAPConstants.Q_ELEM_SOAP_BINDING);
389 LOG.debug("creating binding=" + soapBinding.getClass().getName());
390
391
392 BindingOperation bo = (BindingOperation) port.getBinding()
393 .getBindingOperations().get(0);
394
395 SOAPBody inputBody = (SOAPBody) extReg.createExtension(
396 BindingInput.class, SOAPConstants.Q_ELEM_SOAP_BODY);
397
398 LOG.debug("creating body=" + inputBody);
399
400 SOAPOperation soapOperation = (SOAPOperation) extReg
401 .createExtension(BindingOperation.class,
402 SOAPConstants.Q_ELEM_SOAP_OPERATION);
403 LOG.debug("creating SoapOperation=" + soapOperation);
404
405 soapAddress.setLocationURI("http://localhost/fake_location");
406 port.addExtensibilityElement(soapAddress);
407
408 soapBinding.setTransportURI("http://schemas.xmlsoap.org/soap/http");
409 soapBinding.setStyle("document");
410 port.getBinding().addExtensibilityElement(soapBinding);
411
412 soapOperation.setSoapActionURI("");
413 bo.addExtensibilityElement(soapOperation);
414
415 inputBody.setUse("literal");
416
417 addSoapBodyIfNotPresent(bo.getBindingInput(), inputBody);
418 addSoapBodyIfNotPresent(bo.getBindingOutput(), inputBody);
419 }
420
421 return def;
422 }
423
424
425
426
427
428
429
430
431
432 private static void addSoapBodyIfNotPresent(
433 final BindingInput bindingInput, final SOAPBody soapBody) {
434
435 for (Object obj : bindingInput.getExtensibilityElements()) {
436 if (obj instanceof SOAPBody) {
437 return;
438 }
439 }
440 bindingInput.addExtensibilityElement(soapBody);
441 }
442
443
444
445
446
447
448
449
450
451 private static void addSoapBodyIfNotPresent(
452 final BindingOutput bindingOutput, final SOAPBody soapBody) {
453
454 if (bindingOutput == null) {
455 LOG.debug(">>>> bindingOutput is NULL!!!");
456 return;
457 }
458
459 for (Object obj : bindingOutput.getExtensibilityElements()) {
460 if (obj instanceof SOAPBody) {
461 return;
462 }
463 }
464 bindingOutput.addExtensibilityElement(soapBody);
465 }
466
467
468
469
470
471
472
473
474
475 protected static PortType findFirstPortType(final Definition def) {
476
477 PortType portType = null;
478
479 for (Object portTypeAsObject : def.getPortTypes().keySet()) {
480 LOG.debug("PortTypeKEY=" + portTypeAsObject + "; CLASS="
481 + portTypeAsObject.getClass());
482
483 if (portType == null) {
484 portType = (PortType) def.getPortType((QName) portTypeAsObject);
485 }
486 }
487
488 return portType;
489 }
490
491
492
493
494
495
496
497
498
499
500
501
502
503 protected static void addOperationToWsdlBinding(Definition wsdl,
504 PortType portType, Binding wsdlBinding) {
505
506
507 List<Operation> operations = portType.getOperations();
508
509 for (Operation operation : operations) {
510 BindingOperation bop = wsdl.createBindingOperation();
511
512 bop.setOperation(operation);
513
514 bop.setName(operation.getName());
515
516 Input input = operation.getInput();
517 if (input != null) {
518
519 SOAPBody soapBody = new SOAPBodyImpl();
520 soapBody.setUse("literal");
521
522 BindingInput bindingInput = wsdl.createBindingInput();
523 bindingInput.setName(input.getName());
524 bindingInput.addExtensibilityElement(soapBody);
525
526 bop.setBindingInput(bindingInput);
527 }
528
529 Output output = operation.getOutput();
530 if (output != null) {
531 SOAPBody soapBody = new SOAPBodyImpl();
532 soapBody.setUse("literal");
533
534 BindingOutput bindingOutput = wsdl.createBindingOutput();
535 bindingOutput.setName(output.getName());
536 bindingOutput.addExtensibilityElement(soapBody);
537
538 bop.setBindingOutput(bindingOutput);
539 }
540
541 Map faults = operation.getFaults();
542
543 Iterator faultIt = faults.entrySet().iterator();
544 while (faultIt.hasNext()) {
545 Fault fault = (Fault) ((Map.Entry) faultIt.next()).getValue();
546 BindingFault bindingFault = wsdl.createBindingFault();
547 bindingFault.setName(fault.getName());
548 bop.addBindingFault(bindingFault);
549 }
550
551 wsdlBinding.addBindingOperation(bop);
552 }
553 }
554
555
556
557
558
559
560
561
562
563
564
565
566 protected static Definition addSOAPExtensionsToWSDL(Definition def)
567 throws WSDLException {
568
569 ExtensionRegistry extRegistry = def.getExtensionRegistry();
570
571 String defaultLocationURI = "http://localhost/services/defaultSoapAddress";
572
573 PortType portType = findFirstPortType(def);
574 String portTypeLocalPart = portType.getQName().getLocalPart();
575 String portTypeNamespace = portType.getQName().getNamespaceURI();
576
577 String portTypeNameCut = null;
578 if (portTypeLocalPart.endsWith("PortType")) {
579 int totLen = portTypeLocalPart.length();
580 int suffixLen = "PortType".length();
581 portTypeNameCut = portTypeLocalPart
582 .substring(0, totLen - suffixLen);
583 } else {
584 portTypeNameCut = portTypeLocalPart;
585 }
586
587
588 String serviceName = portTypeNameCut + "Service";
589 String bindingName = portTypeNameCut + "HttpBinding";
590 String portName = portTypeNameCut + "HttpPort";
591 LOG.debug("servicename=" + serviceName + "; bindingName=" + bindingName
592 + "; portName=" + portName);
593
594
595 Binding wsdlBinding = def.createBinding();
596 def.addBinding(wsdlBinding);
597 wsdlBinding.setQName(new QName(portTypeNamespace, bindingName));
598 wsdlBinding.setPortType(portType);
599 wsdlBinding.setUndefined(false);
600
601
602 Port wsdlPort = def.createPort();
603
604
605 SOAPAddress soapAddress = (SOAPAddress) extRegistry.createExtension(
606 wsdlPort.getClass(), SOAPConstants.Q_ELEM_SOAP_ADDRESS);
607
608 soapAddress.setLocationURI(defaultLocationURI);
609
610 wsdlPort.setName(portName);
611 wsdlPort.setBinding(wsdlBinding);
612 wsdlPort.addExtensibilityElement(soapAddress);
613
614 addOperationToWsdlBinding(def, portType, wsdlBinding);
615
616
617 SOAPBinding soapBinding = (SOAPBinding) extRegistry.createExtension(
618 wsdlBinding.getClass(), SOAPConstants.Q_ELEM_SOAP_BINDING);
619 soapBinding.setStyle("document");
620 soapBinding.setTransportURI("http://schemas.xmlsoap.org/soap/http");
621
622 wsdlBinding.addExtensibilityElement(soapBinding);
623
624
625 Service service = def.createService();
626 service.setQName(new QName(portTypeNamespace, serviceName));
627 service.addPort(wsdlPort);
628 def.addService(service);
629
630
631 LOG.debug("NEW DEFINITION=" + def);
632
633
634
635
636 return def;
637 }
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677 private void writeWSDLDocument(Definition def)
678 throws Jbi4CorbaDeployException {
679 FileWriter fr = null;
680 WSDLFactory factory = null;
681 WSDLWriter writer = null;
682
683
684 try {
685 File root=new File(consumerServiceDescriptor.getRootPath());
686
687 if(!root.exists()){
688 root.mkdir();
689 }
690 if (consumerServiceDescriptor.getWsdlFileName() == null) {
691 consumerServiceDescriptor
692 .setWsdlFileName(consumerServiceDescriptor
693 .getRootPath()
694 + File.separator
695 + consumerServiceDescriptor.getServiceName()
696 + ".wsdl");
697 }
698
699 fr = new FileWriter(consumerServiceDescriptor.getWsdlFileName());
700
701 } catch (IOException e) {
702 String msg = MESSAGES
703 .getString("CRB000105_Unable_to_open_filename",
704 consumerServiceDescriptor.getWsdlFileName(), e
705 .getMessage());
706
707 LOG.error(msg, e);
708 throw new Jbi4CorbaDeployException(msg, e);
709 }
710 try {
711 factory = WSDLFactory.newInstance();
712 writer = factory.newWSDLWriter();
713 writer.writeWSDL(def, fr);
714
715 } catch (WSDLException e) {
716 String msg = MESSAGES.getString(
717 "CRB000106_Unable_to_create_default_transformer", writer, e
718 .getMessage());
719
720 LOG.error(msg, e);
721 throw new Jbi4CorbaDeployException(msg, e);
722 }
723
724 try {
725 fr.close();
726 } catch (IOException e) {
727 String msg = MESSAGES.getString(
728 "CRB000108_Unable_to_close_fileWriter", fr, e.getMessage());
729
730 LOG.error(msg, e);
731 throw new Jbi4CorbaDeployException(msg, e);
732 }
733
734 }
735
736
737
738
739
740
741 public ConsumerServiceDescriptor getConsumerServiceDescriptor() {
742 return consumerServiceDescriptor;
743 }
744
745
746
747
748
749
750
751 public void setConsumerServiceDescriptor(
752 ConsumerServiceDescriptor consumerServiceDescriptor) {
753 this.consumerServiceDescriptor = consumerServiceDescriptor;
754 }
755
756
757
758
759
760
761
762
763
764
765 protected ServiceEndpoint retrieveProxiedEndpointDefinition()
766 throws Jbi4CorbaDeployException {
767
768 String targetEndpoint = consumerServiceDescriptor.getTargetEndpoint();
769 QName targetService = consumerServiceDescriptor.getTargetService();
770 QName targetInterfaceName = consumerServiceDescriptor
771 .getTargetInterfaceName();
772
773 if (LOG.isDebugEnabled()) {
774 LOG.debug("Retrieving proxied endpoint definition");
775 LOG.debug("Target service: " + targetService);
776 LOG.debug("Target endpoint: " + targetEndpoint);
777 LOG.debug("Target Interface Name: " + targetInterfaceName);
778 }
779
780 ComponentContext ctx = RuntimeContext.getInstance()
781 .getComponentContext();
782 ServiceEndpoint ep = null;
783
784 LOG.info("CRB000151_Endpoint_found", new Object[] { ctx.getEndpoint(
785 targetService, targetEndpoint) });
786 ServiceEndpoint[] eps1 = ctx.getEndpointsForService(targetService);
787 for (int i = 0; i < eps1.length; i++) {
788 LOG.debug("Endpoint from getEndpointsForService found:" + eps1[i]);
789 }
790
791 if (targetService != null || targetEndpoint != null
792 || targetInterfaceName != null) {
793
794
795 if (targetService != null && targetEndpoint != null) {
796 ep = ctx.getEndpoint(targetService, targetEndpoint);
797 if (ep == null) {
798 String msg = MESSAGES.getString(
799 "CRB000109_Could_not_retrieve_endpoint",
800 targetService, targetEndpoint, ctx);
801
802 LOG.error(msg);
803 throw new Jbi4CorbaDeployException(msg);
804 }
805 LOG
806 .debug("Endpoint retrived using targetService/targetEndpoint:"
807 + targetService + "/" + targetEndpoint);
808 }
809
810 if (ep == null && targetService != null) {
811 LOG.debug("Returns EP from service");
812 ServiceEndpoint[] eps = ctx
813 .getEndpointsForService(targetService);
814 if (eps != null && eps.length > 0) {
815 ep = eps[0];
816 }
817 if (ep == null) {
818 LOG.error("CRB000110_Could_not_retrieve_endpoint",
819 targetService, ctx);
820 throw new Jbi4CorbaDeployException(MESSAGES.getString(
821 "CRB000110_Could_not_retrieve_endpoint",
822 targetService, ctx));
823 }
824 LOG.debug("Endpoint retrived using targetService:"
825 + targetService);
826 }
827
828 if (ep == null && targetInterfaceName != null) {
829 LOG.debug("Returns EP from targetInterfaceName");
830 ServiceEndpoint[] eps = ctx.getEndpoints(targetInterfaceName);
831 if (eps != null && eps.length > 0) {
832 ep = eps[0];
833 }
834 if (ep == null) {
835 LOG.error("CRB000111_Could_not_retrieve_endpoint",
836 targetInterfaceName, ctx);
837 throw new Jbi4CorbaDeployException(MESSAGES.getString(
838 "CRB000111_Could_not_retrieve_endpoint",
839 targetInterfaceName, ctx));
840 }
841 LOG.debug("Endpoint retrived using targetInterfaceName:"
842 + targetInterfaceName);
843 }
844 }
845
846 if (ep != null) {
847 LOG.debug("Enpoind retrived");
848 LOG.debug(" Service Name:" + ep.getServiceName());
849 LOG.debug(" Endpoint Name:" + ep.getEndpointName());
850 } else {
851 LOG.info("CRB000112_No_endpoint_retrived");
852 }
853
854
855 if (ep == null) {
856 LOG.debug("Endpoint is null: pointing to myself");
857 ep = ctx.getEndpoint(this.getServiceName(), this.getEndpointName());
858 }
859
860 return ep;
861 }
862
863
864
865
866
867
868
869 public void validate() throws Jbi4CorbaException {
870
871 }
872
873
874
875
876
877
878
879
880 public void unregisterService() throws Jbi4CorbaException {
881
882 LOG.info("CRB000150_Service_unregistered", new Object[] {
883 this.getServiceName(), this.getEndpointName() });
884
885 }
886
887
888
889
890 public Role getRole() {
891 return Role.CONSUMER;
892 }
893
894 }