You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by Thorsten Scherler <th...@juntadeandalucia.es> on 2008/02/21 09:56:32 UTC

forrest.properties vs forrest.properties.xml

Hi all,

to harmonize the definition of properties IMO we should limit us to one
file. This should be forrest.properties.xml.

I played around:
Index: forrest.build.xml
===================================================================
--- forrest.build.xml   (revision 629705)
+++ forrest.build.xml   (working copy)
@@ -77,6 +77,9 @@
 <!-- people should use -D switch, or <ant><property>s to override these
-->
     <property name="project.home" location="." />
-    <property file="${project.home}/forrest.properties" />
+    <xmlproperty file="${project.home}/forrest.properties.xml" 
+      semanticAttributes="true" keepRoot="false"/>
+    <echoproperties destfile="${project.home}/filter.properties"/>

The last line is for debugging, but till now I did not get the
properties as I want them.

It will result in something like:
property=pelt,.fv,group,project
property.name=dispatcher.theme,dispatcher.theme-ext,group-name,project-name

However regarding
http://ant.apache.org/manual/CoreTasks/xmlproperty.html if I enable
semanticAttributes and use:
<properties>
<!--
    # codename: Dispatcher
    # Dispatcher is using a fallback mechanism for theming.
    # You can configure the theme name and its extension here
    -->
  <property id="dispatcher.theme" value="pelt"/>
  <property id="dispatcher.theme-ext" value=".fv"/>
...

I expected to find 
dispatcher.theme=pelt
but i now only get:
property=pelt,.fv,group,project

Somebody had used the <xmlproperty/> successfully?

salu2
-- 
Thorsten Scherler                                 thorsten.at.apache.org
Open Source Java                      consulting, training and solutions


Re: forrest.properties vs forrest.properties.xml

Posted by Thorsten Scherler <th...@juntadeandalucia.es>.
On Thu, 2008-02-21 at 20:18 +1100, David Crossley wrote:
> Thorsten Scherler wrote:
> > 
> > Somebody had used the <xmlproperty/> successfully?
> 
> We use it elsewhere in our build system:
> 
> main/build.xml
> main/forrest.build.xml
> tools/forrestbar/build.xml
> 
> Do those examples help?

Hmm, the <xmlproperty/> works though the only thing is the
semanticAttributes="true". That just does not seems to work.

Thanks for the links.

salu2

> 
> -David
-- 
Thorsten Scherler                                 thorsten.at.apache.org
Open Source Java                      consulting, training and solutions


Re: forrest.properties vs forrest.properties.xml

Posted by David Crossley <cr...@apache.org>.
Thorsten Scherler wrote:
> 
> Somebody had used the <xmlproperty/> successfully?

We use it elsewhere in our build system:

main/build.xml
main/forrest.build.xml
tools/forrestbar/build.xml

Do those examples help?

-David

Re: forrest.properties vs forrest.properties.xml

Posted by Ross Gardler <rg...@apache.org>.
Thorsten Scherler wrote:
> On Thu, 2008-02-21 at 20:37 +1100, David Crossley wrote:
>> Thorsten Scherler wrote:
>>> Thorsten Scherler wrote:
>>>
>>> Actually doing a wee bit research I wonder why we are not using the
>>> properties dtd from sun:
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
>>> <properties>
>>>     <entry key="plugin.TestPlugin">com.plugin.test.TestPluginModule</entry>
>>>     <entry key="messages.TestPlugin">TestPluginMessages.properties</entry>
>>> </properties>
>>>
>>> This has the benefit to do a
>>> Properties properties = new Properties();
>>> try {
>>>     InputStream xmlStream = getClass().getResourceAsStream("forrest.properties.xml");
>>>     if( xmlStream == null ) {
>>>          //throw some error
>>>     }            
>>>     properties.loadFromXML(xmlStream);
>>> } catch (IOException exception) {
>>>     // throw exception
>>> }
>> Sure.
> 
> Hmm, I think that is not that easy though since there is code that is
> using our custom dtd. 
> 
> Maybe Ross (as I can recall the first in using it) can tell us why we
> did not used the java one.

I didn't use it as I needed a quick fix for an immediate problem in a 
plugin. I did not do research into the best approach, at the time I said 
we need to explore the options before making it default.

You are doing this now (thanks).

In other words, do anything you want to make it happen, I'm not aware of 
any gotchas.

Thanks,
Ross

Re: forrest.properties vs forrest.properties.xml

