Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1024952

Summary: Enhancements to "Programmatically Iterate Resources in a Deployment" doc
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: David M. Lloyd <david.lloyd>
Component: DocumentationAssignee: sgilda
Status: CLOSED CURRENTRELEASE QA Contact: Russell Dickenson <rdickens>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.2.0CC: pjelinek
Target Milestone: GA   
Target Release: EAP 6.2.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
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 16:48:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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.