idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
40,900
private void connectBacklink ( final AbstractJobVertex vertex , final ChannelType channelType , final int indexOfOutputGate , final int indexOfInputGate , DistributionPattern distributionPattern ) { for ( int i = this . backwardEdges . size ( ) ; i <= indexOfInputGate ; i ++ ) { this . backwardEdges . add ( null ) ; } ...
Creates a backward link from a connected job vertex .
40,901
public void checkConfiguration ( final AbstractInvokable invokable ) throws IllegalConfigurationException { if ( invokable == null ) { throw new IllegalArgumentException ( "Argument invokable is null" ) ; } try { invokable . checkConfiguration ( ) ; } catch ( IllegalConfigurationException icex ) { throw icex ; } catch ...
Performs task specific checks if the respective task has been configured properly .
40,902
@ SuppressWarnings ( "unchecked" ) public O withConstantSetFirst ( String ... constantSetFirst ) { if ( this . udfSemantics == null ) { this . udfSemantics = new DualInputSemanticProperties ( ) ; } SemanticPropUtil . getSemanticPropsDualFromString ( this . udfSemantics , constantSetFirst , null , null , null , null , n...
Adds a constant - set annotation for the first input of the UDF .
40,903
@ SuppressWarnings ( "unchecked" ) public O withConstantSetSecond ( String ... constantSetSecond ) { if ( this . udfSemantics == null ) { this . udfSemantics = new DualInputSemanticProperties ( ) ; } SemanticPropUtil . getSemanticPropsDualFromString ( this . udfSemantics , null , constantSetSecond , null , null , null ...
Adds a constant - set annotation for the second input of the UDF .
40,904
public boolean hasDeadlock ( List < ? extends PlanNode > sinks ) { this . g = new DeadlockGraph ( ) ; for ( PlanNode s : sinks ) { s . accept ( this ) ; } if ( g . hasCycle ( ) ) { return true ; } else { return false ; } }
Creates new DeadlockGraph from plan and checks for cycles
40,905
public ExecutionVertex duplicateVertex ( final boolean preserveVertexID ) { ExecutionVertexID newVertexID ; if ( preserveVertexID ) { newVertexID = this . vertexID ; } else { newVertexID = new ExecutionVertexID ( ) ; } final ExecutionVertex duplicatedVertex = new ExecutionVertex ( newVertexID , this . executionGraph , ...
Returns a duplicate of this execution vertex .
40,906
void insertOutputGate ( final int pos , final ExecutionGate outputGate ) { if ( this . outputGates [ pos ] != null ) { throw new IllegalStateException ( "Output gate at position " + pos + " is not null" ) ; } this . outputGates [ pos ] = outputGate ; }
Inserts the output gate at the given position .
40,907
void insertInputGate ( final int pos , final ExecutionGate inputGate ) { if ( this . inputGates [ pos ] != null ) { throw new IllegalStateException ( "Input gate at position " + pos + " is not null" ) ; } this . inputGates [ pos ] = inputGate ; }
Inserts the input gate at the given position .
40,908
public void updateExecutionStateAsynchronously ( final ExecutionState newExecutionState , final String optionalMessage ) { final Runnable command = new Runnable ( ) { public void run ( ) { updateExecutionState ( newExecutionState , optionalMessage ) ; } } ; this . executionGraph . executeCommand ( command ) ; }
Updates the vertex s current execution state through the job s executor service .
40,909
public ExecutionState updateExecutionState ( ExecutionState newExecutionState , final String optionalMessage ) { if ( newExecutionState == null ) { throw new IllegalArgumentException ( "Argument newExecutionState must not be null" ) ; } final ExecutionState currentExecutionState = this . executionState . get ( ) ; if (...
Updates the vertex s current execution state .
40,910
private void checkCancelRequestedFlag ( ) { if ( this . cancelRequested . compareAndSet ( true , false ) ) { final TaskCancelResult tsr = cancelTask ( ) ; if ( tsr . getReturnCode ( ) != AbstractTaskResult . ReturnCode . SUCCESS && tsr . getReturnCode ( ) != AbstractTaskResult . ReturnCode . TASK_NOT_FOUND ) { LOG . er...
Checks if another thread requested the vertex to cancel while it was in state STARTING . If so the method clears the respective flag and repeats the cancel request .
40,911
public int getNumberOfPredecessors ( ) { int numberOfPredecessors = 0 ; for ( int i = 0 ; i < this . inputGates . length ; ++ i ) { numberOfPredecessors += this . inputGates [ i ] . getNumberOfEdges ( ) ; } return numberOfPredecessors ; }
Returns the number of predecessors i . e . the number of vertices which connect to this vertex .
40,912
public int getNumberOfSuccessors ( ) { int numberOfSuccessors = 0 ; for ( int i = 0 ; i < this . outputGates . length ; ++ i ) { numberOfSuccessors += this . outputGates [ i ] . getNumberOfEdges ( ) ; } return numberOfSuccessors ; }
Returns the number of successors i . e . the number of vertices this vertex is connected to .
40,913
public TaskSubmissionResult startTask ( ) { final AllocatedResource ar = this . allocatedResource . get ( ) ; if ( ar == null ) { final TaskSubmissionResult result = new TaskSubmissionResult ( getID ( ) , AbstractTaskResult . ReturnCode . NO_INSTANCE ) ; result . setDescription ( "Assigned instance of vertex " + this ....
Deploys and starts the task represented by this vertex on the assigned instance .
40,914
public TaskDeploymentDescriptor constructDeploymentDescriptor ( ) { final SerializableArrayList < GateDeploymentDescriptor > ogd = new SerializableArrayList < GateDeploymentDescriptor > ( this . outputGates . length ) ; for ( int i = 0 ; i < this . outputGates . length ; ++ i ) { final ExecutionGate eg = this . outputG...
Constructs a new task deployment descriptor for this vertex .
40,915
synchronized AllocatedSlice createSlice ( final InstanceType reqType , final JobID jobID ) { if ( remainingCapacity . getNumberOfComputeUnits ( ) >= reqType . getNumberOfComputeUnits ( ) && remainingCapacity . getNumberOfCores ( ) >= reqType . getNumberOfCores ( ) && remainingCapacity . getMemorySize ( ) >= reqType . g...
Tries to create a new slice on this instance .
40,916
synchronized AllocatedSlice removeAllocatedSlice ( final AllocationID allocationID ) { final AllocatedSlice slice = this . allocatedSlices . remove ( allocationID ) ; if ( slice != null ) { this . remainingCapacity = InstanceTypeFactory . construct ( this . remainingCapacity . getIdentifier ( ) , this . remainingCapaci...
Removes the slice identified by the given allocation ID from this instance and frees up the allocated resources .
40,917
synchronized List < AllocatedSlice > removeAllAllocatedSlices ( ) { final List < AllocatedSlice > slices = new ArrayList < AllocatedSlice > ( this . allocatedSlices . values ( ) ) ; final Iterator < AllocatedSlice > it = slices . iterator ( ) ; while ( it . hasNext ( ) ) { removeAllocatedSlice ( it . next ( ) . getAllo...
Removes all allocated slices on this instance and frees up their allocated resources .
40,918
protected int [ ] getConstantKeySet ( int input ) { Operator < ? > contract = getPactContract ( ) ; if ( contract instanceof AbstractUdfOperator < ? , ? > ) { AbstractUdfOperator < ? , ? > abstractPact = ( AbstractUdfOperator < ? , ? > ) contract ; int [ ] keyColumns = abstractPact . getKeyColumns ( input ) ; if ( keyC...
Returns the key columns for the specific input if all keys are preserved by this node . Null otherwise .
40,919
public void addVertex ( final AbstractJobInputVertex inputVertex ) { if ( ! inputVertices . containsKey ( inputVertex . getID ( ) ) ) { inputVertices . put ( inputVertex . getID ( ) , inputVertex ) ; } }
Adds a new input vertex to the job graph if it is not already included .
40,920
public void addVertex ( final AbstractJobOutputVertex outputVertex ) { if ( ! outputVertices . containsKey ( outputVertex . getID ( ) ) ) { outputVertices . put ( outputVertex . getID ( ) , outputVertex ) ; } }
Adds a new output vertex to the job graph if it is not already included .
40,921
public Iterator < AbstractJobInputVertex > getInputVertices ( ) { final Collection < AbstractJobInputVertex > coll = this . inputVertices . values ( ) ; return coll . iterator ( ) ; }
Returns an iterator to iterate all input vertices registered with the job graph .
40,922
public Iterator < AbstractJobOutputVertex > getOutputVertices ( ) { final Collection < AbstractJobOutputVertex > coll = this . outputVertices . values ( ) ; return coll . iterator ( ) ; }
Returns an iterator to iterate all output vertices registered with the job graph .
40,923
public Iterator < JobTaskVertex > getTaskVertices ( ) { final Collection < JobTaskVertex > coll = this . taskVertices . values ( ) ; return coll . iterator ( ) ; }
Returns an iterator to iterate all task vertices registered with the job graph .
40,924
public AbstractJobVertex [ ] getAllReachableJobVertices ( ) { final Vector < AbstractJobVertex > collector = new Vector < AbstractJobVertex > ( ) ; collectVertices ( null , collector ) ; return collector . toArray ( new AbstractJobVertex [ 0 ] ) ; }
Returns an array of all job vertices than can be reached when traversing the job graph from the input vertices .
40,925
public AbstractJobVertex [ ] getAllJobVertices ( ) { int i = 0 ; final AbstractJobVertex [ ] vertices = new AbstractJobVertex [ inputVertices . size ( ) + outputVertices . size ( ) + taskVertices . size ( ) ] ; final Iterator < AbstractJobInputVertex > iv = getInputVertices ( ) ; while ( iv . hasNext ( ) ) { vertices [...
Returns an array of all job vertices that are registered with the job graph . The order in which the vertices appear in the list is not defined .
40,926
private void collectVertices ( final AbstractJobVertex jv , final List < AbstractJobVertex > collector ) { if ( jv == null ) { final Iterator < AbstractJobInputVertex > iter = getInputVertices ( ) ; while ( iter . hasNext ( ) ) { collectVertices ( iter . next ( ) , collector ) ; } } else { if ( ! collector . contains (...
Auxiliary method to collect all vertices which are reachable from the input vertices .
40,927
public AbstractJobVertex findVertexByID ( final JobVertexID id ) { if ( this . inputVertices . containsKey ( id ) ) { return this . inputVertices . get ( id ) ; } if ( this . outputVertices . containsKey ( id ) ) { return this . outputVertices . get ( id ) ; } if ( this . taskVertices . containsKey ( id ) ) { return th...
Searches for a vertex with a matching ID and returns it .
40,928
private boolean includedInJobGraph ( final JobVertexID id ) { if ( this . inputVertices . containsKey ( id ) ) { return true ; } if ( this . outputVertices . containsKey ( id ) ) { return true ; } if ( this . taskVertices . containsKey ( id ) ) { return true ; } return false ; }
Checks if the job vertex with the given ID is registered with the job graph .
40,929
public boolean isWeaklyConnected ( ) { final AbstractJobVertex [ ] reachable = getAllReachableJobVertices ( ) ; final AbstractJobVertex [ ] all = getAllJobVertices ( ) ; if ( reachable . length != all . length ) { return false ; } final HashMap < JobVertexID , AbstractJobVertex > tmp = new HashMap < JobVertexID , Abstr...
Checks if the job graph is weakly connected .
40,930
public boolean isAcyclic ( ) { final AbstractJobVertex [ ] reachable = getAllReachableJobVertices ( ) ; final HashMap < AbstractJobVertex , Integer > indexMap = new HashMap < AbstractJobVertex , Integer > ( ) ; final HashMap < AbstractJobVertex , Integer > lowLinkMap = new HashMap < AbstractJobVertex , Integer > ( ) ; ...
Checks if the job graph is acyclic .
40,931
private boolean tarjan ( final AbstractJobVertex jv , Integer index , final HashMap < AbstractJobVertex , Integer > indexMap , final HashMap < AbstractJobVertex , Integer > lowLinkMap , final Stack < AbstractJobVertex > stack ) { indexMap . put ( jv , Integer . valueOf ( index ) ) ; lowLinkMap . put ( jv , Integer . va...
Auxiliary method implementing Tarjan s algorithm for strongly - connected components to determine whether the job graph is acyclic .
40,932
private void readRequiredJarFiles ( final DataInput in ) throws IOException { final int numJars = in . readInt ( ) ; if ( numJars > 0 ) { for ( int i = 0 ; i < numJars ; i ++ ) { final Path p = new Path ( ) ; p . read ( in ) ; this . userJars . add ( p ) ; final long sizeOfJar = in . readLong ( ) ; LibraryCacheManager ...
Reads required JAR files from an input stream and adds them to the library cache manager .
40,933
private ExtendedManagementProtocol getJMConnection ( ) throws IOException { String jmHost = config . getString ( ConfigConstants . JOB_MANAGER_IPC_ADDRESS_KEY , null ) ; String jmPort = config . getString ( ConfigConstants . JOB_MANAGER_IPC_PORT_KEY , null ) ; return RPC . getProxy ( ExtendedManagementProtocol . class ...
Sets up a connection to the JobManager .
40,934
public String getPreviewPlan ( ) throws ProgramInvocationException { Thread . currentThread ( ) . setContextClassLoader ( this . getUserCodeClassLoader ( ) ) ; List < DataSinkNode > previewPlan ; if ( isUsingProgramEntryPoint ( ) ) { previewPlan = PactCompiler . createPreOptimizedPlan ( getPlan ( ) ) ; } else if ( isUs...
Returns the analyzed plan without any optimizations .
40,935
public String getDescription ( ) throws ProgramInvocationException { if ( ProgramDescription . class . isAssignableFrom ( this . mainClass ) ) { ProgramDescription descr ; if ( this . program != null ) { descr = ( ProgramDescription ) this . program ; } else { try { descr = InstantiationUtil . instantiate ( this . main...
Returns the description provided by the Program class . This may contain a description of the plan itself and its arguments .
40,936
void registerJob ( final ExecutionGraph eg ) { final Iterator < ExecutionGroupVertex > it = new ExecutionGroupVertexIterator ( eg , true , - 1 ) ; while ( it . hasNext ( ) ) { final ExecutionGroupVertex groupVertex = it . next ( ) ; final InputSplit [ ] inputSplits = groupVertex . getInputSplits ( ) ; if ( inputSplits ...
Registers a new job with the input split tracker .
40,937
void unregisterJob ( final ExecutionGraph eg ) { final Iterator < ExecutionVertex > it = new ExecutionGraphIterator ( eg , true ) ; while ( it . hasNext ( ) ) { this . splitMap . remove ( it . next ( ) . getID ( ) ) ; } }
Unregisters a job from the input split tracker .
40,938
void addInputSplitToLog ( final ExecutionVertex vertex , final int sequenceNumber , final InputSplit inputSplit ) { final List < InputSplit > inputSplitLog = this . splitMap . get ( vertex . getID ( ) ) ; if ( inputSplitLog == null ) { LOG . error ( "Cannot find input split log for vertex " + vertex + " (" + vertex . g...
Adds the given input split to the vertex s log and stores it under the specified sequence number .
40,939
private TaskOperationProtocol getTaskManagerProxy ( ) throws IOException { if ( this . taskManager == null ) { this . taskManager = RPC . getProxy ( TaskOperationProtocol . class , new InetSocketAddress ( getInstanceConnectionInfo ( ) . address ( ) , getInstanceConnectionInfo ( ) . ipcPort ( ) ) , NetUtils . getSocketF...
Creates or returns the RPC stub object for the instance s task manager .
40,940
public synchronized void checkLibraryAvailability ( final JobID jobID ) throws IOException { String [ ] requiredLibraries = LibraryCacheManager . getRequiredJarFiles ( jobID ) ; if ( requiredLibraries == null ) { throw new IOException ( "No entry of required libraries for job " + jobID ) ; } LibraryCacheProfileRequest ...
Checks if all the libraries required to run the job with the given job ID are available on this instance . Any libary that is missing is transferred to the instance as a result of this call .
40,941
public void mapResultToRecord ( Record record , HBaseKey key , HBaseResult result ) { record . setField ( 0 , key ) ; record . setField ( 1 , result ) ; }
Maps the current HBase Result into a Record . This implementation simply stores the HBaseKey at position 0 and the HBase Result object at position 1 .
40,942
public static void loadLibraryFromFile ( final String directory , final String filename ) throws IOException { final String libraryPath = directory + File . separator + filename ; synchronized ( loadedLibrarySet ) { final File outputFile = new File ( directory , filename ) ; if ( ! outputFile . exists ( ) ) { final Cla...
Loads a native library from a file .
40,943
void addRequest ( final InstanceType instanceType , final int numberOfInstances ) { Integer numberOfRemainingInstances = this . pendingRequests . get ( instanceType ) ; if ( numberOfRemainingInstances == null ) { numberOfRemainingInstances = Integer . valueOf ( numberOfInstances ) ; } else { numberOfRemainingInstances ...
Adds the a pending request for the given number of instances of the given type to this map .
40,944
void decreaseNumberOfPendingInstances ( final InstanceType instanceType ) { Integer numberOfRemainingInstances = this . pendingRequests . get ( instanceType ) ; if ( numberOfRemainingInstances == null ) { return ; } numberOfRemainingInstances = Integer . valueOf ( numberOfRemainingInstances . intValue ( ) - 1 ) ; if ( ...
Decreases the number of remaining instances to request of the given type .
40,945
public ManagementStage getStage ( final int index ) { if ( index >= 0 && index < this . stages . size ( ) ) { return this . stages . get ( index ) ; } return null ; }
Returns the management stage with the given index .
40,946
public int getNumberOfInputGroupVertices ( final int stage ) { if ( stage < 0 || stage >= this . stages . size ( ) ) { return 0 ; } return this . stages . get ( stage ) . getNumberOfInputGroupVertices ( ) ; }
Returns the number of input group vertices in the management stage with the given index .
40,947
public ManagementGroupVertex getInputGroupVertex ( final int stage , final int index ) { if ( stage >= this . stages . size ( ) ) { return null ; } return this . stages . get ( stage ) . getInputGroupVertex ( index ) ; }
Returns the input group vertex at the given index in the given stage .
40,948
public ManagementGroupVertex getOutputGroupVertex ( final int stage , final int index ) { if ( stage >= this . stages . size ( ) ) { return null ; } return this . stages . get ( stage ) . getOutputGroupVertex ( index ) ; }
Returns the output group vertex at the given index in the given stage .
40,949
public ManagementVertex getInputVertex ( final int stage , final int index ) { if ( stage >= this . stages . size ( ) ) { return null ; } return this . stages . get ( stage ) . getInputManagementVertex ( index ) ; }
Returns the input vertex with the specified index for the given stage .
40,950
public List < ManagementGroupVertex > getGroupVerticesInTopologicalOrder ( ) { final List < ManagementGroupVertex > topologicalSort = new ArrayList < ManagementGroupVertex > ( ) ; final Deque < ManagementGroupVertex > noIncomingEdges = new ArrayDeque < ManagementGroupVertex > ( ) ; final Map < ManagementGroupVertex , I...
Returns a list of group vertices sorted in topological order .
40,951
public List < ManagementGroupVertex > getGroupVerticesInReverseTopologicalOrder ( ) { final List < ManagementGroupVertex > reverseTopologicalSort = new ArrayList < ManagementGroupVertex > ( ) ; final Deque < ManagementGroupVertex > noOutgoingEdges = new ArrayDeque < ManagementGroupVertex > ( ) ; final Map < ManagementG...
Returns a list of group vertices sorted in reverse topological order .
40,952
public static boolean validate ( Fragment fragment , IValidationCallback callback ) { return validate ( fragment . getActivity ( ) , fragment , callback ) ; }
Perform validation over the views of given fragment
40,953
@ SuppressWarnings ( "unchecked" ) private static ValidationFail performFieldValidations ( Context context , FieldInfo fieldInfo , View view ) { if ( fieldInfo . condition != null && fieldInfo . condition . validationAnnotation ( ) . equals ( Condition . class ) ) { boolean evaluation = evaluateCondition ( view , field...
perform all validations on single field
40,954
static Map < View , FormValidator . FieldInfo > getFieldsForTarget ( Object target ) { Map < View , FormValidator . FieldInfo > infoMap = sCachedFieldsByTarget . get ( target ) ; if ( infoMap != null ) { for ( View view : infoMap . keySet ( ) ) { if ( view . getWindowToken ( ) == null ) { infoMap = null ; break ; } } }...
get map of field information on view for given target
40,955
@ SuppressWarnings ( "TryWithIdenticalCatches" ) private static Map < View , FormValidator . FieldInfo > findFieldsToValidate ( Object target ) { final Field [ ] fields = target . getClass ( ) . getDeclaredFields ( ) ; if ( fields == null || fields . length == 0 ) { return Collections . emptyMap ( ) ; } final WeakHashM...
find fields on target to validate and prepare for their validation
40,956
public static < T extends Enum < T > > T getEnum ( Class < T > enumClass , AbstractConfig config , String key ) { Preconditions . checkNotNull ( enumClass , "enumClass cannot be null" ) ; Preconditions . checkState ( enumClass . isEnum ( ) , "enumClass must be an enum." ) ; String textValue = config . getString ( key )...
Method is used to return an enum value from a given string .
40,957
public static String enumValues ( Class < ? > enumClass ) { Preconditions . checkNotNull ( enumClass , "enumClass cannot be null" ) ; Preconditions . checkState ( enumClass . isEnum ( ) , "enumClass must be an enum." ) ; return Joiner . on ( ", " ) . join ( enumClass . getEnumConstants ( ) ) ; }
Method is used to return the values for an enum .
40,958
public static File getAbsoluteFile ( AbstractConfig config , String key ) { Preconditions . checkNotNull ( config , "config cannot be null" ) ; String path = config . getString ( key ) ; File file = new File ( path ) ; if ( ! file . isAbsolute ( ) ) { throw new ConfigException ( key , path , "Must be an absolute path."...
Method is used to return a File checking to ensure that it is an absolute path .
40,959
public static List < HostAndPort > hostAndPorts ( AbstractConfig config , String key , Integer defaultPort ) { final List < String > inputs = config . getList ( key ) ; List < HostAndPort > result = new ArrayList < > ( ) ; for ( final String input : inputs ) { final HostAndPort hostAndPort = hostAndPort ( input , defau...
Method is used to parse a list ConfigDef item to a list of HostAndPort
40,960
public static List < HostAndPort > hostAndPorts ( AbstractConfig config , String key ) { return hostAndPorts ( config , key , null ) ; }
Method is used to parse hosts and ports
40,961
public static URL url ( AbstractConfig config , String key ) { final String value = config . getString ( key ) ; return url ( key , value ) ; }
Method is used to retrieve a URL from a configuration key .
40,962
public static URI uri ( AbstractConfig config , String key ) { final String value = config . getString ( key ) ; return uri ( key , value ) ; }
Method is used to retrieve a URI from a configuration key .
40,963
public static Set < String > getSet ( AbstractConfig config , String key ) { List < String > value = config . getList ( key ) ; return ImmutableSet . copyOf ( value ) ; }
Method is used to retrieve a list and convert it to an immutable set .
40,964
public static Pattern pattern ( AbstractConfig config , String key ) { String pattern = config . getString ( key ) ; try { return Pattern . compile ( pattern ) ; } catch ( PatternSyntaxException e ) { throw new ConfigException ( key , pattern , String . format ( "Could not compile regex '%s'." , pattern ) ) ; } }
Method is used to create a pattern based on the config element .
40,965
public static char [ ] passwordCharArray ( AbstractConfig config , String key ) { final Password password = config . getPassword ( key ) ; return password . value ( ) . toCharArray ( ) ; }
Method is used to return an array of characters representing the password stored in the config .
40,966
public static KeyStore keyStore ( AbstractConfig config , String key ) { final String keyStoreType = config . getString ( key ) ; try { return KeyStore . getInstance ( keyStoreType ) ; } catch ( KeyStoreException e ) { ConfigException exception = new ConfigException ( key , keyStoreType , "Invalid KeyStore type." ) ; e...
Method will create a KeyStore based on the KeyStore type specified in the config .
40,967
public static KeyManagerFactory keyManagerFactory ( AbstractConfig config , String key ) { final String keyManagerFactoryType = config . getString ( key ) ; try { return KeyManagerFactory . getInstance ( keyManagerFactoryType ) ; } catch ( NoSuchAlgorithmException e ) { ConfigException exception = new ConfigException (...
Method will create a KeyManagerFactory based on the Algorithm type specified in the config .
40,968
public static TrustManagerFactory trustManagerFactory ( AbstractConfig config , String key ) { final String trustManagerFactoryType = config . getString ( key ) ; try { return TrustManagerFactory . getInstance ( trustManagerFactoryType ) ; } catch ( NoSuchAlgorithmException e ) { ConfigException exception = new ConfigE...
Method will create a TrustManagerFactory based on the Algorithm type specified in the config .
40,969
public static SSLContext sslContext ( AbstractConfig config , String key ) { final String trustManagerFactoryType = config . getString ( key ) ; try { return SSLContext . getInstance ( trustManagerFactoryType ) ; } catch ( NoSuchAlgorithmException e ) { ConfigException exception = new ConfigException ( key , trustManag...
Method will create a SSLContext based on the Algorithm type specified in the config .
40,970
protected String getRequestUrl ( String key ) throws Exception { String result = "" ; try { result = this . methods . get ( key ) [ 0 ] ; } catch ( Exception ex ) { throw new Exception ( "Unknown method key: " + key ) ; } return result ; }
Gets the URL of REST Mango Pay API .
40,971
protected < T extends Dto > List < T > getList ( Class < T [ ] > classOfT , Class < T > classOfTItem , String methodKey , Pagination pagination , String entityId , String secondEntityId , Map < String , String > filter , Sorting sorting ) throws Exception { String urlMethod = "" ; if ( entityId != null && entityId . le...
Gets the array of Dto instances from API .
40,972
public boolean drain ( List < SourceRecord > records , int timeout ) throws InterruptedException { Preconditions . checkNotNull ( records , "records cannot be null" ) ; Preconditions . checkArgument ( timeout >= 0 , "timeout should be greater than or equal to 0." ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "det...
Method is used to drain the records from the deque in order and add them to the supplied list .
40,973
public String getHttpHeaderBasicKey ( ) throws Exception { if ( root . getConfig ( ) . getClientId ( ) == null || root . getConfig ( ) . getClientId ( ) . length ( ) == 0 ) throw new Exception ( "MangoPay.config.ClientId is not set." ) ; if ( root . getConfig ( ) . getClientPassword ( ) == null || root . getConfig ( ) ...
Gets basic key for HTTP header .
40,974
private Map < String , String > getHttpHeaderBasic ( ) throws Exception { return new HashMap < String , String > ( ) { { put ( "Authorization" , "Basic " + getHttpHeaderBasicKey ( ) ) ; } } ; }
gets HTTP header value with authorization string for basic authentication
40,975
private Map < String , String > getHttpHeaderStrong ( ) throws Exception { final OAuthToken token = root . getOAuthTokenManager ( ) . getToken ( ) ; if ( token == null || token . getAccessToken ( ) . length ( ) == 0 || token . getTokenType ( ) . length ( ) == 0 ) throw new Exception ( "OAuth token is not created (or is...
gets HTTP header value with authorization string for strong authentication
40,976
public void addField ( String fieldName , SortDirection sortDirection ) { if ( sortFields == null ) sortFields = new HashMap < > ( ) ; sortFields . put ( fieldName , sortDirection ) ; }
Adds field to sort by .
40,977
public Map < String , String > getSortParameter ( ) { return new HashMap < String , String > ( ) { { put ( sortUrlParameterName , getFields ( ) ) ; } } ; }
Gets sort parameters .
40,978
public String getFullUrl ( String restUrl ) { String result = "" ; try { result = ( new URL ( root . getConfig ( ) . getBaseUrl ( ) ) ) . getProtocol ( ) + "://" + this . getHost ( ) + restUrl ; } catch ( Exception ex ) { } return result ; }
Gets complete url .
40,979
public Boolean isValid ( ) { return addressLine1 != null || addressLine2 != null || city != null || region != null || postalCode != null || ( country != null && country != CountryIso . NotSpecified ) ; }
Helper method used internally .
40,980
private String readMangopayVersion ( ) { try { Properties prop = new Properties ( ) ; InputStream input = getClass ( ) . getResourceAsStream ( "mangopay.properties" ) ; prop . load ( input ) ; return prop . getProperty ( "version" ) ; } catch ( IOException ex ) { Logger . getLogger ( Configuration . class . getName ( )...
Read Mangopay version from mangopay properties
40,981
public void ensureValid ( String setting , Object value ) { if ( null == value || ! ( value instanceof Integer ) ) { throw new ConfigException ( setting , "Must be an integer." ) ; } final Integer port = ( Integer ) value ; if ( ! ( port >= this . start && port <= this . end ) ) { throw new ConfigException ( setting , ...
Method is used to validate that the supplied port is within the valid range .
40,982
public static ConfigDef . Recommender visibleIf ( String configKey , Object value ) { return new VisibleIfRecommender ( configKey , value , ValidValuesCallback . EMPTY ) ; }
Method is used to return a recommender that will mark a ConfigItem as visible if the configKey is set to the specified value .
40,983
public void addRequestHttpHeader ( final String key , final String value ) { addRequestHttpHeader ( new HashMap < String , String > ( ) { { put ( key , value ) ; } } ) ; }
Adds HTTP header into the request .
40,984
private Map < String , String > getHttpHeaders ( String restUrl ) throws Exception { if ( this . requestHttpHeaders != null ) return this . requestHttpHeaders ; Map < String , String > httpHeaders = new HashMap < > ( ) ; httpHeaders . put ( "Content-Type" , "application/json" ) ; if ( this . authRequired ) { Authentica...
Gets HTTP header to use in request .
40,985
private void checkResponseCode ( String message ) throws ResponseException { if ( this . responseCode != 200 && this . responseCode != 204 ) { HashMap < Integer , String > responseCodes = new HashMap < Integer , String > ( ) { { put ( 206 , "PartialContent" ) ; put ( 400 , "Bad request" ) ; put ( 401 , "Unauthorized" )...
Checks the HTTP response code and if it s neither 200 nor 204 throws a ResponseException .
40,986
public final void registerTypeParser ( Schema schema , TypeParser typeParser ) { Preconditions . checkNotNull ( schema , "schema cannot be null." ) ; Preconditions . checkNotNull ( typeParser , "typeParser cannot be null." ) ; this . typeParsers . put ( new ParserKey ( schema ) , typeParser ) ; }
Method is used to register a TypeParser for a given schema . If the schema is already registered the new TypeParser will replace the existing one .
40,987
public Object parseString ( Schema schema , String input ) { checkSchemaAndInput ( schema , input ) ; if ( null == input ) { return null ; } TypeParser parser = findParser ( schema ) ; try { Object result = parser . parseString ( input , schema ) ; return result ; } catch ( Exception ex ) { String message = String . fo...
Method is used to parse String data to the proper Java types .
40,988
public static Validator blankOr ( Validator validator ) { Preconditions . checkNotNull ( validator , "validator cannot be null." ) ; return BlankOrValidator . of ( validator ) ; }
Method will return a validator that will accept a blank string . Any other value will be passed on to the supplied validator .
40,989
public static Validator validCharset ( String ... charsets ) { if ( null == charsets || charsets . length == 0 ) { return new ValidCharset ( ) ; } else { return new ValidCharset ( charsets ) ; } }
Method will return a validator that will ensure that a String or List contains a charset that is supported by the system .
40,990
public static Validator validEnum ( Class < ? extends Enum > enumClass , Enum ... excludes ) { String [ ] ex = new String [ excludes . length ] ; for ( int i = 0 ; i < ex . length ; i ++ ) { ex [ i ] = excludes [ i ] . toString ( ) ; } return ValidEnum . of ( enumClass , ex ) ; }
Method is used to create a new INSTANCE of the enum validator .
40,991
public static Validator validHostAndPort ( Integer defaultPort , boolean requireBracketsForIPv6 , boolean portRequired ) { return ValidHostAndPort . of ( defaultPort , requireBracketsForIPv6 , portRequired ) ; }
Validator to ensure that a configuration setting is a hostname and port .
40,992
public static Validator validKeyStoreType ( ) { return ( s , o ) -> { if ( ! ( o instanceof String ) ) { throw new ConfigException ( s , o , "Must be a string." ) ; } String keyStoreType = o . toString ( ) ; try { KeyStore . getInstance ( keyStoreType ) ; } catch ( KeyStoreException e ) { ConfigException exception = ne...
Validator is used to ensure that the KeyStore type specified is valid .
40,993
public static Validator validKeyManagerFactory ( ) { return ( s , o ) -> { if ( ! ( o instanceof String ) ) { throw new ConfigException ( s , o , "Must be a string." ) ; } String keyStoreType = o . toString ( ) ; try { KeyManagerFactory . getInstance ( keyStoreType ) ; } catch ( NoSuchAlgorithmException e ) { ConfigExc...
Validator is used to ensure that the KeyManagerFactory Algorithm specified is valid .
40,994
public static List < Map < String , String > > single ( Map < String , String > settings ) { Preconditions . checkNotNull ( settings , "settings cannot be null." ) ; return ImmutableList . of ( settings ) ; }
Method will create a single from the supplied settings .
40,995
public static List < Map < String , String > > multiple ( Map < String , String > settings , final int taskCount ) { Preconditions . checkNotNull ( settings , "settings cannot be null." ) ; Preconditions . checkState ( taskCount > 0 , "taskCount must be greater than 0." ) ; final List < Map < String , String > > result...
Method is used to generate a list of taskConfigs based on the supplied settings .
40,996
private DataFrame createDataFrame ( ByteBuf buf ) { if ( buf . readableBytes ( ) > 3 ) { byte messageType = buf . getByte ( buf . readerIndex ( ) + 3 ) ; switch ( messageType ) { case Version . ID : return new Version ( buf ) ; case MemoryGetId . ID : return new MemoryGetId ( buf ) ; case InitData . ID : return new Ini...
Creates a Z - Wave DataFrame from a ByteBuf .
40,997
public void onApplicationCommand ( ZWaveControllerContext context , ApplicationCommand ac ) { byte commandClassId = ac . getCommandClassId ( ) ; CommandClass cc = getCommandClass ( commandClassId ) ; if ( cc != null ) { if ( cc instanceof BasicCommandClass ) { cc = performBasicCommandClassMapping ( ( BasicCommandClass ...
Called when an application command message is received for this specific node .
40,998
public void onApplicationUpdate ( ZWaveControllerContext context , ApplicationUpdate update ) { switch ( nodeState ) { case NodeInfo : if ( update . didInfoRequestFail ( ) ) { if ( stateRetries < 1 ) { logger . trace ( "Application update failed for node {}; will retry" , getNodeId ( ) ) ; sendDataFrame ( context , new...
Called when an application update message is received for this node .
40,999
public void channelRead ( ChannelHandlerContext ctx , Object msg ) { if ( msg instanceof Frame ) { Frame frame = ( Frame ) msg ; if ( hasCurrentTransaction ( ) ) { String tid = currentDataFrameTransaction . getId ( ) ; logger . trace ( "Received frame within transaction ({}) context: {}" , tid , frame ) ; NettyZWaveCha...
Called when data is read from the Z - Wave network .