[hibernate-dev] EMF / EM properties

Steve Ebersole steve at hibernate.org
Wed Feb 3 13:56:02 EST 2010


Word of warning.  I actually tried that :)

It ended up being all the properties.  Something was pulling them all.
I tried a sublass+delegate approach (I also had trouble getting the
"default properties" to work with just straight subclassing).

FYI...


On Wed, 2010-02-03 at 15:50 -0300, Hardy Ferentschik wrote:
> I believe Steve is on the right track. As he is saying  
> http://pastebin.com/m6add9d4b
> describes the "second pull" approach which he have been talking about in  
> one of the earlier
> mails. This is very similar to what I had in mind as well, except I  
> thought about sub-classing
> java.util.Properties.
> 
> --Hardy
> 
> 
> On Wed, 03 Feb 2010 14:26:59 -0300, Steve Ebersole <steve at hibernate.org>  
> wrote:
> 
> > I specifically said I did not want to "consolidate the constants in a
> > single place".  Not in terms of this anyway.  Because we will not know
> > them all ahead of time.  Again, I don't see the difference between what
> > you mention and what would be needed for caching.
> >
> > Emmanuel was asking specifically about the specific "second pull
> > approach", which is the context of my answer.  There, given the way
> > y'all decided to form these property names, the only real option is to
> > process all properties starting with "hibernate.search" since that's the
> > most common base.
> >
> > For caching (and search would fit here), I'd expect something like:
> >
> > interface PropertyConsumer {
> >     public boolean consumes(String name);
> >     public void consume(String name, Object value);
> > }
> >
> > class ConfigPropertySet {
> >     ...
> >
> >     void consumeProperties(PropertyConsumer consumer) {
> >         Iterator itr = fullPropertySet.entries().iterator();
> >         while ( itr.hasNext() ) {
> >             Map.Entry entry = (Map.Entry) itr.next();
> >             final String name = entry.getKey();
> >             if ( consumer.consumes( name ) ) {
> >                 register( name, entry.getValue() ):
> >                 consumer.consume( name, entry.getValue() );
> >             }
> >         }
> >     }
> > }
> >
> > Or maybe even just:
> >
> > interface PropertyConsumer {
> >     public boolean consume(String name, Object value);
> > }
> >
> > class ConfigPropertySet {
> >     ...
> >
> >     void consumeProperties(PropertyConsumer consumer) {
> >         Iterator itr = fullPropertySet.entries().iterator();
> >         while ( itr.hasNext() ) {
> >             Map.Entry entry = (Map.Entry) itr.next();
> >             final String name = entry.getKey();
> >             if ( consumer.consume( name, entry.getValue() ) ) {
> >                 register( name, entry.getValue() ):
> >             }
> >         }
> >     }
> > }
> 
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
-- 
Steve Ebersole <steve at hibernate.org>
Hibernate.org




More information about the hibernate-dev mailing list