Source Code Cross Referenced for YPProxyImpl.java in  » Science » Cougaar12_4 » org » cougaar » yp » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Science » Cougaar12_4 » org.cougaar.yp 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * <copyright>
003:         *  
004:         *  Copyright 2002-2004 BBNT Solutions, LLC
005:         *  under sponsorship of the Defense Advanced Research Projects
006:         *  Agency (DARPA).
007:         * 
008:         *  You can redistribute this software and/or modify it under the
009:         *  terms of the Cougaar Open Source License as published on the
010:         *  Cougaar Open Source Website (www.cougaar.org).
011:         * 
012:         *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
013:         *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
014:         *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
015:         *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
016:         *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
017:         *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
018:         *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
019:         *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
020:         *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
021:         *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
022:         *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
023:         *  
024:         * </copyright>
025:         */
026:
027:        package org.cougaar.yp;
028:
029:        import java.util.Vector;
030:
031:        import javax.xml.parsers.DocumentBuilder;
032:        import javax.xml.parsers.DocumentBuilderFactory;
033:        import javax.xml.parsers.ParserConfigurationException;
034:
035:        import org.cougaar.core.mts.MessageAddress;
036:        import org.cougaar.core.service.community.Community;
037:        import org.cougaar.util.log.Logger;
038:        import org.cougaar.util.log.Logging;
039:        import org.uddi4j.UDDIElement;
040:        import org.uddi4j.UDDIException;
041:        import org.uddi4j.datatype.assertion.PublisherAssertion;
042:        import org.uddi4j.request.AddPublisherAssertions;
043:        import org.uddi4j.request.DeleteBinding;
044:        import org.uddi4j.request.DeleteBusiness;
045:        import org.uddi4j.request.DeletePublisherAssertions;
046:        import org.uddi4j.request.DeleteService;
047:        import org.uddi4j.request.DeleteTModel;
048:        import org.uddi4j.request.DiscardAuthToken;
049:        import org.uddi4j.request.FindBinding;
050:        import org.uddi4j.request.FindBusiness;
051:        import org.uddi4j.request.FindRelatedBusinesses;
052:        import org.uddi4j.request.FindService;
053:        import org.uddi4j.request.FindTModel;
054:        import org.uddi4j.request.GetAssertionStatusReport;
055:        import org.uddi4j.request.GetAuthToken;
056:        import org.uddi4j.request.GetBindingDetail;
057:        import org.uddi4j.request.GetBusinessDetail;
058:        import org.uddi4j.request.GetBusinessDetailExt;
059:        import org.uddi4j.request.GetPublisherAssertions;
060:        import org.uddi4j.request.GetRegisteredInfo;
061:        import org.uddi4j.request.GetServiceDetail;
062:        import org.uddi4j.request.GetTModelDetail;
063:        import org.uddi4j.request.SaveBinding;
064:        import org.uddi4j.request.SaveBusiness;
065:        import org.uddi4j.request.SaveService;
066:        import org.uddi4j.request.SaveTModel;
067:        import org.uddi4j.request.SetPublisherAssertions;
068:        import org.uddi4j.request.ValidateValues;
069:        import org.uddi4j.response.AssertionStatusReport;
070:        import org.uddi4j.response.AuthToken;
071:        import org.uddi4j.response.BindingDetail;
072:        import org.uddi4j.response.BusinessDetail;
073:        import org.uddi4j.response.BusinessDetailExt;
074:        import org.uddi4j.response.BusinessList;
075:        import org.uddi4j.response.CompletionStatus;
076:        import org.uddi4j.response.DispositionReport;
077:        import org.uddi4j.response.PublisherAssertions;
078:        import org.uddi4j.response.RegisteredInfo;
079:        import org.uddi4j.response.RelatedBusinessesList;
080:        import org.uddi4j.response.ServiceDetail;
081:        import org.uddi4j.response.ServiceList;
082:        import org.uddi4j.response.TModelDetail;
083:        import org.uddi4j.response.TModelList;
084:        import org.uddi4j.util.AuthInfo;
085:        import org.uddi4j.util.BindingKey;
086:        import org.uddi4j.util.BusinessKey;
087:        import org.uddi4j.util.CategoryBag;
088:        import org.uddi4j.util.DiscoveryURLs;
089:        import org.uddi4j.util.FindQualifiers;
090:        import org.uddi4j.util.IdentifierBag;
091:        import org.uddi4j.util.KeyedReference;
092:        import org.uddi4j.util.ServiceKey;
093:        import org.uddi4j.util.TModelBag;
094:        import org.uddi4j.util.TModelKey;
095:        import org.w3c.dom.DOMException;
096:        import org.w3c.dom.Element;
097:
098:        // this could easily be code generated from uddi4j sources.  sigh.
099:
100:        /** This is the primary mechanism for constructing and executing YP queries.
101:         * The interface is essentially a clone of the UDDI4J UDDIProxy API
102:         * except that it takes the approach of asynchronous operations rather
103:         * than synchronous operations.
104:         **/
105:
106:        class YPProxyImpl implements  YPProxy {
107:            private static final Logger logger = Logging
108:                    .getLogger(YPProxy.class);
109:            private final Object context;
110:            private final YPService yps;
111:            private final boolean autosubmit;
112:            private final int searchMode;
113:
114:            YPProxyImpl(MessageAddress ypAgent, YPService yps,
115:                    boolean autosubmit) {
116:                this .context = ypAgent;
117:                this .yps = yps;
118:                this .autosubmit = autosubmit;
119:                this .searchMode = YPProxy.SearchMode.NO_COMMUNITY_SEARCH;
120:            }
121:
122:            YPProxyImpl(Community community, YPService yps, boolean autosubmit,
123:                    int searchMode) {
124:                this .context = community;
125:                this .yps = yps;
126:                this .autosubmit = autosubmit;
127:
128:                if (YPProxy.SearchMode.validCommunitySearchMode(searchMode)) {
129:                    this .searchMode = searchMode;
130:                } else {
131:                    throw new IllegalArgumentException(
132:                            "Invalid search mode specified - " + searchMode
133:                                    + " - must be one of YPProxy.SearchMode ");
134:                }
135:            }
136:
137:            YPProxyImpl(YPService yps, boolean autosubmit, int searchMode) {
138:                this .context = null;
139:                this .yps = yps;
140:                this .autosubmit = autosubmit;
141:
142:                if (YPProxy.SearchMode.validCommunitySearchMode(searchMode)) {
143:                    this .searchMode = searchMode;
144:                } else {
145:                    throw new IllegalArgumentException(
146:                            "Invalid search mode specified - " + searchMode
147:                                    + " - must be one of YPProxy.SearchMode ");
148:                }
149:            }
150:
151:            public int getSearchMode() {
152:                return searchMode;
153:            }
154:
155:            /**
156:             * @note The returned YPFuture will contain a BindingDetail when completed.
157:             */
158:            public YPFuture find_binding(FindQualifiers findQualifiers,
159:                    String serviceKey, TModelBag tModelBag, int maxRows) {
160:                FindBinding fb = new FindBinding(serviceKey, tModelBag);
161:                if (findQualifiers != null)
162:                    fb.setFindQualifiers(findQualifiers);
163:                if (maxRows > 0)
164:                    fb.setMaxRows(maxRows);
165:                return pkg(fb, true, BindingDetail.class);
166:            }
167:
168:            /**
169:             * @note The returned YPFuture will contain a BusinessList when completed.
170:             */
171:            public YPFuture find_business(Vector names,
172:                    DiscoveryURLs discoveryURLs, IdentifierBag identifierBag,
173:                    CategoryBag categoryBag, TModelBag tModelBag,
174:                    FindQualifiers findQualifiers, int maxRows) {
175:                FindBusiness o = new FindBusiness();
176:                if (maxRows > 0)
177:                    o.setMaxRows(maxRows);
178:                o.setFindQualifiers(findQualifiers);
179:                o.setNameVector(names);
180:                o.setIdentifierBag(identifierBag);
181:                o.setCategoryBag(categoryBag);
182:                o.setTModelBag(tModelBag);
183:                o.setDiscoveryURLs(discoveryURLs);
184:                return pkg(o, true, BusinessList.class);
185:            }
186:
187:            /**
188:             * @note The returned YPFuture will contain a RelatedBusinessesList when completed.
189:             */
190:            public YPFuture find_relatedBusinesses(String businessKey,
191:                    KeyedReference keyedReference,
192:                    FindQualifiers findQualifiers, int maxRows) {
193:                FindRelatedBusinesses o = new FindRelatedBusinesses(businessKey);
194:                o.setKeyedReference(keyedReference);
195:                o.setFindQualifiers(findQualifiers);
196:                if (maxRows > 0)
197:                    o.setMaxRows(maxRows);
198:                return pkg(o, true, RelatedBusinessesList.class);
199:            }
200:
201:            /**
202:             * @note The returned YPFuture will contain a ServiceList when completed.
203:             */
204:            public YPFuture find_service(String businessKey, Vector names,
205:                    CategoryBag categoryBag, TModelBag tModelBag,
206:                    FindQualifiers findQualifiers, int maxRows) {
207:                FindService o = new FindService(businessKey);
208:                o.setNameVector(names);
209:                o.setCategoryBag(categoryBag);
210:                o.setTModelBag(tModelBag);
211:                o.setFindQualifiers(findQualifiers);
212:                if (maxRows > 0)
213:                    o.setMaxRows(maxRows);
214:                return pkg(o, true, ServiceList.class);
215:            }
216:
217:            /**
218:             * @note The returned YPFuture will contain a TModelList when completed.
219:             */
220:            public YPFuture find_tModel(String name, CategoryBag categoryBag,
221:                    IdentifierBag identifierBag, FindQualifiers findQualifiers,
222:                    int maxRows) {
223:                FindTModel o = new FindTModel();
224:                o.setName(name);
225:                o.setCategoryBag(categoryBag);
226:                o.setIdentifierBag(identifierBag);
227:                o.setFindQualifiers(findQualifiers);
228:                if (maxRows > 0)
229:                    o.setMaxRows(maxRows);
230:                return pkg(o, true, TModelList.class);
231:            }
232:
233:            /**
234:             * @note The returned YPFuture will contain a BindingDetail when completed.
235:             */
236:            public YPFuture get_bindingDetail(String bindingKey) {
237:                GetBindingDetail o = new GetBindingDetail();
238:                Vector v = new Vector(1);
239:                v.addElement(new BindingKey(bindingKey));
240:                o.setBindingKeyVector(v);
241:                return pkg(o, true, BindingDetail.class);
242:            }
243:
244:            /**
245:             * @note The returned YPFuture will contain a BindingDetail when completed.
246:             */
247:            public YPFuture get_bindingDetail(Vector bindingKeyStrings) {
248:                GetBindingDetail o = new GetBindingDetail(bindingKeyStrings);
249:                return pkg(o, true, BindingDetail.class);
250:            }
251:
252:            /**
253:             * @note The returned YPFuture will contain a BusinessDetail when completed.
254:             */
255:            public YPFuture get_businessDetail(String businessKey) {
256:                GetBusinessDetail o = new GetBusinessDetail();
257:                Vector v = new Vector(1);
258:                v.addElement(new BusinessKey(businessKey));
259:                o.setBusinessKeyVector(v);
260:                return pkg(o, true, BusinessDetail.class);
261:            }
262:
263:            /**
264:             * @note The returned YPFuture will contain a BusinessDetail when completed.
265:             */
266:            public YPFuture get_businessDetail(Vector businessKeyStrings) {
267:                GetBusinessDetail o = new GetBusinessDetail(businessKeyStrings);
268:                return pkg(o, true, BusinessDetail.class);
269:            }
270:
271:            /**
272:             * @note The returned YPFuture will contain a BusinessDetailExt when completed.
273:             */
274:            public YPFuture get_businessDetailExt(String businessKey) {
275:                GetBusinessDetailExt o = new GetBusinessDetailExt();
276:                Vector v = new Vector(1);
277:                v.addElement(new BusinessKey(businessKey));
278:                o.setBusinessKeyVector(v);
279:                return pkg(o, true, BusinessDetailExt.class);
280:            }
281:
282:            /**
283:             * @note The returned YPFuture will contain a BusinessDetailExt when completed.
284:             */
285:            public YPFuture get_businessDetailExt(Vector businessKeyStrings) {
286:                GetBusinessDetailExt o = new GetBusinessDetailExt(
287:                        businessKeyStrings);
288:                return pkg(o, true, BusinessDetailExt.class);
289:            }
290:
291:            /**
292:             * @note The returned YPFuture will contain a ServiceDetail when completed.
293:             */
294:            public YPFuture get_serviceDetail(String serviceKey) {
295:                GetServiceDetail o = new GetServiceDetail();
296:                o.setServiceKeyVector(v(new ServiceKey(serviceKey)));
297:                return pkg(o, true, ServiceDetail.class);
298:            }
299:
300:            /**
301:             * @note The returned YPFuture will contain a ServiceDetail when completed.
302:             */
303:            public YPFuture get_serviceDetail(Vector serviceKeyStrings) {
304:                GetServiceDetail o = new GetServiceDetail(serviceKeyStrings);
305:                return pkg(o, true, ServiceDetail.class);
306:            }
307:
308:            /**
309:             * @note The returned YPFuture will contain a TModelDetail when completed.
310:             */
311:            public YPFuture get_tModelDetail(String tModelKey) {
312:                GetTModelDetail o = new GetTModelDetail();
313:                o.setTModelKeyVector(v(new TModelKey(tModelKey)));
314:                return pkg(o, true, TModelDetail.class);
315:            }
316:
317:            /**
318:             * @note The returned YPFuture will contain a TModelDetail when completed.
319:             */
320:            public YPFuture get_tModelDetail(Vector tModelKeyStrings) {
321:                GetTModelDetail o = new GetTModelDetail(tModelKeyStrings);
322:                return pkg(o, true, TModelDetail.class);
323:            }
324:
325:            /**
326:             * @note The returned YPFuture will contain a  DispositionReport when completed.
327:             */
328:            public YPFuture add_publisherAssertions(String authInfo,
329:                    PublisherAssertion publisherAssertion) {
330:                AddPublisherAssertions o = new AddPublisherAssertions(authInfo,
331:                        v(publisherAssertion));
332:                return pkg(o, false, DispositionReport.class);
333:            }
334:
335:            /**
336:             * @note The returned YPFuture will contain a  DispositionReport when completed.
337:             */
338:            public YPFuture add_publisherAssertions(String authInfo,
339:                    Vector publisherAssertion) {
340:                AddPublisherAssertions o = new AddPublisherAssertions(authInfo,
341:                        publisherAssertion);
342:                return pkg(o, false, DispositionReport.class);
343:            }
344:
345:            /**
346:             * @note The returned YPFuture will contain a AssertionStatusReport when completed.
347:             */
348:            public YPFuture get_assertionStatusReport(String authInfo,
349:                    String completionStatus) {
350:                GetAssertionStatusReport o = new GetAssertionStatusReport(
351:                        authInfo, completionStatus);
352:                return pkg(o, true, AssertionStatusReport.class);
353:            }
354:
355:            /**
356:             * @note The returned YPFuture will contain a AssertionStatusReport when completed.
357:             */
358:            public YPFuture get_assertionStatusReport(String authInfo,
359:                    CompletionStatus completionStatus) {
360:                GetAssertionStatusReport o = new GetAssertionStatusReport(
361:                        authInfo, completionStatus);
362:                return pkg(o, true, AssertionStatusReport.class);
363:            }
364:
365:            /**
366:             * @note The returned YPFuture will contain a PublisherAssertions when completed.
367:             */
368:            public YPFuture get_publisherAssertions(String authInfo) {
369:                GetPublisherAssertions o = new GetPublisherAssertions(authInfo);
370:                return pkg(o, true, PublisherAssertions.class);
371:            }
372:
373:            /**
374:             * @note The returned YPFuture will contain a DispositionReport when completed.
375:             */
376:            public YPFuture delete_binding(String authInfo, String bindingKey) {
377:                DeleteBinding o = new DeleteBinding(authInfo, v(bindingKey));
378:                return pkg(o, false, DispositionReport.class);
379:            }
380:
381:            /**
382:             * @note The returned YPFuture will contain a DispositionReport when completed.
383:             */
384:            public YPFuture delete_binding(String authInfo,
385:                    Vector bindingKeyStrings) {
386:                DeleteBinding o = new DeleteBinding(authInfo, bindingKeyStrings);
387:                return pkg(o, false, DispositionReport.class);
388:            }
389:
390:            /**
391:             * @note The returned YPFuture will contain a DispositionReport when completed.
392:             */
393:            public YPFuture delete_business(String authInfo, String businessKey) {
394:                return pkg(new DeleteBusiness(authInfo, v(businessKey)), false,
395:                        DispositionReport.class);
396:            }
397:
398:            /**
399:             * @note The returned YPFuture will contain a DispositionReport when completed.
400:             */
401:            public YPFuture delete_business(String authInfo,
402:                    Vector businessKeyStrings) {
403:                return pkg(new DeleteBusiness(authInfo, businessKeyStrings),
404:                        false, DispositionReport.class);
405:            }
406:
407:            /**
408:             * @note The returned YPFuture will contain a DispositionReport when completed.
409:             */
410:            public YPFuture delete_service(String authInfo, String serviceKey) {
411:                return pkg(new DeleteService(authInfo, v(serviceKey)), false,
412:                        DispositionReport.class);
413:            }
414:
415:            /**
416:             * @note The returned YPFuture will contain a DispositionReport when completed.
417:             */
418:            public YPFuture delete_service(String authInfo,
419:                    Vector serviceKeyStrings) {
420:                return pkg(new DeleteService(authInfo, serviceKeyStrings),
421:                        false, DispositionReport.class);
422:            }
423:
424:            /**
425:             * @note The returned YPFuture will contain a DispositionReport when completed.
426:             */
427:            public YPFuture delete_tModel(String authInfo, String tModelKey) {
428:                return pkg(new DeleteTModel(authInfo, v(tModelKey)), false,
429:                        DispositionReport.class);
430:            }
431:
432:            /**
433:             * @note The returned YPFuture will contain a DispositionReport when completed.
434:             */
435:            public YPFuture delete_tModel(String authInfo,
436:                    Vector tModelKeyStrings) {
437:                return pkg(new DeleteTModel(authInfo, tModelKeyStrings), false,
438:                        DispositionReport.class);
439:            }
440:
441:            /**
442:             * @note The returned YPFuture will contain a DispositionReport when completed.
443:             */
444:            public YPFuture delete_publisherAssertions(String authInfo,
445:                    PublisherAssertion publisherAssertion) throws UDDIException {
446:                return pkg(new DeletePublisherAssertions(authInfo,
447:                        v(publisherAssertion)), false, DispositionReport.class);
448:            }
449:
450:            /**
451:             * @note The returned YPFuture will contain a DispositionReport when completed.
452:             */
453:            public YPFuture delete_publisherAssertions(String authInfo,
454:                    Vector publisherAssertion) throws UDDIException {
455:                return pkg(new DeletePublisherAssertions(authInfo,
456:                        publisherAssertion), false, DispositionReport.class);
457:            }
458:
459:            /**
460:             * @note The returned YPFuture will contain a DispositionReport when completed.
461:             */
462:            public YPFuture discard_authToken(String authInfo) {
463:                return pkg(new DiscardAuthToken(authInfo), false,
464:                        DispositionReport.class);
465:            }
466:
467:            /**
468:             * @note The returned YPFuture will contain a DispositionReport when completed.
469:             */
470:            public YPFuture discard_authToken(AuthInfo authInfo) {
471:                DiscardAuthToken o = new DiscardAuthToken();
472:                o.setAuthInfo(authInfo);
473:                return pkg(o, false, DispositionReport.class);
474:            }
475:
476:            /**
477:             * @note The returned YPFuture will contain a AuthToken when completed.
478:             */
479:            public YPFuture get_authToken(String userid, String cred) {
480:                return pkg(new GetAuthToken(userid, cred), true,
481:                        AuthToken.class);
482:            }
483:
484:            /**
485:             * @note The returned YPFuture will contain a RegisteredInfo when completed.
486:             */
487:            public YPFuture get_registeredInfo(String authInfo) {
488:                return pkg(new GetRegisteredInfo(authInfo), true,
489:                        RegisteredInfo.class);
490:            }
491:
492:            /**
493:             * @note The returned YPFuture will contain a BindingDetail when completed.
494:             */
495:            public YPFuture save_binding(String authInfo,
496:                    Vector bindingTemplates) {
497:                return pkg(new SaveBinding(authInfo, bindingTemplates), true,
498:                        BindingDetail.class);
499:            }
500:
501:            /**
502:             * @note The returned YPFuture will contain a BusinessDetail when completed.
503:             */
504:            public YPFuture save_business(String authInfo,
505:                    Vector businessEntities) {
506:                SaveBusiness o = new SaveBusiness(authInfo);
507:                o.setBusinessEntityVector(businessEntities);
508:                return pkg(o, true, BusinessDetail.class);
509:            }
510:
511:            /**
512:             * @note The returned YPFuture will contain a ServiceDetail when completed.
513:             */
514:            public YPFuture save_service(String authInfo,
515:                    Vector businessServices) {
516:                return pkg(new SaveService(authInfo, businessServices), true,
517:                        ServiceDetail.class);
518:            }
519:
520:            /**
521:             * @note The returned YPFuture will contain a TModelDetail when completed.
522:             */
523:            public YPFuture save_tModel(String authInfo, Vector tModels) {
524:                SaveTModel o = new SaveTModel(authInfo);
525:                o.setTModelVector(tModels);
526:                return pkg(o, true, TModelDetail.class);
527:            }
528:
529:            /**
530:             * @note The returned YPFuture will contain a PublisherAssertions when completed.
531:             */
532:            public YPFuture set_publisherAssertions(String authInfo,
533:                    PublisherAssertion pub) {
534:                return pkg(new SetPublisherAssertions(authInfo, v(pub)), false,
535:                        PublisherAssertions.class);
536:            }
537:
538:            /**
539:             * @note The returned YPFuture will contain a  PublisherAssertions when completed.
540:             */
541:            public YPFuture set_publisherAssertions(String authInfo,
542:                    Vector publisherAssertion) {
543:                return pkg(new SetPublisherAssertions(authInfo,
544:                        publisherAssertion), false, PublisherAssertions.class);
545:            }
546:
547:            /**
548:             * @note The returned YPFuture will contain a DispositionReport when completed.
549:             */
550:            public YPFuture validate_values_businessEntity(Vector businessEntity) {
551:                ValidateValues o = new ValidateValues();
552:                o.setBusinessEntityVector(businessEntity);
553:                return pkg(o, false, DispositionReport.class);
554:            }
555:
556:            /**
557:             * @note The returned YPFuture will contain a DispositionReport when completed.
558:             */
559:            public YPFuture validate_values_businessService(
560:                    Vector businessService) {
561:                ValidateValues o = new ValidateValues();
562:                o.setBusinessServiceVector(businessService);
563:                return pkg(o, false, DispositionReport.class);
564:            }
565:
566:            /**
567:             * @note The returned YPFuture will contain a DispositionReport when completed.
568:             */
569:            public YPFuture validate_values_tModel(Vector tModel) {
570:                ValidateValues o = new ValidateValues();
571:                o.setTModelVector(tModel);
572:                return pkg(o, false, DispositionReport.class);
573:            }
574:
575:            /**
576:             * @note The returned YPFuture will contain a Element when completed.
577:             */
578:            public YPFuture send(UDDIElement el, boolean inquiry) {
579:                return pkg(el, inquiry, null);
580:            }
581:
582:            /**
583:             * @note The returned YPFuture will contain a Element when completed.
584:             */
585:            public YPFuture send(Element el, boolean inquiry) {
586:                return pkg(el, inquiry, null);
587:            }
588:
589:            //
590:            //
591:            //
592:
593:            private YPFuture pkg(UDDIElement el, boolean qp, Class rc) {
594:                return pkg(toXML(el), qp, rc);
595:            }
596:
597:            private YPFuture pkg(Element el, boolean qp, Class rc) {
598:                YPFuture fut = new YPFutureImpl(context, el, qp, rc,
599:                        getSearchMode());
600:                if (autosubmit) {
601:                    return yps.submit(fut);
602:                } else {
603:                    return fut;
604:                }
605:            }
606:
607:            // Extra method for sending queries without blackboard involvement.
608:            public YPFuture execute(YPFuture pendingQuery) {
609:                // not yet implemented.  needs something like:
610:                return yps.submit(pendingQuery);
611:            }
612:
613:            //
614:            // utilities
615:            //
616:
617:            private Vector v(Object o) {
618:                Vector v = new Vector(1);
619:                v.addElement(o);
620:                return v;
621:            }
622:
623:            private Element toXML(UDDIElement el) {
624:                Element base = createTmpElement();
625:                el.saveToXML(base);
626:                Element e = (Element) base.getFirstChild();
627:                return e;
628:            }
629:
630:            private static DocumentBuilder _docBuilder = null;
631:
632:            private static synchronized DocumentBuilder getDocBuilder() {
633:                if (_docBuilder == null) {
634:                    try {
635:                        _docBuilder = DocumentBuilderFactory.newInstance()
636:                                .newDocumentBuilder();
637:                    } catch (ParserConfigurationException pce) {
638:                        logger.error(
639:                                "Unexpected failure creating DocumentBuilder",
640:                                pce);
641:                        throw new Error("Could not create DocumentBuilder", pce);
642:                    }
643:                }
644:                return _docBuilder;
645:            }
646:
647:            private Element createTmpElement() {
648:                DocumentBuilder docBuilder = getDocBuilder();
649:                synchronized (docBuilder) {
650:                    try {
651:                        // YECH!! javax.* isnt thread safe... Lets see if this is a bottleneck.
652:                        return docBuilder.newDocument().createElement("tmp");
653:                    } catch (DOMException e) {
654:                        // probably cannot happen
655:                        logger.error("Failure while building tmp element", e);
656:                        throw new RuntimeException(e);
657:                    }
658:                }
659:            }
660:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.