Announcement Announcement Module
Collapse
No announcement yet.
AOP with JDO's PersistenceManager class Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • AOP with JDO's PersistenceManager class

    Hi All,

    Currently I'm developing a somewhat small and generic indexing system, that generates a full inverted index (used for searching words within a document). To do this I have decided I want minimise the impact on the developer to actually use this feature and hijack the PersistenceManager object (used in JDO to write data to the database).

    To do this I am using an interceptor to wrap the PersistenceManagerFactory, this interceptor ... intercepts all method calls that return a PersistenceManager (getPersistenceManager, getPersistenceManagerProxy, etc). This is all in order to programmatically add another interceptor to the PersistenceManager, that in turn processes the functions that match the expression:
    Code:
    ^(make|delete)Persistent(All)?$
    This is where I start writing to the datastore (oh I'm using Google App Engine for this, but I doubt that is important).

    This approach actually works, although it seems a little messy. I was wondering whether it is possible to attach advice directly to a PersistenceManager? Rather than having to do it my way? The issue I see is that I never actually create the PersistenceManager within the Spring XML file, they are always new objects obtained by the PMF, hence no ProxyFactoryBean can be added to it. This was the original reasoning for my somewhat odd implementation.


    Thanks



    John
    Last edited by sacko87; Feb 29th, 2012, 10:08 AM. Reason: Formatting Issues
Working...
X