Search in sources :

Example 1 with ResultCallback

use of org.alfresco.filesys.repo.ResultCallback in project alfresco-repository by Alfresco.

the class ScenarioOpenFileInstance method newOpenFileCallbackCommand.

/**
 * Called for open file.
 */
private ResultCallback newOpenFileCallbackCommand() {
    return new ResultCallback() {

        @Override
        public void execute(Object result) {
            if (result instanceof NetworkFile) {
                // Now update the state of this scenario - we have an open fileHandle
                NetworkFile fileHandle = (NetworkFile) result;
                state = InternalState.OPEN;
                if (isReadOnly(fileHandle)) {
                    openReadOnlyCount++;
                    fileHandleReadOnly = fileHandle;
                    if (logger.isDebugEnabled()) {
                        logger.debug("file opened read only:" + result + ", name:" + name);
                    }
                } else {
                    openReadWriteCount++;
                    fileHandleReadWrite = fileHandle;
                    if (logger.isDebugEnabled()) {
                        logger.debug("file opened read write :" + result + ", name:" + name);
                    }
                }
            }
        }

        @Override
        public TxnReadState getTransactionRequired() {
            return TxnReadState.TXN_NONE;
        }
    };
}
Also used : ResultCallback(org.alfresco.filesys.repo.ResultCallback) TempNetworkFile(org.alfresco.filesys.repo.TempNetworkFile) NetworkFile(org.alfresco.jlan.server.filesys.NetworkFile)

Aggregations

ResultCallback (org.alfresco.filesys.repo.ResultCallback)1 TempNetworkFile (org.alfresco.filesys.repo.TempNetworkFile)1 NetworkFile (org.alfresco.jlan.server.filesys.NetworkFile)1