public void lookupDataSet ( final DataSetLookup request , final DataSetReadyCallback listener ) throws Exception { // Look always into the client data set manager. if ( clientDataSetManager . getDataSet ( request . getDataSetUUID ( ) ) != null ) { DataSet dataSet = clientDataSetManager . lookupDataSet ( request ) ; listener . callback ( dataSet ) ; } // If the data set is not in client, then look up remotely (only if the remote access is available). else if ( dataSetLookupServices != null ) { // First of all, get the target data set estimated size. fetchMetadata ( request . getDataSetUUID ( ) , new DataSetMetadataCallback ( ) { public void callback ( DataSetMetadata metatada ) { // Push the data set to client if and only if the push feature is enabled, the data set is // pushable & the data set is smaller than the max push size defined. DataSetDef dsetDef = metatada . getDefinition ( ) ; int estimatedSize = metatada . getEstimatedSize ( ) / 1000 ; boolean isPushable = dsetDef != null && dsetDef . isPushEnabled ( ) && estimatedSize < dsetDef . getPushMaxSize ( ) ; if ( pushRemoteDataSetEnabled && isPushable ) { // Check if a push is already in progress. // (This is necessary in order to avoid repeating multiple push requests over the same data set). DataSetPushHandler pushHandler = pushRequestMap . get ( request . getDataSetUUID ( ) ) ; if ( pushHandler == null ) { // Create a push handler. pushHandler = new DataSetPushHandler ( metatada ) ; // Send the lookup request to the server... DataSetLookup lookupSourceDataSet = new DataSetLookup ( request . getDataSetUUID ( ) ) ; _lookupDataSet ( lookupSourceDataSet , pushHandler ) ; } // Register the lookup request into the current handler. pushHandler . registerLookup ( request , listener ) ; } // Lookup the remote data set otherwise. else { _lookupDataSet ( request , listener ) ; } } // Data set metadata not found public void notFound ( ) { listener . notFound ( ) ; } @ Override public boolean onError ( final ClientRuntimeError error ) { return listener . onError ( error ) ; } } ) ; } // Data set not found on client. else { listener . notFound ( ) ; } }
Process the specified data set lookup request .