Re: svn commit: r686251 - in /ofbiz/trunk/framework/minilang/src: META-INF/services/ org/ofbiz/minilang/method/conditional/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r686251 - in /ofbiz/trunk/framework/minilang/src: META-INF/services/ org/ofbiz/minilang/method/conditional/

Jacopo Cappellato-3
Adam,

please remember the License header and the svn properties (still  
missing from the last new file you added to the repository).

Thanks,

Jacopo

On Aug 15, 2008, at 5:29 PM, [hidden email] wrote:

> Author: doogie
> Date: Fri Aug 15 08:29:29 2008
> New Revision: 686251
>
> URL: http://svn.apache.org/viewvc?rev=686251&view=rev
> Log:
> More use of ServiceRegistry.
>
> Added:
>    ofbiz/trunk/framework/minilang/src/META-INF/services/
> org.ofbiz.minilang.method.conditional.ConditionalFactory
> Modified:
>    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/
> conditional/CombinedCondition.java
>    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/
> conditional/CompareCondition.java
>    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/
> conditional/CompareFieldCondition.java
>    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/
> conditional/ConditionalFactory.java
>    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/
> conditional/EmptyCondition.java
>    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/
> conditional/HasPermissionCondition.java
>    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/
> conditional/RegexpCondition.java
>    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/
> conditional/ValidateMethodCondition.java
>
> Added: ofbiz/trunk/framework/minilang/src/META-INF/services/
> org.ofbiz.minilang.method.conditional.ConditionalFactory
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/META-INF/services/org.ofbiz.minilang.method.conditional.ConditionalFactory?rev=686251&view=auto
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- ofbiz/trunk/framework/minilang/src/META-INF/services/
> org.ofbiz.minilang.method.conditional.ConditionalFactory (added)
> +++ ofbiz/trunk/framework/minilang/src/META-INF/services/
> org.ofbiz.minilang.method.conditional.ConditionalFactory Fri Aug 15  
> 08:29:29 2008
> @@ -0,0 +1,11 @@
> +org.ofbiz.minilang.method.conditional.CombinedCondition
> $OrConditionFactory
> +org.ofbiz.minilang.method.conditional.CombinedCondition
> $XorConditionFactory
> +org.ofbiz.minilang.method.conditional.CombinedCondition
> $AndConditionFactory
> +org.ofbiz.minilang.method.conditional.CombinedCondition
> $NotConditionFactory
> +org.ofbiz.minilang.method.conditional.CompareCondition
> $CompareConditionFactory
> +org.ofbiz.minilang.method.conditional.CompareFieldCondition
> $CompareFieldConditionFactory
> +org.ofbiz.minilang.method.conditional.EmptyCondition
> $EmptyConditionFactory
> +org.ofbiz.minilang.method.conditional.HasPermissionCondition
> $HasPermissionConditionFactory
> +org.ofbiz.minilang.method.conditional.RegexpCondition
> $RegexpConditionFactory
> +org.ofbiz.minilang.method.conditional.ValidateMethodCondition
> $ValidateMethodConditionFactory
> +
>


smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r686251 - in /ofbiz/trunk/framework/minilang/src: META-INF/services/ org/ofbiz/minilang/method/conditional/

Adam Heath-2
Jacopo Cappellato wrote:

> please remember the License header and the svn properties (still missing
> from the last new file you added to the repository).

You're right, I forgot to add it to *this* new file; but I already did
it for the last one.

What svn properties need to be set?  Or, point me at the documentation
that says what should be done.
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r686251 - in /ofbiz/trunk/framework/minilang/src: META-INF/services/ org/ofbiz/minilang/method/conditional/

Jacopo Cappellato-3
On Aug 15, 2008, at 5:42 PM, Adam Heath wrote:

> Jacopo Cappellato wrote:
>
>> please remember the License header and the svn properties (still  
>> missing from the last new file you added to the repository).
>
> You're right, I forgot to add it to *this* new file; but I already  
> did it for the last one.
>

