You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Kelvin Tan <ke...@relevanz.com> on 2002/02/28 03:36:13 UTC

[stratum-configuration] Absence of methods to specify defaults

Hi,

Is there any particular reason why the methods to specify defaults are
absent for byte, double, float and short? If there aren't, I'll go ahead and
submit a patch for them, as ExtendedProperties supported it and I need them
in my app.

Regards,
Kelvin Tan

Relevanz Pte Ltd
http://www.relevanz.com

180B Bencoolen St.
The Bencoolen, #04-01
S(189648)

Tel: 238 6229
Fax: 337 4417



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [stratum-configuration] Absence of methods to specify defaults

Posted by Kelvin Tan <ke...@relevanz.com>.
Here's the patch. Odd that the methods were implemented in
BaseConfiguration, but not declared in Configuration interface.

Another thing. Regarding XmlConfiguration, I've an initial implementation
based on JDom. Should I submit it, or is SAX/DOM preferred for some reason?

cvs diff Configuration.java (in directory
C:\checkout\jakarta-turbine-stratum\src\java\org\apache\stratum\configuratio
n\)
Index: Configuration.java
===================================================================
RCS file:
/home/cvspublic/jakarta-turbine-stratum/src/java/org/apache/stratum/configur
ation/Configuration.java,v
retrieving revision 1.4
diff -r1.4 Configuration.java
91a92
>     byte getByte(String key, byte defaultValue);
92a94
>     double getDouble(String key, double defaultValue);
93a96
>     float getFloat(String key, float defaultValue);
100a104
>     short getShort(String key, short defaultValue);

Regards,
Kelvin

----- Original Message -----
From: "Kelvin Tan" <ke...@relevanz.com>
To: "Turbine Developers List" <tu...@jakarta.apache.org>
Sent: Thursday, February 28, 2002 10:36 AM
Subject: [stratum-configuration] Absence of methods to specify defaults


> Hi,
>
> Is there any particular reason why the methods to specify defaults are
> absent for byte, double, float and short? If there aren't, I'll go ahead
and
> submit a patch for them, as ExtendedProperties supported it and I need
them
> in my app.
>
> Regards,
> Kelvin Tan
>
> Relevanz Pte Ltd
> http://www.relevanz.com
>
> 180B Bencoolen St.
> The Bencoolen, #04-01
> S(189648)
>
> Tel: 238 6229
> Fax: 337 4417
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Turbine 3:DefaultResolver question

Posted by Chris Holman <ch...@owl.co.uk>.
If the method

String template = aDefaultResolver.getTemplate("moduleType", "");

is called, it currently throws an exception because a templatePath == "" is
deemed invalid.
Wouldnt it be better to return "default.vm"? See code below. Or is there
some underlying requirement for this functionality?

Chris

public class DefaultResolver
    implements Resolver, TurbineConstants
{
...
   public String getTemplate(String moduleType, String targetTemplate)
        throws Exception
    {
        return findTemplate(moduleType, targetTemplate);
    }

    protected String findTemplate(String moduleType, String targetTemplate)
        throws Exception
    {
        StringBuffer sb = new StringBuffer();
/******************************************
 * EXCEPTION THROWN HERE BY: parseTemplatePath("", sb)
 * Wouldnt it be better to catch this exception and
 * allow getPossibleTemplates("") to return "default.vm"?
 * Would require small mod to parseTemplatePath, as
 * this exception indicates a malformed template path.
 ******************************************
        int i = PipelineUtil.parseTemplatePath(targetTemplate, sb);
        Iterator j = getPossibleTemplates(sb.toString());

        while (j.hasNext())
        {
            String template = moduleType + "/" + (String) j.next();
            if (Module.templateExists(template))
            {
                return template;
            }
        }

        // We should have a default template type for
        // each corresponding module and a default extension.
        return moduleType + defaultTemplate;
    }



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>