1d1766043SAndrew Rist/**************************************************************
2cdf0e10cSrcweir *
3d1766043SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4d1766043SAndrew Rist * or more contributor license agreements.  See the NOTICE file
5d1766043SAndrew Rist * distributed with this work for additional information
6d1766043SAndrew Rist * regarding copyright ownership.  The ASF licenses this file
7d1766043SAndrew Rist * to you under the Apache License, Version 2.0 (the
8d1766043SAndrew Rist * "License"); you may not use this file except in compliance
9d1766043SAndrew Rist * with the License.  You may obtain a copy of the License at
10d1766043SAndrew Rist *
11d1766043SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
12d1766043SAndrew Rist *
13d1766043SAndrew Rist * Unless required by applicable law or agreed to in writing,
14d1766043SAndrew Rist * software distributed under the License is distributed on an
15d1766043SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16d1766043SAndrew Rist * KIND, either express or implied.  See the License for the
17d1766043SAndrew Rist * specific language governing permissions and limitations
18d1766043SAndrew Rist * under the License.
19d1766043SAndrew Rist *
20d1766043SAndrew Rist *************************************************************/
21d1766043SAndrew Rist
22d1766043SAndrew Rist
23cdf0e10cSrcweir#ifndef __com_sun_star_ucb_XContentProviderManager_idl__
24cdf0e10cSrcweir#define __com_sun_star_ucb_XContentProviderManager_idl__
25cdf0e10cSrcweir
26cdf0e10cSrcweir#ifndef __com_sun_star_uno_XInterface_idl__
27cdf0e10cSrcweir#include <com/sun/star/uno/XInterface.idl>
28cdf0e10cSrcweir#endif
29cdf0e10cSrcweir
30cdf0e10cSrcweir#ifndef __com_sun_star_ucb_XContentProvider_idl__
31cdf0e10cSrcweir#include <com/sun/star/ucb/XContentProvider.idl>
32cdf0e10cSrcweir#endif
33cdf0e10cSrcweir
34cdf0e10cSrcweir#ifndef __com_sun_star_ucb_DuplicateProviderException_idl__
35cdf0e10cSrcweir#include <com/sun/star/ucb/DuplicateProviderException.idl>
36cdf0e10cSrcweir#endif
37cdf0e10cSrcweir
38cdf0e10cSrcweir#ifndef __com_sun_star_ucb_ContentProviderInfo_idl__
39cdf0e10cSrcweir#include <com/sun/star/ucb/ContentProviderInfo.idl>
40cdf0e10cSrcweir#endif
41cdf0e10cSrcweir
42cdf0e10cSrcweir
43cdf0e10cSrcweir//=============================================================================
44cdf0e10cSrcweir
45cdf0e10cSrcweirmodule com { module sun { module star { module ucb {
46cdf0e10cSrcweir
47cdf0e10cSrcweir//=============================================================================
48cdf0e10cSrcweir/** makes it possible to query/register/deregister content providers.
49cdf0e10cSrcweir
50cdf0e10cSrcweir	@version  1.0
51cdf0e10cSrcweir	@author   Kai Sommerfeld
52cdf0e10cSrcweir	@see      XContentProvider
53cdf0e10cSrcweir*/
54cdf0e10cSrcweirpublished interface XContentProviderManager: com::sun::star::uno::XInterface
55cdf0e10cSrcweir{
56cdf0e10cSrcweir	//-------------------------------------------------------------------------
57cdf0e10cSrcweir	/** registers a content provider for a specific URL template.
58cdf0e10cSrcweir
59cdf0e10cSrcweir		@see XContentIdentifier
60cdf0e10cSrcweir
61cdf0e10cSrcweir		@param Provider
62cdf0e10cSrcweir		the content provider to register.
63cdf0e10cSrcweir
64cdf0e10cSrcweir		<p>This may be <NULL/>, in which case a later
65cdf0e10cSrcweir		<member>XContentProvider::queryContent</member> with an
66cdf0e10cSrcweir	    <type>XContentIdentifier</type>	that matches the <var>Scheme</var>
67cdf0e10cSrcweir	    will simply return <NULL/>. These "dummy" content providers are useful
68cdf0e10cSrcweir	    in combination with other content providers that are registered on a
69cdf0e10cSrcweir	    wildcard URL template: For example,	imagine that you want to route all
70cdf0e10cSrcweir	    http URLs to a HTTP content	provider, but want to block all URLs for
71cdf0e10cSrcweir	    the server <code>www.dont.go</code>. One solution would be to register
72cdf0e10cSrcweir	    the HTTP content provider on the <var>Scheme</var> <code>http</code>,
73cdf0e10cSrcweir	    and to register a "dummy" (i.e., <NULL/>) content provider on the
74cdf0e10cSrcweir		<var>Scheme</var> <code>"http://www.dont.go"([/?#].*)?</code>.
75cdf0e10cSrcweir
76cdf0e10cSrcweir		@param Scheme
77cdf0e10cSrcweir		the URL scheme for the provided contents. More generally, this may not
78cdf0e10cSrcweir		only be a URL scheme, but a URL template.
79cdf0e10cSrcweir
80cdf0e10cSrcweir		<p>A URL template is a regular expression (represented as a string) that
81cdf0e10cSrcweir		specifies a subset of the set of all possible URLs (this subset
82cdf0e10cSrcweir		consists of exactly those URLs that match the regular expression).  The
83cdf0e10cSrcweir		language to denote the regular expressions is initially quite limited,
84cdf0e10cSrcweir		but it may be extended in the future:
85cdf0e10cSrcweir
86cdf0e10cSrcweir		<p><ul>
87cdf0e10cSrcweir		<li><code>regexp = scheme / simple / translation</code></li>
88cdf0e10cSrcweir		<li><code>scheme = ALPHA *(ALPHA / DIGIT / "+" / "-" / ".")</code></li>
89cdf0e10cSrcweir		<li><code>simple = simple-prefix / simple-authority / simple-domain</code></li>
90cdf0e10cSrcweir		<li><code>translation = trans-prefix / trans-authority / trans-domain</code></li>
91cdf0e10cSrcweir		<li><code>simple-prefix = [string] ".*"</code></li>
92cdf0e10cSrcweir		<li><code>trans-prefix = [string] "(.*)->" [string] "\1"</code></li>
93cdf0e10cSrcweir		<li><code>simple-authority = [string] "([/?#].*)?"</code></li>
94cdf0e10cSrcweir		<li><code>trans-authority = [string] "(([/?#].*)?)->" string "\1"</code></li>
95cdf0e10cSrcweir		<li><code>simple-domain = [string] "[^/?#]*" string "([/?#].*)?"</code></li>
96cdf0e10cSrcweir		<li><code>trans-domain = [string] "([^/?#]*" string "([/?#].*)?)->" string "\1"</code></li>
97cdf0e10cSrcweir		<li><code>string = DQUOTE 1*(schar / sescape) DQUOTE  ; DQUOTE is "</code></li>
98cdf0e10cSrcweir		<li><code>schar = &lt any UTF-16 character except " or \></code></li>
99cdf0e10cSrcweir		<li><code>sescape = "\" (DQUOTE / "\")</code></li>
100cdf0e10cSrcweir		</ul>
101cdf0e10cSrcweir
102cdf0e10cSrcweir		<p>A <code>&lt;scheme&gt:</code> matches any URL of exactly the given
103cdf0e10cSrcweir	    scheme (ignoring case),	keeping the extension from URL schemes to URL
104cdf0e10cSrcweir	    templates backwards	compatible.  The <code>&lt;simple&gt:</code>
105cdf0e10cSrcweir	    regexps match any URL starting with a given	string literal, followed
106cdf0e10cSrcweir	    by arbitrary characters (<code>&lt;simple-prefix&gt:</code>), or
107cdf0e10cSrcweir		by arbitrary characters that start with one of '/', '?', or '#', if any
108cdf0e10cSrcweir		(<code>&lt;simple-authority&gt:</code>), or by arbitrary characters not
109cdf0e10cSrcweir	    including any of '/', '?', or '#', followed by a given string literal,
110cdf0e10cSrcweir	    followed by	arbitrary characters that start with one of '/', '?', or
111*a893be29SPedro Giffuni	    '#', if any. The comparison of string literals is done ignoring the
112cdf0e10cSrcweir	    case of ASCII letters.  The <code>&lt;translation&gt:</code> regexps
113cdf0e10cSrcweir	    match the same URLs as their <code>&lt;simple&gt:</code> counterparts,
114cdf0e10cSrcweir	    but they also describe how a (local) URL is mapped to another (remote)
115cdf0e10cSrcweir	    URL.  This mapping is only relevant for	methods of the
116cdf0e10cSrcweir	    <type>RemoteAccessContentProvider</type>'s
117cdf0e10cSrcweir	  	<type>XParameterizedContentProvider</type> interface; in all other
118cdf0e10cSrcweir		cases, <code>&lt;translation&gt:</code> regexps have the same semantics
119cdf0e10cSrcweir	    as their <code>&lt;simple&gt:</code> counterparts.
120cdf0e10cSrcweir
121cdf0e10cSrcweir		@param ReplaceExisting
122cdf0e10cSrcweir		<TRUE/>: replace the provider possibly registered for the given URL
123cdf0e10cSrcweir	    template. The replaced provider will not be	deregistered automatically!
124cdf0e10cSrcweir	    If the superseding provider gets deregistered, the superseded one will
125cdf0e10cSrcweir		become active again.
126cdf0e10cSrcweir		<p><FALSE/>: do not register, if another provider is already registered
127cdf0e10cSrcweir	    for the given URL template.
128cdf0e10cSrcweir
129cdf0e10cSrcweir		@returns
130cdf0e10cSrcweir		the replaced content provider, if there was one.
131cdf0e10cSrcweir	*/
132cdf0e10cSrcweir	com::sun::star::ucb::XContentProvider registerContentProvider(
133cdf0e10cSrcweir				[in] com::sun::star::ucb::XContentProvider Provider,
134cdf0e10cSrcweir				[in] string Scheme,
135cdf0e10cSrcweir				[in] boolean ReplaceExisting )
136cdf0e10cSrcweir		raises( com::sun::star::ucb::DuplicateProviderException );
137cdf0e10cSrcweir
138cdf0e10cSrcweir	//-------------------------------------------------------------------------
139cdf0e10cSrcweir	/** deregisters a content provider.
140cdf0e10cSrcweir
141cdf0e10cSrcweir		@param Provider
142cdf0e10cSrcweir		a content provider to deregister.
143cdf0e10cSrcweir
144cdf0e10cSrcweir		@param Scheme
145cdf0e10cSrcweir		the URL scheme for the provided contents. More generally, this
146cdf0e10cSrcweir		may not only be a URL scheme, but a URL template (see
147cdf0e10cSrcweir		<member>registerContentProvider</member> for a discussion of URL
148cdf0e10cSrcweir		templates).
149cdf0e10cSrcweir	*/
150cdf0e10cSrcweir	[oneway] void deregisterContentProvider(
151cdf0e10cSrcweir				[in] com::sun::star::ucb::XContentProvider Provider,
152cdf0e10cSrcweir			 	[in] string Scheme );
153cdf0e10cSrcweir
154cdf0e10cSrcweir	//-------------------------------------------------------------------------
155cdf0e10cSrcweir	/** returns a list of information on all registered content providers.
156cdf0e10cSrcweir
157cdf0e10cSrcweir		@returns
158cdf0e10cSrcweir		a list information on content providers.
159cdf0e10cSrcweir	*/
160cdf0e10cSrcweir	sequence<com::sun::star::ucb::ContentProviderInfo> queryContentProviders();
161cdf0e10cSrcweir
162cdf0e10cSrcweir	//-------------------------------------------------------------------------
163cdf0e10cSrcweir	/** returns the currently active content provider for a content
164cdf0e10cSrcweir        identifier.
165cdf0e10cSrcweir
166cdf0e10cSrcweir		@param Identifier
167cdf0e10cSrcweir		a content identifier (i.e., a URL).
168cdf0e10cSrcweir
169cdf0e10cSrcweir		@returns
170cdf0e10cSrcweir		a content provider.
171cdf0e10cSrcweir	*/
172cdf0e10cSrcweir	com::sun::star::ucb::XContentProvider queryContentProvider(
173cdf0e10cSrcweir				[in] string Identifier );
174cdf0e10cSrcweir};
175cdf0e10cSrcweir
176cdf0e10cSrcweir//=============================================================================
177cdf0e10cSrcweir
178cdf0e10cSrcweir}; }; }; };
179cdf0e10cSrcweir
180cdf0e10cSrcweir#endif
181