LCOV - code coverage report
Current view: top level - desktop/source/deployment/registry/component - dp_compbackenddb.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 39 0.0 %
Date: 2014-04-14 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/string.h"
      22             : #include "rtl/bootstrap.hxx"
      23             : #include "cppuhelper/exc_hlp.hxx"
      24             : #include "com/sun/star/uno/XComponentContext.hpp"
      25             : #include "com/sun/star/xml/dom/XDocumentBuilder.hpp"
      26             : #include "com/sun/star/xml/xpath/XXPathAPI.hpp"
      27             : #include "dp_misc.h"
      28             : 
      29             : #include "dp_compbackenddb.hxx"
      30             : 
      31             : 
      32             : using namespace ::com::sun::star::uno;
      33             : 
      34             : #define EXTENSION_REG_NS "http://openoffice.org/extensionmanager/component-registry/2010"
      35             : #define NS_PREFIX "comp"
      36             : #define ROOT_ELEMENT_NAME "component-backend-db"
      37             : #define KEY_ELEMENT_NAME "component"
      38             : 
      39             : namespace dp_registry {
      40             : namespace backend {
      41             : namespace component {
      42             : 
      43           0 : ComponentBackendDb::ComponentBackendDb(
      44             :     Reference<XComponentContext> const &  xContext,
      45           0 :     OUString const & url):BackendDb(xContext, url)
      46             : {
      47             : 
      48           0 : }
      49             : 
      50           0 : OUString ComponentBackendDb::getDbNSName()
      51             : {
      52           0 :     return OUString(EXTENSION_REG_NS);
      53             : }
      54             : 
      55           0 : OUString ComponentBackendDb::getNSPrefix()
      56             : {
      57           0 :     return OUString(NS_PREFIX);
      58             : }
      59             : 
      60           0 : OUString ComponentBackendDb::getRootElementName()
      61             : {
      62           0 :     return OUString(ROOT_ELEMENT_NAME);
      63             : }
      64             : 
      65           0 : OUString ComponentBackendDb::getKeyElementName()
      66             : {
      67           0 :     return OUString(KEY_ELEMENT_NAME);
      68             : }
      69             : 
      70           0 : void ComponentBackendDb::addEntry(OUString const & url, Data const & data)
      71             : {
      72             :     try{
      73           0 :         if (!activateEntry(url))
      74             :         {
      75           0 :             Reference<css::xml::dom::XNode> componentNode = writeKeyElement(url);
      76             :             writeSimpleElement("java-type-library",
      77             :                                OUString::boolean((sal_Bool) data.javaTypeLibrary),
      78           0 :                                componentNode);
      79             : 
      80             :             writeSimpleList(
      81             :                 data.implementationNames,
      82             :                 "implementation-names",
      83             :                 "name",
      84           0 :                 componentNode);
      85             : 
      86             :             writeVectorOfPair(
      87             :                 data.singletons,
      88             :                 "singletons",
      89             :                 "item",
      90             :                 "key",
      91             :                 "value",
      92           0 :                 componentNode);
      93             : 
      94           0 :             save();
      95             :         }
      96             :     }
      97           0 :     catch(const css::uno::Exception &)
      98             :     {
      99           0 :         Any exc( ::cppu::getCaughtException() );
     100             :         throw css::deployment::DeploymentException(
     101           0 :             "Extension Manager: failed to write data entry in backend db: " +
     102           0 :             m_urlDb, 0, exc);
     103             :     }
     104           0 : }
     105             : 
     106           0 : ComponentBackendDb::Data ComponentBackendDb::getEntry(OUString const & url)
     107             : {
     108             :     try
     109             :     {
     110           0 :         ComponentBackendDb::Data retData;
     111           0 :         Reference<css::xml::dom::XNode> aNode = getKeyElement(url);
     112           0 :         if (aNode.is())
     113             :         {
     114           0 :             bool bJava = (readSimpleElement("java-type-library", aNode) ==
     115           0 :                 "true") ? true : false;
     116           0 :             retData.javaTypeLibrary = bJava;
     117             : 
     118           0 :             retData.implementationNames =
     119           0 :                 readList( aNode, "implementation-names", "name");
     120             : 
     121           0 :             retData.singletons =
     122           0 :                 readVectorOfPair( aNode, "singletons", "item", "key", "value");
     123             :         }
     124           0 :         return retData;
     125             :     }
     126           0 :     catch(const css::uno::Exception &)
     127             :     {
     128           0 :         Any exc( ::cppu::getCaughtException() );
     129             :         throw css::deployment::DeploymentException(
     130           0 :             "Extension Manager: failed to read data entry in backend db: " +
     131           0 :             m_urlDb, 0, exc);
     132             :     }
     133             : }
     134             : 
     135             : 
     136             : } // namespace bundle
     137             : } // namespace backend
     138             : } // namespace dp_registry
     139             : 
     140             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10