idx int64 0 41.2k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
13,300 | public Optional < String > header ( String headerName ) { return Optional . ofNullable ( httpMetadata . getHttpHeaders ( ) . get ( headerName ) ) ; } | Get a specific header from the HTTP response . |
13,301 | private JsonNode parseProcessOutput ( String processOutput ) { JsonNode credentialsJson = Jackson . jsonNodeOf ( processOutput ) ; if ( ! credentialsJson . isObject ( ) ) { throw new IllegalStateException ( "Process did not return a JSON object." ) ; } JsonNode version = credentialsJson . get ( "Version" ) ; if ( version == null || ! version . isInt ( ) || version . asInt ( ) != 1 ) { throw new IllegalStateException ( "Unsupported credential version: " + version ) ; } return credentialsJson ; } | Parse the output from the credentials process . |
13,302 | private AWSCredentials credentials ( JsonNode credentialsJson ) { String accessKeyId = getText ( credentialsJson , "AccessKeyId" ) ; String secretAccessKey = getText ( credentialsJson , "SecretAccessKey" ) ; String sessionToken = getText ( credentialsJson , "SessionToken" ) ; ValidationUtils . assertStringNotEmpty ( accessKeyId , "AccessKeyId" ) ; ValidationUtils . assertStringNotEmpty ( accessKeyId , "SecretAccessKey" ) ; if ( sessionToken != null ) { return new BasicSessionCredentials ( accessKeyId , secretAccessKey , sessionToken ) ; } else { return new BasicAWSCredentials ( accessKeyId , secretAccessKey ) ; } } | Parse the process output to retrieve the credentials . |
13,303 | private DateTime credentialExpirationTime ( JsonNode credentialsJson ) { String expiration = getText ( credentialsJson , "Expiration" ) ; if ( expiration != null ) { DateTime credentialExpiration = new DateTime ( DateUtils . parseISO8601Date ( expiration ) ) ; credentialExpiration = credentialExpiration . minus ( expirationBufferUnit . toMillis ( expirationBufferValue ) ) ; return credentialExpiration ; } else { return DateTime . now ( ) . plusYears ( 9999 ) ; } } | Parse the process output to retrieve the expiration date and time . The result includes any configured expiration buffer . |
13,304 | private String getText ( JsonNode jsonObject , String nodeName ) { JsonNode subNode = jsonObject . get ( nodeName ) ; if ( subNode == null ) { return null ; } if ( ! subNode . isTextual ( ) ) { throw new IllegalStateException ( nodeName + " from credential process should be textual, but was " + subNode . getNodeType ( ) ) ; } return subNode . asText ( ) ; } | Get a textual value from a json object throwing an exception if the node is missing or not textual . |
13,305 | private String executeCommand ( ) throws IOException , InterruptedException { ProcessBuilder processBuilder = new ProcessBuilder ( command ) ; ByteArrayOutputStream commandOutput = new ByteArrayOutputStream ( ) ; Process process = processBuilder . start ( ) ; try { IOUtils . copy ( process . getInputStream ( ) , commandOutput , processOutputLimit ) ; process . waitFor ( ) ; if ( process . exitValue ( ) != 0 ) { throw new IllegalStateException ( "Command returned non-zero exit value: " + process . exitValue ( ) ) ; } return new String ( commandOutput . toByteArray ( ) , StringUtils . UTF8 ) ; } finally { process . destroy ( ) ; } } | Execute the external process to retrieve credentials . |
13,306 | public void setAdditionalStagingLabelsToDownload ( java . util . Collection < String > additionalStagingLabelsToDownload ) { if ( additionalStagingLabelsToDownload == null ) { this . additionalStagingLabelsToDownload = null ; return ; } this . additionalStagingLabelsToDownload = new java . util . ArrayList < String > ( additionalStagingLabelsToDownload ) ; } | Optional . The staging labels whose values you want to make available on the core in addition to AWSCURRENT . |
13,307 | private ProfilesConfigFile getProfilesConfigFile ( ) { if ( configFile == null ) { synchronized ( this ) { if ( configFile == null ) { try { configFile = new ProfilesConfigFile ( configFileLocationProvider . getLocation ( ) ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to load config file" , e ) ; } } } } return configFile ; } | ProfilesConfigFile immediately loads the profiles at construction time |
13,308 | public void setWarnings ( java . util . Collection < SanitizationWarning > warnings ) { if ( warnings == null ) { this . warnings = null ; return ; } this . warnings = new java . util . ArrayList < SanitizationWarning > ( warnings ) ; } | The list of the first 20 warnings about the configuration XML elements or attributes that were sanitized . |
13,309 | public S3Location withCannedACL ( CannedAccessControlList cannedACL ) { setCannedACL ( cannedACL == null ? null : cannedACL . toString ( ) ) ; return this ; } | Sets the canned ACL to apply to the restore results . |
13,310 | public S3Location withStorageClass ( StorageClass storageClass ) { setStorageClass ( storageClass == null ? null : storageClass . toString ( ) ) ; return this ; } | Sets the class of storage used to store the restore results . |
13,311 | public void reset ( ) throws IOException { this . fis . close ( ) ; abortIfNeeded ( ) ; this . fis = new FileInputStream ( file ) ; long skipped = 0 ; long toSkip = markPoint ; while ( toSkip > 0 ) { skipped = this . fis . skip ( toSkip ) ; toSkip -= skipped ; } if ( log . isDebugEnabled ( ) ) { log . debug ( "Reset to mark point " + markPoint + " after returning " + bytesReadPastMarkPoint + " bytes" ) ; } this . bytesReadPastMarkPoint = 0 ; } | Resets the input stream to the last mark point or the beginning of the stream if there is no mark point by creating a new FileInputStream based on the underlying file . |
13,312 | public UploadResult upload ( final String accountId , final String vaultName , final String archiveDescription , final File file ) throws AmazonServiceException , AmazonClientException , FileNotFoundException { return upload ( accountId , vaultName , archiveDescription , file , null ) ; } | Uploads the specified file to Amazon Glacier for archival storage in the specified vault in the specified user s account . For small archives this method will upload the archive directly to Glacier . For larger archives this method will use Glacier s multipart upload API to split the upload into multiple parts for better error recovery if any errors are encountered while streaming the data to Amazon Glacier . |
13,313 | public UploadResult upload ( final String accountId , final String vaultName , final String archiveDescription , final File file , ProgressListener progressListener ) throws AmazonServiceException , AmazonClientException { if ( file . length ( ) > MULTIPART_UPLOAD_SIZE_THRESHOLD ) { return uploadInMultipleParts ( accountId , vaultName , archiveDescription , file , progressListener ) ; } else { return uploadInSinglePart ( accountId , vaultName , archiveDescription , file , progressListener ) ; } } | Uploads the specified file to Amazon Glacier for archival storage in the specified vault in the specified user s account . For small archives this method will upload the archive directly to Glacier . For larger archives this method will use Glacier s multipart upload API to split the upload into multiple parts for better error recovery if any errors are encountered while streaming the data to Amazon Glacier . You can also add an optional progress listener for receiving updates about the upload status . |
13,314 | public void download ( final String vaultName , final String archiveId , final File file ) throws AmazonServiceException , AmazonClientException { download ( null , vaultName , archiveId , file ) ; } | Downloads an archive from Amazon Glacier in the specified vault for the current user s account and saves it to the specified file . Amazon Glacier is optimized for long term storage of data that isn t needed quickly . This method will first make a request to Amazon Glacier to prepare the archive to be downloaded . Once Glacier has finished preparing the archive to be downloaded this method will start downloading the data and storing it in the specified file . Also this method will download the archive in multiple chunks using range retrieval for better error recovery if any errors are encountered while streaming the data from Amazon Glacier . |
13,315 | public void download ( final String accountId , final String vaultName , final String archiveId , final File file , ProgressListener progressListener ) throws AmazonServiceException , AmazonClientException { JobStatusMonitor jobStatusMonitor = null ; String jobId = null ; publishProgress ( progressListener , ProgressEventType . TRANSFER_PREPARING_EVENT ) ; try { if ( credentialsProvider != null && clientConfiguration != null ) { jobStatusMonitor = new JobStatusMonitor ( credentialsProvider , clientConfiguration ) ; } else { jobStatusMonitor = new JobStatusMonitor ( sqs , sns ) ; } JobParameters jobParameters = new JobParameters ( ) . withArchiveId ( archiveId ) . withType ( "archive-retrieval" ) . withSNSTopic ( jobStatusMonitor . getTopicArn ( ) ) ; InitiateJobResult archiveRetrievalResult = glacier . initiateJob ( new InitiateJobRequest ( ) . withAccountId ( accountId ) . withVaultName ( vaultName ) . withJobParameters ( jobParameters ) ) ; jobId = archiveRetrievalResult . getJobId ( ) ; jobStatusMonitor . waitForJobToComplete ( jobId ) ; } catch ( Throwable t ) { publishProgress ( progressListener , ProgressEventType . TRANSFER_FAILED_EVENT ) ; throw failure ( t ) ; } finally { if ( jobStatusMonitor != null ) { jobStatusMonitor . shutdown ( ) ; } } downloadJobOutput ( accountId , vaultName , jobId , file , progressListener ) ; } | Downloads an archive from Amazon Glacier in the specified vault in the specified user s account and saves it to the specified file . Amazon Glacier is optimized for long term storage of data that isn t needed quickly . This method will first make a request to Amazon Glacier to prepare the archive to be downloaded . Once Glacier has finished preparing the archive to be downloaded this method will start downloading the data and storing it in the specified file . You can also add an optional progress listener for receiving updates about the download status . |
13,316 | private void downloadOneChunk ( String accountId , String vaultName , String jobId , RandomAccessFile output , long currentPosition , long endPosition , ProgressListener progressListener ) { final long chunkSize = endPosition - currentPosition + 1 ; TreeHashInputStream input = null ; int retries = 0 ; while ( true ) { try { GetJobOutputRequest req = new GetJobOutputRequest ( ) . withAccountId ( accountId ) . withVaultName ( vaultName ) . withRange ( "bytes=" + currentPosition + "-" + endPosition ) . withJobId ( jobId ) . withGeneralProgressListener ( progressListener ) ; GetJobOutputResult jobOutputResult = glacier . getJobOutput ( req ) ; try { input = new TreeHashInputStream ( new BufferedInputStream ( jobOutputResult . getBody ( ) ) ) ; appendToFile ( output , input ) ; } catch ( NoSuchAlgorithmException e ) { throw failure ( e , "Unable to compute hash for data integrity" ) ; } finally { closeQuietly ( input , log ) ; } if ( null != jobOutputResult . getChecksum ( ) ) { if ( ! input . getTreeHash ( ) . equalsIgnoreCase ( jobOutputResult . getChecksum ( ) ) ) { publishResponseBytesDiscarded ( progressListener , chunkSize ) ; if ( log . isDebugEnabled ( ) ) log . debug ( "reverting " + chunkSize ) ; throw new IOException ( "Client side computed hash doesn't match server side hash; possible data corruption" ) ; } } else { log . warn ( "Cannot validate the downloaded output since no tree-hash checksum is returned from Glacier. " + "Make sure the InitiateJob and GetJobOutput requests use tree-hash-aligned ranges." ) ; } return ; } catch ( IOException ioe ) { if ( retries < DEFAULT_MAX_RETRIES ) { retries ++ ; if ( log . isDebugEnabled ( ) ) { log . debug ( retries + " retry downloadOneChunk accountId=" + accountId + ", vaultName=" + vaultName + ", jobId=" + jobId + ", currentPosition=" + currentPosition + " endPosition=" + endPosition ) ; } try { output . seek ( currentPosition ) ; } catch ( IOException e ) { throw new AmazonClientException ( "Unable to download the archive: " + ioe . getMessage ( ) , e ) ; } } else { throw new AmazonClientException ( "Unable to download the archive: " + ioe . getMessage ( ) , ioe ) ; } } } } | Download one chunk from Amazon Glacier . It will do the retry if any errors are encountered while streaming the data from Amazon Glacier . |
13,317 | private void appendToFile ( RandomAccessFile output , InputStream input ) throws IOException { byte [ ] buffer = new byte [ 1024 * 1024 ] ; int bytesRead = 0 ; do { bytesRead = input . read ( buffer ) ; if ( bytesRead < 0 ) break ; output . write ( buffer , 0 , bytesRead ) ; } while ( bytesRead > 0 ) ; return ; } | Writes the data from the given input stream to the given output stream . |
13,318 | private int matchXmlNamespaceAttribute ( String s ) { StringPrefixSlicer stringSlicer = new StringPrefixSlicer ( s ) ; if ( stringSlicer . removePrefix ( "xmlns" ) == false ) return - 1 ; stringSlicer . removeRepeatingPrefix ( " " ) ; if ( stringSlicer . removePrefix ( "=" ) == false ) return - 1 ; stringSlicer . removeRepeatingPrefix ( " " ) ; if ( stringSlicer . removePrefix ( "\"" ) == false ) return - 1 ; if ( stringSlicer . removePrefixEndingWith ( "\"" ) == false ) return - 1 ; return s . length ( ) - stringSlicer . getString ( ) . length ( ) ; } | Checks if the string starts with a complete XML namespace attribute and if so returns the number of characters that match . |
13,319 | public GetDocumentStreamResult getDocumentStream ( final GetDocumentStreamRequest getDocumentStreamRequest ) { String versionId = getDocumentStreamRequest . getVersionId ( ) ; if ( versionId == null ) { GetDocumentRequest getDocumentRequest = new GetDocumentRequest ( ) ; getDocumentRequest . setDocumentId ( getDocumentStreamRequest . getDocumentId ( ) ) ; String requestAuthenticationToken = getDocumentStreamRequest . getAuthenticationToken ( ) ; if ( requestAuthenticationToken != null ) { getDocumentRequest . setAuthenticationToken ( requestAuthenticationToken ) ; } else { getDocumentRequest . setAuthenticationToken ( authenticationToken ) ; } GetDocumentResult result = client . getDocument ( getDocumentRequest ) ; versionId = result . getMetadata ( ) . getLatestVersionMetadata ( ) . getId ( ) ; } GetDocumentStreamResult getDocumentStreamResult = new GetDocumentStreamResult ( getDocumentStreamRequest ) ; getDocumentStreamResult . setVersionId ( versionId ) ; InputStream stream = getDocumentVersionStream ( getDocumentStreamRequest . getDocumentId ( ) , versionId ) ; getDocumentStreamResult . setStream ( stream ) ; return getDocumentStreamResult ; } | Gets document stream from WorkDocs . If VersionId of GetDocumentStreamRequest is not specified then the latest version of specified document is retrieved . Clients must close the stream once content is read . |
13,320 | public UploadDocumentStreamResult uploadDocumentStream ( UploadDocumentStreamRequest uploadDocumentStreamRequest ) { InputStream stream = uploadDocumentStreamRequest . getStream ( ) ; if ( stream == null ) { throw new IllegalArgumentException ( "InputStream must be specified." ) ; } InitiateDocumentVersionUploadRequest initiateDocumentVersionUploadRequest = new InitiateDocumentVersionUploadRequest ( ) ; initiateDocumentVersionUploadRequest . setParentFolderId ( uploadDocumentStreamRequest . getParentFolderId ( ) ) ; initiateDocumentVersionUploadRequest . setName ( uploadDocumentStreamRequest . getDocumentName ( ) ) ; initiateDocumentVersionUploadRequest . setContentType ( uploadDocumentStreamRequest . getContentType ( ) ) ; initiateDocumentVersionUploadRequest . setContentCreatedTimestamp ( uploadDocumentStreamRequest . getContentCreatedTimestamp ( ) ) ; initiateDocumentVersionUploadRequest . setContentModifiedTimestamp ( uploadDocumentStreamRequest . getContentModifiedTimestamp ( ) ) ; initiateDocumentVersionUploadRequest . setDocumentSizeInBytes ( uploadDocumentStreamRequest . getDocumentSizeInBytes ( ) ) ; initiateDocumentVersionUploadRequest . setId ( uploadDocumentStreamRequest . getDocumentId ( ) ) ; String requestAuthenticationToken = uploadDocumentStreamRequest . getAuthenticationToken ( ) ; if ( requestAuthenticationToken != null ) { initiateDocumentVersionUploadRequest . setAuthenticationToken ( requestAuthenticationToken ) ; } else { initiateDocumentVersionUploadRequest . setAuthenticationToken ( authenticationToken ) ; } InitiateDocumentVersionUploadResult result = client . initiateDocumentVersionUpload ( initiateDocumentVersionUploadRequest ) ; UploadMetadata uploadMetadata = result . getUploadMetadata ( ) ; String documentId = result . getMetadata ( ) . getId ( ) ; String versionId = result . getMetadata ( ) . getLatestVersionMetadata ( ) . getId ( ) ; String uploadUrl = uploadMetadata . getUploadUrl ( ) ; try { URL url = new URL ( uploadUrl ) ; HttpURLConnection connection = ( HttpURLConnection ) url . openConnection ( ) ; connection . setDoOutput ( true ) ; connection . setRequestMethod ( "PUT" ) ; connection . setRequestProperty ( "Content-Type" , uploadDocumentStreamRequest . getContentType ( ) ) ; connection . setRequestProperty ( "x-amz-server-side-encryption" , "AES256" ) ; OutputStream outputStream = connection . getOutputStream ( ) ; IOUtils . copy ( stream , outputStream ) ; connection . getResponseCode ( ) ; } catch ( MalformedURLException e ) { throw new SdkClientException ( e ) ; } catch ( IOException e ) { throw new SdkClientException ( e ) ; } UpdateDocumentVersionRequest updateDocumentVersionRequest = new UpdateDocumentVersionRequest ( ) ; updateDocumentVersionRequest . setDocumentId ( documentId ) ; updateDocumentVersionRequest . setVersionId ( versionId ) ; updateDocumentVersionRequest . setVersionStatus ( DocumentVersionStatus . ACTIVE ) ; if ( authenticationToken != null ) { updateDocumentVersionRequest . setAuthenticationToken ( authenticationToken ) ; } UpdateDocumentVersionResult updateDocumentVersionResult = client . updateDocumentVersion ( updateDocumentVersionRequest ) ; UploadDocumentStreamResult uploadDocumentStreamResult = new UploadDocumentStreamResult ( uploadDocumentStreamRequest ) ; uploadDocumentStreamResult . setDocumentId ( documentId ) ; uploadDocumentStreamResult . setVersionId ( versionId ) ; return uploadDocumentStreamResult ; } | Uploads document stream to WorkDocs . If document ID is specified then it creates a new version under this document . If document ID is not specified then it creates a new document and uploads content to its only version . \ Client must close the input stream once upload operation is complete . |
13,321 | public Waiter < ReadJobRequest > jobComplete ( ) { return new WaiterBuilder < ReadJobRequest , ReadJobResult > ( ) . withSdkFunction ( new ReadJobFunction ( client ) ) . withAcceptors ( new JobComplete . IsCompleteMatcher ( ) , new JobComplete . IsCanceledMatcher ( ) , new JobComplete . IsErrorMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 120 ) , new FixedDelayStrategy ( 30 ) ) ) . withExecutorService ( executorService ) . build ( ) ; } | Builds a JobComplete waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy . |
13,322 | private boolean isDownloadParallel ( PresignedUrlDownloadRequest request , Long startByte , Long endByte , long partialObjectMaxSize ) { return ! configuration . isDisableParallelDownloads ( ) && ! ( s3 instanceof AmazonS3Encryption ) && request . getRange ( ) == null && ( startByte != null && endByte != null && endByte - startByte + 1 > partialObjectMaxSize ) ; } | Returns a boolean value indicating if object can be downloaded in parallel when using presigned url . |
13,323 | public Download resumeDownload ( PersistableDownload persistableDownload ) { assertParameterNotNull ( persistableDownload , "PausedDownload is mandatory to resume a download." ) ; GetObjectRequest request = new GetObjectRequest ( persistableDownload . getBucketName ( ) , persistableDownload . getKey ( ) , persistableDownload . getVersionId ( ) ) ; if ( persistableDownload . getRange ( ) != null && persistableDownload . getRange ( ) . length == 2 ) { long [ ] range = persistableDownload . getRange ( ) ; request . setRange ( range [ 0 ] , range [ 1 ] ) ; } request . setRequesterPays ( persistableDownload . isRequesterPays ( ) ) ; request . setResponseHeaders ( persistableDownload . getResponseHeaders ( ) ) ; return doDownload ( request , new File ( persistableDownload . getFile ( ) ) , null , null , APPEND_MODE , 0 , persistableDownload ) ; } | Resumes an download operation . This download operation uses the same configuration as the original download . Any data already fetched will be skipped and only the remaining data is retrieved from Amazon S3 . |
13,324 | public java . util . concurrent . Future < ChangeMessageVisibilityResult > changeMessageVisibilityAsync ( String queueUrl , String receiptHandle , Integer visibilityTimeout , com . amazonaws . handlers . AsyncHandler < ChangeMessageVisibilityRequest , ChangeMessageVisibilityResult > asyncHandler ) { return changeMessageVisibilityAsync ( new ChangeMessageVisibilityRequest ( ) . withQueueUrl ( queueUrl ) . withReceiptHandle ( receiptHandle ) . withVisibilityTimeout ( visibilityTimeout ) , asyncHandler ) ; } | Simplified method form for invoking the ChangeMessageVisibility operation with an AsyncHandler . |
13,325 | public java . util . concurrent . Future < ChangeMessageVisibilityBatchResult > changeMessageVisibilityBatchAsync ( String queueUrl , java . util . List < ChangeMessageVisibilityBatchRequestEntry > entries , com . amazonaws . handlers . AsyncHandler < ChangeMessageVisibilityBatchRequest , ChangeMessageVisibilityBatchResult > asyncHandler ) { return changeMessageVisibilityBatchAsync ( new ChangeMessageVisibilityBatchRequest ( ) . withQueueUrl ( queueUrl ) . withEntries ( entries ) , asyncHandler ) ; } | Simplified method form for invoking the ChangeMessageVisibilityBatch operation with an AsyncHandler . |
13,326 | public java . util . concurrent . Future < CreateQueueResult > createQueueAsync ( String queueName ) { return createQueueAsync ( new CreateQueueRequest ( ) . withQueueName ( queueName ) ) ; } | Simplified method form for invoking the CreateQueue operation . |
13,327 | public java . util . concurrent . Future < CreateQueueResult > createQueueAsync ( String queueName , com . amazonaws . handlers . AsyncHandler < CreateQueueRequest , CreateQueueResult > asyncHandler ) { return createQueueAsync ( new CreateQueueRequest ( ) . withQueueName ( queueName ) , asyncHandler ) ; } | Simplified method form for invoking the CreateQueue operation with an AsyncHandler . |
13,328 | public java . util . concurrent . Future < DeleteMessageResult > deleteMessageAsync ( String queueUrl , String receiptHandle ) { return deleteMessageAsync ( new DeleteMessageRequest ( ) . withQueueUrl ( queueUrl ) . withReceiptHandle ( receiptHandle ) ) ; } | Simplified method form for invoking the DeleteMessage operation . |
13,329 | public java . util . concurrent . Future < DeleteMessageResult > deleteMessageAsync ( String queueUrl , String receiptHandle , com . amazonaws . handlers . AsyncHandler < DeleteMessageRequest , DeleteMessageResult > asyncHandler ) { return deleteMessageAsync ( new DeleteMessageRequest ( ) . withQueueUrl ( queueUrl ) . withReceiptHandle ( receiptHandle ) , asyncHandler ) ; } | Simplified method form for invoking the DeleteMessage operation with an AsyncHandler . |
13,330 | public java . util . concurrent . Future < DeleteMessageBatchResult > deleteMessageBatchAsync ( String queueUrl , java . util . List < DeleteMessageBatchRequestEntry > entries ) { return deleteMessageBatchAsync ( new DeleteMessageBatchRequest ( ) . withQueueUrl ( queueUrl ) . withEntries ( entries ) ) ; } | Simplified method form for invoking the DeleteMessageBatch operation . |
13,331 | public java . util . concurrent . Future < DeleteMessageBatchResult > deleteMessageBatchAsync ( String queueUrl , java . util . List < DeleteMessageBatchRequestEntry > entries , com . amazonaws . handlers . AsyncHandler < DeleteMessageBatchRequest , DeleteMessageBatchResult > asyncHandler ) { return deleteMessageBatchAsync ( new DeleteMessageBatchRequest ( ) . withQueueUrl ( queueUrl ) . withEntries ( entries ) , asyncHandler ) ; } | Simplified method form for invoking the DeleteMessageBatch operation with an AsyncHandler . |
13,332 | public java . util . concurrent . Future < DeleteQueueResult > deleteQueueAsync ( String queueUrl ) { return deleteQueueAsync ( new DeleteQueueRequest ( ) . withQueueUrl ( queueUrl ) ) ; } | Simplified method form for invoking the DeleteQueue operation . |
13,333 | public java . util . concurrent . Future < DeleteQueueResult > deleteQueueAsync ( String queueUrl , com . amazonaws . handlers . AsyncHandler < DeleteQueueRequest , DeleteQueueResult > asyncHandler ) { return deleteQueueAsync ( new DeleteQueueRequest ( ) . withQueueUrl ( queueUrl ) , asyncHandler ) ; } | Simplified method form for invoking the DeleteQueue operation with an AsyncHandler . |
13,334 | public java . util . concurrent . Future < GetQueueAttributesResult > getQueueAttributesAsync ( String queueUrl , java . util . List < String > attributeNames ) { return getQueueAttributesAsync ( new GetQueueAttributesRequest ( ) . withQueueUrl ( queueUrl ) . withAttributeNames ( attributeNames ) ) ; } | Simplified method form for invoking the GetQueueAttributes operation . |
13,335 | public java . util . concurrent . Future < GetQueueAttributesResult > getQueueAttributesAsync ( String queueUrl , java . util . List < String > attributeNames , com . amazonaws . handlers . AsyncHandler < GetQueueAttributesRequest , GetQueueAttributesResult > asyncHandler ) { return getQueueAttributesAsync ( new GetQueueAttributesRequest ( ) . withQueueUrl ( queueUrl ) . withAttributeNames ( attributeNames ) , asyncHandler ) ; } | Simplified method form for invoking the GetQueueAttributes operation with an AsyncHandler . |
13,336 | public java . util . concurrent . Future < GetQueueUrlResult > getQueueUrlAsync ( String queueName ) { return getQueueUrlAsync ( new GetQueueUrlRequest ( ) . withQueueName ( queueName ) ) ; } | Simplified method form for invoking the GetQueueUrl operation . |
13,337 | public java . util . concurrent . Future < GetQueueUrlResult > getQueueUrlAsync ( String queueName , com . amazonaws . handlers . AsyncHandler < GetQueueUrlRequest , GetQueueUrlResult > asyncHandler ) { return getQueueUrlAsync ( new GetQueueUrlRequest ( ) . withQueueName ( queueName ) , asyncHandler ) ; } | Simplified method form for invoking the GetQueueUrl operation with an AsyncHandler . |
13,338 | public java . util . concurrent . Future < ListQueueTagsResult > listQueueTagsAsync ( String queueUrl ) { return listQueueTagsAsync ( new ListQueueTagsRequest ( ) . withQueueUrl ( queueUrl ) ) ; } | Simplified method form for invoking the ListQueueTags operation . |
13,339 | public java . util . concurrent . Future < ListQueueTagsResult > listQueueTagsAsync ( String queueUrl , com . amazonaws . handlers . AsyncHandler < ListQueueTagsRequest , ListQueueTagsResult > asyncHandler ) { return listQueueTagsAsync ( new ListQueueTagsRequest ( ) . withQueueUrl ( queueUrl ) , asyncHandler ) ; } | Simplified method form for invoking the ListQueueTags operation with an AsyncHandler . |
13,340 | public java . util . concurrent . Future < ListQueuesResult > listQueuesAsync ( String queueNamePrefix ) { return listQueuesAsync ( new ListQueuesRequest ( ) . withQueueNamePrefix ( queueNamePrefix ) ) ; } | Simplified method form for invoking the ListQueues operation . |
13,341 | public java . util . concurrent . Future < ReceiveMessageResult > receiveMessageAsync ( String queueUrl ) { return receiveMessageAsync ( new ReceiveMessageRequest ( ) . withQueueUrl ( queueUrl ) ) ; } | Simplified method form for invoking the ReceiveMessage operation . |
13,342 | public java . util . concurrent . Future < ReceiveMessageResult > receiveMessageAsync ( String queueUrl , com . amazonaws . handlers . AsyncHandler < ReceiveMessageRequest , ReceiveMessageResult > asyncHandler ) { return receiveMessageAsync ( new ReceiveMessageRequest ( ) . withQueueUrl ( queueUrl ) , asyncHandler ) ; } | Simplified method form for invoking the ReceiveMessage operation with an AsyncHandler . |
13,343 | public java . util . concurrent . Future < SendMessageResult > sendMessageAsync ( String queueUrl , String messageBody ) { return sendMessageAsync ( new SendMessageRequest ( ) . withQueueUrl ( queueUrl ) . withMessageBody ( messageBody ) ) ; } | Simplified method form for invoking the SendMessage operation . |
13,344 | public java . util . concurrent . Future < SendMessageResult > sendMessageAsync ( String queueUrl , String messageBody , com . amazonaws . handlers . AsyncHandler < SendMessageRequest , SendMessageResult > asyncHandler ) { return sendMessageAsync ( new SendMessageRequest ( ) . withQueueUrl ( queueUrl ) . withMessageBody ( messageBody ) , asyncHandler ) ; } | Simplified method form for invoking the SendMessage operation with an AsyncHandler . |
13,345 | public java . util . concurrent . Future < SendMessageBatchResult > sendMessageBatchAsync ( String queueUrl , java . util . List < SendMessageBatchRequestEntry > entries ) { return sendMessageBatchAsync ( new SendMessageBatchRequest ( ) . withQueueUrl ( queueUrl ) . withEntries ( entries ) ) ; } | Simplified method form for invoking the SendMessageBatch operation . |
13,346 | public java . util . concurrent . Future < SendMessageBatchResult > sendMessageBatchAsync ( String queueUrl , java . util . List < SendMessageBatchRequestEntry > entries , com . amazonaws . handlers . AsyncHandler < SendMessageBatchRequest , SendMessageBatchResult > asyncHandler ) { return sendMessageBatchAsync ( new SendMessageBatchRequest ( ) . withQueueUrl ( queueUrl ) . withEntries ( entries ) , asyncHandler ) ; } | Simplified method form for invoking the SendMessageBatch operation with an AsyncHandler . |
13,347 | public java . util . concurrent . Future < SetQueueAttributesResult > setQueueAttributesAsync ( String queueUrl , java . util . Map < String , String > attributes ) { return setQueueAttributesAsync ( new SetQueueAttributesRequest ( ) . withQueueUrl ( queueUrl ) . withAttributes ( attributes ) ) ; } | Simplified method form for invoking the SetQueueAttributes operation . |
13,348 | public java . util . concurrent . Future < SetQueueAttributesResult > setQueueAttributesAsync ( String queueUrl , java . util . Map < String , String > attributes , com . amazonaws . handlers . AsyncHandler < SetQueueAttributesRequest , SetQueueAttributesResult > asyncHandler ) { return setQueueAttributesAsync ( new SetQueueAttributesRequest ( ) . withQueueUrl ( queueUrl ) . withAttributes ( attributes ) , asyncHandler ) ; } | Simplified method form for invoking the SetQueueAttributes operation with an AsyncHandler . |
13,349 | public java . util . concurrent . Future < TagQueueResult > tagQueueAsync ( String queueUrl , java . util . Map < String , String > tags ) { return tagQueueAsync ( new TagQueueRequest ( ) . withQueueUrl ( queueUrl ) . withTags ( tags ) ) ; } | Simplified method form for invoking the TagQueue operation . |
13,350 | public java . util . concurrent . Future < TagQueueResult > tagQueueAsync ( String queueUrl , java . util . Map < String , String > tags , com . amazonaws . handlers . AsyncHandler < TagQueueRequest , TagQueueResult > asyncHandler ) { return tagQueueAsync ( new TagQueueRequest ( ) . withQueueUrl ( queueUrl ) . withTags ( tags ) , asyncHandler ) ; } | Simplified method form for invoking the TagQueue operation with an AsyncHandler . |
13,351 | public java . util . concurrent . Future < UntagQueueResult > untagQueueAsync ( String queueUrl , java . util . List < String > tagKeys ) { return untagQueueAsync ( new UntagQueueRequest ( ) . withQueueUrl ( queueUrl ) . withTagKeys ( tagKeys ) ) ; } | Simplified method form for invoking the UntagQueue operation . |
13,352 | public java . util . concurrent . Future < UntagQueueResult > untagQueueAsync ( String queueUrl , java . util . List < String > tagKeys , com . amazonaws . handlers . AsyncHandler < UntagQueueRequest , UntagQueueResult > asyncHandler ) { return untagQueueAsync ( new UntagQueueRequest ( ) . withQueueUrl ( queueUrl ) . withTagKeys ( tagKeys ) , asyncHandler ) ; } | Simplified method form for invoking the UntagQueue operation with an AsyncHandler . |
13,353 | private MemberModel tryFindMemberModelByC2jName ( String memberC2jName , boolean ignoreCase ) { final List < MemberModel > memberModels = getMembers ( ) ; final String expectedName = ignoreCase ? StringUtils . lowerCase ( memberC2jName ) : memberC2jName ; if ( memberModels != null ) { for ( MemberModel member : memberModels ) { String actualName = ignoreCase ? StringUtils . lowerCase ( member . getC2jName ( ) ) : member . getC2jName ( ) ; if ( expectedName . equals ( actualName ) ) { return member ; } } } return null ; } | Tries to find the member model associated with the given c2j member name from this shape model . Returns the member model if present else returns null . |
13,354 | public MemberModel findMemberModelByC2jName ( String memberC2jName ) { MemberModel model = tryFindMemberModelByC2jName ( memberC2jName , false ) ; if ( model == null ) { throw new IllegalArgumentException ( memberC2jName + " member (c2j name) does not exist in the shape." ) ; } return model ; } | Returns the member model associated with the given c2j member name from this shape model . |
13,355 | public boolean removeMemberByC2jName ( String memberC2jName , boolean ignoreCase ) { MemberModel model = tryFindMemberModelByC2jName ( memberC2jName , ignoreCase ) ; return model == null ? false : members . remove ( model ) ; } | Takes in the c2j member name as input and removes if the shape contains a member with the given name . Return false otherwise . |
13,356 | public EnumModel findEnumModelByValue ( String enumValue ) { if ( enums != null ) { for ( EnumModel enumModel : enums ) { if ( enumValue . equals ( enumModel . getValue ( ) ) ) { return enumModel ; } } } return null ; } | Returns the enum model for the given enum value . Returns null if no such enum value exists . |
13,357 | public void setItem ( java . util . Collection < EndpointBatchItem > item ) { if ( item == null ) { this . item = null ; return ; } this . item = new java . util . ArrayList < EndpointBatchItem > ( item ) ; } | List of items to update . Maximum 100 items |
13,358 | public TableKeysAndAttributes withPrimaryKeys ( PrimaryKey ... primaryKeys ) { if ( primaryKeys == null ) this . primaryKeys = null ; else { Set < String > pkNameSet = null ; for ( PrimaryKey pk : primaryKeys ) { if ( pkNameSet == null ) pkNameSet = pk . getComponentNameSet ( ) ; else { if ( ! pkNameSet . equals ( pk . getComponentNameSet ( ) ) ) { throw new IllegalArgumentException ( "primary key attribute names must be consistent for the specified primary keys" ) ; } } } this . primaryKeys = new ArrayList < PrimaryKey > ( Arrays . asList ( primaryKeys ) ) ; } return this ; } | Used to specify multiple primary keys . A primary key could consist of either a hash - key or both a hash - key and a range - key depending on the schema of the table . |
13,359 | public TableKeysAndAttributes withHashOnlyKeys ( String hashKeyName , Object ... hashKeyValues ) { if ( hashKeyName == null ) throw new IllegalArgumentException ( ) ; PrimaryKey [ ] primaryKeys = new PrimaryKey [ hashKeyValues . length ] ; for ( int i = 0 ; i < hashKeyValues . length ; i ++ ) primaryKeys [ i ] = new PrimaryKey ( hashKeyName , hashKeyValues [ i ] ) ; return withPrimaryKeys ( primaryKeys ) ; } | Used to specify multiple hash - only primary keys . |
13,360 | public TableKeysAndAttributes withHashAndRangeKeys ( String hashKeyName , String rangeKeyName , Object ... alternatingHashAndRangeKeyValues ) { if ( hashKeyName == null ) throw new IllegalArgumentException ( "hash key name must be specified" ) ; if ( rangeKeyName == null ) throw new IllegalArgumentException ( "range key name must be specified" ) ; if ( alternatingHashAndRangeKeyValues . length % 2 != 0 ) throw new IllegalArgumentException ( "number of hash and range key values must be the same" ) ; final int len = alternatingHashAndRangeKeyValues . length / 2 ; PrimaryKey [ ] primaryKeys = new PrimaryKey [ len ] ; for ( int i = 0 ; i < alternatingHashAndRangeKeyValues . length ; i += 2 ) { primaryKeys [ i >> 1 ] = new PrimaryKey ( hashKeyName , alternatingHashAndRangeKeyValues [ i ] , rangeKeyName , alternatingHashAndRangeKeyValues [ i + 1 ] ) ; } return withPrimaryKeys ( primaryKeys ) ; } | Used to specify multiple hash - and - range primary keys . |
13,361 | public TableKeysAndAttributes addPrimaryKey ( PrimaryKey primaryKey ) { if ( primaryKey != null ) { if ( primaryKeys == null ) primaryKeys = new ArrayList < PrimaryKey > ( ) ; checkConsistency ( primaryKey ) ; this . primaryKeys . add ( primaryKey ) ; } return this ; } | Adds a primary key to be included in the batch get - item operation . A primary key could consist of either a hash - key or both a hash - key and a range - key depending on the schema of the table . |
13,362 | public TableKeysAndAttributes addHashOnlyPrimaryKey ( String hashKeyName , Object hashKeyValue ) { this . addPrimaryKey ( new PrimaryKey ( hashKeyName , hashKeyValue ) ) ; return this ; } | Adds a hash - only primary key to be included in the batch get - item operation . |
13,363 | public TableKeysAndAttributes addHashOnlyPrimaryKeys ( String hashKeyName , Object ... hashKeyValues ) { for ( Object hashKeyValue : hashKeyValues ) { this . addPrimaryKey ( new PrimaryKey ( hashKeyName , hashKeyValue ) ) ; } return this ; } | Adds multiple hash - only primary keys to be included in the batch get - item operation . |
13,364 | public TableKeysAndAttributes addHashAndRangePrimaryKeys ( String hashKeyName , String rangeKeyName , Object ... alternatingHashRangeKeyValues ) { if ( alternatingHashRangeKeyValues . length % 2 != 0 ) { throw new IllegalArgumentException ( "The multiple hash and range key values must alternate" ) ; } for ( int i = 0 ; i < alternatingHashRangeKeyValues . length ; i += 2 ) { Object hashKeyValue = alternatingHashRangeKeyValues [ i ] ; Object rangeKeyValue = alternatingHashRangeKeyValues [ i + 1 ] ; this . addPrimaryKey ( new PrimaryKey ( ) . addComponent ( hashKeyName , hashKeyValue ) . addComponent ( rangeKeyName , rangeKeyValue ) ) ; } return this ; } | Adds multiple hash - and - range primary keys to be included in the batch get - item operation . |
13,365 | public TableKeysAndAttributes withAttributeNames ( String ... attributeNames ) { if ( attributeNames == null ) this . attributeNames = null ; else this . attributeNames = Collections . unmodifiableSet ( new LinkedHashSet < String > ( Arrays . asList ( attributeNames ) ) ) ; return this ; } | Used to specify the attributes to be retrieved in each item returned from the batch get - item operation . |
13,366 | public Waiter < DescribeAppsRequest > appExists ( ) { return new WaiterBuilder < DescribeAppsRequest , DescribeAppsResult > ( ) . withSdkFunction ( new DescribeAppsFunction ( client ) ) . withAcceptors ( new HttpSuccessStatusAcceptor ( WaiterState . SUCCESS ) , new HttpFailureStatusAcceptor ( 400 , WaiterState . FAILURE ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 40 ) , new FixedDelayStrategy ( 1 ) ) ) . withExecutorService ( executorService ) . build ( ) ; } | Builds a AppExists waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy . |
13,367 | public Waiter < DescribeInstancesRequest > instanceOnline ( ) { return new WaiterBuilder < DescribeInstancesRequest , DescribeInstancesResult > ( ) . withSdkFunction ( new DescribeInstancesFunction ( client ) ) . withAcceptors ( new InstanceOnline . IsOnlineMatcher ( ) , new InstanceOnline . IsSetup_failedMatcher ( ) , new InstanceOnline . IsShutting_downMatcher ( ) , new InstanceOnline . IsStart_failedMatcher ( ) , new InstanceOnline . IsStoppedMatcher ( ) , new InstanceOnline . IsStoppingMatcher ( ) , new InstanceOnline . IsTerminatingMatcher ( ) , new InstanceOnline . IsTerminatedMatcher ( ) , new InstanceOnline . IsStop_failedMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 40 ) , new FixedDelayStrategy ( 15 ) ) ) . withExecutorService ( executorService ) . build ( ) ; } | Builds a InstanceOnline waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy . |
13,368 | public Waiter < DescribeInstancesRequest > instanceRegistered ( ) { return new WaiterBuilder < DescribeInstancesRequest , DescribeInstancesResult > ( ) . withSdkFunction ( new DescribeInstancesFunction ( client ) ) . withAcceptors ( new InstanceRegistered . IsRegisteredMatcher ( ) , new InstanceRegistered . IsSetup_failedMatcher ( ) , new InstanceRegistered . IsShutting_downMatcher ( ) , new InstanceRegistered . IsStoppedMatcher ( ) , new InstanceRegistered . IsStoppingMatcher ( ) , new InstanceRegistered . IsTerminatingMatcher ( ) , new InstanceRegistered . IsTerminatedMatcher ( ) , new InstanceRegistered . IsStop_failedMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 40 ) , new FixedDelayStrategy ( 15 ) ) ) . withExecutorService ( executorService ) . build ( ) ; } | Builds a InstanceRegistered waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy . |
13,369 | public void setState ( TransferState state ) { super . setState ( state ) ; switch ( state ) { case Completed : fireProgressEvent ( ProgressEventType . TRANSFER_COMPLETED_EVENT ) ; break ; case Canceled : fireProgressEvent ( ProgressEventType . TRANSFER_CANCELED_EVENT ) ; break ; case Failed : fireProgressEvent ( ProgressEventType . TRANSFER_FAILED_EVENT ) ; break ; default : break ; } } | This method is also responsible for firing COMPLETED signal to the listeners . |
13,370 | private void updateDownloadStatus ( S3Object result ) { if ( result == null ) { download . setState ( Transfer . TransferState . Canceled ) ; download . setMonitor ( new DownloadMonitor ( download , null ) ) ; } else { download . setState ( Transfer . TransferState . Completed ) ; } } | Takes the result from serial download updates the transfer state and monitor in downloadImpl object based on the result . |
13,371 | private void addHeadersToRequest ( HttpRequestBase httpRequest , Request < ? > request ) { httpRequest . addHeader ( HttpHeaders . HOST , getHostHeaderValue ( request . getEndpoint ( ) ) ) ; for ( Entry < String , String > entry : request . getHeaders ( ) . entrySet ( ) ) { if ( ! ( ignoreHeaders . contains ( entry . getKey ( ) ) ) ) { httpRequest . addHeader ( entry . getKey ( ) , entry . getValue ( ) ) ; } } if ( httpRequest . getHeaders ( HttpHeaders . CONTENT_TYPE ) == null || httpRequest . getHeaders ( HttpHeaders . CONTENT_TYPE ) . length == 0 ) { httpRequest . addHeader ( HttpHeaders . CONTENT_TYPE , "application/x-www-form-urlencoded; " + "charset=" + DEFAULT_ENCODING . toLowerCase ( ) ) ; } } | Configures the headers in the specified Apache HTTP request . |
13,372 | private void addProxyConfig ( RequestConfig . Builder requestConfigBuilder , HttpClientSettings settings ) { if ( settings . isProxyEnabled ( ) && settings . isAuthenticatedProxy ( ) && settings . getProxyAuthenticationMethods ( ) != null ) { List < String > apacheAuthenticationSchemes = new ArrayList < String > ( ) ; for ( ProxyAuthenticationMethod authenticationMethod : settings . getProxyAuthenticationMethods ( ) ) { apacheAuthenticationSchemes . add ( toApacheAuthenticationScheme ( authenticationMethod ) ) ; } requestConfigBuilder . setProxyPreferredAuthSchemes ( apacheAuthenticationSchemes ) ; } } | Update the provided request configuration builder to specify the proxy authentication schemes that should be used when authenticating against the HTTP proxy . |
13,373 | private String toApacheAuthenticationScheme ( ProxyAuthenticationMethod authenticationMethod ) { if ( authenticationMethod == null ) { throw new IllegalStateException ( "The configured proxy authentication methods must not be null." ) ; } switch ( authenticationMethod ) { case NTLM : return AuthSchemes . NTLM ; case BASIC : return AuthSchemes . BASIC ; case DIGEST : return AuthSchemes . DIGEST ; case SPNEGO : return AuthSchemes . SPNEGO ; case KERBEROS : return AuthSchemes . KERBEROS ; default : throw new IllegalStateException ( "Unknown authentication scheme: " + authenticationMethod ) ; } } | Convert the customer - facing authentication method into an apache - specific authentication method . |
13,374 | public Future < SendMessageResult > sendMessage ( SendMessageRequest request , AsyncHandler < SendMessageRequest , SendMessageResult > handler ) { QueueBufferCallback < SendMessageRequest , SendMessageResult > callback = null ; if ( handler != null ) { callback = new QueueBufferCallback < SendMessageRequest , SendMessageResult > ( handler , request ) ; } QueueBufferFuture < SendMessageRequest , SendMessageResult > future = sendBuffer . sendMessage ( request , callback ) ; future . setBuffer ( this ) ; return future ; } | asynchronously enqueues a message to SQS . |
13,375 | public SendMessageResult sendMessageSync ( SendMessageRequest request ) { Future < SendMessageResult > future = sendMessage ( request , null ) ; return waitForFuture ( future ) ; } | Sends a message to SQS and returns the SQS reply . |
13,376 | public Future < DeleteMessageResult > deleteMessage ( DeleteMessageRequest request , AsyncHandler < DeleteMessageRequest , DeleteMessageResult > handler ) { QueueBufferCallback < DeleteMessageRequest , DeleteMessageResult > callback = null ; if ( handler != null ) { callback = new QueueBufferCallback < DeleteMessageRequest , DeleteMessageResult > ( handler , request ) ; } QueueBufferFuture < DeleteMessageRequest , DeleteMessageResult > future = sendBuffer . deleteMessage ( request , callback ) ; future . setBuffer ( this ) ; return future ; } | Asynchronously deletes a message from SQS . |
13,377 | public DeleteMessageResult deleteMessageSync ( DeleteMessageRequest request ) { Future < DeleteMessageResult > future = deleteMessage ( request , null ) ; return waitForFuture ( future ) ; } | Deletes a message from SQS . Does not return until a confirmation from SQS has been received |
13,378 | public Future < ChangeMessageVisibilityResult > changeMessageVisibility ( ChangeMessageVisibilityRequest request , AsyncHandler < ChangeMessageVisibilityRequest , ChangeMessageVisibilityResult > handler ) { QueueBufferCallback < ChangeMessageVisibilityRequest , ChangeMessageVisibilityResult > callback = null ; if ( handler != null ) { callback = new QueueBufferCallback < ChangeMessageVisibilityRequest , ChangeMessageVisibilityResult > ( handler , request ) ; } QueueBufferFuture < ChangeMessageVisibilityRequest , ChangeMessageVisibilityResult > future = sendBuffer . changeMessageVisibility ( request , callback ) ; future . setBuffer ( this ) ; return future ; } | asynchronously adjust a message s visibility timeout to SQS . |
13,379 | public ChangeMessageVisibilityResult changeMessageVisibilitySync ( ChangeMessageVisibilityRequest request ) { Future < ChangeMessageVisibilityResult > future = sendBuffer . changeMessageVisibility ( request , null ) ; return waitForFuture ( future ) ; } | Changes visibility of a message in SQS . Does not return until a confirmation from SQS has been received . |
13,380 | public Future < ReceiveMessageResult > receiveMessage ( ReceiveMessageRequest rq , AsyncHandler < ReceiveMessageRequest , ReceiveMessageResult > handler ) { if ( canBeRetrievedFromQueueBuffer ( rq ) ) { QueueBufferCallback < ReceiveMessageRequest , ReceiveMessageResult > callback = null ; if ( handler != null ) { callback = new QueueBufferCallback < ReceiveMessageRequest , ReceiveMessageResult > ( handler , rq ) ; } QueueBufferFuture < ReceiveMessageRequest , ReceiveMessageResult > future = receiveBuffer . receiveMessageAsync ( rq , callback ) ; future . setBuffer ( this ) ; return future ; } else if ( handler != null ) { return realSqs . receiveMessageAsync ( rq , handler ) ; } else { return realSqs . receiveMessageAsync ( rq ) ; } } | Submits a request to receive some messages from SQS . |
13,381 | public ReceiveMessageResult receiveMessageSync ( ReceiveMessageRequest rq ) { Future < ReceiveMessageResult > future = receiveMessage ( rq , null ) ; return waitForFuture ( future ) ; } | Retrieves messages from an SQS queue . |
13,382 | private < ResultType > ResultType waitForFuture ( Future < ResultType > future ) { ResultType toReturn = null ; try { toReturn = future . get ( ) ; } catch ( InterruptedException ie ) { Thread . currentThread ( ) . interrupt ( ) ; AmazonClientException ce = new AmazonClientException ( "Thread interrupted while waiting for execution result" ) ; ce . initCause ( ie ) ; throw ce ; } catch ( ExecutionException ee ) { Throwable cause = ee . getCause ( ) ; if ( cause instanceof AmazonClientException ) { throw ( AmazonClientException ) cause ; } AmazonClientException ce = new AmazonClientException ( "Caught an exception while waiting for request to complete..." ) ; ce . initCause ( ee ) ; throw ce ; } return toReturn ; } | this method carefully waits for futures . If waiting throws it converts the exceptions to the exceptions that SQS clients expect . This is what we use to turn asynchronous calls into synchronous ones |
13,383 | public static boolean isRequestSuccessful ( org . apache . http . HttpResponse response ) { int status = response . getStatusLine ( ) . getStatusCode ( ) ; return status / 100 == HttpStatus . SC_OK / 100 ; } | Checks if the request was successful or not based on the status code . |
13,384 | public static HttpResponse createResponse ( Request < ? > request , HttpRequestBase method , org . apache . http . HttpResponse apacheHttpResponse , HttpContext context ) throws IOException { HttpResponse httpResponse = new HttpResponse ( request , method , context ) ; if ( apacheHttpResponse . getEntity ( ) != null ) { httpResponse . setContent ( apacheHttpResponse . getEntity ( ) . getContent ( ) ) ; } httpResponse . setStatusCode ( apacheHttpResponse . getStatusLine ( ) . getStatusCode ( ) ) ; httpResponse . setStatusText ( apacheHttpResponse . getStatusLine ( ) . getReasonPhrase ( ) ) ; for ( Header header : apacheHttpResponse . getAllHeaders ( ) ) { httpResponse . addHeader ( header . getName ( ) , header . getValue ( ) ) ; } return httpResponse ; } | Creates and initializes an HttpResponse object suitable to be passed to an HTTP response handler object . |
13,385 | public static HttpEntity newStringEntity ( String s ) { try { return new StringEntity ( s ) ; } catch ( UnsupportedEncodingException e ) { throw new SdkClientException ( "Unable to create HTTP entity: " + e . getMessage ( ) , e ) ; } } | Utility function for creating a new StringEntity and wrapping any errors as a SdkClientException . |
13,386 | public static HttpEntity newBufferedHttpEntity ( HttpEntity entity ) throws FakeIOException { try { return new BufferedHttpEntity ( entity ) ; } catch ( FakeIOException e ) { throw e ; } catch ( IOException e ) { throw new SdkClientException ( "Unable to create HTTP entity: " + e . getMessage ( ) , e ) ; } } | Utility function for creating a new BufferedEntity and wrapping any errors as a SdkClientException . |
13,387 | public static HttpClientContext newClientContext ( HttpClientSettings settings , Map < String , ? extends Object > attributes ) { final HttpClientContext clientContext = new HttpClientContext ( ) ; if ( attributes != null && ! attributes . isEmpty ( ) ) { for ( Map . Entry < String , ? > entry : attributes . entrySet ( ) ) { clientContext . setAttribute ( entry . getKey ( ) , entry . getValue ( ) ) ; } } addPreemptiveAuthenticationProxy ( clientContext , settings ) ; clientContext . setAttribute ( HttpContextUtils . DISABLE_SOCKET_PROXY_PROPERTY , settings . disableSocketProxy ( ) ) ; return clientContext ; } | Returns a new HttpClientContext used for request execution . |
13,388 | public static CredentialsProvider newProxyCredentialsProvider ( HttpClientSettings settings ) { final CredentialsProvider provider = new BasicCredentialsProvider ( ) ; provider . setCredentials ( newAuthScope ( settings ) , newNTCredentials ( settings ) ) ; return provider ; } | Returns a new Credentials Provider for use with proxy authentication . |
13,389 | private static Credentials newNTCredentials ( HttpClientSettings settings ) { return new NTCredentials ( settings . getProxyUsername ( ) , settings . getProxyPassword ( ) , settings . getProxyWorkstation ( ) , settings . getProxyDomain ( ) ) ; } | Returns a new instance of NTCredentials used for proxy authentication . |
13,390 | private static void createDeliveryStream ( ) throws Exception { boolean deliveryStreamExists = false ; LOG . info ( "Checking if " + deliveryStreamName + " already exits" ) ; List < String > deliveryStreamNames = listDeliveryStreams ( ) ; if ( deliveryStreamNames != null && deliveryStreamNames . contains ( deliveryStreamName ) ) { deliveryStreamExists = true ; LOG . info ( "DeliveryStream " + deliveryStreamName + " already exists. Not creating the new delivery stream" ) ; } else { LOG . info ( "DeliveryStream " + deliveryStreamName + " does not exist" ) ; } if ( ! deliveryStreamExists ) { CreateDeliveryStreamRequest createDeliveryStreamRequest = new CreateDeliveryStreamRequest ( ) ; createDeliveryStreamRequest . setDeliveryStreamName ( deliveryStreamName ) ; S3DestinationConfiguration s3DestinationConfiguration = new S3DestinationConfiguration ( ) ; s3DestinationConfiguration . setBucketARN ( s3BucketARN ) ; s3DestinationConfiguration . setPrefix ( s3ObjectPrefix ) ; s3DestinationConfiguration . setCompressionFormat ( CompressionFormat . UNCOMPRESSED ) ; EncryptionConfiguration encryptionConfiguration = new EncryptionConfiguration ( ) ; if ( ! StringUtils . isNullOrEmpty ( s3DestinationAWSKMSKeyId ) ) { encryptionConfiguration . setKMSEncryptionConfig ( new KMSEncryptionConfig ( ) . withAWSKMSKeyARN ( s3DestinationAWSKMSKeyId ) ) ; } else { encryptionConfiguration . setNoEncryptionConfig ( NoEncryptionConfig . NoEncryption ) ; } s3DestinationConfiguration . setEncryptionConfiguration ( encryptionConfiguration ) ; BufferingHints bufferingHints = null ; if ( s3DestinationSizeInMBs != null || s3DestinationIntervalInSeconds != null ) { bufferingHints = new BufferingHints ( ) ; bufferingHints . setSizeInMBs ( s3DestinationSizeInMBs ) ; bufferingHints . setIntervalInSeconds ( s3DestinationIntervalInSeconds ) ; } s3DestinationConfiguration . setBufferingHints ( bufferingHints ) ; String iamRoleArn = createIamRole ( s3ObjectPrefix ) ; s3DestinationConfiguration . setRoleARN ( iamRoleArn ) ; createDeliveryStreamRequest . setS3DestinationConfiguration ( s3DestinationConfiguration ) ; firehoseClient . createDeliveryStream ( createDeliveryStreamRequest ) ; LOG . info ( "Creating DeliveryStream : " + deliveryStreamName ) ; waitForDeliveryStreamToBecomeAvailable ( deliveryStreamName ) ; } } | Method to create delivery stream for S3 destination configuration . |
13,391 | private static void updateDeliveryStream ( ) throws Exception { DeliveryStreamDescription deliveryStreamDescription = describeDeliveryStream ( deliveryStreamName ) ; LOG . info ( "Updating DeliveryStream Destination: " + deliveryStreamName + " with new configuration options" ) ; UpdateDestinationRequest updateDestinationRequest = new UpdateDestinationRequest ( ) . withDeliveryStreamName ( deliveryStreamName ) . withCurrentDeliveryStreamVersionId ( deliveryStreamDescription . getVersionId ( ) ) . withDestinationId ( deliveryStreamDescription . getDestinations ( ) . get ( 0 ) . getDestinationId ( ) ) ; S3DestinationUpdate s3DestinationUpdate = new S3DestinationUpdate ( ) ; s3DestinationUpdate . withPrefix ( updateS3ObjectPrefix ) ; BufferingHints bufferingHints = null ; if ( updateSizeInMBs != null || updateIntervalInSeconds != null ) { bufferingHints = new BufferingHints ( ) ; bufferingHints . setSizeInMBs ( updateSizeInMBs ) ; bufferingHints . setIntervalInSeconds ( updateIntervalInSeconds ) ; } s3DestinationUpdate . setBufferingHints ( bufferingHints ) ; putRolePolicy ( updateS3ObjectPrefix ) ; updateDestinationRequest . setS3DestinationUpdate ( s3DestinationUpdate ) ; firehoseClient . updateDestination ( updateDestinationRequest ) ; } | Method to update s3 destination with updated s3Prefix and buffering hints values . |
13,392 | public static void waitUntilExists ( final AmazonDynamoDB dynamo , final String tableName ) throws InterruptedException { waitUntilExists ( dynamo , tableName , DEFAULT_WAIT_TIMEOUT , DEFAULT_WAIT_INTERVAL ) ; } | Waits up to 10 minutes for a specified DynamoDB table to resolve indicating that it exists . If the table doesn t return a result after this time a SdkClientException is thrown . |
13,393 | public static void waitUntilExists ( final AmazonDynamoDB dynamo , final String tableName , final int timeout , final int interval ) throws InterruptedException { TableDescription table = waitForTableDescription ( dynamo , tableName , null , timeout , interval ) ; if ( table == null ) { throw new SdkClientException ( "Table " + tableName + " never returned a result" ) ; } } | Waits up to a specified amount of time for a specified DynamoDB table to resolve indicating that it exists . If the table doesn t return a result after this time a SdkClientException is thrown . |
13,394 | private static TableDescription waitForTableDescription ( final AmazonDynamoDB dynamo , final String tableName , TableStatus desiredStatus , final int timeout , final int interval ) throws InterruptedException , IllegalArgumentException { if ( timeout < 0 ) { throw new IllegalArgumentException ( "Timeout must be >= 0" ) ; } if ( interval <= 0 || interval >= timeout ) { throw new IllegalArgumentException ( "Interval must be > 0 and < timeout" ) ; } long startTime = System . currentTimeMillis ( ) ; long endTime = startTime + timeout ; TableDescription table = null ; while ( System . currentTimeMillis ( ) < endTime ) { try { table = dynamo . describeTable ( new DescribeTableRequest ( tableName ) ) . getTable ( ) ; if ( desiredStatus == null || table . getTableStatus ( ) . equals ( desiredStatus . toString ( ) ) ) { return table ; } } catch ( ResourceNotFoundException rnfe ) { } Thread . sleep ( interval ) ; } return table ; } | Wait for the table to reach the desired status and returns the table description |
13,395 | public static final boolean createTableIfNotExists ( final AmazonDynamoDB dynamo , final CreateTableRequest createTableRequest ) { try { dynamo . createTable ( createTableRequest ) ; return true ; } catch ( final ResourceInUseException e ) { if ( LOG . isTraceEnabled ( ) ) { LOG . trace ( "Table " + createTableRequest . getTableName ( ) + " already exists" , e ) ; } } return false ; } | Creates the table and ignores any errors if it already exists . |
13,396 | public static final boolean deleteTableIfExists ( final AmazonDynamoDB dynamo , final DeleteTableRequest deleteTableRequest ) { try { dynamo . deleteTable ( deleteTableRequest ) ; return true ; } catch ( final ResourceNotFoundException e ) { if ( LOG . isTraceEnabled ( ) ) { LOG . trace ( "Table " + deleteTableRequest . getTableName ( ) + " does not exist" , e ) ; } } return false ; } | Deletes the table and ignores any errors if it doesn t exist . |
13,397 | public void setDefinitions ( java . util . Collection < DefinitionInformation > definitions ) { if ( definitions == null ) { this . definitions = null ; return ; } this . definitions = new java . util . ArrayList < DefinitionInformation > ( definitions ) ; } | Information about a definition . |
13,398 | public void shutdown ( ) { clientExecutionTimer . shutdown ( ) ; httpRequestTimer . shutdown ( ) ; IdleConnectionReaper . removeConnectionManager ( httpClient . getHttpClientConnectionManager ( ) ) ; httpClient . getHttpClientConnectionManager ( ) . shutdown ( ) ; } | Shuts down this HTTP client object releasing any resources that might be held open . This is an optional method and callers are not expected to call it but can if they want to explicitly release any open resources . Once a client has been shutdown it cannot be used to make more requests . |
13,399 | private < T > HttpResponseHandler < T > getNonNullResponseHandler ( HttpResponseHandler < T > responseHandler ) { if ( responseHandler != null ) { return responseHandler ; } else { return new HttpResponseHandler < T > ( ) { public T handle ( HttpResponse response ) throws Exception { return null ; } public boolean needsConnectionLeftOpen ( ) { return false ; } } ; } } | Ensures the response handler is not null . If it is this method returns a dummy response handler . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.