Bug 1024952 - Enhancements to "Programmatically Iterate Resources in a Deployment" doc
Enhancements to "Programmatically Iterate Resources in a Deployment" doc
Status: CLOSED CURRENTRELEASE
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Documentation (Show other bugs)
6.2.0
Unspecified Unspecified
unspecified Severity unspecified
: GA
: EAP 6.2.0
Assigned To: sgilda
Russell Dickenson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-30 12:03 EDT by David M. Lloyd
Modified: 2014-08-14 11:23 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
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 11:48:51 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description David M. Lloyd 2013-10-30 12:03:12 EDT
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 12:46:32 EDT
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 07:56:19 EDT
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.