Hi Andreas,

Andreas Saeger escribió:
Hello,
I'm referring to http://www.openoffice.org/issues/show_bug.cgi?id=89534
It seems to be necessary to "unlock" an installed Java library before we
can use it with our beloved hsqldb. How do I actually "unlock" a Java
library? I followed the path outlined by Ariel and merged
<node oor:name="DriverSettings">
        <node oor:name="com.sun.star.sdbcx.comp.hsqldb.Driver">
                <node oor:name="PermittedJavaMethods">
                        <prop oor:name="Ariel Functions" oor:op="replace" 
oor:type="xs:string">
                                
<value>ar.com.arielconstenlahaile.dbextras.funcsql.Fechas.*</value>
                        </prop>
                </node>
        </node>
</node>

into DataAccess.xcu, which is the same registry file where all my
datasources are defined as well. This seems to correspond with the
definitions given in the respective DataAccess.xcs.


Oh, who had this great PermittedJavaMethods idea?
My dear, you have now to create an extension in order to merge this into your configuration!

I guess (=didn't try) that if you just add this to your /home/ariel/.openoffice.org2/user/registry/data/org/openoffice/Office/DataAccess.xcu it won't be cached.


Other way: try it with the configuration API (this one I tried, and WORKED, oh Lord!):

'***************************************************************************
Option Explicit

PRIVATE CONST DRIVER_SETTINGS_NODE_PATH = "org.openoffice.Office.DataAccess/DriverSettings"
PRIVATE CONST HSQLDB_DRIVER = "com.sun.star.sdbcx.comp.hsqldb.Driver"
PRIVATE CONST METHODS = "PermittedJavaMethods"

Sub HSQLDB_StoredProcedures

        Dim oConfig as Object   
        oConfig = getConfigurationAccess(DRIVER_SETTINGS_NODE_PATH, true)
        
        Dim oHsqlDriver as Object
        oHsqlDriver = oConfig.getByName(HSQLDB_DRIVER)
        
        Dim oJavaMethods as Object
        
        'Of course, simpler is to use the hierarchical mane directly ;-)
        
'"/org.openoffice.Office.DataAccess/DriverSettings/com.sun.star.sdbcx.comp.hsqldb.Driver/PermittedJavaMethods"
        oJavaMethods = oHsqlDriver.getByName(METHODS)
        
        Dim oNewMethod as Variant, sMethods$
        sMethods = "My Own HSQLDB StoredProcedures"
oNewMethod = "ar.com.arielconstenlahaile.dbextras.funcsql.Fechas.*" 'wow, wow, this is an any!
        
        oJavaMethods.insertByName(sMethods, oNewMethod)
        
        oConfig.commitChanges()
End Sub


Function getConfigurationAccess( _
                                                                        
sNodePath$,_
                                                                        bUpdate 
as Boolean,_
                                                                        
Optional aLocale$ _
                                                                )
REM Param. aLocale es STRING, NO com.sun.star.lang.Locale
'       p.e.    "es", "es-AR"
'                       "*" para TODAS
        On Error GoTo getConfigurationAccessErrorHandler

        Dim sConfigurationProvider$, oConfigurationProvider as Object
        Dim sConfigurationAccess$, sConfigurationUpdateAccess$, sConfiguration$
        Dim oConfigurationAccess as Object
        
        sConfigurationProvider = 
"com.sun.star.configuration.ConfigurationProvider"
        oConfigurationProvider = createUNOService(sConfigurationProvider)
        
        Dim oParametros(0) As New com.sun.star.beans.PropertyValue
        oParametros(0).Name = "nodepath"
        oParametros(0).Value = sNodePath
        
        sConfigurationAccess   = 
"com.sun.star.configuration.ConfigurationAccess"
sConfigurationUpdateAccess = "com.sun.star.configuration.ConfigurationUpdateAccess"
        
        if bUpdate then
                ReDim Preserve oParametros(1)
                oParametros(1).Name = "EnableAsync"
                oParametros(1).Value = FALSE
                sConfiguration = sConfigurationUpdateAccess
        else
                sConfiguration = sConfigurationAccess
        end if
        
        if NOT IsMissing(aLocale) then
                Dim n%
                n = UBound(oParametros)+1
                ReDim Preserve oParametros(n)
                oParametros(n).Name = "Locale"
                oParametros(n).Value = aLocale
        end if
                
        oConfigurationAccess = 
oConfigurationProvider.createInstanceWithArguments(_
                                                                                
sConfiguration, oParametros())
        
        getConfigurationAccessCleanUp:                                          
                        
                getConfigurationAccess() = oConfigurationAccess
                Exit Function
                getConfigurationAccessErrorHandler:
                        Resume getConfigurationAccessCleanUp
End Function
'********************************************************************************



that will create


 <node oor:name="DriverSettings">
  <node oor:name="com.sun.star.sdbcx.comp.hsqldb.Driver">
   <node oor:name="PermittedJavaMethods">
<prop oor:name="My Own HSQLDB StoredProcedures" oor:op="replace" oor:type="xs:string">
     <value>ar.com.arielconstenlahaile.dbextras.funcsql.Fechas.*</value>
    </prop>
   </node>
  </node>
 </node>


I've tried this and worked.
Hope it works for you too.

Regards
Ariel.


--
Ariel Constenla-Haile
La Plata, Argentina

[EMAIL PROTECTED]
[EMAIL PROTECTED]

http://www.ArielConstenlaHaile.com.ar/ooo/



"Aus der Kriegsschule des Lebens
                - Was mich nicht umbringt,
        macht mich härter."
                Nietzsche Götzendämmerung, Sprüche und Pfeile, 8.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to