1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_framework.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir //________________________________ 32*cdf0e10cSrcweir // my own includes 33*cdf0e10cSrcweir #include <jobs/jobexecutor.hxx> 34*cdf0e10cSrcweir #include <jobs/job.hxx> 35*cdf0e10cSrcweir #include <jobs/joburl.hxx> 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir #ifndef __FRAMEWORK_CLASS_CONVERTER_HXX_ 38*cdf0e10cSrcweir #include <classes/converter.hxx> 39*cdf0e10cSrcweir #endif 40*cdf0e10cSrcweir #include <threadhelp/transactionguard.hxx> 41*cdf0e10cSrcweir #include <threadhelp/readguard.hxx> 42*cdf0e10cSrcweir #include <threadhelp/writeguard.hxx> 43*cdf0e10cSrcweir #include <general.h> 44*cdf0e10cSrcweir #include <services.h> 45*cdf0e10cSrcweir 46*cdf0e10cSrcweir //________________________________ 47*cdf0e10cSrcweir // interface includes 48*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 49*cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp> 50*cdf0e10cSrcweir #include <com/sun/star/container/XContainer.hpp> 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir //________________________________ 53*cdf0e10cSrcweir // includes of other projects 54*cdf0e10cSrcweir #include <unotools/configpathes.hxx> 55*cdf0e10cSrcweir #include <rtl/ustrbuf.hxx> 56*cdf0e10cSrcweir #include <vcl/svapp.hxx> 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir #include <rtl/logfile.hxx> 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir //________________________________ 61*cdf0e10cSrcweir // namespace 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir namespace framework{ 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir //________________________________ 66*cdf0e10cSrcweir // non exported const 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir //________________________________ 69*cdf0e10cSrcweir // non exported definitions 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir //________________________________ 72*cdf0e10cSrcweir // declarations 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir DEFINE_XINTERFACE_6( JobExecutor , 75*cdf0e10cSrcweir OWeakObject , 76*cdf0e10cSrcweir DIRECT_INTERFACE(css::lang::XTypeProvider ), 77*cdf0e10cSrcweir DIRECT_INTERFACE(css::lang::XServiceInfo ), 78*cdf0e10cSrcweir DIRECT_INTERFACE(css::task::XJobExecutor ), 79*cdf0e10cSrcweir DIRECT_INTERFACE(css::container::XContainerListener ), 80*cdf0e10cSrcweir DIRECT_INTERFACE(css::document::XEventListener ), 81*cdf0e10cSrcweir DERIVED_INTERFACE(css::lang::XEventListener,css::document::XEventListener) 82*cdf0e10cSrcweir ) 83*cdf0e10cSrcweir 84*cdf0e10cSrcweir DEFINE_XTYPEPROVIDER_6( JobExecutor , 85*cdf0e10cSrcweir css::lang::XTypeProvider , 86*cdf0e10cSrcweir css::lang::XServiceInfo , 87*cdf0e10cSrcweir css::task::XJobExecutor , 88*cdf0e10cSrcweir css::container::XContainerListener, 89*cdf0e10cSrcweir css::document::XEventListener , 90*cdf0e10cSrcweir css::lang::XEventListener 91*cdf0e10cSrcweir ) 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir DEFINE_XSERVICEINFO_ONEINSTANCESERVICE( JobExecutor , 94*cdf0e10cSrcweir ::cppu::OWeakObject , 95*cdf0e10cSrcweir SERVICENAME_JOBEXECUTOR , 96*cdf0e10cSrcweir IMPLEMENTATIONNAME_JOBEXECUTOR 97*cdf0e10cSrcweir ) 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir DEFINE_INIT_SERVICE( JobExecutor, 100*cdf0e10cSrcweir { 101*cdf0e10cSrcweir m_xModuleManager = css::uno::Reference< css::frame::XModuleManager >( 102*cdf0e10cSrcweir m_xSMGR->createInstance( 103*cdf0e10cSrcweir SERVICENAME_MODULEMANAGER ), 104*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW ); 105*cdf0e10cSrcweir 106*cdf0e10cSrcweir /*Attention 107*cdf0e10cSrcweir I think we don't need any mutex or lock here ... because we are called by our own static method impl_createInstance() 108*cdf0e10cSrcweir to create a new instance of this class by our own supported service factory. 109*cdf0e10cSrcweir see macro DEFINE_XSERVICEINFO_MULTISERVICE and "impl_initService()" for further informations! 110*cdf0e10cSrcweir */ 111*cdf0e10cSrcweir // read the list of all currently registered events inside configuration. 112*cdf0e10cSrcweir // e.g. "/org.openoffice.Office.Jobs/Events/<event name>" 113*cdf0e10cSrcweir // We need it later to check if an incoming event request can be executed successfully 114*cdf0e10cSrcweir // or must be rejected. It's an optimization! Of course we must implement updating of this 115*cdf0e10cSrcweir // list too ... Be listener at the configuration. 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir m_aConfig.open(ConfigAccess::E_READONLY); 118*cdf0e10cSrcweir if (m_aConfig.getMode() == ConfigAccess::E_READONLY) 119*cdf0e10cSrcweir { 120*cdf0e10cSrcweir css::uno::Reference< css::container::XNameAccess > xRegistry(m_aConfig.cfg(), css::uno::UNO_QUERY); 121*cdf0e10cSrcweir if (xRegistry.is()) 122*cdf0e10cSrcweir m_lEvents = Converter::convert_seqOUString2OUStringList(xRegistry->getElementNames()); 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir css::uno::Reference< css::container::XContainer > xNotifier(m_aConfig.cfg(), css::uno::UNO_QUERY); 125*cdf0e10cSrcweir if (xNotifier.is()) 126*cdf0e10cSrcweir { 127*cdf0e10cSrcweir css::uno::Reference< css::container::XContainerListener > xThis(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY); 128*cdf0e10cSrcweir xNotifier->addContainerListener(xThis); 129*cdf0e10cSrcweir } 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir // don't close cfg here! 132*cdf0e10cSrcweir // It will be done inside disposing ... 133*cdf0e10cSrcweir } 134*cdf0e10cSrcweir } 135*cdf0e10cSrcweir ) 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir //________________________________ 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir /** 140*cdf0e10cSrcweir @short standard ctor 141*cdf0e10cSrcweir @descr It initialize this new instance. 142*cdf0e10cSrcweir 143*cdf0e10cSrcweir @param xSMGR 144*cdf0e10cSrcweir reference to the uno service manager 145*cdf0e10cSrcweir */ 146*cdf0e10cSrcweir JobExecutor::JobExecutor( /*IN*/ const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ) 147*cdf0e10cSrcweir : ThreadHelpBase (&Application::GetSolarMutex() ) 148*cdf0e10cSrcweir , ::cppu::OWeakObject ( ) 149*cdf0e10cSrcweir , m_xSMGR (xSMGR ) 150*cdf0e10cSrcweir , m_xModuleManager ( ) 151*cdf0e10cSrcweir , m_aConfig (xSMGR, ::rtl::OUString::createFromAscii(JobData::EVENTCFG_ROOT) ) 152*cdf0e10cSrcweir { 153*cdf0e10cSrcweir // Don't do any reference related code here! Do it inside special 154*cdf0e10cSrcweir // impl_ method() ... see DEFINE_INIT_SERVICE() macro for further informations. 155*cdf0e10cSrcweir } 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir JobExecutor::~JobExecutor() 158*cdf0e10cSrcweir { 159*cdf0e10cSrcweir LOG_ASSERT(m_aConfig.getMode() == ConfigAccess::E_CLOSED, "JobExecutor::~JobExecutor()\nConfiguration don't send dispoing() message!\n") 160*cdf0e10cSrcweir } 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir //________________________________ 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir /** 165*cdf0e10cSrcweir @short implementation of XJobExecutor interface 166*cdf0e10cSrcweir @descr We use the given event to locate any registered job inside our configuration 167*cdf0e10cSrcweir and execute it. Further we control the lifetime of it and supress 168*cdf0e10cSrcweir shutdown of the office till all jobs was finished. 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir @param sEvent 171*cdf0e10cSrcweir is used to locate registered jobs 172*cdf0e10cSrcweir */ 173*cdf0e10cSrcweir void SAL_CALL JobExecutor::trigger( const ::rtl::OUString& sEvent ) throw(css::uno::RuntimeException) 174*cdf0e10cSrcweir { 175*cdf0e10cSrcweir RTL_LOGFILE_CONTEXT(aLog, "fwk (as96863) JobExecutor::trigger()"); 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir /* SAFE { */ 178*cdf0e10cSrcweir ReadGuard aReadLock(m_aLock); 179*cdf0e10cSrcweir 180*cdf0e10cSrcweir // Optimization! 181*cdf0e10cSrcweir // Check if the given event name exist inside configuration and reject wrong requests. 182*cdf0e10cSrcweir // This optimization supress using of the cfg api for getting event and job descriptions ... 183*cdf0e10cSrcweir if (m_lEvents.find(sEvent) == m_lEvents.end()) 184*cdf0e10cSrcweir return; 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir // get list of all enabled jobs 187*cdf0e10cSrcweir // The called static helper methods read it from the configuration and 188*cdf0e10cSrcweir // filter disabled jobs using it's time stamp values. 189*cdf0e10cSrcweir css::uno::Sequence< ::rtl::OUString > lJobs = JobData::getEnabledJobsForEvent(m_xSMGR, sEvent); 190*cdf0e10cSrcweir 191*cdf0e10cSrcweir aReadLock.unlock(); 192*cdf0e10cSrcweir /* } SAFE */ 193*cdf0e10cSrcweir 194*cdf0e10cSrcweir // step over all enabled jobs and execute it 195*cdf0e10cSrcweir sal_Int32 c = lJobs.getLength(); 196*cdf0e10cSrcweir for (sal_Int32 j=0; j<c; ++j) 197*cdf0e10cSrcweir { 198*cdf0e10cSrcweir /* SAFE { */ 199*cdf0e10cSrcweir aReadLock.lock(); 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir JobData aCfg(m_xSMGR); 202*cdf0e10cSrcweir aCfg.setEvent(sEvent, lJobs[j]); 203*cdf0e10cSrcweir aCfg.setEnvironment(JobData::E_EXECUTION); 204*cdf0e10cSrcweir 205*cdf0e10cSrcweir /*Attention! 206*cdf0e10cSrcweir Jobs implements interfaces and dies by ref count! 207*cdf0e10cSrcweir And freeing of such uno object is done by uno itself. 208*cdf0e10cSrcweir So we have to use dynamic memory everytimes. 209*cdf0e10cSrcweir */ 210*cdf0e10cSrcweir Job* pJob = new Job(m_xSMGR, css::uno::Reference< css::frame::XFrame >()); 211*cdf0e10cSrcweir css::uno::Reference< css::uno::XInterface > xJob(static_cast< ::cppu::OWeakObject* >(pJob), css::uno::UNO_QUERY); 212*cdf0e10cSrcweir pJob->setJobData(aCfg); 213*cdf0e10cSrcweir 214*cdf0e10cSrcweir aReadLock.unlock(); 215*cdf0e10cSrcweir /* } SAFE */ 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir pJob->execute(css::uno::Sequence< css::beans::NamedValue >()); 218*cdf0e10cSrcweir } 219*cdf0e10cSrcweir } 220*cdf0e10cSrcweir 221*cdf0e10cSrcweir //________________________________ 222*cdf0e10cSrcweir 223*cdf0e10cSrcweir void SAL_CALL JobExecutor::notifyEvent( const css::document::EventObject& aEvent ) throw(css::uno::RuntimeException) 224*cdf0e10cSrcweir { 225*cdf0e10cSrcweir static ::rtl::OUString EVENT_ON_NEW = DECLARE_ASCII("OnNew" ); // Doc UI event 226*cdf0e10cSrcweir static ::rtl::OUString EVENT_ON_LOAD = DECLARE_ASCII("OnLoad" ); // Doc UI event 227*cdf0e10cSrcweir static ::rtl::OUString EVENT_ON_CREATE = DECLARE_ASCII("OnCreate" ); // Doc API event 228*cdf0e10cSrcweir static ::rtl::OUString EVENT_ON_LOAD_FINISHED = DECLARE_ASCII("OnLoadFinished" ); // Doc API event 229*cdf0e10cSrcweir static ::rtl::OUString EVENT_ON_DOCUMENT_OPENED = DECLARE_ASCII("onDocumentOpened" ); // Job UI event : OnNew or OnLoad 230*cdf0e10cSrcweir static ::rtl::OUString EVENT_ON_DOCUMENT_ADDED = DECLARE_ASCII("onDocumentAdded" ); // Job API event : OnCreate or OnLoadFinished 231*cdf0e10cSrcweir 232*cdf0e10cSrcweir /* SAFE { */ 233*cdf0e10cSrcweir ReadGuard aReadLock(m_aLock); 234*cdf0e10cSrcweir 235*cdf0e10cSrcweir ::comphelper::SequenceAsVector< JobData::TJob2DocEventBinding > lJobs; 236*cdf0e10cSrcweir 237*cdf0e10cSrcweir // Optimization! 238*cdf0e10cSrcweir // Check if the given event name exist inside configuration and reject wrong requests. 239*cdf0e10cSrcweir // This optimization supress using of the cfg api for getting event and job descriptions. 240*cdf0e10cSrcweir // see using of m_lEvents.find() below ... 241*cdf0e10cSrcweir 242*cdf0e10cSrcweir // retrieve event context from event source 243*cdf0e10cSrcweir rtl::OUString aModuleIdentifier; 244*cdf0e10cSrcweir try 245*cdf0e10cSrcweir { 246*cdf0e10cSrcweir aModuleIdentifier = m_xModuleManager->identify( aEvent.Source ); 247*cdf0e10cSrcweir } 248*cdf0e10cSrcweir catch( css::uno::Exception& ) 249*cdf0e10cSrcweir {} 250*cdf0e10cSrcweir 251*cdf0e10cSrcweir // Special feature: If the events "OnNew" or "OnLoad" occures - we generate our own event "onDocumentOpened". 252*cdf0e10cSrcweir if ( 253*cdf0e10cSrcweir (aEvent.EventName.equals(EVENT_ON_NEW )) || 254*cdf0e10cSrcweir (aEvent.EventName.equals(EVENT_ON_LOAD)) 255*cdf0e10cSrcweir ) 256*cdf0e10cSrcweir { 257*cdf0e10cSrcweir if (m_lEvents.find(EVENT_ON_DOCUMENT_OPENED) != m_lEvents.end()) 258*cdf0e10cSrcweir JobData::appendEnabledJobsForEvent(m_xSMGR, EVENT_ON_DOCUMENT_OPENED, lJobs); 259*cdf0e10cSrcweir } 260*cdf0e10cSrcweir 261*cdf0e10cSrcweir // Special feature: If the events "OnCreate" or "OnLoadFinished" occures - we generate our own event "onDocumentAdded". 262*cdf0e10cSrcweir if ( 263*cdf0e10cSrcweir (aEvent.EventName.equals(EVENT_ON_CREATE )) || 264*cdf0e10cSrcweir (aEvent.EventName.equals(EVENT_ON_LOAD_FINISHED)) 265*cdf0e10cSrcweir ) 266*cdf0e10cSrcweir { 267*cdf0e10cSrcweir if (m_lEvents.find(EVENT_ON_DOCUMENT_ADDED) != m_lEvents.end()) 268*cdf0e10cSrcweir JobData::appendEnabledJobsForEvent(m_xSMGR, EVENT_ON_DOCUMENT_ADDED, lJobs); 269*cdf0e10cSrcweir } 270*cdf0e10cSrcweir 271*cdf0e10cSrcweir // Add all jobs for "real" notified event too .-) 272*cdf0e10cSrcweir if (m_lEvents.find(aEvent.EventName) != m_lEvents.end()) 273*cdf0e10cSrcweir JobData::appendEnabledJobsForEvent(m_xSMGR, aEvent.EventName, lJobs); 274*cdf0e10cSrcweir 275*cdf0e10cSrcweir aReadLock.unlock(); 276*cdf0e10cSrcweir /* } SAFE */ 277*cdf0e10cSrcweir 278*cdf0e10cSrcweir // step over all enabled jobs and execute it 279*cdf0e10cSrcweir ::comphelper::SequenceAsVector< JobData::TJob2DocEventBinding >::const_iterator pIt; 280*cdf0e10cSrcweir for ( pIt = lJobs.begin(); 281*cdf0e10cSrcweir pIt != lJobs.end() ; 282*cdf0e10cSrcweir ++pIt ) 283*cdf0e10cSrcweir { 284*cdf0e10cSrcweir /* SAFE { */ 285*cdf0e10cSrcweir aReadLock.lock(); 286*cdf0e10cSrcweir 287*cdf0e10cSrcweir const JobData::TJob2DocEventBinding& rBinding = *pIt; 288*cdf0e10cSrcweir 289*cdf0e10cSrcweir JobData aCfg(m_xSMGR); 290*cdf0e10cSrcweir aCfg.setEvent(rBinding.m_sDocEvent, rBinding.m_sJobName); 291*cdf0e10cSrcweir aCfg.setEnvironment(JobData::E_DOCUMENTEVENT); 292*cdf0e10cSrcweir 293*cdf0e10cSrcweir if (!aCfg.hasCorrectContext(aModuleIdentifier)) 294*cdf0e10cSrcweir continue; 295*cdf0e10cSrcweir 296*cdf0e10cSrcweir /*Attention! 297*cdf0e10cSrcweir Jobs implements interfaces and dies by ref count! 298*cdf0e10cSrcweir And freeing of such uno object is done by uno itself. 299*cdf0e10cSrcweir So we have to use dynamic memory everytimes. 300*cdf0e10cSrcweir */ 301*cdf0e10cSrcweir css::uno::Reference< css::frame::XModel > xModel(aEvent.Source, css::uno::UNO_QUERY); 302*cdf0e10cSrcweir Job* pJob = new Job(m_xSMGR, xModel); 303*cdf0e10cSrcweir css::uno::Reference< css::uno::XInterface > xJob(static_cast< ::cppu::OWeakObject* >(pJob), css::uno::UNO_QUERY); 304*cdf0e10cSrcweir pJob->setJobData(aCfg); 305*cdf0e10cSrcweir 306*cdf0e10cSrcweir aReadLock.unlock(); 307*cdf0e10cSrcweir /* } SAFE */ 308*cdf0e10cSrcweir 309*cdf0e10cSrcweir pJob->execute(css::uno::Sequence< css::beans::NamedValue >()); 310*cdf0e10cSrcweir } 311*cdf0e10cSrcweir } 312*cdf0e10cSrcweir 313*cdf0e10cSrcweir //________________________________ 314*cdf0e10cSrcweir 315*cdf0e10cSrcweir void SAL_CALL JobExecutor::elementInserted( const css::container::ContainerEvent& aEvent ) throw(css::uno::RuntimeException) 316*cdf0e10cSrcweir { 317*cdf0e10cSrcweir ::rtl::OUString sValue; 318*cdf0e10cSrcweir if (aEvent.Accessor >>= sValue) 319*cdf0e10cSrcweir { 320*cdf0e10cSrcweir ::rtl::OUString sEvent = ::utl::extractFirstFromConfigurationPath(sValue); 321*cdf0e10cSrcweir if (sEvent.getLength() > 0) 322*cdf0e10cSrcweir { 323*cdf0e10cSrcweir OUStringList::iterator pEvent = m_lEvents.find(sEvent); 324*cdf0e10cSrcweir if (pEvent == m_lEvents.end()) 325*cdf0e10cSrcweir m_lEvents.push_back(sEvent); 326*cdf0e10cSrcweir } 327*cdf0e10cSrcweir } 328*cdf0e10cSrcweir } 329*cdf0e10cSrcweir 330*cdf0e10cSrcweir void SAL_CALL JobExecutor::elementRemoved ( const css::container::ContainerEvent& aEvent ) throw(css::uno::RuntimeException) 331*cdf0e10cSrcweir { 332*cdf0e10cSrcweir ::rtl::OUString sValue; 333*cdf0e10cSrcweir if (aEvent.Accessor >>= sValue) 334*cdf0e10cSrcweir { 335*cdf0e10cSrcweir ::rtl::OUString sEvent = ::utl::extractFirstFromConfigurationPath(sValue); 336*cdf0e10cSrcweir if (sEvent.getLength() > 0) 337*cdf0e10cSrcweir { 338*cdf0e10cSrcweir OUStringList::iterator pEvent = m_lEvents.find(sEvent); 339*cdf0e10cSrcweir if (pEvent != m_lEvents.end()) 340*cdf0e10cSrcweir m_lEvents.erase(pEvent); 341*cdf0e10cSrcweir } 342*cdf0e10cSrcweir } 343*cdf0e10cSrcweir } 344*cdf0e10cSrcweir 345*cdf0e10cSrcweir void SAL_CALL JobExecutor::elementReplaced( const css::container::ContainerEvent& ) throw(css::uno::RuntimeException) 346*cdf0e10cSrcweir { 347*cdf0e10cSrcweir // I'm not interested on changed items :-) 348*cdf0e10cSrcweir } 349*cdf0e10cSrcweir 350*cdf0e10cSrcweir //________________________________ 351*cdf0e10cSrcweir 352*cdf0e10cSrcweir /** @short the used cfg changes notifier wish to be released in its reference. 353*cdf0e10cSrcweir 354*cdf0e10cSrcweir @descr We close our internal used configuration instance to 355*cdf0e10cSrcweir free this reference. 356*cdf0e10cSrcweir 357*cdf0e10cSrcweir @attention For the special feature "bind global document event broadcaster to job execution" 358*cdf0e10cSrcweir this job executor instance was registered from outside code as 359*cdf0e10cSrcweir css.document.XEventListener. So it can be, that this disposing call comes from 360*cdf0e10cSrcweir the global event broadcaster service. But we don't hold any reference to this service 361*cdf0e10cSrcweir which can or must be released. Because this broadcaster itself is an one instance service 362*cdf0e10cSrcweir too, we can ignore this request. On the other side we must relase our internal CFG 363*cdf0e10cSrcweir reference ... SOLUTION => check the given event source and react only, if it's our internal 364*cdf0e10cSrcweir hold configuration object! 365*cdf0e10cSrcweir */ 366*cdf0e10cSrcweir void SAL_CALL JobExecutor::disposing( const css::lang::EventObject& aEvent ) throw(css::uno::RuntimeException) 367*cdf0e10cSrcweir { 368*cdf0e10cSrcweir /* SAFE { */ 369*cdf0e10cSrcweir ReadGuard aReadLock(m_aLock); 370*cdf0e10cSrcweir css::uno::Reference< css::uno::XInterface > xCFG(m_aConfig.cfg(), css::uno::UNO_QUERY); 371*cdf0e10cSrcweir if ( 372*cdf0e10cSrcweir (xCFG == aEvent.Source ) && 373*cdf0e10cSrcweir (m_aConfig.getMode() != ConfigAccess::E_CLOSED) 374*cdf0e10cSrcweir ) 375*cdf0e10cSrcweir { 376*cdf0e10cSrcweir m_aConfig.close(); 377*cdf0e10cSrcweir } 378*cdf0e10cSrcweir aReadLock.unlock(); 379*cdf0e10cSrcweir /* } SAFE */ 380*cdf0e10cSrcweir } 381*cdf0e10cSrcweir 382*cdf0e10cSrcweir } // namespace framework 383