Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
1fc4b51c
Kaydet (Commit)
1fc4b51c
authored
Eyl 15, 2003
tarafından
Noel Power
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#19595#
Adding changes to use createContentEnumeration to determine/discover scriptProviders
üst
5e1f0136
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
71 deletions
+51
-71
MasterScriptProvider.cxx
scripting/source/provider/MasterScriptProvider.cxx
+10
-8
ProviderCache.cxx
scripting/source/provider/ProviderCache.cxx
+39
-57
ProviderCache.hxx
scripting/source/provider/ProviderCache.hxx
+2
-6
No files found.
scripting/source/provider/MasterScriptProvider.cxx
Dosyayı görüntüle @
1fc4b51c
...
...
@@ -2,9 +2,9 @@
*
* $RCSfile: MasterScriptProvider.cxx,v $
*
* $Revision: 1.
4
$
* $Revision: 1.
5
$
*
* last change: $Author: npower $ $Date: 2003-09-1
0 08:08:14
$
* last change: $Author: npower $ $Date: 2003-09-1
5 14:32:37
$
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
...
...
@@ -127,20 +127,22 @@ MasterScriptProvider::MasterScriptProvider( const Reference< XComponentContext >
"MasterScriptProvider::initialise: cannot get StorageManager"
);
m_xScriptStorageMgr
=
Reference
<
storage
::
XScriptStorageManager
>
(
xInterface
,
UNO_QUERY_THROW
);
// Set up contextless cache
// if initialise method is called a new ProviderCache will be
// created with the appropriate context supplied as an argument
Sequence
<
Any
>
invokeArgs
(
1
);
invokeArgs
[
0
]
<<=
m_XScriptingContext
;
m_pPCache
=
new
ProviderCache
(
m_xContext
,
invokeArgs
);
}
catch
(
Exception
&
e
)
{
OSL_TRACE
(
"MasterScriptProvider -ctor caught exception %s"
,
::
rtl
::
OUStringToOString
(
e
.
Message
,
RTL_TEXTENCODING_ASCII_US
).
pData
->
buffer
);
::
rtl
::
OUString
temp
=
OUSTR
(
"MasterScriptProvider::MasterScriptProvider: could not raise instance of ScriptStorageManager : "
);
throw
RuntimeException
(
temp
.
concat
(
e
.
Message
),
Reference
<
XInterface
>
()
);
}
// Set up contextless cache
// if initialise method is called a new ProviderCache will be
// created with the appropriate context supplied as an argument
Sequence
<
Any
>
invokeArgs
(
1
);
invokeArgs
[
0
]
<<=
m_XScriptingContext
;
m_pPCache
=
new
ProviderCache
(
m_xContext
,
invokeArgs
);
m_bIsValid
=
true
;
}
...
...
scripting/source/provider/ProviderCache.cxx
Dosyayı görüntüle @
1fc4b51c
...
...
@@ -2,9 +2,9 @@
*
* $RCSfile: ProviderCache.cxx,v $
*
* $Revision: 1.
1
$
* $Revision: 1.
2
$
*
* last change: $Author: npower $ $Date: 2003-09-
04 07:21:55
$
* last change: $Author: npower $ $Date: 2003-09-
15 14:32:37
$
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
...
...
@@ -73,6 +73,10 @@ using namespace drafts::com::sun::star::script::framework;
namespace
func_provider
{
::
rtl
::
OUString
languageProviderName
=
::
rtl
::
OUString
::
createFromAscii
(
"drafts.com.sun.star.script.framework.provider.LanguageScriptProvider"
);
::
rtl
::
OUString
providerKey
=
::
rtl
::
OUString
::
createFromAscii
(
"drafts.com.sun.star.script.framework.provider.ScriptProviderFor"
);
ProviderCache
::
ProviderCache
(
const
Reference
<
XComponentContext
>&
xContext
,
const
Sequence
<
Any
>&
scriptContext
)
throw
(
RuntimeException
)
:
m_Sctx
(
scriptContext
),
m_xContext
(
xContext
)
...
...
@@ -176,79 +180,58 @@ void
ProviderCache
::
populateCache
()
throw
(
RuntimeException
)
{
OSL_TRACE
(
"ProviderCache::populateCache()"
);
// temporary hard code here for services, will be determined by
// createContentEnumeration as soon as registration problems are
// sorted out. At the moment can only get the factory for each service
// by doing createContentEnumeration on each of the language providers,
// will be possible to do this just using "LanguageScriptProvider"
// as the service name to get all of the factorys
::
rtl
::
OUString
serviceList
[]
=
{
::
rtl
::
OUString
::
createFromAscii
(
"drafts.com.sun.star.script.framework.provider.ScriptProviderForJavaScript"
),
::
rtl
::
OUString
::
createFromAscii
(
"drafts.com.sun.star.script.framework.provider.ScriptProviderForJava"
),
::
rtl
::
OUString
::
createFromAscii
(
"drafts.com.sun.star.script.framework.provider.ScriptProviderForBeanShell"
)
};
Sequence
<
::
rtl
::
OUString
>
s_serviceNames
=
Sequence
<
::
rtl
::
OUString
>
(
serviceList
,
3
);
// wrong name in services.rdb
::
rtl
::
OUString
serviceName
;
::
osl
::
Guard
<
osl
::
Mutex
>
aGuard
(
m_mutex
);
try
{
for
(
int
index
=
0
;
index
<
s_serviceNames
.
getLength
();
index
++
)
{
ProviderDetails
details
;
OSL_TRACE
(
"Getting factory for service %s"
,
::
rtl
::
OUStringToOString
(
s_serviceNames
[
index
],
RTL_TEXTENCODING_ASCII_US
).
pData
->
buffer
);
details
.
factory
=
getFactory
(
s_serviceNames
[
index
]
);
m_hProviderDetailsCache
[
s_serviceNames
[
index
]
]
=
details
;
}
}
catch
(
RuntimeException
&
e
)
{
::
rtl
::
OUString
temp
=
OUSTR
(
"ProviderCache::populateCache: couldn't populate cache"
);
throw
RuntimeException
(
temp
.
concat
(
e
.
Message
),
Reference
<
XInterface
>
()
);
}
}
Reference
<
lang
::
XSingleComponentFactory
>
ProviderCache
::
getFactory
(
const
::
rtl
::
OUString
&
serviceName
)
throw
(
RuntimeException
)
{
OSL_TRACE
(
"ProviderCache::getFactor() Getting factory for service %s"
,
::
rtl
::
OUStringToOString
(
serviceName
,
RTL_TEXTENCODING_ASCII_US
).
pData
->
buffer
);
Reference
<
lang
::
XSingleComponentFactory
>
factory
;
try
{
Reference
<
container
::
XContentEnumerationAccess
>
xEnumAccess
=
Reference
<
container
::
XContentEnumerationAccess
>
(
m_xMgr
,
UNO_QUERY_THROW
);
Reference
<
container
::
XEnumeration
>
xEnum
=
xEnumAccess
->
createContentEnumeration
(
service
Name
);
Reference
<
container
::
XEnumeration
>
xEnum
=
xEnumAccess
->
createContentEnumeration
(
languageProvider
Name
);
// there will be only one service at the moment until registration
// details are sorted out.
if
(
xEnum
->
hasMoreElements
()
)
while
(
xEnum
->
hasMoreElements
()
)
{
Reference
<
lang
::
XSingleComponentFactory
>
factory
;
if
(
sal_False
==
(
xEnum
->
nextElement
()
>>=
factory
)
)
{
OSL_TRACE
(
"ProviderCache::populateCache() failed to extract factory from any"
);
throw
new
RuntimeException
(
::
rtl
::
OUString
::
createFromAscii
(
" error extracting XSingleComponentFactory from Content enumeration. "
),
Reference
<
XInterface
>
()
);
}
}
validateXRef
(
factory
,
"ProviderCache::populateCache() invalid factory"
);
Reference
<
lang
::
XServiceInfo
>
xServiceInfo
(
factory
,
UNO_QUERY_THROW
);
validateXRef
(
xServiceInfo
,
"ProviderCache::populateCache() failed to get XServiceInfo from factory"
);
OSL_TRACE
(
"ProviderCache::populateCache() processing element for implementation name %s"
,
::
rtl
::
OUStringToOString
(
xServiceInfo
->
getImplementationName
(),
RTL_TEXTENCODING_ASCII_US
).
pData
->
buffer
);
validateXRef
(
factory
,
"ProviderCache::getFactory() invalid factory"
);
Sequence
<
::
rtl
::
OUString
>
serviceNames
=
xServiceInfo
->
getSupportedServiceNames
(
);
if
(
serviceNames
.
getLength
()
>
0
)
{
for
(
sal_Int32
index
=
0
;
index
<
serviceNames
.
getLength
();
index
++
)
{
if
(
serviceNames
[
index
].
indexOf
(
providerKey
)
==
0
)
{
serviceName
=
serviceNames
[
index
];
OSL_TRACE
(
"ProviderCache::populateCache(), creating entry with factory for service %s"
,
::
rtl
::
OUStringToOString
(
serviceName
,
RTL_TEXTENCODING_ASCII_US
).
pData
->
buffer
);
ProviderDetails
details
;
details
.
factory
=
factory
;
m_hProviderDetailsCache
[
serviceName
]
=
details
;
break
;
}
}
}
}
}
catch
(
Exception
e
)
{
::
rtl
::
OUString
temp
=
OUSTR
(
"ProviderCache::
getFactory: could'n
t obtain XSingleComponentFactory for "
);
"ProviderCache::
populateCache: couldn'
t obtain XSingleComponentFactory for "
);
temp
.
concat
(
serviceName
);
throw
RuntimeException
(
temp
.
concat
(
e
.
Message
),
Reference
<
XInterface
>
()
);
}
return
factory
;
}
Reference
<
provider
::
XScriptProvider
>
...
...
@@ -257,7 +240,6 @@ ProviderCache::createProvider( ProviderDetails& details ) throw ( RuntimeExcepti
OSL_TRACE
(
"ProviderCache::createProvider()"
);
try
{
//details.provider = Reference< provider::XScriptProvider >( details.factory->createInstanceWithArguments( m_Sctx ), UNO_QUERY_THROW );
details
.
provider
=
Reference
<
provider
::
XScriptProvider
>
(
details
.
factory
->
createInstanceWithArgumentsAndContext
(
m_Sctx
,
m_xContext
),
UNO_QUERY_THROW
);
validateXRef
(
details
.
provider
,
"ProviderCache::createProvider, failed to create provider"
);
}
...
...
scripting/source/provider/ProviderCache.hxx
Dosyayı görüntüle @
1fc4b51c
...
...
@@ -2,9 +2,9 @@
*
* $RCSfile: ProviderCache.hxx,v $
*
* $Revision: 1.
1
$
* $Revision: 1.
2
$
*
* last change: $Author: npower $ $Date: 2003-09-
04 07:20:4
7 $
* last change: $Author: npower $ $Date: 2003-09-
15 14:32:3
7 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
...
...
@@ -111,10 +111,6 @@ public:
private
:
void
populateCache
()
throw
(
css
::
uno
::
RuntimeException
);
// getFactory( const ::rtl::OUString& serviceName ) throw ( RuntimeException );
//css::uno::Reference< css::lang::XSingleServiceFactory >
css
::
uno
::
Reference
<
css
::
lang
::
XSingleComponentFactory
>
getFactory
(
const
rtl
::
OUString
&
serviceName
)
throw
(
css
::
uno
::
RuntimeException
);
css
::
uno
::
Reference
<
dcsssf
::
provider
::
XScriptProvider
>
createProvider
(
ProviderDetails
&
details
)
throw
(
css
::
uno
::
RuntimeException
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment