1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: mergeddataprovider.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef CONFIGMGR_BACKEND_MERGEDDATAPROVIDER_HXX
32 #define CONFIGMGR_BACKEND_MERGEDDATAPROVIDER_HXX
34 #include "sal/config.h"
36 #include "salhelper/simplereferenceobject.hxx"
38 #include "request.hxx"
39 #include "requesttypes.hxx"
40 #include "utility.hxx"
44 // ---------------------------------------------------------------------------
47 // ---------------------------------------------------------------------------
48 /** Listener interface for receiving notifications
49 about changes to previously requested data
51 struct SAL_NO_VTABLE INodeDataListener
53 /** is called to indicate changes within the data being observed.
55 @param _aOriginalRequest
56 identifies the data that changed
58 virtual void dataChanged(ComponentRequest
const & _aOriginalRequest
) SAL_THROW(()) = 0;
60 // ---------------------------------------------------------------------------
62 /// Interface providing access to template (schema) data
63 struct SAL_NO_VTABLE ITemplateDataProvider
65 /** loads a given template and returns it as return value
68 identifies the template to be loaded
71 A valid instance of the given template.
73 <p> Currently a request with empty template name
74 will retrieve a group node holding all templates
78 @throws com::sun::star::uno::Exception
79 if the template cannot be retrieved.
80 The exact exception being thrown may depend on the underlying backend.
82 virtual ResultHolder
< TemplateInstance
> getTemplateData(TemplateRequest
const & _aRequest
)
83 SAL_THROW((com::sun::star::uno::Exception
)) = 0;
85 // ---------------------------------------------------------------------------
87 /** Composite interface providing full access to merged configuration data
90 <p> Loading and updating of data is supported.
91 Support for notification depends on the backend.
94 struct IMergedDataProvider
95 : salhelper::SimpleReferenceObject
96 , ITemplateDataProvider
98 /** loads merged data for a (partial) tree and returns it as return value.
101 identifies the component to be loaded
104 a listener to observe subsequent changes to the data requested
106 <p> If NULL, no notifications will be sent. </p>
108 <p> Otherwise the listener will be notified of changes.
109 The listener must subsequently be removed by calling
110 <member>removeRequestListener</member>.
111 The listener must live at least until it is removed.
115 A valid component instance for the given request.
117 @throws com::sun::star::uno::Exception
118 if the node cannot be retrieved.
119 The exact exception being thrown may depend on the underlying backend.
121 virtual ResultHolder
< ComponentInstance
> getNodeData(ComponentRequest
const & _aRequest
,
122 ITemplateDataProvider
* _aTemplateProvider
,
123 INodeDataListener
* _pListener
= NULL
)
124 SAL_THROW((com::sun::star::uno::Exception
)) = 0;
126 /** remove a listener registered for a previous request.
127 <p>This may also release some open resources for the request.</p>
130 a listener that was passed to a previous succes
133 identifies the component associated with the listener
135 virtual void removeRequestListener(INodeDataListener
* _pListener
,
136 const ComponentRequest
& aRequest
) SAL_THROW(()) = 0;
138 /** applies an update to the stored data.
141 identifies the node to be updated and
142 describes the changes to be applied.
144 @throws com::sun::star::uno::Exception
145 if the node cannot be updated.
146 The exact exception being thrown may depend on the underlying backend.
148 virtual void updateNodeData(UpdateRequest
const & _anUpdate
)
149 SAL_THROW((com::sun::star::uno::Exception
)) = 0;
151 /** loads default data for a (partial) tree and returns it as return value
154 identifies the node to be loaded
157 A valid node instance for the default state of the given node.
159 <p>May be NULL, if the node exists but has no default equivalent.</p>
161 @throws com::sun::star::uno::Exception
162 if the default cannot be retrieved.
163 The exact exception being thrown may depend on the underlying backend.
165 virtual ResultHolder
< NodeInstance
> getDefaultData(NodeRequest
const & _aRequest
)
166 SAL_THROW((com::sun::star::uno::Exception
)) = 0;
169 // ---------------------------------------------------------------------------
170 } // namespace backend
172 // ---------------------------------------------------------------------------
173 } // namespace configmgr