Page 1 of 1

DropboxOOo

PostPosted: Sun May 26, 2019 8:49 am
by psilocybe
Hello everyone,

Just to say that I finally managed to finish the extension for Dropbox. (Just 200 lines of code, but I had to modify OAuth2OOo and CloudUcpOOO also)

https://github.com/prrvchr/DropboxOOo/raw/master/DropboxOOo.oxt

I remind you that you must first install the two extensions OAuth2OOo and CloudUcpOOo.

It is functional under Linux, but I still have malfunctions under Windows that I have trouble adjusting (lack of time and especially Windows computer)

The excellent API Python Request is now accessible from Basic, normally (I have not tested yet) since I can now compile the IDL files, here is the copy describing the available interfaces:

Code: Select all   Expand viewCollapse view
#ifndef __com_sun_star_auth_XOAuth2Service_idl__
#define __com_sun_star_auth_XOAuth2Service_idl__

#include <com/sun/star/uno/XInterface.idl>
#include <com/sun/star/auth/RestRequestParameter.idl>
#include <com/sun/star/auth/XRestKeyMap.idl>
#include <com/sun/star/beans/Optional.idl>
#include <com/sun/star/io/XInputStream.idl>
#include <com/sun/star/io/XOutputStream.idl>
#include <com/sun/star/container/XEnumeration.idl>
#include <com/sun/star/sdbc/XConnection.idl>

module com { module sun { module star { module auth {

interface XOAuth2Service: com::sun::star::uno::XInterface
{

    void initializeSession([in] string ResourceUrl);
    boolean initializeUser([in] string UserName);
    short getSessionMode([in] string Host);
    string getToken([in] string Format);
    ::com::sun::star::beans::Optional<::com::sun::star::auth::XRestKeyMap> execute([in] RestRequestParameter Parameter);
    ::com::sun::star::container::XEnumeration getEnumerator([in] RestRequestParameter Parameter);
    ::com::sun::star::io::XInputStream getInputStream([in] RestRequestParameter Parameter,
                                                      [in] long Chunk,
                                                      [in] long Buffer);
    ::com::sun::star::uno::XInterface getUploader([in] ::com::sun::star::sdbc::XConnection Connection,
                                                  [in] ::com::sun::star::uno::XInterface Provider);

    [attribute, readonly] ::com::sun::star::uno::XInterface Setting;
    [attribute, readonly] ::com::sun::star::uno::XInterface Session;
    [attribute] string ResourceUrl;
    [attribute] string UserName;
    [attribute] string Error;

};


}; }; }; };

#endif


The OAuth2Service service must first be loaded in order to make the imports available.

I had as a project to make a version for ICloud, it will not be possible, Apple using only proprietary solutions, own SDK, no OAuth2 ... (amazing no), too bad.

For the Linuxiens, good test for the Windoziens unless you are brave, it will have to wait a little longer.

Good test ...

Re: DropboxOOo

PostPosted: Sat Jun 01, 2019 1:14 pm
by psilocybe
Hi,

It is functional under Linux, but I still have malfunctions under Windows that I have trouble adjusting (lack of time and especially Windows computer)


I finally managed to find the malfunction, it is not related to Window but to LibreOffice which requires the modification of the Java environment as described here:
https://github.com/prrvchr/CloudUcpOOo/blob/master/README.md

Before any test, please reinstall the latest version taking care to uninstall before any update.

Re: DropboxOOo

PostPosted: Sat Jun 01, 2019 9:04 pm
by Villeroy
CloudUcpOOo/blob/master/README.md wrote:Put hsqldb-2.4.1.jar somewhere on your hard drive.
In menu Tools - Options - LibreOffice - Advanced - Click Class Path... and Add Archive...

If you do that, any embedded HSQL databases will be converted on the fly and stop working.

1. Download any database with embedded HSQL from the Base forum such as download/file.php?id=35509
2. Open the database and then any object therein (table, query, form, report) to establish a connection and on-the-fly conversion from HSQL 1 to HSQL 2.
3. Close the database.
4. Reopen the database.
error wrote:The connection could not be established. The database was created by a newer version of OpenOffice.


A quick and dirty Basic function returning the URL of the shipped hsqldb.jar:
Code: Select all   Expand viewCollapse view
Function getDefaultJarPath()
Dim obj1, sprog$
REM get path of preinstalled hsqldb.jar
    obj1 = createUnoService("com.sun.star.util.PathSubstitution")
    sprog = obj1.substituteVariables("$(prog)", True)
    getDefaultJarPath = sprog &"/classes/hsqldb.jar"
End Function

HSQL 1.8 is documented here: http://www.hsqldb.org/doc/1.8/guide/ch09.html
It should be able to do what you need.

Re: DropboxOOo

PostPosted: Sun Jun 02, 2019 11:33 am
by psilocybe
Hi Villeroy,

If you do that, any embedded HSQL databases will be converted on the fly and stop working.


You are unfortunately right, I did not find anything to successfully run hsqldb 2.4.1 under LibreOffice without breaking everything ... :crazy:

It seems that LibreOffice launches the JDBC driver in a Java virtual machine without modifying the ClassPath (it does not add the JDBC jar archive to ClassPath)... While it works perfectly with OpenOffice :ucrazy:

I have no solution except a correction from LibreOffice :ouch: , or to return to version 1.8 ... :knock:
I am not sure to find all that I need.

In any case ... thank you for your help...

Re: DropboxOOo

PostPosted: Sun Jun 02, 2019 12:08 pm
by Villeroy
Same problem with AOO with HSQL2 in the class path. You can use database connections to HSQL 2.x with Base documents. Just specify the HSQL driver in the individual document settng. I guess you want to maintain a small in-memory database to store the user's cloud credentials and URLs. This might be possible with HSQL 1.8 as well.

This is a little Python script which converts an embedded HSQLDB to external HSQL2 connections without breaking other embedded databases: viewtopic.php?f=21&t=86071

Code: Select all   Expand viewCollapse view
  oCurrentController = dbDoc.getCurrentController()
  oDataSource = oCurrentController.DataSource
  oSettings = oDataSource.Settings

These settings have a property JavaDriverClass which is always "org.hsqldb.jdbcDriver" and JavaDriverClassPath which is the file: URL to hsqldb.jar.

Your code might not utilize any database document. I just wanted to outline how the problem can be avoided in the context of a Base connection when adding a gloabal ClassPath to HSQL is not an option.

Re: DropboxOOo

PostPosted: Sun Jun 02, 2019 12:52 pm
by psilocybe
Same problem with AOO with HSQL2 in the class path.


I'm just a beginner, especially in Java, but for me it works as it should under OpenOffice:
I connect with XDriverManager.getConnectionWithInfo () and put the path to the JDBC jar in Info's JavaDriverClassPath, don't need to modify the User ClassPath, juste to package the JDBC jar into the extension and know it location...

it would be really nice if it worked well under LibreOffice... but I have never managed to connect to a hsqldb database other than 1.8 without modifying the User ClassPath.

I'm going to watch your macro: ExtractHSQL.py.odt
Yet I seem to have already tried, according to your advice elsewhere, to save the JavaDriverClassPath in an odb file, the connection always asks me to change the User ClassPath under LibreOffice at least.

This might be possible with HSQL 1.8 as well.

I have to list what I use in 2.4.1 which is not in 1.8...