Yeah, I noticed the fix for the license... I was just speaking about  
the svn properities for the old file.

The best thing to do is to load the svn config file in your user home,  
so that the standard svn properties will be automatically added to all  
the new files you commit; you can find a link to our official config  
file (and the simple instructions to use it) here:

  http://docs.ofbiz.org/display/OFBADMIN/OFBiz+Source+Repository+and+Access

(see the paragraph "Developer Access").

There is also a mention to this here:

http://docs.ofbiz.org/display/OFBADMIN/OFBiz+Contributors+Best+Practices

> What svn properties need to be set?  Or, point me at the  
> documentation that says what should be done.

For files like these (that are similar to Java source files) we need  
the following properties:

svn:mime-type=text/plain
svn:eol-style=native
svn:keywords="Date Rev Author URL Id"
You can manually set them to two files in your local repository using  
the "svn propset" command and then committing the file.
For example:

svn propset svn:mime-type text/plain path/to/file/filename
svn propset ....
svn commit path/to/file/filename

Hope it helps,
Jacopo

smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r686251 - in /ofbiz/trunk/framework/minilang/src: META-INF/services/ org/ofbiz/minilang/method/conditional/

Adam Heath-2
Jacopo Cappellato wrote:

> On Aug 15, 2008, at 5:42 PM, Adam Heath wrote:
>
>> Jacopo Cappellato wrote:
>>
>>> please remember the License header and the svn properties (still
>>> missing from the last new file you added to the repository).
>>
>> You're right, I forgot to add it to *this* new file; but I already did
>> it for the last one.
>>
>
> Yeah, I noticed the fix for the license... I was just speaking about the
> svn properities for the old file.
>
> The best thing to do is to load the svn config file in your user home,
> so that the standard svn properties will be automatically added to all
> the new files you commit; you can find a link to our official config
> file (and the simple instructions to use it) here:
Ew.  That's bad.  I hate that svn and svk don't have per-checkout config
settings.

So, I wrote a program to automate it.

==
mkdir $HOME/bin
PATH=$HOME/bin:$PATH
cp $attachments/svk $HOME/bin/svk
cp $attachments/.svn-props.txt $ofbiz_checkout_root/.svn-props.txt
==

This should also work for svn(by copying the script and naming it svn
instead), but I haven't tested that.  I haven't tested it on anything
other than debian linux.  The only odd thing is does it call
/bin/readlink, but most systems should already have that.

If others like this script, then we could check in that .svn-props.txt,
and the binary.  For now, I'll keep them local.

#!/usr/bin/perl -w

use strict;
use warnings;

my $NAME_SEP = '/';
my $PATH_SEP = ':';

my %prop_patterns;

sub find_next() {
        my $prog = $0;
        $prog =~ s/.*\Q$NAME_SEP\E//;
        my $canon_prog = `readlink -f "$0"`;
        chomp($canon_prog);
        foreach my $path (split(/\Q$PATH_SEP\E/, $ENV{'PATH'})) {
                if (-x "$path/$prog") {
                        my $next_prog = `readlink -f "$path/$prog"`;
                        chomp($next_prog);
                        next if ($canon_prog eq $next_prog);
                        return $next_prog;
                }
        }
        print(STDERR "Couldn't find next '$prog' in $ENV{'PATH'}\n");
        exit(1);
}

my $next_prog = find_next();

