idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
123,400
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 .
123,401
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 .
123,402
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 .
123,403
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 .
123,404
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 .
123,405
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 .
123,406
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 .
123,407
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 .
123,408
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 .
123,409
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 .
123,410
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 .
123,411
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 .
123,412
public static boolean validate ( Fragment fragment , IValidationCallback callback ) { return validate ( fragment . getActivity ( ) , fragment , callback ) ; }
Perform validation over the views of given fragment
123,413
@ 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
123,414
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
123,415
@ 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
123,416
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 .
123,417
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 .
123,418
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 .
123,419
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
123,420
public static List < HostAndPort > hostAndPorts ( AbstractConfig config , String key ) { return hostAndPorts ( config , key , null ) ; }
Method is used to parse hosts and ports
123,421
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 .
123,422
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 .
123,423
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 .
123,424
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 .
123,425
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 .
123,426
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 .
123,427
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 .
123,428
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 .
123,429
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 .
123,430
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 .
123,431
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 .
123,432
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 .
123,433
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 .
123,434
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
123,435
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
123,436
public void addField ( String fieldName , SortDirection sortDirection ) { if ( sortFields == null ) sortFields = new HashMap < > ( ) ; sortFields . put ( fieldName , sortDirection ) ; }
Adds field to sort by .
123,437
public Map < String , String > getSortParameter ( ) { return new HashMap < String , String > ( ) { { put ( sortUrlParameterName , getFields ( ) ) ; } } ; }
Gets sort parameters .
123,438
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 .
123,439
public Boolean isValid ( ) { return addressLine1 != null || addressLine2 != null || city != null || region != null || postalCode != null || ( country != null && country != CountryIso . NotSpecified ) ; }
Helper method used internally .
123,440
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
123,441
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 .
123,442
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 .
123,443
public void addRequestHttpHeader ( final String key , final String value ) { addRequestHttpHeader ( new HashMap < String , String > ( ) { { put ( key , value ) ; } } ) ; }
Adds HTTP header into the request .
123,444
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 .
123,445
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 .
123,446
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 .
123,447
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 .
123,448
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 .
123,449
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 .
123,450
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 .
123,451
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 .
123,452
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 .
123,453
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 .
123,454
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 .
123,455
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 .
123,456
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 .
123,457
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 .
123,458
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 .
123,459
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 .
123,460
public DataFrame createMultiInstanceGet ( byte nodeId , byte commandClass ) { if ( getVersion ( ) > 1 ) { throw new ZWaveRuntimeException ( "MULTI_INSTANCE_GET is deprecated for command class versions > 1" ) ; } return createSendDataFrame ( "MULTI_INSTANCE_GET" , nodeId , new byte [ ] { MultiInstanceCommandClass . ID ,...
Create a MULTI_INSTANCE_GET command .
123,461
public DataFrame createMultiChannelEndPointGet ( byte nodeId ) { if ( getVersion ( ) < 2 ) { throw new ZWaveRuntimeException ( "MULTI_CHANNEL_END_POINT_GET is not available in command class version 1" ) ; } return createSendDataFrame ( "MULTI_CHANNEL_END_POINT_GET" , nodeId , new byte [ ] { MultiInstanceCommandClass . ...
Create a MULTI_CHANNEL_END_POINT_GET command .
123,462
public DataFrame createMultiChannelCapabilityGet ( byte nodeId , byte endPoint ) { if ( getVersion ( ) < 2 ) { throw new ZWaveRuntimeException ( "MULTI_CHANNEL_CAPABILITY_GET is not available in command class version 1" ) ; } return createSendDataFrame ( "MULTI_CHANNEL_CAPABILITY_GET" , nodeId , new byte [ ] { MultiIns...
Create a MULTI_CHANNEL_CAPABILITY_GET command .
123,463
boolean attemptResend ( ZWaveChannelContext ctx , boolean dueToCAN ) { if ( startFrame . getSendCount ( ) < MAX_SEND_COUNT ) { logger . debug ( "Transaction {} has failed - will reset and resend initial request" , getId ( ) ) ; reset ( ) ; if ( dueToCAN ) { startFrame . decrementSendCount ( ) ; } ctx . writeFrame ( new...
Attempts to re - send the data frame that initiated this transaction .
123,464
public Map < String , Object > restore ( PersistenceContext ctx , byte nodeId ) { Map < String , Object > map = ctx . getCommandClassMap ( nodeId , getId ( ) ) ; this . version = ( int ) map . get ( "version" ) ; return map ; }
Restores details about this command class from a persistence context .
123,465
public Map < String , Object > save ( PersistenceContext ctx , byte nodeId ) { Map < String , Object > map = ctx . getCommandClassMap ( nodeId , getId ( ) ) ; map . put ( "version" , getVersion ( ) ) ; return map ; }
Saves details about this command class to a persistence context .
123,466
static protected DataFrame createSendDataFrame ( String name , byte nodeId , byte [ ] data , boolean isResponseExpected ) { return new SendData ( name , nodeId , data , ( byte ) ( SendData . TRANSMIT_OPTION_ACK | SendData . TRANSMIT_OPTION_AUTO_ROUTE ) , isResponseExpected ) ; }
Convenience method for creating SendData frames
123,467
public DataFrame createGet ( byte nodeId , Scale s ) { switch ( getVersion ( ) ) { case 1 : return createSendDataFrame ( "METER_GET" , nodeId , new byte [ ] { MeterCommandClass . ID , METER_GET } , true ) ; default : { byte scale = scaleToByte ( s ) ; byte b = ( byte ) ( ( scale << 3 ) & 0x18 ) ; return createSendDataF...
Create a Get data frame .
123,468
public void setOnHeadViewBindViewHolderListener ( FamiliarRecyclerView . OnHeadViewBindViewHolderListener onHeadViewBindViewHolderListener ) { if ( null != mWrapFamiliarRecyclerViewAdapter ) { mWrapFamiliarRecyclerViewAdapter . setOnHeadViewBindViewHolderListener ( onHeadViewBindViewHolderListener ) ; } else { mTempOnH...
HeadView onBindViewHolder callback
123,469
public void setOnFooterViewBindViewHolderListener ( FamiliarRecyclerView . OnFooterViewBindViewHolderListener onFooterViewBindViewHolderListener ) { if ( null != mWrapFamiliarRecyclerViewAdapter ) { mWrapFamiliarRecyclerViewAdapter . setOnFooterViewBindViewHolderListener ( onFooterViewBindViewHolderListener ) ; } else ...
FooterView onBindViewHolder callback
123,470
public void autoRefresh ( ) { if ( ! isPullRefreshEnabled ) return ; setRefreshing ( true ) ; new android . os . Handler ( ) . postDelayed ( new Runnable ( ) { public void run ( ) { callOnPullRefresh ( ) ; } } , 1000 ) ; }
Automatic pull refresh
123,471
protected RuleSet readRules ( MavenProject rootModule ) throws MojoExecutionException { List < RuleSource > sources = new ArrayList < > ( ) ; PluginRepository pluginRepository = pluginRepositoryProvider . getPluginRepository ( ) ; if ( rulesUrl != null ) { getLog ( ) . debug ( "Retrieving rules from URL " + rulesUrl . ...
Reads the available rules from the rules directory and deployed catalogs .
123,472
private void addRuleFiles ( List < RuleSource > sources , File directory ) throws MojoExecutionException { List < RuleSource > ruleSources = readRulesDirectory ( directory ) ; for ( RuleSource ruleSource : ruleSources ) { getLog ( ) . debug ( "Adding rules from file " + ruleSource ) ; sources . add ( ruleSource ) ; } }
Add rules from the given directory to the list of sources .
123,473
private List < RuleSource > readRulesDirectory ( File rulesDirectory ) throws MojoExecutionException { if ( rulesDirectory . exists ( ) && ! rulesDirectory . isDirectory ( ) ) { throw new MojoExecutionException ( rulesDirectory . getAbsolutePath ( ) + " does not exist or is not a directory." ) ; } getLog ( ) . info ( "...
Retrieves the list of available rules from the rules directory .
123,474
protected void execute ( StoreOperation storeOperation , MavenProject rootModule , Set < MavenProject > executedModules ) throws MojoExecutionException , MojoFailureException { synchronized ( cachingStoreProvider ) { Store store = getStore ( rootModule ) ; if ( isResetStoreBeforeExecution ( ) && executedModules . isEmp...
Execute an operation with the store .
123,475
protected Set < MavenProject > getExecutedModules ( MavenProject rootModule ) { String executionKey = createExecutionKey ( execution ) ; String executedModulesContextKey = AbstractProjectMojo . class . getName ( ) + "#executedModules" ; Map < String , Set < MavenProject > > executedProjectsPerExecutionKey = ( Map < Str...
Determine the already executed modules for a given root module .
123,476
private Store getStore ( MavenProject rootModule ) throws MojoExecutionException { StoreConfiguration configuration = getStoreConfiguration ( rootModule ) ; List < Class < ? > > descriptorTypes ; try { descriptorTypes = pluginRepositoryProvider . getPluginRepository ( ) . getModelPluginRepository ( ) . getDescriptorTyp...
Determine the store instance to use for the given root module .
123,477
private EmbeddedNeo4jConfiguration getEmbeddedNeo4jConfiguration ( ) { OptionHelper . verifyDeprecatedOption ( PARAMETER_SERVER_ADDRESS , this . serverAddress , PARAMETER_EMBEDDED_LISTEN_ADDRESS ) ; OptionHelper . verifyDeprecatedOption ( PARAMETER_SERVER_PORT , this . serverPort , PARAMETER_EMBEDDED_HTTP_PORT ) ; Embe...
Create the configuration for the embedded server .
123,478
static Map < MavenProject , List < MavenProject > > getProjects ( List < MavenProject > reactorProjects , String rulesDirectory , boolean useExecutionRootAsProjectRoot ) throws MojoExecutionException { Map < MavenProject , List < MavenProject > > rootModules = new HashMap < > ( ) ; for ( MavenProject reactorProject : r...
Aggregate projects to their base projects
123,479
static File getRulesDirectory ( MavenProject rootModule , String rulesDirectory ) { File rules = new File ( rulesDirectory ) ; return rules . isAbsolute ( ) ? rules : new File ( rootModule . getBasedir ( ) . getAbsolutePath ( ) + File . separator + rulesDirectory ) ; }
Returns the directory containing rules .
123,480
static File getOutputDirectory ( MavenProject rootModule ) { String directoryName = rootModule . getBuild ( ) . getDirectory ( ) + "/" + OUTPUT_DIRECTORY ; File directory = new File ( directoryName ) ; directory . mkdirs ( ) ; return directory ; }
Determines the directory for writing output files .
123,481
static File getOutputFile ( MavenProject rootModule , File reportFile , String defaultFile ) throws MojoExecutionException { File selectedXmlReportFile ; if ( reportFile != null ) { selectedXmlReportFile = reportFile ; } else if ( rootModule != null ) { selectedXmlReportFile = new File ( getOutputDirectory ( rootModule...
Determines a report file name .
123,482
protected Map < String , Object > getPluginProperties ( ) { Map < String , Object > properties = new HashMap < > ( ) ; if ( scanProperties != null ) { properties . putAll ( scanProperties ) ; } properties . put ( ScanInclude . class . getName ( ) , scanIncludes ) ; return properties ; }
Return the plugin properties .
123,483
private boolean isLastModuleInProject ( Set < MavenProject > executedModules , List < MavenProject > projectModules ) { Set < MavenProject > remainingModules = new HashSet < > ( ) ; if ( execution . getPlugin ( ) . getExecutions ( ) . isEmpty ( ) ) { getLog ( ) . debug ( "No configured executions found, assuming CLI in...
Determines if the last module for a project is currently executed .
123,484
public String deriveKeyFormatted ( String inputPassword ) { PBKDF2Parameters p = getParameters ( ) ; byte [ ] salt = generateSalt ( ) ; p . setSalt ( salt ) ; p . setDerivedKey ( deriveKey ( inputPassword ) ) ; String formatted = getFormatter ( ) . toString ( p ) ; return formatted ; }
Derive key from password then format .
123,485
public boolean verifyKeyFormatted ( String formatted , String candidatePassword ) { PBKDF2Parameters p = getParameters ( ) ; PBKDF2Parameters q = new PBKDF2Parameters ( ) ; q . hashAlgorithm = p . hashAlgorithm ; q . hashCharset = p . hashCharset ; boolean verifyOK = false ; if ( ! getFormatter ( ) . fromString ( q , f...
Verification function .
123,486
protected boolean validatePassword ( String inputPassword , String expectedPassword ) { boolean verifyOK = false ; for ( ; ; ) { if ( inputPassword == null || expectedPassword == null ) { break ; } PBKDF2Parameters p = getEngineParameters ( ) ; if ( p == null ) { break ; } PBKDF2Formatter f = getFormatter ( ) ; if ( f ...
Actual salt - enabled verification function . Get parameters from database password then compute candidate derived key from user - supplied password and parameters then compare database derived key and candidate derived key . Login if match .
123,487
protected byte [ ] PBKDF2 ( PRF prf , byte [ ] S , int c , int dkLen ) { if ( S == null ) { S = new byte [ 0 ] ; } int hLen = prf . getHLen ( ) ; int l = ceil ( dkLen , hLen ) ; int r = dkLen - ( l - 1 ) * hLen ; byte T [ ] = new byte [ l * hLen ] ; int ti_offset = 0 ; for ( int i = 1 ; i <= l ; i ++ ) { _F ( T , ti_of...
Core Password Based Key Derivation Function 2 .
123,488
protected int ceil ( int a , int b ) { int m = 0 ; if ( a % b > 0 ) { m = 1 ; } return a / b + m ; }
Integer division with ceiling function .
123,489
protected void _F ( byte [ ] dest , int offset , PRF prf , byte [ ] S , int c , int blockIndex ) { int hLen = prf . getHLen ( ) ; byte U_r [ ] = new byte [ hLen ] ; byte U_i [ ] = new byte [ S . length + 4 ] ; System . arraycopy ( S , 0 , U_i , 0 , S . length ) ; INT ( U_i , S . length , blockIndex ) ; for ( int i = 0 ...
Function F .
123,490
protected void xor ( byte [ ] dest , byte [ ] src ) { for ( int i = 0 ; i < dest . length ; i ++ ) { dest [ i ] ^= src [ i ] ; } }
Block - Xor . Xor source bytes into destination byte buffer . Destination buffer must be same length or less than source buffer .
123,491
protected void INT ( byte [ ] dest , int offset , int i ) { dest [ offset + 0 ] = ( byte ) ( i / ( 256 * 256 * 256 ) ) ; dest [ offset + 1 ] = ( byte ) ( i / ( 256 * 256 ) ) ; dest [ offset + 2 ] = ( byte ) ( i / ( 256 ) ) ; dest [ offset + 3 ] = ( byte ) ( i ) ; }
Four - octet encoding of the integer i most significant octet first .
123,492
public static String bin2hex ( final byte [ ] b ) { if ( b == null ) { return "" ; } StringBuffer sb = new StringBuffer ( 2 * b . length ) ; for ( int i = 0 ; i < b . length ; i ++ ) { int v = ( 256 + b [ i ] ) % 256 ; sb . append ( hex . charAt ( ( v / 16 ) & 15 ) ) ; sb . append ( hex . charAt ( ( v % 16 ) & 15 ) ) ;...
Simple binary - to - hexadecimal conversion .
123,493
public static byte [ ] hex2bin ( final String s ) { String m = s ; if ( s == null ) { m = "" ; } else if ( s . length ( ) % 2 != 0 ) { m = "0" + s ; } byte r [ ] = new byte [ m . length ( ) / 2 ] ; for ( int i = 0 , n = 0 ; i < m . length ( ) ; n ++ ) { char h = m . charAt ( i ++ ) ; char l = m . charAt ( i ++ ) ; r [ ...
Convert hex string to array of bytes .
123,494
public static int hex2bin ( char c ) { if ( c >= '0' && c <= '9' ) { return ( c - '0' ) ; } if ( c >= 'A' && c <= 'F' ) { return ( c - 'A' + 10 ) ; } if ( c >= 'a' && c <= 'f' ) { return ( c - 'a' + 10 ) ; } throw new IllegalArgumentException ( "Input string may only contain hex digits, but found '" + c + "'" ) ; }
Convert hex digit to numerical value .
123,495
private void processInstanceEvent ( InstanceContentEvent instanceEvent ) { Instance instance = instanceEvent . getInstance ( ) ; boolean predictionCovered = false ; boolean trainingCovered = false ; boolean continuePrediction = instanceEvent . isTesting ( ) ; boolean continueTraining = instanceEvent . isTraining ( ) ; ...
Merge predict and train so we only check for covering rules one time
123,496
private ResultContentEvent newResultContentEvent ( double [ ] prediction , InstanceContentEvent inEvent ) { ResultContentEvent rce = new ResultContentEvent ( inEvent . getInstanceIndex ( ) , inEvent . getInstance ( ) , inEvent . getClassId ( ) , prediction , inEvent . isLastEvent ( ) ) ; rce . setClassifierIndex ( this...
Helper method to generate new ResultContentEvent based on an instance and its prediction result .
123,497
public double [ ] getVotesForInstance ( Instance inst ) { double [ ] ret ; inst . setDataset ( dataset ) ; if ( this . isInit == false ) { ret = new double [ dataset . numClasses ( ) ] ; } else { ret = learner . getVotesForInstance ( inst ) ; } return ret ; }
Predicts the class memberships for a given instance . If an instance is unclassified the returned array elements must be all zero .
123,498
private KeyFinder < S4Event > getKeyFinder ( ) { KeyFinder < S4Event > keyFinder = new KeyFinder < S4Event > ( ) { public List < String > get ( S4Event s4event ) { List < String > results = new ArrayList < String > ( ) ; results . add ( s4event . getKey ( ) ) ; return results ; } } ; return keyFinder ; }
KeyFinder sets the keys for a specific event .
123,499
protected void onCreate ( ) { logger . debug ( "PE ID {}" , getId ( ) ) ; if ( this . processor != null ) { this . processor = this . processor . newProcessor ( this . processor ) ; this . processor . onCreate ( Integer . parseInt ( getId ( ) ) ) ; } }
Methods from ProcessingElement