Application Properties

Hello,

How can I define a list of properties externally, without having to change the source, as well as retrieve these properties in my code?

I have noticed in the bottom of the Servoy Admin Page two fields system.properites and user.properties, so I was wondering If I should use them. I tried and I couldn’t even add a value to those fields. Why they don’t have a info button like the others after all?

Thank you.

Hi,

We have a few extra tables to store these properties.
The forms to edit them are only accesible for the administrator.

They are copied to globals when the users login.

Regards,

Hans

Sorry, but I didn’t understand what you said. Could you give me an example?

You have “few” tables to store properties? Why more than one? What are the differences? In which database are they at?

Hans Nieuwenhuis:
They are copied to globals when the users login.

What globals are you referring? How can I access it?

Anyway, what I want is a way to CUSTOMIZE my own properties and be able to get them from code.

Thank you.

User properties can be set/get through application.get/setUserProperty().

Serverside, in the servoy.properties, you can insert some default values for them. Those will show also on the admin pages in the area you saw.

Paul

Our UserManager plugin allows you to read and write any property to either a client’s or the server’s property file. Is that what you want?

pbakker:
Serverside, in the servoy.properties, you can insert some default values for them. Those will show also on the admin pages in the area you saw.

Yes, I saw the area to enter system and user properties as the picture I sent before shows. However I couldn’t add any parameter there. In this case, I have A NEW PROBLEM, what’s going on with those fields that never accept new values?

patrick:
Our UserManager plugin allows you to read and write any property to either a client’s or the server’s property file. Is that what you want?

Thanks for the suggestion, but I’ve noticed it’s not free and actually it has much more than what I need. If Servoy could handle through the getProperty method would be great.

Cheers,

If Servoy could handle everything, there wouldn’t be much space for plugins :wink:

You can add them directly in the servoy.properties file, but you should also be able to edit them directly on the admin page.

I’ve just tried this and this works just fine in Servoy 4.1.2.

Paul

pbakker:
You can add them directly in the servoy.properties file, but you should also be able to edit them directly on the admin page.

That’s just weird, I’ve tried to do both ways and nothing. The property simply disappears as soon as I save the changes. My question is: Is there any configuration in the application server that could be avoiding me save the properties?

Thanks.

Ah, you can edit (and save), but after you save they disappear.

Most likely, you are entering properties that aren’t prefixes properly.

System properties have to start with “system.”.

Use properties have to start with “user.”.

The fields on the admin page also filter on that.

Paul

Beautiful. It works, but just for user properties. The same problem of disappearing found for system properties, even using the correct prefix. Any ideas? Are we not supposed to use that field?

Just for reference, I had to reference them in code using application.getUserProperty() passing the property name without the prefix. Hey, Servoy! Why not have a “info” button like all the other fields have with all this information.

One last and important question: Is there any way of saving properties in the client machine for remembering the user, like web cookies for example?

Cheers,

This is also something that can be done with the UserManager plugin :) .

and, oh boy, I LOVE that plugin! ;-)

user properties ARE client specific properties, so each client can have it’s own value for a specific property.

The option “user.properties” on the admin pages is only to supply a client with default values for them.

User properties work transparently in both the Smart and WebClient.

I stand corrected on the prefix for the system properties: it’s not just “system.” but “system.property.”

Paul

pbakker:
user properties ARE client specific properties, so each client can have it’s own value for a specific property.

In this case, I can assume that if I use application.setUserProperty(), it will somehow store the property in the client’s machine and the application will be able to get it further even after a shutdown?

If that’s the case, could you please explain where these properties are saved in the client’s machine? Which file?

I’m very grateful for the help given so far. Just need to know this little more. I couldn’t find any documentation about it.

Thank you.

The properties file is inside the .servoy folder that is in the user’s directory. I can’t recommend writing there by using the file plugin, however. I could imagine that your changes are overwritten in certain cases…

How do I read a system property, defined as mentioned above with the prefix system.property?

patrick:
I can’t recommend writing there by using the file plugin, however

Well, can I use the function application.getUserProperty() for reading the user properties stored in .servoy client folder? Where is this folder saved? Sorry, I couldn’t find it. And again, are those user properties recorded in the client’s machine by the function application.setUserProperty()?

Does anyone use this in your applications? How do you define specific application configuration properties?

Anyway, if Servoy could put a “info” button for these fields in the admin page would have helped me a lot.

Cheers,

Hi,

May be this article http://www.servoymagazine.com/home/2008 … lient.html helps you to access servoy.property file.

Thanks

Thank you for the link, but I still need help with this. The article is about reading properties from a database server. I want to be able to very simply read the system property from the file. I wish to access the server of one of our customer and simply edit a property with a notepad or through Servoy admin page.

There must be a way to do this in Servoy, otherwise what is the purpose of having that field system.properties on the bottom of Admin Page?

Also, the user properties are not clear in the way they actually work. If they can be stored in the client remote machine, etc.

Thank you,

Hi Juliano,

I’m not sure what is not clear about the workings of the user properties. As said before, user properties set with the application.get/setUserProperty() are client specific.

The user.properties field on the admin pages allows you to set a default value serverside for these same properties. Once the client starts, it gets these default values.

Where they are stored shouldn’t really matter. What’s important is that they are client specific, can be edited/retrieved using the application.get/setUserProperty() functions and can get a default value when the client starts by adding them (with “user.” prefix) to the user properties field on the admin pages.

As for the system properties: These are “system” properties, as in Java stuff. We added the ability to add/edit system properties, because some customers had a need for it. If you need to read system properties clientside, you need some Java code, but in general you don’t need to access system properties in the client.

You need seems to be to edit the servoy.properties file of the server of your customer(s). There is no mechanism to do this from the client in servoy. On the admin pages, there is no direct way to do this, but most of the properties are linked to functionality you do find ont he admin pages, like the Database Servers page on the Admin Pages etc.

Hope it’s clear now.

Paul