Posted by Thorsten Scherler <th...@juntadeandalucia.es>.
On Thu, 2008-02-21 at 20:37 +1100, David Crossley wrote:
> Thorsten Scherler wrote:
> > Thorsten Scherler wrote:
> > 
> > Actually doing a wee bit research I wonder why we are not using the
> > properties dtd from sun:
> > <?xml version="1.0" encoding="UTF-8"?>
> > <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
> > <properties>
> >     <entry key="plugin.TestPlugin">com.plugin.test.TestPluginModule</entry>
> >     <entry key="messages.TestPlugin">TestPluginMessages.properties</entry>
> > </properties>
> > 
> > This has the benefit to do a
> > Properties properties = new Properties();
> > try {
> >     InputStream xmlStream = getClass().getResourceAsStream("forrest.properties.xml");
> >     if( xmlStream == null ) {
> >          //throw some error
> >     }            
> >     properties.loadFromXML(xmlStream);
> > } catch (IOException exception) {
> >     // throw exception
> > }
> 
> Sure.

Hmm, I think that is not that easy though since there is code that is
using our custom dtd. 

Maybe Ross (as I can recall the first in using it) can tell us why we
did not used the java one.

salu2
-- 
Thorsten Scherler                                 thorsten.at.apache.org
Open Source Java                      consulting, training and solutions


Re: forrest.properties vs forrest.properties.xml

Posted by David Crossley <cr...@apache.org>.
Thorsten Scherler wrote:
> Thorsten Scherler wrote:
> 
> Actually doing a wee bit research I wonder why we are not using the
> properties dtd from sun:
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
> <properties>
>     <entry key="plugin.TestPlugin">com.plugin.test.TestPluginModule</entry>
>     <entry key="messages.TestPlugin">TestPluginMessages.properties</entry>
> </properties>
> 
> This has the benefit to do a
> Properties properties = new Properties();
> try {
>     InputStream xmlStream = getClass().getResourceAsStream("forrest.properties.xml");
>     if( xmlStream == null ) {
>          //throw some error
>     }            
>     properties.loadFromXML(xmlStream);
> } catch (IOException exception) {
>     // throw exception
> }

Sure. Please ensure that you use a Public Identifier and
configure our schema catalog. Just follow some other
examples and we do have some docs somewhere.

Can we re-distribute that DTD? (No time to look sorry,
going away now for weekend. Perhaps legal-discuss archives.)
I sure hope so, we don't want to hit their server for
every parse of an xml instance.

[OT a bit] By the way, did everyone see:
http://www.w3.org/blog/systeam/2008/02/08/w3c_s_excessive_dtd_traffic
"W3C Systeam's blog - W3C's Excessive DTD Traffic"

At Forrest we have been pretty good in this regard.

-David

Re: forrest.properties vs forrest.properties.xml

Posted by Thorsten Scherler <th...@juntadeandalucia.es>.
On Thu, 2008-02-21 at 09:56 +0100, Thorsten Scherler wrote:
> Hi all,
> 
> to harmonize the definition of properties IMO we should limit us to one
> file. This should be forrest.properties.xml.
> 

Actually doing a wee bit research I wonder why we are not using the
properties dtd from sun:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
    <entry key="plugin.TestPlugin">com.plugin.test.TestPluginModule</entry>
    <entry key="messages.TestPlugin">TestPluginMessages.properties</entry>
</properties>

This has the benefit to do a
Properties properties = new Properties();
try {
    InputStream xmlStream = getClass().getResourceAsStream("forrest.properties.xml");
    if( xmlStream == null ) {
         //throw some error
    }            
    properties.loadFromXML(xmlStream);
} catch (IOException exception) {
    // throw exception
}

salu2

> I played around:
> Index: forrest.build.xml
> ===================================================================
> --- forrest.build.xml   (revision 629705)
> +++ forrest.build.xml   (working copy)
> @@ -77,6 +77,9 @@
>  <!-- people should use -D switch, or <ant><property>s to override these
> -->
>      <property name="project.home" location="." />
> -    <property file="${project.home}/forrest.properties" />
> +    <xmlproperty file="${project.home}/forrest.properties.xml" 
> +      semanticAttributes="true" keepRoot="false"/>
> +    <echoproperties destfile="${project.home}/filter.properties"/>
> 
> The last line is for debugging, but till now I did not get the
> properties as I want them.
> 
> It will result in something like:
> property=pelt,.fv,group,project
> property.name=dispatcher.theme,dispatcher.theme-ext,group-name,project-name
> 
> However regarding
> http://ant.apache.org/manual/CoreTasks/xmlproperty.html if I enable
> semanticAttributes and use:
> <properties>
> <!--
>     # codename: Dispatcher
>     # Dispatcher is using a fallback mechanism for theming.
>     # You can configure the theme name and its extension here
>     -->
>   <property id="dispatcher.theme" value="pelt"/>
>   <property id="dispatcher.theme-ext" value=".fv"/>
> ...
> 
> I expected to find 
> dispatcher.theme=pelt
> but i now only get:
> property=pelt,.fv,group,project
> 
> Somebody had used the <xmlproperty/> successfully?
> 
> salu2
-- 
Thorsten Scherler                                 thorsten.at.apache.org
Open Source Java                      consulting, training and solutions