sub parse_prop_patterns($$) {
        my ($label, $text) = @_;
        my @patterns;
        foreach my $line (split('\n', $text)) {
                # Skip comments and empty lines
                next if ($line =~ /^\s*(#.*|)$/);
                die("Unknown line ($line) in ($label)") if ($line !~ /^\s*([^\s]+)\s+=\s+(.*?)\s*$/);
                my ($pattern, $props) = ($1, $2);
                if ($pattern =~ m/^~.*/) {
                        # full regex
                } else {
                        $pattern =~ s/\./\\./g;
                        $pattern =~ s/\*/[^$NAME_SEP]*?/g;
                        my $pattern_prefix;
                        if ($pattern =~ m/^\/.*/) {
                                # full path
                                $pattern_prefix = '';
                        } else {
                                $pattern_prefix = '.*';
                        }
                        # Convert / to local
                        $pattern =~ s/\//$NAME_SEP/g;
                        $pattern = $pattern_prefix . $NAME_SEP . $pattern;
                }
                $pattern = qr/^$pattern$/;
                my %props;
                while ($props =~ s/^([^=;]+)=?//) {
                        my $prop_name = $1;
                        my $prop_value;
                        if ($props =~ s/^"([^"]*)"(;|$)//) {
                                $prop_value = $1;
                        } elsif ($props =~ s/^'([^']*)'(;|$)//) {
                                $prop_value = $1;
                        } elsif ($props =~ s/^(.*?)(;|$)//) {
                                $prop_value = $1;
                        } else {
                                die("Bad line ($line) in ($label) when parsing ($prop_name) value ($props)");
                        }
                        $props{$prop_name} = $prop_value;
                }
                push(@patterns, [qr/^$pattern$/, \%props]);
        }
        close(FILE);
        return \@patterns;
}

sub get_prop_patterns($) {
        my ($file) = @_;
        return $prop_patterns{$file} if ($prop_patterns{$file});
        my %patterns;
        open(FILE, "< $file") || die("Couldn't open file($file): $!");
        local $/ = undef;
        my $data = <FILE>;
        close(FILE);
        my $patterns = parse_prop_patterns($file, $data);
        $prop_patterns{$file} = $patterns;
        return $patterns;
}

sub set_props($) {
        my ($path) = @_;
        my $canon_path = `readlink -f "$path"`;
        chomp($canon_path);
        my $search_path = $canon_path;
        my $patterns;
        while ($search_path =~ s/\Q$NAME_SEP\E[^$NAME_SEP]+$//) {
                if (-e "$search_path$NAME_SEP.svn-props.txt") {
                        $patterns = get_prop_patterns("$search_path$NAME_SEP.svn-props.txt");
                        last;
                }
        }
        return if (!$patterns);
        my %apply_patterns;
        foreach my $pattern (@$patterns) {
                if ($canon_path =~ $pattern->[0]) {
                        while (my ($name, $value) = each(%{$pattern->[1]})) {
                                $apply_patterns{$name} = $value;
                        }
                }
        }
        while (my ($name, $value) = each(%apply_patterns)) {
                my @cmd = ($next_prog, 'propset', $name, $value, $path);
                system(@cmd) && die("Couldn't run " . join(' ', @cmd));
        }
}

my (@args, $override);
while (@ARGV) {
        my $arg = shift();
        push(@args, $arg);
        if ($arg =~ m/^(add|import)$/) {
                $override = 1;
                last;
        }
}
exec($next_prog, @args, @ARGV) if (!$override);
# Add the new files first, before modifying their properties
system($next_prog, @args, @ARGV) && die("Couldn't run $next_prog " . join(' ', @args, @_));
foreach my $path (@ARGV) {
        set_props($path);
}

