1*2c696243SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*2c696243SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*2c696243SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*2c696243SAndrew Rist  * distributed with this work for additional information
6*2c696243SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*2c696243SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*2c696243SAndrew Rist  * "License"); you may not use this file except in compliance
9*2c696243SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*2c696243SAndrew Rist  *
11*2c696243SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*2c696243SAndrew Rist  *
13*2c696243SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*2c696243SAndrew Rist  * software distributed under the License is distributed on an
15*2c696243SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*2c696243SAndrew Rist  * KIND, either express or implied.  See the License for the
17*2c696243SAndrew Rist  * specific language governing permissions and limitations
18*2c696243SAndrew Rist  * under the License.
19*2c696243SAndrew Rist  *
20*2c696243SAndrew Rist  *************************************************************/
21*2c696243SAndrew Rist 
22*2c696243SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_scripting.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include "StorageBridgeFactory.hxx"
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #include "StorageBridge.hxx"
31cdf0e10cSrcweir 
32cdf0e10cSrcweir using namespace ::drafts::com::sun::star::script::framework;
33cdf0e10cSrcweir using namespace ::com::sun::star::uno;
34cdf0e10cSrcweir using namespace ::com::sun::star;
35cdf0e10cSrcweir 
36cdf0e10cSrcweir namespace scripting_runtimemgr
37cdf0e10cSrcweir {
38cdf0e10cSrcweir 
39cdf0e10cSrcweir //*************************************************************************
StorageBridgeFactory(const Reference<XComponentContext> & xContext)40cdf0e10cSrcweir StorageBridgeFactory::StorageBridgeFactory(
41cdf0e10cSrcweir     const Reference< XComponentContext >& xContext ) :
42cdf0e10cSrcweir     m_xContext( xContext )
43cdf0e10cSrcweir {}
44cdf0e10cSrcweir 
45cdf0e10cSrcweir 
46cdf0e10cSrcweir 
47cdf0e10cSrcweir //*************************************************************************
48cdf0e10cSrcweir // StorageBridge is a bridge between us an storage, the StorageBridge implements the
49cdf0e10cSrcweir // XScriptInfoAccess
50cdf0e10cSrcweir // interface, it allows both the "real" storage and a java test storage component to be
51cdf0e10cSrcweir // configured.
52cdf0e10cSrcweir // @param location contains a url for the document.
53cdf0e10cSrcweir // @returns a storage instance for the location "location".
54cdf0e10cSrcweir // @see StorageBridge.cxx  for flag "STORAGEPROXY", set to use java "test" component or
55cdf0e10cSrcweir // use "real" storage.
56cdf0e10cSrcweir 
57cdf0e10cSrcweir Reference< storage::XScriptInfoAccess >
getStorageInstance(sal_Int32 sid)58cdf0e10cSrcweir StorageBridgeFactory::getStorageInstance( sal_Int32 sid )
59cdf0e10cSrcweir {
60cdf0e10cSrcweir 
61cdf0e10cSrcweir     Reference< storage::XScriptInfoAccess > storage = new StorageBridge( m_xContext,
62cdf0e10cSrcweir             sid ) ;
63cdf0e10cSrcweir     return storage;
64cdf0e10cSrcweir }
65cdf0e10cSrcweir } //scripting_runtimemgr
66