cancel
Showing results for 
Search instead for 
Did you mean: 

CIFS file content is not available till action finishes

begunrom
Champ in-the-making
Champ in-the-making
I have defined a custom action that is triggered by a rule. RuleType=INBOUND
CIFS is enabled on the system.
When i add new content via nodeService.createNode the node gets created, the custom action is triggered, and the file becomes visible via cifs. The file size = 0, as no content has been loaded yet.
Then i add content via writer.putContent(file).
The custom action is triggered.
Then i check the lenth of the content written to the newly created document via.
ContentReader reader = contentService.getReader(actionedUponNodeRef, ContentModel.PROP_CONTENT);
reader.getSize() returns a non null value as expected.

When i look at the file size in CIFS, this remains 0, till the custom action completes.

My problem is that i have a need to read this file via CIFS, before the action completes.
This file is of a type, unknown to Alfresco and can only be read by an external program, that only can read files by using cifs.
How can i work arount this?
3 REPLIES 3

mrogers
Star Contributor
Star Contributor
You won't (and shouldn't) be able to "dirty read" content in alfresco.  

However it may be that you can re-order your transactions to make them work.  Perhaps by running them in a chain so that your external program run after the first commit.

I'm unclear what exactly you are trying to do, but it seems to me that you are going in a wrong direction at the moment.    What is your external program doing?

begunrom
Champ in-the-making
Champ in-the-making
The external program is a cad program (solidWorks). When uploading a cad file, we need to determine it's type (part,assembly,drawing) and adjust the alfresco document type accordingly. Also each cad type has it's own behaviour, when files are moved, copied,… Relations are also defined in the CAD document.
Also we need to extract metadata, that is not in the regular properties, you find in Office documents.
This is the reason, why we need access to the document itself.

begunrom
Champ in-the-making
Champ in-the-making
We started development in Alfresco 4.0.d, and did not encounter any problems with that part.
In the mean while we switched to 4.2.c for development because we wanted to use maven.
Since then i cannot get the loop complete. I cannot touch the file via cifs before the transaction is complete.
The transaction set's the document type. In order to set the document type i need to read the file.

I am confused.