1 /*************************************************************************
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * Copyright 2008 by Sun Microsystems, Inc.
6 * OpenOffice.org - a multi-platform office productivity suite
8 * $RCSfile: onlogrotate_job.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
28 ************************************************************************/
30 // MARKER(update_precomp.py): autogen include statement, do not remove
31 #include "precompiled_extensions.hxx"
33 #include "corecontroller.hxx"
34 #include "invite_job.hxx"
35 #include "onlogrotate_job.hxx"
36 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
37 #include <cppuhelper/factory.hxx>
38 #include <osl/mutex.hxx>
39 #include <osl/thread.h>
40 #include <rtl/ustrbuf.hxx>
41 #include <rtl/ustring.hxx>
44 using namespace ::com::sun::star::lang
;
45 using namespace ::com::sun::star::registry
;
46 using namespace ::com::sun::star::uno
;
47 using namespace ::oooimprovement
;
48 using ::rtl::OUString
;
49 using ::rtl::OUStringBuffer
;
54 void writeInfo(const Reference
<XRegistryKey
>& reg_key
,
55 const OUString
& implementation_name
,
56 const OUString
& service_name
)
58 OUStringBuffer
buf(256);
59 buf
.append(implementation_name
);
60 buf
.appendAscii("/UNO/SERVICES/");
61 buf
.append(service_name
);
62 reg_key
->createKey(buf
.makeStringAndClear());
68 void SAL_CALL
component_getImplementationEnvironment(const sal_Char
** env_type_name
, uno_Environment
**)
69 { *env_type_name
= CPPU_CURRENT_LANGUAGE_BINDING_NAME
; }
71 sal_Bool SAL_CALL
component_writeInfo(void*, void* p_reg_key
)
73 if (!p_reg_key
) return sal_False
;
76 Reference
<XRegistryKey
> reg_key(reinterpret_cast<XRegistryKey
*>(p_reg_key
), UNO_QUERY
);
78 CoreController::getImplementationName_static(),
79 CoreController::getSupportedServiceNames_static()[0]);
81 OnLogRotateJob::getImplementationName_static(),
82 OnLogRotateJob::getSupportedServiceNames_static()[0]);
84 InviteJob::getImplementationName_static(),
85 InviteJob::getSupportedServiceNames_static()[0]);
88 catch(const InvalidRegistryException
&)
89 { OSL_ENSURE( sal_False
, "### InvalidRegistryException!" ); }
93 void* SAL_CALL
component_getFactory(const sal_Char
* pImplName
, void* pServiceManager
, void*)
95 if ( !pServiceManager
|| !pImplName
) return 0;
97 Reference
<XSingleServiceFactory
> factory
;
98 Reference
<XMultiServiceFactory
> sm(reinterpret_cast<XMultiServiceFactory
*>(pServiceManager
), UNO_QUERY
);
99 OUString impl_name
= OUString::createFromAscii(pImplName
);
100 Sequence
<OUString
> names(1);
101 names
[0] = impl_name
;
103 if (impl_name
.equals(CoreController::getImplementationName_static()))
104 factory
= ::cppu::createSingleFactory(sm
, impl_name
, CoreController::Create
, names
);
105 if (impl_name
.equals(OnLogRotateJob::getImplementationName_static()))
106 factory
= ::cppu::createSingleFactory(sm
, impl_name
, OnLogRotateJob::Create
, names
);
107 if (impl_name
.equals(InviteJob::getImplementationName_static()))
108 factory
= ::cppu::createSingleFactory(sm
, impl_name
, InviteJob::Create
, names
);
109 if (!factory
.is()) return 0;
111 return factory
.get();