on 12/1/2000 1:01 AM, "Magn�s ��r Torfason" <[EMAIL PROTECTED]> wrote:
> Calling getConfigurations("my.service") returns a Configurations containing
> the values:
>
> name=MyService
> value=352
> anothervalue=0
>
> It is very valuable for me to have the option to pass configurations with
> values that are not dependent on the service in question, and lacking a
> better place, I submit the patch here, since it is not being developed in
> it's original place (jserv).
>
> Magnus
Hi Magnus, I believe that the Services API already offers this
functionality.
<http://www.working-dogs.com/turbine/cvsweb/index.cgi/turbine/src/java/org/a
pache/turbine/services/TurbineServices.java?rev=1.4&content-type=text/x-cvsw
eb-markup>
Here is the code:
/**
� � * Returns the properites of a specific service. �Properties are
� � * retrieved from TurbineResources.properties provided that you
� � * have the following entires:
� � *
� � * <br>
� � *
� � * services.MyService.greeting=Hello, I'm Jan B.
� � *
� � * <br>
� � *
� � * services.MyService.defaultAction=beep
� � *
� � * <br>
� � *
� � * Service "MyService" will get a set of two properites:
� � * "greeting" = "Hello, I'm Jan B." and "defaultAction" = "beep".
� � *
� � * @param name The name of the service.
� � * @return Properties of requested Service.
� � */
� �public Properties getProperties( String name )
� �{
� � � �Properties properties = new Properties();
� � � �Enumeration keys =
TurbineResources.getKeys(SERVICE_PREFIX+name+".");
� � � �int pref = SERVICE_PREFIX.length()+name.length()+1;
� � � �while(keys.hasMoreElements())
� � � �{
� � � � � �String key = (String)keys.nextElement();
� � � � � �properties.put(key.substring(pref),
TurbineResources.getString(key));
� � � �}
� � � �return properties;
� �}
-jon
--
twice of not very much is still a lot more than not very much
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]