Re: Decreasing DataSourceInfo verbosity

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Mon Apr 09 2007 - 06:08:37 EDT

  • Next message: Andrus Adamchik: "Re: Decreasing DataSourceInfo verbosity"

    > Perhaps could add more logic, like if using a built-in encoder, don't
    > log the salt (not used), etc, but that might just be more complicated
    > than it is worth.

    Thanks for the clarification. That's what I just did:

    http://svn.apache.org/viewvc?view=rev&revision=526699

    I added a few more conditionals, so that the default encoder and
    location are not printed. I think added clarity is worth 5 minutes
    that I spent on it :-) If there are other ideas, please fill free to
    further update this code.

    Andrus

    On Apr 9, 2007, at 12:59 AM, Michael Gentry wrote:
    > Well, not that I'm opposed, but even if using the
    > PlainTextPasswordEncoder, the password source could still be an URL
    > (file: or http:), a file in the CLASSPATH, or obtained by running an
    > executable program, so logging that info might still be useful ...
    >
    > Perhaps could add more logic, like if using a built-in encoder, don't
    > log the salt (not used), etc, but that might just be more complicated
    > than it is worth.
    >
    > Thoughts?
    >
    > Thanks,
    >
    > /dev/mrg
    >
    >
    > On 4/8/07, Andrus Adamchik <andru..bjectstyle.org> wrote:
    >> A question for Michael Gentry ...
    >>
    >> I am nitpicking here, but with the new password encoder feature, on
    >> startup Cayenne prints encoder class, password location and other
    >> related information. Would it be ok to make this output conditional
    >> on encoder class being not PlainTextPasswordEncoder per patch below?
    >>
    >> What do you think?
    >>
    >> Thanks
    >> Andrus
    >>
    >>
    >> Index: framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/
    >> cayenne/conn/DataSourceInfo.java
    >> ===================================================================
    >> --- framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/
    >> cayenne/conn/DataSourceInfo.java (revision 525813)
    >> +++ framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/
    >> cayenne/conn/DataSourceInfo.java (working copy)
    >>.. -23,6 +23,7 @@
    >> import java.io.Serializable;
    >> import org.apache.cayenne.conf.PasswordEncoding;
    >> +import org.apache.cayenne.conf.PlainTextPasswordEncoder;
    >> import org.apache.cayenne.util.Util;
    >> /**
    >>.. -133,16 +134,16 @@
    >> .append("\n min. connections: ")
    >> .append(minConnections)
    >> .append("\n max. connections: ")
    >> - .append(maxConnections)
    >> - .append("\n encoder class: ")
    >> - .append(passwordEncoderClass)
    >> - .append("\n encoder salt: ")
    >> - .append(passwordEncoderSalt)
    >> - .append("\n password location: ")
    >> - .append(passwordLocation)
    >> - .append("\n password source: ")
    >> - .append(getPasswordSource())
    >> - .append("\n]");
    >> + .append(maxConnections);
    >> +
    >> + if (!PlainTextPasswordEncoder.class.getName().equals
    >> (this.passwordEncoderClass)) {
    >> + buf.append("\n encoder class: ").append
    >> (passwordEncoderClass).append(
    >> + "\n encoder salt: ").append
    >> (passwordEncoderSalt).append(
    >> + "\n password location: ").append
    >> (passwordLocation).append(
    >> + "\n password source: ").append
    >> (getPasswordSource());
    >> + }
    >> +
    >> + buf.append("\n]");
    >> return buf.toString();
    >> }
    >>
    >>
    >



    This archive was generated by hypermail 2.0.0 : Mon Apr 09 2007 - 06:10:43 EDT