1. mst
  2. ooo340

Commits

Joachim Lingner  committed a0673b6

jl155 #i111592# fixing unopkg sync

  • Participants
  • Parent commits 1835b80
  • Branches default

Comments (0)

Files changed (5)

File desktop/source/deployment/manager/dp_extensionmanager.cxx

View file
 //Attention: The argument xCmdEnv MUST NOT aqcuire the solar mutex when its
 //Interaction handler functions are called. It must save the calls and can show
 //GUI after the synchronize call has finished.
-void ExtensionManager::synchronizeBundledPrereg(
-    Reference<task::XAbortChannel> const & xAbortChannel,
-    Reference<ucb::XCommandEnvironment> const & xCmdEnv )
+void ExtensionManager::synchronizeBundledPrereg()
     throw (deploy::DeploymentException,
            uno::RuntimeException)
 {
+    OUString sCurrentExtension;
     try
     {
-        String sSynchronizingBundled(StrSyncRepository::get());
-        sSynchronizingBundled.SearchAndReplaceAllAscii( "%NAME", OUSTR("bundled"));
-        dp_misc::ProgressLevel progressBundled(xCmdEnv, sSynchronizingBundled);
-
-        Reference<deploy::XPackageManagerFactory> xPackageManagerFactory(
-            deploy::thePackageManagerFactory::get(m_xContext));
-
-        Reference<deploy::XPackageManager> xMgr =
-            xPackageManagerFactory->getPackageManager(OUSTR("bundled_prereg"));
+        ::osl::MutexGuard guard(getMutex());
+        const Reference<deploy::XPackageManager> xMgr =
+            m_xPackageManagerFactory->getPackageManager(OUSTR("bundled_prereg"));
 
         uno::Sequence<Reference<deploy::XPackage> > addedBundledExtensions;
         uno::Sequence<deploy::ExtensionBaseInfo> removedBundledExtensions;
 
+        //XPackageManager::synchronize already revokes removed extensions
         xMgr->synchronize(addedBundledExtensions, removedBundledExtensions);
-        progressBundled.update(OUSTR("\n\n"));
 
-        uno::Sequence<Reference<deploy::XPackage> > extensions = xMgr->getDeployedPackages(
-            xAbortChannel, xCmdEnv);
-        try
+        for (sal_Int32 i = 0; i < addedBundledExtensions.getLength(); i++)
         {
-            for (sal_Int32 i = 0; i < extensions.getLength(); i++)
-            {
-                extensions[i]->registerPackage(true, xAbortChannel, xCmdEnv);
-            }
-        }
-        catch (...)
-        {
-            OSL_ASSERT(0);
+            Reference<deploy::XPackage> const & ext = addedBundledExtensions[i];
+            sCurrentExtension = ext->getDisplayName();
+            xMgr->setOperationStatus(ext, 0);
+            ext->registerPackage(true, Reference<task::XAbortChannel>(),
+                                 Reference<ucb::XCommandEnvironment>());
         }
         OUString lastSyncBundled(RTL_CONSTASCII_USTRINGPARAM(
                                      "$BUNDLED_EXTENSIONS_PREREG/lastsynchronized"));
-        writeLastModified(lastSyncBundled, xCmdEnv);
+        writeLastModified(lastSyncBundled, Reference<ucb::XCommandEnvironment>());
 
     } catch (deploy::DeploymentException& ) {
         throw;
-    } catch (ucb::CommandFailedException & ) {
-        throw;
-    } catch (ucb::CommandAbortedException & ) {
-        throw;
-    } catch (lang::IllegalArgumentException &) {
-        throw;
     } catch (uno::RuntimeException &) {
         throw;
     } catch (...) {
         uno::Any exc = ::cppu::getCaughtException();
+        OUString sMsg = sCurrentExtension.getLength() ?
+            OUSTR("Extension Manager: Error while registering extension: \'") +
+            sCurrentExtension + OUSTR("\'."):
+            OUSTR("Extension Manager: exception in synchronizeBundledPrereg.");
         throw deploy::DeploymentException(
-            OUSTR("Extension Manager: exception in synchronize"),
-            static_cast<OWeakObject*>(this), exc);
+            sMsg, static_cast<OWeakObject*>(this), exc);
     }
 }
 
     }
 }
 
+
+//If an extension was removed then an extension with the same identifier in
+//another repository can become active, or there is no active extension at all.
+//Extension which depend on it must be examined if they work with the new
+//active extension. If not they are made inoperative.
+//
 //We assume that the extension manager mutex is locked!
-//The function sets  the operation status for active and disabled extensions
 void ExtensionManager::processRemovedExtensions(
     Reference<deploy::XPackageManager> const & /*xMgr*/,
     uno::Sequence<deploy::ExtensionBaseInfo> const & removedExtensions,

File desktop/source/deployment/manager/dp_extensionmanager.hxx

View file
                css::lang::IllegalArgumentException,
                css::uno::RuntimeException);
 
