1*cdf0e10cSrcweir/*************************************************************************
2*cdf0e10cSrcweir *
3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir *
5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir *
7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir *
9*cdf0e10cSrcweir * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir *
11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir *
15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir *
21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir *
26*cdf0e10cSrcweir ************************************************************************/
27*cdf0e10cSrcweir#ifndef __com_sun_star_ucb_XDynamicResultSet_idl__
28*cdf0e10cSrcweir#define __com_sun_star_ucb_XDynamicResultSet_idl__
29*cdf0e10cSrcweir
30*cdf0e10cSrcweir#ifndef __com_sun_star_lang_XComponent_idl__
31*cdf0e10cSrcweir#include <com/sun/star/lang/XComponent.idl>
32*cdf0e10cSrcweir#endif
33*cdf0e10cSrcweir
34*cdf0e10cSrcweir#ifndef __com_sun_star_ucb_XDynamicResultSetListener_idl__
35*cdf0e10cSrcweir#include <com/sun/star/ucb/XDynamicResultSetListener.idl>
36*cdf0e10cSrcweir#endif
37*cdf0e10cSrcweir
38*cdf0e10cSrcweir#ifndef __com_sun_star_ucb_ListenerAlreadySetException_idl__
39*cdf0e10cSrcweir#include <com/sun/star/ucb/ListenerAlreadySetException.idl>
40*cdf0e10cSrcweir#endif
41*cdf0e10cSrcweir
42*cdf0e10cSrcweir#ifndef __com_sun_star_sdbc_XResultSet_idl__
43*cdf0e10cSrcweir#include <com/sun/star/sdbc/XResultSet.idl>
44*cdf0e10cSrcweir#endif
45*cdf0e10cSrcweir
46*cdf0e10cSrcweir#ifndef __com_sun_star_ucb_AlreadyInitializedException_idl__
47*cdf0e10cSrcweir#include <com/sun/star/ucb/AlreadyInitializedException.idl>
48*cdf0e10cSrcweir#endif
49*cdf0e10cSrcweir
50*cdf0e10cSrcweir#ifndef __com_sun_star_ucb_ServiceNotFoundException_idl__
51*cdf0e10cSrcweir#include <com/sun/star/ucb/ServiceNotFoundException.idl>
52*cdf0e10cSrcweir#endif
53*cdf0e10cSrcweir
54*cdf0e10cSrcweir//=============================================================================
55*cdf0e10cSrcweir
56*cdf0e10cSrcweirmodule com { module sun { module star { module ucb {
57*cdf0e10cSrcweir
58*cdf0e10cSrcweir//=============================================================================
59*cdf0e10cSrcweir/** Provides read access to a <type>ContentResultSet</type>.
60*cdf0e10cSrcweir
61*cdf0e10cSrcweir	<p>
62*cdf0e10cSrcweir	You can either get a simple static <type>ContentResultSet</type> or you can
63*cdf0e10cSrcweir	listen to change-notifications and than swap from the old to a new
64*cdf0e10cSrcweir	<type>ContentResultSet</type>.
65*cdf0e10cSrcweir	</p>
66*cdf0e10cSrcweir
67*cdf0e10cSrcweir	<p>The following describes the dynamic use:</p>
68*cdf0e10cSrcweir
69*cdf0e10cSrcweir	<p>
70*cdf0e10cSrcweir	<type>XDynamicResultSet</type> provides the possibility to get notifications
71*cdf0e10cSrcweir	about changes on a <type>ContentResultSet</type> and have an
72*cdf0e10cSrcweir	listener-controlled update from one version to the next version. Two
73*cdf0e10cSrcweir	<type>ContentResultSet</type> implementations were given to the listener in
74*cdf0e10cSrcweir	the first notification as interface
75*cdf0e10cSrcweir    <type scope="com::sun::star::sdbc">XResultSet</type>.
76*cdf0e10cSrcweir	</p>
77*cdf0e10cSrcweir
78*cdf0e10cSrcweir	<p>
79*cdf0e10cSrcweir	To get notifications the listener has to be of type
80*cdf0e10cSrcweir	<type>XDynamicResultSetListener</type>.
81*cdf0e10cSrcweir	</p>
82*cdf0e10cSrcweir
83*cdf0e10cSrcweir	<p>
84*cdf0e10cSrcweir	After registration you will get notifications for events of type
85*cdf0e10cSrcweir	<type>ListEvent</type>.
86*cdf0e10cSrcweir	</p>
87*cdf0e10cSrcweir
88*cdf0e10cSrcweir	<p>
89*cdf0e10cSrcweir	The calling of <member>XDynamicResultSetListener::notify</member> has
90*cdf0e10cSrcweir	to happen in an own thread, because it could take a longer time and any
91*cdf0e10cSrcweir	actions	til the listener returns the call. So don't block the notify-causing
92*cdf0e10cSrcweir	action.
93*cdf0e10cSrcweir	</p>
94*cdf0e10cSrcweir
95*cdf0e10cSrcweir	<p>
96*cdf0e10cSrcweir	While one notify-call is going on:
97*cdf0e10cSrcweir	</p>
98*cdf0e10cSrcweir
99*cdf0e10cSrcweir	<ol>
100*cdf0e10cSrcweir  	<li> The listener is allowed to access both <type>ContentResultSet</type>s,
101*cdf0e10cSrcweir		 they must be both valid.</li>
102*cdf0e10cSrcweir  	<li> It is not allowed to start a second notify-call.</li>
103*cdf0e10cSrcweir  	<li> All addditional things we want to send as notification are to be
104*cdf0e10cSrcweir	     queued.</li>
105*cdf0e10cSrcweir  	<li> Any other calls are to be accepted and treated.</li>
106*cdf0e10cSrcweir	</ol>
107*cdf0e10cSrcweir
108*cdf0e10cSrcweir	<p>
109*cdf0e10cSrcweir	After the listener has returned the notify-call:
110*cdf0e10cSrcweir	</p>
111*cdf0e10cSrcweir
112*cdf0e10cSrcweir	<ol>
113*cdf0e10cSrcweir	<li> The listener is allowed to access the new
114*cdf0e10cSrcweir         <type>ContentResultSet</type>. The new one is first assigned in the
115*cdf0e10cSrcweir         WELCOME-event and than the ResultSets are always swapped.</li>
116*cdf0e10cSrcweir	<li> The listener is not allowed to access the old
117*cdf0e10cSrcweir         <type>ContentResultSet</type>.</li>
118*cdf0e10cSrcweir	</ol>
119*cdf0e10cSrcweir*/
120*cdf0e10cSrcweir
121*cdf0e10cSrcweirpublished interface XDynamicResultSet: com::sun::star::lang::XComponent
122*cdf0e10cSrcweir{
123*cdf0e10cSrcweir	//-------------------------------------------------------------------------
124*cdf0e10cSrcweir	/** Call this, if you don't care about any changes.
125*cdf0e10cSrcweir
126*cdf0e10cSrcweir		@returns
127*cdf0e10cSrcweir		an <type scope="com::sun::star::sdbc">XResultSet</type> that is
128*cdf0e10cSrcweir        implemented as <type>ContentResultSet</type>. Its content will never
129*cdf0e10cSrcweir        change.
130*cdf0e10cSrcweir
131*cdf0e10cSrcweir		@trows ListenerAlreadySetException
132*cdf0e10cSrcweir		if someone already has registered as listener via
133*cdf0e10cSrcweir		<member>XDynamicResultSet::setListener</member>	or if someone has
134*cdf0e10cSrcweir		established a connection to a <type>CachedDynamicResultSet</type>
135*cdf0e10cSrcweir		via <member>XDynamicResultSet::connectToCache</member>.
136*cdf0e10cSrcweir	*/
137*cdf0e10cSrcweir	com::sun::star::sdbc::XResultSet getStaticResultSet()
138*cdf0e10cSrcweir		raises( com::sun::star::ucb::ListenerAlreadySetException );
139*cdf0e10cSrcweir
140*cdf0e10cSrcweir	//-------------------------------------------------------------------------
141*cdf0e10cSrcweir	/**	Call this, if you want to get notifications about changes.
142*cdf0e10cSrcweir
143*cdf0e10cSrcweir		<p>The implementor has to call
144*cdf0e10cSrcweir		<member scope="com::sun::star::lang">XComponent::addEventListener</member>
145*cdf0e10cSrcweir		in this method, so that we can call
146*cdf0e10cSrcweir		<member scope="com::sun::star::lang">XEventListener::disposing</member>
147*cdf0e10cSrcweir		at the listener
148*cdf0e10cSrcweir
149*cdf0e10cSrcweir		@param Listener
150*cdf0e10cSrcweir		a listener for resultset notifications
151*cdf0e10cSrcweir
152*cdf0e10cSrcweir		@throws ListenerAlreadySetException
153*cdf0e10cSrcweir		if this method is called more than once during the life of the
154*cdf0e10cSrcweir		implementation object or if this method is called if someone already
155*cdf0e10cSrcweir		has	fetched the <type>ContentResultSet</type> via
156*cdf0e10cSrcweir		<member>XDynamicResultSet::getStaticResultSet</member>.
157*cdf0e10cSrcweir
158*cdf0e10cSrcweir	*/
159*cdf0e10cSrcweir	void setListener( [in] XDynamicResultSetListener Listener )
160*cdf0e10cSrcweir		raises( com::sun::star::ucb::ListenerAlreadySetException );
161*cdf0e10cSrcweir
162*cdf0e10cSrcweir	//-------------------------------------------------------------------------
163*cdf0e10cSrcweir	/**	Connects this to a <type>CachedDynamicResultSet</type> for optimized
164*cdf0e10cSrcweir		remote data transport.
165*cdf0e10cSrcweir
166*cdf0e10cSrcweir		<p>This method creates a <type>CachedDynamicResultSetStub</type>
167*cdf0e10cSrcweir		and sets it as Source to the given cache.
168*cdf0e10cSrcweir
169*cdf0e10cSrcweir		<p>After this method has returned you can and have to use the given
170*cdf0e10cSrcweir		result set cache for further access.
171*cdf0e10cSrcweir
172*cdf0e10cSrcweir		@param Cache
173*cdf0e10cSrcweir		has to be an implementation of the service
174*cdf0e10cSrcweir		<type>CachedDynamicResultSet</type>. In particular it has to support
175*cdf0e10cSrcweir		the interface <type>XSourceInitialization</type>.
176*cdf0e10cSrcweir
177*cdf0e10cSrcweir		@throws ListenerAlreadySetException
178*cdf0e10cSrcweir		if if someone already has fetched the <type>ContentResultSet</type> via
179*cdf0e10cSrcweir		<member>XDynamicResultSet::getStaticResultSet</member>.
180*cdf0e10cSrcweir
181*cdf0e10cSrcweir		@throws AlreadyInitializedException
182*cdf0e10cSrcweir		if <var>Cache</var> was already initialized with another source.
183*cdf0e10cSrcweir
184*cdf0e10cSrcweir		@throws ServiceNotFoundException
185*cdf0e10cSrcweir	*/
186*cdf0e10cSrcweir	void connectToCache( [in] XDynamicResultSet Cache )
187*cdf0e10cSrcweir		raises( com::sun::star::ucb::ListenerAlreadySetException
188*cdf0e10cSrcweir				, com::sun::star::ucb::AlreadyInitializedException
189*cdf0e10cSrcweir				, com::sun::star::ucb::ServiceNotFoundException );
190*cdf0e10cSrcweir
191*cdf0e10cSrcweir	//-------------------------------------------------------------------------
192*cdf0e10cSrcweir	/**	Using this method you can get information, whether the offered
193*cdf0e10cSrcweir		<type>ContentResultSet</type>s are sorted or filtered etc correctly as
194*cdf0e10cSrcweir		demanded during the creation of the <type>XDynamicResultSet</type>.
195*cdf0e10cSrcweir
196*cdf0e10cSrcweir		@returns
197*cdf0e10cSrcweir		zero or more constants of the <type>ContentResultSetCapability</type>
198*cdf0e10cSrcweir		constants group.
199*cdf0e10cSrcweir	*/
200*cdf0e10cSrcweir	short getCapabilities();
201*cdf0e10cSrcweir};
202*cdf0e10cSrcweir
203*cdf0e10cSrcweir//=============================================================================
204*cdf0e10cSrcweir
205*cdf0e10cSrcweir}; }; }; };
206*cdf0e10cSrcweir
207*cdf0e10cSrcweir#endif
208