As Dean says, getting the modification time of an in-memory resource is impossible (actually you need to create an external mechanism to keep track of it). So I would suggest to change the thrown Exception to something more meaningful and to explicitly document which resources are capable to be scanned for changes.<div>
Right now, the Resources capable to being scanned are:</div><div><ul><li>ClasspathResource</li><li>UrlResource</li><li>FileSystemResource</li><li>EncodedResource (depending on the implementation of Resource it is using) </li>
</ul><div>@Wolfgang, for non in-memory Resources like files or url resources you can get the last modified time. This is used by the scanner to check if a particular resource has been modified since the last time it was scanned. As Dean mentioned, this is not feasible when the resource is an in-memory resource like a ByteArrayResource.</div>
<div><br></div><div>Best Regards, </div><div><br></div><br>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br><br>Esteban Aliverti<br>- Developer @ <a href="http://www.plugtree.com" target="_blank">http://www.plugtree.com impossible </a><br>
- Blog @ <a href="http://ilesteban.wordpress.com" target="_blank">http://ilesteban.wordpress.com</a><br>
<br><br><div class="gmail_quote">On Fri, Jan 6, 2012 at 10:51 AM, Dean <span dir="ltr"><<a href="mailto:dean@qualica.com">dean@qualica.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
@Esteban - I've tried both the ClassPathResource and UrlResource and haven't<br>
actually tried ReaderResource.<br>
<br>
I see what you mean with the source code, I did notice that specific error<br>
message appears for ReaderResource, but I don't know how my code is getting<br>
there. I will debug it and find out what is going on when I get a moment.<br>
<br>
I notice that getLastModified also isn't implemented for InputStreamResource<br>
(with a different error message).<br>
<br>
How would you propose returning a modified date for a ByteArrayResource,<br>
ReaderResource or InputStreamResource as these are in-memory objects and<br>
don't actually have a modified date?<br>
<br>
Regards<br>
<span class="HOEnZb"><font color="#888888"><br>
Dean<br>
<br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/Resource-Change-Scanner-Service-modified-date-error-tp3634802p3637468.html" target="_blank">http://drools.46999.n3.nabble.com/Resource-Change-Scanner-Service-modified-date-error-tp3634802p3637468.html</a><br>
</font></span><div class="HOEnZb"><div class="h5">Sent from the Drools: User forum mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div></div></blockquote></div><br></div>