AnsweredAssumed Answered

ContentServicePolicies.OnContentReadPolicy implementation

Question asked by jmliege on Nov 10, 2006
Latest reply on Nov 23, 2006 by jmliege
Hi,

I've managed to trap when a content is being read through the implementation of the interface ContentServicePolicies.OnContentReadPolicy like the following…


public MyClass implements ContentServicePolicies.OnContentReadPolicy
{

   private PolicyComponent policyComponent;

   private NodeService nodeService;

   public static QName CONTENT_READ =                     QName.createQName(NamespaceService.ALFRESCO_URI,"onContentRead");
    
   //Setters for PolicyComponent & NodeService.
   public void set…..
   …..
   …..

   public void init()
  {
      this.policyComponent.bindClassBehaviour(CONTENT_READ,
                                      MyModel.ASPECT_TEST,
                    new JavaBehavior(this,"onContentRead"));
   }
  

   public void onContentRead(NodeRef nodeRef)
  {
         nodeService.setProperty(nodeRef,ContentModel.PROP_NAME,"test");
   }

}

Everything is fine until I reach the nodeService.setProperty()

I always have an IndexerException… with the message :"the indexer is unable to accept more work : the indexer is preparing to commit".

In fact, it seems that changing properties, writing content (in another content node), … logically crashes as there are many event triggered at the same time…

I don't know what i 'm able to do (permit) exactly.Is it really normal ?

To summarize: What are the limitations of this onContentReadPolicy?

EDIT: I think i will try to do it with speficiying the NotificationFrequency with a value of TRANSACTION_COMMIT… and not on EVERY_EVENT.

Thanks for any help.

JMarc

Outcomes