Bug 1024952 - Enhancements to "Programmatically Iterate Resources in a Deployment" doc
Summary: Enhancements to "Programmatically Iterate Resources in a Deployment" doc
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Documentation
Version: 6.2.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: GA
: EAP 6.2.0
Assignee: sgilda
QA Contact: Russell Dickenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-10-30 16:03 UTC by David M. Lloyd
Modified: 2014-08-14 15:23 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Build Name: 14875, Development Guide-6.2-1 Build Date: 30-10-2013 10:11:06 Topic ID: 24377-549482 [Latest]
Last Closed: 2013-12-15 16:48:51 UTC
Type: Bug


Attachments (Terms of Use)

Description David M. Lloyd 2013-10-30 16:03:12 UTC
Title: Programmatically Iterate Resources in a Deployment

Describe the issue:

Several minor changes.

Suggestions for improvement:

1. The correct link for JBoss Modules API docs is "http://docs.jboss.org/jbossmodules/1.3.0.Final/api/".  I was working on getting a more general 1.3 symlink set up but it's not working, so this will have to do for now.

2. "Iterate All Resources Found in a Single Module and Imported Resources" section has a typo in the code sample "Interator" instead of "Iterator".  Probably me, as I make this typo all the time.

3. Some code examples:

* Find all files named "foobar.properties" in my deployment

ModuleClassLoader moduleClassLoader = (ModuleClassLoader) TargetClass.class.getClassLoader();
Iterator<Resource> mclResources = PathFilters.filtered(PathFilters.match("**/foobar.properties"), moduleClassLoader.iterateResources("", true));

* Find all files name "foobar.properties" in my deployment and imports

ModuleClassLoader moduleClassLoader = (ModuleClassLoader) TargetClass.class.getClassLoader();
Module module = moduleClassLoader.getModule();
Iterator<Resource> moduleResources = module.iterateResources(PathFilters.match("**/foobar.properties));

* Find all files inside any directory named "my-resources" in my deployment

ModuleClassLoader moduleClassLoader = (ModuleClassLoader) TargetClass.class.getClassLoader();
Iterator<Resource> mclResources = PathFilters.filtered(PathFilters.match("**/my-resources/**"), moduleClassLoader.iterateResources("", true));

* Find all files named "foo" or "bar" in my deployment and imports

ModuleClassLoader moduleClassLoader = (ModuleClassLoader) TargetClass.class.getClassLoader();
Module module = moduleClassLoader.getModule();
Iterator<Resource> moduleResources = module.iterateResources(PathFilters.any(PathFilters.match("**/foo"), PathFilters.match("**/bar"));

* Find all files in a specific package in my deployment

ModuleClassLoader moduleClassLoader = (ModuleClassLoader) TargetClass.class.getClassLoader();
Iterator<Resource> mclResources = moduleClassLoader.iterateResources("path/form/of/packagename", false);

Comment 1 sgilda 2013-10-30 16:46:32 UTC
David, I just want to make sure I understand the section location for each of the above examples. 

Do they belong under an existing section? 
Or do you think it would be better to add a new subsectio, something like "Examples of Programmatically Filtering Resources in a Deployment"?

Comment 2 sgilda 2013-10-31 11:56:19 UTC
Added the examples to a separate section at the end.


Note You need to log in before you can comment on or make changes to this bug.