summaryrefslogtreecommitdiff
path: root/framework/source/jobs/joburl.cxx
blob: a7f0375c8a99f584abc13ae82a84dfcf664f8994 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
/*************************************************************************
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * Copyright 2000, 2010 Oracle and/or its affiliates.
 *
 * OpenOffice.org - a multi-platform office productivity suite
 *
 * This file is part of OpenOffice.org.
 *
 * OpenOffice.org is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * OpenOffice.org is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License version 3 for more details
 * (a copy is included in the LICENSE file that accompanied this code).
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with OpenOffice.org.  If not, see
 * <http://www.openoffice.org/license.html>
 * for a copy of the LGPLv3 License.
 *
 ************************************************************************/

// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_framework.hxx"

//________________________________
//  my own includes
#include <jobs/joburl.hxx>
#include <threadhelp/readguard.hxx>
#include <threadhelp/writeguard.hxx>
#include <general.h>

//________________________________
//  interface includes

//________________________________
//  includes of other projects
#include <rtl/ustrbuf.hxx>
#include <vcl/svapp.hxx>

//________________________________
//  namespace

namespace framework{

//________________________________
//  non exported const

//________________________________
//  non exported definitions

//________________________________
//  declarations

//________________________________
/**
    @short      special ctor
    @descr      It initialize this new instance with a (hopyfully) valid job URL.
                This URL will be parsed. After that we set our members right,
                so other interface methods of this class can be used to get
                all items of this URL. Of course it will be possible to know,
                if this URL was valid too.

    @param      sURL
                    the job URL for parsing
*/
JobURL::JobURL( /*IN*/ const ::rtl::OUString& sURL )
    : ThreadHelpBase( &Application::GetSolarMutex() )
{
    #ifdef ENABLE_COMPONENT_SELF_CHECK
    JobURL::impldbg_checkIt();
    #endif

    m_eRequest = E_UNKNOWN;

    // syntax: vnd.sun.star.job:{[event=<name>],[alias=<name>],[service=<name>]}

    // check for "vnd.sun.star.job:"
    if (sURL.matchIgnoreAsciiCaseAsciiL(JOBURL_PROTOCOL_STR,JOBURL_PROTOCOL_LEN,0))
    {
        sal_Int32 t = JOBURL_PROTOCOL_LEN;
        do
        {
            // seperate all token of "{[event=<name>],[alias=<name>],[service=<name>]}"
            ::rtl::OUString sToken = sURL.getToken(0, JOBURL_PART_SEPERATOR, t);
            ::rtl::OUString sPartValue    ;
            ::rtl::OUString sPartArguments;

            // check for "event="
            if (
                (JobURL::implst_split(sToken,JOBURL_EVENT_STR,JOBURL_EVENT_LEN,sPartValue,sPartArguments)) &&
                (sPartValue.getLength()>0                                                                )
               )
            {
                // set the part value
                m_sEvent     = sPartValue    ;
                m_sEventArgs = sPartArguments;
                m_eRequest  |= E_EVENT       ;
            }
            else
            // check for "alias="
            if (
                (JobURL::implst_split(sToken,JOBURL_ALIAS_STR,JOBURL_ALIAS_LEN,sPartValue,sPartArguments)) &&
                (sPartValue.getLength()>0                                                                )
               )
            {
                // set the part value
                m_sAlias     = sPartValue    ;
                m_sAliasArgs = sPartArguments;
                m_eRequest  |= E_ALIAS       ;
            }
            else
            // check for "service="
            if (
                (JobURL::implst_split(sToken,JOBURL_SERVICE_STR,JOBURL_SERVICE_LEN,sPartValue,sPartArguments)) &&
                (sPartValue.getLength()>0                                                                    )
               )
            {
                // set the part value
                m_sService     = sPartValue    ;
                m_sServiceArgs = sPartArguments;
                m_eRequest    |= E_SERVICE     ;
            }
        }
        while(t!=-1);
    }
}

//________________________________
/**
    @short      knows, if this job URL object hold a valid URL inside

    @return     <sal_True/> if it represent a valid job URL.
*/
sal_Bool JobURL::isValid() const
{
    /* SAFE { */
    ReadGuard aReadLock(m_aLock);
    return (m_eRequest!=E_UNKNOWN);
}

//________________________________
/**
    @short      get the event item of this job URL
    @descr      Because the three possible parts of such URL (event, alias, service)
                can't be combined, this method can(!) return a valid value - but it's
                not a must. Thats why the return value must be used too, to detect a missing
                event value.

    @param      sEvent
                    returns the possible existing event value
                    e.g. "vnd.sun.star.job:event=myEvent" returns "myEvent"

    @return     <sal_True/> if an event part of the job URL exist and the out parameter
                sEvent was filled.

    @attention  The out parameter will be reseted everytime. Don't use it if method returns <sal_False/>!
*/
sal_Bool JobURL::getEvent( /*OUT*/ ::rtl::OUString& sEvent ) const
{
    /* SAFE { */
    ReadGuard aReadLock(m_aLock);

             sEvent = ::rtl::OUString();
    sal_Bool bSet   = ((m_eRequest & E_EVENT) == E_EVENT);
    if (bSet)
        sEvent = m_sEvent;

    aReadLock.unlock();
    /* } SAFE */

    return bSet;
}

//________________________________
/**
    @short      get the alias item of this job URL
    @descr      Because the three possible parts of such URL (event, alias, service)
                can't be combined, this method can(!) return a valid value - but it's
                not a must. Thats why the return value must be used too, to detect a missing
                alias value.

    @param      sAlias
                    returns the possible existing alias value
                    e.g. "vnd.sun.star.job:alias=myAlias" returns "myAlias"

    @return     <sal_True/> if an alias part of the job URL exist and the out parameter
                sAlias was filled.

    @attention  The out parameter will be reseted everytime. Don't use it if method returns <sal_False/>!
*/
sal_Bool JobURL::getAlias( /*OUT*/ ::rtl::OUString& sAlias ) const
{
    /* SAFE { */
    ReadGuard aReadLock(m_aLock);

             sAlias = ::rtl::OUString();
    sal_Bool bSet   = ((m_eRequest & E_ALIAS) == E_ALIAS);
    if (bSet)
        sAlias = m_sAlias;

    aReadLock.unlock();
    /* } SAFE */

    return bSet;
}

//________________________________
/**
    @short      get the service item of this job URL
    @descr      Because the three possible parts of such URL (event, service, service)
                can't be combined, this method can(!) return a valid value - but it's
                not a must. Thats why the return value must be used too, to detect a missing
                service value.

    @param      sAlias
                    returns the possible existing service value
                    e.g. "vnd.sun.star.job:service=com.sun.star.Service" returns "com.sun.star.Service"

    @return     <sal_True/> if an service part of the job URL exist and the out parameter
                sService was filled.

    @attention  The out parameter will be reseted everytime. Don't use it if method returns <sal_False/>!
*/
sal_Bool JobURL::getService( /*OUT*/ ::rtl::OUString& sService ) const
{
    /* SAFE { */
    ReadGuard aReadLock(m_aLock);

             sService = ::rtl::OUString();
    sal_Bool bSet     = ((m_eRequest & E_SERVICE) == E_SERVICE);
    if (bSet)
        sService = m_sService;

    aReadLock.unlock();
    /* } SAFE */

    return bSet;
}

//________________________________
/**
    @short      searches for a special identifier in the given string and split it
    @descr      If the given identifier could be found at the beginning of the given string,
                this method split it into different parts and return it.
                Following schema is used: <partidentifier>=<partvalue>[?<partarguments>]

    @param      sPart
                    the string, which should be analyzed

    @param      pPartIdentifier
                    the part identifier value, which must be found at the beginning of the
                    parameter <var>sPart</var>

    @param      nPartLength
                    the length of the ascii value <var>pPartIdentifier</var>

    @param      rPartValue
                    returns the part value if <var>sPart</var> was splitted successfully

    @param      rPartArguments
                    returns the part arguments if <var>sPart</var> was splitted successfully

    @return     <sal_True/> if the identifier could be found and the string was splitted.
                <sal_False/> otherwhise.
*/
sal_Bool JobURL::implst_split( /*IN*/  const ::rtl::OUString& sPart           ,
                               /*IN*/  const sal_Char*        pPartIdentifier ,
                               /*IN*/        sal_Int32        nPartLength     ,
                               /*OUT*/       ::rtl::OUString& rPartValue      ,
                               /*OUT*/       ::rtl::OUString& rPartArguments  )
{
    // first search for the given identifier
    sal_Bool bPartFound = (sPart.matchIgnoreAsciiCaseAsciiL(pPartIdentifier,nPartLength,0));

    // If it exist - we can split the part and return sal_True.
    // Otherwhise we do nothing and return sal_False.
    if (bPartFound)
    {
        // But may the part has optional arguments - seperated by a "?".
        // Do so - we set the return value with the whole part string.
        // Arguments will be set to an empty string as default.
        // If we detect the right sign - we split the arguments and overwrite the default.
        ::rtl::OUString sValueAndArguments = sPart.copy(nPartLength);
        ::rtl::OUString sValue             = sValueAndArguments     ;
        ::rtl::OUString sArguments;

        sal_Int32 nArgStart = sValueAndArguments.indexOf('?',0);
        if (nArgStart!=-1)
        {
            sValue     = sValueAndArguments.copy(0,nArgStart);
            ++nArgStart; // ignore '?'!
            sArguments = sValueAndArguments.copy(nArgStart);
        }

        rPartValue     = sValue    ;
        rPartArguments = sArguments;
    }

    return bPartFound;
}

//________________________________
/**
    @short      special debug method
    @descr      It's the entry point method to start a self component check for this class.
                It's used for internal purposes only and never a part of a legal product.
                Use it for testing and debug only!
*/
#ifdef ENABLE_COMPONENT_SELF_CHECK

#define LOGFILE_JOBURL  "joburl.log"

void JobURL::impldbg_checkIt()
{
    // check simple URL's
    JobURL::impldbg_checkURL("vnd.sun.star.job:event=onMyEvent"    , E_EVENT  , "onMyEvent", ""       , ""           , NULL, NULL, NULL);
    JobURL::impldbg_checkURL("vnd.sun.star.job:alias=myAlias"      , E_ALIAS  , ""         , "myAlias", ""           , NULL, NULL, NULL);
    JobURL::impldbg_checkURL("vnd.sun.star.job:service=css.Service", E_SERVICE, ""         , ""       , "css.Service", NULL, NULL, NULL);
    JobURL::impldbg_checkURL("vnd.sun.star.job:service=;"          , E_UNKNOWN, ""         , ""       , ""           , NULL, NULL, NULL);

    // check combinations
    // Note: No additional spaces or tabs are allowed after a seperator occured.
    // Tab and spaces before a seperator will be used as value!
    JobURL::impldbg_checkURL("vnd.sun.star.job:event=onMyEvent;alias=myAlias;service=css.Service"  , E_EVENT | E_ALIAS | E_SERVICE , "onMyEvent", "myAlias", "css.Service" , NULL, NULL, NULL);
    JobURL::impldbg_checkURL("vnd.sun.star.job:service=css.Service;alias=myAlias"                  , E_ALIAS | E_SERVICE           , ""         , "myAlias", "css.Service" , NULL, NULL, NULL);
    JobURL::impldbg_checkURL("vnd.sun.star.job:service=css.Service ;alias=myAlias"                 , E_ALIAS | E_SERVICE           , ""         , "myAlias", "css.Service ", NULL, NULL, NULL);
    JobURL::impldbg_checkURL("vnd.sun.star.job:service=css.Service; alias=myAlias"                 , E_UNKNOWN                     , ""         , ""       , ""            , NULL, NULL, NULL);
    JobURL::impldbg_checkURL("vnd.sun.star.job : event=onMyEvent"                                  , E_UNKNOWN                     , ""         , ""       , ""            , NULL, NULL, NULL);
    JobURL::impldbg_checkURL("vnd.sun.star.job:event=onMyEvent;event=onMyEvent;service=css.Service", E_UNKNOWN                     , ""         , ""       , ""            , NULL, NULL, NULL);

    // check upper/lower case
    // fix parts of the URL are case insensitive (e.g. "vnd.SUN.star.job:eVEnt=")
    // values are case sensitive                 (e.g. "myAlias"                )
    JobURL::impldbg_checkURL("vnd.SUN.star.job:eVEnt=onMyEvent;aliAs=myAlias;serVice=css.Service", E_EVENT | E_ALIAS | E_SERVICE , "onMyEvent", "myAlias", "css.Service" , NULL, NULL, NULL);
    JobURL::impldbg_checkURL("vnd.SUN.star.job:eVEnt=onMyEVENT;aliAs=myALIAS;serVice=css.SERVICE", E_EVENT | E_ALIAS | E_SERVICE , "onMyEVENT", "myALIAS", "css.SERVICE" , NULL, NULL, NULL);

    // check stupid URLs
    JobURL::impldbg_checkURL("vnd.sun.star.jobs:service=css.Service"    , E_UNKNOWN, "", "", "", NULL, NULL, NULL);
    JobURL::impldbg_checkURL("vnd.sun.star.job service=css.Service"     , E_UNKNOWN, "", "", "", NULL, NULL, NULL);
    JobURL::impldbg_checkURL("vnd.sun.star.job:service;css.Service"     , E_UNKNOWN, "", "", "", NULL, NULL, NULL);
    JobURL::impldbg_checkURL("vnd.sun.star.job:service;"                , E_UNKNOWN, "", "", "", NULL, NULL, NULL);
    JobURL::impldbg_checkURL("vnd.sun.star.job:;alias;service;event="   , E_UNKNOWN, "", "", "", NULL, NULL, NULL);
    JobURL::impldbg_checkURL("vnd.sun.star.job:alias=a;service=s;event=", E_UNKNOWN, "", "", "", NULL, NULL, NULL);

    // check argument handling
    JobURL::impldbg_checkURL("vnd.sun.star.job:event=onMyEvent?eventArg1,eventArg2=3,eventArg4,"            , E_EVENT          , "onMyEvent", ""       , ""             , "eventArg1,eventArg2=3,eventArg4,", NULL                 , NULL          );
    JobURL::impldbg_checkURL("vnd.sun.star.job:alias=myAlias?aliasArg1,aliasarg2"                           , E_EVENT          , ""         , "myAlias", ""             , NULL                              , "aliasArg1,aliasarg2", NULL          );
    JobURL::impldbg_checkURL("vnd.sun.star.job:service=css.myService?serviceArg1"                           , E_EVENT          , ""         , ""       , "css.myService", NULL                              , NULL                 , "serviceArg1" );
    JobURL::impldbg_checkURL("vnd.sun.star.job:service=css.myService?serviceArg1;alias=myAlias?aliasArg=564", E_EVENT | E_ALIAS, ""         , "myAlias", "css.myService", NULL                              , "aliasArg=564"       , "serviceArg1" );
}

//________________________________
/**
    @short      helper debug method
    @descr      It uses the given parameter to create a new instance of a JobURL.
                They results will be compared with the exepected ones.
                The a log will be written, which contains some detailed informations
                for this sub test.

    @param      pURL
                    the job URL, which should be checked

    @param      eExpectedPart
                    the expected result

    @param      pExpectedEvent
                    the expected event value

    @param      pExpectedAlias
                    the expected alias value

    @param      pExpectedService
                    the expected service value

    @param      pExpectedEventArgs
                    the expected event arguments

    @param      pExpectedAliasArgs
                    the expected alias arguments

    @param      pExpectedServiceArgs
                    the expected service arguments
*/
void JobURL::impldbg_checkURL( /*IN*/ const sal_Char*  pURL                 ,
                               /*IN*/       sal_uInt32 eExpectedPart        ,
                               /*IN*/ const sal_Char*  pExpectedEvent       ,
                               /*IN*/ const sal_Char*  pExpectedAlias       ,
                               /*IN*/ const sal_Char*  pExpectedService     ,
                               /*IN*/ const sal_Char*  pExpectedEventArgs   ,
                               /*IN*/ const sal_Char*  pExpectedAliasArgs   ,
                               /*IN*/ const sal_Char*  pExpectedServiceArgs )
{
    ::rtl::OUString sEvent      ;
    ::rtl::OUString sAlias      ;
    ::rtl::OUString sService    ;
    ::rtl::OUString sEventArgs  ;
    ::rtl::OUString sAliasArgs  ;
    ::rtl::OUString sServiceArgs;
    ::rtl::OUString sURL    (::rtl::OUString::createFromAscii(pURL));
    sal_Bool        bOK     = sal_True;

    JobURL aURL(sURL);

    // check if URL is invalid
    if (eExpectedPart==E_UNKNOWN)
        bOK = !aURL.isValid();

    // check if URL has the expected event part
    if (
        (bOK                                 ) &&
        ((eExpectedPart & E_EVENT) == E_EVENT)
       )
    {
        bOK = (
                (aURL.isValid()                          ) &&
                (aURL.getEvent(sEvent)                   ) &&
                (sEvent.getLength()>0                    ) &&
                (sEvent.compareToAscii(pExpectedEvent)==0)
              );

        if (bOK && pExpectedEventArgs!=NULL)
        {
            bOK = (
                    (aURL.getEventArgs(sEventArgs)                   ) &&
                    (sEventArgs.compareToAscii(pExpectedEventArgs)==0)
                  );
        };
    }

    // check if URL has no event part
    if (
        (bOK                                 ) &&
        ((eExpectedPart & E_EVENT) != E_EVENT)
       )
    {
        bOK = (
                (!aURL.getEvent(sEvent)        ) &&
                (sEvent.getLength()==0         ) &&
                (!aURL.getEventArgs(sEventArgs)) &&
                (sEventArgs.getLength()==0     )
              );
    }

    // check if URL has the expected alias part
    if (
        (bOK                                 ) &&
        ((eExpectedPart & E_ALIAS) == E_ALIAS)
       )
    {
        bOK = (
                (aURL.isValid()                          ) &&
                (aURL.getAlias(sAlias)                   ) &&
                (sAlias.getLength()>0                    ) &&
                (sAlias.compareToAscii(pExpectedAlias)==0)
              );

        if (bOK && pExpectedAliasArgs!=NULL)
        {
            bOK = (
                    (aURL.getAliasArgs(sAliasArgs)                   ) &&
                    (sAliasArgs.compareToAscii(pExpectedAliasArgs)==0)
                  );
        };
    }

    // check if URL has the no alias part
    if (
        (bOK                                 ) &&
        ((eExpectedPart & E_ALIAS) != E_ALIAS)
       )
    {
        bOK = (
                (!aURL.getAlias(sAlias)        ) &&
                (sAlias.getLength()==0         ) &&
                (!aURL.getAliasArgs(sAliasArgs)) &&
                (sAliasArgs.getLength()==0     )
              );
    }

    // check if URL has the expected service part
    if (
        (bOK                                     ) &&
        ((eExpectedPart & E_SERVICE) == E_SERVICE)
       )
    {
        bOK = (
                (aURL.isValid()                              ) &&
                (aURL.getService(sService)                   ) &&
                (sService.getLength()>0                      ) &&
                (sService.compareToAscii(pExpectedService)==0)
              );

        if (bOK && pExpectedServiceArgs!=NULL)
        {
            bOK = (
                    (aURL.getServiceArgs(sServiceArgs)                   ) &&
                    (sServiceArgs.compareToAscii(pExpectedServiceArgs)==0)
                  );
        };
    }

    // check if URL has the no service part
    if (
        (bOK                                     ) &&
        ((eExpectedPart & E_SERVICE) != E_SERVICE)
       )
    {
        bOK = (
                (!aURL.getService(sService)        ) &&
                (sService.getLength()==0           ) &&
                (!aURL.getServiceArgs(sServiceArgs)) &&
                (sServiceArgs.getLength()==0       )
              );
    }

    ::rtl::OUStringBuffer sMsg(256);

    sMsg.appendAscii("\"" );
    sMsg.append     (sURL );
    sMsg.appendAscii("\" ");

    if (bOK)
    {
        sMsg.appendAscii("... OK\n");
    }
    else
    {
        sMsg.appendAscii("... failed\n");
        sMsg.appendAscii("expected was: ");
        if (eExpectedPart==E_UNKNOWN)
            sMsg.appendAscii("E_UNKNOWN");
        if ((eExpectedPart & E_EVENT) == E_EVENT)
        {
            sMsg.appendAscii("| E_EVENT e=\"");
            sMsg.appendAscii(pExpectedEvent  );
            sMsg.appendAscii("\""            );
        }
        if ((eExpectedPart & E_ALIAS) == E_ALIAS)
        {
            sMsg.appendAscii("| E_ALIAS a=\"");
            sMsg.appendAscii(pExpectedAlias  );
            sMsg.appendAscii("\""            );
        }
        if ((eExpectedPart & E_SERVICE) == E_SERVICE)
        {
            sMsg.appendAscii("| E_SERVICE s=\"");
            sMsg.appendAscii(pExpectedService  );
            sMsg.appendAscii("\""              );
        }
        sMsg.appendAscii("\tbut it was  : "     );
        sMsg.append     (aURL.impldbg_toString());
        sMsg.appendAscii("\n"                   );
    }

    WRITE_LOGFILE(LOGFILE_JOBURL, U2B(sMsg.makeStringAndClear()))
}

//________________________________
/**
    @short      helper debug method
    @descr      It returns a representation of the internal object state
                as string notation.

    @returns    The formated string representation.
*/
::rtl::OUString JobURL::impldbg_toString() const
{
    /* SAFE { */
    ReadGuard aReadLock(m_aLock);

    ::rtl::OUStringBuffer sBuffer(256);

    if (m_eRequest==E_UNKNOWN)
        sBuffer.appendAscii("E_UNKNOWN");
    if ((m_eRequest & E_EVENT) == E_EVENT)
        sBuffer.appendAscii("| E_EVENT");
    if ((m_eRequest & E_ALIAS) == E_ALIAS)
        sBuffer.appendAscii("| E_ALIAS");
    if ((m_eRequest & E_SERVICE) == E_SERVICE)
        sBuffer.appendAscii("| E_SERVICE");
    sBuffer.appendAscii("{ e=\""   );
    sBuffer.append     (m_sEvent   );
    sBuffer.appendAscii("\" - a=\"");
    sBuffer.append     (m_sAlias   );
    sBuffer.appendAscii("\" - s=\"");
    sBuffer.append     (m_sService );
    sBuffer.appendAscii("\" }"     );

    aReadLock.unlock();
    /* } SAFE */

    return sBuffer.makeStringAndClear();
}

//________________________________

sal_Bool JobURL::getServiceArgs( /*OUT*/ ::rtl::OUString& sServiceArgs ) const
{
    /* SAFE { */
    ReadGuard aReadLock(m_aLock);

             sServiceArgs = ::rtl::OUString();
    sal_Bool bSet         = ((m_eRequest & E_SERVICE) == E_SERVICE);
    if (bSet)
        sServiceArgs = m_sServiceArgs;

    aReadLock.unlock();
    /* } SAFE */

    return bSet;
}

//________________________________

sal_Bool JobURL::getEventArgs( /*OUT*/ ::rtl::OUString& sEventArgs ) const
{
    /* SAFE { */
    ReadGuard aReadLock(m_aLock);

             sEventArgs = ::rtl::OUString();
    sal_Bool bSet       = ((m_eRequest & E_EVENT) == E_EVENT);
    if (bSet)
        sEventArgs = m_sEventArgs;

    aReadLock.unlock();
    /* } SAFE */

    return bSet;
}

//________________________________

sal_Bool JobURL::getAliasArgs( /*OUT*/ ::rtl::OUString& sAliasArgs ) const
{
    /* SAFE { */
    ReadGuard aReadLock(m_aLock);

             sAliasArgs = ::rtl::OUString();
    sal_Bool bSet       = ((m_eRequest & E_ALIAS) == E_ALIAS);
    if (bSet)
        sAliasArgs = m_sAliasArgs;

    aReadLock.unlock();
    /* } SAFE */

    return bSet;
}

#endif // ENABLE_COMPONENT_SELF_CHECK

} // namespace framework