Source Code Cross Referenced for ClientISoapImpl.java in  » Groupware » LibreSource » org » libresource » so6 » adapter » ls » client » soap » 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 » Groupware » LibreSource » org.libresource.so6.adapter.ls.client.soap 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * LibreSource
003:         * Copyright (C) 2004-2008 Artenum SARL / INRIA
004:         * http://www.libresource.org - contact@artenum.com
005:         *
006:         * This file is part of the LibreSource software, 
007:         * which can be used and distributed under license conditions.
008:         * The license conditions are provided in the LICENSE.TXT file 
009:         * at the root path of the packaging that enclose this file. 
010:         * More information can be found at 
011:         * - http://dev.libresource.org/home/license
012:         *
013:         * Initial authors :
014:         *
015:         * Guillaume Bort / INRIA
016:         * Francois Charoy / Universite Nancy 2
017:         * Julien Forest / Artenum
018:         * Claude Godart / Universite Henry Poincare
019:         * Florent Jouille / INRIA
020:         * Sebastien Jourdain / INRIA / Artenum
021:         * Yves Lerumeur / Artenum
022:         * Pascal Molli / Universite Henry Poincare
023:         * Gerald Oster / INRIA
024:         * Mariarosa Penzi / Artenum
025:         * Gerard Sookahet / Artenum
026:         * Raphael Tani / INRIA
027:         *
028:         * Contributors :
029:         *
030:         * Stephane Bagnier / Artenum
031:         * Amadou Dia / Artenum-IUP Blois
032:         * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
033:         */package org.libresource.so6.adapter.ls.client.soap;
034:
035:        import org.apache.axis.client.Call;
036:        import org.apache.axis.client.Service;
037:        import org.apache.axis.encoding.XMLType;
038:        import org.apache.axis.encoding.ser.JAFDataHandlerDeserializerFactory;
039:        import org.apache.axis.encoding.ser.JAFDataHandlerSerializerFactory;
040:
041:        import org.libresource.so6.core.client.AuthenticationException;
042:        import org.libresource.so6.core.client.LocalException;
043:        import org.libresource.so6.core.client.ServerException;
044:        import org.libresource.so6.core.client.UnableToContactServerException;
045:        import org.libresource.so6.core.engine.util.CryptUtil;
046:        import org.libresource.so6.core.net.DataflowClientI;
047:
048:        import java.io.File;
049:        import java.io.FileInputStream;
050:        import java.io.FileOutputStream;
051:
052:        import java.rmi.RemoteException;
053:
054:        import java.util.ArrayList;
055:        import java.util.Properties;
056:        import java.util.StringTokenizer;
057:
058:        import javax.activation.DataHandler;
059:
060:        import javax.xml.namespace.QName;
061:        import javax.xml.rpc.ParameterMode;
062:        import javax.xml.rpc.ServiceException;
063:
064:        /**
065:         * @author smack
066:         */
067:        public class ClientISoapImpl implements  DataflowClientI {
068:            public static final String SERVICE_URL_ENDPOINT = "so6.soap.url.endpoint";
069:
070:            //
071:            private Service service;
072:
073:            // Vars
074:            private String endpointURI;
075:            private String login;
076:            private String password;
077:            private String replicaURI;
078:            private String synchronizerURI;
079:
080:            /**
081:             * Creates a new ClientISoapImpl object.
082:             *
083:             * @param props DOCUMENT ME!
084:             */
085:            public ClientISoapImpl(Properties props) {
086:                service = new org.apache.axis.client.Service();
087:
088:                //
089:                endpointURI = props.getProperty(SERVICE_URL_ENDPOINT);
090:                login = props.getProperty(SO6_LOGIN);
091:
092:                if (props.getProperty(SO6_PASSWORD) != null) {
093:                    password = CryptUtil
094:                            .decode(props.getProperty(SO6_PASSWORD));
095:                }
096:
097:                synchronizerURI = props.getProperty(SO6_QUEUE_ID);
098:                replicaURI = "" + props.getProperty(SO6_CONNECTION_ID);
099:            }
100:
101:            /**
102:             * DOCUMENT ME!
103:             *
104:             * @param binExt DOCUMENT ME!
105:             *
106:             * @throws UnableToContactServerException DOCUMENT ME!
107:             * @throws ServerException DOCUMENT ME!
108:             * @throws LocalException DOCUMENT ME!
109:             */
110:            public void addBinExt(String binExt)
111:                    throws UnableToContactServerException, ServerException,
112:                    LocalException {
113:                Call call = createSoapCall("addBinExt");
114:                call.addParameter("SYNCHRONIZER_URI", XMLType.XSD_STRING,
115:                        ParameterMode.IN);
116:                call.addParameter("binExt", XMLType.XSD_STRING,
117:                        ParameterMode.IN);
118:                call.setReturnType(XMLType.AXIS_VOID);
119:
120:                try {
121:                    call.invoke(new Object[] { synchronizerURI, binExt });
122:                } catch (RemoteException e) {
123:                    throw new ServerException(e);
124:                }
125:            }
126:
127:            /**
128:             * DOCUMENT ME!
129:             *
130:             * @param wsId DOCUMENT ME!
131:             * @param queueURI DOCUMENT ME!
132:             * @param wscName DOCUMENT ME!
133:             * @param wscPath DOCUMENT ME!
134:             *
135:             * @return DOCUMENT ME!
136:             *
137:             * @throws UnableToContactServerException DOCUMENT ME!
138:             * @throws ServerException DOCUMENT ME!
139:             * @throws LocalException DOCUMENT ME!
140:             */
141:            public String addWsConnection(String wsId, String queueURI,
142:                    String wscName, String wscPath)
143:                    throws UnableToContactServerException, ServerException,
144:                    LocalException {
145:                // addWsConnection(String wsId, String queueId, String wscName, String wscPath)
146:                Call call = createSoapCall("addWsConnection");
147:                call
148:                        .addParameter("WS_ID", XMLType.XSD_STRING,
149:                                ParameterMode.IN);
150:                call.addParameter("SYNCHRONIZER_URI", XMLType.XSD_STRING,
151:                        ParameterMode.IN);
152:                call.addParameter("WSC_NAME_URI", XMLType.XSD_STRING,
153:                        ParameterMode.IN);
154:                call.addParameter("WS_PATH_URI", XMLType.XSD_STRING,
155:                        ParameterMode.IN);
156:                call.setReturnType(XMLType.XSD_STRING);
157:
158:                try {
159:                    return (String) call.invoke(new Object[] { wsId,
160:                            synchronizerURI, wscName, wscPath });
161:                } catch (RemoteException e) {
162:                    throw new ServerException(e);
163:                }
164:            }
165:
166:            /**
167:             * DOCUMENT ME!
168:             *
169:             * @param workspaceId DOCUMENT ME!
170:             *
171:             * @throws UnableToContactServerException DOCUMENT ME!
172:             * @throws ServerException DOCUMENT ME!
173:             * @throws LocalException DOCUMENT ME!
174:             */
175:            public void createWorkspace(String workspaceId)
176:                    throws UnableToContactServerException, ServerException,
177:                    LocalException {
178:                // createWorkspace(String wsId) 
179:                Call call = createSoapCall("createWorkspace");
180:                call
181:                        .addParameter("WS_ID", XMLType.XSD_STRING,
182:                                ParameterMode.IN);
183:                call.setReturnType(XMLType.AXIS_VOID);
184:
185:                try {
186:                    call.invoke(new Object[] { workspaceId });
187:                } catch (RemoteException e) {
188:                    throw new ServerException(e);
189:                }
190:            }
191:
192:            /**
193:             * DOCUMENT ME!
194:             *
195:             * @return DOCUMENT ME!
196:             *
197:             * @throws UnableToContactServerException DOCUMENT ME!
198:             * @throws ServerException DOCUMENT ME!
199:             * @throws LocalException DOCUMENT ME!
200:             */
201:            public String getBinExt() throws UnableToContactServerException,
202:                    ServerException, LocalException {
203:                Call call = createSoapCall("getBinExt");
204:                call.addParameter("SYNCHRONIZER_URI", XMLType.XSD_STRING,
205:                        ParameterMode.IN);
206:                call.setReturnType(XMLType.XSD_STRING);
207:
208:                try {
209:                    String result = (String) call
210:                            .invoke(new Object[] { synchronizerURI });
211:
212:                    return result;
213:                } catch (RemoteException e) {
214:                    throw new ServerException(e);
215:                }
216:            }
217:
218:            // ClientI Interface
219:
220:            /**
221:             * DOCUMENT ME!
222:             *
223:             * @return DOCUMENT ME!
224:             *
225:             * @throws UnableToContactServerException DOCUMENT ME!
226:             * @throws ServerException DOCUMENT ME!
227:             * @throws LocalException DOCUMENT ME!
228:             */
229:            public long getLastTicket() throws UnableToContactServerException,
230:                    ServerException, LocalException {
231:                Call call = createSoapCall("getLastTicket");
232:                call.addParameter("SYNCHRONIZER_URI", XMLType.XSD_STRING,
233:                        ParameterMode.IN);
234:                call.setReturnType(XMLType.XSD_LONG);
235:
236:                try {
237:                    return ((Long) call
238:                            .invoke(new Object[] { synchronizerURI }))
239:                            .longValue();
240:                } catch (RemoteException e) {
241:                    throw new ServerException(e);
242:                }
243:            }
244:
245:            /**
246:             * DOCUMENT ME!
247:             *
248:             * @param queueId DOCUMENT ME!
249:             *
250:             * @return DOCUMENT ME!
251:             *
252:             * @throws Exception DOCUMENT ME!
253:             */
254:            public String getNetworkFromQueue(String queueId) throws Exception {
255:                Call call = createSoapCall("getNetworkFromQueue");
256:                call.addParameter("SYNCHRONIZER_URI", XMLType.XSD_STRING,
257:                        ParameterMode.IN);
258:
259:                QName qnameAttachment = new QName("urn:libresource",
260:                        "DataHandler");
261:                call.registerTypeMapping(DataHandler.class, qnameAttachment,
262:                        JAFDataHandlerSerializerFactory.class,
263:                        JAFDataHandlerDeserializerFactory.class);
264:                call.setReturnType(qnameAttachment);
265:                call.setProperty(Call.ATTACHMENT_ENCAPSULATION_FORMAT,
266:                        Call.ATTACHMENT_ENCAPSULATION_FORMAT_DIME);
267:
268:                DataHandler dh = (DataHandler) call
269:                        .invoke(new Object[] { queueId });
270:
271:                // Make a file
272:                File f = File.createTempFile("so6NetworkDownload", null);
273:                FileOutputStream fos = new FileOutputStream(f);
274:                dh.writeTo(fos);
275:                fos.close();
276:
277:                return f.getPath();
278:            }
279:
280:            // DataflowReaderClientI
281:
282:            /**
283:             * DOCUMENT ME!
284:             *
285:             * @param wsId DOCUMENT ME!
286:             *
287:             * @return DOCUMENT ME!
288:             *
289:             * @throws UnableToContactServerException DOCUMENT ME!
290:             * @throws ServerException DOCUMENT ME!
291:             * @throws LocalException DOCUMENT ME!
292:             */
293:            public String getNetworkFromWorkspace(String wsId)
294:                    throws UnableToContactServerException, ServerException,
295:                    LocalException {
296:                Call call = createSoapCall("getNetworkFromWorkspace");
297:                call
298:                        .addParameter("WS_ID", XMLType.XSD_STRING,
299:                                ParameterMode.IN);
300:
301:                QName qnameAttachment = new QName("urn:libresource",
302:                        "DataHandler");
303:                call.registerTypeMapping(DataHandler.class, qnameAttachment,
304:                        JAFDataHandlerSerializerFactory.class,
305:                        JAFDataHandlerDeserializerFactory.class);
306:                call.setReturnType(qnameAttachment);
307:                call.setProperty(Call.ATTACHMENT_ENCAPSULATION_FORMAT,
308:                        Call.ATTACHMENT_ENCAPSULATION_FORMAT_DIME);
309:
310:                DataHandler dh = null;
311:
312:                try {
313:                    dh = (DataHandler) call.invoke(new Object[] { wsId });
314:                } catch (RemoteException e) {
315:                    throw new ServerException(e);
316:                }
317:
318:                try {
319:                    // Make a file
320:                    File f = File.createTempFile("so6NetworkDownload", null);
321:                    FileOutputStream fos = new FileOutputStream(f);
322:                    dh.writeTo(fos);
323:                    fos.close();
324:
325:                    return f.getPath();
326:                } catch (Exception e) {
327:                    throw new LocalException(e);
328:                }
329:            }
330:
331:            /**
332:             * DOCUMENT ME!
333:             *
334:             * @param fromTicket DOCUMENT ME!
335:             *
336:             * @return DOCUMENT ME!
337:             *
338:             * @throws UnableToContactServerException DOCUMENT ME!
339:             * @throws ServerException DOCUMENT ME!
340:             * @throws LocalException DOCUMENT ME!
341:             */
342:            public String getPatch(final long fromTicket)
343:                    throws UnableToContactServerException, ServerException,
344:                    LocalException {
345:                //Workspace.getMonitoringLogger().log(Level.INFO, "ClientI.getPatch", new ProgressInfo( true, "Downloading", -1));
346:                Call call = createSoapCall("getPatch");
347:                call.addParameter("SYNCHRONIZER_URI", XMLType.XSD_STRING,
348:                        ParameterMode.IN);
349:                call.addParameter("fromTicket", XMLType.XSD_LONG,
350:                        ParameterMode.IN);
351:
352:                QName qnameAttachment = new QName("urn:libresource",
353:                        "DataHandler");
354:                call.registerTypeMapping(DataHandler.class, qnameAttachment,
355:                        JAFDataHandlerSerializerFactory.class,
356:                        JAFDataHandlerDeserializerFactory.class);
357:                call.setReturnType(qnameAttachment);
358:                call.setProperty(Call.ATTACHMENT_ENCAPSULATION_FORMAT,
359:                        Call.ATTACHMENT_ENCAPSULATION_FORMAT_DIME);
360:
361:                //
362:                //
363:                DataHandler dh = null;
364:
365:                try {
366:                    dh = (DataHandler) call.invoke(new Object[] {
367:                            synchronizerURI, new Long(fromTicket) });
368:                } catch (RemoteException e) {
369:                    throw new ServerException(e);
370:                }
371:
372:                // Make a file
373:                File f;
374:
375:                try {
376:                    f = File.createTempFile("downloadedPatch", null);
377:
378:                    FileOutputStream fos = new FileOutputStream(f);
379:
380:                    //MonitoredOutputStream mos = new MonitoredOutputStream(fos, getPatchSize(fromTicket));
381:                    dh.writeTo(fos);
382:                    fos.close();
383:                } catch (Exception e) {
384:                    throw new LocalException(e);
385:                }
386:
387:                //
388:                return f.getPath();
389:            }
390:
391:            /**
392:             * DOCUMENT ME!
393:             *
394:             * @param arg0 DOCUMENT ME!
395:             * @param arg1 DOCUMENT ME!
396:             *
397:             * @return DOCUMENT ME!
398:             *
399:             * @throws UnableToContactServerException DOCUMENT ME!
400:             * @throws ServerException DOCUMENT ME!
401:             * @throws LocalException DOCUMENT ME!
402:             */
403:            public String getPatch(long arg0, long arg1)
404:                    throws UnableToContactServerException, ServerException,
405:                    LocalException {
406:                throw new LocalException("Not implemented yet");
407:            }
408:
409:            /**
410:             * DOCUMENT ME!
411:             *
412:             * @param fromTicket DOCUMENT ME!
413:             *
414:             * @return DOCUMENT ME!
415:             *
416:             * @throws Exception DOCUMENT ME!
417:             */
418:            public long getPatchSize(long fromTicket) throws Exception {
419:                long[][] patches = listPatch();
420:
421:                for (int i = 0; i < patches.length; i++) {
422:                    if (patches[i][0] == fromTicket) {
423:                        return patches[i][2];
424:                    }
425:                }
426:
427:                return -1;
428:            }
429:
430:            /**
431:             * DOCUMENT ME!
432:             *
433:             * @return DOCUMENT ME!
434:             *
435:             * @throws UnableToContactServerException DOCUMENT ME!
436:             * @throws ServerException DOCUMENT ME!
437:             * @throws LocalException DOCUMENT ME!
438:             */
439:            public long[][] listPatch() throws UnableToContactServerException,
440:                    ServerException, LocalException {
441:                Call call = createSoapCall("listPatch");
442:                call.addParameter("SYNCHRONIZER_URI", XMLType.XSD_STRING,
443:                        ParameterMode.IN);
444:                call.setReturnType(XMLType.XSD_STRING);
445:
446:                String patchArray = null;
447:
448:                try {
449:                    patchArray = (String) call
450:                            .invoke(new Object[] { synchronizerURI });
451:                } catch (RemoteException e) {
452:                    throw new ServerException(e);
453:                }
454:
455:                //
456:                StringTokenizer st = new StringTokenizer(patchArray, "\n");
457:                ArrayList patchs = new ArrayList();
458:
459:                while (st.hasMoreTokens()) {
460:                    patchs.add(st.nextToken());
461:                }
462:
463:                long[][] result = new long[patchs.size()][3];
464:
465:                for (int i = 0; i < result.length; i++) {
466:                    result[i][0] = Long.parseLong(((String) patchs.get(i))
467:                            .split(" ")[0]);
468:                    result[i][1] = Long.parseLong(((String) patchs.get(i))
469:                            .split(" ")[1]);
470:                    result[i][2] = Long.parseLong(((String) patchs.get(i))
471:                            .split(" ")[2]);
472:                }
473:
474:                return result;
475:            }
476:
477:            //
478:
479:            /**
480:             * DOCUMENT ME!
481:             *
482:             * @param args DOCUMENT ME!
483:             *
484:             * @throws Exception DOCUMENT ME!
485:             */
486:            public static void main(String[] args) throws Exception {
487:                Properties props = new Properties();
488:                FileInputStream fis = new FileInputStream(
489:                        "c:/work/so6/.so6/1/so6.properties");
490:                props.load(fis);
491:                fis.close();
492:
493:                ClientISoapImpl client = new ClientISoapImpl(props);
494:
495:                //System.out.println("get patct 1");
496:                //System.out.println(client.getPatch(1));
497:            }
498:
499:            /**
500:             * DOCUMENT ME!
501:             *
502:             * @param lastTicket DOCUMENT ME!
503:             *
504:             * @throws Exception DOCUMENT ME!
505:             */
506:            public void notifyQueue(long lastTicket) throws Exception {
507:                // notifyQueue(String synchronizerURI, String replicaURI, long lastTicket)
508:                Call call = createSoapCall("notifyQueue");
509:                call.addParameter("SYNCHRONIZER_URI", XMLType.XSD_STRING,
510:                        ParameterMode.IN);
511:                call.addParameter("REPLICA_URI", XMLType.XSD_STRING,
512:                        ParameterMode.IN);
513:                call.addParameter("LAST_WS_TICKET", XMLType.XSD_LONG,
514:                        ParameterMode.IN);
515:                call.setReturnType(XMLType.AXIS_VOID);
516:                call.invoke(new Object[] { synchronizerURI, replicaURI,
517:                        new Long(lastTicket) });
518:            }
519:
520:            /**
521:             * DOCUMENT ME!
522:             *
523:             * @param wsId DOCUMENT ME!
524:             * @param queueIds DOCUMENT ME!
525:             *
526:             * @throws UnableToContactServerException DOCUMENT ME!
527:             * @throws ServerException DOCUMENT ME!
528:             * @throws LocalException DOCUMENT ME!
529:             */
530:            public void notifyWorkspaceConnections(String wsId,
531:                    String[] queueIds) throws UnableToContactServerException,
532:                    ServerException, LocalException {
533:                // Not Yet implemented
534:                throw new LocalException(
535:                        "Not yet implemented (notifyWorkspaceConnections)");
536:            }
537:
538:            /**
539:             * DOCUMENT ME!
540:             *
541:             * @param binExt DOCUMENT ME!
542:             *
543:             * @throws UnableToContactServerException DOCUMENT ME!
544:             * @throws ServerException DOCUMENT ME!
545:             * @throws LocalException DOCUMENT ME!
546:             */
547:            public void removeBinExt(String binExt)
548:                    throws UnableToContactServerException, ServerException,
549:                    LocalException {
550:                Call call = createSoapCall("removeBinExt");
551:                call.addParameter("SYNCHRONIZER_URI", XMLType.XSD_STRING,
552:                        ParameterMode.IN);
553:                call.addParameter("binExt", XMLType.XSD_STRING,
554:                        ParameterMode.IN);
555:                call.setReturnType(XMLType.AXIS_VOID);
556:
557:                try {
558:                    call.invoke(new Object[] { synchronizerURI, binExt });
559:                } catch (RemoteException e) {
560:                    throw new ServerException(e);
561:                }
562:            }
563:
564:            /**
565:             * DOCUMENT ME!
566:             *
567:             * @param workspaceId DOCUMENT ME!
568:             *
569:             * @throws UnableToContactServerException DOCUMENT ME!
570:             * @throws ServerException DOCUMENT ME!
571:             * @throws LocalException DOCUMENT ME!
572:             */
573:            public void removeWorkspace(String workspaceId)
574:                    throws UnableToContactServerException, ServerException,
575:                    LocalException {
576:                // removeWorkspace(String wsId) 
577:                Call call = createSoapCall("removeWorkspace");
578:                call
579:                        .addParameter("WS_ID", XMLType.XSD_STRING,
580:                                ParameterMode.IN);
581:                call.setReturnType(XMLType.AXIS_VOID);
582:
583:                try {
584:                    call.invoke(new Object[] { workspaceId });
585:                } catch (RemoteException e) {
586:                    throw new ServerException(e);
587:                }
588:            }
589:
590:            /**
591:             * DOCUMENT ME!
592:             *
593:             * @param wsId DOCUMENT ME!
594:             * @param queueId DOCUMENT ME!
595:             *
596:             * @throws AuthenticationException DOCUMENT ME!
597:             * @throws UnableToContactServerException DOCUMENT ME!
598:             * @throws ServerException DOCUMENT ME!
599:             */
600:            public void removeWsConnection(String wsId, String queueId)
601:                    throws AuthenticationException,
602:                    UnableToContactServerException, ServerException {
603:                // removeWsConnection(String wsId, String queueId)
604:                Call call = createSoapCall("removeWsConnection");
605:                call
606:                        .addParameter("WS_ID", XMLType.XSD_STRING,
607:                                ParameterMode.IN);
608:                call.addParameter("SYNCHRONIZER_URI", XMLType.XSD_STRING,
609:                        ParameterMode.IN);
610:                call.setReturnType(XMLType.AXIS_VOID);
611:
612:                try {
613:                    call.invoke(new Object[] { wsId, synchronizerURI });
614:                } catch (RemoteException e) {
615:                    throw new ServerException(e);
616:                }
617:            }
618:
619:            /**
620:             * DOCUMENT ME!
621:             *
622:             * @param fromTicket DOCUMENT ME!
623:             * @param toTicket DOCUMENT ME!
624:             * @param patchFileName DOCUMENT ME!
625:             *
626:             * @throws UnableToContactServerException DOCUMENT ME!
627:             * @throws ServerException DOCUMENT ME!
628:             * @throws LocalException DOCUMENT ME!
629:             */
630:            public void sendPatch(long fromTicket, long toTicket,
631:                    String patchFileName)
632:                    throws UnableToContactServerException, ServerException,
633:                    LocalException {
634:                MonitoredDataSource datasource = new MonitoredDataSource(
635:                        patchFileName);
636:                DataHandler dh = new DataHandler(datasource);
637:
638:                //
639:                Call call = createSoapCall("sendPatch");
640:                call.addParameter("SYNCHRONIZER_URI", XMLType.XSD_STRING,
641:                        ParameterMode.IN);
642:                call.addParameter("fromTicket", XMLType.XSD_LONG,
643:                        ParameterMode.IN);
644:                call.addParameter("toTicket", XMLType.XSD_LONG,
645:                        ParameterMode.IN);
646:
647:                QName qnameAttachment = new QName("urn:libresource",
648:                        "DataHandler");
649:                call.registerTypeMapping(dh.getClass(), qnameAttachment,
650:                        JAFDataHandlerSerializerFactory.class,
651:                        JAFDataHandlerDeserializerFactory.class);
652:                call.addParameter("dh", qnameAttachment, ParameterMode.IN);
653:                call.setReturnType(XMLType.AXIS_VOID);
654:                call.setProperty(Call.ATTACHMENT_ENCAPSULATION_FORMAT,
655:                        Call.ATTACHMENT_ENCAPSULATION_FORMAT_DIME);
656:
657:                try {
658:                    call.invoke(new Object[] { synchronizerURI,
659:                            new Long(fromTicket), new Long(toTicket), dh });
660:                } catch (RemoteException e) {
661:                    throw new ServerException(e);
662:                }
663:            }
664:
665:            // SOAP MANAGEMENT
666:            private Call createSoapCall(String funcName)
667:                    throws UnableToContactServerException {
668:                Call call = null;
669:
670:                try {
671:                    call = (Call) service.createCall();
672:                } catch (ServiceException e) {
673:                    throw new UnableToContactServerException();
674:                }
675:
676:                call.setTimeout(new Integer(0));
677:
678:                if ((login != null) && (password != null)) {
679:                    call.setUsername(login);
680:                    call.setPassword(password);
681:                }
682:
683:                // Finish the standard set of a SOAP call
684:                call.setTargetEndpointAddress(endpointURI);
685:                call.setOperationName(funcName);
686:
687:                return call;
688:            }
689:
690:            //
691:            public class Test extends Thread {
692:                int i = 0;
693:                private Call call;
694:                private boolean keepGoing = true;
695:
696:                public Test(Call call) {
697:                    this .call = call;
698:                }
699:
700:                public void exit() {
701:                    keepGoing = false;
702:                }
703:
704:                public void run() {
705:                    while (keepGoing) {
706:                        try {
707:                            System.out.println("-->"
708:                                    + call.getResponseMessage()
709:                                            .getContentLength());
710:
711:                            //System.out.println(message.getSOAPPartAsString());
712:                            sleep(500);
713:                        } catch (Exception e) {
714:                            System.out.println("Error: " + (i++) + e);
715:                        }
716:                    }
717:                }
718:            }
719:        }
w_w__w.jav_a__2___s___._c_o__m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.