Page 1 of 1

How to store user's informations

Posted: Wed Jul 11, 2012 10:01 am
by sebastienlavandier
Hello,

I develop a plugin for the author, and I want to store different informations like server url, user name, password, ...

I found a method "StandalonePluginWorkspace.getOptionsStorage()" in the Author API. But could you say me where are store the informations, only in memory, or in a file also ?

Else how can I do that ? Maybe by using the other method "standalonePluginWorkspace.getPreferencesDirectory()" ?

Thanks in advance for you answer.
Seb.

Re: How to store user's informations

Posted: Wed Jul 11, 2012 10:22 am
by Radu
Hello Sebastien,
I found a method "StandalonePluginWorkspace.getOptionsStorage()" in the Author API. But could you say me where are store the informations, only in memory, or in a file also ?
The settings which you save are persistent, they are saved on disk when Oxygen is closed together with Oxygen's own internal preferences.
So this would be the API that you need.
Else how can I do that ? Maybe by using the other method "standalonePluginWorkspace.getPreferencesDirectory()"
You can use this method if you want to take full control over the format which is used to save the preferences, if you want to create your own preferences file and save it to Oxygen's preferences directory located in the user home. Probably not necessary in your case.

By the way, if you are saving passwords you can also use our API:

Code: Select all

ro.sync.exml.workspace.api.util.UtilAccess.encrypt(String)
and

Code: Select all

ro.sync.exml.workspace.api.util.UtilAccess.decrypt(String)
to encrypt the password before storing it and to decrypt it when retrieving it from the options storage.

Regards,
Radu

Re: How to store user's informations

Posted: Wed Jul 11, 2012 12:38 pm
by sebastienlavandier
Thanks Radu,

But if I want to store a user account, could I used the method :
standalonePluginWorkspace.getOptionsStorage().setOption() ?

and where data are stored ?

Thanks in advance for your answer.
Seb

Re: How to store user's informations

Posted: Wed Jul 11, 2012 2:02 pm
by Radu
Hi Sebastien,

Yes, you can use the options storage API to store simple key=>value pairs.
Oxygen has a preferences folder, depending on the operating system it is located in different places.
In this topic you can see at step (3) the locations on the preferences folder:

http://www.oxygenxml.com/doc/ug-oxygen/ ... alone.html

In that preferences folder there is an XML file which is used to store the Oxygen options along with the user-defined options.
The XML file is called something like:

oxyAuthorOptionsSa14.0.xml

or

oxyOptionsSa14.0.xml

depending on the installed kit (XML Author or XML Editor) and on the installed version.

Regards,
Radu

Re: How to store user's informations

Posted: Fri Jul 13, 2012 10:22 am
by sebastienlavandier
Thanks you Radu.