[wildfly-dev] JAR scanning

Eduardo Sant'Ana da Silva eduardo.santanadasilva at gmail.com
Mon Sep 22 11:05:21 EDT 2014


            URI uri = getURI("/test.rar");
            final VirtualFile virtualFile = VFS.getChild(uri);
            final Indexer indexer = new Indexer();
            final List<VirtualFile> classChildren = virtualFile.getChildren(new SuffixMatchFilter(".class",
                    VisitorAttributes.RECURSE_LEAVES_ONLY));
            for (VirtualFile classFile : classChildren) {
                InputStream inputStream = null;
                try {
                    inputStream = classFile.openStream();
                    indexer.index(inputStream);
                } finally {
                    VFSUtils.safeClose(inputStream);
                }
            }


On Sep 22, 2014, at 11:53 AM, Jason Greene <jason.greene at redhat.com> wrote:

> You can do a similar technique. Load a file in your deployment via getResource on a clasloader. Then you will get a VFS uri. If you convert it to a URL and call openContent on it you will get a VFS VirtualFile, and then using that you can browse anything int he deployment.
> 
> 
> On Sep 22, 2014, at 9:29 AM, Thomas Segismont <tsegismo at redhat.com> wrote:
> 
>> Hi everyone,
>> 
>> In RHQ I need a way to list my domain classes at runtime (when preparing 
>> the CLI environment for execution, but that's another story).
>> 
>> In the past, for the same issue with another project, I did something 
>> like looking for the persistence.xml file in the classpath and then scan 
>> the JAR where it is found.
>> 
>> I wonder if there's something I could re-use from our EAP6.3-alpha base. 
>> Any idea?
>> 
>> Thanks,
>> Thomas
>> _______________________________________________
>> wildfly-dev mailing list
>> wildfly-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/wildfly-dev
> 
> --
> Jason T. Greene
> WildFly Lead / JBoss EAP Platform Architect
> JBoss, a division of Red Hat
> 
> 
> _______________________________________________
> wildfly-dev mailing list
> wildfly-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/wildfly-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/wildfly-dev/attachments/20140922/43b7e359/attachment.html 


More information about the wildfly-dev mailing list