//You could try separating your server command for writing out the file from
//the client.  That should eliminate the caching issue. Like this:

package customization.aerovantix.retrieve;

import wt.method.*;
import wt.content.*;
import java.io.File;

/**
 *
 * @author  antonio.villanueva
 */

public class AerovantixServerCommands implements RemoteAccess{

	/** Creates a new instance of RMSTest */

	public AerovantixServerCommands() { }

	public static void writeOutDocumentContent(ApplicationData data, String path) {

		String filename=data.getFileName();

		try {
			ContentServerHelper.service.writeContentStream(data,path+File.separator+filename);
		}

	catch (Exception e) {
		System.out.println("Error exporting file for Aerovantix request");
	}
}


And that would be invoked like this from you client:

//export file

	//get Content object

	ContentHolder holder=ContentHelper.service.getContents(doc);

	ApplicationData data=(ApplicationData)ContentHelper.service.getPrimary(doc);

	//build server call to export content file

	String path=indexerProperties.getString("outputPath");

	Class[] args={ApplicationData.class,String.class};

	Object[] args2={data,path};

	//export file

	rms.invoke("writeOutDocumentContent","customization.aerovantix.retrieve.AerovantixServerCommands", null,args,args2); 

A better way to execute you client program is to use the following block
(avoid writing password in file):

    RemoteMethodServer rms = RemoteMethodServer.getDefault();

    GatewayAuthenticator auth = new GatewayAuthenticator();

    auth.setRemoteUser("wcadmin");

    rms.setAuthenticator(auth);

    System.out.println("Connected to PDMLink!");

 
No password required but only works if invoked from the same host as server.

So are you exporting every file to disk in order to calculate the size of
the cabinet?  Would it be easier to write them to an external vault and then
just look at the size of the vault on disk?  You should be able to configure
the cabinet such that it writes all content to a special folder for the
cabinet only. One folder per cabinet.
