LCOV - code coverage report
Current view: top level - libreoffice/desktop/source/deployment/registry/package - dp_extbackenddb.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 29 0.0 %
Date: 2012-12-27 Functions: 0 7 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             : 
      21             : #include "rtl/bootstrap.hxx"
      22             : #include "cppuhelper/exc_hlp.hxx"
      23             : #include "com/sun/star/uno/XComponentContext.hpp"
      24             : #include "com/sun/star/xml/dom/XDocumentBuilder.hpp"
      25             : #include "com/sun/star/xml/xpath/XXPathAPI.hpp"
      26             : #include "dp_misc.h"
      27             : 
      28             : #include "dp_extbackenddb.hxx"
      29             : 
      30             : 
      31             : using namespace ::com::sun::star::uno;
      32             : using ::rtl::OUString;
      33             : 
      34             : #define EXTENSION_REG_NS "http://openoffice.org/extensionmanager/extension-registry/2010"
      35             : #define NS_PREFIX "ext"
      36             : #define ROOT_ELEMENT_NAME "extension-backend-db"
      37             : #define KEY_ELEMENT_NAME "extension"
      38             : 
      39             : namespace dp_registry {
      40             : namespace backend {
      41             : namespace bundle {
      42             : 
      43           0 : ExtensionBackendDb::ExtensionBackendDb(
      44             :     Reference<XComponentContext> const &  xContext,
      45           0 :     ::rtl::OUString const & url):BackendDb(xContext, url)
      46             : {
      47             : 
      48           0 : }
      49             : 
      50           0 : OUString ExtensionBackendDb::getDbNSName()
      51             : {
      52           0 :     return OUSTR(EXTENSION_REG_NS);
      53             : }
      54             : 
      55           0 : OUString ExtensionBackendDb::getNSPrefix()
      56             : {
      57           0 :     return OUSTR(NS_PREFIX);
      58             : }
      59             : 
      60           0 : OUString ExtensionBackendDb::getRootElementName()
      61             : {
      62           0 :     return OUSTR(ROOT_ELEMENT_NAME);
      63             : }
      64             : 
      65           0 : OUString ExtensionBackendDb::getKeyElementName()
      66             : {
      67           0 :     return OUSTR(KEY_ELEMENT_NAME);
      68             : }
      69             : 
      70           0 : void ExtensionBackendDb::addEntry(::rtl::OUString const & url, Data const & data)
      71             : {
      72             :     try{
      73             :         //reactive revoked entry if possible.
      74           0 :         if (!activateEntry(url))
      75             :         {
      76           0 :             Reference<css::xml::dom::XNode> extensionNodeNode = writeKeyElement(url);
      77             :             writeVectorOfPair(
      78             :                 data.items,
      79             :                 OUSTR("extension-items"),
      80             :                 OUSTR("item"),
      81             :                 OUSTR("url"),
      82             :                 OUSTR("media-type"),
      83           0 :                 extensionNodeNode);
      84           0 :             save();
      85             :         }
      86             :     }
      87           0 :     catch(const css::uno::Exception &)
      88             :     {
      89           0 :         Any exc( ::cppu::getCaughtException() );
      90             :         throw css::deployment::DeploymentException(
      91             :             OUSTR("Extension Manager: failed to write data entry in backend db: ") +
      92           0 :             m_urlDb, 0, exc);
      93             :     }
      94           0 : }
      95             : 
      96           0 : ExtensionBackendDb::Data ExtensionBackendDb::getEntry(::rtl::OUString const & url)
      97             : {
      98             :     try
      99             :     {
     100           0 :         ExtensionBackendDb::Data retData;
     101           0 :         Reference<css::xml::dom::XNode> aNode = getKeyElement(url);
     102             : 
     103           0 :         if (aNode.is())
     104             :         {
     105             :             retData.items =
     106             :                 readVectorOfPair(
     107             :                     aNode,
     108             :                     OUSTR("extension-items"),
     109             :                     OUSTR("item"),
     110             :                     OUSTR("url"),
     111           0 :                     OUSTR("media-type"));
     112             :         }
     113           0 :         return retData;
     114             :     }
     115           0 :     catch(const css::uno::Exception &)
     116             :     {
     117           0 :         Any exc( ::cppu::getCaughtException() );
     118             :         throw css::deployment::DeploymentException(
     119             :             OUSTR("Extension Manager: failed to read data entry in backend db: ") +
     120           0 :             m_urlDb, 0, exc);
     121             :     }
     122             : }
     123             : 
     124             : } // namespace bundle
     125             : } // namespace backend
     126             : } // namespace dp_registry
     127             : 
     128             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10