idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
30,200 | public Integer getInteger ( String key , Supplier < Integer > notFound ) { return getParsed ( key , Integer :: new , notFound ) ; } | Retrieve a mapped element and return it as an Integer . |
30,201 | public Double getDouble ( String key , Supplier < Double > notFound ) { return getParsed ( key , Double :: new , notFound ) ; } | Retrieve a mapped element and return it as a Double . |
30,202 | public Float getFloat ( String key , Supplier < Float > notFound ) { return getParsed ( key , Float :: new , notFound ) ; } | Retrieve a mapped element and return it as a Float . |
30,203 | public void execute ( ) throws HibiscusException { prepare ( ) ; httpRequest . addHeader ( "User-Agent" , getClass ( ) . getName ( ) . toUpperCase ( ) ) ; httpRequest . addHeader ( "X-Conversation-Id" , HashGenerator . getMD5Hash ( System . currentTimeMillis ( ) + "." + new Thread ( ) . getId ( ) ) ) ; SchemeRegistry registry = SchemeRegistryFactory . createDefault ( ) ; ; PoolingClientConnectionManager connManager = new PoolingClientConnectionManager ( registry ) ; DefaultHttpClient requestClient = new DefaultHttpClient ( connManager ) ; try { final long startTime = System . currentTimeMillis ( ) ; final HttpResponse response = requestClient . execute ( httpRequest ) ; final long elapsedTime = System . currentTimeMillis ( ) - startTime ; final HttpEntity responseEntity = response . getEntity ( ) ; this . responseTime = elapsedTime ; this . response = new Response ( ) ; this . response . setStatusLine ( response . getStatusLine ( ) . toString ( ) ) ; this . response . setResponseHeaders ( response . getAllHeaders ( ) ) ; if ( null != responseEntity ) { this . response . setResponseBody ( StreamUtil . inputStreamToString ( responseEntity . getContent ( ) ) ) ; } if ( log . isDebugEnabled ( ) ) { debugRequest ( response ) ; } } catch ( IOException e ) { throw new HibiscusException ( e ) ; } } | Transmits the HTTP request from the client to the server |
30,204 | public static HttpWorkerAbstract getWorkerStrategy ( final String requestMethod , final HttpClient client ) { if ( requestMethod . equals ( HEAD ) ) { return new HttpWorkerHead ( client ) ; } else if ( requestMethod . equals ( GET ) ) { return new HttpWorkerGet ( client ) ; } else if ( requestMethod . equals ( POST ) ) { return new HttpWorkerPost ( client ) ; } else if ( requestMethod . equals ( PUT ) ) { return new HttpWorkerPut ( client ) ; } else if ( requestMethod . equals ( DELETE ) ) { return new HttpWorkerDelete ( client ) ; } return new HttpWorkerGet ( client ) ; } | Returns an instance of a HTTP Worker based on the request method |
30,205 | static public FileId getInstance ( String id ) throws DaoManagerException { if ( id != null && FileConnector . exists ( id ) ) { return new FileId ( id , null ) ; } else { return null ; } } | if FileId is not a valid file this returns null |
30,206 | public List < Invocation > toChain ( ) { List < Invocation > chain = parent == null ? new ArrayList < Invocation > ( ) : parent . toChain ( ) ; chain . add ( this ) ; return chain ; } | Returns a list of invocation . |
30,207 | @ SuppressWarnings ( "unchecked" ) public Object invoke ( Object object ) throws Exception { if ( object == null ) throw new NullPointerException ( "object" ) ; for ( Invocation invocation : toChain ( ) ) { MethodDescriptor < Object , Object > unchecked = ( MethodDescriptor < Object , Object > ) invocation . method ; object = unchecked . invoke ( object , invocation . getArgsWithDefaults ( ) ) ; } return object ; } | Invokes this invocation chain on an object . |
30,208 | public Request addQueryParameter ( final String name , final String value ) { this . query . put ( name , value ) ; return this ; } | Adds a Query Parameter to a list . The list is converted to a String and appended to the URL when the Request is submitted . |
30,209 | private Response writeResource ( final String method , final String body ) throws IOException { buildQueryString ( ) ; buildHeaders ( ) ; connection . setDoOutput ( true ) ; connection . setRequestMethod ( method ) ; writer = new OutputStreamWriter ( connection . getOutputStream ( ) ) ; writer . write ( body ) ; writer . close ( ) ; return readResponse ( ) ; } | A private method that handles issuing POST and PUT requests |
30,210 | private void buildQueryString ( ) throws MalformedURLException { StringBuilder builder = new StringBuilder ( ) ; if ( ! query . isEmpty ( ) ) { for ( Map . Entry < String , String > param : query . entrySet ( ) ) { builder . append ( param . getKey ( ) ) ; builder . append ( "=" ) ; builder . append ( param . getValue ( ) ) ; builder . append ( "&" ) ; } builder . deleteCharAt ( builder . lastIndexOf ( "&" ) ) ; } if ( builder . length ( ) > 0 ) { builder . insert ( 0 , "?" ) ; } url = new URL ( url . toString ( ) + builder . toString ( ) ) ; } | A private method that loops through the query parameter Map building a String to be appended to the URL . |
30,211 | private void buildHeaders ( ) { if ( ! headers . isEmpty ( ) ) { for ( Map . Entry < String , List < String > > entry : headers . entrySet ( ) ) { List < String > values = entry . getValue ( ) ; for ( String value : values ) { connection . addRequestProperty ( entry . getKey ( ) , value ) ; } } } } | A private method that loops through the headers Map putting them on the Request or Response object . |
30,212 | public static QName tagToQName ( final String tag , final Map < String , String > nsRegistry ) { final String [ ] split = tag . split ( "\\:" ) ; if ( split . length <= 1 ) { return new QName ( split [ 0 ] ) ; } else { final String namespace = nsRegistry . get ( split [ 0 ] ) ; if ( namespace != null ) { return new QName ( namespace , split [ 1 ] ) ; } else { return new QName ( split [ 1 ] ) ; } } } | Transform a tag local or prefixed with a namespace alias to a local or full QName . |
30,213 | public long write ( short type , byte [ ] [ ] data ) throws InterruptedException , IOException { try { return super . put ( type , data , true ) ; } catch ( InterruptedException e ) { throw e ; } catch ( IOException e ) { throw e ; } catch ( Throwable e ) { throw new DelegatedRuntimeException ( e ) ; } } | Sub - classes call this method to write log records with a specific record type . |
30,214 | public int getThreadNumber ( ) { if ( cli . hasOption ( THREAD_NUMBER ) ) { return Integer . valueOf ( cli . getOptionValue ( THREAD_NUMBER ) ) ; } return DEFAULT_THREAD_NUMBER ; } | If thread number option is true returns thread number . If false returns default number . |
30,215 | public long getSplitSize ( ) { if ( cli . hasOption ( SPLIT_SIZE ) ) { return Long . valueOf ( cli . getOptionValue ( SPLIT_SIZE ) ) ; } return DEFAULT_SPLIT_SIZE ; } | If split size option is true returns thread number . If false returns split size . |
30,216 | @ Property ( value = "" ) public String produceSystemProperty ( InjectionPoint ip ) { Property annotation = ip . getAnnotated ( ) . getAnnotation ( Property . class ) ; String propertyKey = annotation . value ( ) ; String defaultValue = annotation . defaultValue ( ) ; if ( propertyKey == null || propertyKey . isEmpty ( ) ) { return defaultValue ; } Resolver resolverAnnotation = annotation . resolver ( ) ; ResolverWrapper wrapper = new ResolverAnnotationWrapper ( resolverAnnotation ) ; PropertyResolver resolver = this . resolverFactory . createPropertyResolver ( wrapper ) ; Map < Object , Object > bootstrapMap = this . resolverFactory . getBootstrapProperties ( wrapper ) ; Map < Object , Object > defaultMap = this . resolverFactory . getDefaultProperties ( wrapper ) ; this . logger . trace ( "original default value for '{}' is '{}'" , propertyKey , defaultValue ) ; String resolvedDefault = resolver . resolveProperties ( defaultValue , bootstrapMap , defaultMap ) ; this . logger . trace ( "default value for '{}' resolved to '{}'" , propertyKey , defaultValue ) ; String value = resolver . resolveProperties ( propertyKey , bootstrapMap , defaultMap ) ; if ( value == null || value . isEmpty ( ) || propertyKey . equals ( value ) ) { value = resolvedDefault ; } this . logger . trace ( "value for '{}' resolved to '{}'" , propertyKey , value ) ; return value ; } | Produces the System Property Specified by the Injection Point . |
30,217 | public void addBcc ( final Address internetAddress ) throws MessagingException { super . addRecipient ( javax . mail . Message . RecipientType . BCC , internetAddress ) ; } | Adding one bcc - address to the EmailMessage . |
30,218 | public void addCc ( final Address internetAddress ) throws MessagingException { super . addRecipient ( javax . mail . Message . RecipientType . CC , internetAddress ) ; } | Adding one cc - address to the EmailMessage . |
30,219 | public void addTo ( final Address internetAddress ) throws MessagingException { super . addRecipient ( javax . mail . Message . RecipientType . TO , internetAddress ) ; } | Adding one to - address to the EmailMessage . |
30,220 | public void setContent ( final Object content , final String type ) throws MessagingException { charset = EmailExtensions . getCharsetFromContentType ( type ) ; super . setContent ( content , type ) ; } | Sets the content . |
30,221 | public void setFrom ( final String senderEmail ) throws AddressException , UnsupportedEncodingException , MessagingException { final Address fromEmail = EmailExtensions . newAddress ( senderEmail ) ; super . setFrom ( fromEmail ) ; } | Sets the from address . |
30,222 | public void setUtf8Content ( final Object content ) throws MessagingException { final String type = EmailConstants . MIMETYPE_TEXT_PLAIN + EmailConstants . CHARSET_PREFIX + EmailConstants . CHARSET_UTF8 ; setContent ( content , type ) ; } | Sets the utf8 content . |
30,223 | public static String show ( String s ) { StringBuilder builder = new StringBuilder ( ) ; if ( s != null ) { for ( char ch : s . toCharArray ( ) ) { addCharacter ( builder , ch ) ; } } return builder . toString ( ) ; } | Shows a string in such a way that it can be uniquely decoded but with a minimum of syntactic sugar . |
30,224 | public static String displayParts ( Object ... parts ) { StringBuilder builder = new StringBuilder ( "[" ) ; boolean first = true ; for ( Object part : parts ) { if ( first ) { first = false ; } else { builder . append ( '|' ) ; } if ( part == null ) { builder . append ( '?' ) ; } else { builder . append ( display ( part ) ) ; } } builder . append ( ']' ) ; return builder . toString ( ) ; } | Displays the given parts with a bit of syntactic sugar . |
30,225 | public static String displayWithTypes ( Object object ) { StringBuilder builder = new StringBuilder ( ) ; displayRecursive ( object , builder , new Stack < > ( ) , true ) ; return builder . toString ( ) ; } | Displays the given object including type information . |
30,226 | public static String display ( Object object ) { StringBuilder builder = new StringBuilder ( ) ; displayRecursive ( object , builder , new Stack < > ( ) , false ) ; return builder . toString ( ) ; } | Displays the given object excluding type information . |
30,227 | public static String display ( Object first , Object second , Object ... remainder ) { Object [ ] array = new Object [ remainder . length + 2 ] ; array [ 0 ] = first ; array [ 1 ] = second ; System . arraycopy ( remainder , 0 , array , 2 , remainder . length ) ; return display ( array ) ; } | Displays the given objects as an array excluding type information . |
30,228 | private void authorizeClassicDbSecurityGroup ( String groupName , String sourceCidr ) throws CloudException , InternalException { Map < String , String > parameters = getProvider ( ) . getStandardRdsParameters ( getProvider ( ) . getContext ( ) , AUTHORIZE_DB_SECURITY_GROUP_INGRESS ) ; parameters . put ( "DBSecurityGroupName" , groupName ) ; parameters . put ( "CIDRIP" , sourceCidr ) ; EC2Method method = new EC2Method ( SERVICE_ID , getProvider ( ) , parameters ) ; try { method . invoke ( ) ; } catch ( EC2Exception e ) { String code = e . getCode ( ) ; if ( code != null && code . equals ( "AuthorizationAlreadyExists" ) ) { return ; } throw new CloudException ( e ) ; } } | Use this to authorize with security groups in EC2 - Classic |
30,229 | private void revokeClassicDbSecurityGroup ( String groupName , String sourceCidr ) throws CloudException , InternalException { Map < String , String > parameters = getProvider ( ) . getStandardRdsParameters ( getProvider ( ) . getContext ( ) , REVOKE_DB_SECURITY_GROUP_INGRESS ) ; parameters . put ( "CIDRIP" , sourceCidr ) ; parameters . put ( "DBSecurityGroupName" , groupName ) ; EC2Method method = new EC2Method ( SERVICE_ID , getProvider ( ) , parameters ) ; method . invoke ( ) ; } | Use this to revoke access of security groups in EC2 - Classic |
30,230 | public static String getFileExtension ( String resource ) { int secondToTheLastDot = resource . lastIndexOf ( '.' , resource . length ( ) - 5 ) ; if ( secondToTheLastDot == - 1 ) { throw new IllegalArgumentException ( "The resource must be named like: 'foo.type.stg' " + "where '.type' will be the file extension of the output files." ) ; } String extension = resource . substring ( secondToTheLastDot , resource . length ( ) - 4 ) ; if ( extension . length ( ) < 2 ) { throw new IllegalArgumentException ( "The resource must be named like: 'foo.type.stg' " + "where '.type' will be the file extension of the output files." ) ; } return extension ; } | Get the file extension of the provided stg resource . |
30,231 | public static int [ ] createHashes ( byte [ ] data , int hashes ) { int [ ] result = new int [ hashes ] ; int k = 0 ; byte salt = 0 ; while ( k < hashes ) { byte [ ] digest ; synchronized ( messageDigest ) { messageDigest . update ( salt ) ; salt ++ ; digest = messageDigest . digest ( data ) ; } for ( int i = 0 ; i < digest . length / 4 && k < hashes ; i ++ ) { int h = 0 ; for ( int j = ( i * 4 ) ; j < ( i * 4 ) + 4 ; j ++ ) { h <<= 8 ; h |= ( ( int ) digest [ j ] ) & 0xFF ; } result [ k ] = h ; k ++ ; } } return result ; } | Generates digests based on the contents of an array of bytes and splits the result into 4 - byte int s and store them in an array . The digest function is called until the required number of int s are produced . For each call to digest a salt is prepended to the data . The salt is increased by 1 for each call . |
30,232 | protected Properties decryptPassword ( final Properties properties ) { String password = properties . getProperty ( "password" ) ; properties . put ( "password" , AESUtil . decrypt ( password , AESUtil . DEFAULT_KEY ) ) ; return properties ; } | Decrypt password . |
30,233 | @ SuppressWarnings ( "unchecked" ) public static < T , I > List < T > asList ( I ... target ) { return ( List < T > ) Arrays . asList ( asArray ( target ) ) ; } | Returns an list containing all of the given elements |
30,234 | public static < T > Object unwraps ( T [ ] target ) { return new StructBehavior < Object > ( target ) { protected Object booleanIf ( ) { return unwrap ( ( Boolean [ ] ) this . delegate ) ; } protected Object byteIf ( ) { return unwrap ( ( Byte [ ] ) this . delegate ) ; } protected Object characterIf ( ) { return unwrap ( ( Character [ ] ) this . delegate ) ; } protected Object doubleIf ( ) { return unwrap ( ( Double [ ] ) this . delegate ) ; } protected Object floatIf ( ) { return unwrap ( ( Float [ ] ) this . delegate ) ; } protected Object integerIf ( ) { return unwrap ( ( Integer [ ] ) this . delegate ) ; } protected Object longIf ( ) { return unwrap ( ( Long [ ] ) this . delegate ) ; } protected Object shortIf ( ) { return unwrap ( ( Short [ ] ) this . delegate ) ; } protected Object nullIf ( ) { return null ; } protected Object noneMatched ( ) { return this . delegate ; } } . doDetect ( ) ; } | Converts the given object array to primitive array object . |
30,235 | static Object add ( Object array , int index , Object element , Class < ? > clss ) { if ( array == null ) { if ( index != 0 ) { throw new IndexOutOfBoundsException ( "Index: " + index + ", Length: 0" ) ; } Object joinedArray = Array . newInstance ( clss , 1 ) ; Array . set ( joinedArray , 0 , element ) ; return joinedArray ; } int length = Array . getLength ( array ) ; if ( index > length || index < 0 ) { throw new IndexOutOfBoundsException ( "Index: " + index + ", Length: " + length ) ; } Object result = Array . newInstance ( clss , length + 1 ) ; System . arraycopy ( array , 0 , result , 0 , index ) ; Array . set ( result , index , element ) ; if ( index < length ) { System . arraycopy ( array , index , result , index + 1 , length - index ) ; } return result ; } | Adds the element at the specified position from the specified array |
30,236 | public static Object remove ( Object array , int index ) { int length = length ( array ) ; if ( index < 0 || index >= length ) { throw new IndexOutOfBoundsException ( "Index: " + index + ", Length: " + length ) ; } Object result = Array . newInstance ( array . getClass ( ) . getComponentType ( ) , length - 1 ) ; System . arraycopy ( array , 0 , result , 0 , index ) ; if ( index < length - 1 ) { System . arraycopy ( array , index + 1 , result , index , length - index - 1 ) ; } return result ; } | Removes the element at the specified position from the specified array |
30,237 | public java . util . concurrent . Future < ListSSHPublicKeysResult > listSSHPublicKeysAsync ( com . amazonaws . handlers . AsyncHandler < ListSSHPublicKeysRequest , ListSSHPublicKeysResult > asyncHandler ) { return listSSHPublicKeysAsync ( new ListSSHPublicKeysRequest ( ) , asyncHandler ) ; } | Simplified method form for invoking the ListSSHPublicKeys operation with an AsyncHandler . |
30,238 | public java . util . concurrent . Future < ListVirtualMFADevicesResult > listVirtualMFADevicesAsync ( com . amazonaws . handlers . AsyncHandler < ListVirtualMFADevicesRequest , ListVirtualMFADevicesResult > asyncHandler ) { return listVirtualMFADevicesAsync ( new ListVirtualMFADevicesRequest ( ) , asyncHandler ) ; } | Simplified method form for invoking the ListVirtualMFADevices operation with an AsyncHandler . |
30,239 | public void setMediaPackageSettings ( java . util . Collection < MediaPackageOutputDestinationSettings > mediaPackageSettings ) { if ( mediaPackageSettings == null ) { this . mediaPackageSettings = null ; return ; } this . mediaPackageSettings = new java . util . ArrayList < MediaPackageOutputDestinationSettings > ( mediaPackageSettings ) ; } | Destination settings for a MediaPackage output ; one destination for both encoders . |
30,240 | public void setSettings ( java . util . Collection < OutputDestinationSettings > settings ) { if ( settings == null ) { this . settings = null ; return ; } this . settings = new java . util . ArrayList < OutputDestinationSettings > ( settings ) ; } | Destination settings for a standard output ; one destination for each redundant encoder . |
30,241 | final Mappings mappingsOf ( final Class < ? > clazz ) { if ( ! mappings . containsKey ( clazz ) ) { mappings . putIfAbsent ( clazz , new Mappings ( clazz ) ) ; } return mappings . get ( clazz ) ; } | Gets the mapping definition for a given class . |
30,242 | public void setFunctions ( java . util . Collection < Function > functions ) { if ( functions == null ) { this . functions = null ; return ; } this . functions = new java . util . ArrayList < Function > ( functions ) ; } | A list of Lambda functions in this function definition version . |
30,243 | private void checkMessage ( Message msg ) throws MessagingException { if ( msg == null ) { throw new MessagingException ( "Message is null" ) ; } if ( ! ( msg instanceof MimeMessage ) ) { throw new MessagingException ( "AWS Mail Service can only send MimeMessages" ) ; } } | Checks that the message can be sent using AWS Simple E - mail Service . |
30,244 | private void collateRecipients ( Message m , Address [ ] addresses ) throws MessagingException { if ( ! isNullOrEmpty ( addresses ) ) { Hashtable < Address , Message . RecipientType > addressTable = new Hashtable < Address , Message . RecipientType > ( ) ; for ( Address a : addresses ) { addressTable . put ( a , Message . RecipientType . TO ) ; } if ( ! isNullOrEmpty ( m . getRecipients ( Message . RecipientType . TO ) ) ) { for ( Address a : m . getRecipients ( Message . RecipientType . TO ) ) { addressTable . put ( a , Message . RecipientType . TO ) ; } } if ( ! isNullOrEmpty ( m . getRecipients ( Message . RecipientType . CC ) ) ) { for ( Address a : m . getRecipients ( Message . RecipientType . CC ) ) { addressTable . put ( a , Message . RecipientType . CC ) ; } } if ( ! isNullOrEmpty ( m . getRecipients ( Message . RecipientType . BCC ) ) ) { for ( Address a : m . getRecipients ( Message . RecipientType . BCC ) ) { addressTable . put ( a , Message . RecipientType . BCC ) ; } } m . setRecipients ( Message . RecipientType . TO , new Address [ 0 ] ) ; m . setRecipients ( Message . RecipientType . CC , new Address [ 0 ] ) ; m . setRecipients ( Message . RecipientType . BCC , new Address [ 0 ] ) ; Iterator < Address > aIter = addressTable . keySet ( ) . iterator ( ) ; while ( aIter . hasNext ( ) ) { Address a = aIter . next ( ) ; m . addRecipient ( addressTable . get ( a ) , a ) ; } if ( m . getRecipients ( Message . RecipientType . TO ) == null || m . getRecipients ( Message . RecipientType . TO ) . length == 0 ) { m . setRecipient ( Message . RecipientType . TO , addressTable . keySet ( ) . iterator ( ) . next ( ) ) ; } } } | Collates any addresses into the message object . All addresses in the Address array become of type TO unless they already exist in the Message header . If they are in the Message header they will stay of the same type . Any duplicate addresses are removed . Type BCC and then CC takes precedence over TO when duplicates exist . If any address is invalid an exception is thrown . |
30,245 | private void sendEmail ( Message m , SendRawEmailRequest req ) throws SendFailedException , MessagingException { Address [ ] sent = null ; Address [ ] unsent = null ; Address [ ] invalid = null ; try { appendUserAgent ( req , USER_AGENT ) ; SendRawEmailResult resp = this . emailService . sendRawEmail ( req ) ; lastMessageId = resp . getMessageId ( ) ; sent = m . getAllRecipients ( ) ; unsent = new Address [ 0 ] ; invalid = new Address [ 0 ] ; super . notifyTransportListeners ( TransportEvent . MESSAGE_DELIVERED , sent , unsent , invalid , m ) ; } catch ( Exception e ) { sent = new Address [ 0 ] ; unsent = m . getAllRecipients ( ) ; invalid = new Address [ 0 ] ; super . notifyTransportListeners ( TransportEvent . MESSAGE_NOT_DELIVERED , sent , unsent , invalid , m ) ; throw new SendFailedException ( "Unable to send email" , e , sent , unsent , invalid ) ; } } | Sends an email using AWS E - mail Service and notifies listeners |
30,246 | public void setGroupCertificateAuthorities ( java . util . Collection < GroupCertificateAuthorityProperties > groupCertificateAuthorities ) { if ( groupCertificateAuthorities == null ) { this . groupCertificateAuthorities = null ; return ; } this . groupCertificateAuthorities = new java . util . ArrayList < GroupCertificateAuthorityProperties > ( groupCertificateAuthorities ) ; } | A list of certificate authorities associated with the group . |
30,247 | public void setEndpoints ( java . util . Collection < String > endpoints ) { if ( endpoints == null ) { this . endpoints = null ; return ; } this . endpoints = new java . util . ArrayList < String > ( endpoints ) ; } | The broker s wire - level protocol endpoints . |
30,248 | public void execute ( ) { try { final IntermediateModel intermediateModel = new IntermediateModelBuilder ( models , codeGenBinDirectory ) . build ( ) ; writeIntermediateModel ( intermediateModel ) ; emitCode ( intermediateModel ) ; } catch ( Exception e ) { throw new RuntimeException ( "Failed to generate code. Exception message : " + e . getMessage ( ) , e ) ; } } | load ServiceModel . load code gen configuration from individual client . load Waiters . generate intermediate model . generate code . |
30,249 | private void replaceHostLabelsWithStringSpecifier ( String hostExpression ) { if ( StringUtils . isNullOrEmpty ( hostExpression ) ) { throw new IllegalArgumentException ( "Given host prefix is either null or empty" ) ; } Matcher matcher = PATTERN . matcher ( hostExpression ) ; while ( matcher . find ( ) ) { String matched = matcher . group ( 1 ) ; c2jNames . add ( matched ) ; hostWithStringSpecifier = hostWithStringSpecifier . replaceFirst ( "\\{" + matched + "}" , "%s" ) ; } } | Replace all the labels in host with %s symbols and collect the input shape member names into a list |
30,250 | public static double durationMilliOf ( long startTimeNano , long endTimeNano ) { double micros = ( double ) TimeUnit . NANOSECONDS . toMicros ( endTimeNano - startTimeNano ) ; return micros / 1000.0 ; } | Returns the duration in milliseconds as double preserving the decimal precision as necessary for the given start and end time in nanoseconds . |
30,251 | private String generateSubstitutionTokenString ( String baseToken , Long suffixCounter , Set < String > expressionAttributeNamesKeys , Set < String > expressionAttributeValuesKeys ) { String hexSuffix = Long . toHexString ( suffixCounter ) ; String tokenBase = baseToken . substring ( 0 , Math . min ( baseToken . length ( ) , 4 ) ) + hexSuffix ; if ( ! expressionAttributeNamesKeys . contains ( getExpressionAttributeNameSubstitutionToken ( tokenBase ) ) && ! expressionAttributeValuesKeys . contains ( getExpressionAttributeValueSubstitutionToken ( tokenBase ) ) ) { return tokenBase ; } String fullToken = baseToken + hexSuffix ; if ( ! expressionAttributeNamesKeys . contains ( getExpressionAttributeNameSubstitutionToken ( fullToken ) ) && ! expressionAttributeValuesKeys . contains ( getExpressionAttributeValueSubstitutionToken ( fullToken ) ) ) { return fullToken ; } else { throw new DynamoDBMappingException ( "Failed to process update operation inside transactionWrite request due to conflict with expressionAttributeName or expressionAttributeValue token name: " + fullToken + ". Please replace this token name with a different token name." ) ; } } | Generate a string that can be used as a substitution token for attributeNames and attributeValues in update expression . De - dupes generated string on existingAttributesKeyList . The string starts with a baseToken s substring that is passed in from the caller and then appended with a hex string the hex string represents the locally incremented counter across attributes . In case there is a conflict with above generated string we ll instead substitute with the full baseToken instead of the baseToken substring |
30,252 | public String generateUpdateExpressionAndUpdateAttributeMaps ( Map < String , String > expressionAttributeNamesMap , Map < String , AttributeValue > expressionsAttributeValuesMap , Map < String , AttributeValue > nonKeyNonNullAttributeValueMap , List < String > nullValuedNonKeyAttributeNames ) { StringBuilder updateExpressionSetBuilder = new StringBuilder ( ) ; StringBuilder updateExpressionDeleteBuilder = new StringBuilder ( ) ; List < String > sortedNonKeyNonNullAttributeNames = new ArrayList < String > ( nonKeyNonNullAttributeValueMap . keySet ( ) ) ; Collections . sort ( sortedNonKeyNonNullAttributeNames ) ; List < String > sortedNullValuedNonKeyAttributeNames = new ArrayList < String > ( nullValuedNonKeyAttributeNames ) ; Collections . sort ( sortedNullValuedNonKeyAttributeNames ) ; String baseToken = getBaseToken ( sortedNonKeyNonNullAttributeNames , sortedNullValuedNonKeyAttributeNames ) ; Long suffixCounter = 0L ; if ( sortedNonKeyNonNullAttributeNames . size ( ) > 0 ) { updateExpressionSetBuilder . append ( "SET " ) ; List < String > updateStringSetExpressions = new ArrayList < String > ( ) ; for ( String nonKeyAttributeName : sortedNonKeyNonNullAttributeNames ) { String tokenBase = generateSubstitutionTokenString ( baseToken , suffixCounter , expressionAttributeNamesMap . keySet ( ) , expressionsAttributeValuesMap . keySet ( ) ) ; suffixCounter ++ ; String tokenKeyName = getExpressionAttributeNameSubstitutionToken ( tokenBase ) ; String tokenValueName = getExpressionAttributeValueSubstitutionToken ( tokenBase ) ; expressionAttributeNamesMap . put ( tokenKeyName , nonKeyAttributeName ) ; expressionsAttributeValuesMap . put ( tokenValueName , nonKeyNonNullAttributeValueMap . get ( nonKeyAttributeName ) ) ; updateStringSetExpressions . add ( tokenKeyName + " = " + tokenValueName ) ; } for ( int i = 0 ; i < updateStringSetExpressions . size ( ) - 1 ; i ++ ) { updateExpressionSetBuilder . append ( updateStringSetExpressions . get ( i ) + ", " ) ; } updateExpressionSetBuilder . append ( updateStringSetExpressions . get ( updateStringSetExpressions . size ( ) - 1 ) ) ; } if ( sortedNullValuedNonKeyAttributeNames . size ( ) > 0 ) { updateExpressionDeleteBuilder . append ( "REMOVE " ) ; List < String > updateStringDeleteExpressions = new ArrayList < String > ( ) ; for ( String nullAttributeName : sortedNullValuedNonKeyAttributeNames ) { String tokenBaseString = generateSubstitutionTokenString ( baseToken , suffixCounter , expressionAttributeNamesMap . keySet ( ) ) ; suffixCounter ++ ; String tokenKeyName = getExpressionAttributeNameSubstitutionToken ( tokenBaseString ) ; expressionAttributeNamesMap . put ( tokenKeyName , nullAttributeName ) ; updateStringDeleteExpressions . add ( tokenKeyName ) ; } for ( int i = 0 ; i < updateStringDeleteExpressions . size ( ) - 1 ; i ++ ) { updateExpressionDeleteBuilder . append ( updateStringDeleteExpressions . get ( i ) + ", " ) ; } updateExpressionDeleteBuilder . append ( updateStringDeleteExpressions . get ( updateStringDeleteExpressions . size ( ) - 1 ) ) ; } StringBuilder updateExpression = new StringBuilder ( ) ; if ( updateExpressionSetBuilder . length ( ) > 0 ) { updateExpression . append ( updateExpressionSetBuilder . toString ( ) ) ; } if ( updateExpressionDeleteBuilder . length ( ) > 0 ) { updateExpression . append ( " " + updateExpressionDeleteBuilder . toString ( ) ) ; } return updateExpression . toString ( ) ; } | Merge nonKeyAttributes along with any condition expression attributes and generate corresponding update expression |
30,253 | public void setAvailabilityZones ( java . util . Collection < AvailabilityZone > availabilityZones ) { if ( availabilityZones == null ) { this . availabilityZones = null ; return ; } this . availabilityZones = new java . util . ArrayList < AvailabilityZone > ( availabilityZones ) ; } | The list of available az . |
30,254 | public void setSupportedEngineVersions ( java . util . Collection < String > supportedEngineVersions ) { if ( supportedEngineVersions == null ) { this . supportedEngineVersions = null ; return ; } this . supportedEngineVersions = new java . util . ArrayList < String > ( supportedEngineVersions ) ; } | The list of supported engine versions . |
30,255 | private AmazonS3 cacheClient ( String region ) { if ( awscredentialsProvider == null ) { throw new IllegalArgumentException ( "No credentials provider found to connect to S3" ) ; } AmazonS3 client = new AmazonS3Client ( awscredentialsProvider ) ; client . setRegion ( RegionUtils . getRegion ( region ) ) ; clientsByRegion . put ( region , client ) ; return client ; } | Returns a new client with region configured to region . Also updates the clientsByRegion map by associating the new client with region . |
30,256 | private static void assertShapeAndMembersAreInModel ( IntermediateModel model , Map < String , List < String > > shapeAndMembers ) { shapeAndMembers . forEach ( ( shapeName , members ) -> { if ( Utils . findShapeModelByC2jNameIfExists ( model , shapeName ) == null ) { throw new IllegalStateException ( String . format ( "Cannot find shape [%s] in the model when processing " + "customization config emitLegacyEnumSetterFor. %s" , shapeName , shapeName ) ) ; } members . forEach ( memberName -> { if ( model . getShapeByC2jName ( shapeName ) . getMemberByC2jName ( memberName ) == null ) { throw new IllegalStateException ( String . format ( "Cannot find member [%s] in the model when processing " + "customization config emitLegacyEnumSetterFor. %s" , memberName , shapeName ) ) ; } } ) ; } ) ; } | Checks that all shapes and members in a given customization are actually in the model . Good to fail fast for things like typos instead of silently not applying that customization . |
30,257 | public java . util . concurrent . Future < CancelImportTaskResult > cancelImportTaskAsync ( com . amazonaws . handlers . AsyncHandler < CancelImportTaskRequest , CancelImportTaskResult > asyncHandler ) { return cancelImportTaskAsync ( new CancelImportTaskRequest ( ) , asyncHandler ) ; } | Simplified method form for invoking the CancelImportTask operation with an AsyncHandler . |
30,258 | public java . util . concurrent . Future < CreateInternetGatewayResult > createInternetGatewayAsync ( com . amazonaws . handlers . AsyncHandler < CreateInternetGatewayRequest , CreateInternetGatewayResult > asyncHandler ) { return createInternetGatewayAsync ( new CreateInternetGatewayRequest ( ) , asyncHandler ) ; } | Simplified method form for invoking the CreateInternetGateway operation with an AsyncHandler . |
30,259 | public java . util . concurrent . Future < DescribeAddressesResult > describeAddressesAsync ( com . amazonaws . handlers . AsyncHandler < DescribeAddressesRequest , DescribeAddressesResult > asyncHandler ) { return describeAddressesAsync ( new DescribeAddressesRequest ( ) , asyncHandler ) ; } | Simplified method form for invoking the DescribeAddresses operation with an AsyncHandler . |
30,260 | public java . util . concurrent . Future < DescribeBundleTasksResult > describeBundleTasksAsync ( com . amazonaws . handlers . AsyncHandler < DescribeBundleTasksRequest , DescribeBundleTasksResult > asyncHandler ) { return describeBundleTasksAsync ( new DescribeBundleTasksRequest ( ) , asyncHandler ) ; } | Simplified method form for invoking the DescribeBundleTasks operation with an AsyncHandler . |
30,261 | public java . util . concurrent . Future < DescribeConversionTasksResult > describeConversionTasksAsync ( com . amazonaws . handlers . AsyncHandler < DescribeConversionTasksRequest , DescribeConversionTasksResult > asyncHandler ) { return describeConversionTasksAsync ( new DescribeConversionTasksRequest ( ) , asyncHandler ) ; } | Simplified method form for invoking the DescribeConversionTasks operation with an AsyncHandler . |
30,262 | public java . util . concurrent . Future < DescribeCustomerGatewaysResult > describeCustomerGatewaysAsync ( com . amazonaws . handlers . AsyncHandler < DescribeCustomerGatewaysRequest , DescribeCustomerGatewaysResult > asyncHandler ) { return describeCustomerGatewaysAsync ( new DescribeCustomerGatewaysRequest ( ) , asyncHandler ) ; } | Simplified method form for invoking the DescribeCustomerGateways operation with an AsyncHandler . |
30,263 | public java . util . concurrent . Future < DescribeDhcpOptionsResult > describeDhcpOptionsAsync ( com . amazonaws . handlers . AsyncHandler < DescribeDhcpOptionsRequest , DescribeDhcpOptionsResult > asyncHandler ) { return describeDhcpOptionsAsync ( new DescribeDhcpOptionsRequest ( ) , asyncHandler ) ; } | Simplified method form for invoking the DescribeDhcpOptions operation with an AsyncHandler . |
30,264 | public java . util . concurrent . Future < DescribeFlowLogsResult > describeFlowLogsAsync ( com . amazonaws . handlers . AsyncHandler < DescribeFlowLogsRequest , DescribeFlowLogsResult > asyncHandler ) { return describeFlowLogsAsync ( new DescribeFlowLogsRequest ( ) , asyncHandler ) ; } | Simplified method form for invoking the DescribeFlowLogs operation with an AsyncHandler . |
30,265 | public java . util . concurrent . Future < DescribeIdFormatResult > describeIdFormatAsync ( com . amazonaws . handlers . AsyncHandler < DescribeIdFormatRequest , DescribeIdFormatResult > asyncHandler ) { return describeIdFormatAsync ( new DescribeIdFormatRequest ( ) , asyncHandler ) ; } | Simplified method form for invoking the DescribeIdFormat operation with an AsyncHandler . |
30,266 | public java . util . concurrent . Future < DescribeInstanceStatusResult > describeInstanceStatusAsync ( com . amazonaws . handlers . AsyncHandler < DescribeInstanceStatusRequest , DescribeInstanceStatusResult > asyncHandler ) { return describeInstanceStatusAsync ( new DescribeInstanceStatusRequest ( ) , asyncHandler ) ; } | Simplified method form for invoking the DescribeInstanceStatus operation with an AsyncHandler . |
30,267 | public java . util . concurrent . Future < DescribeInternetGatewaysResult > describeInternetGatewaysAsync ( com . amazonaws . handlers . AsyncHandler < DescribeInternetGatewaysRequest , DescribeInternetGatewaysResult > asyncHandler ) { return describeInternetGatewaysAsync ( new DescribeInternetGatewaysRequest ( ) , asyncHandler ) ; } | Simplified method form for invoking the DescribeInternetGateways operation with an AsyncHandler . |
30,268 | public java . util . concurrent . Future < DescribeKeyPairsResult > describeKeyPairsAsync ( com . amazonaws . handlers . AsyncHandler < DescribeKeyPairsRequest , DescribeKeyPairsResult > asyncHandler ) { return describeKeyPairsAsync ( new DescribeKeyPairsRequest ( ) , asyncHandler ) ; } | Simplified method form for invoking the DescribeKeyPairs operation with an AsyncHandler . |
30,269 | public java . util . concurrent . Future < DescribeNetworkInterfacesResult > describeNetworkInterfacesAsync ( com . amazonaws . handlers . AsyncHandler < DescribeNetworkInterfacesRequest , DescribeNetworkInterfacesResult > asyncHandler ) { return describeNetworkInterfacesAsync ( new DescribeNetworkInterfacesRequest ( ) , asyncHandler ) ; } | Simplified method form for invoking the DescribeNetworkInterfaces operation with an AsyncHandler . |
30,270 | public java . util . concurrent . Future < DescribeRegionsResult > describeRegionsAsync ( com . amazonaws . handlers . AsyncHandler < DescribeRegionsRequest , DescribeRegionsResult > asyncHandler ) { return describeRegionsAsync ( new DescribeRegionsRequest ( ) , asyncHandler ) ; } | Simplified method form for invoking the DescribeRegions operation with an AsyncHandler . |
30,271 | public java . util . concurrent . Future < DescribeReservedInstancesListingsResult > describeReservedInstancesListingsAsync ( com . amazonaws . handlers . AsyncHandler < DescribeReservedInstancesListingsRequest , DescribeReservedInstancesListingsResult > asyncHandler ) { return describeReservedInstancesListingsAsync ( new DescribeReservedInstancesListingsRequest ( ) , asyncHandler ) ; } | Simplified method form for invoking the DescribeReservedInstancesListings operation with an AsyncHandler . |
30,272 | public java . util . concurrent . Future < DescribeReservedInstancesOfferingsResult > describeReservedInstancesOfferingsAsync ( com . amazonaws . handlers . AsyncHandler < DescribeReservedInstancesOfferingsRequest , DescribeReservedInstancesOfferingsResult > asyncHandler ) { return describeReservedInstancesOfferingsAsync ( new DescribeReservedInstancesOfferingsRequest ( ) , asyncHandler ) ; } | Simplified method form for invoking the DescribeReservedInstancesOfferings operation with an AsyncHandler . |
30,273 | public java . util . concurrent . Future < DescribeSecurityGroupsResult > describeSecurityGroupsAsync ( com . amazonaws . handlers . AsyncHandler < DescribeSecurityGroupsRequest , DescribeSecurityGroupsResult > asyncHandler ) { return describeSecurityGroupsAsync ( new DescribeSecurityGroupsRequest ( ) , asyncHandler ) ; } | Simplified method form for invoking the DescribeSecurityGroups operation with an AsyncHandler . |
30,274 | public java . util . concurrent . Future < DescribeSubnetsResult > describeSubnetsAsync ( com . amazonaws . handlers . AsyncHandler < DescribeSubnetsRequest , DescribeSubnetsResult > asyncHandler ) { return describeSubnetsAsync ( new DescribeSubnetsRequest ( ) , asyncHandler ) ; } | Simplified method form for invoking the DescribeSubnets operation with an AsyncHandler . |
30,275 | public java . util . concurrent . Future < DescribeVpcEndpointsResult > describeVpcEndpointsAsync ( com . amazonaws . handlers . AsyncHandler < DescribeVpcEndpointsRequest , DescribeVpcEndpointsResult > asyncHandler ) { return describeVpcEndpointsAsync ( new DescribeVpcEndpointsRequest ( ) , asyncHandler ) ; } | Simplified method form for invoking the DescribeVpcEndpoints operation with an AsyncHandler . |
30,276 | public java . util . concurrent . Future < DescribeVpnConnectionsResult > describeVpnConnectionsAsync ( com . amazonaws . handlers . AsyncHandler < DescribeVpnConnectionsRequest , DescribeVpnConnectionsResult > asyncHandler ) { return describeVpnConnectionsAsync ( new DescribeVpnConnectionsRequest ( ) , asyncHandler ) ; } | Simplified method form for invoking the DescribeVpnConnections operation with an AsyncHandler . |
30,277 | public java . util . concurrent . Future < RevokeSecurityGroupIngressResult > revokeSecurityGroupIngressAsync ( ) { return revokeSecurityGroupIngressAsync ( new RevokeSecurityGroupIngressRequest ( ) ) ; } | Simplified method form for invoking the RevokeSecurityGroupIngress operation . |
30,278 | public java . util . concurrent . Future < RevokeSecurityGroupIngressResult > revokeSecurityGroupIngressAsync ( com . amazonaws . handlers . AsyncHandler < RevokeSecurityGroupIngressRequest , RevokeSecurityGroupIngressResult > asyncHandler ) { return revokeSecurityGroupIngressAsync ( new RevokeSecurityGroupIngressRequest ( ) , asyncHandler ) ; } | Simplified method form for invoking the RevokeSecurityGroupIngress operation with an AsyncHandler . |
30,279 | public void flush ( ) { PrintWriter out = null ; try { try { out = new PrintWriter ( Utils . createFile ( dir , file ) , "UTF-8" ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } String contents = getBuffer ( ) . toString ( ) ; out . write ( processor . apply ( contents ) ) ; } finally { closeQuietly ( out ) ; } } | This method is expected to be called only once during the code generation process after the template processing is done . |
30,280 | public void setDevices ( java . util . Collection < Device > devices ) { if ( devices == null ) { this . devices = null ; return ; } this . devices = new java . util . ArrayList < Device > ( devices ) ; } | A list of devices in the definition version . |
30,281 | public ValidationException getException ( ) { StringBuilder exceptionMessage = new StringBuilder ( ) ; for ( Problem problem : problems ) { exceptionMessage . append ( String . format ( "\n%s: %s" , problem . getContext ( ) . getPath ( ) , problem . getMessage ( ) ) ) ; } return new ValidationException ( exceptionMessage . toString ( ) ) ; } | Factory method to create an exception with all problems identified in the message . |
30,282 | public java . util . concurrent . Future < ListApplicationsResult > listApplicationsAsync ( com . amazonaws . handlers . AsyncHandler < ListApplicationsRequest , ListApplicationsResult > asyncHandler ) { return listApplicationsAsync ( new ListApplicationsRequest ( ) , asyncHandler ) ; } | Simplified method form for invoking the ListApplications operation with an AsyncHandler . |
30,283 | public java . util . concurrent . Future < ListDeploymentsResult > listDeploymentsAsync ( com . amazonaws . handlers . AsyncHandler < ListDeploymentsRequest , ListDeploymentsResult > asyncHandler ) { return listDeploymentsAsync ( new ListDeploymentsRequest ( ) , asyncHandler ) ; } | Simplified method form for invoking the ListDeployments operation with an AsyncHandler . |
30,284 | public java . util . concurrent . Future < ListOnPremisesInstancesResult > listOnPremisesInstancesAsync ( com . amazonaws . handlers . AsyncHandler < ListOnPremisesInstancesRequest , ListOnPremisesInstancesResult > asyncHandler ) { return listOnPremisesInstancesAsync ( new ListOnPremisesInstancesRequest ( ) , asyncHandler ) ; } | Simplified method form for invoking the ListOnPremisesInstances operation with an AsyncHandler . |
30,285 | public java . util . concurrent . Future < UpdateApplicationResult > updateApplicationAsync ( com . amazonaws . handlers . AsyncHandler < UpdateApplicationRequest , UpdateApplicationResult > asyncHandler ) { return updateApplicationAsync ( new UpdateApplicationRequest ( ) , asyncHandler ) ; } | Simplified method form for invoking the UpdateApplication operation with an AsyncHandler . |
30,286 | private static String trySlurpContent ( HttpResponse response ) { try { return IOUtils . toString ( response . getEntity ( ) . getContent ( ) ) ; } catch ( IOException e ) { return "" ; } } | Tries to read all the content from the HTTP response into a string . If an IO failure occurs while reading content empty string is returned instead . |
30,287 | public void setAttributes ( java . util . Collection < Value > attributes ) { if ( attributes == null ) { this . attributes = null ; return ; } this . attributes = new java . util . ArrayList < Value > ( attributes ) ; } | Struct or UDT |
30,288 | public static < T > T loadConfigurationModel ( Class < T > clzz , String configurationFileLocation ) { System . out . println ( "Loading config file " + configurationFileLocation ) ; InputStream fileContents = null ; try { fileContents = getRequiredResourceAsStream ( configurationFileLocation ) ; return Jackson . load ( clzz , fileContents ) ; } catch ( IOException e ) { System . err . println ( "Failed to read the configuration file " + configurationFileLocation ) ; throw new RuntimeException ( e ) ; } finally { if ( fileContents != null ) { Utils . closeQuietly ( fileContents ) ; } } } | Deserialize the contents of a given configuration file . |
30,289 | public void setOutputs ( java . util . Collection < AddOutputRequest > outputs ) { if ( outputs == null ) { this . outputs = null ; return ; } this . outputs = new java . util . ArrayList < AddOutputRequest > ( outputs ) ; } | A list of outputs that you want to add . |
30,290 | public void setProgressListener ( com . amazonaws . services . s3 . model . ProgressListener progressListener ) { setGeneralProgressListener ( new LegacyS3ProgressListener ( progressListener ) ) ; } | Sets the optional progress listener for receiving updates about object upload status . |
30,291 | public com . amazonaws . services . s3 . model . ProgressListener getProgressListener ( ) { ProgressListener generalProgressListener = getGeneralProgressListener ( ) ; if ( generalProgressListener instanceof LegacyS3ProgressListener ) { return ( ( LegacyS3ProgressListener ) generalProgressListener ) . unwrap ( ) ; } else { return null ; } } | Returns the optional progress listener for receiving updates about object upload status . |
30,292 | public ChannelsResponse withChannels ( java . util . Map < String , ChannelResponse > channels ) { setChannels ( channels ) ; return this ; } | A map of channels with the ChannelType as the key and the Channel as the value . |
30,293 | public Waiter < GetCertificateRequest > certificateIssued ( ) { return new WaiterBuilder < GetCertificateRequest , GetCertificateResult > ( ) . withSdkFunction ( new GetCertificateFunction ( client ) ) . withAcceptors ( new HttpSuccessStatusAcceptor ( WaiterState . SUCCESS ) , new CertificateIssued . IsRequestInProgressExceptionMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 60 ) , new FixedDelayStrategy ( 3 ) ) ) . withExecutorService ( executorService ) . build ( ) ; } | Builds a CertificateIssued 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,294 | public Waiter < DescribeCertificateAuthorityAuditReportRequest > auditReportCreated ( ) { return new WaiterBuilder < DescribeCertificateAuthorityAuditReportRequest , DescribeCertificateAuthorityAuditReportResult > ( ) . withSdkFunction ( new DescribeCertificateAuthorityAuditReportFunction ( client ) ) . withAcceptors ( new AuditReportCreated . IsSUCCESSMatcher ( ) , new AuditReportCreated . IsFAILEDMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 60 ) , new FixedDelayStrategy ( 3 ) ) ) . withExecutorService ( executorService ) . build ( ) ; } | Builds a AuditReportCreated 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,295 | public Waiter < GetCertificateAuthorityCsrRequest > certificateAuthorityCSRCreated ( ) { return new WaiterBuilder < GetCertificateAuthorityCsrRequest , GetCertificateAuthorityCsrResult > ( ) . withSdkFunction ( new GetCertificateAuthorityCsrFunction ( client ) ) . withAcceptors ( new HttpSuccessStatusAcceptor ( WaiterState . SUCCESS ) , new CertificateAuthorityCSRCreated . IsRequestInProgressExceptionMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 60 ) , new FixedDelayStrategy ( 3 ) ) ) . withExecutorService ( executorService ) . build ( ) ; } | Builds a CertificateAuthorityCSRCreated 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,296 | public boolean verifyMessageSignature ( String message , PublicKey publicKey ) { Map < String , String > parsed = parseJSON ( message ) ; return verifySignature ( parsed , publicKey ) ; } | Validates the signature on a Simple Notification Service message . No Amazon - specific dependencies just plain Java crypto and Jackson for parsing |
30,297 | public boolean verifySignature ( Map < String , String > parsedMessage , PublicKey publicKey ) { boolean valid = false ; String version = parsedMessage . get ( SIGNATURE_VERSION ) ; if ( version . equals ( "1" ) ) { String type = parsedMessage . get ( TYPE ) ; String signature = parsedMessage . get ( SIGNATURE ) ; String signed ; if ( type . equals ( NOTIFICATION_TYPE ) ) { signed = stringToSign ( publishMessageValues ( parsedMessage ) ) ; } else if ( type . equals ( SUBSCRIBE_TYPE ) ) { signed = stringToSign ( subscribeMessageValues ( parsedMessage ) ) ; } else if ( type . equals ( UNSUBSCRIBE_TYPE ) ) { signed = stringToSign ( subscribeMessageValues ( parsedMessage ) ) ; } else { throw new RuntimeException ( "Cannot process message of type " + type ) ; } valid = verifySignature ( signed , signature , publicKey ) ; } return valid ; } | Validates the signature on a Simple Notification Service message . No Amazon - specific dependencies just plain Java crypto |
30,298 | public boolean verifySignature ( String message , String signature , PublicKey publicKey ) { boolean result = false ; try { byte [ ] sigbytes = Base64 . decode ( signature . getBytes ( ) ) ; Signature sigChecker = SIG_CHECKER . get ( ) ; sigChecker . initVerify ( publicKey ) ; sigChecker . update ( message . getBytes ( ) ) ; result = sigChecker . verify ( sigbytes ) ; } catch ( InvalidKeyException e ) { } catch ( SignatureException e ) { } return result ; } | Does the actual Java cryptographic verification of the signature . This method does no handling of the many rare exceptions it is required to catch . |
30,299 | public Waiter < GetIdentityVerificationAttributesRequest > identityExists ( ) { return new WaiterBuilder < GetIdentityVerificationAttributesRequest , GetIdentityVerificationAttributesResult > ( ) . withSdkFunction ( new GetIdentityVerificationAttributesFunction ( client ) ) . withAcceptors ( new IdentityExists . IsSuccessMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 20 ) , new FixedDelayStrategy ( 3 ) ) ) . withExecutorService ( executorService ) . build ( ) ; } | Builds a IdentityExists 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 . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.