update credits
[LibreOffice.git] / desktop / source / deployment / registry / dp_backend.cxx
blob8c6cdfaf867e420f8dce047cde38306a363d0874
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "sal/config.h"
22 #include <cassert>
24 #include "dp_backend.h"
25 #include "dp_ucb.h"
26 #include "rtl/ustring.hxx"
27 #include "rtl/uri.hxx"
28 #include "rtl/bootstrap.hxx"
29 #include "osl/file.hxx"
30 #include "cppuhelper/exc_hlp.hxx"
31 #include "comphelper/servicedecl.hxx"
32 #include "comphelper/unwrapargs.hxx"
33 #include "ucbhelper/content.hxx"
34 #include "com/sun/star/lang/WrappedTargetRuntimeException.hpp"
35 #include "com/sun/star/deployment/InvalidRemovedParameterException.hpp"
36 #include "com/sun/star/deployment/thePackageManagerFactory.hpp"
37 #include "com/sun/star/ucb/InteractiveAugmentedIOException.hpp"
38 #include "com/sun/star/ucb/IOErrorCode.hpp"
39 #include "com/sun/star/beans/StringPair.hpp"
40 #include "com/sun/star/sdbc/XResultSet.hpp"
41 #include "com/sun/star/sdbc/XRow.hpp"
42 #include "unotools/tempfile.hxx"
45 using namespace ::dp_misc;
46 using namespace ::com::sun::star;
47 using namespace ::com::sun::star::uno;
48 using namespace ::com::sun::star::ucb;
50 namespace dp_registry {
51 namespace backend {
53 //______________________________________________________________________________
54 PackageRegistryBackend::~PackageRegistryBackend()
58 //______________________________________________________________________________
59 void PackageRegistryBackend::disposing( lang::EventObject const & event )
60 throw (RuntimeException)
62 Reference<deployment::XPackage> xPackage(
63 event.Source, UNO_QUERY_THROW );
64 OUString url( xPackage->getURL() );
65 ::osl::MutexGuard guard( getMutex() );
66 if ( m_bound.erase( url ) != 1 )
68 SAL_WARN("desktop.deployment", "erase(" << url << ") != 1");
72 //______________________________________________________________________________
73 PackageRegistryBackend::PackageRegistryBackend(
74 Sequence<Any> const & args,
75 Reference<XComponentContext> const & xContext )
76 : t_BackendBase( getMutex() ),
77 m_xComponentContext( xContext ),
78 m_eContext( CONTEXT_UNKNOWN ),
79 m_readOnly( false )
81 assert(xContext.is());
82 boost::optional<OUString> cachePath;
83 boost::optional<bool> readOnly;
84 comphelper::unwrapArgs( args, m_context, cachePath, readOnly );
85 if (cachePath)
86 m_cachePath = *cachePath;
87 if (readOnly)
88 m_readOnly = *readOnly;
90 if ( m_context == "user" )
91 m_eContext = CONTEXT_USER;
92 else if ( m_context == "shared" )
93 m_eContext = CONTEXT_SHARED;
94 else if ( m_context == "bundled" )
95 m_eContext = CONTEXT_BUNDLED;
96 else if ( m_context == "tmp" )
97 m_eContext = CONTEXT_TMP;
98 else if (m_context.matchIgnoreAsciiCase("vnd.sun.star.tdoc:/"))
99 m_eContext = CONTEXT_DOCUMENT;
100 else
101 m_eContext = CONTEXT_UNKNOWN;
104 //______________________________________________________________________________
105 void PackageRegistryBackend::check()
107 ::osl::MutexGuard guard( getMutex() );
108 if (rBHelper.bInDispose || rBHelper.bDisposed) {
109 throw lang::DisposedException(
110 "PackageRegistryBackend instance has already been disposed!",
111 static_cast<OWeakObject *>(this) );
115 //______________________________________________________________________________
116 void PackageRegistryBackend::disposing()
118 try {
119 for ( t_string2ref::const_iterator i = m_bound.begin(); i != m_bound.end(); ++i)
120 i->second->removeEventListener(this);
121 m_bound.clear();
122 m_xComponentContext.clear();
123 WeakComponentImplHelperBase::disposing();
125 catch (const RuntimeException &) {
126 throw;
128 catch (const Exception &) {
129 Any exc( ::cppu::getCaughtException() );
130 throw lang::WrappedTargetRuntimeException(
131 "caught unexpected exception while disposing!",
132 static_cast<OWeakObject *>(this), exc );
136 // XPackageRegistry
137 //______________________________________________________________________________
138 Reference<deployment::XPackage> PackageRegistryBackend::bindPackage(
139 OUString const & url, OUString const & mediaType, sal_Bool bRemoved,
140 OUString const & identifier, Reference<XCommandEnvironment> const & xCmdEnv )
141 throw (deployment::DeploymentException,
142 deployment::InvalidRemovedParameterException,
143 ucb::CommandFailedException,
144 lang::IllegalArgumentException, RuntimeException)
146 ::osl::ResettableMutexGuard guard( getMutex() );
147 check();
149 t_string2ref::const_iterator const iFind( m_bound.find( url ) );
150 if (iFind != m_bound.end())
152 Reference<deployment::XPackage> xPackage( iFind->second );
153 if (xPackage.is())
155 if (!mediaType.isEmpty() &&
156 mediaType != xPackage->getPackageType()->getMediaType())
157 throw lang::IllegalArgumentException
158 ("XPackageRegistry::bindPackage: media type does not match",
159 static_cast<OWeakObject*>(this), 1);
160 if (xPackage->isRemoved() != bRemoved)
161 throw deployment::InvalidRemovedParameterException(
162 "XPackageRegistry::bindPackage: bRemoved parameter does not match",
163 static_cast<OWeakObject*>(this), xPackage->isRemoved(), xPackage);
164 return xPackage;
168 guard.clear();
170 Reference<deployment::XPackage> xNewPackage;
171 try {
172 xNewPackage = bindPackage_( url, mediaType, bRemoved,
173 identifier, xCmdEnv );
175 catch (const RuntimeException &) {
176 throw;
178 catch (const CommandFailedException &) {
179 throw;
181 catch (const deployment::DeploymentException &) {
182 throw;
184 catch (const Exception &) {
185 Any exc( ::cppu::getCaughtException() );
186 throw deployment::DeploymentException(
187 "Error binding package: " + url,
188 static_cast<OWeakObject *>(this), exc );
191 guard.reset();
193 ::std::pair< t_string2ref::iterator, bool > insertion(
194 m_bound.insert( t_string2ref::value_type( url, xNewPackage ) ) );
195 if (insertion.second)
196 { // first insertion
197 SAL_WARN_IF(
198 Reference<XInterface>(insertion.first->second) != xNewPackage,
199 "desktop.deployment", "mismatch");
201 else
202 { // found existing entry
203 Reference<deployment::XPackage> xPackage( insertion.first->second );
204 if (xPackage.is())
205 return xPackage;
206 insertion.first->second = xNewPackage;
209 guard.clear();
210 xNewPackage->addEventListener( this ); // listen for disposing events
211 return xNewPackage;
214 OUString PackageRegistryBackend::createFolder(
215 OUString const & relUrl,
216 Reference<ucb::XCommandEnvironment> const & xCmdEnv)
218 const OUString sDataFolder = makeURL(getCachePath(), relUrl);
219 //make sure the folder exist
220 ucbhelper::Content dataContent;
221 ::dp_misc::create_folder(&dataContent, sDataFolder, xCmdEnv);
223 const String baseDir(sDataFolder);
224 const ::utl::TempFile aTemp(&baseDir, sal_True);
225 const OUString url = aTemp.GetURL();
226 return sDataFolder + url.copy(url.lastIndexOf('/'));
229 //folderURL can have the extension .tmp or .tmp_
230 //Before OOo 3.4 the created a tmp file with osl_createTempFile and
231 //then created a Folder with a same name and a trailing '_'
232 //If the folderURL has no '_' then there is no corresponding tmp file.
233 void PackageRegistryBackend::deleteTempFolder(
234 OUString const & folderUrl)
236 if (!folderUrl.isEmpty())
238 erase_path( folderUrl, Reference<XCommandEnvironment>(),
239 false /* no throw: ignore errors */ );
241 if (folderUrl[folderUrl.getLength() - 1] == '_')
243 const OUString tempFile = folderUrl.copy(0, folderUrl.getLength() - 1);
244 erase_path( tempFile, Reference<XCommandEnvironment>(),
245 false /* no throw: ignore errors */ );
250 //usedFolders can contain folder names which have the extension .tmp or .tmp_
251 //Before OOo 3.4 we created a tmp file with osl_createTempFile and
252 //then created a Folder with a same name and a trailing '_'
253 //If the folderURL has no '_' then there is no corresponding tmp file.
254 void PackageRegistryBackend::deleteUnusedFolders(
255 OUString const & relUrl,
256 ::std::list< OUString> const & usedFolders)
260 const OUString sDataFolder = makeURL(getCachePath(), relUrl);
261 ::ucbhelper::Content tempFolder(
262 sDataFolder, Reference<ucb::XCommandEnvironment>(), m_xComponentContext);
264 Reference<sdbc::XResultSet> xResultSet(
265 StrTitle::createCursor( tempFolder, ::ucbhelper::INCLUDE_FOLDERS_ONLY ) );
267 // get all temp directories:
268 ::std::vector<OUString> tempEntries;
270 const char tmp[] = ".tmp";
272 while (xResultSet->next())
274 OUString title(
275 Reference<sdbc::XRow>(
276 xResultSet, UNO_QUERY_THROW )->getString(
277 1 /* Title */ ) );
279 if (title.endsWith(tmp))
280 tempEntries.push_back(
281 makeURLAppendSysPathSegment(sDataFolder, title));
284 for ( ::std::size_t pos = 0; pos < tempEntries.size(); ++pos )
286 if (::std::find( usedFolders.begin(), usedFolders.end(), tempEntries[pos] ) ==
287 usedFolders.end())
289 deleteTempFolder(tempEntries[pos]);
293 catch (const ucb::InteractiveAugmentedIOException& e)
295 //In case the folder containing all the data folder does not
296 //exist yet, we ignore the exception
297 if (e.Code != ucb::IOErrorCode_NOT_EXISTING)
298 throw;
304 //______________________________________________________________________________
305 Package::~Package()
309 //______________________________________________________________________________
310 Package::Package( ::rtl::Reference<PackageRegistryBackend> const & myBackend,
311 OUString const & url,
312 OUString const & rName,
313 OUString const & displayName,
314 Reference<deployment::XPackageTypeInfo> const & xPackageType,
315 bool bRemoved,
316 OUString const & identifier)
317 : t_PackageBase( getMutex() ),
318 m_myBackend( myBackend ),
319 m_url( url ),
320 m_name( rName ),
321 m_displayName( displayName ),
322 m_xPackageType( xPackageType ),
323 m_bRemoved(bRemoved),
324 m_identifier(identifier)
326 if (m_bRemoved)
328 //We use the last segment of the URL
329 SAL_WARN_IF(
330 !m_name.isEmpty(), "desktop.deployment", "non-empty m_name");
331 OUString name = m_url;
332 rtl::Bootstrap::expandMacros(name);
333 sal_Int32 index = name.lastIndexOf('/');
334 if (index != -1 && index < name.getLength())
335 m_name = name.copy(index + 1);
339 //______________________________________________________________________________
340 void Package::disposing()
342 m_myBackend.clear();
343 WeakComponentImplHelperBase::disposing();
346 //______________________________________________________________________________
347 void Package::check() const
349 ::osl::MutexGuard guard( getMutex() );
350 if (rBHelper.bInDispose || rBHelper.bDisposed) {
351 throw lang::DisposedException(
352 "Package instance has already been disposed!",
353 static_cast<OWeakObject *>(const_cast<Package *>(this)));
357 // XComponent
358 //______________________________________________________________________________
359 void Package::dispose() throw (RuntimeException)
361 //Do not call check here. We must not throw an exception here if the object
362 //is being disposed or is already disposed. See com.sun.star.lang.XComponent
363 WeakComponentImplHelperBase::dispose();
366 //______________________________________________________________________________
367 void Package::addEventListener(
368 Reference<lang::XEventListener> const & xListener ) throw (RuntimeException)
370 //Do not call check here. We must not throw an exception here if the object
371 //is being disposed or is already disposed. See com.sun.star.lang.XComponent
372 WeakComponentImplHelperBase::addEventListener( xListener );
375 //______________________________________________________________________________
376 void Package::removeEventListener(
377 Reference<lang::XEventListener> const & xListener ) throw (RuntimeException)
379 //Do not call check here. We must not throw an exception here if the object
380 //is being disposed or is already disposed. See com.sun.star.lang.XComponent
381 WeakComponentImplHelperBase::removeEventListener( xListener );
384 // XModifyBroadcaster
385 //______________________________________________________________________________
386 void Package::addModifyListener(
387 Reference<util::XModifyListener> const & xListener )
388 throw (RuntimeException)
390 check();
391 rBHelper.addListener( ::getCppuType( &xListener ), xListener );
394 //______________________________________________________________________________
395 void Package::removeModifyListener(
396 Reference<util::XModifyListener> const & xListener )
397 throw (RuntimeException)
399 check();
400 rBHelper.removeListener( ::getCppuType( &xListener ), xListener );
403 //______________________________________________________________________________
404 void Package::checkAborted(
405 ::rtl::Reference<AbortChannel> const & abortChannel )
407 if (abortChannel.is() && abortChannel->isAborted()) {
408 throw CommandAbortedException(
409 "abort!", static_cast<OWeakObject *>(this) );
413 // XPackage
414 //______________________________________________________________________________
415 Reference<task::XAbortChannel> Package::createAbortChannel()
416 throw (RuntimeException)
418 check();
419 return new AbortChannel;
422 //______________________________________________________________________________
423 sal_Bool Package::isBundle() throw (RuntimeException)
425 return false; // default
428 //______________________________________________________________________________
429 ::sal_Int32 Package::checkPrerequisites(
430 const css::uno::Reference< css::task::XAbortChannel >&,
431 const css::uno::Reference< css::ucb::XCommandEnvironment >&,
432 sal_Bool)
433 throw (css::deployment::DeploymentException,
434 css::deployment::ExtensionRemovedException,
435 css::ucb::CommandFailedException,
436 css::ucb::CommandAbortedException,
437 css::uno::RuntimeException)
439 if (m_bRemoved)
440 throw deployment::ExtensionRemovedException();
441 return 0;
444 //______________________________________________________________________________
445 ::sal_Bool Package::checkDependencies(
446 const css::uno::Reference< css::ucb::XCommandEnvironment >& )
447 throw (css::deployment::DeploymentException,
448 css::deployment::ExtensionRemovedException,
449 css::ucb::CommandFailedException,
450 css::uno::RuntimeException)
452 if (m_bRemoved)
453 throw deployment::ExtensionRemovedException();
454 return true;
458 //______________________________________________________________________________
459 Sequence< Reference<deployment::XPackage> > Package::getBundle(
460 Reference<task::XAbortChannel> const &,
461 Reference<XCommandEnvironment> const & )
462 throw (deployment::DeploymentException,
463 CommandFailedException, CommandAbortedException,
464 lang::IllegalArgumentException, RuntimeException)
466 return Sequence< Reference<deployment::XPackage> >();
469 //______________________________________________________________________________
470 OUString Package::getName() throw (RuntimeException)
472 return m_name;
475 beans::Optional<OUString> Package::getIdentifier() throw (RuntimeException)
477 if (m_bRemoved)
478 return beans::Optional<OUString>(true, m_identifier);
480 return beans::Optional<OUString>();
483 //______________________________________________________________________________
484 OUString Package::getVersion() throw (
485 deployment::ExtensionRemovedException,
486 RuntimeException)
488 if (m_bRemoved)
489 throw deployment::ExtensionRemovedException();
490 return OUString();
493 //______________________________________________________________________________
494 OUString Package::getURL() throw (RuntimeException)
496 return m_url;
499 //______________________________________________________________________________
500 OUString Package::getDisplayName() throw (
501 deployment::ExtensionRemovedException, RuntimeException)
503 if (m_bRemoved)
504 throw deployment::ExtensionRemovedException();
505 return m_displayName;
508 //______________________________________________________________________________
509 OUString Package::getDescription() throw (
510 deployment::ExtensionRemovedException,RuntimeException)
512 if (m_bRemoved)
513 throw deployment::ExtensionRemovedException();
514 return OUString();
517 //______________________________________________________________________________
518 OUString Package::getLicenseText() throw (
519 deployment::ExtensionRemovedException,RuntimeException)
521 if (m_bRemoved)
522 throw deployment::ExtensionRemovedException();
523 return OUString();
526 //______________________________________________________________________________
527 Sequence<OUString> Package::getUpdateInformationURLs() throw (
528 deployment::ExtensionRemovedException, RuntimeException)
530 if (m_bRemoved)
531 throw deployment::ExtensionRemovedException();
532 return Sequence<OUString>();
535 //______________________________________________________________________________
536 css::beans::StringPair Package::getPublisherInfo() throw (
537 deployment::ExtensionRemovedException, RuntimeException)
539 if (m_bRemoved)
540 throw deployment::ExtensionRemovedException();
541 css::beans::StringPair aEmptyPair;
542 return aEmptyPair;
545 //______________________________________________________________________________
546 uno::Reference< css::graphic::XGraphic > Package::getIcon( sal_Bool /*bHighContrast*/ )
547 throw (deployment::ExtensionRemovedException, RuntimeException )
549 if (m_bRemoved)
550 throw deployment::ExtensionRemovedException();
552 uno::Reference< css::graphic::XGraphic > aEmpty;
553 return aEmpty;
556 //______________________________________________________________________________
557 Reference<deployment::XPackageTypeInfo> Package::getPackageType()
558 throw (RuntimeException)
560 return m_xPackageType;
563 //______________________________________________________________________________
564 void Package::exportTo(
565 OUString const & destFolderURL, OUString const & newTitle,
566 sal_Int32 nameClashAction, Reference<XCommandEnvironment> const & xCmdEnv )
567 throw (deployment::ExtensionRemovedException,
568 CommandFailedException, CommandAbortedException, RuntimeException)
570 if (m_bRemoved)
571 throw deployment::ExtensionRemovedException();
573 ::ucbhelper::Content destFolder( destFolderURL, xCmdEnv, getMyBackend()->getComponentContext() );
574 ::ucbhelper::Content sourceContent( getURL(), xCmdEnv, getMyBackend()->getComponentContext() );
575 if (! destFolder.transferContent(
576 sourceContent, ::ucbhelper::InsertOperation_COPY,
577 newTitle, nameClashAction ))
578 throw RuntimeException( "UCB transferContent() failed!", 0 );
581 //______________________________________________________________________________
582 void Package::fireModified()
584 ::cppu::OInterfaceContainerHelper * container = rBHelper.getContainer(
585 ::getCppuType( static_cast<Reference<
586 util::XModifyListener> const *>(0) ) );
587 if (container != 0) {
588 Sequence< Reference<XInterface> > elements(
589 container->getElements() );
590 lang::EventObject evt( static_cast<OWeakObject *>(this) );
591 for ( sal_Int32 pos = 0; pos < elements.getLength(); ++pos )
593 Reference<util::XModifyListener> xListener(
594 elements[ pos ], UNO_QUERY );
595 if (xListener.is())
596 xListener->modified( evt );
601 // XPackage
602 //______________________________________________________________________________
603 beans::Optional< beans::Ambiguous<sal_Bool> > Package::isRegistered(
604 Reference<task::XAbortChannel> const & xAbortChannel,
605 Reference<XCommandEnvironment> const & xCmdEnv )
606 throw (deployment::DeploymentException,
607 CommandFailedException, CommandAbortedException, RuntimeException)
609 try {
610 ::osl::ResettableMutexGuard guard( getMutex() );
611 return isRegistered_( guard,
612 AbortChannel::get(xAbortChannel),
613 xCmdEnv );
615 catch (const RuntimeException &) {
616 throw;
618 catch (const CommandFailedException &) {
619 throw;
621 catch (const CommandAbortedException &) {
622 throw;
624 catch (const deployment::DeploymentException &) {
625 throw;
627 catch (const Exception &) {
628 Any exc( ::cppu::getCaughtException() );
629 throw deployment::DeploymentException(
630 "unexpected exception occurred!",
631 static_cast<OWeakObject *>(this), exc );
635 //______________________________________________________________________________
636 void Package::processPackage_impl(
637 bool doRegisterPackage,
638 bool startup,
639 Reference<task::XAbortChannel> const & xAbortChannel,
640 Reference<XCommandEnvironment> const & xCmdEnv )
642 check();
643 bool action = false;
645 try {
646 try {
647 ::osl::ResettableMutexGuard guard( getMutex() );
648 beans::Optional< beans::Ambiguous<sal_Bool> > option(
649 isRegistered_( guard, AbortChannel::get(xAbortChannel),
650 xCmdEnv ) );
651 action = (option.IsPresent &&
652 (option.Value.IsAmbiguous ||
653 (doRegisterPackage ? !option.Value.Value
654 : option.Value.Value)));
655 if (action) {
657 OUString displayName = isRemoved() ? getName() : getDisplayName();
658 ProgressLevel progress(
659 xCmdEnv,
660 (doRegisterPackage
661 ? PackageRegistryBackend::StrRegisteringPackage::get()
662 : PackageRegistryBackend::StrRevokingPackage::get())
663 + displayName );
664 processPackage_( guard,
665 doRegisterPackage,
666 startup,
667 AbortChannel::get(xAbortChannel),
668 xCmdEnv );
671 catch (lang::IllegalArgumentException &) {
672 Any e(cppu::getCaughtException());
673 throw deployment::DeploymentException(
674 ((doRegisterPackage
675 ? getResourceString(RID_STR_ERROR_WHILE_REGISTERING)
676 : getResourceString(RID_STR_ERROR_WHILE_REVOKING))
677 + getDisplayName()),
678 static_cast< OWeakObject * >(this), e);
680 catch (const RuntimeException &e) {
681 SAL_WARN(
682 "desktop.deployment",
683 "unexpected RuntimeException \"" << e.Message << '"');
684 throw;
686 catch (const CommandFailedException &) {
687 throw;
689 catch (const CommandAbortedException &) {
690 throw;
692 catch (const deployment::DeploymentException &) {
693 throw;
695 catch (const Exception &) {
696 Any exc( ::cppu::getCaughtException() );
697 throw deployment::DeploymentException(
698 (doRegisterPackage
699 ? getResourceString(RID_STR_ERROR_WHILE_REGISTERING)
700 : getResourceString(RID_STR_ERROR_WHILE_REVOKING))
701 + getDisplayName(), static_cast<OWeakObject *>(this), exc );
704 catch (...) {
705 if (action)
706 fireModified();
707 throw;
709 if (action)
710 fireModified();
713 //______________________________________________________________________________
714 void Package::registerPackage(
715 sal_Bool startup,
716 Reference<task::XAbortChannel> const & xAbortChannel,
717 Reference<XCommandEnvironment> const & xCmdEnv )
718 throw (deployment::DeploymentException,
719 deployment::ExtensionRemovedException,
720 CommandFailedException, CommandAbortedException,
721 lang::IllegalArgumentException, RuntimeException)
723 if (m_bRemoved)
724 throw deployment::ExtensionRemovedException();
725 processPackage_impl( true /* register */, startup, xAbortChannel, xCmdEnv );
728 //______________________________________________________________________________
729 void Package::revokePackage(
730 sal_Bool startup,
731 Reference<task::XAbortChannel> const & xAbortChannel,
732 Reference<XCommandEnvironment> const & xCmdEnv )
733 throw (deployment::DeploymentException,
734 CommandFailedException, CommandAbortedException,
735 lang::IllegalArgumentException, RuntimeException)
737 processPackage_impl( false /* revoke */, startup, xAbortChannel, xCmdEnv );
741 PackageRegistryBackend * Package::getMyBackend() const
743 PackageRegistryBackend * pBackend = m_myBackend.get();
744 if (NULL == pBackend)
746 //May throw a DisposedException
747 check();
748 //We should never get here...
749 throw RuntimeException(
750 "Failed to get the BackendImpl",
751 static_cast<OWeakObject*>(const_cast<Package *>(this)));
753 return pBackend;
755 OUString Package::getRepositoryName()
756 throw (RuntimeException)
758 PackageRegistryBackend * backEnd = getMyBackend();
759 return backEnd->getContext();
762 beans::Optional< OUString > Package::getRegistrationDataURL()
763 throw (deployment::ExtensionRemovedException,
764 css::uno::RuntimeException)
766 if (m_bRemoved)
767 throw deployment::ExtensionRemovedException();
768 return beans::Optional<OUString>();
771 sal_Bool Package::isRemoved()
772 throw (RuntimeException)
774 return m_bRemoved;
778 //______________________________________________________________________________
779 Package::TypeInfo::~TypeInfo()
783 // XPackageTypeInfo
784 //______________________________________________________________________________
785 OUString Package::TypeInfo::getMediaType() throw (RuntimeException)
787 return m_mediaType;
790 //______________________________________________________________________________
791 OUString Package::TypeInfo::getDescription()
792 throw (deployment::ExtensionRemovedException, RuntimeException)
794 return getShortDescription();
797 //______________________________________________________________________________
798 OUString Package::TypeInfo::getShortDescription()
799 throw (deployment::ExtensionRemovedException, RuntimeException)
801 return m_shortDescr;
804 //______________________________________________________________________________
805 OUString Package::TypeInfo::getFileFilter() throw (RuntimeException)
807 return m_fileFilter;
810 //______________________________________________________________________________
811 /**************************
812 * Get Icon
814 * @param highContrast NOTE: disabled the returning of high contrast icons.
815 * This bool is a noop now.
816 * @param smallIcon Return the small version of the icon
818 Any Package::TypeInfo::getIcon( sal_Bool /*highContrast*/, sal_Bool smallIcon )
819 throw (RuntimeException)
821 if (! smallIcon)
822 return Any();
823 const sal_uInt16 nIconId = m_smallIcon;
824 return Any( &nIconId, getCppuType( static_cast<sal_uInt16 const *>(0) ) );
830 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */