idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
118,400
public void parse ( final byte [ ] pData , final Collection < TagAndLength > pTags ) { Collection < AnnotationData > set = getAnnotationSet ( pTags ) ; BitUtils bit = new BitUtils ( pData ) ; Iterator < AnnotationData > it = set . iterator ( ) ; while ( it . hasNext ( ) ) { AnnotationData data = it . next ( ) ; if ( da...
Method to parse byte data
118,401
protected void setField ( final Field field , final IFile pData , final Object pValue ) { if ( field != null ) { try { field . set ( pData , pValue ) ; } catch ( IllegalArgumentException e ) { LOGGER . error ( "Parameters of fied.set are not valid" , e ) ; } catch ( IllegalAccessException e ) { LOGGER . error ( "Imposs...
Method used to set the value of a field
118,402
public static final Collection < String > getDescription ( final String pAtr ) { Collection < String > ret = null ; if ( StringUtils . isNotBlank ( pAtr ) ) { String val = StringUtils . deleteWhitespace ( pAtr ) . toUpperCase ( ) ; for ( String key : MAP . keySet ( ) ) { if ( val . matches ( "^" + key + "$" ) ) { ret =...
Method used to find description from ATR
118,403
public static EmvTrack2 extractTrack2EquivalentData ( final byte [ ] pRawTrack2 ) { EmvTrack2 ret = null ; if ( pRawTrack2 != null ) { EmvTrack2 track2 = new EmvTrack2 ( ) ; track2 . setRaw ( pRawTrack2 ) ; String data = BytesUtils . bytesToStringNoSpace ( pRawTrack2 ) ; Matcher m = TRACK2_EQUIVALENT_PATTERN . matcher ...
Extract track 2 Equivalent data
118,404
public static EmvTrack1 extractTrack1Data ( final byte [ ] pRawTrack1 ) { EmvTrack1 ret = null ; if ( pRawTrack1 != null ) { EmvTrack1 track1 = new EmvTrack1 ( ) ; track1 . setRaw ( pRawTrack1 ) ; Matcher m = TRACK1_PATTERN . matcher ( new String ( pRawTrack1 ) ) ; if ( m . find ( ) ) { track1 . setFormatCode ( m . gro...
Extract track 1 data
118,405
public void initFromAnnotation ( final Data pData ) { dateStandard = pData . dateStandard ( ) ; format = pData . format ( ) ; index = pData . index ( ) ; readHexa = pData . readHexa ( ) ; size = pData . size ( ) ; if ( pData . tag ( ) != null ) { tag = EmvTags . find ( BytesUtils . fromString ( pData . tag ( ) ) ) ; } ...
Initialization from annotation
118,406
public static CPLC parse ( byte [ ] raw ) { CPLC ret = null ; if ( raw != null ) { byte [ ] cplc = null ; if ( raw . length == CPLC . SIZE + 2 ) { cplc = raw ; } else if ( raw . length == CPLC . SIZE + 5 ) { cplc = TlvUtil . getValue ( raw , CPLC_TAG ) ; } else { LOGGER . error ( "CPLC data not valid" ) ; return null ;...
Method used to parse and extract CPLC data
118,407
public static boolean contains ( final byte [ ] pByte , final SwEnum ... pEnum ) { SwEnum val = SwEnum . getSW ( pByte ) ; if ( LOGGER . isDebugEnabled ( ) && pByte != null ) { LOGGER . debug ( "Response Status <" + BytesUtils . bytesToStringNoSpace ( Arrays . copyOfRange ( pByte , Math . max ( pByte . length - 2 , 0 )...
Method used to check equality with the last command return SW1SW2 == pEnum
118,408
protected boolean extractPublicData ( final Application pApplication ) throws CommunicationException { boolean ret = false ; byte [ ] data = selectAID ( pApplication . getAid ( ) ) ; if ( ResponseUtils . contains ( data , SwEnum . SW_9000 , SwEnum . SW_6285 ) ) { pApplication . setReadingStep ( ApplicationStepEnum . SE...
Read public card data from parameter AID
118,409
protected EmvCardScheme findCardScheme ( final String pAid , final String pCardNumber ) { EmvCardScheme type = EmvCardScheme . getCardTypeByAid ( pAid ) ; if ( type == EmvCardScheme . CB ) { type = EmvCardScheme . getCardTypeByCardNumber ( pCardNumber ) ; if ( type != null ) { LOGGER . debug ( "Real type:" + type . get...
Method used to find the real card scheme
118,410
protected boolean parse ( final byte [ ] pSelectResponse , final Application pApplication ) throws CommunicationException { boolean ret = false ; byte [ ] logEntry = getLogEntry ( pSelectResponse ) ; byte [ ] pdol = TlvUtil . getValue ( pSelectResponse , EmvTags . PDOL ) ; byte [ ] gpo = getGetProcessingOptions ( pdol ...
Method used to parse EMV card
118,411
protected boolean extractCommonsCardData ( final byte [ ] pGpo ) throws CommunicationException { boolean ret = false ; byte data [ ] = TlvUtil . getValue ( pGpo , EmvTags . RESPONSE_MESSAGE_TEMPLATE_1 ) ; if ( data != null ) { data = ArrayUtils . subarray ( data , 2 , data . length ) ; } else { ret = extractTrackData (...
Method used to extract commons card data
118,412
protected List < Afl > extractAfl ( final byte [ ] pAfl ) { List < Afl > list = new ArrayList < Afl > ( ) ; ByteArrayInputStream bai = new ByteArrayInputStream ( pAfl ) ; while ( bai . available ( ) >= 4 ) { Afl afl = new Afl ( ) ; afl . setSfi ( bai . read ( ) >> 3 ) ; afl . setFirstRecord ( bai . read ( ) ) ; afl . s...
Extract list of application file locator from Afl response
118,413
protected byte [ ] getGetProcessingOptions ( final byte [ ] pPdol ) throws CommunicationException { List < TagAndLength > list = TlvUtil . parseTagAndLength ( pPdol ) ; ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ; try { out . write ( EmvTags . COMMAND_TEMPLATE . getTagBytes ( ) ) ; out . write ( TlvUtil ...
Method used to create GPO command and execute it
118,414
protected boolean extractTrackData ( final EmvCard pEmvCard , final byte [ ] pData ) { template . get ( ) . getCard ( ) . setTrack1 ( TrackUtils . extractTrack1Data ( TlvUtil . getValue ( pData , EmvTags . TRACK1_DATA ) ) ) ; template . get ( ) . getCard ( ) . setTrack2 ( TrackUtils . extractTrack2EquivalentData ( TlvU...
Method used to extract track data from response
118,415
private void extractAnnotation ( ) { for ( Class < ? extends IFile > clazz : LISTE_CLASS ) { Map < ITag , AnnotationData > maps = new HashMap < ITag , AnnotationData > ( ) ; Set < AnnotationData > set = new TreeSet < AnnotationData > ( ) ; Field [ ] fields = clazz . getDeclaredFields ( ) ; for ( Field field : fields ) ...
Method to extract all annotation information and store them in the map
118,416
public String getHolderLastname ( ) { String ret = holderLastname ; if ( ret == null && track1 != null ) { ret = track1 . getHolderLastname ( ) ; } return ret ; }
Method used to get the field holderLastname
118,417
public String getHolderFirstname ( ) { String ret = holderFirstname ; if ( ret == null && track1 != null ) { ret = track1 . getHolderFirstname ( ) ; } return ret ; }
Method used to get the field holderFirstname
118,418
public String getCardNumber ( ) { String ret = null ; if ( track2 != null ) { ret = track2 . getCardNumber ( ) ; } if ( ret == null && track1 != null ) { ret = track1 . getCardNumber ( ) ; } return ret ; }
Method used to get the field cardNumber
118,419
public Date getExpireDate ( ) { Date ret = null ; if ( track2 != null ) { ret = track2 . getExpireDate ( ) ; } if ( ret == null && track1 != null ) { ret = track1 . getExpireDate ( ) ; } return ret ; }
Method used to get the field expireDate
118,420
private static String getTagValueAsString ( final ITag tag , final byte [ ] value ) { StringBuilder buf = new StringBuilder ( ) ; switch ( tag . getTagValueType ( ) ) { case TEXT : buf . append ( "=" ) ; buf . append ( new String ( value ) ) ; break ; case NUMERIC : buf . append ( "NUMERIC" ) ; break ; case BINARY : bu...
Method used get Tag value as String
118,421
public static List < TagAndLength > parseTagAndLength ( final byte [ ] data ) { List < TagAndLength > tagAndLengthList = new ArrayList < TagAndLength > ( ) ; if ( data != null ) { TLVInputStream stream = new TLVInputStream ( new ByteArrayInputStream ( data ) ) ; try { while ( stream . available ( ) > 0 ) { if ( stream ...
Method used to parser Tag and length
118,422
public static List < TLV > getlistTLV ( final byte [ ] pData , final ITag ... pTag ) { List < TLV > list = new ArrayList < TLV > ( ) ; TLVInputStream stream = new TLVInputStream ( new ByteArrayInputStream ( pData ) ) ; try { while ( stream . available ( ) > 0 ) { TLV tlv = TlvUtil . getNextTLV ( stream ) ; if ( tlv == ...
Method used to get the list of TLV corresponding to tags specified in parameters
118,423
public static byte [ ] getValue ( final byte [ ] pData , final ITag ... pTag ) { byte [ ] ret = null ; if ( pData != null ) { TLVInputStream stream = new TLVInputStream ( new ByteArrayInputStream ( pData ) ) ; try { while ( stream . available ( ) > 0 ) { TLV tlv = TlvUtil . getNextTLV ( stream ) ; if ( tlv == null ) { ...
Method used to get Tag value
118,424
public static int getLength ( final List < TagAndLength > pList ) { int ret = 0 ; if ( pList != null ) { for ( TagAndLength tl : pList ) { ret += tl . getLength ( ) ; } } return ret ; }
Method used to get length of all Tags
118,425
private void addDefaultParsers ( ) { parsers = new ArrayList < IParser > ( ) ; parsers . add ( new GeldKarteParser ( this ) ) ; parsers . add ( new EmvParser ( this ) ) ; }
Add default parser implementation
118,426
public EmvTemplate addParsers ( final IParser ... pParsers ) { if ( pParsers != null ) { for ( IParser parser : pParsers ) { parsers . add ( 0 , parser ) ; } } return this ; }
Method used to add a list of parser to the current EMV template
118,427
public EmvCard readEmvCard ( ) throws CommunicationException { if ( config . readCplc ) { readCPLCInfos ( ) ; } if ( config . readAt ) { card . setAt ( BytesUtils . bytesToStringNoSpace ( provider . getAt ( ) ) ) ; card . setAtrDescription ( config . contactLess ? AtrUtils . getDescriptionFromAts ( card . getAt ( ) ) :...
Method used to read public data from EMV card
118,428
protected boolean readWithPSE ( ) throws CommunicationException { boolean ret = false ; if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Try to read card with Payment System Environment" ) ; } byte [ ] data = selectPaymentEnvironment ( ) ; if ( ResponseUtils . isSucceed ( data ) ) { card . getApplications ( ) . a...
Read EMV card with Payment System Environment or Proximity Payment System Environment
118,429
protected List < Application > parseFCIProprietaryTemplate ( final byte [ ] pData ) throws CommunicationException { List < Application > ret = new ArrayList < Application > ( ) ; byte [ ] data = TlvUtil . getValue ( pData , EmvTags . SFI ) ; if ( data != null ) { int sfi = BytesUtils . byteArrayToInt ( data ) ; if ( LO...
Method used to parse FCI Proprietary Template
118,430
protected void readWithAID ( ) throws CommunicationException { if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Try to read card with AID" ) ; } Application app = new Application ( ) ; for ( EmvCardScheme type : EmvCardScheme . values ( ) ) { for ( byte [ ] aid : type . getAidByte ( ) ) { app . setAid ( aid ) ; a...
Read EMV card with AID
118,431
protected byte [ ] selectPaymentEnvironment ( ) throws CommunicationException { if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Select " + ( config . contactLess ? "PPSE" : "PSE" ) + " Application" ) ; } return provider . transceive ( new CommandApdu ( CommandEnum . SELECT , config . contactLess ? PPSE : PSE , 0...
Method used to select payment environment PSE or PPSE
118,432
protected byte [ ] selectAID ( final byte [ ] pAid ) throws CommunicationException { if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Select AID: " + BytesUtils . bytesToString ( pAid ) ) ; } return template . get ( ) . getProvider ( ) . transceive ( new CommandApdu ( CommandEnum . SELECT , pAid , 0 ) . toBytes (...
Select application with AID or RID
118,433
protected String extractApplicationLabel ( final byte [ ] pData ) { if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Extract Application label" ) ; } String label = null ; byte [ ] labelByte = TlvUtil . getValue ( pData , EmvTags . APPLICATION_PREFERRED_NAME ) ; if ( labelByte == null ) { labelByte = TlvUtil . ge...
Method used to extract application label
118,434
protected void extractCardHolderName ( final byte [ ] pData ) { byte [ ] cardHolderByte = TlvUtil . getValue ( pData , EmvTags . CARDHOLDER_NAME ) ; if ( cardHolderByte != null ) { String [ ] name = StringUtils . split ( new String ( cardHolderByte ) . trim ( ) , TrackUtils . CARD_HOLDER_NAME_SEPARATOR ) ; if ( name !=...
Extract card holder lastname and firstname
118,435
protected int getTransactionCounter ( ) throws CommunicationException { int ret = UNKNOW ; if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Get Transaction Counter ATC" ) ; } byte [ ] data = template . get ( ) . getProvider ( ) . transceive ( new CommandApdu ( CommandEnum . GET_DATA , 0x9F , 0x36 , 0 ) . toBytes ...
Method used to get Transaction counter
118,436
protected List < TagAndLength > getLogFormat ( ) throws CommunicationException { List < TagAndLength > ret = new ArrayList < TagAndLength > ( ) ; if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "GET log format" ) ; } byte [ ] data = template . get ( ) . getProvider ( ) . transceive ( new CommandApdu ( CommandEnum...
Method used to get log format
118,437
protected List < EmvTransactionRecord > extractLogEntry ( final byte [ ] pLogEntry ) throws CommunicationException { List < EmvTransactionRecord > listRecord = new ArrayList < EmvTransactionRecord > ( ) ; if ( template . get ( ) . getConfig ( ) . readTransactions && pLogEntry != null ) { List < TagAndLength > tals = ge...
Method used to extract log entry from card
118,438
private static Date getDate ( final AnnotationData pAnnotation , final BitUtils pBit ) { Date date = null ; if ( pAnnotation . getDateStandard ( ) == BCD_DATE ) { date = pBit . getNextDate ( pAnnotation . getSize ( ) , pAnnotation . getFormat ( ) , true ) ; } else if ( pAnnotation . getDateStandard ( ) == CPCL_DATE ) {...
Method to get a date from the bytes array
118,439
public static Object getObject ( final AnnotationData pAnnotation , final BitUtils pBit ) { Object obj = null ; Class < ? > clazz = pAnnotation . getField ( ) . getType ( ) ; if ( clazz . equals ( Integer . class ) ) { obj = getInteger ( pAnnotation , pBit ) ; } else if ( clazz . equals ( Float . class ) ) { obj = getF...
Method to read and object from the bytes tab
118,440
private static Float getFloat ( final AnnotationData pAnnotation , final BitUtils pBit ) { Float ret = null ; if ( BCD_FORMAT . equals ( pAnnotation . getFormat ( ) ) ) { ret = Float . parseFloat ( pBit . getNextHexaString ( pAnnotation . getSize ( ) ) ) ; } else { ret = ( float ) getInteger ( pAnnotation , pBit ) ; } ...
Method use to get float
118,441
@ SuppressWarnings ( "unchecked" ) private static IKeyEnum getEnum ( final AnnotationData pAnnotation , final BitUtils pBit ) { int val = 0 ; try { val = Integer . parseInt ( pBit . getNextHexaString ( pAnnotation . getSize ( ) ) , pAnnotation . isReadHexa ( ) ? 16 : 10 ) ; } catch ( NumberFormatException nfe ) { } ret...
This method is used to get an enum with his key
118,442
@ SuppressWarnings ( "unchecked" ) public static < T extends IKeyEnum > T getValue ( final int pKey , final Class < T > pClass ) { for ( IKeyEnum val : pClass . getEnumConstants ( ) ) { if ( val . getKey ( ) == pKey ) { return ( T ) val ; } } LOGGER . error ( "Unknow value:" + pKey + " for Enum:" + pClass . getName ( )...
Get the value of and enum from his key
118,443
public static int [ ] getHashBuckets ( String key , int hashCount , int max , boolean applyWidth ) { byte [ ] b ; b = key . getBytes ( StandardCharsets . UTF_8 ) ; return getHashBuckets ( b , hashCount , max , applyWidth ) ; }
than performing further iterations of murmur .
118,444
private void status ( final String [ ] args ) throws FileNotFoundException { setWorkingDir ( args ) ; final Path statusFile = this . workingDir . resolve ( this . statusName ) ; readStatus ( true , statusFile ) ; if ( args . length > 2 && args [ 2 ] . equalsIgnoreCase ( "verbose" ) ) { System . out . println ( this . s...
Prints the status of the node running in the configured working directory .
118,445
public static int computeBestK ( int bucketsPerElement ) { assert bucketsPerElement >= 0 ; if ( bucketsPerElement >= optKPerBuckets . length ) { return optKPerBuckets [ optKPerBuckets . length - 1 ] ; } return optKPerBuckets [ bucketsPerElement ] ; }
Given the number of buckets that can be used per element return the optimal number of hash functions in order to minimize the false positive rate .
118,446
public Iterable < JsonObject > convertRecord ( JsonArray outputSchema , String strInputRecord , WorkUnitState workUnit ) throws DataConversionException { JsonParser jsonParser = new JsonParser ( ) ; JsonObject inputRecord = ( JsonObject ) jsonParser . parse ( strInputRecord ) ; if ( ! this . unpackComplexSchemas ) { re...
Takes in a record with format String and Uses the inputSchema to convert the record to a JsonObject
118,447
private JsonElement parseEnumType ( JsonSchema schema , JsonElement value ) throws DataConversionException { if ( schema . getSymbols ( ) . contains ( value ) ) { return value ; } throw new DataConversionException ( "Invalid symbol: " + value . getAsString ( ) + " allowed values: " + schema . getSymbols ( ) . toString ...
Parses Enum type values
118,448
private JsonElement parseJsonArrayType ( JsonSchema schema , JsonElement value ) throws DataConversionException { Type arrayType = schema . getTypeOfArrayItems ( ) ; JsonArray tempArray = new JsonArray ( ) ; if ( Type . isPrimitive ( arrayType ) ) { return value ; } JsonSchema nestedSchema = schema . getItemsWithinData...
Parses JsonArray type values
118,449
private JsonElement parseJsonObjectType ( JsonSchema schema , JsonElement value ) throws DataConversionException { JsonSchema valuesWithinDataType = schema . getValuesWithinDataType ( ) ; if ( schema . isType ( MAP ) ) { if ( Type . isPrimitive ( valuesWithinDataType . getType ( ) ) ) { return value ; } JsonObject map ...
Parses JsonObject type values
118,450
private JsonElement parsePrimitiveType ( JsonSchema schema , JsonElement value ) throws DataConversionException { if ( ( schema . isType ( NULL ) || schema . isNullable ( ) ) && value . isJsonNull ( ) ) { return JsonNull . INSTANCE ; } if ( ( schema . isType ( NULL ) && ! value . isJsonNull ( ) ) || ( ! schema . isType...
Parses primitive types
118,451
public static boolean isAncestor ( Path possibleAncestor , Path fullPath ) { return ! relativizePath ( fullPath , possibleAncestor ) . equals ( getPathWithoutSchemeAndAuthority ( fullPath ) ) ; }
Checks whether possibleAncestor is an ancestor of fullPath .
118,452
public static Path getPathWithoutSchemeAndAuthority ( Path path ) { return new Path ( null , null , path . toUri ( ) . getPath ( ) ) ; }
Removes the Scheme and Authority from a Path .
118,453
public static Path getRootPath ( Path path ) { if ( path . isRoot ( ) ) { return path ; } return getRootPath ( path . getParent ( ) ) ; }
Returns the root path for the specified path .
118,454
public static Path withoutLeadingSeparator ( Path path ) { return new Path ( StringUtils . removeStart ( path . toString ( ) , Path . SEPARATOR ) ) ; }
Removes the leading slash if present .
118,455
public static Path deepestNonGlobPath ( Path input ) { Path commonRoot = input ; while ( commonRoot != null && isGlob ( commonRoot ) ) { commonRoot = commonRoot . getParent ( ) ; } return commonRoot ; }
Finds the deepest ancestor of input that is not a glob .
118,456
public static void deleteEmptyParentDirectories ( FileSystem fs , Path limitPath , Path startPath ) throws IOException { if ( PathUtils . isAncestor ( limitPath , startPath ) && ! PathUtils . getPathWithoutSchemeAndAuthority ( limitPath ) . equals ( PathUtils . getPathWithoutSchemeAndAuthority ( startPath ) ) && fs . l...
Deletes empty directories starting with startPath and all ancestors up to but not including limitPath .
118,457
public static Optional < Path > getPersistDir ( State state ) throws IOException { if ( state . contains ( PERSIST_DIR_KEY ) ) { return Optional . of ( new Path ( state . getProp ( PERSIST_DIR_KEY ) , UserGroupInformation . getCurrentUser ( ) . getShortUserName ( ) ) ) ; } return Optional . absent ( ) ; }
Get the persist directory for this job .
118,458
public boolean persistFile ( State state , CopyableFile file , Path path ) throws IOException { if ( ! this . persistDir . isPresent ( ) ) { return false ; } String guid = computeGuid ( state , file ) ; Path guidPath = new Path ( this . persistDir . get ( ) , guid ) ; if ( ! this . fs . exists ( guidPath ) ) { this . f...
Moves a copied path into a persistent location managed by gobblin - distcp . This method is used when an already copied file cannot be successfully published . In future runs instead of re - copying the file distcp will use the persisted file .
118,459
static String shortenPathName ( Path path , int bytes ) { String pathString = path . toUri ( ) . getPath ( ) ; String replaced = pathString . replace ( "/" , "_" ) ; if ( replaced . length ( ) <= bytes ) { return replaced ; } int bytesPerHalf = ( bytes - 3 ) / 2 ; return replaced . substring ( 0 , bytesPerHalf ) + "......
Shorten an absolute path into a sanitized String of length at most bytes . This is useful for including a summary of an absolute path in a file name .
118,460
public FileSystem getProxiedFileSystem ( State properties , AuthType authType , String authPath , String uri , final Configuration conf ) throws IOException , InterruptedException , URISyntaxException { Preconditions . checkArgument ( StringUtils . isNotBlank ( properties . getProp ( ConfigurationKeys . FS_PROXY_AS_USE...
Getter for proxiedFs using the passed parameters to create an instance of a proxiedFs .
118,461
private static Optional < Token < ? > > getTokenFromSeqFile ( String authPath , String proxyUserName ) throws IOException { try ( Closer closer = Closer . create ( ) ) { FileSystem localFs = FileSystem . getLocal ( new Configuration ( ) ) ; SequenceFile . Reader tokenReader = closer . register ( new SequenceFile . Read...
Get token from the token sequence file .
118,462
public static Duration getLeadTimeDurationFromConfig ( State state ) { String leadTimeProp = state . getProp ( DATE_PARTITIONED_SOURCE_PARTITION_LEAD_TIME ) ; if ( leadTimeProp == null || leadTimeProp . length ( ) == 0 ) { return DEFAULT_PARTITIONED_SOURCE_PARTITION_LEAD_TIME ; } int leadTime = Integer . parseInt ( lea...
Retrieve the lead time duration from the LEAD_TIME and LEAD_TIME granularity config settings .
118,463
public void purge ( ) throws IOException { this . datasetOwner = getOwner ( ) ; State state = new State ( this . state ) ; this . datasetOwnerFs = ProxyUtils . getOwnerFs ( state , this . datasetOwner ) ; try ( HiveProxyQueryExecutor queryExecutor = ProxyUtils . getQueryExecutor ( state , this . datasetOwner ) ) { if (...
This method is responsible for actual purging . - It first creates a staging table partition with the same schema as of original table partition . - Staging table partition is then populated by original table left outer joined with compliance id table .
118,464
public void launch ( ) throws IOException , YarnException { this . eventBus . register ( this ) ; String clusterName = this . config . getString ( GobblinClusterConfigurationKeys . HELIX_CLUSTER_NAME_KEY ) ; HelixUtils . createGobblinHelixCluster ( this . config . getString ( GobblinClusterConfigurationKeys . ZK_CONNEC...
Launch a new Gobblin instance on Yarn .
118,465
public List < HivePartitionDataset > findDatasets ( ) throws IOException { Preconditions . checkArgument ( this . state . contains ( ComplianceConfigurationKeys . RESTORE_DATASET ) , "Missing required property " + ComplianceConfigurationKeys . RESTORE_DATASET ) ; HivePartitionDataset hivePartitionDataset = HivePartitio...
Will return a Singleton list of HivePartitionDataset to be restored .
118,466
public void pushMessages ( List < byte [ ] > messages ) { List < KeyedMessage < String , byte [ ] > > keyedMessages = Lists . transform ( messages , new Function < byte [ ] , KeyedMessage < String , byte [ ] > > ( ) { public KeyedMessage < String , byte [ ] > apply ( byte [ ] bytes ) { return new KeyedMessage < String ...
Push all mbyte array messages to the Kafka topic .
118,467
protected ProducerCloseable < String , byte [ ] > createProducer ( ProducerConfig config ) { return this . closer . register ( new ProducerCloseable < String , byte [ ] > ( config ) ) ; }
Actually creates the Kafka producer .
118,468
private void acquirePermits ( long permits ) throws InterruptedException { long startMs = System . currentTimeMillis ( ) ; limiter . acquirePermits ( permits ) ; long permitAcquisitionTime = System . currentTimeMillis ( ) - startMs ; if ( throttledTimer . isPresent ( ) ) { Instrumented . updateTimer ( throttledTimer , ...
Acquire permit along with emitting metrics if enabled .
118,469
public S getSchemaByKey ( K key ) throws SchemaRegistryException { try { return cachedSchemasByKeys . get ( key ) ; } catch ( ExecutionException e ) { throw new SchemaRegistryException ( String . format ( "Schema with key %s cannot be retrieved" , key ) , e ) ; } }
Get schema from schema registry by key .
118,470
public static void generateDumpScript ( Path dumpScript , FileSystem fs , String heapFileName , String chmod ) throws IOException { if ( fs . exists ( dumpScript ) ) { LOG . info ( "Heap dump script already exists: " + dumpScript ) ; return ; } try ( BufferedWriter scriptWriter = new BufferedWriter ( new OutputStreamWr...
Generate the dumpScript which is used when OOM error is thrown during task execution . The current content dumpScript puts the . prof files to the DUMP_FOLDER within the same directory of the dumpScript .
118,471
public static void submit ( Optional < EventSubmitter > submitter , String name ) { if ( submitter . isPresent ( ) ) { submitter . get ( ) . submit ( name ) ; } }
Calls submit on submitter if present .
118,472
public static String getJvmInputArguments ( ) { RuntimeMXBean runtimeMxBean = ManagementFactory . getRuntimeMXBean ( ) ; List < String > arguments = runtimeMxBean . getInputArguments ( ) ; return String . format ( "JVM Input Arguments: %s" , JOINER . join ( arguments ) ) ; }
Gets the input arguments passed to the JVM .
118,473
public static String formatJvmArguments ( Optional < String > jvmArguments ) { if ( jvmArguments . isPresent ( ) ) { return PORT_UTILS . replacePortTokens ( jvmArguments . get ( ) ) ; } return StringUtils . EMPTY ; }
Formats the specified jvm arguments such that any tokens are replaced with concrete values ;
118,474
public void initialize ( ) { String table = Preconditions . checkNotNull ( this . state . getProp ( ForkOperatorUtils . getPropertyNameForBranch ( JdbcPublisher . JDBC_PUBLISHER_FINAL_TABLE_NAME , this . branches , this . branchId ) ) ) ; String db = Preconditions . checkNotNull ( this . state . getProp ( ForkOperatorU...
AvroToJdbcEntryConverter list of date columns existing in the table . As we don t want each converter making a connection against database to get the same information . Here ConverterInitializer will retrieve it and store it into WorkUnit so that AvroToJdbcEntryConverter will use it later .
118,475
protected void startUp ( ) { log . info ( "Starting the " + getClass ( ) . getSimpleName ( ) ) ; log . info ( "Polling git with interval {} " , this . pollingInterval ) ; this . scheduledExecutor . scheduleAtFixedRate ( new Runnable ( ) { public void run ( ) { try { if ( shouldPollGit ( ) ) { processGitConfigChanges ( ...
Start the service .
118,476
void processGitConfigChangesHelper ( List < DiffEntry > changes ) throws IOException { for ( DiffEntry change : changes ) { switch ( change . getChangeType ( ) ) { case ADD : case MODIFY : addChange ( change ) ; break ; case DELETE : removeChange ( change ) ; break ; case RENAME : removeChange ( change ) ; addChange ( ...
A helper method where actual processing of the list of changes since the last refresh of the repository takes place and the changes applied .
118,477
public void addAll ( State otherState ) { Properties diffCommonProps = new Properties ( ) ; diffCommonProps . putAll ( Maps . difference ( this . commonProperties , otherState . commonProperties ) . entriesOnlyOnRight ( ) ) ; addAll ( diffCommonProps ) ; addAll ( otherState . specProperties ) ; }
Populates this instance with properties of the other instance .
118,478
public String getProp ( String key ) { if ( this . specProperties . containsKey ( key ) ) { return this . specProperties . getProperty ( key ) ; } return this . commonProperties . getProperty ( key ) ; }
Get the value of a property .
118,479
public List < String > getPropAsList ( String key , String def ) { return LIST_SPLITTER . splitToList ( getProp ( key , def ) ) ; }
Get the value of a property as a list of strings using the given default value if the property is not set .
118,480
public long getPropAsLong ( String key , long def ) { return Long . parseLong ( getProp ( key , String . valueOf ( def ) ) ) ; }
Get the value of a property as a long integer using the given default value if the property is not set .
118,481
public int getPropAsInt ( String key , int def ) { return Integer . parseInt ( getProp ( key , String . valueOf ( def ) ) ) ; }
Get the value of a property as an integer using the given default value if the property is not set .
118,482
public double getPropAsDouble ( String key , double def ) { return Double . parseDouble ( getProp ( key , String . valueOf ( def ) ) ) ; }
Get the value of a property as a double using the given default value if the property is not set .
118,483
public boolean getPropAsBoolean ( String key , boolean def ) { return Boolean . parseBoolean ( getProp ( key , String . valueOf ( def ) ) ) ; }
Get the value of a property as a boolean using the given default value if the property is not set .
118,484
public void removeProp ( String key ) { this . specProperties . remove ( key ) ; if ( this . commonProperties . containsKey ( key ) ) { Properties commonPropsCopy = new Properties ( ) ; commonPropsCopy . putAll ( this . commonProperties ) ; commonPropsCopy . remove ( key ) ; this . commonProperties = commonPropsCopy ; ...
Remove a property if it exists .
118,485
public void removePropsWithPrefix ( String prefix ) { this . specProperties . entrySet ( ) . removeIf ( entry -> ( ( String ) entry . getKey ( ) ) . startsWith ( prefix ) ) ; Properties newCommonProperties = null ; for ( Object key : this . commonProperties . keySet ( ) ) { if ( ( ( String ) key ) . startsWith ( prefix...
Remove all properties with a certain keyPrefix
118,486
private String getDbTableName ( String schemaName ) { Preconditions . checkArgument ( schemaName . matches ( ".+_.+_.+" ) ) ; return schemaName . replaceFirst ( "_" , "." ) . substring ( 0 , schemaName . lastIndexOf ( '_' ) ) ; }
Translate schema name to dbname . tablename to use in path
118,487
public static Collection < WorkUnitState > mergeAllSplitWorkUnits ( FileSystem fs , Collection < WorkUnitState > workUnits ) throws IOException { ListMultimap < CopyableFile , WorkUnitState > splitWorkUnitsMap = ArrayListMultimap . create ( ) ; for ( WorkUnitState workUnit : workUnits ) { if ( isSplitWorkUnit ( workUni...
Finds all split work units in the input collection and merges the file parts into the expected output files .
118,488
private boolean shouldStickToTheSameNode ( int containerExitStatus ) { switch ( containerExitStatus ) { case ContainerExitStatus . DISKS_FAILED : return false ; case ContainerExitStatus . ABORTED : return false ; default : return this . containerHostAffinityEnabled ; } }
Check the exit status of a completed container and see if the replacement container should try to be started on the same node . Some exit status indicates a disk or node failure and in such cases the replacement container should try to be started on a different node .
118,489
private void handleContainerCompletion ( ContainerStatus containerStatus ) { Map . Entry < Container , String > completedContainerEntry = this . containerMap . remove ( containerStatus . getContainerId ( ) ) ; String completedInstanceName = completedContainerEntry . getValue ( ) ; LOGGER . info ( String . format ( "Con...
Handle the completion of a container . A new container will be requested to replace the one that just exited . Depending on the exit status and if container host affinity is enabled the new container may or may not try to be started on the same node .
118,490
public static Builder builder ( URI catalogURI , Properties jobProps ) { String name = JobState . getJobNameFromProps ( jobProps ) ; String group = JobState . getJobGroupFromProps ( jobProps ) ; if ( null == group ) { group = "default" ; } try { URI jobURI = new URI ( catalogURI . getScheme ( ) , catalogURI . getAuthor...
Creates a builder for the JobSpec based on values in a job properties config .
118,491
public void sendNotification ( final Notification notification ) { ContextAwareTimer . Context timer = this . notificationTimer . time ( ) ; if ( ! this . notificationTargets . isEmpty ( ) ) { for ( final Map . Entry < UUID , Function < Notification , Void > > entry : this . notificationTargets . entrySet ( ) ) { try {...
Send a notification to all targets of this context and to the parent of this context .
118,492
public RecordWriter getRecordWriter ( TaskAttemptContext taskAttemptContext ) throws IOException { Configuration conf = taskAttemptContext . getConfiguration ( ) ; String extension = "." + conf . get ( COMPACTION_OUTPUT_EXTENSION , "orc" ) ; Path filename = getDefaultWorkFile ( taskAttemptContext , extension ) ; Writer...
Required for extension since super method hard - coded file extension as . orc . To keep flexibility of extension name we made it configuration driven .
118,493
public static FileBasedJobLockFactory create ( Config factoryConfig , Configuration hadoopConf , Optional < Logger > log ) throws IOException { FileSystem fs = factoryConfig . hasPath ( FS_URI_CONFIG ) ? FileSystem . get ( URI . create ( factoryConfig . getString ( FS_URI_CONFIG ) ) , hadoopConf ) : getDefaultFileSyste...
Create a new instance using the specified factory and hadoop configurations .
118,494
boolean isLocked ( Path lockFile ) throws JobLockException { try { return this . fs . exists ( lockFile ) ; } catch ( IOException e ) { throw new JobLockException ( e ) ; } }
Check if the lock is locked .
118,495
public long getRecordCount ( Collection < Path > paths ) { long count = 0 ; for ( Path path : paths ) { count += getRecordCount ( path ) ; } return count ; }
Get record count for a list of paths .
118,496
public void launch ( ) throws IOException , InterruptedException { this . eventBus . register ( this ) ; HelixUtils . createGobblinHelixCluster ( this . zkConnectionString , this . helixClusterName , false ) ; LOGGER . info ( "Created Helix cluster " + this . helixClusterName ) ; connectHelixManager ( ) ; this . cluste...
Launch a new Gobblin cluster on AWS .
118,497
protected HttpOperation generateHttpOperation ( GenericRecord inputRecord , State state ) { Map < String , String > keyAndValue = new HashMap < > ( ) ; Optional < Iterable < String > > keys = getKeys ( state ) ; HttpOperation operation ; if ( keys . isPresent ( ) ) { for ( String key : keys . get ( ) ) { String value =...
Extract user defined keys by looking at gobblin . converter . http . keys If keys are defined extract key - value pair from inputRecord and set it to HttpOperation If keys are not defined generate HttpOperation by HttpUtils . toHttpOperation
118,498
public static Path getJobStateFilePath ( boolean usingStateStore , Path appWorkPath , String jobId ) { final Path jobStateFilePath ; if ( usingStateStore ) { jobStateFilePath = new Path ( appWorkPath , GobblinClusterConfigurationKeys . JOB_STATE_DIR_NAME + Path . SEPARATOR + jobId + Path . SEPARATOR + jobId + "." + Abs...
Generate the path to the job . state file
118,499
private String loadExistingMetadata ( Path metadataFilename , int branchId ) { try { FileSystem fsForBranch = writerFileSystemByBranches . get ( branchId ) ; if ( ! fsForBranch . exists ( metadataFilename ) ) { return null ; } FSDataInputStream existingMetadata = writerFileSystemByBranches . get ( branchId ) . open ( m...
Read in existing metadata as a UTF8 string .