LCOV - code coverage report
Current view: top level - libreoffice/framework/source/jobs - joburl.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 70 0.0 %
Date: 2012-12-27 Functions: 0 6 0.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10