This project has retired. For details please refer to its
Attic page.
UDDIInquiryJAXRS xref
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.juddi.api.impl.rest;
17
18 import java.net.URL;
19 import java.util.ArrayList;
20 import java.util.Arrays;
21 import java.util.List;
22 import java.util.Properties;
23
24 import javax.ws.rs.*;
25 import javax.wsdl.Definition;
26
27 import org.apache.commons.logging.Log;
28 import org.apache.commons.logging.LogFactory;
29 import org.apache.juddi.api.impl.UDDIInquiryImpl;
30 import org.apache.juddi.api_v3.AccessPointType;
31 import org.apache.juddi.api_v3.rest.UriContainer;
32 import org.apache.juddi.v3.client.UDDIConstants;
33 import org.apache.juddi.v3.client.mapping.URLLocalizerDefaultImpl;
34 import org.apache.juddi.v3.client.mapping.wsdl.ReadWSDL;
35 import org.apache.juddi.v3.client.mapping.wsdl.WSDL2UDDI;
36 import org.apache.juddi.v3.error.UDDIErrorHelper;
37 import org.uddi.api_v3.*;
38 import org.uddi.sub_v3.KeyBag;
39 import org.uddi.v3_service.DispositionReportFaultMessage;
40
41
42
43
44
45
46
47
48 @Path("/")
49 @Produces({"application/xml", "application/json", "text/html"})
50 @org.apache.cxf.jaxrs.model.wadl.Description("This service provides access to UDDIv3 data via a REST interface, including the "
51 + "recommendation specified in the UDDIv3 spec titled, HTTP GET, as well as a number of methods above and beyond.")
52 public class UDDIInquiryJAXRS {
53
54 private static org.apache.juddi.api.impl.UDDIInquiryImpl inquiry = new UDDIInquiryImpl();
55 private static final Log log = LogFactory.getLog(UDDIInquiryJAXRS.class);
56
57
58
59
60
61
62
63 @GET
64 @Path("/JSON/businessKey/{id}")
65 @Produces("application/json")
66 @org.apache.cxf.jaxrs.model.wadl.Description("Returns the details of a business entity in JSON")
67 public org.uddi.api_v3.BusinessEntity getBusinessDetailJSON(@PathParam("id") String id) throws WebApplicationException {
68 return getBusinessDetail(id);
69 }
70
71
72
73
74
75
76
77
78 @GET
79 @Path("/XML/businessKey/{id}")
80 @Produces("application/xml")
81 @org.apache.cxf.jaxrs.model.wadl.Description("Returns the details of a business entity in XML")
82 public org.uddi.api_v3.BusinessEntity getBusinessDetailXML(@PathParam("id") String id) throws WebApplicationException {
83 return getBusinessDetail(id);
84 }
85
86 private org.uddi.api_v3.BusinessEntity getBusinessDetail(String id) {
87 GetBusinessDetail gbd = new GetBusinessDetail();
88 gbd.getBusinessKey().add(id);
89 BusinessDetail businessDetail;
90 try {
91 businessDetail = inquiry.getBusinessDetail(gbd);
92 return businessDetail.getBusinessEntity().get(0);
93 } catch (DispositionReportFaultMessage ex) {
94 HandleException(ex);
95 }
96 return null;
97 }
98
99
100
101
102
103
104
105
106 @GET
107 @Path("/XML/tModelKey/{id}")
108 @Produces("application/xml")
109 @org.apache.cxf.jaxrs.model.wadl.Description("Returns the details of a tModel entity in XML")
110 public org.uddi.api_v3.TModel getTModelDetailXML(@PathParam("id") String id) throws WebApplicationException {
111 return getTModelDetail(id);
112 }
113
114
115
116
117
118
119
120
121 @GET
122 @Path("/JSON/tModelKey/{id}")
123 @Produces("application/json")
124 @org.apache.cxf.jaxrs.model.wadl.Description("Returns the details of a tModel entity in JSON")
125 public org.uddi.api_v3.TModel getTModelDetailJSON(@PathParam("id") String id) throws WebApplicationException {
126 return getTModelDetail(id);
127 }
128
129 private org.uddi.api_v3.TModel getTModelDetail(String id) {
130 GetTModelDetail gbd = new GetTModelDetail();
131 gbd.getTModelKey().add(id);
132
133 try {
134 TModelDetail tModelDetail = inquiry.getTModelDetail(gbd);
135 return tModelDetail.getTModel().get(0);
136 } catch (DispositionReportFaultMessage ex) {
137 HandleException(ex);
138 }
139 return null;
140 }
141
142
143
144
145
146
147
148
149 @GET
150 @Path("/JSON/serviceKey/{id}")
151 @Produces("application/json")
152 @org.apache.cxf.jaxrs.model.wadl.Description("Returns the details of a service entity in JSON")
153 public org.uddi.api_v3.BusinessService getServiceDetailJSON(@PathParam("id") String id) throws WebApplicationException {
154 return getServiceDetail(id);
155 }
156
157
158
159
160
161
162
163
164
165
166
167
168
169 @GET
170 @Path("/JSON/getDetail")
171 @Produces("application/json")
172 @org.apache.cxf.jaxrs.model.wadl.Description("Returns the details of a UDDI entity in JSON, use query parameters"
173 + "serviceKey,businessKey,tModelKey, bindingKey")
174 public Object getDetailJSON(@QueryParam("serviceKey") String serviceKey,
175 @QueryParam("businessKey") String businessKey,
176 @QueryParam("tModelKey") String tModelKey,
177 @QueryParam("bindingKey") String bindingKey) throws WebApplicationException {
178 int params = 0;
179 if (businessKey != null) {
180 params++;
181 }
182 if (tModelKey != null) {
183 params++;
184 }
185 if (bindingKey != null) {
186 params++;
187 }
188 if (serviceKey != null) {
189 params++;
190 }
191 if (params != 1) {
192 throw new WebApplicationException(400);
193 }
194
195 if (businessKey != null) {
196 return getBusinessDetail(businessKey);
197 }
198 if (tModelKey != null) {
199 return getTModelDetail(tModelKey);
200 }
201 if (bindingKey != null) {
202 return getBindingDetail(bindingKey);
203 }
204 if (serviceKey != null) {
205 return getServiceDetail(serviceKey);
206 }
207 throw new WebApplicationException(400);
208 }
209
210
211
212
213
214
215
216
217
218
219
220
221
222 @GET
223 @Path("/XML/getDetail")
224 @Produces("application/xml")
225 @org.apache.cxf.jaxrs.model.wadl.Description("This method implements the UDDIv3 spec for HTTP GET Inquiry services. Returns the details of a UDDI entity in XML, use query parameters"
226 + "serviceKey,businessKey,tModelKey, bindingKey")
227 public Object getDetailXML(@QueryParam("serviceKey") String serviceKey,
228 @QueryParam("businessKey") String businessKey,
229 @QueryParam("tModelKey") String tModelKey,
230 @QueryParam("bindingKey") String bindingKey) throws WebApplicationException {
231 int params = 0;
232 if (businessKey != null) {
233 params++;
234 }
235 if (tModelKey != null) {
236 params++;
237 }
238 if (bindingKey != null) {
239 params++;
240 }
241 if (serviceKey != null) {
242 params++;
243 }
244 if (params != 1) {
245 throw new WebApplicationException(400);
246 }
247 if (businessKey != null) {
248 return getBusinessDetail(businessKey);
249 }
250 if (tModelKey != null) {
251 return getTModelDetail(tModelKey);
252 }
253 if (bindingKey != null) {
254 return getBindingDetail(bindingKey);
255 }
256 if (serviceKey != null) {
257 return getServiceDetail(serviceKey);
258 }
259 throw new WebApplicationException(400);
260 }
261
262
263
264
265
266
267
268
269 @GET
270 @Path("/XML/serviceKey/{id}")
271 @Produces("application/xml")
272 @org.apache.cxf.jaxrs.model.wadl.Description("Returns the details of a service entity in XML")
273 public org.uddi.api_v3.BusinessService getServiceDetailXML(@PathParam("id") String id) throws WebApplicationException {
274 return getServiceDetail(id);
275 }
276
277 private BusinessService getServiceDetail(String id) {
278 GetServiceDetail gbd = new GetServiceDetail();
279 gbd.getServiceKey().add(id);
280
281 try {
282 ServiceDetail serviceDetail = inquiry.getServiceDetail(gbd);
283 return serviceDetail.getBusinessService().get(0);
284 } catch (DispositionReportFaultMessage ex) {
285 HandleException(ex);
286 }
287 return null;
288 }
289
290
291
292
293
294
295
296
297 @GET
298 @Path("/JSON/opInfo/{id}")
299 @Produces("application/json")
300 @org.apache.cxf.jaxrs.model.wadl.Description("Returns the operational details of a given entity in JSON")
301 public org.uddi.api_v3.OperationalInfo getOpInfoJSON(@PathParam("id") String id) throws WebApplicationException {
302 return getOpInfoDetail(id);
303 }
304
305
306
307
308
309
310
311
312 @GET
313 @Path("/XML/opInfo/{id}")
314 @Produces("application/xml")
315 @org.apache.cxf.jaxrs.model.wadl.Description("Returns the operational details of a given entity in XML")
316 public org.uddi.api_v3.OperationalInfo getOpInfoXML(@PathParam("id") String id) throws WebApplicationException {
317 return getOpInfoDetail(id);
318 }
319
320 private OperationalInfo getOpInfoDetail(String id) {
321 GetOperationalInfo req = new GetOperationalInfo();
322 req.getEntityKey().add(id);
323 try {
324 OperationalInfos operationalInfo = inquiry.getOperationalInfo(req);
325 return operationalInfo.getOperationalInfo().get(0);
326 } catch (DispositionReportFaultMessage ex) {
327 HandleException(ex);
328 }
329 return null;
330 }
331
332
333
334
335
336
337
338
339 @GET
340 @Path("/JSON/bindingKey/{id}")
341 @Produces("application/json")
342 @org.apache.cxf.jaxrs.model.wadl.Description("Returns the binding details of a given entity in JSON")
343 public org.uddi.api_v3.BindingTemplate getBindingDetailJSON(@PathParam("id") String id) throws WebApplicationException {
344 return getBindingDetail(id);
345 }
346
347
348
349
350
351
352
353
354 @GET
355 @Path("/XML/bindingKey/{id}")
356 @Produces("application/xml")
357 @org.apache.cxf.jaxrs.model.wadl.Description("Returns the binding details of a given entity in XML")
358 public org.uddi.api_v3.BindingTemplate getBindingDetailXML(@PathParam("id") String id) throws WebApplicationException {
359 return getBindingDetail(id);
360 }
361
362 private BindingTemplate getBindingDetail(String id) {
363 GetBindingDetail req = new GetBindingDetail();
364 req.getBindingKey().add(id);
365 try {
366 BindingDetail bindingDetail = inquiry.getBindingDetail(req);
367 return bindingDetail.getBindingTemplate().get(0);
368 } catch (DispositionReportFaultMessage ex) {
369 HandleException(ex);
370 }
371 return null;
372 }
373
374
375
376
377
378
379
380
381 @GET
382 @Path("/JSON/endpointsByService/{id}")
383 @Produces("application/json")
384 @org.apache.cxf.jaxrs.model.wadl.Description("Returns the service access points of a given service in JSON")
385 public UriContainer geEndpointsByServiceJSON(@PathParam("id") String id) throws WebApplicationException {
386 return getEndpointsByService(id);
387 }
388
389
390
391
392
393
394
395
396 @GET
397 @Path("/XML/endpointsByService/{id}")
398 @Produces("application/xml")
399 @org.apache.cxf.jaxrs.model.wadl.Description("Returns the service access points of a given service in XML")
400 public UriContainer getEndpointsByServiceXML(@PathParam("id") String id) throws WebApplicationException {
401 return getEndpointsByService(id);
402 }
403
404
405
406
407
408
409
410
411 @GET
412 @Path("/XML/businessList")
413 @Produces("application/xml")
414 @org.apache.cxf.jaxrs.model.wadl.Description("Returns the business keys of the first 100 registered businesses in XML")
415 public KeyBag getBusinessListXML() throws WebApplicationException {
416 return getBusinessListData();
417 }
418
419
420
421
422
423
424
425
426 @GET
427 @Path("/JSON/businessList")
428 @Produces("application/json")
429 @org.apache.cxf.jaxrs.model.wadl.Description("Returns the business keys of the first 100 registered businesses in JSON")
430 public KeyBag getBusinessListJSON() throws WebApplicationException {
431 return getBusinessListData();
432 }
433
434
435
436
437
438
439
440 @GET
441 @Path("/XML/serviceList")
442 @Produces("application/xml")
443 @org.apache.cxf.jaxrs.model.wadl.Description("Returns the Service keys of the first 100 registered services in XML")
444 public KeyBag getServiceListXML() throws WebApplicationException {
445 return getServiceListData();
446 }
447
448
449
450
451
452
453
454 @GET
455 @Path("/JSON/serviceList")
456 @Produces("application/json")
457 @org.apache.cxf.jaxrs.model.wadl.Description("Returns the Service keys of the first 100 registered services in JSON")
458 public KeyBag getServiceListJSON() throws WebApplicationException {
459 return getServiceListData();
460 }
461
462
463
464
465
466
467
468 @GET
469 @Path("/XML/tModelList")
470 @Produces("application/xml")
471 @org.apache.cxf.jaxrs.model.wadl.Description("Returns the tModel keys of the first 100 registered services in XML")
472 public KeyBag getTModelListXML() throws WebApplicationException {
473 return getTmodelListData();
474 }
475
476
477
478
479
480
481
482
483
484
485
486
487 @GET
488 @Path("/XML/businessSearch")
489 @Produces("application/xml")
490 @org.apache.cxf.jaxrs.model.wadl.Description("Returns the search results for registered businesses in XML")
491 public BusinessList getBusinessSearchXML(@QueryParam("name") String name,
492 @QueryParam("lang") String lang,
493 @QueryParam("findQualifiers") String findQualifiers,
494 @QueryParam("maxrows") Integer maxrows,
495 @QueryParam("offset") Integer offset) throws WebApplicationException {
496 return getBusinessSearch(name, lang, findQualifiers, maxrows, offset);
497 }
498
499
500
501
502
503
504
505
506
507
508
509
510 @GET
511 @Path("/JSON/businessSearch")
512 @Produces("application/json")
513 @org.apache.cxf.jaxrs.model.wadl.Description("Returns the search results for registered businesses in JSON")
514 public BusinessList getBusinessSearchJSON(@QueryParam("name") String name,
515 @QueryParam("lang") String lang,
516 @QueryParam("findQualifiers") String findQualifiers,
517 @QueryParam("maxrows") Integer maxrows,
518 @QueryParam("offset") Integer offset) throws WebApplicationException {
519 return getBusinessSearch(name, lang, findQualifiers, maxrows, offset);
520 }
521
522
523
524
525
526
527
528
529
530
531
532
533 @GET
534 @Path("/JSON/serviceSearch")
535 @Produces("application/json")
536 @org.apache.cxf.jaxrs.model.wadl.Description("Returns the search results for registered services in JSON")
537 public ServiceList getServiceSearchJSON(@QueryParam("name") String name,
538 @QueryParam("lang") String lang,
539 @QueryParam("findQualifiers") String findQualifiers,
540 @QueryParam("maxrows") Integer maxrows,
541 @QueryParam("offset") Integer offset) throws WebApplicationException {
542 return getServiceSearch(name, lang, findQualifiers, maxrows, offset);
543 }
544
545
546
547
548
549
550
551
552
553
554
555
556 @GET
557 @Path("/XML/serviceSearch")
558 @Produces("application/json")
559 @org.apache.cxf.jaxrs.model.wadl.Description("Returns the search results for registered services in XML")
560 public ServiceList getServiceSearchXML(@QueryParam("name") String name,
561 @QueryParam("lang") String lang,
562 @QueryParam("findQualifiers") String findQualifiers,
563 @QueryParam("maxrows") Integer maxrows,
564 @QueryParam("offset") Integer offset) throws WebApplicationException {
565 return getServiceSearch(name, lang, findQualifiers, maxrows, offset);
566 }
567
568
569
570
571
572
573
574 @GET
575 @Path("/JSON/tModelList")
576 @Produces("application/json")
577 @org.apache.cxf.jaxrs.model.wadl.Description("Returns the tModel keys of the first 100 registered services in JSON")
578 public KeyBag getTModelListJSON() throws WebApplicationException {
579 return getTmodelListData();
580 }
581
582
583
584
585
586
587
588
589
590
591
592
593 @GET
594 @Path("/JSON/searchTModel")
595 @Produces("application/json")
596 @org.apache.cxf.jaxrs.model.wadl.Description("Returns the search results for registered tModel in JSON")
597 public TModelList getTModelSearchJSON(@QueryParam("name") String name,
598 @QueryParam("lang") String lang,
599 @QueryParam("findQualifiers") String findQualifiers,
600 @QueryParam("maxrows") Integer maxrows,
601 @QueryParam("offset") Integer offset) throws WebApplicationException {
602 return getTModelSearch(name, lang, findQualifiers, maxrows, offset);
603 }
604
605
606
607
608
609
610
611
612
613
614
615
616 @GET
617 @Path("/XML/searchTModel")
618 @Produces("application/json")
619 @org.apache.cxf.jaxrs.model.wadl.Description("Returns the search results for registered tModel in XML")
620 public TModelList getTModelSearchXML(@QueryParam("name") String name,
621 @QueryParam("lang") String lang,
622 @QueryParam("findQualifiers") String findQualifiers,
623 @QueryParam("maxrows") Integer maxrows,
624 @QueryParam("offset") Integer offset) throws WebApplicationException {
625 return getTModelSearch(name, lang, findQualifiers, maxrows, offset);
626 }
627
628 private UriContainer getEndpointsByService(String id) throws WebApplicationException {
629 UriContainer c = new UriContainer();
630 List<String> ret = new ArrayList<String>();
631 GetServiceDetail fs = new GetServiceDetail();
632
633 fs.getServiceKey().add(id);
634 try {
635 ServiceDetail serviceDetail = inquiry.getServiceDetail(fs);
636 if (serviceDetail == null || serviceDetail.getBusinessService().isEmpty()) {
637 throw new WebApplicationException(400);
638 } else {
639 List<String> endpoints = GetEndpoints(serviceDetail, null);
640 ret.addAll(endpoints);
641 }
642 } catch (DispositionReportFaultMessage ex) {
643 HandleException(ex);
644 }
645 c.setUriList(ret);
646 return c;
647 }
648
649 private List<String> GetEndpoints(ServiceDetail serviceDetail, String authInfo) throws DispositionReportFaultMessage {
650 List<String> items = new ArrayList<String>();
651 if (serviceDetail == null) {
652 return items;
653 }
654 for (int i = 0; i < serviceDetail.getBusinessService().size(); i++) {
655 if (serviceDetail.getBusinessService().get(i).getBindingTemplates() != null) {
656 for (int k = 0; k < serviceDetail.getBusinessService().get(i).getBindingTemplates().getBindingTemplate().size(); k++) {
657 items.addAll(ParseBinding(serviceDetail.getBusinessService().get(i).getBindingTemplates().getBindingTemplate().get(k), authInfo));
658 }
659 }
660 }
661 return items;
662 }
663
664 private List<String> GetBindingInfo(String value, String cred) throws DispositionReportFaultMessage {
665 List<String> items = new ArrayList<String>();
666 if (value == null) {
667 return items;
668 }
669 GetBindingDetail b = new GetBindingDetail();
670 b.setAuthInfo(cred);
671 b.getBindingKey().add(value);
672 BindingDetail bindingDetail = inquiry.getBindingDetail(b);
673 for (int i = 0; i < bindingDetail.getBindingTemplate().size(); i++) {
674 items.addAll(ParseBinding(bindingDetail.getBindingTemplate().get(i), cred));
675 }
676 return items;
677 }
678
679 private List<String> FetchWSDL(String value) {
680 List<String> items = new ArrayList<String>();
681
682 if (value.startsWith("http://") || value.startsWith("https://")) {
683
684 org.apache.juddi.v3.client.mapping.wsdl.ReadWSDL r = new ReadWSDL();
685 r.setIgnoreSSLErrors(true);
686 try {
687 Definition wsdlDefinition = r.readWSDL(new URL(value));
688 Properties properties = new Properties();
689
690 properties.put("keyDomain", "domain");
691 properties.put("businessName", "biz");
692 properties.put("serverName", "localhost");
693 properties.put("serverPort", "80");
694
695 WSDL2UDDI wsdl2UDDI = new WSDL2UDDI(null, new URLLocalizerDefaultImpl(), properties);
696 BusinessServices businessServices = wsdl2UDDI.createBusinessServices(wsdlDefinition);
697 for (int i = 0; i < businessServices.getBusinessService().size(); i++) {
698 if (businessServices.getBusinessService().get(i).getBindingTemplates() != null) {
699 for (int k = 0; k < businessServices.getBusinessService().get(i).getBindingTemplates().getBindingTemplate().size(); k++) {
700 items.addAll(ParseBinding(businessServices.getBusinessService().get(i).getBindingTemplates().getBindingTemplate().get(k), null));
701 }
702 }
703 }
704 } catch (Exception ex) {
705 }
706
707 }
708 return items;
709 }
710
711 private List<String> ParseBinding(BindingTemplate get, String authInfo) throws DispositionReportFaultMessage {
712 List<String> items = new ArrayList<String>();
713 if (get == null || get.getAccessPoint() == null) {
714 return items;
715 }
716 if (get.getHostingRedirector() != null) {
717
718
719 items.addAll(GetBindingInfo(get.getHostingRedirector().getBindingKey(), authInfo));
720 }
721 if (get.getAccessPoint() != null) {
722 String usetype = get.getAccessPoint().getUseType();
723 if (usetype == null) {
724
725
726 items.add((get.getAccessPoint().getValue()));
727
728 } else if (usetype.equalsIgnoreCase(AccessPointType.BINDING_TEMPLATE.toString())) {
729
730 items.addAll(GetBindingInfo(get.getAccessPoint().getValue(), authInfo));
731 } else if (usetype.equalsIgnoreCase(AccessPointType.HOSTING_REDIRECTOR.toString())) {
732
733
734 items.addAll(GetBindingInfo(get.getAccessPoint().getValue(), authInfo));
735
736 } else if (usetype.equalsIgnoreCase(AccessPointType.WSDL_DEPLOYMENT.toString())) {
737
738 items.addAll(FetchWSDL(get.getAccessPoint().getValue()));
739 } else if (usetype.equalsIgnoreCase(AccessPointType.END_POINT.toString())) {
740
741 items.add((get.getAccessPoint().getValue()));
742
743 } else {
744
745
746 items.add((get.getAccessPoint().getValue()));
747
748 }
749
750 }
751 return items;
752 }
753
754 private static void HandleException(Exception ex) throws WebApplicationException {
755 if (ex == null) {
756 throw new WebApplicationException(500);
757 }
758 log.error(ex.getMessage());
759 log.debug(ex);
760 if (ex instanceof DispositionReportFaultMessage) {
761 DispositionReportFaultMessage dr = (DispositionReportFaultMessage) ex;
762 if (dr.getFaultInfo() == null) {
763 throw new WebApplicationException(500);
764 }
765 if (dr.getFaultInfo().countainsErrorCode(UDDIErrorHelper.lookupErrCode(UDDIErrorHelper.E_AUTH_TOKEN_EXPIRED))) {
766 throw new WebApplicationException(ex, 401);
767 }
768 if (dr.getFaultInfo().countainsErrorCode(UDDIErrorHelper.lookupErrCode(UDDIErrorHelper.E_AUTH_TOKEN_REQUIRED))) {
769 throw new WebApplicationException(ex, 401);
770 }
771 if (dr.getFaultInfo().countainsErrorCode(UDDIErrorHelper.lookupErrCode(UDDIErrorHelper.E_FATAL_ERROR))) {
772 throw new WebApplicationException(ex, 500);
773 }
774 }
775 throw new WebApplicationException(ex, 400);
776 }
777 private final int MAX_ROWS = 100;
778
779 private KeyBag getBusinessListData() {
780 FindBusiness fb = new FindBusiness();
781 fb.getName().add(new Name(UDDIConstants.WILDCARD, null));
782 fb.setFindQualifiers(new FindQualifiers());
783 fb.getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
784 fb.setMaxRows(MAX_ROWS);
785 BusinessList findBusiness = null;
786 try {
787 findBusiness = inquiry.findBusiness(fb);
788 } catch (Exception ex) {
789 HandleException(ex);
790 }
791 KeyBag kb = new KeyBag();
792 if (findBusiness != null && findBusiness.getBusinessInfos() != null) {
793 for (int i = 0; i < findBusiness.getBusinessInfos().getBusinessInfo().size(); i++) {
794 kb.getBusinessKey().add(findBusiness.getBusinessInfos().getBusinessInfo().get(i).getBusinessKey());
795 }
796 }
797 return kb;
798 }
799
800 private KeyBag getServiceListData() {
801 FindService fb = new FindService();
802 fb.getName().add(new Name(UDDIConstants.WILDCARD, null));
803 fb.setFindQualifiers(new FindQualifiers());
804 fb.getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
805 fb.setMaxRows(MAX_ROWS);
806 ServiceList findBusiness = null;
807 try {
808 findBusiness = inquiry.findService(fb);
809 } catch (Exception ex) {
810 HandleException(ex);
811 }
812 KeyBag kb = new KeyBag();
813 if (findBusiness != null && findBusiness.getServiceInfos() != null) {
814 for (int i = 0; i < findBusiness.getServiceInfos().getServiceInfo().size(); i++) {
815 kb.getServiceKey().add(findBusiness.getServiceInfos().getServiceInfo().get(i).getServiceKey());
816 }
817 }
818 return kb;
819 }
820
821 private KeyBag getTmodelListData() {
822 FindTModel fb = new FindTModel();
823 fb.setName(new Name(UDDIConstants.WILDCARD, null));
824 fb.setFindQualifiers(new FindQualifiers());
825 fb.getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
826 fb.setMaxRows(MAX_ROWS);
827 TModelList findBusiness = null;
828 try {
829 findBusiness = inquiry.findTModel(fb);
830 } catch (Exception ex) {
831 HandleException(ex);
832 }
833 KeyBag kb = new KeyBag();
834 if (findBusiness != null && findBusiness.getTModelInfos() != null) {
835 for (int i = 0; i < findBusiness.getTModelInfos().getTModelInfo().size(); i++) {
836 kb.getTModelKey().add(findBusiness.getTModelInfos().getTModelInfo().get(i).getTModelKey());
837 }
838 }
839 return kb;
840 }
841
842 private BusinessList getBusinessSearch(String name, String lang, String findQualifiers, Integer maxrows, Integer offset) {
843 FindBusiness fb = new FindBusiness();
844
845 fb.getName().add(new Name(UDDIConstants.WILDCARD, null));
846 if (name != null) {
847 fb.getName().get(0).setValue(name);
848 }
849 if (lang != null) {
850 fb.getName().get(0).setValue(lang);
851 }
852 fb.setFindQualifiers(new FindQualifiers());
853 if (findQualifiers == null) {
854 fb.getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
855 } else {
856 String[] fqs = findQualifiers.split(",");
857 fb.getFindQualifiers().getFindQualifier().addAll(Arrays.asList(fqs));
858 }
859 fb.setMaxRows(MAX_ROWS);
860
861 if (maxrows != null) {
862 fb.setMaxRows(maxrows);
863 }
864 fb.setListHead(0);
865 if (offset != null) {
866 fb.setListHead(offset);
867 }
868
869 BusinessList findBusiness = null;
870 try {
871 findBusiness = inquiry.findBusiness(fb);
872 } catch (Exception ex) {
873 HandleException(ex);
874 }
875 return findBusiness;
876
877 }
878
879 private ServiceList getServiceSearch(String name, String lang, String findQualifiers, Integer maxrows, Integer offset) {
880 FindService fb = new FindService();
881
882 fb.getName().add(new Name(UDDIConstants.WILDCARD, null));
883 if (name != null) {
884 fb.getName().get(0).setValue(name);
885 }
886 if (lang != null) {
887 fb.getName().get(0).setValue(lang);
888 }
889 fb.setFindQualifiers(new FindQualifiers());
890 if (findQualifiers == null) {
891 fb.getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
892 } else {
893 String[] fqs = findQualifiers.split(",");
894 fb.getFindQualifiers().getFindQualifier().addAll(Arrays.asList(fqs));
895 }
896 fb.setMaxRows(MAX_ROWS);
897
898 if (maxrows != null) {
899 fb.setMaxRows(maxrows);
900 }
901 fb.setListHead(0);
902 if (offset != null) {
903 fb.setListHead(offset);
904 }
905
906 ServiceList findBusiness = null;
907 try {
908 findBusiness = inquiry.findService(fb);
909 } catch (Exception ex) {
910 HandleException(ex);
911 }
912
913 return findBusiness;
914 }
915
916 private TModelList getTModelSearch(String name, String lang, String findQualifiers, Integer maxrows, Integer offset) {
917 FindTModel fb = new FindTModel();
918
919 fb.setName(new Name(UDDIConstants.WILDCARD, null));
920 if (name != null) {
921 fb.getName().setValue(name);
922 }
923 if (lang != null) {
924 fb.getName().setValue(lang);
925 }
926 fb.setFindQualifiers(new FindQualifiers());
927 if (findQualifiers == null) {
928 fb.getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
929 } else {
930 String[] fqs = findQualifiers.split(",");
931 fb.getFindQualifiers().getFindQualifier().addAll(Arrays.asList(fqs));
932 }
933 fb.setMaxRows(MAX_ROWS);
934
935 if (maxrows != null) {
936 fb.setMaxRows(maxrows);
937 }
938 fb.setListHead(0);
939 if (offset != null) {
940 fb.setListHead(offset);
941 }
942
943 TModelList findBusiness = null;
944 try {
945 findBusiness = inquiry.findTModel(fb);
946 } catch (Exception ex) {
947 HandleException(ex);
948 }
949
950 return findBusiness;
951
952 }
953 }