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