sure!  the code is attached here.

the code does not yet check for valid annotations since i stopped
working on it a while ago.  but it can be added easily.  It has
locationFilters and packageFilters properties the same way stripes
means it (it is after all stripes' ResolveUtil ;)

ray,

On 5/1/06, Jeppe Cramon <[EMAIL PROTECTED]> wrote:
Hi Ray

That sounds cool. Would you care to share (if allowed) ?

/Jeppe

Ray Tsang wrote:
> I actually used Tim's ResolverUtil to write a hibernate session
> factory for spring that discovers ejb3 annotated beans from given
> classpath.
>
> ray,
>
> On 5/1/06, Tim Fennell <[EMAIL PROTECTED]> wrote:
>> Hi Marcel,
>>
>> At the time I wrote that stuff I couldn't find anything around that
>> did what I needed.  I spent quite a bit of time in the debugger
>> trying things out and seeing what would work :)  After Stripes was
>> released, Seam was released and does something quite similar.
>>
>> As for refactoring the code into some other class/project....  I'm
>> not so sure.  The code itself is actually pretty well isolated.  Take
>> a look at the class:
>>      net.sourceforge.stripes.util.ResolverUtil
>>
>> That one class has all the classpath walking logic in it.  And now
>> that Stripes is under the Apache license, there's nothing to stop
>> anyone taking it and using it...
>>
>> -t
>>
>> On Apr 30, 2006, at 2:55 PM, Marcel Overdijk wrote:
>>
>> > Hi Tim,
>> >
>> > I really like the idea of the @UrlBinding annotation.
>> > I want to create something similar like this. So I examined your
>> > code for getting annotated classes with a specific annotation. I
>> > think this is some common code which can be used in more
>> > circumstances/frameworks.
>> >
>> > Do you know if there is some framework out there (e.g. Jakarta
>> > Commons Annotations ;-) for retrieving this information. I guess
>> > not, and that was why you created it yourself.
>> > It might be an idea to remove the code to get annotated classes to
>> > a seperate class which can be used by other frameworks/programs?
>> >
>> > Regards,
>> > Marcel
>> >
>> >
>> >
>> >
>> > -------------------------------------------------------
>> > Using Tomcat but need to do more? Need to support web services,
>> > security?
>> > Get stuff done quickly with pre-integrated technology to make your
>> > job easier
>> > Download IBM WebSphere Application Server v.1.0.1 based on Apache
>> > Geronimo
>> > http://sel.as-us.falkag.net/sel?
>> > cmd=lnk&kid=120709&bid=263057&dat=121642
>> > _______________________________________________
>> > Stripes-development mailing list
>> > [email protected]
>> > https://lists.sourceforge.net/lists/listinfo/stripes-development
>>
>>
>>
>> -------------------------------------------------------
>> Using Tomcat but need to do more? Need to support web services,
>> security?
>> Get stuff done quickly with pre-integrated technology to make your
>> job easier
>> Download IBM WebSphere Application Server v.1.0.1 based on Apache
>> Geronimo
>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>> _______________________________________________
>> Stripes-development mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/stripes-development
>>
> Rȧ�:&q�[���y�hv����^y�h��i��py���z�r��!���n}�h�ꮉ�%����ފ{^���y�^r
> 薈2����쨺��m欉�ã    塧HŞm*az����bq�b�t���]5m�v���!xg��x��
> m���zV���ږF�����\�ОI"t
> ӽ=n'ۭ��Z�
> 
׮6J���z���ٚ�X��X��+k���u�ޖ�fz{e��l���q���z�m��?�X���(��~��zw��X�����b��?����z��nt==



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

package com.nooton.user.stripes;

import java.io.Serializable;
import java.util.Collections;
import java.util.Set;

import net.sourceforge.stripes.util.ResolverUtil;

import org.hibernate.HibernateException;
import org.hibernate.cfg.AnnotationConfiguration;
import org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean;

public class EnhancedAnnotationSessionFactoryBean extends
        AnnotationSessionFactoryBean
{
    private Set<String> locationFilters = Collections.emptySet();
    
    private Set<String> packageFilters = Collections.emptySet();
    
    private Class parentClass = Serializable.class;
    
    public Class getParentClass()
    {
        return parentClass;
    }

    public void setParentClass(Class parentClass)
    {
        this.parentClass = parentClass;
    }
    
    public Set<String> getLocationFilters()
    {
        return locationFilters;
    }

    public void setLocationFilters(Set<String> locationFilters)
    {
        this.locationFilters = locationFilters;
    }

    public Set<String> getPackageFilters()
    {
        return packageFilters;
    }

    public void setPackageFilters(Set<String> packageFilters)
    {
        this.packageFilters = packageFilters;
    }

    @Override
    protected void postProcessAnnotationConfiguration(
            AnnotationConfiguration config) throws HibernateException
    {
        if (parentClass != null)
        {
            Set<Class> classes = ResolverUtil.getImplementations(parentClass, locationFilters, packageFilters);
            for (Class clazz : classes)
            {
                config.addAnnotatedClass(clazz);
            }
        }
        super.postProcessAnnotationConfiguration(config);
    }
}

Reply via email to