idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
11,500 | public void configurationChanged ( ) { HashSet < Param > changedParams = new HashSet ( ) ; for ( Param param : parameters ) { if ( ! param . isStatic ( ) ) { Object oldValue = param . getValue ( ) ; readAndValidateParameter ( param ) ; if ( ! ConfigUtil . equalValues ( oldValue , param . getValue ( ) ) ) { changedParams . add ( param ) ; } } } if ( ! changedParams . isEmpty ( ) ) { for ( ConfigChangeListener listener : configChangeListeners ) { listener . configurationChanged ( changedParams ) ; } } } | notified on reload configuration event |
11,501 | private Throwable loadLib ( String _lib ) { try { System . load ( _lib ) ; return null ; } catch ( Throwable _ex ) { return _ex ; } } | Tries to load a library from the given path . Will catches exceptions and return them to the caller . Will return null if no exception has been thrown . |
11,502 | private File extractToTemp ( InputStream _fileToExtract , String _tmpName , String _fileSuffix ) throws IOException { if ( _fileToExtract == null ) { throw new IOException ( "Null stream" ) ; } File tempFile = File . createTempFile ( _tmpName , _fileSuffix ) ; tempFile . deleteOnExit ( ) ; if ( ! tempFile . exists ( ) ) { throw new FileNotFoundException ( "File " + tempFile . getAbsolutePath ( ) + " could not be created" ) ; } byte [ ] buffer = new byte [ 1024 ] ; int readBytes ; OutputStream os = new FileOutputStream ( tempFile ) ; try { while ( ( readBytes = _fileToExtract . read ( buffer ) ) != - 1 ) { os . write ( buffer , 0 , readBytes ) ; } } finally { os . close ( ) ; _fileToExtract . close ( ) ; } return tempFile ; } | Extract the file behind InputStream _fileToExtract to the tmp - folder . |
11,503 | public void mouseReleased ( MouseEvent e ) { if ( ! hasFocus ) { return ; } boolean repaint = tabRowPainter . mouseReleased ( e ) ; if ( ! repaint ) { repaint = toolbarPainter . mouseReleased ( e ) ; } } | the event was consumed - DO NOT PAINT |
11,504 | private boolean isProxied ( HttpServletRequest httpServletRequest ) { if ( Proxy . isProxyClass ( httpServletRequest . getClass ( ) ) ) { InvocationHandler handler = Proxy . getInvocationHandler ( httpServletRequest ) ; return handler instanceof ServletRequestInvocationHandler ; } return false ; } | Check if this request is already proxied by pax wicket |
11,505 | public boolean hasRelation ( Interval interval1 , Interval interval2 ) { if ( interval1 == null || interval2 == null ) { return false ; } Long minStart1 = interval1 . getMinimumStart ( ) ; Long maxStart1 = interval1 . getMaximumStart ( ) ; Long minFinish1 = interval1 . getMinimumFinish ( ) ; Long maxFinish1 = interval1 . getMaximumFinish ( ) ; Long minStart2 = interval2 . getMinimumStart ( ) ; Long maxStart2 = interval2 . getMaximumStart ( ) ; Long minFinish2 = interval2 . getMinimumFinish ( ) ; Long maxFinish2 = interval2 . getMaximumFinish ( ) ; return evenHasRelationCheck ( 0 , minStart1 , minStart2 ) && oddHasRelationCheck ( 1 , maxStart1 , maxStart2 ) && evenHasRelationCheck ( 2 , minStart1 , minFinish2 ) && oddHasRelationCheck ( 3 , maxStart1 , maxFinish2 ) && evenHasRelationCheck ( 4 , minFinish1 , minStart2 ) && oddHasRelationCheck ( 5 , maxFinish1 , maxStart2 ) && evenHasRelationCheck ( 6 , minFinish1 , minFinish2 ) && oddHasRelationCheck ( 7 , maxFinish1 , maxFinish2 ) ; } | Determines whether the given intervals have this relation . |
11,506 | public byte [ ] transform ( String className , File file ) throws IOException , IllegalClassFormatException { try { return transform ( className , new FileInputStream ( file ) ) ; } catch ( FileNotFoundException e ) { throw new RuntimeException ( e ) ; } } | Transform a file . |
11,507 | public byte [ ] transform ( String className , InputStream is ) throws IOException , IllegalClassFormatException { try { byte [ ] classBytes = readBytes ( is ) ; return transformer . transform ( classLoader , className , null , null , classBytes ) ; } finally { if ( is != null ) { is . close ( ) ; } } } | Transform a input stream . |
11,508 | public static void writeBytes ( byte [ ] bytes , OutputStream os ) throws IOException { BufferedOutputStream bos = new BufferedOutputStream ( os ) ; ByteArrayInputStream bis = new ByteArrayInputStream ( bytes ) ; byte [ ] buf = new byte [ 1028 ] ; int len ; while ( ( len = bis . read ( buf , 0 , buf . length ) ) > - 1 ) { bos . write ( buf , 0 , len ) ; } bos . flush ( ) ; bos . close ( ) ; bis . close ( ) ; } | Helper method to write bytes to a OutputStream . |
11,509 | public void init ( final String scope ) throws InitializationException , InterruptedException { try { init ( ScopeProcessor . generateScope ( scope ) ) ; } catch ( CouldNotPerformException | NullPointerException ex ) { throw new InitializationException ( this , ex ) ; } } | Initialize the remote on a scope . |
11,510 | public void unlock ( final Object maintainer ) throws CouldNotPerformException { synchronized ( maintainerLock ) { if ( this . maintainer != null && this . maintainer != maintainer ) { throw new CouldNotPerformException ( "Could not unlock remote because it is locked by another instance!" ) ; } this . maintainer = null ; } } | Method unlocks this instance . |
11,511 | public void addHandler ( final Handler handler , final boolean wait ) throws InterruptedException , CouldNotPerformException { try { listener . addHandler ( handler , wait ) ; } catch ( CouldNotPerformException ex ) { throw new CouldNotPerformException ( "Could not register Handler!" , ex ) ; } } | Method adds an handler to the internal rsb listener . |
11,512 | public void deactivate ( final Object maintainer ) throws InterruptedException , CouldNotPerformException , VerificationFailedException { if ( this . maintainer . equals ( maintainer ) ) { synchronized ( maintainerLock ) { unlock ( maintainer ) ; deactivate ( ) ; lock ( maintainer ) ; } } else { throw new VerificationFailedException ( "[" + maintainer + "] is not the current maintainer of this remote" ) ; } } | Atomic deactivate which makes sure that the maintainer stays the same . |
11,513 | private Future < M > sync ( ) { logger . debug ( "Synchronization of Remote[" + this + "] triggered..." ) ; try { validateInitialization ( ) ; try { SyncTaskCallable syncCallable = new SyncTaskCallable ( ) ; final Future < M > currentSyncTask = GlobalCachedExecutorService . submit ( syncCallable ) ; syncCallable . setRelatedFuture ( currentSyncTask ) ; return currentSyncTask ; } catch ( java . util . concurrent . RejectedExecutionException | NullPointerException ex ) { throw new CouldNotPerformException ( "Could not request the current status." , ex ) ; } } catch ( CouldNotPerformException ex ) { return FutureProcessor . canceledFuture ( ex ) ; } } | Method forces a server - remote data sync and returns the new acquired data . Can be useful for initial data sync or data sync after reconnection . |
11,514 | public void shutdown ( ) { try { verifyMaintainability ( ) ; } catch ( VerificationFailedException ex ) { throw new RuntimeException ( "Can not shutdown " + this + "!" , ex ) ; } this . shutdownInitiated = true ; try { dataObservable . shutdown ( ) ; } finally { try { deactivate ( ) ; } catch ( CouldNotPerformException | InterruptedException ex ) { ExceptionPrinter . printHistory ( "Could not shutdown " + this + "!" , ex , logger ) ; } } } | This method deactivates the remote and cleans all resources . |
11,515 | private void notifyPrioritizedObservers ( final M data ) throws CouldNotPerformException { try { internalPrioritizedDataObservable . notifyObservers ( data ) ; } catch ( CouldNotPerformException ex ) { throw ex ; } finally { long newTransactionId = ( Long ) getDataField ( TransactionIdProvider . TRANSACTION_ID_FIELD_NAME ) ; if ( newTransactionId < transactionId && transactionId != 0 ) { logger . warn ( "RemoteService {} received a data object with an older transaction id {} than {}" , this , newTransactionId , transactionId ) ; } transactionId = newTransactionId ; } } | Notify all observers registered on the prioritized observable and retrieve the new transaction id . The transaction id is updated here to guarantee that the prioritized observables have been notified before transaction sync futures return . |
11,516 | public void waitForConnectionState ( final ConnectionState . State connectionState , long timeout ) throws InterruptedException , TimeoutException , CouldNotPerformException { synchronized ( connectionMonitor ) { boolean delayDetected = false ; while ( ! Thread . currentThread ( ) . isInterrupted ( ) ) { if ( this . connectionState . equals ( connectionState ) ) { if ( delayDetected ) { logger . info ( "Continue processing because " + getClass ( ) . getSimpleName ( ) . replace ( "Remote" , "" ) + "[" + getScopeStringRep ( ) + "] is now " + this . connectionState . name ( ) . toLowerCase ( ) + "." ) ; } return ; } failOnShutdown ( "Waiting for connectionState[" + connectionState . name ( ) + "] in connectionState[" + this . connectionState . name ( ) + "] on shutdown" ) ; if ( timeout == 0 ) { connectionMonitor . wait ( 15000 ) ; if ( ! this . connectionState . equals ( connectionState ) ) { failOnShutdown ( "Waiting for connectionState[" + connectionState . name ( ) + "] in connectionState[" + this . connectionState . name ( ) + "] on shutdown" ) ; delayDetected = true ; logger . info ( "Wait for " + this . connectionState . name ( ) . toLowerCase ( ) + " " + getClass ( ) . getSimpleName ( ) . replace ( "Remote" , "" ) + "[" + getScopeStringRep ( ) + "] to be " + connectionState . name ( ) . toLowerCase ( ) + "..." ) ; connectionMonitor . wait ( ) ; } continue ; } connectionMonitor . wait ( timeout ) ; if ( timeout != 0 && ! this . connectionState . equals ( connectionState ) ) { throw new TimeoutException ( "Timeout expired!" ) ; } } } } | Method blocks until the remote reaches the desired connection state . In case the timeout is expired an TimeoutException will be thrown . |
11,517 | public void waitForConnectionState ( final ConnectionState . State connectionState ) throws InterruptedException , CouldNotPerformException { try { waitForConnectionState ( connectionState , 0 ) ; } catch ( TimeoutException ex ) { assert false ; } } | Method blocks until the remote reaches the desired connection state . |
11,518 | private void applyDataUpdate ( final M data ) { this . data = data ; CompletableFutureLite < M > currentSyncFuture = null ; Future < M > currentSyncTask = null ; synchronized ( syncMonitor ) { if ( syncFuture != null ) { currentSyncFuture = syncFuture ; currentSyncTask = syncTask ; syncFuture = null ; syncTask = null ; } } if ( currentSyncFuture != null ) { currentSyncFuture . complete ( data ) ; } if ( currentSyncTask != null && ! currentSyncTask . isDone ( ) ) { currentSyncTask . cancel ( false ) ; } setConnectionState ( CONNECTED ) ; try { notifyPrioritizedObservers ( data ) ; } catch ( CouldNotPerformException ex ) { ExceptionPrinter . printHistory ( new CouldNotPerformException ( "Could not notify data update!" , ex ) , logger ) ; } try { dataObservable . notifyObservers ( data ) ; } catch ( CouldNotPerformException ex ) { ExceptionPrinter . printHistory ( new CouldNotPerformException ( "Could not notify data update to all observer!" , ex ) , logger ) ; } } | Method is used to internally update the data object . |
11,519 | public boolean isInValueSet ( Value value ) { if ( value == null ) { throw new IllegalArgumentException ( "value cannot be null" ) ; } boolean result = true ; if ( ! this . valuesKeySet . isEmpty ( ) ) { result = this . valuesKeySet . contains ( value ) ; } else if ( this . lowerBound != null || this . upperBound != null ) { if ( this . lowerBound != null && ! ValueComparator . GREATER_THAN_OR_EQUAL_TO . compare ( value , this . lowerBound ) ) { result = false ; } if ( this . upperBound != null && ! ValueComparator . LESS_THAN_OR_EQUAL_TO . compare ( value , this . upperBound ) ) { result = false ; } } return result ; } | Returns whether the specified value is in the value set . |
11,520 | public String displayName ( Value value ) { if ( value == null ) { throw new IllegalArgumentException ( "value cannot be null" ) ; } ValueSetElement vse = this . values . get ( value ) ; if ( vse != null ) { return vse . getDisplayName ( ) ; } else { return "" ; } } | Returns a display name for the specified value if one is defined . |
11,521 | public String abbrevDisplayName ( Value value ) { if ( value == null ) { throw new IllegalArgumentException ( "value cannot be null" ) ; } ValueSetElement vse = this . values . get ( value ) ; if ( vse != null ) { return vse . getAbbrevDisplayName ( ) ; } else { return "" ; } } | Returns an abbreviated display name for the specified value if one is defined . |
11,522 | public static boolean isAnyNull ( Object ... _objects ) { if ( _objects == null ) { return true ; } for ( Object obj : _objects ) { if ( obj == null ) { return true ; } } return false ; } | Checks if any of the passed in objects is null . |
11,523 | public static String isAnyFileMissing ( File ... _files ) { if ( _files == null ) { return "null" ; } for ( File obj : _files ) { if ( obj != null && ! obj . exists ( ) ) { return obj . toString ( ) ; } else if ( obj == null ) { return null ; } } return null ; } | Checks if any of the passed in files are non - existing . |
11,524 | public static boolean equalsOne ( Object _obj , Object ... _arrObj ) { if ( _obj == null || _arrObj == null ) { return false ; } for ( Object o : _arrObj ) { if ( o != null && _obj . equals ( o ) ) { return true ; } } return false ; } | Returns true if the specified object equals at least one of the specified other objects . |
11,525 | public static boolean mapContainsKeys ( Map < ? , ? > _map , Object ... _keys ) { if ( _map == null ) { return false ; } else if ( _keys == null ) { return true ; } for ( Object key : _keys ) { if ( key != null && ! _map . containsKey ( key ) ) { return false ; } } return true ; } | Checks whether a map contains all of the specified keys . |
11,526 | public static boolean startsWithAny ( String _str , String ... _startStrings ) { if ( _str == null || _startStrings == null || _startStrings . length == 0 ) { return false ; } for ( String start : _startStrings ) { if ( _str . startsWith ( start ) ) { return true ; } } return false ; } | Checks if given String starts with any of the other given parameters . |
11,527 | public void setInverseIsA ( String ... inverseIsA ) { ProtempaUtil . checkArrayForNullElement ( inverseIsA , "inverseIsA" ) ; ProtempaUtil . checkArrayForDuplicates ( inverseIsA , "inverseIsA" ) ; this . inverseIsA = inverseIsA . clone ( ) ; recalculateChildren ( ) ; } | Sets the children of this proposition definition . |
11,528 | public void reset ( ) { setDisplayName ( null ) ; setAbbreviatedDisplayName ( null ) ; setDescription ( null ) ; setInverseIsA ( ArrayUtils . EMPTY_STRING_ARRAY ) ; setTermIds ( ArrayUtils . EMPTY_STRING_ARRAY ) ; setPropertyDefinitions ( new PropertyDefinition [ ] { } ) ; setReferenceDefinitions ( new ReferenceDefinition [ ] { } ) ; setInDataSource ( false ) ; setAccessed ( null ) ; setCreated ( null ) ; setUpdated ( null ) ; } | Resets this proposition definition to default values . |
11,529 | Set < ElementKind > getKinds ( Element element ) { final ImmutableSet . Builder < ElementKind > kinds = ImmutableSet . builder ( ) ; if ( element . getKind ( ) == ElementKind . INTERFACE ) { kinds . add ( ElementKind . METHOD ) ; } if ( element . getKind ( ) == ElementKind . CLASS ) { kinds . add ( ElementKind . FIELD ) ; if ( element . getModifiers ( ) . contains ( Modifier . ABSTRACT ) ) { kinds . add ( ElementKind . METHOD ) ; } } return kinds . build ( ) ; } | Get the set of supported element kinds that make up the total set of fields for this type . |
11,530 | public String generateClause ( ) { StringBuilder wherePart = new StringBuilder ( ) ; wherePart . append ( referenceIndices . generateColumnReference ( columnSpec ) ) ; if ( not ) { wherePart . append ( " NOT" ) ; } wherePart . append ( " IN (" ) ; for ( int k = 0 ; k < elements . length ; k ++ ) { Object val = elements [ k ] ; wherePart . append ( SqlGeneratorUtil . prepareValue ( val ) ) ; if ( k + 1 < elements . length ) { if ( ( k + 1 ) % 1000 == 0 ) { wherePart . append ( ") OR " ) ; wherePart . append ( referenceIndices . generateColumnReference ( columnSpec ) ) ; wherePart . append ( " IN (" ) ; } else { wherePart . append ( ',' ) ; } } } wherePart . append ( ')' ) ; return wherePart . toString ( ) ; } | Oracle doesn t allow more than 1000 elements in an IN clause so if we want more than 1000 we create multiple IN clauses chained together by OR . |
11,531 | public Filter [ ] filterChainToArray ( ) { int length = chainLength ( ) ; Filter [ ] array = new Filter [ length ] ; Filter thisFilter = this ; for ( int i = 0 ; i < length ; i ++ ) { array [ i ] = thisFilter ; thisFilter = thisFilter . getAnd ( ) ; } return array ; } | Return an array that contains all of the filters in the chain . |
11,532 | public void handleQueryResult ( String key , List < Proposition > propositions , Map < Proposition , Set < Proposition > > forwardDerivations , Map < Proposition , Set < Proposition > > backwardDerivations , Map < UniqueId , Proposition > references ) throws QueryResultsHandlerProcessingException { Set < Proposition > propositionsAsSet = new HashSet < > ( ) ; addDerived ( propositions , forwardDerivations , backwardDerivations , propositionsAsSet ) ; List < Proposition > propositionsCopy = new ArrayList < > ( propositionsAsSet ) ; for ( Comparator < Proposition > c : this . comparator ) { Collections . sort ( propositionsCopy , c ) ; } this . visitor . setKeyId ( key ) ; try { this . visitor . visit ( propositionsCopy ) ; } catch ( TabDelimHandlerProtempaException pe ) { throw new QueryResultsHandlerProcessingException ( pe ) ; } catch ( ProtempaException pe ) { throw new AssertionError ( pe ) ; } } | Writes a keys worth of data in tab delimited format optionally sorted . |
11,533 | public boolean addPrimitiveParameterId ( String paramId ) { boolean result = this . paramIds . add ( paramId ) ; if ( result ) { recalculateChildren ( ) ; } return result ; } | Adds a primitive parameter from which this abstraction is inferred . |
11,534 | public boolean removePrimitiveParameterId ( String paramId ) { boolean result = this . paramIds . remove ( paramId ) ; if ( result ) { recalculateChildren ( ) ; } return result ; } | Removes a primitive parameter from which this abstraction is inferred . |
11,535 | public Algorithm readAlgorithm ( String id ) throws AlgorithmSourceReadException { Algorithm result = null ; if ( id != null ) { if ( algorithms != null ) { result = algorithms . getAlgorithm ( id ) ; } if ( result == null ) { initializeIfNeeded ( ) ; for ( AlgorithmSourceBackend backend : getBackends ( ) ) { result = backend . readAlgorithm ( id , algorithms ) ; if ( result != null ) { break ; } } } } return result ; } | Read an algorithm with the given id . |
11,536 | public Set < Algorithm > readAlgorithms ( ) throws AlgorithmSourceReadException { initializeIfNeeded ( ) ; if ( algorithms != null ) { if ( ! readAlgorithmsCalled && getBackends ( ) != null ) { for ( AlgorithmSourceBackend backend : getBackends ( ) ) { backend . readAlgorithms ( algorithms ) ; } readAlgorithmsCalled = true ; } return algorithms . getAlgorithms ( ) ; } return Collections . emptySet ( ) ; } | Reads all algorithms in this algorithm source . |
11,537 | public static HierarchicalConfiguration getHierarchicalConfiguration ( final Configuration configuration ) { if ( configuration instanceof CompositeConfiguration ) { final CompositeConfiguration compositeConfig = ( CompositeConfiguration ) configuration ; for ( int i = 0 ; i < compositeConfig . getNumberOfConfigurations ( ) ; i ++ ) { if ( compositeConfig . getConfiguration ( i ) instanceof HierarchicalConfiguration ) { return ( HierarchicalConfiguration ) compositeConfig . getConfiguration ( i ) ; } } } return null ; } | returns the hierarchical part of a configuration |
11,538 | public static Configuration createCompositeConfiguration ( final Class < ? > clazz , final Configuration configuration ) { final CompositeConfiguration compositeConfiguration = new CompositeConfiguration ( ) ; final Configuration defaultConfiguration = ConfigurationFactory . getDefaultConfiguration ( ) ; if ( configuration != null ) { compositeConfiguration . addConfiguration ( configuration ) ; } compositeConfiguration . addConfiguration ( defaultConfiguration ) ; return compositeConfiguration ; } | create a composite configuration that wraps the configuration sent by the user . this util will also load the defaultConfig . properties file loaded relative to the given clazz parameter |
11,539 | private static String getInnerMapKey ( final String key ) { final int index = key . indexOf ( "." ) ; return key . substring ( index + 1 ) ; } | create inner key map by taking what ever is after the first dot . |
11,540 | private static String stripKey ( final String key ) { int index = key . indexOf ( "." ) ; if ( index > 0 ) { return key . substring ( 0 , index ) ; } return null ; } | strip the original key by taking every thing from the start of the original key to the first dot . |
11,541 | public static boolean isHexadecimal ( String value ) { if ( value == null || value . length ( ) == 0 ) { return false ; } if ( ! HEX_REGEX_PATTERN . matcher ( value ) . matches ( ) ) { return false ; } return true ; } | return if the given string is a valid hexadecimal string |
11,542 | public boolean evaluateCondition ( ExecutionContext context ) { Value v = condition . getValue ( context ) ; return ! ( v instanceof NilValue || ( v instanceof BooleanValue && ! ( ( BooleanValue ) v ) . get ( ) ) ) ; } | Evaluates the elsif condition . |
11,543 | void grab ( KnowledgeHelper kh ) { assert kh != null : "kh cannot be null" ; assert this . kh == null : "The previous user of this copier forgot to call release!" ; if ( this . kh != null ) { LOGGER . log ( Level . WARNING , "The previous user of this copier forgot to call release. This causes a memory leak!" ) ; } this . kh = kh ; this . uniqueIdProvider = new ProviderBasedUniqueIdFactory ( new JBossRulesDerivedLocalUniqueIdValuesProvider ( this . kh . getWorkingMemory ( ) , this . propId ) ) ; } | Grabs this copier for use by a Drools consequence . |
11,544 | static String [ ] parsePackages ( String packages ) { if ( packages == null || packages . trim ( ) . length ( ) == 0 ) { return new String [ 0 ] ; } String [ ] commaSplit = packages . split ( "," ) ; String [ ] processPackages = new String [ commaSplit . length ] ; for ( int i = 0 ; i < commaSplit . length ; i ++ ) { processPackages [ i ] = convert ( commaSplit [ i ] ) ; } return processPackages ; } | Split using delimiter and convert to slash notation . |
11,545 | static DetectQueryBean convert ( Collection < String > packages ) { String [ ] asArray = packages . toArray ( new String [ packages . size ( ) ] ) ; for ( int i = 0 ; i < asArray . length ; i ++ ) { asArray [ i ] = convert ( asArray [ i ] ) ; } return new DetectQueryBean ( asArray ) ; } | Convert the dot notation entity bean packages to slash notation . |
11,546 | private static String convert ( String pkg ) { pkg = pkg . trim ( ) ; if ( pkg . endsWith ( "*" ) ) { pkg = pkg . substring ( 0 , pkg . length ( ) - 1 ) ; } if ( pkg . endsWith ( ".query" ) ) { pkg = pkg . substring ( 0 , pkg . length ( ) - 6 ) ; } pkg = pkg . replace ( '.' , '/' ) ; return pkg . endsWith ( "/" ) ? pkg : pkg + "/" ; } | Concert package to slash notation taking into account trailing wildcard . |
11,547 | protected CloseableLockProvider getManageLock ( ) { return new CloseableLockProvider ( ) { public CloseableReadLockWrapper getCloseableReadLock ( final Object consumer ) { return getManageReadLock ( consumer ) ; } public CloseableWriteLockWrapper getCloseableWriteLock ( final Object consumer ) { return getManageWriteLock ( consumer ) ; } } ; } | This method generates a closable lock provider . Be informed that the controller and all its services are directly locked and internal builder operations are queued . Therefore please release the locks after usage otherwise the overall processing pipeline is delayed . |
11,548 | public void notifyChange ( ) throws CouldNotPerformException , InterruptedException { logger . debug ( "Notify data change of " + this ) ; M newData ; manageLock . lockWrite ( this ) ; try { try { validateInitialization ( ) ; } catch ( final NotInitializedException ex ) { if ( destroyed ) { return ; } throw ex ; } newData = updateDataToPublish ( cloneDataBuilder ( ) ) ; Event event = new Event ( informer . getScope ( ) , newData . getClass ( ) , newData ) ; event . getMetaData ( ) . setUserTime ( RPCHelper . USER_TIME_KEY , System . nanoTime ( ) ) ; if ( isActive ( ) ) { try { waitForMiddleware ( NOTIFICATILONG_TIMEOUT , TimeUnit . MILLISECONDS ) ; informer . publish ( event ) ; } catch ( TimeoutException ex ) { ExceptionPrinter . printHistory ( new CouldNotPerformException ( "Skip data update notification because middleware is not ready since " + TimeUnit . MILLISECONDS . toSeconds ( NOTIFICATILONG_TIMEOUT ) + " seconds of " + this + "!" , ex ) , logger , LogLevel . WARN ) ; } catch ( CouldNotPerformException ex ) { ExceptionPrinter . printHistory ( new CouldNotPerformException ( "Could not inform about data change of " + this + "!" , ex ) , logger ) ; } } } finally { manageLock . unlockWrite ( this ) ; } try { notifyDataUpdate ( newData ) ; } catch ( CouldNotPerformException ex ) { ExceptionPrinter . printHistory ( new CouldNotPerformException ( "Could not notify data update!" , ex ) , logger ) ; } dataObserver . notifyObservers ( newData ) ; } | Synchronize all registered remote instances about a data change . |
11,549 | public Boolean isReady ( ) { try { validateInitialization ( ) ; validateActivation ( ) ; validateMiddleware ( ) ; return true ; } catch ( InvalidStateException e ) { return false ; } } | Method returns true if this instance was initialized activated and is successfully connected to the middleware . |
11,550 | synchronized boolean removeRelation ( Interval i1 , Interval i2 ) { if ( i1 == i2 || ! containsInterval ( i1 ) || ! containsInterval ( i2 ) ) { return false ; } Object i1Start = i1 . getStart ( ) ; Object i1Finish = i1 . getFinish ( ) ; Object i2Start = i2 . getStart ( ) ; Object i2Finish = i2 . getFinish ( ) ; directedGraph . setEdge ( i1Start , i2Start , null ) ; directedGraph . setEdge ( i1Start , i2Finish , null ) ; directedGraph . setEdge ( i2Start , i1Start , null ) ; directedGraph . setEdge ( i2Start , i1Finish , null ) ; directedGraph . setEdge ( i1Finish , i2Start , null ) ; directedGraph . setEdge ( i1Finish , i2Finish , null ) ; directedGraph . setEdge ( i2Finish , i1Start , null ) ; directedGraph . setEdge ( i2Finish , i1Finish , null ) ; calcMinDuration = null ; calcMaxDuration = null ; calcMinFinish = null ; calcMaxFinish = null ; calcMinStart = null ; calcMaxStart = null ; shortestDistancesFromTimeZeroSource = null ; shortestDistancesFromTimeZeroDestination = null ; return true ; } | Remove the distance relation between two intervals if such a relation exists . |
11,551 | synchronized boolean removeInterval ( Interval i ) { calcMinDuration = null ; calcMaxDuration = null ; calcMinFinish = null ; calcMaxFinish = null ; calcMinStart = null ; calcMaxStart = null ; shortestDistancesFromTimeZeroSource = null ; shortestDistancesFromTimeZeroDestination = null ; if ( directedGraph . remove ( i . getStart ( ) ) != null ) { if ( directedGraph . remove ( i . getFinish ( ) ) == null ) { throw new IllegalStateException ( ) ; } intervals . remove ( i ) ; return true ; } else { return false ; } } | Remove an interval from this graph . |
11,552 | private boolean containsInterval ( Interval i ) { if ( i != null ) { return directedGraph . contains ( i . getStart ( ) ) && directedGraph . contains ( i . getFinish ( ) ) ; } else { return false ; } } | Determine if an interval is contained in this graph . |
11,553 | synchronized boolean addInterval ( Interval i ) { if ( i == null || containsInterval ( i ) || ! intervals . add ( i ) ) { return false ; } Object iStart = i . getStart ( ) ; Object iFinish = i . getFinish ( ) ; directedGraph . add ( iStart ) ; directedGraph . add ( iFinish ) ; Weight mindur = i . getSpecifiedMinimumLength ( ) ; Weight maxdur = i . getSpecifiedMaximumLength ( ) ; directedGraph . setEdge ( iStart , iFinish , maxdur ) ; directedGraph . setEdge ( iFinish , iStart , mindur . invertSign ( ) ) ; Weight minstart = i . getSpecifiedMinimumStart ( ) ; Weight maxstart = i . getSpecifiedMaximumStart ( ) ; directedGraph . setEdge ( timeZero , iStart , maxstart ) ; directedGraph . setEdge ( iStart , timeZero , minstart . invertSign ( ) ) ; Weight minfinish = i . getSpecifiedMinimumFinish ( ) ; Weight maxfinish = i . getSpecifiedMaximumFinish ( ) ; directedGraph . setEdge ( timeZero , iFinish , maxfinish ) ; directedGraph . setEdge ( iFinish , timeZero , minfinish . invertSign ( ) ) ; calcMinDuration = null ; calcMaxDuration = null ; calcMinFinish = null ; calcMaxFinish = null ; calcMinStart = null ; calcMaxStart = null ; shortestDistancesFromTimeZeroSource = null ; shortestDistancesFromTimeZeroDestination = null ; return true ; } | Add an interval to this graph . |
11,554 | synchronized Weight getMinimumStart ( ) { if ( calcMinStart == null ) { Weight result = WeightFactory . NEG_INFINITY ; if ( shortestDistancesFromTimeZeroDestination == null ) { shortestDistancesFromTimeZeroDestination = BellmanFord . calcShortestDistances ( timeZero , directedGraph , BellmanFord . Mode . DESTINATION ) ; if ( shortestDistancesFromTimeZeroDestination == null ) { throw new IllegalStateException ( "Negative cycle detected!" ) ; } } for ( int i = 0 , n = intervals . size ( ) ; i < n ; i ++ ) { Object start = intervals . get ( i ) . getStart ( ) ; result = Weight . max ( result , ( Weight ) shortestDistancesFromTimeZeroDestination . get ( start ) ) ; } calcMinStart = result . invertSign ( ) ; } return calcMinStart ; } | Calculates and returns the minimum path from time zero to the start of an interval . |
11,555 | synchronized Weight getMaximumStart ( ) { if ( calcMaxStart == null ) { Weight result = WeightFactory . POS_INFINITY ; if ( shortestDistancesFromTimeZeroSource == null ) { shortestDistancesFromTimeZeroSource = BellmanFord . calcShortestDistances ( timeZero , directedGraph , BellmanFord . Mode . SOURCE ) ; if ( shortestDistancesFromTimeZeroSource == null ) { throw new IllegalStateException ( "Negative cycle detected!" ) ; } } for ( int i = 0 , n = intervals . size ( ) ; i < n ; i ++ ) { Object start = intervals . get ( i ) . getStart ( ) ; result = Weight . min ( result , ( Weight ) shortestDistancesFromTimeZeroSource . get ( start ) ) ; } calcMaxStart = result ; } return calcMaxStart ; } | Calculates and returns the maximum path from time zero to the start of an interval . |
11,556 | synchronized Weight getMinimumFinish ( ) { if ( calcMinFinish == null ) { Weight result = WeightFactory . POS_INFINITY ; if ( shortestDistancesFromTimeZeroDestination == null ) { shortestDistancesFromTimeZeroDestination = BellmanFord . calcShortestDistances ( timeZero , directedGraph , BellmanFord . Mode . DESTINATION ) ; if ( shortestDistancesFromTimeZeroDestination == null ) { throw new IllegalStateException ( "Negative cycle detected!" ) ; } } for ( int i = 0 , n = intervals . size ( ) ; i < n ; i ++ ) { Object finish = intervals . get ( i ) . getFinish ( ) ; result = Weight . min ( result , ( Weight ) shortestDistancesFromTimeZeroDestination . get ( finish ) ) ; } calcMinFinish = result . invertSign ( ) ; } return calcMinFinish ; } | Calculates and returns the minimum path from time zero to the finish of an interval . |
11,557 | synchronized Weight getMaximumFinish ( ) { if ( calcMaxFinish == null ) { Weight result = WeightFactory . NEG_INFINITY ; if ( shortestDistancesFromTimeZeroSource == null ) { shortestDistancesFromTimeZeroSource = BellmanFord . calcShortestDistances ( timeZero , directedGraph , BellmanFord . Mode . SOURCE ) ; if ( shortestDistancesFromTimeZeroSource == null ) { throw new IllegalStateException ( "Negative cycle detected!" ) ; } } for ( int i = 0 , n = intervals . size ( ) ; i < n ; i ++ ) { Object finish = intervals . get ( i ) . getFinish ( ) ; result = Weight . max ( result , ( Weight ) shortestDistancesFromTimeZeroSource . get ( finish ) ) ; } calcMaxFinish = result ; } return calcMaxFinish ; } | Calculates and returns the maximum path from time zero to the finish of an interval . |
11,558 | synchronized Weight getMaximumDuration ( ) { if ( calcMaxDuration == null ) { Weight max = WeightFactory . ZERO ; for ( int i = 0 , n = intervals . size ( ) ; i < n ; i ++ ) { Object start = intervals . get ( i ) . getStart ( ) ; Map < ? , Weight > d = BellmanFord . calcShortestDistances ( start , directedGraph , BellmanFord . Mode . SOURCE ) ; if ( d == null ) { throw new IllegalStateException ( "Negative cycle detected!" ) ; } for ( int j = 0 ; j < n ; j ++ ) { Object finish = intervals . get ( j ) . getFinish ( ) ; max = Weight . max ( max , d . get ( finish ) ) ; } } calcMaxDuration = max ; } return calcMaxDuration ; } | Calculates and returns the maximum time distance from the start of an interval to the finish of an interval . |
11,559 | synchronized Weight getMinimumDuration ( ) { if ( calcMinDuration == null ) { Weight min = WeightFactory . POS_INFINITY ; for ( int i = 0 , n = intervals . size ( ) ; i < n ; i ++ ) { Object finish = intervals . get ( i ) . getFinish ( ) ; Map < ? , Weight > d = BellmanFord . calcShortestDistances ( finish , directedGraph , BellmanFord . Mode . SOURCE ) ; if ( d == null ) { throw new IllegalStateException ( "Negative cycle detected!" ) ; } for ( int j = 0 ; j < n ; j ++ ) { Object start = intervals . get ( j ) . getStart ( ) ; min = Weight . min ( min , d . get ( start ) ) ; } } calcMinDuration = min . invertSign ( ) ; } return calcMinDuration ; } | Calculates and returns the minimum time distance from the start of an interval to the finish of an interval . |
11,560 | public void send ( StDatapoint datapoint ) { StDatapointValidator . validate ( datapoint ) ; sender . send ( Collections . singletonList ( datapoint ) ) ; } | Send datapoint . |
11,561 | public void send ( List < StDatapoint > datapoints ) { for ( StDatapoint metric : datapoints ) { StDatapointValidator . validate ( metric ) ; } sender . send ( datapoints ) ; } | Send datapoints list . |
11,562 | public final void addSourceListener ( SourceListener < S > listener ) { if ( listener != null ) { this . listenerList . add ( listener ) ; } } | Adds a listener that gets called whenever something changes . |
11,563 | protected void fireSourceUpdated ( S e ) { for ( int i = 0 , n = this . listenerList . size ( ) ; i < n ; i ++ ) { this . listenerList . get ( i ) . sourceUpdated ( e ) ; } } | Notifies registered listeners that the source has been updated . |
11,564 | private static void removeNonApplicableFilters ( Collection < EntitySpec > entitySpecs , Set < Filter > filtersCopy , EntitySpec entitySpec ) { Set < EntitySpec > entitySpecsSet = new HashSet < > ( ) ; Set < String > filterPropIds = new HashSet < > ( ) ; String [ ] entitySpecPropIds = entitySpec . getPropositionIds ( ) ; for ( Iterator < Filter > itr = filtersCopy . iterator ( ) ; itr . hasNext ( ) ; ) { Filter f = itr . next ( ) ; Arrays . addAll ( filterPropIds , f . getPropositionIds ( ) ) ; for ( EntitySpec es : entitySpecs ) { if ( Collections . containsAny ( filterPropIds , es . getPropositionIds ( ) ) ) { entitySpecsSet . add ( es ) ; } } if ( Collections . containsAny ( filterPropIds , entitySpecPropIds ) ) { return ; } if ( ! atLeastOneInInboundReferences ( entitySpecsSet , entitySpec ) ) { itr . remove ( ) ; } entitySpecsSet . clear ( ) ; filterPropIds . clear ( ) ; } } | Remove filters that are not directly applicable to the given entity spec and are not applicable to other entity specs that refer to it . |
11,565 | static boolean needsPropIdInClause ( Set < String > queryPropIds , String [ ] entitySpecPropIds ) { Set < String > entitySpecPropIdsSet = Arrays . asSet ( entitySpecPropIds ) ; List < String > filteredPropIds = new ArrayList < > ( entitySpecPropIds . length ) ; for ( String propId : queryPropIds ) { if ( entitySpecPropIdsSet . contains ( propId ) ) { filteredPropIds . add ( propId ) ; } } return ( filteredPropIds . size ( ) < entitySpecPropIds . length * 0.85f ) && ( filteredPropIds . size ( ) <= 2000 ) ; } | Returns whether an IN clause containing the proposition ids of interest should be added to the WHERE clause . |
11,566 | private String getVersion ( final Class launcherClass , final String groupId , final String artifactId ) throws NotAvailableException { String version = null ; try { Properties p = new Properties ( ) ; InputStream is = getClass ( ) . getResourceAsStream ( "/META-INF/maven/" + groupId + "/" + artifactId + "/pom.properties" ) ; if ( is != null ) { p . load ( is ) ; version = p . getProperty ( "version" , "" ) ; } } catch ( Exception e ) { } if ( version == null ) { Package launcherPackage = launcherClass . getClass ( ) . getPackage ( ) ; if ( launcherPackage != null ) { version = launcherPackage . getImplementationVersion ( ) ; if ( version == null ) { version = launcherPackage . getSpecificationVersion ( ) ; } } } if ( version == null ) { throw new NotAvailableException ( "Application Version" ) ; } return version ; } | Method tries to detect the application Version . |
11,567 | public void init ( String strDateParam , Date dateTarget , String strLanguage ) { if ( strDateParam != null ) dateParam = strDateParam ; initComponents ( ) ; this . setName ( "JCalendarPopup" ) ; nowDate = new Date ( ) ; if ( dateTarget == null ) dateTarget = nowDate ; selectedDate = dateTarget ; if ( strLanguage != null ) { Locale locale = new Locale ( strLanguage , "" ) ; if ( locale != null ) { calendar = Calendar . getInstance ( locale ) ; dateFormat = DateFormat . getDateInstance ( DateFormat . FULL , locale ) ; } } calendar . setTime ( dateTarget ) ; calendar . set ( Calendar . HOUR_OF_DAY , 12 ) ; calendar . set ( Calendar . MINUTE , 0 ) ; calendar . set ( Calendar . SECOND , 0 ) ; calendar . set ( Calendar . MILLISECOND , 0 ) ; targetDate = calendar . getTime ( ) ; this . layoutCalendar ( targetDate ) ; if ( dateTarget == nowDate ) selectedDate = targetDate ; } | Creates new form CalendarPopup . |
11,568 | private void nextMonthActionPerformed ( ActionEvent evt ) { calendar . setTime ( targetPanelDate ) ; calendar . add ( Calendar . MONTH , 1 ) ; calendar . set ( Calendar . HOUR_OF_DAY , 12 ) ; calendar . set ( Calendar . MINUTE , 0 ) ; calendar . set ( Calendar . SECOND , 0 ) ; calendar . set ( Calendar . MILLISECOND , 0 ) ; targetPanelDate = calendar . getTime ( ) ; this . layoutCalendar ( targetPanelDate ) ; } | User pressed the next month button change the calendar . |
11,569 | private void nextYearActionPerformed ( ActionEvent evt ) { calendar . setTime ( targetPanelDate ) ; calendar . add ( Calendar . YEAR , 1 ) ; calendar . set ( Calendar . HOUR_OF_DAY , 12 ) ; calendar . set ( Calendar . MINUTE , 0 ) ; calendar . set ( Calendar . SECOND , 0 ) ; calendar . set ( Calendar . MILLISECOND , 0 ) ; targetPanelDate = calendar . getTime ( ) ; this . layoutCalendar ( targetPanelDate ) ; } | User pressed the next year button change the calendar . |
11,570 | public Date getFirstDateInCalendar ( Date dateTarget ) { int iFirstDayOfWeek = calendar . getFirstDayOfWeek ( ) ; calendar . setTime ( dateTarget ) ; int iTargetDayOfWeek = calendar . get ( Calendar . DAY_OF_WEEK ) ; int iOffset = - Math . abs ( iTargetDayOfWeek - iFirstDayOfWeek ) ; calendar . add ( Calendar . DATE , iOffset ) ; calendar . set ( Calendar . HOUR_OF_DAY , 0 ) ; calendar . set ( Calendar . MINUTE , 0 ) ; calendar . set ( Calendar . SECOND , 0 ) ; calendar . set ( Calendar . MILLISECOND , 0 ) ; return calendar . getTime ( ) ; } | Given the first date of the calendar get the first date of that week . |
11,571 | public void mouseEntered ( MouseEvent evt ) { JLabel button = ( JLabel ) evt . getSource ( ) ; oldBorder = button . getBorder ( ) ; button . setBorder ( ROLLOVER_BORDER ) ; } | Invoked when the mouse enters a component . |
11,572 | public void mouseExited ( MouseEvent evt ) { JLabel button = ( JLabel ) evt . getSource ( ) ; button . setBorder ( oldBorder ) ; } | Invoked when the mouse exits a component . |
11,573 | private JPopupMenu getJPopupMenu ( ) { Container parent = this . getParent ( ) ; while ( parent != null ) { if ( parent instanceof JPopupMenu ) return ( JPopupMenu ) parent ; parent = parent . getParent ( ) ; } return null ; } | Get the parent popup menu . |
11,574 | public void setText ( final String text ) { this . text . setText ( text ) ; this . text . setFont ( Font . font ( this . text . getFont ( ) . getFamily ( ) , FontWeight . BOLD , size / 2 ) ) ; stack . requestLayout ( ) ; } | Method sets the text displayed next to the logo . |
11,575 | public void setSvgIcon ( final SVGIcon svgIcon ) { if ( this . svgIcon != null ) { stack . getChildren ( ) . remove ( this . svgIcon ) ; } this . svgIcon = svgIcon ; this . svgIcon . setSize ( size ) ; stack . getChildren ( ) . add ( this . svgIcon ) ; stack . requestLayout ( ) ; } | Method sets the icon to display . |
11,576 | public void setSize ( final double size ) { this . size = size ; stack . setPrefSize ( size , size ) ; text . setFont ( Font . font ( text . getFont ( ) . getFamily ( ) , FontWeight . BOLD , size / 2 ) ) ; svgIcon . setSize ( size ) ; stack . requestLayout ( ) ; } | Method can be used to set the size of this component . |
11,577 | public static < T extends TemporalProposition > List < T > getView ( List < T > params , Long minValid , Long maxValid ) { if ( params != null ) { if ( minValid == null && maxValid == null ) { return params ; } else { int min = minValid != null ? binarySearchMinStart ( params , minValid . longValue ( ) ) : 0 ; int max = maxValid != null ? binarySearchMaxFinish ( params , maxValid . longValue ( ) ) : params . size ( ) ; return params . subList ( min , max ) ; } } else { return null ; } } | Filters a list of temporal propositions by time . |
11,578 | public static < T extends Proposition > Map < String , List < T > > createPropositionMap ( List < T > propositions ) { Map < String , List < T > > result = new HashMap < > ( ) ; if ( propositions != null ) { for ( T prop : propositions ) { String propId = prop . getId ( ) ; List < T > ts = null ; if ( result . containsKey ( propId ) ) { ts = result . get ( propId ) ; } else { ts = new ArrayList < > ( ) ; result . put ( propId , ts ) ; } ts . add ( prop ) ; } } return result ; } | Divides a list of propositions up by id . |
11,579 | public Builder removeTimestamps ( final Builder builder ) { final Descriptors . Descriptor descriptorForType = builder . getDescriptorForType ( ) ; for ( final Descriptors . FieldDescriptor field : descriptorForType . getFields ( ) ) { if ( ! field . isRepeated ( ) && field . getType ( ) == Descriptors . FieldDescriptor . Type . MESSAGE ) { if ( field . getName ( ) . equals ( RESOURCE_ALLOCATION_FIELD ) ) { continue ; } if ( field . getMessageType ( ) . getName ( ) . equals ( TIMESTAMP_MESSAGE_NAME ) ) { builder . clearField ( field ) ; } else { if ( builder . hasField ( field ) ) { removeTimestamps ( builder . getFieldBuilder ( field ) ) ; } } } } return builder ; } | Recursively clear timestamp messages from a builder . For efficiency repeated fields are ignored . |
11,580 | public static < M extends MessageOrBuilder > M updateTimestampWithCurrentTime ( final M messageOrBuilder ) throws CouldNotPerformException { return updateTimestamp ( System . currentTimeMillis ( ) , messageOrBuilder ) ; } | Method updates the timestamp field of the given message with the current time . |
11,581 | public static < M extends MessageOrBuilder > M updateTimestamp ( final long milliseconds , final M messageOrBuilder ) throws CouldNotPerformException { return updateTimestamp ( milliseconds , messageOrBuilder , TimeUnit . MILLISECONDS ) ; } | Method updates the timestamp field of the given message with the given timestamp . |
11,582 | public static < M extends MessageOrBuilder > M updateTimestamp ( final long time , final M messageOrBuilder , final TimeUnit timeUnit ) throws CouldNotPerformException { long milliseconds = TimeUnit . MILLISECONDS . convert ( time , timeUnit ) ; try { if ( messageOrBuilder == null ) { throw new NotAvailableException ( "messageOrBuilder" ) ; } try { if ( messageOrBuilder . getClass ( ) . getSimpleName ( ) . equals ( "Builder" ) ) { messageOrBuilder . getClass ( ) . getMethod ( SET + TIMESTAMP_NAME , Timestamp . class ) . invoke ( messageOrBuilder , TimestampJavaTimeTransform . transform ( milliseconds ) ) ; return messageOrBuilder ; } final Object builder = messageOrBuilder . getClass ( ) . getMethod ( "toBuilder" ) . invoke ( messageOrBuilder ) ; builder . getClass ( ) . getMethod ( SET + TIMESTAMP_NAME , Timestamp . class ) . invoke ( builder , TimestampJavaTimeTransform . transform ( milliseconds ) ) ; return ( M ) builder . getClass ( ) . getMethod ( "build" ) . invoke ( builder ) ; } catch ( IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException ex ) { throw new NotSupportedException ( "Field[Timestamp]" , messageOrBuilder . getClass ( ) . getName ( ) , ex ) ; } } catch ( CouldNotPerformException ex ) { throw new CouldNotPerformException ( "Could not update timestemp! " , ex ) ; } } | Method updates the timestamp field of the given message with the given time in the given timeUnit . |
11,583 | public static < M extends MessageOrBuilder > M updateTimestamp ( final long timestamp , final M messageOrBuilder , final TimeUnit timeUnit , final Logger logger ) { try { return updateTimestamp ( timestamp , messageOrBuilder , timeUnit ) ; } catch ( CouldNotPerformException ex ) { ExceptionPrinter . printHistory ( ex , logger ) ; return messageOrBuilder ; } } | Method updates the timestamp field of the given message with the given timestamp . In case of an error the original message is returned . |
11,584 | public static < M extends MessageOrBuilder > M updateTimestampWithCurrentTime ( final M messageOrBuilder , final Logger logger ) { try { return updateTimestampWithCurrentTime ( messageOrBuilder ) ; } catch ( CouldNotPerformException ex ) { ExceptionPrinter . printHistory ( ex , logger ) ; return messageOrBuilder ; } } | Method updates the timestamp field of the given message with the current time . In case of an error the original message is returned . |
11,585 | public static boolean hasTimestamp ( final MessageOrBuilder messageOrBuilder ) { try { final FieldDescriptor fieldDescriptor = ProtoBufFieldProcessor . getFieldDescriptor ( messageOrBuilder , TIMESTAMP_FIELD_NAME ) ; return messageOrBuilder . hasField ( fieldDescriptor ) ; } catch ( NotAvailableException ex ) { return false ; } } | Method return true if the given message contains a timestamp field . |
11,586 | protected final void setApplicationName ( String applicationName ) throws IllegalArgumentException { validateNotEmpty ( applicationName , "applicationName" ) ; synchronized ( this ) { properties . put ( APPLICATION_NAME , applicationName ) ; } } | Sets the application name . |
11,587 | protected final void setPageName ( String pageName ) throws IllegalArgumentException { validateNotEmpty ( pageName , "pageName" ) ; synchronized ( this ) { properties . put ( PAGE_NAME , pageName ) ; } } | Set the page name . |
11,588 | public BitcoinURI resolve ( String label , String currency , boolean validateTLSA ) throws WalletNameLookupException { String resolved ; label = label . toLowerCase ( ) ; currency = currency . toLowerCase ( ) ; if ( label . isEmpty ( ) ) { throw new WalletNameLookupException ( "Wallet Name Label Must Non-Empty" ) ; } try { resolved = this . resolver . resolve ( String . format ( "_%s._wallet.%s" , currency , DNSUtil . ensureDot ( this . preprocessWalletName ( label ) ) ) , Type . TXT ) ; if ( resolved == null || resolved . equals ( "" ) ) { throw new WalletNameCurrencyUnavailableException ( "Currency Not Available in Wallet Name" ) ; } } catch ( DNSSECException e ) { if ( this . backupDnsServerIndex >= this . resolver . getBackupDnsServers ( ) . size ( ) ) { throw new WalletNameLookupException ( e . getMessage ( ) , e ) ; } this . resolver . useBackupDnsServer ( this . backupDnsServerIndex ++ ) ; return this . resolve ( label , currency , validateTLSA ) ; } byte [ ] decodeResult = BaseEncoding . base64 ( ) . decode ( resolved ) ; try { URL walletNameUrl = new URL ( new String ( decodeResult ) ) ; return processWalletNameUrl ( walletNameUrl , validateTLSA ) ; } catch ( MalformedURLException e ) { } try { this . backupDnsServerIndex = 0 ; return new BitcoinURI ( resolved ) ; } catch ( BitcoinURIParseException e ) { try { return new BitcoinURI ( "bitcoin:" + resolved ) ; } catch ( BitcoinURIParseException e1 ) { throw new WalletNameLookupException ( "BitcoinURI Creation Failed for " + resolved , e1 ) ; } } } | Resolve a Wallet Name |
11,589 | public BitcoinURI processWalletNameUrl ( URL url , boolean verifyTLSA ) throws WalletNameLookupException { HttpsURLConnection conn = null ; InputStream ins ; InputStreamReader isr ; BufferedReader in = null ; Certificate possibleRootCert = null ; if ( verifyTLSA ) { try { if ( ! this . tlsaValidator . validateTLSA ( url ) ) { throw new WalletNameTlsaValidationException ( "TLSA Validation Failed" ) ; } } catch ( ValidSelfSignedCertException ve ) { possibleRootCert = ve . getRootCert ( ) ; } catch ( Exception e ) { throw new WalletNameTlsaValidationException ( "TLSA Validation Failed" , e ) ; } } try { conn = ( HttpsURLConnection ) url . openConnection ( ) ; if ( possibleRootCert != null ) { try { KeyStore ssKeystore = KeyStore . getInstance ( KeyStore . getDefaultType ( ) ) ; ssKeystore . load ( null , null ) ; ssKeystore . setCertificateEntry ( ( ( X509Certificate ) possibleRootCert ) . getSubjectDN ( ) . toString ( ) , possibleRootCert ) ; TrustManagerFactory tmf = TrustManagerFactory . getInstance ( TrustManagerFactory . getDefaultAlgorithm ( ) ) ; tmf . init ( ssKeystore ) ; SSLContext ctx = SSLContext . getInstance ( "TLS" ) ; ctx . init ( null , tmf . getTrustManagers ( ) , null ) ; conn . setSSLSocketFactory ( ctx . getSocketFactory ( ) ) ; } catch ( Exception e ) { throw new WalletNameTlsaValidationException ( "Failed to Add TLSA Self Signed Certificate to HttpsURLConnection" , e ) ; } } ins = conn . getInputStream ( ) ; isr = new InputStreamReader ( ins ) ; in = new BufferedReader ( isr ) ; String inputLine ; String data = "" ; while ( ( inputLine = in . readLine ( ) ) != null ) { data += inputLine ; } try { return new BitcoinURI ( data ) ; } catch ( BitcoinURIParseException e ) { throw new WalletNameLookupException ( "Unable to create BitcoinURI" , e ) ; } } catch ( IOException e ) { throw new WalletNameURLFailedException ( "WalletName URL Connection Failed" , e ) ; } finally { if ( conn != null && in != null ) { try { in . close ( ) ; } catch ( IOException e ) { } conn . disconnect ( ) ; } } } | Resolve a Wallet Name URL Endpoint |
11,590 | public static Component scan ( Component root , ScannerMatcher matcher ) { if ( matcher . matches ( root ) ) return root ; if ( ! ( root instanceof Container ) ) return null ; Container container = ( Container ) root ; for ( Component component : container . getComponents ( ) ) { Component found = scan ( component , matcher ) ; if ( found != null ) return found ; } return null ; } | Scans a component tree searching for the one which is matched by the given matcher . In case of multiple matches the firs one found is returned . |
11,591 | protected boolean isDependingOnConsistentRegistries ( ) { dependingRegistryMapLock . readLock ( ) . lock ( ) ; try { return dependingRegistryMap . keySet ( ) . stream ( ) . noneMatch ( ( registry ) -> ( ! registry . isConsistent ( ) ) ) ; } finally { dependingRegistryMapLock . readLock ( ) . unlock ( ) ; } } | If this registry depends on other registries this method can be used to tell this registry if all depending registries are consistent . |
11,592 | public void removeDependency ( final Registry registry ) throws CouldNotPerformException { if ( registry == null ) { throw new NotAvailableException ( "registry" ) ; } registryLock . writeLock ( ) . lock ( ) ; try { dependingRegistryMapLock . writeLock ( ) . lock ( ) ; try { if ( ! dependingRegistryMap . containsKey ( registry ) ) { logger . warn ( "Could not remove a dependency which was never registered!" ) ; return ; } dependingRegistryMap . remove ( registry ) . shutdown ( ) ; } finally { dependingRegistryMapLock . writeLock ( ) . unlock ( ) ; } } finally { registryLock . writeLock ( ) . unlock ( ) ; } } | This method allows the removal of a registered registry dependency . |
11,593 | public void removeAllDependencies ( ) { registryLock . writeLock ( ) . lock ( ) ; try { dependingRegistryMapLock . writeLock ( ) . lock ( ) ; try { List < Registry > dependingRegistryList = new ArrayList < > ( dependingRegistryMap . keySet ( ) ) ; Collections . reverse ( dependingRegistryList ) ; dependingRegistryList . stream ( ) . forEach ( ( registry ) -> { dependingRegistryMap . remove ( registry ) . shutdown ( ) ; } ) ; } finally { dependingRegistryMapLock . writeLock ( ) . unlock ( ) ; } } finally { registryLock . writeLock ( ) . unlock ( ) ; } } | Removal of all registered registry dependencies in the reversed order in which they where added . |
11,594 | protected final boolean notifyObservers ( ) { try { if ( registryLock . isWriteLockedByCurrentThread ( ) ) { logger . debug ( "Notification of registry[" + this + "] change skipped because of running write operations!" ) ; notificationSkipped = true ; return false ; } if ( super . notifyObservers ( entryMap ) ) { try { pluginPool . afterRegistryChange ( ) ; } catch ( CouldNotPerformException ex ) { MultiException . ExceptionStack exceptionStack = new MultiException . ExceptionStack ( ) ; exceptionStack . push ( pluginPool , ex ) ; throw new MultiException ( "PluginPool could not execute afterRegistryChange" , exceptionStack ) ; } } notificationSkipped = false ; } catch ( CouldNotPerformException ex ) { ExceptionPrinter . printHistory ( new CouldNotPerformException ( "Could not notify all registry observer!" , ex ) , logger , LogLevel . ERROR ) ; return false ; } return true ; } | Method triggers a new registry changed notification on all observers . The notification will be skipped in case the registry is busy . But a final notification is always guaranteed . |
11,595 | public List < String > getMatchingPropIds ( String searchKey ) throws KnowledgeSourceReadException { LOGGER . log ( Level . INFO , "Searching knowledge source For search string {0}" , searchKey ) ; Set < String > searchResults = getSearchResultsFromBackend ( searchKey ) ; return new ArrayList < > ( searchResults ) ; } | Gets the proposition Definitions from each backend that match the searchKey |
11,596 | private AgentManifestReader readManifests ( ClassLoader classLoader , String path ) throws IOException { Enumeration < URL > resources = classLoader . getResources ( path ) ; while ( resources . hasMoreElements ( ) ) { URL url = resources . nextElement ( ) ; try { addResource ( url . openStream ( ) ) ; } catch ( IOException e ) { System . err . println ( "Error reading manifest resources " + url ) ; e . printStackTrace ( ) ; } } return this ; } | Read all the specific manifest files and return the set of packages containing type query beans . |
11,597 | private void add ( String packages ) { if ( packages != null ) { String [ ] split = packages . split ( ",|;| " ) ; for ( int i = 0 ; i < split . length ; i ++ ) { String pkg = split [ i ] . trim ( ) ; if ( ! pkg . isEmpty ( ) ) { packageSet . add ( pkg ) ; } } } } | Collect each individual package splitting by delimiters . |
11,598 | public void setAsText ( final String text ) { if ( BeanUtils . isNull ( text ) ) { setValue ( null ) ; return ; } try { Object newValue = Long . valueOf ( text ) ; setValue ( newValue ) ; } catch ( NumberFormatException e ) { throw new IllegalArgumentException ( "Failed to parse long." , e ) ; } } | Map the argument text into and Integer using Integer . valueOf . |
11,599 | public void init ( IPersistentSubscriptionStore storageService ) { Log . debug ( "init invoked" ) ; m_storageService = storageService ; if ( Log . DEBUG ) { Log . debug ( "Reloading all stored subscriptions...subscription tree before {}" , dumpTree ( ) ) ; } for ( Subscription subscription : m_storageService . retrieveAllSubscriptions ( ) ) { Log . debug ( "Re-subscribing {} to topic {}" , subscription . getClientId ( ) , subscription . getTopic ( ) ) ; addDirect ( subscription ) ; } if ( Log . DEBUG ) { Log . debug ( "Finished loading. Subscription tree after {}" , dumpTree ( ) ) ; } } | Initialize basic store structures like the FS storage to maintain client s topics subscriptions |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.