[hibernate-dev] Hibernate EntityManager reusing MC facilities

Emmanuel Bernard emmanuel at hibernate.org
Fri Mar 27 18:28:21 EDT 2009


The URL does change from one call to another so the constructor taking  
a URL won't work here.

Set instead of List, yes that makes sense.

/**
* return all packages in the jar matching one of these annotations
* if annotationsToLookFor is empty, return all packages
*/
Set<Package> getPackagesInJar(URL jartoScan, Set<Annotation>  
annotationsToLookFor);

/**
* return all classes in the jar matching one of these annotations
* if annotationsToLookFor is empty, return all classes
*/
Set<Class<?>> getClassesInJar(URL jartoScan, Set<Annotation>  
annotationsToLookFor);

/**
* return all files in the jar matching one of these file names
* if filePatterns is empty, return all files
* eg **/*.hbm.xml, META-INF/orm.xml
*/
Set<[structure containing file name + InputStream]> getFilesInJar(URL  
jartoScan, Set<String> filePatterns);

Optional contract but would be nice to have:

/**
* return all files in the classpath (ie PU visibility) matching one of  
these file names
* if filePatterns is empty, return all files
* the use case is really exact file name.
*/
Set<[structure containing file name + InputStream]>  
getFilesInClasspath(URL jartoScan, Set<String> filePatterns);

/** return the unqualified JAR name ie customer-model.jar or store.war  
*/
String getUnqualifiedJarName(URL);

On  Mar 27, 2009, at 18:12, Elias Ross wrote:

> Probably would make more sense to pass in a Set<T> or Collection<T> as
> the method arguments, as Set<X> is being returned.
>
> And since many of the methods take a URL, maybe make it more OOP
> style, like something like:
>
> class JarScanner {
>  public JarScanner(URL url);
>  public Set<Entry> getFiles(Collection<String> filePatterns);
> }
>
> On Fri, Mar 27, 2009 at 2:49 PM, Emmanuel Bernard
> <emmanuel at hibernate.org> wrote:
>> I have been chatting with Ales and here is the contract that HEM  
>> could rely
>> on to scan entities and DD files.
>>
>> Here is a proposal for the contract
>>
>> /**
>>  * return all packages in the jar matching one of these annotations
>>  * if annotationsToLookFor is empty, return all packages
>>  */
>> Set<Package> getPackagesInJar(URL jartoScan, List<Annotation>
>> annotationsToLookFor);
>>
>> /**
>>  * return all classes in the jar matching one of these annotations
>>  * if annotationsToLookFor is empty, return all classes
>>  */
>> Set<Class<?>> getClassesInJar(URL jartoScan, List<Annotation>
>> annotationsToLookFor);
>>
>> /**
>>  * return all files in the jar matching one of these file names
>>  * if filePatterns is empty, return all files
>>  * eg **/*.hbm.xml, META-INF/orm.xml
>>  */
>> Set<[structure containing file name + InputStream]> getFilesInJar(URL
>> jartoScan, List<String> filePatterns);
>>
>> Optional contract but would be nice to have:
>>
>> /**
>>  * return all files in the classpath (ie PU visibility) matching  
>> one of
>> these file names
>>  * if filePatterns is empty, return all files
>>  * the use case is really exact file name.
>>  */
>> Set<[structure containing file name + InputStream]>  
>> getFilesInClasspath(URL
>> jartoScan, List<String> filePatterns);
>>
>> /** return the unqualified JAR name ie customer-model.jar or  
>> store.war */
>> String getUnqualifiedJarName(URL);
>>
>>
>>
>> _______________________________________________
>> hibernate-dev mailing list
>> hibernate-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>>
>> --
>> This message has been scanned for viruses and
>> dangerous content by MailScanner, and is
>> believed to be clean.
>>




More information about the hibernate-dev mailing list