Debian Codegraph @

cvsservice/DESIGN

raw
1 OVERVIEW
2 --------
3
4 The cvs DCOP service consists of the following three parts:
5
6 1. CvsService - The main interface to the functionality of the cvs command line
7 client. There is one method for each cvs command, e.g. add,
8 checkout, commit, etc... The methods assemble the command line
9 arguments, create a CvsJob and return a DCOPRef object for it
10 to the caller. There is one instance of this service for each
11 application instance.
12
13 2. Repository - This DCOPObject manages the configuration data of the current
14 cvs repository. The data is automatically updated when other
15 service instances change it.
16
17 3. CvsJob - This class represents a cvs job. You can execute and cancel it,
18 and you can retrieve the output of the cvs client by either
19 connecting to the proper DCOP signals or by using the output()
20 method. There are two types of jobs. First the non-concurrent
21 job which has to run alone, like cvs update or import. Second
22 the jobs which can run concurrently like cvs log or annotate.
23
24 USAGE
25 -----
26
27 How-to use this service in C++ applications:
28
29 // start DCOP service
30 QString error;
31 QCString appId;
32
33 KToolInvocation::startServiceByDesktopName("cvsservice", QStringList(), &error,
34 &appId);
35
36 // create stub for repository
37 Repository_stub repository(appId, "CvsRepository");
38
39 // set directory of working copy
40 repository.setWorkingCopy("/home/user/kde/kdesdk/cervisia");
41
42 // create stub for service
43 CvsService_stub cvsService(appId, "CvsService");
44
45 // call "cvs log" for cervisiapart.h
46 DCOPRef job = cvsService.log("cervisiapart.h");
47
48 // connect to signals to get output
49 connectDCOPSignal(job.app(), job.obj(), "jobExited(bool, int)", [MY SLOT]);
50 connectDCOPSignal(job.app(), job.obj(), "receivedStdout(QString)",
51 [MY SLOT]);
52
53 // execute the cvs command
54 job.execute();
55
56
57 How-to use this service in a shell script:
58
59 #!/bin/sh
60
61 # start DCOP service
62 APP=`dcopstart cvsservice`
63
64 # set directory of working copy
65 dcop $APP CvsRepository setWorkingCopy /home/user/kde/kdesdk/cervisia
66
67 # call "cvs log" for cervisiapart.h
68 JOB=`dcop $APP CvsService log cervisiapart.h`
69
70 # execute the cvs command
71 dcop $JOB execute
72
73 # print the output on stdout
74 dcop $JOB output
75
76 # stop DCOP service
77 dcop $APP CvsService quit
78
79
80 How-to use this service in a javascript:
81
82 #!/usr/bin/env kjscmd
83
84 var client = new DCOPClient(this);
85 if ( client.attach() )
86 {
87 // start DCOP service
88 var appID = client.dcopStart("cvsservice");
89
90 // set directory of working copy
91 client.send(appID, "CvsRepository", "setWorkingCopy(QString)", "/home/user/kde/kdesdk/cervisia");
92
93 // call "cvs log" for cervisiapart.h
94 var job = client.call(appID, "CvsService", "log(QString)", "cervisiapart.h");
95
96 // execute the cvs command
97 job.call("execute()");
98
99 // wait for job to finish
100 while( job.call("isRunning()") );
101
102 // print the output on stdout
103 var output = job.call("output()");
104 println(output);
105
106 // stop DCOP service
107 client.send(appID, "CvsService", "quit()");
108 }