1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #if ! defined INCLUDED_DP_COMPBACKENDDB_HXX
29 #define INCLUDED_DP_COMPBACKENDDB_HXX
30 
31 #include "rtl/ustring.hxx"
32 #include "rtl/string.hxx"
33 #include <vector>
34 #include <list>
35 #include "dp_backenddb.hxx"
36 
37 namespace css = ::com::sun::star;
38 
39 namespace com { namespace sun { namespace star {
40         namespace uno {
41         class XComponentContext;
42         }
43         namespace xml { namespace dom {
44             class XDocument;
45             class XNode;
46         }}
47         namespace xml { namespace xpath {
48             class XXPathAPI;
49         }}
50 }}}
51 
52 namespace dp_registry {
53 namespace backend {
54 namespace component {
55 
56 /* The XML file stores the extensions which are currently registered.
57    They will be removed when they are revoked.
58    The format looks like this:
59 
60 <?xml version="1.0"?>
61 <component-backend-db xmlns="http://openoffice.org/extensionmanager/component-registry/2010">
62   <component url="vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE/uno_packages/5CD5.tmp_/leaves1.oxt/extensionoptions.jar">
63     <name>FileName</name>
64     <java-type-library>true</java-type-library>
65     <implementation-names>
66       <name>com.sun.star.comp.extensionoptions.OptionsEventHandler$_OptionsEventHandler</name>
67       ...
68     </implementation-names>
69     <singletons>
70       <item>
71         <key>com.sun.star.java.theJavaVirtualMachine</key>
72         <value>com.sun.star.java.JavaVirtualMachine</value>
73       </item>
74       ...
75     </singletons>
76   </component>
77 
78   <component ...>
79   ...
80 </component-backend-db>
81  */
82 class ComponentBackendDb: public dp_registry::backend::BackendDb
83 {
84 protected:
85     virtual ::rtl::OUString getDbNSName();
86     virtual ::rtl::OUString getNSPrefix();
87     virtual ::rtl::OUString getRootElementName();
88     virtual ::rtl::OUString getKeyElementName();
89 
90 public:
91     struct Data
92     {
93         Data(): javaTypeLibrary(false) {};
94 
95         ::std::list< ::rtl::OUString> implementationNames;
96         /* every singleton has a key and a value
97          */
98         ::std::vector< ::std::pair< ::rtl::OUString, ::rtl::OUString> >singletons;
99         bool javaTypeLibrary;
100     };
101 
102 public:
103 
104     ComponentBackendDb( css::uno::Reference<css::uno::XComponentContext> const &  xContext,
105                         ::rtl::OUString const & url);
106 
107     void addEntry(::rtl::OUString const & url, Data const & data);
108 
109     Data getEntry(::rtl::OUString const & url);
110 
111 
112 };
113 
114 
115 
116 }
117 }
118 }
119 #endif
120 
121