Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <jobs/joburl.hxx>
30 : : #include <threadhelp/readguard.hxx>
31 : : #include <threadhelp/writeguard.hxx>
32 : : #include <general.h>
33 : :
34 : : #include <rtl/ustrbuf.hxx>
35 : : #include <vcl/svapp.hxx>
36 : :
37 : : namespace framework{
38 : :
39 : : /**
40 : : @short special ctor
41 : : @descr It initialize this new instance with a (hopyfully) valid job URL.
42 : : This URL will be parsed. After that we set our members right,
43 : : so other interface methods of this class can be used to get
44 : : all items of this URL. Of course it will be possible to know,
45 : : if this URL was valid too.
46 : :
47 : : @param sURL
48 : : the job URL for parsing
49 : : */
50 : 0 : JobURL::JobURL( /*IN*/ const ::rtl::OUString& sURL )
51 : 0 : : ThreadHelpBase( &Application::GetSolarMutex() )
52 : : {
53 : : #ifdef ENABLE_COMPONENT_SELF_CHECK
54 : : JobURL::impldbg_checkIt();
55 : : #endif
56 : :
57 : 0 : m_eRequest = E_UNKNOWN;
58 : :
59 : : // syntax: vnd.sun.star.job:{[event=<name>],[alias=<name>],[service=<name>]}
60 : :
61 : : // check for "vnd.sun.star.job:"
62 [ # # ]: 0 : if (sURL.matchIgnoreAsciiCaseAsciiL(JOBURL_PROTOCOL_STR,JOBURL_PROTOCOL_LEN,0))
63 : : {
64 : 0 : sal_Int32 t = JOBURL_PROTOCOL_LEN;
65 [ # # ]: 0 : do
66 : : {
67 : : // seperate all token of "{[event=<name>],[alias=<name>],[service=<name>]}"
68 : 0 : ::rtl::OUString sToken = sURL.getToken(0, JOBURL_PART_SEPERATOR, t);
69 : 0 : ::rtl::OUString sPartValue ;
70 : 0 : ::rtl::OUString sPartArguments;
71 : :
72 : : // check for "event="
73 [ # # ]: 0 : if (
[ # # # # ]
74 : 0 : (JobURL::implst_split(sToken,JOBURL_EVENT_STR,JOBURL_EVENT_LEN,sPartValue,sPartArguments)) &&
75 : 0 : (!sPartValue.isEmpty())
76 : : )
77 : : {
78 : : // set the part value
79 : 0 : m_sEvent = sPartValue ;
80 : 0 : m_sEventArgs = sPartArguments;
81 : 0 : m_eRequest |= E_EVENT ;
82 : : }
83 : : else
84 : : // check for "alias="
85 [ # # ]: 0 : if (
[ # # # # ]
86 : 0 : (JobURL::implst_split(sToken,JOBURL_ALIAS_STR,JOBURL_ALIAS_LEN,sPartValue,sPartArguments)) &&
87 : 0 : (!sPartValue.isEmpty())
88 : : )
89 : : {
90 : : // set the part value
91 : 0 : m_sAlias = sPartValue ;
92 : 0 : m_sAliasArgs = sPartArguments;
93 : 0 : m_eRequest |= E_ALIAS ;
94 : : }
95 : : else
96 : : // check for "service="
97 [ # # ]: 0 : if (
[ # # # # ]
98 : 0 : (JobURL::implst_split(sToken,JOBURL_SERVICE_STR,JOBURL_SERVICE_LEN,sPartValue,sPartArguments)) &&
99 : 0 : (!sPartValue.isEmpty())
100 : : )
101 : : {
102 : : // set the part value
103 : 0 : m_sService = sPartValue ;
104 : 0 : m_sServiceArgs = sPartArguments;
105 : 0 : m_eRequest |= E_SERVICE ;
106 : 0 : }
107 : : }
108 : : while(t!=-1);
109 : : }
110 : 0 : }
111 : :
112 : : //________________________________
113 : : /**
114 : : @short knows, if this job URL object hold a valid URL inside
115 : :
116 : : @return <TRUE/> if it represent a valid job URL.
117 : : */
118 : 0 : sal_Bool JobURL::isValid() const
119 : : {
120 : : /* SAFE { */
121 [ # # ]: 0 : ReadGuard aReadLock(m_aLock);
122 [ # # ]: 0 : return (m_eRequest!=E_UNKNOWN);
123 : : }
124 : :
125 : : //________________________________
126 : : /**
127 : : @short get the event item of this job URL
128 : : @descr Because the three possible parts of such URL (event, alias, service)
129 : : can't be combined, this method can(!) return a valid value - but it's
130 : : not a must. Thats why the return value must be used too, to detect a missing
131 : : event value.
132 : :
133 : : @param sEvent
134 : : returns the possible existing event value
135 : : e.g. "vnd.sun.star.job:event=myEvent" returns "myEvent"
136 : :
137 : : @return <TRUE/> if an event part of the job URL exist and the out parameter
138 : : sEvent was filled.
139 : :
140 : : @attention The out parameter will be reseted everytime. Don't use it if method returns <FALSE/>!
141 : : */
142 : 0 : sal_Bool JobURL::getEvent( /*OUT*/ ::rtl::OUString& sEvent ) const
143 : : {
144 : : /* SAFE { */
145 [ # # ]: 0 : ReadGuard aReadLock(m_aLock);
146 : :
147 : 0 : sEvent = ::rtl::OUString();
148 : 0 : sal_Bool bSet = ((m_eRequest & E_EVENT) == E_EVENT);
149 [ # # ]: 0 : if (bSet)
150 : 0 : sEvent = m_sEvent;
151 : :
152 [ # # ]: 0 : aReadLock.unlock();
153 : : /* } SAFE */
154 : :
155 [ # # ]: 0 : return bSet;
156 : : }
157 : :
158 : : //________________________________
159 : : /**
160 : : @short get the alias item of this job URL
161 : : @descr Because the three possible parts of such URL (event, alias, service)
162 : : can't be combined, this method can(!) return a valid value - but it's
163 : : not a must. Thats why the return value must be used too, to detect a missing
164 : : alias value.
165 : :
166 : : @param sAlias
167 : : returns the possible existing alias value
168 : : e.g. "vnd.sun.star.job:alias=myAlias" returns "myAlias"
169 : :
170 : : @return <TRUE/> if an alias part of the job URL exist and the out parameter
171 : : sAlias was filled.
172 : :
173 : : @attention The out parameter will be reseted everytime. Don't use it if method returns <FALSE/>!
174 : : */
175 : 0 : sal_Bool JobURL::getAlias( /*OUT*/ ::rtl::OUString& sAlias ) const
176 : : {
177 : : /* SAFE { */
178 [ # # ]: 0 : ReadGuard aReadLock(m_aLock);
179 : :
180 : 0 : sAlias = ::rtl::OUString();
181 : 0 : sal_Bool bSet = ((m_eRequest & E_ALIAS) == E_ALIAS);
182 [ # # ]: 0 : if (bSet)
183 : 0 : sAlias = m_sAlias;
184 : :
185 [ # # ]: 0 : aReadLock.unlock();
186 : : /* } SAFE */
187 : :
188 [ # # ]: 0 : return bSet;
189 : : }
190 : :
191 : : //________________________________
192 : : /**
193 : : @short get the service item of this job URL
194 : : @descr Because the three possible parts of such URL (event, service, service)
195 : : can't be combined, this method can(!) return a valid value - but it's
196 : : not a must. Thats why the return value must be used too, to detect a missing
197 : : service value.
198 : :
199 : : @param sAlias
200 : : returns the possible existing service value
201 : : e.g. "vnd.sun.star.job:service=com.sun.star.Service" returns "com.sun.star.Service"
202 : :
203 : : @return <TRUE/> if an service part of the job URL exist and the out parameter
204 : : sService was filled.
205 : :
206 : : @attention The out parameter will be reseted everytime. Don't use it if method returns <FALSE/>!
207 : : */
208 : 0 : sal_Bool JobURL::getService( /*OUT*/ ::rtl::OUString& sService ) const
209 : : {
210 : : /* SAFE { */
211 [ # # ]: 0 : ReadGuard aReadLock(m_aLock);
212 : :
213 : 0 : sService = ::rtl::OUString();
214 : 0 : sal_Bool bSet = ((m_eRequest & E_SERVICE) == E_SERVICE);
215 [ # # ]: 0 : if (bSet)
216 : 0 : sService = m_sService;
217 : :
218 [ # # ]: 0 : aReadLock.unlock();
219 : : /* } SAFE */
220 : :
221 [ # # ]: 0 : return bSet;
222 : : }
223 : :
224 : : //________________________________
225 : : /**
226 : : @short searches for a special identifier in the given string and split it
227 : : @descr If the given identifier could be found at the beginning of the given string,
228 : : this method split it into different parts and return it.
229 : : Following schema is used: <partidentifier>=<partvalue>[?<partarguments>]
230 : :
231 : : @param sPart
232 : : the string, which should be analyzed
233 : :
234 : : @param pPartIdentifier
235 : : the part identifier value, which must be found at the beginning of the
236 : : parameter <var>sPart</var>
237 : :
238 : : @param nPartLength
239 : : the length of the ascii value <var>pPartIdentifier</var>
240 : :
241 : : @param rPartValue
242 : : returns the part value if <var>sPart</var> was splitted successfully
243 : :
244 : : @param rPartArguments
245 : : returns the part arguments if <var>sPart</var> was splitted successfully
246 : :
247 : : @return <TRUE/> if the identifier could be found and the string was splitted.
248 : : <FALSE/> otherwhise.
249 : : */
250 : 0 : sal_Bool JobURL::implst_split( /*IN*/ const ::rtl::OUString& sPart ,
251 : : /*IN*/ const sal_Char* pPartIdentifier ,
252 : : /*IN*/ sal_Int32 nPartLength ,
253 : : /*OUT*/ ::rtl::OUString& rPartValue ,
254 : : /*OUT*/ ::rtl::OUString& rPartArguments )
255 : : {
256 : : // first search for the given identifier
257 : 0 : sal_Bool bPartFound = (sPart.matchIgnoreAsciiCaseAsciiL(pPartIdentifier,nPartLength,0));
258 : :
259 : : // If it exist - we can split the part and return sal_True.
260 : : // Otherwhise we do nothing and return sal_False.
261 [ # # ]: 0 : if (bPartFound)
262 : : {
263 : : // But may the part has optional arguments - seperated by a "?".
264 : : // Do so - we set the return value with the whole part string.
265 : : // Arguments will be set to an empty string as default.
266 : : // If we detect the right sign - we split the arguments and overwrite the default.
267 : 0 : ::rtl::OUString sValueAndArguments = sPart.copy(nPartLength);
268 : 0 : ::rtl::OUString sValue = sValueAndArguments ;
269 : 0 : ::rtl::OUString sArguments;
270 : :
271 : 0 : sal_Int32 nArgStart = sValueAndArguments.indexOf('?',0);
272 [ # # ]: 0 : if (nArgStart!=-1)
273 : : {
274 : 0 : sValue = sValueAndArguments.copy(0,nArgStart);
275 : 0 : ++nArgStart; // ignore '?'!
276 : 0 : sArguments = sValueAndArguments.copy(nArgStart);
277 : : }
278 : :
279 : 0 : rPartValue = sValue ;
280 : 0 : rPartArguments = sArguments;
281 : : }
282 : :
283 : 0 : return bPartFound;
284 : : }
285 : :
286 : : //________________________________
287 : : /**
288 : : @short special debug method
289 : : @descr It's the entry point method to start a self component check for this class.
290 : : It's used for internal purposes only and never a part of a legal product.
291 : : Use it for testing and debug only!
292 : : */
293 : : #ifdef ENABLE_COMPONENT_SELF_CHECK
294 : :
295 : : #define LOGFILE_JOBURL "joburl.log"
296 : :
297 : : void JobURL::impldbg_checkIt()
298 : : {
299 : : // check simple URL's
300 : : JobURL::impldbg_checkURL("vnd.sun.star.job:event=onMyEvent" , E_EVENT , "onMyEvent", "" , "" , NULL, NULL, NULL);
301 : : JobURL::impldbg_checkURL("vnd.sun.star.job:alias=myAlias" , E_ALIAS , "" , "myAlias", "" , NULL, NULL, NULL);
302 : : JobURL::impldbg_checkURL("vnd.sun.star.job:service=css.Service", E_SERVICE, "" , "" , "css.Service", NULL, NULL, NULL);
303 : : JobURL::impldbg_checkURL("vnd.sun.star.job:service=;" , E_UNKNOWN, "" , "" , "" , NULL, NULL, NULL);
304 : :
305 : : // check combinations
306 : : // Note: No additional spaces or tabs are allowed after a seperator occurred.
307 : : // Tab and spaces before a seperator will be used as value!
308 : : 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);
309 : : JobURL::impldbg_checkURL("vnd.sun.star.job:service=css.Service;alias=myAlias" , E_ALIAS | E_SERVICE , "" , "myAlias", "css.Service" , NULL, NULL, NULL);
310 : : JobURL::impldbg_checkURL("vnd.sun.star.job:service=css.Service ;alias=myAlias" , E_ALIAS | E_SERVICE , "" , "myAlias", "css.Service ", NULL, NULL, NULL);
311 : : JobURL::impldbg_checkURL("vnd.sun.star.job:service=css.Service; alias=myAlias" , E_UNKNOWN , "" , "" , "" , NULL, NULL, NULL);
312 : : JobURL::impldbg_checkURL("vnd.sun.star.job : event=onMyEvent" , E_UNKNOWN , "" , "" , "" , NULL, NULL, NULL);
313 : : JobURL::impldbg_checkURL("vnd.sun.star.job:event=onMyEvent;event=onMyEvent;service=css.Service", E_UNKNOWN , "" , "" , "" , NULL, NULL, NULL);
314 : :
315 : : // check upper/lower case
316 : : // fix parts of the URL are case insensitive (e.g. "vnd.SUN.star.job:eVEnt=")
317 : : // values are case sensitive (e.g. "myAlias" )
318 : : 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);
319 : : 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);
320 : :
321 : : // check stupid URLs
322 : : JobURL::impldbg_checkURL("vnd.sun.star.jobs:service=css.Service" , E_UNKNOWN, "", "", "", NULL, NULL, NULL);
323 : : JobURL::impldbg_checkURL("vnd.sun.star.job service=css.Service" , E_UNKNOWN, "", "", "", NULL, NULL, NULL);
324 : : JobURL::impldbg_checkURL("vnd.sun.star.job:service;css.Service" , E_UNKNOWN, "", "", "", NULL, NULL, NULL);
325 : : JobURL::impldbg_checkURL("vnd.sun.star.job:service;" , E_UNKNOWN, "", "", "", NULL, NULL, NULL);
326 : : JobURL::impldbg_checkURL("vnd.sun.star.job:;alias;service;event=" , E_UNKNOWN, "", "", "", NULL, NULL, NULL);
327 : : JobURL::impldbg_checkURL("vnd.sun.star.job:alias=a;service=s;event=", E_UNKNOWN, "", "", "", NULL, NULL, NULL);
328 : :
329 : : // check argument handling
330 : : JobURL::impldbg_checkURL("vnd.sun.star.job:event=onMyEvent?eventArg1,eventArg2=3,eventArg4," , E_EVENT , "onMyEvent", "" , "" , "eventArg1,eventArg2=3,eventArg4,", NULL , NULL );
331 : : JobURL::impldbg_checkURL("vnd.sun.star.job:alias=myAlias?aliasArg1,aliasarg2" , E_EVENT , "" , "myAlias", "" , NULL , "aliasArg1,aliasarg2", NULL );
332 : : JobURL::impldbg_checkURL("vnd.sun.star.job:service=css.myService?serviceArg1" , E_EVENT , "" , "" , "css.myService", NULL , NULL , "serviceArg1" );
333 : : 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" );
334 : : }
335 : :
336 : : //________________________________
337 : : /**
338 : : @short helper debug method
339 : : @descr It uses the given parameter to create a new instance of a JobURL.
340 : : They results will be compared with the exepected ones.
341 : : The a log will be written, which contains some detailed informations
342 : : for this sub test.
343 : :
344 : : @param pURL
345 : : the job URL, which should be checked
346 : :
347 : : @param eExpectedPart
348 : : the expected result
349 : :
350 : : @param pExpectedEvent
351 : : the expected event value
352 : :
353 : : @param pExpectedAlias
354 : : the expected alias value
355 : :
356 : : @param pExpectedService
357 : : the expected service value
358 : :
359 : : @param pExpectedEventArgs
360 : : the expected event arguments
361 : :
362 : : @param pExpectedAliasArgs
363 : : the expected alias arguments
364 : :
365 : : @param pExpectedServiceArgs
366 : : the expected service arguments
367 : : */
368 : : void JobURL::impldbg_checkURL( /*IN*/ const sal_Char* pURL ,
369 : : /*IN*/ sal_uInt32 eExpectedPart ,
370 : : /*IN*/ const sal_Char* pExpectedEvent ,
371 : : /*IN*/ const sal_Char* pExpectedAlias ,
372 : : /*IN*/ const sal_Char* pExpectedService ,
373 : : /*IN*/ const sal_Char* pExpectedEventArgs ,
374 : : /*IN*/ const sal_Char* pExpectedAliasArgs ,
375 : : /*IN*/ const sal_Char* pExpectedServiceArgs )
376 : : {
377 : : ::rtl::OUString sEvent ;
378 : : ::rtl::OUString sAlias ;
379 : : ::rtl::OUString sService ;
380 : : ::rtl::OUString sEventArgs ;
381 : : ::rtl::OUString sAliasArgs ;
382 : : ::rtl::OUString sServiceArgs;
383 : : ::rtl::OUString sURL (::rtl::OUString::createFromAscii(pURL));
384 : : sal_Bool bOK = sal_True;
385 : :
386 : : JobURL aURL(sURL);
387 : :
388 : : // check if URL is invalid
389 : : if (eExpectedPart==E_UNKNOWN)
390 : : bOK = !aURL.isValid();
391 : :
392 : : // check if URL has the expected event part
393 : : if (
394 : : (bOK ) &&
395 : : ((eExpectedPart & E_EVENT) == E_EVENT)
396 : : )
397 : : {
398 : : bOK = (
399 : : (aURL.isValid() ) &&
400 : : (aURL.getEvent(sEvent) ) &&
401 : : (!sEvent.isEmpty() ) &&
402 : : (sEvent.compareToAscii(pExpectedEvent)==0)
403 : : );
404 : :
405 : : if (bOK && pExpectedEventArgs!=NULL)
406 : : {
407 : : bOK = (
408 : : (aURL.getEventArgs(sEventArgs) ) &&
409 : : (sEventArgs.compareToAscii(pExpectedEventArgs)==0)
410 : : );
411 : : };
412 : : }
413 : :
414 : : // check if URL has no event part
415 : : if (
416 : : (bOK ) &&
417 : : ((eExpectedPart & E_EVENT) != E_EVENT)
418 : : )
419 : : {
420 : : bOK = (
421 : : (!aURL.getEvent(sEvent) ) &&
422 : : (sEvent.isEmpty() ) &&
423 : : (!aURL.getEventArgs(sEventArgs)) &&
424 : : (sEventArgs.isEmpty() )
425 : : );
426 : : }
427 : :
428 : : // check if URL has the expected alias part
429 : : if (
430 : : (bOK ) &&
431 : : ((eExpectedPart & E_ALIAS) == E_ALIAS)
432 : : )
433 : : {
434 : : bOK = (
435 : : (aURL.isValid() ) &&
436 : : (aURL.getAlias(sAlias) ) &&
437 : : (!sAlias.isEmpty() ) &&
438 : : (sAlias.compareToAscii(pExpectedAlias)==0)
439 : : );
440 : :
441 : : if (bOK && pExpectedAliasArgs!=NULL)
442 : : {
443 : : bOK = (
444 : : (aURL.getAliasArgs(sAliasArgs) ) &&
445 : : (sAliasArgs.compareToAscii(pExpectedAliasArgs)==0)
446 : : );
447 : : };
448 : : }
449 : :
450 : : // check if URL has the no alias part
451 : : if (
452 : : (bOK ) &&
453 : : ((eExpectedPart & E_ALIAS) != E_ALIAS)
454 : : )
455 : : {
456 : : bOK = (
457 : : (!aURL.getAlias(sAlias) ) &&
458 : : (sAlias.isEmpty() ) &&
459 : : (!aURL.getAliasArgs(sAliasArgs)) &&
460 : : (sAliasArgs.isEmpty() )
461 : : );
462 : : }
463 : :
464 : : // check if URL has the expected service part
465 : : if (
466 : : (bOK ) &&
467 : : ((eExpectedPart & E_SERVICE) == E_SERVICE)
468 : : )
469 : : {
470 : : bOK = (
471 : : (aURL.isValid() ) &&
472 : : (aURL.getService(sService) ) &&
473 : : (!sService.isEmpty() ) &&
474 : : (sService.compareToAscii(pExpectedService)==0)
475 : : );
476 : :
477 : : if (bOK && pExpectedServiceArgs!=NULL)
478 : : {
479 : : bOK = (
480 : : (aURL.getServiceArgs(sServiceArgs) ) &&
481 : : (sServiceArgs.compareToAscii(pExpectedServiceArgs)==0)
482 : : );
483 : : };
484 : : }
485 : :
486 : : // check if URL has the no service part
487 : : if (
488 : : (bOK ) &&
489 : : ((eExpectedPart & E_SERVICE) != E_SERVICE)
490 : : )
491 : : {
492 : : bOK = (
493 : : (!aURL.getService(sService) ) &&
494 : : (sService.isEmpty() ) &&
495 : : (!aURL.getServiceArgs(sServiceArgs)) &&
496 : : (sServiceArgs.isEmpty() )
497 : : );
498 : : }
499 : :
500 : : ::rtl::OUStringBuffer sMsg(256);
501 : :
502 : : sMsg.appendAscii("\"" );
503 : : sMsg.append (sURL );
504 : : sMsg.appendAscii("\" ");
505 : :
506 : : if (bOK)
507 : : {
508 : : sMsg.appendAscii("... OK\n");
509 : : }
510 : : else
511 : : {
512 : : sMsg.appendAscii("... failed\n");
513 : : sMsg.appendAscii("expected was: ");
514 : : if (eExpectedPart==E_UNKNOWN)
515 : : sMsg.appendAscii("E_UNKNOWN");
516 : : if ((eExpectedPart & E_EVENT) == E_EVENT)
517 : : {
518 : : sMsg.appendAscii("| E_EVENT e=\"");
519 : : sMsg.appendAscii(pExpectedEvent );
520 : : sMsg.appendAscii("\"" );
521 : : }
522 : : if ((eExpectedPart & E_ALIAS) == E_ALIAS)
523 : : {
524 : : sMsg.appendAscii("| E_ALIAS a=\"");
525 : : sMsg.appendAscii(pExpectedAlias );
526 : : sMsg.appendAscii("\"" );
527 : : }
528 : : if ((eExpectedPart & E_SERVICE) == E_SERVICE)
529 : : {
530 : : sMsg.appendAscii("| E_SERVICE s=\"");
531 : : sMsg.appendAscii(pExpectedService );
532 : : sMsg.appendAscii("\"" );
533 : : }
534 : : sMsg.appendAscii("\tbut it was : " );
535 : : sMsg.append (aURL.impldbg_toString());
536 : : sMsg.appendAscii("\n" );
537 : : }
538 : :
539 : : WRITE_LOGFILE(LOGFILE_JOBURL, U2B(sMsg.makeStringAndClear()))
540 : : }
541 : :
542 : : //________________________________
543 : : /**
544 : : @short helper debug method
545 : : @descr It returns a representation of the internal object state
546 : : as string notation.
547 : :
548 : : @returns The formated string representation.
549 : : */
550 : : ::rtl::OUString JobURL::impldbg_toString() const
551 : : {
552 : : /* SAFE { */
553 : : ReadGuard aReadLock(m_aLock);
554 : :
555 : : ::rtl::OUStringBuffer sBuffer(256);
556 : :
557 : : if (m_eRequest==E_UNKNOWN)
558 : : sBuffer.appendAscii("E_UNKNOWN");
559 : : if ((m_eRequest & E_EVENT) == E_EVENT)
560 : : sBuffer.appendAscii("| E_EVENT");
561 : : if ((m_eRequest & E_ALIAS) == E_ALIAS)
562 : : sBuffer.appendAscii("| E_ALIAS");
563 : : if ((m_eRequest & E_SERVICE) == E_SERVICE)
564 : : sBuffer.appendAscii("| E_SERVICE");
565 : : sBuffer.appendAscii("{ e=\"" );
566 : : sBuffer.append (m_sEvent );
567 : : sBuffer.appendAscii("\" - a=\"");
568 : : sBuffer.append (m_sAlias );
569 : : sBuffer.appendAscii("\" - s=\"");
570 : : sBuffer.append (m_sService );
571 : : sBuffer.appendAscii("\" }" );
572 : :
573 : : aReadLock.unlock();
574 : : /* } SAFE */
575 : :
576 : : return sBuffer.makeStringAndClear();
577 : : }
578 : :
579 : : //________________________________
580 : :
581 : : sal_Bool JobURL::getServiceArgs( /*OUT*/ ::rtl::OUString& sServiceArgs ) const
582 : : {
583 : : /* SAFE { */
584 : : ReadGuard aReadLock(m_aLock);
585 : :
586 : : sServiceArgs = ::rtl::OUString();
587 : : sal_Bool bSet = ((m_eRequest & E_SERVICE) == E_SERVICE);
588 : : if (bSet)
589 : : sServiceArgs = m_sServiceArgs;
590 : :
591 : : aReadLock.unlock();
592 : : /* } SAFE */
593 : :
594 : : return bSet;
595 : : }
596 : :
597 : : //________________________________
598 : :
599 : : sal_Bool JobURL::getEventArgs( /*OUT*/ ::rtl::OUString& sEventArgs ) const
600 : : {
601 : : /* SAFE { */
602 : : ReadGuard aReadLock(m_aLock);
603 : :
604 : : sEventArgs = ::rtl::OUString();
605 : : sal_Bool bSet = ((m_eRequest & E_EVENT) == E_EVENT);
606 : : if (bSet)
607 : : sEventArgs = m_sEventArgs;
608 : :
609 : : aReadLock.unlock();
610 : : /* } SAFE */
611 : :
612 : : return bSet;
613 : : }
614 : :
615 : : //________________________________
616 : :
617 : : sal_Bool JobURL::getAliasArgs( /*OUT*/ ::rtl::OUString& sAliasArgs ) const
618 : : {
619 : : /* SAFE { */
620 : : ReadGuard aReadLock(m_aLock);
621 : :
622 : : sAliasArgs = ::rtl::OUString();
623 : : sal_Bool bSet = ((m_eRequest & E_ALIAS) == E_ALIAS);
624 : : if (bSet)
625 : : sAliasArgs = m_sAliasArgs;
626 : :
627 : : aReadLock.unlock();
628 : : /* } SAFE */
629 : :
630 : : return bSet;
631 : : }
632 : :
633 : : #endif // ENABLE_COMPONENT_SELF_CHECK
634 : :
635 : : } // namespace framework
636 : :
637 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|