[wildfly-dev] JAR scanning
Jason Greene
jason.greene at redhat.com
Mon Sep 22 11:23:57 EDT 2014
Yeah something like that. Although I just want to stress the importance of using the ClassLoader for the deployment, as due to a historical oversight the path is different between windows and unix.
On Sep 22, 2014, at 10:05 AM, Eduardo Sant'Ana da Silva <eduardo.santanadasilva at gmail.com> wrote:
>
> 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
>
--
Jason T. Greene
WildFly Lead / JBoss EAP Platform Architect
JBoss, a division of Red Hat
More information about the wildfly-dev
mailing list