*.java = svn:mime-type=text/plain;svn:eol-style=native;svn:keywords="Date Rev Author URL Id"
*.bsh = svn:mime-type=text/plain;svn:eol-style=native;svn:keywords="Date Rev Author URL Id"
*.groovy = svn:mime-type=text/plain;svn:eol-style=native;svn:keywords="Date Rev Author URL Id"
*.jsp = svn:mime-type=text/plain;svn:eol-style=native;svn:keywords="Date Rev Author URL Id"
*.tld = svn:mime-type=text/xml;svn:eol-style=native;svn:keywords="Date Rev Author URL Id"
*.ftl = svn:mime-type=text/plain;svn:eol-style=native;svn:keywords="Date Rev Author URL Id"
*.js = svn:mime-type=text/plain;svn:eol-style=native;svn:keywords="Date Rev Author URL Id"
*.sql = svn:mime-type=text/plain;svn:eol-style=native;svn:keywords="Date Rev Author URL Id"
*.c = svn:mime-type=text/plain;svn:eol-style=native;svn:keywords="Date Rev Author URL Id"
*.cpp = svn:mime-type=text/plain;svn:eol-style=native;svn:keywords="Date Rev Author URL Id"
*.h = svn:mime-type=text/plain;svn:eol-style=native;svn:keywords="Date Rev Author URL Id"
*.txt = svn:mime-type=text/plain;svn:eol-style=native;svn:keywords="Date Rev Author URL Id"
*.sgml = svn:mime-type=text/plain;svn:eol-style=native;svn:keywords="Date Rev Author URL Id"
*.properties = svn:mime-type=text/plain;svn:eol-style=native;svn:keywords="Date Rev Author URL Id"
*.xml = svn:mime-type=text/xml;svn:eol-style=native;svn:keywords="Date Rev Author URL Id"
*.classpath = svn:mime-type=text/xml;svn:eol-style=native;svn:keywords="Date Rev Author URL Id"
*.project = svn:mime-type=text/xml;svn:eol-style=native;svn:keywords="Date Rev Author URL Id"
*.sld = svn:mime-type=text/xml;svn:eol-style=native;svn:keywords="Date Rev Author URL Id"
*.gml = svn:mime-type=text/xml;svn:eol-style=native;svn:keywords="Date Rev Author URL Id"
*.xsl = svn:mime-type=text/xsl;svn:eol-style=native;svn:keywords="Date Rev Author URL Id"
*.xsd = svn:mime-type=text/xsd;svn:eol-style=native;svn:keywords="Date Rev Author URL Id"
*.html = svn:mime-type=text/html;svn:eol-style=native;svn:keywords="Date Rev Author URL Id"
*.htm = svn:mime-type=text/html;svn:eol-style=native;svn:keywords="Date Rev Author URL Id"
*.css = svn:mime-type=text/css;svn:eol-style=native;svn:keywords="Date Rev Author URL Id"
*.dsp = svn:eol-style=CRLF
*.bat = svn:eol-style=CRLF
*.dsw = svn:eol-style=CRLF
*.sh = svn:eol-style=LF;svn:executable;svn:keywords="Date Rev Author URL Id"
*.png = svn:mime-type=image/png
*.jpg = svn:mime-type=image/jpeg
*.gif = svn:mime-type=image/gif
*.tif = svn:mime-type=image/tiff
*.zip = svn:mime-type=application/zip
*.sxw = svn:mime-type=application/zip
*.sxc = svn:mime-type=application/zip
*.sxi = svn:mime-type=application/zip
*.jar = svn:mime-type=application/octet-stream
*.jks = svn:mime-type=application/octet-stream
*.utf = svn:mime-type=application/octet-stream
*.ttf = svn:mime-type=application/octet-stream
*.shp = svn:mime-type=application/octet-stream
*.shx = svn:mime-type=application/octet-stream
*.dbf = svn:mime-type=application/octet-stream
*.mif = svn:mime-type=application/octet-stream
*.mid = svn:mime-type=application/octet-stream
Makefile = svn:mime-type=text/plain;svn:eol-style=native
README = svn:mime-type=text/plain;svn:eol-style=native
NOTICE = svn:mime-type=text/plain;svn:eol-style=native
LICENSE = svn:mime-type=text/plain;svn:eol-style=native
ant = svn:mime-type=text/plain;svn:eol-style=LF
ij.ofbiz = svn:mime-type=text/plain;svn:eol-style=LF
rc.ofbiz = svn:mime-type=text/plain;svn:eol-style=LF