Quantcast

How to configure plugin properties

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to configure plugin properties

Andrea Patricelli
Hi all,

I'm developing a custom plugin to connect to a web application.
The plugin needs host, protocol, port and credentials of the web
application to connect to it and then run.
At first startup the plugin asks to the user to insert these values.

Is there a best practice or a kind of "classpath" under which I can put
these properties? I mean a way to package a default file and then read
it without knowing the full path of the file.
Is there a kind of properties directory?

Best regards,
Andrea

--
Dott. Andrea Patricelli
Tel. +39 3204524292

Developer @ Tirasa S.r.l.
Viale D'Annunzio 267 - 65127 Pescara
Tel +39 0859116307 / FAX +39 0859111173
http://www.tirasa.net

Apache Syncope PMC Member

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to configure plugin properties

Oliver Rettig
Hi,

I am not sure what exactly you want to do, but maybe this helps:

Inside your netbeans module - in a subfolder with the name "release" of the
folder where is your netbeans module you can save files.

This files are automatically copied with the build process of the module.

In your code you can access thes files by

org.openide.modules.InstalledFileLocator

e.g.

  File glaRightSideLabelSetFile = InstalledFileLocator.
                getDefault().locate("gla-right-labelset.xml",
                        "de.orat.gaitlabhd.hdascii.fileType", false);

best regards
Oliver



> Hi all,
>
> I'm developing a custom plugin to connect to a web application.
> The plugin needs host, protocol, port and credentials of the web
> application to connect to it and then run.
> At first startup the plugin asks to the user to insert these values.
>
> Is there a best practice or a kind of "classpath" under which I can put
> these properties? I mean a way to package a default file and then read
> it without knowing the full path of the file.
> Is there a kind of properties directory?
>
> Best regards,
> Andrea


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to configure plugin properties

Boris Heithecker
In reply to this post by Andrea Patricelli
If it's only a few string-like properties, you could use NbPreferences.forModule(YourClass.class).... to store and retrieve your properties. 
It's easy, because you don't have to bother about files, persistences, places and so on. Preferences are persisted by the platform. 
Boris

2017-04-18 15:37 GMT+02:00 Andrea Patricelli <[hidden email]>:
Hi all,

I'm developing a custom plugin to connect to a web application.
The plugin needs host, protocol, port and credentials of the web application to connect to it and then run.
At first startup the plugin asks to the user to insert these values.

Is there a best practice or a kind of "classpath" under which I can put these properties? I mean a way to package a default file and then read it without knowing the full path of the file.
Is there a kind of properties directory?

Best regards,
Andrea

--
Dott. Andrea Patricelli
Tel. <a href="tel:%2B39%203204524292" value="+393204524292" target="_blank">+39 3204524292

Developer @ Tirasa S.r.l.
Viale D'Annunzio 267 - 65127 Pescara
Tel <a href="tel:%2B39%200859116307" value="+390859116307" target="_blank">+39 0859116307 / FAX <a href="tel:%2B39%200859111173" value="+390859111173" target="_blank">+39 0859111173
http://www.tirasa.net

Apache Syncope PMC Member




--
Boris Heithecker


Dr. Boris Heithecker
Lüneburger Str. 30
28870 Ottersberg
Tel.: 0 42 05/ 31 58 34
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to configure plugin properties

Andrea Patricelli-2

Hi Boris,

That's great, it is what I was looking for!

Best regards,
Andrea


Il 19/04/2017 19:10, Boris Heithecker ha scritto:
If it's only a few string-like properties, you could use NbPreferences.forModule(YourClass.class).... to store and retrieve your properties. 
It's easy, because you don't have to bother about files, persistences, places and so on. Preferences are persisted by the platform. 
Boris

2017-04-18 15:37 GMT+02:00 Andrea Patricelli <[hidden email]>:
Hi all,

I'm developing a custom plugin to connect to a web application.
The plugin needs host, protocol, port and credentials of the web application to connect to it and then run.
At first startup the plugin asks to the user to insert these values.

Is there a best practice or a kind of "classpath" under which I can put these properties? I mean a way to package a default file and then read it without knowing the full path of the file.
Is there a kind of properties directory?

Best regards,
Andrea

--
Dott. Andrea Patricelli
Tel. <a moz-do-not-send="true" href="tel:%2B39%203204524292" value="+393204524292" target="_blank">+39 3204524292

Developer @ Tirasa S.r.l.
Viale D'Annunzio 267 - 65127 Pescara
Tel <a moz-do-not-send="true" href="tel:%2B39%200859116307" value="+390859116307" target="_blank">+39 0859116307 / FAX <a moz-do-not-send="true" href="tel:%2B39%200859111173" value="+390859111173" target="_blank">+39 0859111173
http://www.tirasa.net

Apache Syncope PMC Member




--
Boris Heithecker


Dr. Boris Heithecker
Lüneburger Str. 30
28870 Ottersberg
Tel.: 0 42 05/ 31 58 34

-- 
Dott. Andrea Patricelli
Tel. +39 3204524292

Developer @ Tirasa S.r.l.
Viale D'Annunzio 267 - 65127 Pescara
Tel +39 0859116307 / FAX +39 0859111173
http://www.tirasa.net

Apache Syncope PMC Member
Loading...