protected String getNextAccountToRetrieve() { try { if (accountsToRetrieve == null) { logInfo("Getting list of accounts"); NetworkResponse response = gateway.listAccountsForMirroring(getSecurity()); String resultCode = response.getResultCode(); if (resultCode.equals(NetworkInterfaceConstants.OK)) { accountsToRetrieve = new Vector(response.getResultVector()); logNotice("Account count:" + accountsToRetrieve.size()); } else { logError("error returned by " + ip + ": " + resultCode); } } if (accountsToRetrieve == null || accountsToRetrieve.size() == 0) { accountsToRetrieve = null; return null; } return (String) accountsToRetrieve.remove(0); } catch (Exception e) { logError("getNextAccountToRetrieve: ", e); return null; } }
protected BulletinMirroringInformation getNextItemToRetrieve() { try { while (itemsToRetrieve.size() == 0) { String nextAccountId = getNextAccountToRetrieve(); if (nextAccountId == null) return null; int totalIdsReturned = 0; String mirroringCallUsed = "listAvailableIdsForMirroring"; NetworkResponse response = gateway.listAvailableIdsForMirroring(getSecurity(), nextAccountId); if (networkResponseOk(response)) { Vector listwithBulletinMirroringInfo = response.getResultVector(); totalIdsReturned = listwithBulletinMirroringInfo.size(); itemsToRetrieve = listOnlyPacketsThatWeWantUsingBulletinMirroringInformation( nextAccountId, listwithBulletinMirroringInfo); } else { mirroringCallUsed = "OLD MIRRORING CALL(listBulletinsForMirroring)"; response = gateway.listBulletinsForMirroring(getSecurity(), nextAccountId); if (networkResponseOk(response)) { Vector listWithLocalIds = response.getResultVector(); totalIdsReturned = listWithLocalIds.size(); itemsToRetrieve = listOnlyPacketsThatWeWantUsingLocalIds(nextAccountId, listWithLocalIds); } } if (networkResponseOk(response)) { String publicCode = MartusCrypto.getFormattedPublicCode(nextAccountId); if (totalIdsReturned > 0 || itemsToRetrieve.size() > 0) logInfo( mirroringCallUsed + ": " + publicCode + " -> " + totalIdsReturned + " -> " + itemsToRetrieve.size()); } else { logWarning( "MirroringRetriever.getNextItemToRetrieve: Returned NetworkResponse: " + response.getResultCode()); } } if (itemsToRetrieve.size() == 0) return null; return (BulletinMirroringInformation) itemsToRetrieve.remove(0); } catch (Exception e) { logError("MirroringRetriever.getNextUidToRetrieve: ", e); MartusLogger.logException(e); return null; } }