-    virtual void SAL_CALL synchronizeBundledPrereg(
-        css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
-        css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
+    virtual void SAL_CALL synchronizeBundledPrereg()
         throw (css::deployment::DeploymentException,
                css::uno::RuntimeException);
 

File desktop/source/deployment/manager/dp_manager.cxx

View file
                 
                 // The folder was not found in the data base, so it must be
                 // an added extension
-                OUString url(m_activePackages_expanded + OUSTR("/") + titleEncoded);
+//                OUString url(m_activePackages_expanded + OUSTR("/") + titleEncoded);
+                OUString url(m_activePackages + OUSTR("/") + titleEncoded);
                 OUString sExtFolder;
                 if (bShared) //that is, shared
                 {
                     url = makeURLAppendSysPathSegment(m_activePackages_expanded, title);
                     url = makeURLAppendSysPathSegment(url, sExtFolder);
                 }
+                //For use with XExtensionManager::synchronizeBundledPrereg the
+                //url must not be absolut, that is, do not use m_activePackages_expanded to
+                //construct the url
                 Reference<deployment::XPackage> xPackage = m_xRegistry->bindPackage(
                     url, OUString(), false, OUString(), Reference<ucb::XCommandEnvironment>());
                 if (xPackage.is())
         {
             OSL_ASSERT(0);
         }
-
-        out_addedExtensions = ::comphelper::containerToSequence(vecAddedExtensions);
     }
+    out_addedExtensions = ::comphelper::containerToSequence(vecAddedExtensions);
     return bModified;
 }
 
 }
 
 
-// sal_Int32 PackageManagerImpl::checkPrerequisitesAndEnable(
-//     css::uno::Reference<css::deployment::XPackage> const & extension,
-//     css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
-//     css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
-//     throw (css::deployment::DeploymentException,
-//            css::ucb::CommandFailedException,
-//            css::ucb::CommandAbortedException,
-//            css::lang::IllegalArgumentException,
-//            css::uno::RuntimeException)
-// {
-//     try
-//     {
-//         if (!extension.is() || !m_context.equals(extension->getRepositoryName()))
-//             throw lang::IllegalArgumentException(
-//                 OUSTR("PackageManagerImpl::checkPrerequisites: extension is not"
-//                       " from this repository."), 0, 0);
-    
-//         ActivePackages::Data dbData;
-//         OUString id = dp_misc::getIdentifier(extension);
-//         ::osl::MutexGuard guard(getMutex());            
-//         if (m_activePackagesDB->get( &dbData, id, OUString()))
-//         {
-//             //If the license was already displayed, then do not show it again
-//             Reference<ucb::XCommandEnvironment> _xCmdEnv = xCmdEnv;
-//             sal_Int32 status = dbData.operationStatus.toInt32();
-//             if ( !(status & deployment::OperationStatus::LICENSE))
-//                 _xCmdEnv = new NoLicenseCommandEnv(xCmdEnv->getInteractionHandler());
-            
-//             sal_Int32 failedStatus = extension->checkPrerequisites(
-//                 xAbortChannel, _xCmdEnv, false);
-//             dbData.operationStatus = OUString::valueOf(failedStatus);
-//             insertToActivationLayerDB(id, dbData);        
-//         }
-//         else
-//         {
-//             throw lang::IllegalArgumentException(
-//                 OUSTR("PackageManagerImpl::checkPrerequisites: unknown extension"),
-//                 0, 0);
-
-//         }
-//         return 0;
-//     }
-//     catch (deployment::DeploymentException& ) {
-//         throw;
-//     } catch (ucb::CommandFailedException & ) {
-//         throw;
-//     } catch (ucb::CommandAbortedException & ) {
-//         throw;
-//     } catch (lang::IllegalArgumentException &) {
-//         throw;
-//     } catch (uno::RuntimeException &) {
-//         throw;
-//     } catch (...) {
-//         uno::Any excOccurred = ::cppu::getCaughtException();
-//         deployment::DeploymentException exc(
-//             OUSTR("PackageManagerImpl::checkPrerequisites: exception "),
-//             static_cast<OWeakObject*>(this), excOccurred);
-//         throw exc;
-//     }
-// }
-
 sal_Int32 PackageManagerImpl::getOperationStatusWithId(
     OUString const & identifier)
     throw (deployment::DeploymentException,

File desktop/source/pkgchk/unopkg/unopkg_app.cxx

View file
         {
             if (! dp_misc::office_is_running())
             {
-                xExtensionManager->synchronizeBundledPrereg(
-                    Reference<task::XAbortChannel>(), xCmdEnv);
+                xExtensionManager->synchronizeBundledPrereg();
             }
             else
             {

File offapi/com/sun/star/deployment/XExtensionManager.idl

View file
        first startup.
     */
 
-    void synchronizeBundledPrereg(
-        [in] com::sun::star::task::XAbortChannel xAbortChannel,
-        [in] com::sun::star::ucb::XCommandEnvironment xCmdEnv )
+    void synchronizeBundledPrereg()
         raises (DeploymentException);