[jboss-jira] [JBoss JIRA] Updated: (JBRULES-2415) Provide recursive file scan for files under change-set.xml

Priya M (JIRA) jira-events at lists.jboss.org
Tue Jan 26 17:35:19 EST 2010


     [ https://jira.jboss.org/jira/browse/JBRULES-2415?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Priya M updated JBRULES-2415:
-----------------------------

    Description: 
Currently, the following only scans all rule files under rules/ but not any subdirectories. It would be nice to have a parameter like includeSubDirectories=true in resource tag

<change-set xmlns='http://drools.org/drools-5.0/change-set'
            xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
            xs:schemaLocation='http://drools.org/drools-5.0/change-set.xsd' >
   <add>
       <resource source='file:C:/rules/' type='DRL' />
   </add>
</change-set>

The following code in PackageBuilder can be changed to add at least one level of subdirectory and I'm sure with a little bit of refactoring and retest, one can add n-levels of subdirectories (though I would agree that we should limit the depth).

Line:530
if ( iNestedResourceResource.isDirectory() ) {
    this.resourceDirectories.add( iNestedResourceResource );
    for ( Resource childResource : iNestedResourceResource.listResources() ) {
        if ( ((InternalResource) childResource).isDirectory() ) { // process one level subdirectory
            this.resourceDirectories.add( childResource );
            for ( Resource subChildResource : childResource.listResources() ) {
                if ( ((InternalResource) subChildResource).isDirectory() ) {
                    continue; // ignore second level sub directories
                }
                ((InternalResource) childResource).setResourceType( iNestedResourceResource.getResourceType() );
                addKnowledgeResource( childResource,
                                      iNestedResourceResource.getResourceType(),
                                      iNestedResourceResource.getConfiguration() );
            }
            
        }
        else {        
            ((InternalResource) childResource).setResourceType( iNestedResourceResource.getResourceType() );
            addKnowledgeResource( childResource,
                                  iNestedResourceResource.getResourceType(),
                                  iNestedResourceResource.getConfiguration() );
        }
    }
} else {
    addKnowledgeResource( iNestedResourceResource,
                          iNestedResourceResource.getResourceType(),
                          iNestedResourceResource.getConfiguration() );
  }
}

  was:
Currently, the following only scans all rule files under rules/ but not any subdirectories. It would be nice to have a parameter like includeSubDirectories=true in resource tag

<change-set xmlns='http://drools.org/drools-5.0/change-set'
            xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
            xs:schemaLocation='http://drools.org/drools-5.0/change-set.xsd' >
   <add>
       <resource source='file:C:/rules/' type='DRL' />
   </add>
</change-set>



> Provide recursive file scan for files under change-set.xml
> ----------------------------------------------------------
>
>                 Key: JBRULES-2415
>                 URL: https://jira.jboss.org/jira/browse/JBRULES-2415
>             Project: Drools
>          Issue Type: Feature Request
>      Security Level: Public(Everyone can see) 
>          Components: drools-core
>    Affects Versions: 5.0.1.FINAL
>         Environment: windows
>            Reporter: Priya M
>            Assignee: Mark Proctor
>            Priority: Minor
>             Fix For: 5.1.0.M2
>
>
> Currently, the following only scans all rule files under rules/ but not any subdirectories. It would be nice to have a parameter like includeSubDirectories=true in resource tag
> <change-set xmlns='http://drools.org/drools-5.0/change-set'
>             xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
>             xs:schemaLocation='http://drools.org/drools-5.0/change-set.xsd' >
>    <add>
>        <resource source='file:C:/rules/' type='DRL' />
>    </add>
> </change-set>
> The following code in PackageBuilder can be changed to add at least one level of subdirectory and I'm sure with a little bit of refactoring and retest, one can add n-levels of subdirectories (though I would agree that we should limit the depth).
> Line:530
> if ( iNestedResourceResource.isDirectory() ) {
>     this.resourceDirectories.add( iNestedResourceResource );
>     for ( Resource childResource : iNestedResourceResource.listResources() ) {
>         if ( ((InternalResource) childResource).isDirectory() ) { // process one level subdirectory
>             this.resourceDirectories.add( childResource );
>             for ( Resource subChildResource : childResource.listResources() ) {
>                 if ( ((InternalResource) subChildResource).isDirectory() ) {
>                     continue; // ignore second level sub directories
>                 }
>                 ((InternalResource) childResource).setResourceType( iNestedResourceResource.getResourceType() );
>                 addKnowledgeResource( childResource,
>                                       iNestedResourceResource.getResourceType(),
>                                       iNestedResourceResource.getConfiguration() );
>             }
>             
>         }
>         else {        
>             ((InternalResource) childResource).setResourceType( iNestedResourceResource.getResourceType() );
>             addKnowledgeResource( childResource,
>                                   iNestedResourceResource.getResourceType(),
>                                   iNestedResourceResource.getConfiguration() );
>         }
>     }
> } else {
>     addKnowledgeResource( iNestedResourceResource,
>                           iNestedResourceResource.getResourceType(),
>                           iNestedResourceResource.getConfiguration() );
>   }
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list