How to store user's informations

Post here questions and problems related to oXygen frameworks/document types.
sebastienlavandier
Posts: 124
Joined: Tue May 29, 2012 5:42 pm

How to store user's informations

Post by sebastienlavandier » Wed Jul 11, 2012 10:01 am

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.

Radu
Posts: 6979
Joined: Fri Jul 09, 2004 5:18 pm

Re: How to store user's informations

Post by Radu » Wed Jul 11, 2012 10:22 am

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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

sebastienlavandier
Posts: 124
Joined: Tue May 29, 2012 5:42 pm

Re: How to store user's informations

Post by sebastienlavandier » Wed Jul 11, 2012 12:38 pm

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

Radu
Posts: 6979
Joined: Fri Jul 09, 2004 5:18 pm

Re: How to store user's informations

Post by Radu » Wed Jul 11, 2012 2:02 pm

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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

sebastienlavandier
Posts: 124
Joined: Tue May 29, 2012 5:42 pm

Re: How to store user's informations

Post by sebastienlavandier » Fri Jul 13, 2012 10:22 am

Thanks you Radu.

Post Reply