As a developer, you can also create your own server properties, assign default values to them, and use those values in a class or a service method implementation.
First declare the server property name. Then associate it with a server.
To create a new server property name:
1. | Choose View, Objects List from the menu, and open the "Server Property Names" window or tab. |
2. | Create a new record for the new server property. Fill out the fields as appropriate. |
To associate the new server property with a server:
1. | Choose Define, Servers from the menu. |
2. | The Servers window or tab opens. |
3. | Click the Properties tab. |
4. | Choose your newly added server property from the dropdown box in the 'Property name' column. In the 'Property value' column, specify a value for the property. |
You can now use the property in a class or a service method implementation. Use the following java functions:
UServiceConfig.getConfigString(propertyName)
UServiceConfig.getConfigInt(propertyName)
Examples
String queueName = UServiceConfig.getConfigString("QUEUE_NAME");
int timeout = UServiceConfig.getConfigInt("WAIT_TIMEOUT");
There are some methods that can be used to get your class-specific property. You can make these using the syntax classname.property. Use the following java functions:
UServiceConfig.getConfigString(propertyName, class);
UServiceConfig.getConfigInt(propertyName, class);
Examples
String queueName = UServiceConfig.getConfigString("QUEUE_NAME", QueueProcessor.class); // Will get the property QueueProcessor.QUEUE_NAME
int timeout = UServiceConfig.getConfigInt("WAIT_TIMEOUT", QueueProcessor.class); // Will get the property QueueProcessor.WAIT_TIMEOUT
|