1
votes

I'm using Modeshape 2.6.0.I have two types of content : binary content and metadata..

The binary is saved in jcr:data property of the CR node. I'm getting the content via content.getProperty("jcr:data").getBinary()...(where content is of type Node)

Project uses a ehcache cache solution.This cache mechanism should be extended to my binary content. To make it work, I need to get the content of the node into something that implements Serializable.

My first target was Binary, by using content.getProperty("jcr:data").getBinary() But I get the error bellow, as Binary does not implement Serializable.

23:44:49,255 ERROR [net.sf.ehcache.store.compound.factories.DiskStorageFactory] Disk Write of 7690f9c6-a6f0-412e-ba47-b8e43f77d1af failed (it will be evicted instead): : java.io.NotSerializableException: org.modeshape.jcr.JcrBinary

Any suggestion?

Thank you.

1

1 Answers

1
votes

Found a way to to do it...

I'm building a ByteArrayOutputStream object, bout, where I'm writing the bytes that I'm reading from contentNode.getProperty("jcr:data").getBinary().getStream(). Finally I'm returning an object(instance of a class that I wrote that implements Serializable) that encapsulates the byte[] from bout.toByteArray()

If there are better ways to do it,please share.

Thanks.