[jboss-jira] [JBoss JIRA] (JBRULES-3619) Knowledge Agent: add the possibility to apply ByteArrayResources
Mark Proctor (JIRA)
jira-events at lists.jboss.org
Sun Sep 9 13:04:32 EDT 2012
[ https://issues.jboss.org/browse/JBRULES-3619?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12716824#comment-12716824 ]
Mark Proctor commented on JBRULES-3619:
---------------------------------------
This can be done quite cleanly as an integration exercise via a memory file system and a custom classloader. For this reason I have closed the pull request, and have not merged it. I've pasted the comments I left in the pull request below:
---
not sure I like this, it seems very kludgy. The knowledge agent is for monitoring external resources, but this is applying them.
It's possible to make a MemoryFileSystem and actually use that, without changing KnowledgeBuilder at all.
I recently wrote a MemoryFileSystem here:
https://github.com/droolsjbpm/drools/tree/master/drools-compiler/src/test/java/org/drools/kproject/memory
And here you can see the vfs in action, programmatically, to allow me to build resources in memory without touching disk. See testCompileAndCDI, where I build up the contents of the MemoryFileSystem.
https://github.com/droolsjbpm/drools/blob/master/drools-compiler/src/test/java/org/drools/kproject/KProjectTest.java
What makes it work is the classloader, scroll down to line 455:
MemoryFileSystemClassLoader
As you can see the builder factory is using just standard knowledge builder public apis, but they are actually being resolved from in memory.
https://github.com/droolsjbpm/drools/blob/master/drools-compiler/src/main/java/org/drools/kproject/KBaseBuilder.java
You can actually mix both in memory and disk based file systems, using the in memory to "overlay" the disk.
> Knowledge Agent: add the possibility to apply ByteArrayResources
> ----------------------------------------------------------------
>
> Key: JBRULES-3619
> URL: https://issues.jboss.org/browse/JBRULES-3619
> Project: Drools
> Issue Type: Feature Request
> Security Level: Public(Everyone can see)
> Components: drools-core
> Affects Versions: 5.4.0.Final
> Reporter: Esteban Aliverti
> Assignee: Esteban Aliverti
> Priority: Minor
>
> At the moment, the agent can process change-set containing one or more resources. The problem is when the resource we want to use is a ByteArray/InputStream/Reader Resource. There is no way to create a change-set containing any of these types of resources.
> It would be a nice feature to allow the Knowledge Agent to accept these kind of resources.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list