1

I am learning how to use a content repository (Jackrabbit) and I wonder how it is possible to check if a node actually was removed. I use datastore and I know that is immutable however the node must be stored somewhere? I have configured the persistence manager to use postgresql. Everything works, I just want to know how I can see that the node actually was removed.

LuckyLuke
  • 47,771
  • 85
  • 270
  • 434

1 Answers1

2

Not sure what you mean by "actually removed". At the JCR level, Session.itemExists(path) will tell you if there's an Item (i.e. a Node or Property) at the specified path or not. Call this with an admin session to make sure access control doesn't get in the way.

If you're looking for on-disk deletion of the corresponding data, that's down to the PersistenceManager implementation - some will only garbage collect deleted data on demand, while others will delete it immediately when it is deleted at the JCR level. Lower layers (database, OS, disk) might also keep deleted data around for some time.

Bertrand Delacretaz
  • 6,100
  • 19
  • 24
  • But I use database and datastore. When I add a file the file content is placed in the filesystem, but where is the metadata stored? Doesn't it get a row or something in one of the tables it created? Or does it keep this metadata in the file? – LuckyLuke Aug 06 '13 at 15:38
  • Binary JCR Properties over a certain size are indeed stored in the filesystem if you use Jackrabbit's DataStore ( http://wiki.apache.org/jackrabbit/DataStore ), and that includes the contents of files. The other properties of a JCR nt:file node are stored according to the Jackrabbit's PersistenceManager configuration, which might target a database. Whether that database data is deleted when you delete the nodes is up to the PersistenceManager implementation, as explained in my initial reply. – Bertrand Delacretaz Aug 07 '13 at 15:26
  • Yes, the binary properties over a certain size is stored in the filesystem but aren't they referenced by a node that keeps its metadata in the database? Where do I find the nodes? – LuckyLuke Aug 07 '13 at 15:30
  • You're not saying how you add nodes - if you go via the JCR API you will have created nodes yourself, and you can retrieve them by path. If you copied files in the JCR repository via WebDAV for example, the WebDAV server components will create the nodes. You can then find them by visiting the repository from its root, by searching using the JCR API or by using a JCR explorer. – Bertrand Delacretaz Aug 08 '13 at 09:18
  • I am creating the nodes through the JCR API. But I thought only the binary properties over a certain file was stored in the filesystem. Where are the other properties stored? Are they also stored in the file or are there some record in the database or what? – LuckyLuke Aug 08 '13 at 14:50
  • Already replied above, see "if you use Jackrabbit's DataStore..." – Bertrand Delacretaz Aug 09 '13 at 06:58
  • Nope, that doesn't answer the question. – LuckyLuke Aug 09 '13 at 18:33
  • I cannot help more then, you might want to ask on the jackrabbit users list, see http://jackrabbit.apache.org/mailing-lists.html – Bertrand Delacretaz Aug 10 '13 at 08:20