idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
30,300
public PublicEndpoint withMetrics ( java . util . Map < String , Double > metrics ) { setMetrics ( metrics ) ; return this ; }
Custom metrics that your app reports to Amazon Pinpoint .
30,301
public String readText ( ) throws XMLStreamException { if ( isInsideResponseHeader ( ) ) { return getHeader ( currentHeader ) ; } if ( currentEvent . isAttribute ( ) ) { Attribute attribute = ( Attribute ) currentEvent ; return attribute . getValue ( ) ; } StringBuilder sb = new StringBuilder ( ) ; while ( true ) { XMLEvent event = eventReader . peek ( ) ; if ( event . getEventType ( ) == XMLStreamConstants . CHARACTERS ) { eventReader . nextEvent ( ) ; sb . append ( event . asCharacters ( ) . getData ( ) ) ; } else if ( event . getEventType ( ) == XMLStreamConstants . END_ELEMENT ) { return sb . toString ( ) ; } else { throw new RuntimeException ( "Encountered unexpected event: " + event . toString ( ) ) ; } } }
Returns the text contents of the current element being parsed .
30,302
public XMLEvent nextEvent ( ) throws XMLStreamException { if ( attributeIterator != null && attributeIterator . hasNext ( ) ) { currentEvent = ( XMLEvent ) attributeIterator . next ( ) ; } else { currentEvent = eventReader . nextEvent ( ) ; } if ( currentEvent . isStartElement ( ) ) { attributeIterator = currentEvent . asStartElement ( ) . getAttributes ( ) ; } updateContext ( currentEvent ) ; if ( eventReader . hasNext ( ) ) { XMLEvent nextEvent = eventReader . peek ( ) ; if ( nextEvent != null && nextEvent . isCharacters ( ) ) { for ( MetadataExpression metadataExpression : metadataExpressions ) { if ( testExpression ( metadataExpression . expression , metadataExpression . targetDepth ) ) { metadata . put ( metadataExpression . key , nextEvent . asCharacters ( ) . getData ( ) ) ; } } } } return currentEvent ; }
Returns the next XML event for the document being parsed .
30,303
public void registerMetadataExpression ( String expression , int targetDepth , String storageKey ) { metadataExpressions . add ( new MetadataExpression ( expression , targetDepth , storageKey ) ) ; }
Registers an expression which if matched will cause the data for the matching element to be stored in the metadata map under the specified key .
30,304
private CopyResult copyInOneChunk ( ) { CopyObjectResult copyObjectResult = s3 . copyObject ( copyObjectRequest ) ; CopyResult copyResult = new CopyResult ( ) ; copyResult . setSourceBucketName ( copyObjectRequest . getSourceBucketName ( ) ) ; copyResult . setSourceKey ( copyObjectRequest . getSourceKey ( ) ) ; copyResult . setDestinationBucketName ( copyObjectRequest . getDestinationBucketName ( ) ) ; copyResult . setDestinationKey ( copyObjectRequest . getDestinationKey ( ) ) ; copyResult . setETag ( copyObjectResult . getETag ( ) ) ; copyResult . setVersionId ( copyObjectResult . getVersionId ( ) ) ; return copyResult ; }
Performs the copy of the Amazon S3 object from source bucket to destination bucket . The Amazon S3 object is copied to destination in one single request .
30,305
private long getOptimalPartSize ( long contentLengthOfSource ) { long optimalPartSize = TransferManagerUtils . calculateOptimalPartSizeForCopy ( copyObjectRequest , configuration , contentLengthOfSource ) ; log . debug ( "Calculated optimal part size: " + optimalPartSize ) ; return optimalPartSize ; }
Computes and returns the optimal part size for the copy operation .
30,306
private void copyPartsInParallel ( CopyPartRequestFactory requestFactory ) { while ( requestFactory . hasMoreRequests ( ) ) { if ( threadPool . isShutdown ( ) ) throw new CancellationException ( "TransferManager has been shutdown" ) ; CopyPartRequest request = requestFactory . getNextCopyPartRequest ( ) ; futures . add ( threadPool . submit ( new CopyPartCallable ( s3 , request ) ) ) ; } }
Submits a callable for each part to be copied to our thread pool and records its corresponding Future .
30,307
public void setChannelMappings ( java . util . Collection < AudioChannelMapping > channelMappings ) { if ( channelMappings == null ) { this . channelMappings = null ; return ; } this . channelMappings = new java . util . ArrayList < AudioChannelMapping > ( channelMappings ) ; }
Mapping of input channels to output channels with appropriate gain adjustments .
30,308
private static final < T > RuleFactory < T > rulesOf ( DynamoDBMapperConfig config , S3Link . Factory s3Links , DynamoDBMapperModelFactory models ) { final boolean ver1 = ( config . getConversionSchema ( ) == ConversionSchemas . V1 ) ; final boolean ver2 = ( config . getConversionSchema ( ) == ConversionSchemas . V2 ) ; final boolean v2Compatible = ( config . getConversionSchema ( ) == ConversionSchemas . V2_COMPATIBLE ) ; final DynamoDBTypeConverterFactory . Builder scalars = config . getTypeConverterFactory ( ) . override ( ) ; scalars . with ( String . class , S3Link . class , s3Links ) ; final Rules < T > factory = new Rules < T > ( scalars . build ( ) ) ; factory . add ( factory . new NativeType ( ! ver1 ) ) ; factory . add ( factory . new V2CompatibleBool ( v2Compatible ) ) ; factory . add ( factory . new NativeBool ( ver2 ) ) ; factory . add ( factory . new StringScalar ( true ) ) ; factory . add ( factory . new DateToEpochRule ( true ) ) ; factory . add ( factory . new NumberScalar ( true ) ) ; factory . add ( factory . new BinaryScalar ( true ) ) ; factory . add ( factory . new NativeBoolSet ( ver2 ) ) ; factory . add ( factory . new StringScalarSet ( true ) ) ; factory . add ( factory . new NumberScalarSet ( true ) ) ; factory . add ( factory . new BinaryScalarSet ( true ) ) ; factory . add ( factory . new ObjectSet ( ver2 ) ) ; factory . add ( factory . new ObjectStringSet ( ! ver2 ) ) ; factory . add ( factory . new ObjectList ( ! ver1 ) ) ; factory . add ( factory . new ObjectMap ( ! ver1 ) ) ; factory . add ( factory . new ObjectDocumentMap ( ! ver1 , models , config ) ) ; return factory ; }
Creates a new set of conversion rules based on the configuration .
30,309
public void setScheduleActions ( java . util . Collection < ScheduleAction > scheduleActions ) { if ( scheduleActions == null ) { this . scheduleActions = null ; return ; } this . scheduleActions = new java . util . ArrayList < ScheduleAction > ( scheduleActions ) ; }
A list of schedule actions to create .
30,310
CipherLite recreate ( ) { return scheme . createCipherLite ( secreteKey , cipher . getIV ( ) , this . cipherMode , cipher . getProvider ( ) , true ) ; }
Recreates a new instance of CipherLite from the current one .
30,311
CipherLite createUsingIV ( byte [ ] iv ) { return scheme . createCipherLite ( secreteKey , iv , this . cipherMode , cipher . getProvider ( ) , true ) ; }
Creates a new instance of CipherLite from the current one but using the given IV .
30,312
byte [ ] doFinal ( byte [ ] input , int inputOffset , int inputLen ) throws IllegalBlockSizeException , BadPaddingException { return cipher . doFinal ( input , inputOffset , inputLen ) ; }
Encrypts or decrypts data in a single - part operation or finishes a multiple - part operation . The data is encrypted or decrypted depending on how the underlying cipher was initialized .
30,313
public static ThreadPoolExecutor createDefaultExecutorService ( ) { ThreadFactory threadFactory = new ThreadFactory ( ) { private int threadCount = 1 ; public Thread newThread ( Runnable r ) { Thread thread = new Thread ( r ) ; thread . setName ( "s3-transfer-manager-worker-" + threadCount ++ ) ; return thread ; } } ; return ( ThreadPoolExecutor ) Executors . newFixedThreadPool ( 10 , threadFactory ) ; }
Returns a new thread pool configured with the default settings .
30,314
public static long getContentLength ( PutObjectRequest putObjectRequest ) { File file = getRequestFile ( putObjectRequest ) ; if ( file != null ) return file . length ( ) ; if ( putObjectRequest . getInputStream ( ) != null ) { if ( putObjectRequest . getMetadata ( ) . getContentLength ( ) > 0 ) { return putObjectRequest . getMetadata ( ) . getContentLength ( ) ; } } return - 1 ; }
Returns the size of the data in this request otherwise - 1 if the content length is unknown .
30,315
public static long calculateOptimalPartSize ( PutObjectRequest putObjectRequest , TransferManagerConfiguration configuration ) { double contentLength = TransferManagerUtils . getContentLength ( putObjectRequest ) ; double optimalPartSize = ( double ) contentLength / ( double ) MAXIMUM_UPLOAD_PARTS ; optimalPartSize = Math . ceil ( optimalPartSize ) ; return ( long ) Math . max ( optimalPartSize , configuration . getMinimumUploadPartSize ( ) ) ; }
Returns the optimal part size in bytes for each individual part upload in a multipart upload .
30,316
public static File getRequestFile ( final PutObjectRequest putObjectRequest ) { if ( putObjectRequest . getFile ( ) != null ) return putObjectRequest . getFile ( ) ; return null ; }
Convenience method for getting the file specified in a request .
30,317
public static long calculateOptimalPartSizeForCopy ( CopyObjectRequest copyObjectRequest , TransferManagerConfiguration configuration , long contentLengthOfSource ) { double optimalPartSize = ( double ) contentLengthOfSource / ( double ) MAXIMUM_UPLOAD_PARTS ; optimalPartSize = Math . ceil ( optimalPartSize ) ; return ( long ) Math . max ( optimalPartSize , configuration . getMultipartCopyPartSize ( ) ) ; }
Calculates the optimal part size of each part request if the copy operation is carried out as multi - part copy .
30,318
public static PauseStatus determinePauseStatus ( TransferState transferState , boolean forceCancel ) { if ( forceCancel ) { if ( transferState == TransferState . Waiting ) { return PauseStatus . CANCELLED_BEFORE_START ; } else if ( transferState == TransferState . InProgress ) { return PauseStatus . CANCELLED ; } } if ( transferState == TransferState . Waiting ) { return PauseStatus . NOT_STARTED ; } return PauseStatus . NO_EFFECT ; }
Determines the pause status based on the current state of transfer .
30,319
public static boolean isDownloadParallelizable ( final AmazonS3 s3 , final GetObjectRequest getObjectRequest , Integer partCount ) { ValidationUtils . assertNotNull ( s3 , "S3 client" ) ; ValidationUtils . assertNotNull ( getObjectRequest , "GetObjectRequest" ) ; if ( s3 instanceof AmazonS3Encryption || getObjectRequest . getRange ( ) != null || getObjectRequest . getPartNumber ( ) != null || partCount == null ) { return false ; } return true ; }
Returns true if the specified download request can use parallel part downloads for increased performance .
30,320
public static Long getContentLengthFromContentRange ( ObjectMetadata metadata ) { ValidationUtils . assertNotNull ( metadata , "Object metadata" ) ; String contentRange = ( String ) metadata . getRawMetadataValue ( Headers . CONTENT_RANGE ) ; if ( contentRange != null ) { try { String [ ] tokens = contentRange . split ( "[ -/]+" ) ; return Long . parseLong ( tokens [ 3 ] ) ; } catch ( Exception e ) { log . info ( String . format ( "Error parsing 'Content-Range' header value: %s. So returning " + "null value for content length" , contentRange ) , e ) ; } } return null ; }
Returns the content length of the object if response contains the Content - Range header and is well formed .
30,321
public JsonNode visit ( JmesPathSubExpression subExpression , JsonNode input ) throws InvalidTypeException { JsonNode prelimnaryResult = subExpression . getExpressions ( ) . get ( 0 ) . accept ( this , input ) ; for ( int i = 1 ; i < subExpression . getExpressions ( ) . size ( ) ; i ++ ) { prelimnaryResult = subExpression . getExpressions ( ) . get ( i ) . accept ( this , prelimnaryResult ) ; } return prelimnaryResult ; }
Evaluates a subexpression by evaluating the expression on the left with the original JSON document and then evaluating the expression on the right with the result of the left expression evaluation .
30,322
public JsonNode visit ( JmesPathField fieldNode , JsonNode input ) { if ( input . isObject ( ) ) { return input . get ( CamelCaseUtils . toCamelCase ( fieldNode . getValue ( ) ) ) ; } return NullNode . getInstance ( ) ; }
Retrieves the value of the field node
30,323
public JsonNode visit ( JmesPathFlatten flatten , JsonNode input ) throws InvalidTypeException { JsonNode flattenResult = flatten . getFlattenExpr ( ) . accept ( this , input ) ; if ( flattenResult . isArray ( ) ) { Iterator < JsonNode > elements = flattenResult . elements ( ) ; ArrayNode flattenedArray = ObjectMapperSingleton . getObjectMapper ( ) . createArrayNode ( ) ; while ( elements . hasNext ( ) ) { JsonNode element = elements . next ( ) ; if ( element != null ) { if ( element . isArray ( ) ) { Iterator < JsonNode > inner = element . iterator ( ) ; while ( inner . hasNext ( ) ) { JsonNode innerElement = inner . next ( ) ; if ( innerElement != null ) { flattenedArray . add ( innerElement ) ; } } } else { flattenedArray . add ( element ) ; } } } return flattenedArray ; } return NullNode . getInstance ( ) ; }
Flattens out the elements of the given expression into a single list . It s evaluated as follows . Create an empty result list . Iterate over the elements of the current result . If the current element is not a list add to the end of the result list . If the current element is a list add each element of the current element to the end of the result list . The result list is now the new current result .
30,324
public JsonNode visit ( JmesPathFunction function , JsonNode input ) throws InvalidTypeException { List < JsonNode > evaluatedArguments = new ArrayList < JsonNode > ( ) ; List < JmesPathExpression > arguments = function . getExpressions ( ) ; for ( JmesPathExpression arg : arguments ) { evaluatedArguments . add ( arg . accept ( this , input ) ) ; } return function . evaluate ( evaluatedArguments ) ; }
Evaluates function expression in applicative order . Each argument is an expression each argument expression is evaluated before evaluating the function . The function is then called with the evaluated function arguments . The result of the function - expression is the result returned by the function call .
30,325
public JsonNode visit ( Comparator op , JsonNode input ) { JsonNode lhsNode = op . getLhsExpr ( ) . accept ( this , input ) ; JsonNode rhsNode = op . getRhsExpr ( ) . accept ( this , input ) ; if ( op . matches ( lhsNode , rhsNode ) ) { return BooleanNode . TRUE ; } return BooleanNode . FALSE ; }
Evaluate the expressions as per the given comparison operator .
30,326
public JsonNode visit ( JmesPathNotExpression notExpression , JsonNode input ) throws InvalidTypeException { JsonNode resultExpr = notExpression . getExpr ( ) . accept ( this , input ) ; if ( resultExpr != BooleanNode . TRUE ) { return BooleanNode . TRUE ; } return BooleanNode . FALSE ; }
Not - expression negates the result of an expression . If the expression results in a truth - like value a not - expression will change this value to false . If the expression results in a false - like value a not - expression will change this value to true .
30,327
public JsonNode visit ( JmesPathAndExpression andExpression , JsonNode input ) throws InvalidTypeException { JsonNode lhsNode = andExpression . getLhsExpr ( ) . accept ( this , input ) ; JsonNode rhsNode = andExpression . getRhsExpr ( ) . accept ( this , input ) ; if ( lhsNode == BooleanNode . TRUE ) { return rhsNode ; } else { return lhsNode ; } }
And expression will evaluate to either the left expression or the right expression . If the expression on the left hand side is a truth - like value then the value on the right hand side is returned . Otherwise the result of the expression on the left hand side is returned .
30,328
public void setLoggers ( java . util . Collection < Logger > loggers ) { if ( loggers == null ) { this . loggers = null ; return ; } this . loggers = new java . util . ArrayList < Logger > ( loggers ) ; }
A list of loggers .
30,329
public CopyResult waitForCopyResult ( ) throws AmazonClientException , AmazonServiceException , InterruptedException { try { CopyResult result = null ; while ( ! monitor . isDone ( ) || result == null ) { Future < ? > f = monitor . getFuture ( ) ; result = ( CopyResult ) f . get ( ) ; } return result ; } catch ( ExecutionException e ) { rethrowExecutionException ( e ) ; return null ; } }
Waits for this copy operation to complete and returns the result of the operation . Be prepared to handle errors when calling this method . Any errors that occurred during the asynchronous transfer will be re - thrown through this method .
30,330
public void setPresets ( java . util . Collection < Preset > presets ) { if ( presets == null ) { this . presets = null ; return ; } this . presets = new java . util . ArrayList < Preset > ( presets ) ; }
List of presets
30,331
public java . util . concurrent . Future < ConfirmSubscriptionResult > confirmSubscriptionAsync ( String topicArn , String token , String authenticateOnUnsubscribe ) { return confirmSubscriptionAsync ( new ConfirmSubscriptionRequest ( ) . withTopicArn ( topicArn ) . withToken ( token ) . withAuthenticateOnUnsubscribe ( authenticateOnUnsubscribe ) ) ; }
Simplified method form for invoking the ConfirmSubscription operation .
30,332
public java . util . concurrent . Future < ConfirmSubscriptionResult > confirmSubscriptionAsync ( String topicArn , String token , String authenticateOnUnsubscribe , com . amazonaws . handlers . AsyncHandler < ConfirmSubscriptionRequest , ConfirmSubscriptionResult > asyncHandler ) { return confirmSubscriptionAsync ( new ConfirmSubscriptionRequest ( ) . withTopicArn ( topicArn ) . withToken ( token ) . withAuthenticateOnUnsubscribe ( authenticateOnUnsubscribe ) , asyncHandler ) ; }
Simplified method form for invoking the ConfirmSubscription operation with an AsyncHandler .
30,333
public java . util . concurrent . Future < CreateTopicResult > createTopicAsync ( String name ) { return createTopicAsync ( new CreateTopicRequest ( ) . withName ( name ) ) ; }
Simplified method form for invoking the CreateTopic operation .
30,334
public java . util . concurrent . Future < CreateTopicResult > createTopicAsync ( String name , com . amazonaws . handlers . AsyncHandler < CreateTopicRequest , CreateTopicResult > asyncHandler ) { return createTopicAsync ( new CreateTopicRequest ( ) . withName ( name ) , asyncHandler ) ; }
Simplified method form for invoking the CreateTopic operation with an AsyncHandler .
30,335
public java . util . concurrent . Future < DeleteTopicResult > deleteTopicAsync ( String topicArn ) { return deleteTopicAsync ( new DeleteTopicRequest ( ) . withTopicArn ( topicArn ) ) ; }
Simplified method form for invoking the DeleteTopic operation .
30,336
public java . util . concurrent . Future < DeleteTopicResult > deleteTopicAsync ( String topicArn , com . amazonaws . handlers . AsyncHandler < DeleteTopicRequest , DeleteTopicResult > asyncHandler ) { return deleteTopicAsync ( new DeleteTopicRequest ( ) . withTopicArn ( topicArn ) , asyncHandler ) ; }
Simplified method form for invoking the DeleteTopic operation with an AsyncHandler .
30,337
public java . util . concurrent . Future < GetSubscriptionAttributesResult > getSubscriptionAttributesAsync ( String subscriptionArn ) { return getSubscriptionAttributesAsync ( new GetSubscriptionAttributesRequest ( ) . withSubscriptionArn ( subscriptionArn ) ) ; }
Simplified method form for invoking the GetSubscriptionAttributes operation .
30,338
public java . util . concurrent . Future < GetSubscriptionAttributesResult > getSubscriptionAttributesAsync ( String subscriptionArn , com . amazonaws . handlers . AsyncHandler < GetSubscriptionAttributesRequest , GetSubscriptionAttributesResult > asyncHandler ) { return getSubscriptionAttributesAsync ( new GetSubscriptionAttributesRequest ( ) . withSubscriptionArn ( subscriptionArn ) , asyncHandler ) ; }
Simplified method form for invoking the GetSubscriptionAttributes operation with an AsyncHandler .
30,339
public java . util . concurrent . Future < GetTopicAttributesResult > getTopicAttributesAsync ( String topicArn ) { return getTopicAttributesAsync ( new GetTopicAttributesRequest ( ) . withTopicArn ( topicArn ) ) ; }
Simplified method form for invoking the GetTopicAttributes operation .
30,340
public java . util . concurrent . Future < GetTopicAttributesResult > getTopicAttributesAsync ( String topicArn , com . amazonaws . handlers . AsyncHandler < GetTopicAttributesRequest , GetTopicAttributesResult > asyncHandler ) { return getTopicAttributesAsync ( new GetTopicAttributesRequest ( ) . withTopicArn ( topicArn ) , asyncHandler ) ; }
Simplified method form for invoking the GetTopicAttributes operation with an AsyncHandler .
30,341
public java . util . concurrent . Future < ListSubscriptionsResult > listSubscriptionsAsync ( String nextToken ) { return listSubscriptionsAsync ( new ListSubscriptionsRequest ( ) . withNextToken ( nextToken ) ) ; }
Simplified method form for invoking the ListSubscriptions operation .
30,342
public java . util . concurrent . Future < ListSubscriptionsResult > listSubscriptionsAsync ( String nextToken , com . amazonaws . handlers . AsyncHandler < ListSubscriptionsRequest , ListSubscriptionsResult > asyncHandler ) { return listSubscriptionsAsync ( new ListSubscriptionsRequest ( ) . withNextToken ( nextToken ) , asyncHandler ) ; }
Simplified method form for invoking the ListSubscriptions operation with an AsyncHandler .
30,343
public java . util . concurrent . Future < ListSubscriptionsByTopicResult > listSubscriptionsByTopicAsync ( String topicArn ) { return listSubscriptionsByTopicAsync ( new ListSubscriptionsByTopicRequest ( ) . withTopicArn ( topicArn ) ) ; }
Simplified method form for invoking the ListSubscriptionsByTopic operation .
30,344
public java . util . concurrent . Future < ListSubscriptionsByTopicResult > listSubscriptionsByTopicAsync ( String topicArn , com . amazonaws . handlers . AsyncHandler < ListSubscriptionsByTopicRequest , ListSubscriptionsByTopicResult > asyncHandler ) { return listSubscriptionsByTopicAsync ( new ListSubscriptionsByTopicRequest ( ) . withTopicArn ( topicArn ) , asyncHandler ) ; }
Simplified method form for invoking the ListSubscriptionsByTopic operation with an AsyncHandler .
30,345
public java . util . concurrent . Future < ListTopicsResult > listTopicsAsync ( String nextToken ) { return listTopicsAsync ( new ListTopicsRequest ( ) . withNextToken ( nextToken ) ) ; }
Simplified method form for invoking the ListTopics operation .
30,346
public java . util . concurrent . Future < PublishResult > publishAsync ( String topicArn , String message , com . amazonaws . handlers . AsyncHandler < PublishRequest , PublishResult > asyncHandler ) { return publishAsync ( new PublishRequest ( ) . withTopicArn ( topicArn ) . withMessage ( message ) , asyncHandler ) ; }
Simplified method form for invoking the Publish operation with an AsyncHandler .
30,347
public java . util . concurrent . Future < PublishResult > publishAsync ( String topicArn , String message , String subject ) { return publishAsync ( new PublishRequest ( ) . withTopicArn ( topicArn ) . withMessage ( message ) . withSubject ( subject ) ) ; }
Simplified method form for invoking the Publish operation .
30,348
public java . util . concurrent . Future < RemovePermissionResult > removePermissionAsync ( String topicArn , String label , com . amazonaws . handlers . AsyncHandler < RemovePermissionRequest , RemovePermissionResult > asyncHandler ) { return removePermissionAsync ( new RemovePermissionRequest ( ) . withTopicArn ( topicArn ) . withLabel ( label ) , asyncHandler ) ; }
Simplified method form for invoking the RemovePermission operation with an AsyncHandler .
30,349
public java . util . concurrent . Future < SetSubscriptionAttributesResult > setSubscriptionAttributesAsync ( String subscriptionArn , String attributeName , String attributeValue ) { return setSubscriptionAttributesAsync ( new SetSubscriptionAttributesRequest ( ) . withSubscriptionArn ( subscriptionArn ) . withAttributeName ( attributeName ) . withAttributeValue ( attributeValue ) ) ; }
Simplified method form for invoking the SetSubscriptionAttributes operation .
30,350
public java . util . concurrent . Future < SetSubscriptionAttributesResult > setSubscriptionAttributesAsync ( String subscriptionArn , String attributeName , String attributeValue , com . amazonaws . handlers . AsyncHandler < SetSubscriptionAttributesRequest , SetSubscriptionAttributesResult > asyncHandler ) { return setSubscriptionAttributesAsync ( new SetSubscriptionAttributesRequest ( ) . withSubscriptionArn ( subscriptionArn ) . withAttributeName ( attributeName ) . withAttributeValue ( attributeValue ) , asyncHandler ) ; }
Simplified method form for invoking the SetSubscriptionAttributes operation with an AsyncHandler .
30,351
public java . util . concurrent . Future < SetTopicAttributesResult > setTopicAttributesAsync ( String topicArn , String attributeName , String attributeValue ) { return setTopicAttributesAsync ( new SetTopicAttributesRequest ( ) . withTopicArn ( topicArn ) . withAttributeName ( attributeName ) . withAttributeValue ( attributeValue ) ) ; }
Simplified method form for invoking the SetTopicAttributes operation .
30,352
public java . util . concurrent . Future < SetTopicAttributesResult > setTopicAttributesAsync ( String topicArn , String attributeName , String attributeValue , com . amazonaws . handlers . AsyncHandler < SetTopicAttributesRequest , SetTopicAttributesResult > asyncHandler ) { return setTopicAttributesAsync ( new SetTopicAttributesRequest ( ) . withTopicArn ( topicArn ) . withAttributeName ( attributeName ) . withAttributeValue ( attributeValue ) , asyncHandler ) ; }
Simplified method form for invoking the SetTopicAttributes operation with an AsyncHandler .
30,353
public java . util . concurrent . Future < SubscribeResult > subscribeAsync ( String topicArn , String protocol , String endpoint ) { return subscribeAsync ( new SubscribeRequest ( ) . withTopicArn ( topicArn ) . withProtocol ( protocol ) . withEndpoint ( endpoint ) ) ; }
Simplified method form for invoking the Subscribe operation .
30,354
public java . util . concurrent . Future < SubscribeResult > subscribeAsync ( String topicArn , String protocol , String endpoint , com . amazonaws . handlers . AsyncHandler < SubscribeRequest , SubscribeResult > asyncHandler ) { return subscribeAsync ( new SubscribeRequest ( ) . withTopicArn ( topicArn ) . withProtocol ( protocol ) . withEndpoint ( endpoint ) , asyncHandler ) ; }
Simplified method form for invoking the Subscribe operation with an AsyncHandler .
30,355
public java . util . concurrent . Future < UnsubscribeResult > unsubscribeAsync ( String subscriptionArn ) { return unsubscribeAsync ( new UnsubscribeRequest ( ) . withSubscriptionArn ( subscriptionArn ) ) ; }
Simplified method form for invoking the Unsubscribe operation .
30,356
public java . util . concurrent . Future < UnsubscribeResult > unsubscribeAsync ( String subscriptionArn , com . amazonaws . handlers . AsyncHandler < UnsubscribeRequest , UnsubscribeResult > asyncHandler ) { return unsubscribeAsync ( new UnsubscribeRequest ( ) . withSubscriptionArn ( subscriptionArn ) , asyncHandler ) ; }
Simplified method form for invoking the Unsubscribe operation with an AsyncHandler .
30,357
public void setWhitelist ( java . util . Collection < String > whitelist ) { if ( whitelist == null ) { this . whitelist = null ; return ; } this . whitelist = new java . util . ArrayList < String > ( whitelist ) ; }
A list of source IP CIDR blocks that will be allowed to access the OriginEndpoint .
30,358
public ItemResponse withEventsItemResponse ( java . util . Map < String , EventItemResponse > eventsItemResponse ) { setEventsItemResponse ( eventsItemResponse ) ; return this ; }
A multipart response object that contains a key and value for each event ID in the request . In each object the event ID is the key and an EventItemResponse object is the value .
30,359
private AmazonServiceException createException ( String errorCode , JsonContent jsonContent ) { AmazonServiceException ase = unmarshallException ( errorCode , jsonContent ) ; if ( ase == null ) { ase = new AmazonServiceException ( "Unable to unmarshall exception response with the unmarshallers provided" ) ; } return ase ; }
Create an AmazonServiceException using the chain of unmarshallers . This method will never return null it will always return a valid AmazonServiceException
30,360
public FindingStatistics withCountBySeverity ( java . util . Map < String , Integer > countBySeverity ) { setCountBySeverity ( countBySeverity ) ; return this ; }
Represents a map of severity to count statistic for a set of findings
30,361
private void processRecordsWithRetries ( List < Record > records ) { for ( Record record : records ) { boolean processedSuccessfully = false ; for ( int i = 0 ; i < NUM_RETRIES ; i ++ ) { try { processSingleRecord ( record ) ; processedSuccessfully = true ; break ; } catch ( Throwable t ) { LOG . warn ( "Caught throwable while processing record " + record , t ) ; } try { Thread . sleep ( BACKOFF_TIME_IN_MILLIS ) ; } catch ( InterruptedException e ) { LOG . debug ( "Interrupted sleep" , e ) ; } } if ( ! processedSuccessfully ) { LOG . error ( "Couldn't process record " + record + ". Skipping the record." ) ; } } }
Process records performing retries as needed . Skip poison pill records .
30,362
private void processSingleRecord ( Record record ) { String data = null ; try { data = decoder . decode ( record . getData ( ) ) . toString ( ) ; long recordCreateTime = new Long ( data . substring ( "testData-" . length ( ) ) ) ; long ageOfRecordInMillis = System . currentTimeMillis ( ) - recordCreateTime ; LOG . info ( record . getSequenceNumber ( ) + ", " + record . getPartitionKey ( ) + ", " + data + ", Created " + ageOfRecordInMillis + " milliseconds ago." ) ; } catch ( NumberFormatException e ) { LOG . info ( "Record does not match sample record format. Ignoring record with data; " + data ) ; } catch ( CharacterCodingException e ) { LOG . error ( "Malformed data: " + data , e ) ; } }
Process a single record .
30,363
private void checkpoint ( IRecordProcessorCheckpointer checkpointer ) { LOG . info ( "Checkpointing shard " + kinesisShardId ) ; for ( int i = 0 ; i < NUM_RETRIES ; i ++ ) { try { checkpointer . checkpoint ( ) ; break ; } catch ( ShutdownException se ) { LOG . info ( "Caught shutdown exception, skipping checkpoint." , se ) ; break ; } catch ( ThrottlingException e ) { if ( i >= ( NUM_RETRIES - 1 ) ) { LOG . error ( "Checkpoint failed after " + ( i + 1 ) + "attempts." , e ) ; break ; } else { LOG . info ( "Transient issue when checkpointing - attempt " + ( i + 1 ) + " of " + NUM_RETRIES , e ) ; } } catch ( InvalidStateException e ) { LOG . error ( "Cannot save checkpoint to the DynamoDB table used by the Amazon Kinesis Client Library." , e ) ; break ; } try { Thread . sleep ( BACKOFF_TIME_IN_MILLIS ) ; } catch ( InterruptedException e ) { LOG . debug ( "Interrupted sleep" , e ) ; } } }
Checkpoint with retries .
30,364
public UploadResult waitForUploadResult ( ) throws AmazonClientException , AmazonServiceException , InterruptedException { try { UploadResult result = null ; while ( ! monitor . isDone ( ) || result == null ) { Future < ? > f = monitor . getFuture ( ) ; result = ( UploadResult ) f . get ( ) ; } return result ; } catch ( ExecutionException e ) { rethrowExecutionException ( e ) ; return null ; } }
Waits for this upload to complete and returns the result of this upload . This is a blocking call . Be prepared to handle errors when calling this method . Any errors that occurred during the asynchronous transfer will be re - thrown through this method .
30,365
private PauseResult < PersistableUpload > pause ( final boolean forceCancelTransfers ) throws AmazonClientException { UploadMonitor uploadMonitor = ( UploadMonitor ) monitor ; return uploadMonitor . pause ( forceCancelTransfers ) ; }
Tries to pause and return the information required to resume the upload operation .
30,366
public Waiter < DescribeClusterRequest > clusterActive ( ) { return new WaiterBuilder < DescribeClusterRequest , DescribeClusterResult > ( ) . withSdkFunction ( new DescribeClusterFunction ( client ) ) . withAcceptors ( new ClusterActive . IsDELETINGMatcher ( ) , new ClusterActive . IsFAILEDMatcher ( ) , new ClusterActive . IsACTIVEMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 40 ) , new FixedDelayStrategy ( 30 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a ClusterActive 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 .
30,367
public TransactionLoadRequest addLoad ( Object key ) { objectsToLoad . add ( key ) ; objectLoadExpressions . add ( null ) ; return this ; }
Adds specified key to list of objects to load . All item attributes will be loaded .
30,368
public TransactionLoadRequest addLoad ( Object key , DynamoDBTransactionLoadExpression transactLoadExpression ) { objectsToLoad . add ( key ) ; objectLoadExpressions . add ( transactLoadExpression ) ; return this ; }
Adds specified key to list of objects to load . Item attributes will be loaded as specified by transactLoadExpression .
30,369
public Waiter < GetChangeRequest > resourceRecordSetsChanged ( ) { return new WaiterBuilder < GetChangeRequest , GetChangeResult > ( ) . withSdkFunction ( new GetChangeFunction ( client ) ) . withAcceptors ( new ResourceRecordSetsChanged . IsINSYNCMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 60 ) , new FixedDelayStrategy ( 30 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a ResourceRecordSetsChanged 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 .
30,370
public void setVersions ( java . util . Collection < VersionInformation > versions ) { if ( versions == null ) { this . versions = null ; return ; } this . versions = new java . util . ArrayList < VersionInformation > ( versions ) ; }
Information about a version .
30,371
public String getVariableSetterType ( ) { final String prefix = List . class . getName ( ) ; if ( variableType . startsWith ( prefix ) ) { return Collection . class . getName ( ) + variableType . substring ( prefix . length ( ) ) ; } else { return variableType ; } }
Returns the Java type used for the input parameter of a setter method .
30,372
static synchronized boolean startSingleton ( CloudWatchMetricConfig config ) { if ( singleton != null ) { return false ; } log . info ( "Initializing " + MetricCollectorSupport . class . getSimpleName ( ) ) ; return createAndStartCollector ( config ) ; }
Starts a new CloudWatch collector if it s not already started .
30,373
static synchronized boolean restartSingleton ( CloudWatchMetricConfig config ) { if ( singleton == null ) { throw new IllegalStateException ( MetricCollectorSupport . class . getSimpleName ( ) + " has neven been initialized" ) ; } log . info ( "Re-initializing " + MetricCollectorSupport . class . getSimpleName ( ) ) ; singleton . stop ( ) ; return createAndStartCollector ( config ) ; }
Retarts with a new CloudWatch collector .
30,374
private static boolean createAndStartCollector ( CloudWatchMetricConfig config ) { MetricCollectorSupport collector = new MetricCollectorSupport ( config ) ; if ( collector . start ( ) ) { singleton = collector ; return true ; } return false ; }
Returns true if the collector is successfully created and started ; false otherwise .
30,375
public boolean stop ( ) { synchronized ( MetricCollectorSupport . class ) { if ( uploaderThread != null ) { uploaderThread . cancel ( ) ; uploaderThread . interrupt ( ) ; uploaderThread = null ; if ( singleton == this ) { singleton = null ; } return true ; } } return false ; }
Stops this collector immediately dropping all pending metrics in memory .
30,376
public void sign ( SignableRequest < ? > request , AWSCredentials credentials ) throws SdkClientException { sign ( request , SignatureVersion . V2 , SigningAlgorithm . HmacSHA256 , credentials ) ; }
This signer will add Signature parameter to the request . Default signature version is 2 and default signing algorithm is HmacSHA256 .
30,377
private String calculateStringToSignV1 ( Map < String , List < String > > parameters ) { StringBuilder data = new StringBuilder ( ) ; SortedMap < String , List < String > > sorted = new TreeMap < String , List < String > > ( String . CASE_INSENSITIVE_ORDER ) ; sorted . putAll ( parameters ) ; for ( Map . Entry < String , List < String > > entry : sorted . entrySet ( ) ) { for ( String value : entry . getValue ( ) ) { data . append ( entry . getKey ( ) ) . append ( value ) ; } } return data . toString ( ) ; }
Calculates string to sign for signature version 1 .
30,378
private String calculateStringToSignV2 ( SignableRequest < ? > request ) throws SdkClientException { URI endpoint = request . getEndpoint ( ) ; StringBuilder data = new StringBuilder ( ) ; data . append ( "POST" ) . append ( "\n" ) . append ( getCanonicalizedEndpoint ( endpoint ) ) . append ( "\n" ) . append ( getCanonicalizedResourcePath ( request ) ) . append ( "\n" ) . append ( getCanonicalizedQueryString ( request . getParameters ( ) ) ) ; return data . toString ( ) ; }
Calculate string to sign for signature version 2 .
30,379
private String getFormattedTimestamp ( int offset ) { SimpleDateFormat df = new SimpleDateFormat ( "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" ) ; df . setTimeZone ( TimeZone . getTimeZone ( "UTC" ) ) ; if ( overriddenDate != null ) { return df . format ( overriddenDate ) ; } else { return df . format ( getSignatureDate ( offset ) ) ; } }
Formats date as ISO 8601 timestamp
30,380
public void setBrokerSummaries ( java . util . Collection < BrokerSummary > brokerSummaries ) { if ( brokerSummaries == null ) { this . brokerSummaries = null ; return ; } this . brokerSummaries = new java . util . ArrayList < BrokerSummary > ( brokerSummaries ) ; }
A list of information about all brokers .
30,381
protected CipherLite newCipherLite ( Cipher cipher , SecretKey cek , int cipherMode ) { return new CipherLite ( cipher , this , cek , cipherMode ) ; }
This is a factory method intended to be overridden by sublcasses to return the appropriate instance of cipher lite .
30,382
public java . util . concurrent . Future < DescribeHsmResult > describeHsmAsync ( com . amazonaws . handlers . AsyncHandler < DescribeHsmRequest , DescribeHsmResult > asyncHandler ) { return describeHsmAsync ( new DescribeHsmRequest ( ) , asyncHandler ) ; }
Simplified method form for invoking the DescribeHsm operation with an AsyncHandler .
30,383
public static String toCamelCase ( String str ) { if ( str == null || str . isEmpty ( ) ) { return str ; } StringBuilder stringBuilder = new StringBuilder ( ) ; boolean foundFirstLowercase = false ; for ( char cur : str . toCharArray ( ) ) { if ( Character . isUpperCase ( cur ) && ! foundFirstLowercase ) { stringBuilder . append ( Character . toLowerCase ( cur ) ) ; } else { foundFirstLowercase = true ; stringBuilder . append ( cur ) ; } } return stringBuilder . toString ( ) ; }
This matches the algorithm that Jackson uses to convert getter names to JSON field names . Any names starting with a lowercase character are left as is any names starting with one or more uppercase characters have all consecutive uppercase characters converted to lowercase . See tests for examples .
30,384
public java . util . concurrent . Future < DescribeDomainsResult > describeDomainsAsync ( com . amazonaws . handlers . AsyncHandler < DescribeDomainsRequest , DescribeDomainsResult > asyncHandler ) { return describeDomainsAsync ( new DescribeDomainsRequest ( ) , asyncHandler ) ; }
Simplified method form for invoking the DescribeDomains operation with an AsyncHandler .
30,385
public java . util . concurrent . Future < ListDomainNamesResult > listDomainNamesAsync ( com . amazonaws . handlers . AsyncHandler < ListDomainNamesRequest , ListDomainNamesResult > asyncHandler ) { return listDomainNamesAsync ( new ListDomainNamesRequest ( ) , asyncHandler ) ; }
Simplified method form for invoking the ListDomainNames operation with an AsyncHandler .
30,386
public static < T > List < T > mergeLists ( List < T > list1 , List < T > list2 ) { List < T > merged = new LinkedList < T > ( ) ; if ( list1 != null ) { merged . addAll ( list1 ) ; } if ( list2 != null ) { merged . addAll ( list2 ) ; } return merged ; }
Returns a new list containing the second list appended to the first list .
30,387
public static String join ( Collection < String > toJoin , String separator ) { if ( isNullOrEmpty ( toJoin ) ) { return "" ; } StringBuilder joinedString = new StringBuilder ( ) ; int currentIndex = 0 ; for ( String s : toJoin ) { if ( s != null ) { joinedString . append ( s ) ; } if ( currentIndex ++ != toJoin . size ( ) - 1 ) { joinedString . append ( separator ) ; } } return joinedString . toString ( ) ; }
Joins a collection of strings with the given separator into a single string .
30,388
private JsonNode applyCustomizationsToShapeJson ( String shapeName , Shape shape , JsonNode valueNode ) { if ( valueNode == null || ! valueNode . isContainerNode ( ) ) { return valueNode ; } valueNode = applyModificationsToShapeJson ( shapeName , valueNode ) ; ShapeSubstitution shapeSub = null ; if ( customizationConfig . getShapeSubstitutions ( ) != null ) { shapeSub = customizationConfig . getShapeSubstitutions ( ) . get ( shapeName ) ; } if ( shapeSub != null ) { String substituteShapeName = shapeSub . getEmitAsShape ( ) ; Shape substituteShape = serviceModel . getShape ( substituteShapeName ) ; JsonNode substituteValue = valueNode ; if ( shapeSub . getEmitFromMember ( ) != null ) { substituteValue = valueNode . get ( shapeSub . getEmitFromMember ( ) ) ; if ( substituteValue == null ) { System . err . println ( String . format ( "Warning: Substituting shape '%s' for its" + " member '%s' as shape '%s' produced null value. Original" + " value: %s" , shapeName , shapeSub . getEmitFromMember ( ) , substituteShapeName , valueNode . toString ( ) ) ) ; } } System . out . println ( String . format ( "Substituting shape %s with %s. %s -> %s" , shapeName , substituteShapeName , valueNode . toString ( ) , Objects . toString ( substituteValue ) ) ) ; return applyCustomizationsToShapeJson ( substituteShapeName , substituteShape , substituteValue ) ; } else { switch ( shape . getType ( ) ) { case "map" : case "structure" : { if ( shape . getMembers ( ) == null ) { return valueNode ; } ObjectNode obj = MAPPER . createObjectNode ( ) ; for ( Map . Entry < String , Member > e : shape . getMembers ( ) . entrySet ( ) ) { Member member = e . getValue ( ) ; String memberName = e . getKey ( ) ; String memberShapeName = member . getShape ( ) ; Shape memberShape = serviceModel . getShape ( memberShapeName ) ; JsonNode memberValue = valueNode . get ( memberName ) ; if ( memberValue != null ) { obj . set ( memberName , applyCustomizationsToShapeJson ( memberShapeName , memberShape , memberValue ) ) ; } } return obj ; } case "list" : { ArrayNode list = MAPPER . createArrayNode ( ) ; String memberShapeName = shape . getListMember ( ) . getShape ( ) ; Shape memberShape = serviceModel . getShape ( memberShapeName ) ; for ( JsonNode e : valueNode ) { list . add ( applyCustomizationsToShapeJson ( memberShapeName , memberShape , e ) ) ; } return list ; } default : throw new RuntimeException ( "Unknown shape type: " + shape . getType ( ) ) ; } } }
Recursively apply any declared customizations to this JSON value according to the given shape and the customizations declared for the shape .
30,389
private JsonNode applyShapeModifier ( JsonNode node , ShapeModifier modifier ) { if ( node == null || modifier == null ) { return node ; } if ( modifier . getExclude ( ) == null && modifier . getModify ( ) == null ) { return node ; } if ( ! node . isObject ( ) ) return node ; final ObjectNode obj = ( ObjectNode ) node ; ObjectNode modified = MAPPER . createObjectNode ( ) ; final List < String > excludes = modifier . getExclude ( ) != null ? modifier . getExclude ( ) : Collections . emptyList ( ) ; obj . fieldNames ( ) . forEachRemaining ( m -> { if ( ! excludes . contains ( m ) ) { modified . set ( m , obj . get ( m ) ) ; } } ) ; final List < Map < String , ShapeModifier_ModifyModel > > modify = modifier . getModify ( ) != null ? modifier . getModify ( ) : Collections . emptyList ( ) ; modify . forEach ( memberMods -> memberMods . entrySet ( ) . forEach ( memberMod -> { String memberName = memberMod . getKey ( ) ; ShapeModifier_ModifyModel modelModify = memberMod . getValue ( ) ; if ( modelModify . getEmitPropertyName ( ) != null ) { String newName = modelModify . getEmitPropertyName ( ) ; modified . set ( newName , modified . get ( memberName ) ) ; modified . remove ( memberName ) ; memberName = newName ; } } ) ) ; return modified ; }
Apply any shape modifiers to the JSON value . This only takes care of exclude and emitPropertyName .
30,390
public synchronized AWSSessionCredentials getImmutableCredentials ( ) { Credentials creds = getSessionCredentials ( ) ; return new BasicSessionCredentials ( creds . getAccessKeyId ( ) , creds . getSecretAccessKey ( ) , creds . getSessionToken ( ) ) ; }
Returns immutable session credentials for this session beginning a new one if necessary .
30,391
public synchronized void refreshCredentials ( ) { GetSessionTokenResult sessionTokenResult = securityTokenService . getSessionToken ( new GetSessionTokenRequest ( ) . withDurationSeconds ( sessionDurationSeconds ) ) ; sessionCredentials = sessionTokenResult . getCredentials ( ) ; }
Refreshes the session credentials from STS .
30,392
public List < T > batchLoad ( Iterable < T > itemsToGet ) { final Map < String , List < Object > > results = mapper . batchLoad ( itemsToGet ) ; if ( results . isEmpty ( ) ) { return Collections . < T > emptyList ( ) ; } return ( List < T > ) results . get ( mapper . getTableName ( model . targetType ( ) , config ) ) ; }
Retrieves multiple items from the table using their primary keys .
30,393
public List < DynamoDBMapper . FailedBatch > batchSave ( Iterable < T > objectsToSave ) { return mapper . batchWrite ( objectsToSave , ( Iterable < T > ) Collections . < T > emptyList ( ) ) ; }
Saves the objects given using one or more calls to the batchWriteItem API .
30,394
public List < DynamoDBMapper . FailedBatch > batchDelete ( Iterable < T > objectsToDelete ) { return mapper . batchWrite ( ( Iterable < T > ) Collections . < T > emptyList ( ) , objectsToDelete ) ; }
Deletes the objects given using one or more calls to the batchWtiteItem API .
30,395
public List < DynamoDBMapper . FailedBatch > batchWrite ( Iterable < T > objectsToWrite , Iterable < T > objectsToDelete ) { return mapper . batchWrite ( objectsToWrite , objectsToDelete ) ; }
Saves and deletes the objects given using one or more calls to the batchWriteItem API .
30,396
public T load ( H hashKey ) { return mapper . < T > load ( model . targetType ( ) , hashKey ) ; }
Loads an object with the hash key given .
30,397
public T load ( H hashKey , R rangeKey ) { return mapper . < T > load ( model . targetType ( ) , hashKey , rangeKey ) ; }
Loads an object with the hash and range key .
30,398
public void save ( T object , DynamoDBSaveExpression saveExpression ) { mapper . < T > save ( object , saveExpression ) ; }
Saves the object given into DynamoDB using the specified saveExpression .
30,399
public void saveIfNotExists ( T object ) throws ConditionalCheckFailedException { final DynamoDBSaveExpression saveExpression = new DynamoDBSaveExpression ( ) ; for ( final DynamoDBMapperFieldModel < T , Object > key : model . keys ( ) ) { saveExpression . withExpectedEntry ( key . name ( ) , new ExpectedAttributeValue ( ) . withExists ( false ) ) ; } mapper . < T > save ( object , saveExpression ) ; }
Saves the object given into DynamoDB with the condition that the hash and if applicable the range key does not already exist .