idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
137,400
public void handleDatagram ( InetSocketAddress source , DatagramChannel channel , ByteBuffer buf , long when ) { if ( _digest == null ) { try { _digest = MessageDigest . getInstance ( "MD5" ) ; } catch ( NoSuchAlgorithmException nsae ) { log . warning ( "Missing MD5 algorithm." ) ; return ; } _sequencer = _pcmgr . crea...
Processes a datagram sent to this connection .
137,401
protected void inheritStreams ( PresentsConnection other ) { _fin = other . _fin ; _oin = other . _oin ; _oout = other . _oout ; if ( _loader != null ) { _oin . setClassLoader ( _loader ) ; } }
Instructs this connection to inherit its streams from the supplied connection object . This is called by the connection manager when the time comes to pass streams from the authing connection to the running connection .
137,402
public void setDefaultAccessController ( AccessController controller ) { AccessController oldDefault = _defaultController ; _defaultController = controller ; for ( DObject obj : _objects . values ( ) ) { if ( oldDefault == obj . getAccessController ( ) ) { obj . setAccessController ( controller ) ; } } }
Sets up an access controller that will be provided to any distributed objects created on the server . The controllers can subsequently be overridden if desired but a default controller is useful for implementing basic access control policies .
137,403
public void clearProxyObject ( int origObjectId , DObject object ) { if ( _proxies . remove ( object . getOid ( ) ) == null ) { log . warning ( "Missing proxy mapping for cleared proxy" , "ooid" , origObjectId ) ; } _objects . remove ( object . getOid ( ) ) ; }
Clears a proxy object reference from our local distributed object space . This merely removes it from our internal tables the caller is responsible for coordinating the deregistration of the object with the proxying client .
137,404
public Stats getStats ( boolean snapshot ) { if ( snapshot ) { _recent = _current ; _current = new Stats ( ) ; _current . maxQueueSize = _evqueue . size ( ) ; } return _recent ; }
Returns a recent snapshot of runtime statistics tracked by the distributed object manager .
137,405
public void run ( ) { log . info ( "DOMGR running." ) ; synchronized ( this ) { _dobjThread = Thread . currentThread ( ) ; } while ( isRunning ( ) ) { processUnit ( _evqueue . get ( ) ) ; } log . info ( "DOMGR exited." ) ; }
Runs the dobjmgr event loop until it is requested to exit . This should be called from the main application thread .
137,406
public void dumpUnitProfiles ( ) { for ( Map . Entry < String , UnitProfile > entry : _profiles . entrySet ( ) ) { log . info ( "P: " + entry . getKey ( ) + " => " + entry . getValue ( ) ) ; } }
Dumps collected profiling information to the system log .
137,407
protected void processUnit ( Object unit ) { long start = System . nanoTime ( ) ; int queueSize = _evqueue . size ( ) ; if ( queueSize > _current . maxQueueSize ) { _current . maxQueueSize = queueSize ; } try { if ( unit instanceof Runnable ) { ( ( Runnable ) unit ) . run ( ) ; } else { DEvent event = ( DEvent ) unit ;...
Processes a single unit from the queue .
137,408
protected void processCompoundEvent ( CompoundEvent event ) { List < DEvent > events = event . getEvents ( ) ; int ecount = events . size ( ) ; DObject target = _objects . get ( event . getTargetOid ( ) ) ; if ( target == null ) { log . debug ( "Compound event target no longer exists" , "event" , event ) ; return ; } f...
Performs the processing associated with a compound event notifying listeners and the like .
137,409
protected void processEvent ( DEvent event ) { DObject target = _objects . get ( event . getTargetOid ( ) ) ; if ( target == null ) { log . debug ( "Event target no longer exists" , "event" , event ) ; return ; } if ( ! target . checkPermissions ( event ) ) { log . warning ( "Event failed permissions check" , "event" ,...
Performs the processing associated with an event notifying listeners and the like .
137,410
protected void handleFatalError ( Object causer , Error error ) { if ( _fatalThrottle . throttleOp ( ) ) { throw error ; } log . warning ( "Fatal error caused by '" + causer + "': " + error , error ) ; }
Attempts to recover from fatal errors but rethrows if things are freaking out too frequently .
137,411
protected void registerEventHelpers ( ) { try { _helpers . put ( ObjectDestroyedEvent . class , new EventHelper ( ) { public boolean invoke ( DEvent event , DObject target ) { return objectDestroyed ( event , target ) ; } } ) ; _helpers . put ( ObjectAddedEvent . class , new EventHelper ( ) { public boolean invoke ( DE...
Registers our event helper methods .
137,412
public void setHeader ( File header ) { try { _header = StreamUtil . toString ( new FileReader ( header ) ) ; } catch ( IOException ioe ) { System . err . println ( "Unabled to load header '" + header + ": " + ioe . getMessage ( ) ) ; } }
Configures us with a header file that we ll prepend to all generated source files .
137,413
protected boolean wouldProduceSameFile ( String generated , File existing ) throws IOException { Iterator < String > generatedLines = Splitter . on ( EOL ) . split ( generated ) . iterator ( ) ; for ( String prev : Files . readLines ( existing , UTF_8 ) ) { if ( ! generatedLines . hasNext ( ) ) { return false ; } Strin...
Returns true if the given string has the same content as the file sans svn prop lines .
137,414
protected String mergeTemplate ( String template , Object ... data ) throws IOException { return mergeTemplate ( template , createMap ( data ) ) ; }
Merges the specified template using the supplied mapping of keys to objects .
137,415
protected String mergeTemplate ( String template , Map < String , Object > data ) throws IOException { Reader reader = new InputStreamReader ( getClass ( ) . getClassLoader ( ) . getResourceAsStream ( template ) , UTF_8 ) ; return convertEols ( Mustache . compiler ( ) . escapeHTML ( false ) . compile ( reader ) . execu...
Merges the specified template using the supplied mapping of string keys to objects .
137,416
public static String comicChars ( int length ) { char [ ] chars = new char [ length ] ; for ( int ii = 0 ; ii < length ; ii ++ ) { chars [ ii ] = RandomUtil . pickRandom ( COMIC_CHARS ) ; } return new String ( chars ) ; }
Return a comicy replacement of the specified length .
137,417
public String filter ( String msg , Name otherUser , boolean outgoing ) { _stopMatcher . reset ( msg ) ; if ( _stopMatcher . find ( ) ) { return null ; } Mode level = getFilterMode ( ) ; if ( level == Mode . UNFILTERED ) { return msg ; } StringBuffer inbuf = new StringBuffer ( msg ) ; StringBuffer outbuf = new StringBu...
from interface ChatFilter
137,418
protected void configureCurseWords ( String curseWords ) { StringTokenizer st = new StringTokenizer ( curseWords ) ; int numWords = st . countTokens ( ) ; _matchers = new Matcher [ numWords ] ; _replacements = new String [ numWords ] ; _vernacular = new String [ numWords ] ; _comicLength = new int [ numWords ] ; for ( ...
Configure the curse word portion of our filtering .
137,419
protected void configureStopWords ( String stopWords ) { List < String > patterns = Lists . newArrayList ( ) ; for ( StringTokenizer st = new StringTokenizer ( stopWords ) ; st . hasMoreTokens ( ) ; ) { patterns . add ( getStopWordRegexp ( st . nextToken ( ) ) ) ; } String pattern = patterns . isEmpty ( ) ? ".\\A" : "(...
Configure the words that will stop .
137,420
protected void setStopPattern ( String pattern ) { _stopMatcher = Pattern . compile ( pattern , Pattern . CASE_INSENSITIVE ) . matcher ( "" ) ; }
Sets our stop word matcher to one for the given regular expression .
137,421
public static < T > T queueAndWait ( RunQueue runq , final String name , final Callable < T > action ) throws ServiceException { final ServletWaiter < T > waiter = new ServletWaiter < T > ( name ) ; runq . postRunnable ( new Runnable ( ) { public void run ( ) { try { waiter . postSuccess ( action . call ( ) ) ; } catch...
Posts a result getter to be executed on the run queue thread and blocks waiting for the result .
137,422
public static < T extends TOP > int count ( final Class < T > type , final JCas aJCas ) { return JCasUtil . select ( aJCas , type ) . size ( ) ; }
Counts the number of features structures of the given type in the JCas
137,423
public static < T extends TOP > boolean hasAny ( final Class < T > type , final JCas aJCas ) { return count ( type , aJCas ) != 0 ; }
Returns whether there is any feature structure of the given type
137,424
public static < T extends TOP > boolean hasNo ( final Class < T > type , final JCas aJCas ) { return ! hasAny ( type , aJCas ) ; }
Returns whether there is no feature structure of the given type
137,425
public static < T extends TOP > List < T > selectAsList ( final JCas jCas , final Class < T > type ) { return new ArrayList < > ( JCasUtil . select ( jCas , type ) ) ; }
Convenience method that selects all feature structures of the given type and creates a list from them .
137,426
public static < T extends Annotation > boolean doOverlap ( final T anno1 , final T anno2 ) { return anno1 . getEnd ( ) > anno2 . getBegin ( ) && anno1 . getBegin ( ) < anno2 . getEnd ( ) ; }
Returns whether the given annotations have a non - empty overlap .
137,427
public static boolean haveSameSpan ( final Annotation anno1 , final Annotation anno2 ) { return anno1 . getBegin ( ) == anno2 . getBegin ( ) && anno1 . getEnd ( ) == anno2 . getEnd ( ) ; }
Returns whether two annotations share the same span
137,428
public static JCas getJCas ( final Annotation annotation ) { JCas result = null ; try { result = annotation . getCAS ( ) . getJCas ( ) ; } catch ( final CASException e ) { throw new IllegalArgumentException ( e ) ; } return result ; }
Returns the JCas of this annotation .
137,429
public static boolean isFirstCoveredToken ( final Token token , final Annotation annotation ) { final JCas jCas = getJCas ( annotation ) ; final List < Token > coveredTokens = JCasUtil . selectCovered ( jCas , Token . class , annotation ) ; if ( coveredTokens . isEmpty ( ) ) { return false ; } else { final Token firstC...
Returns whether the given token is the first token covered by the given annotation .
137,430
public static void updateEnd ( final Annotation annotation , final int end ) { annotation . removeFromIndexes ( ) ; annotation . setEnd ( end ) ; annotation . addToIndexes ( ) ; }
Sets the end value of the annotation updating indexes appropriately
137,431
public static void updateBegin ( final Annotation annotation , final int begin ) { annotation . removeFromIndexes ( ) ; annotation . setBegin ( begin ) ; annotation . addToIndexes ( ) ; }
Sets the begin value of the annotation updating indexes appropriately
137,432
public static Token findTokenByBeginPosition ( JCas jCas , int begin ) { for ( Token token : JCasUtil . select ( getInitialView ( jCas ) , Token . class ) ) { if ( token . getBegin ( ) == begin ) { return token ; } } return null ; }
Returns token at the given position
137,433
public static Token findTokenByEndPosition ( JCas jCas , int end ) { for ( Token token : JCasUtil . select ( getInitialView ( jCas ) , Token . class ) ) { if ( token . getEnd ( ) == end ) { return token ; } } return null ; }
Returns token ending at the given position
137,434
public static List < Token > getPrecedingTokens ( JCas jCas , Token token ) { List < Token > result = new ArrayList < Token > ( ) ; for ( Token t : JCasUtil . select ( getInitialView ( jCas ) , Token . class ) ) { if ( t . getBegin ( ) < token . getBegin ( ) ) { result . add ( t ) ; } } return result ; }
Returns a list of tokens preceding the given token
137,435
public static List < Sentence > getPrecedingSentences ( JCas jCas , Sentence annotation ) { List < Sentence > result = new ArrayList < Sentence > ( ) ; for ( Sentence sentence : JCasUtil . select ( getInitialView ( jCas ) , Sentence . class ) ) { if ( sentence . getBegin ( ) < annotation . getBegin ( ) ) { result . add...
Returns a list of annotations of the same type preceding the given annotation
137,436
public byte [ ] getSecret ( PrivateKey key ) { if ( _secret == null ) { _secret = SecureUtil . decryptBytes ( key , _encodedSecret , _salt ) ; } return _secret ; }
Decodes the secret .
137,437
public void addTranslation ( String className , String streamedName ) { if ( _translations == null ) { _translations = Maps . newHashMap ( ) ; } _translations . put ( className , streamedName ) ; }
Configures this object output stream with a mapping from a classname to a streamed name .
137,438
public void writeIntern ( String value ) throws IOException { if ( value == null ) { writeShort ( 0 ) ; return ; } if ( _internmap == null ) { _internmap = Maps . newHashMap ( ) ; } Short code = _internmap . get ( value ) ; if ( code == null ) { if ( ObjectInputStream . STREAM_DEBUG ) { log . info ( hashCode ( ) + ": C...
Writes a pooled string value to the output stream .
137,439
protected ClassMapping writeClassMapping ( Class < ? > sclass ) throws IOException { if ( _classmap == null ) { _classmap = Maps . newHashMap ( ) ; } ClassMapping cmap = _classmap . get ( sclass ) ; if ( cmap == null ) { Class < ? > collClass = Streamer . getCollectionClass ( sclass ) ; if ( collClass != null && ! coll...
Retrieves or creates the class mapping for the supplied class writes it out to the stream and returns a reference to it .
137,440
protected void writeClassMapping ( int code , Class < ? > sclass ) throws IOException { writeShort ( code ) ; String cname = sclass . getName ( ) ; if ( _translations != null ) { String tname = _translations . get ( cname ) ; if ( tname != null ) { cname = tname ; } } writeUTF ( cname ) ; }
Writes out the mapping for a class .
137,441
public void getTimeOid ( String arg1 , TimeBaseService . GotTimeBaseListener arg2 ) { TimeBaseMarshaller . GotTimeBaseMarshaller listener2 = new TimeBaseMarshaller . GotTimeBaseMarshaller ( ) ; listener2 . listener = arg2 ; sendRequest ( GET_TIME_OID , new Object [ ] { arg1 , listener2 } ) ; }
from interface TimeBaseService
137,442
public synchronized void writeDatagram ( Message datagram ) throws IOException { _uout . writeInt ( ++ _lastNumber ) ; _uout . writeInt ( _lastReceived ) ; Set < Class < ? > > mappedClasses = _uout . getMappedClasses ( ) ; mappedClasses . clear ( ) ; Set < String > mappedInterns = _uout . getMappedInterns ( ) ; mappedI...
Writes a datagram to the underlying stream .
137,443
public synchronized Message readDatagram ( ) throws IOException , ClassNotFoundException { int number = _uin . readInt ( ) ; if ( number <= _lastReceived ) { return null ; } _missedCount = number - _lastReceived - 1 ; _lastReceived = number ; int received = _uin . readInt ( ) ; int remove = 0 ; for ( int ii = 0 , nn = ...
Reads a datagram from the underlying stream .
137,444
protected < T extends InvocationMarshaller < ? > > T addProvider ( InvocationProvider prov , Class < T > mclass ) { return _plmgr . addProvider ( prov , mclass ) ; }
Registers an invocation provider and notes the registration such that it will be automatically cleared when our parent manager shuts down .
137,445
protected < T extends InvocationMarshaller < ? > > T addDispatcher ( InvocationDispatcher < T > disp ) { return _plmgr . addDispatcher ( disp ) ; }
Registers an invocation dispatcher and notes the registration such that it will be automatically cleared when our parent manager shuts down .
137,446
public byte [ ] createSecret ( PublicKeyCredentials pkcred , PrivateKey key , int length ) { _data = new AuthResponseData ( ) ; byte [ ] clientSecret = pkcred . getSecret ( key ) ; if ( clientSecret == null ) { _data . code = FAILED_TO_SECURE ; return null ; } byte [ ] secret = SecureUtil . createRandomKey ( length ) ;...
Encodes the server secret in the response data or sets the failed state .
137,447
public byte [ ] getCodeBytes ( PublicKeyCredentials pkcreds ) { return pkcreds == null || _data . code == null || _data . code . equals ( FAILED_TO_SECURE ) ? null : SecureUtil . xorBytes ( StringUtil . unhexlate ( _data . code ) , pkcreds . getSecret ( ) ) ; }
Returns the code bytes or null for a failed state .
137,448
public void activatePeriodicReport ( RootDObjectManager omgr ) { omgr . newInterval ( new Runnable ( ) { public void run ( ) { logReport ( LOG_REPORT_HEADER + generateReport ( DEFAULT_TYPE , System . currentTimeMillis ( ) , true ) ) ; } } ) . schedule ( getReportInterval ( ) , true ) ; }
Starts up our periodic report generation task .
137,449
protected String generateReport ( String type , long now , boolean reset ) { long sinceLast = now - _lastReportStamp ; long uptime = now - _serverStartTime ; StringBuilder report = new StringBuilder ( ) ; if ( DEFAULT_TYPE . equals ( type ) ) { report . append ( "- Uptime: " ) ; report . append ( StringUtil . intervalT...
Generates and logs a state of server report .
137,450
public void init ( NodeRecord record ) { _record = record ; _client = new Client ( null , _omgr ) { protected void convertFromRemote ( DObject target , DEvent event ) { super . convertFromRemote ( target , event ) ; event . setTargetOid ( target . getOid ( ) ) ; event . eventId = PeerNode . this . _omgr . getNextEventI...
Initializes this peer node and creates its internal client .
137,451
public void objectAvailable ( NodeObject object ) { nodeobj = object ; nodeobj . addListener ( _listener = createListener ( ) ) ; _peermgr . connectedToPeer ( this ) ; String nodeName = getNodeName ( ) ; for ( ClientInfo clinfo : nodeobj . clients ) { _peermgr . clientLoggedOn ( nodeName , clinfo ) ; } for ( NodeObject...
documentation inherited from interface Subscriber
137,452
public List < NodeRecord > loadNodes ( String namespace , boolean includeShutdown ) { Query < NodeRecord > query = from ( NodeRecord . class ) . noCache ( ) ; List < SQLExpression < ? > > conditions = Lists . newArrayList ( ) ; if ( ! StringUtil . isBlank ( namespace ) ) { conditions . add ( NodeRecord . NODE_NAME . li...
Returns a list of all nodes registered in the repository with names starting with the given string optionally including nodes that are explicitly shut down .
137,453
public List < NodeRecord > loadNodesFromRegion ( String region ) { return from ( NodeRecord . class ) . noCache ( ) . where ( NodeRecord . REGION . eq ( region ) , Ops . not ( NodeRecord . SHUTDOWN ) ) . select ( ) ; }
Returns a list of nodes registered in the repository with the specified region that are not explicitly shut down .
137,454
public void updateNode ( NodeRecord record ) { record . lastUpdated = new Timestamp ( System . currentTimeMillis ( ) ) ; store ( record ) ; }
Updates the supplied node record inserting it into the database if necessary .
137,455
public void shutdownNode ( String nodeName ) { updatePartial ( NodeRecord . getKey ( nodeName ) , NodeRecord . SHUTDOWN , true ) ; }
Marks the identified node as shut down in its record .
137,456
public List < byte [ ] > split ( byte sep ) { List < byte [ ] > l = new LinkedList < > ( ) ; int start = 0 ; for ( int i = 0 ; i < bytes . length ; i ++ ) { if ( sep == bytes [ i ] ) { byte [ ] b = Arrays . copyOfRange ( bytes , start , i ) ; if ( b . length > 0 ) { l . add ( b ) ; } start = i + 1 ; i = start ; } } l ....
Split byte array by a separator byte .
137,457
public OccupantInfo getOccupantInfo ( int bodyOid ) { return ( _place == null ) ? null : _place . occupantInfo . get ( Integer . valueOf ( bodyOid ) ) ; }
Returns the occupant info for the user in question if it exists in the currently occupied place . Returns null if no occupant info exists for the specified body .
137,458
public OccupantInfo getOccupantInfo ( Name username ) { return ( _place == null ) ? null : _place . getOccupantInfo ( username ) ; }
Returns the occupant info for the user in question if it exists in the currently occupied place . Returns null if no occupant info exists with the specified username .
137,459
public void entryAdded ( EntryAddedEvent < OccupantInfo > event ) { if ( ! event . getName ( ) . equals ( PlaceObject . OCCUPANT_INFO ) ) { return ; } final OccupantInfo info = event . getEntry ( ) ; _observers . apply ( new ObserverList . ObserverOp < OccupantObserver > ( ) { public boolean apply ( OccupantObserver ob...
Deals with all of the processing when an occupant shows up .
137,460
public void entryUpdated ( EntryUpdatedEvent < OccupantInfo > event ) { if ( ! event . getName ( ) . equals ( PlaceObject . OCCUPANT_INFO ) ) { return ; } final OccupantInfo info = event . getEntry ( ) ; final OccupantInfo oinfo = event . getOldEntry ( ) ; _observers . apply ( new ObserverList . ObserverOp < OccupantOb...
Deals with all of the processing when an occupant is updated .
137,461
public void entryRemoved ( EntryRemovedEvent < OccupantInfo > event ) { if ( ! event . getName ( ) . equals ( PlaceObject . OCCUPANT_INFO ) ) { return ; } final OccupantInfo oinfo = event . getOldEntry ( ) ; _observers . apply ( new ObserverList . ObserverOp < OccupantObserver > ( ) { public boolean apply ( OccupantObs...
Deals with all of the processing when an occupant leaves .
137,462
public void start ( Activity activity ) { Intent i = new Intent ( activity , CalculatorActivity . class ) ; if ( ! TextUtils . isEmpty ( activityTitle ) ) { i . putExtra ( CalculatorActivity . TITLE_ACTIVITY , activityTitle ) ; } if ( ! TextUtils . isEmpty ( value ) ) { i . putExtra ( CalculatorActivity . VALUE , value...
Start the activity using the parent activity
137,463
public void start ( Fragment fragment ) { Intent i = new Intent ( fragment . getContext ( ) , CalculatorActivity . class ) ; if ( ! TextUtils . isEmpty ( activityTitle ) ) { i . putExtra ( CalculatorActivity . TITLE_ACTIVITY , activityTitle ) ; } if ( ! TextUtils . isEmpty ( value ) ) { i . putExtra ( CalculatorActivit...
Start the activity using the parent fragment
137,464
public int getIndexWithinSections ( int listPosition ) { boolean isSection = false ; int numPrecedingSections = 0 ; for ( Integer sectionPosition : mSections . keySet ( ) ) { if ( listPosition > sectionPosition ) numPrecedingSections ++ ; else if ( listPosition == sectionPosition ) isSection = true ; else break ; } ret...
Finds the section index for a given list position .
137,465
public int getPositionForSection ( int sectionIndex ) { if ( mSectionList . size ( ) == 0 ) { for ( Integer key : mSections . keySet ( ) ) { mSectionList . add ( key ) ; } } return sectionIndex < mSectionList . size ( ) ? mSectionList . get ( sectionIndex ) : getCount ( ) ; }
Given the index of a section within the array of section objects returns the starting position of that section within the adapter .
137,466
public int getSectionForPosition ( int position ) { Object [ ] objects = getSections ( ) ; int sectionIndex = getIndexWithinSections ( position ) ; return sectionIndex < objects . length ? sectionIndex : 0 ; }
Given a position within the adapter returns the index of the corresponding section within the array of section objects .
137,467
public double getNumericValue ( ) { String original = getText ( ) . toString ( ) . replaceAll ( mNumberFilterRegex , "" ) ; if ( hasCustomDecimalSeparator ) { original = StringUtils . replace ( original , String . valueOf ( mDecimalSeparator ) , String . valueOf ( DECIMAL_SEPARATOR ) ) ; } try { return NumberFormat . g...
Return numeric value represented by the text field
137,468
private String format ( final String original ) { final String [ ] parts = original . split ( "\\" + mDecimalSeparator , - 1 ) ; String number = parts [ 0 ] . replaceAll ( mNumberFilterRegex , "" ) . replaceFirst ( LEADING_ZERO_FILTER_REGEX , "" ) ; if ( ! hasCustomDecimalSeparator ) { number = StringUtils . reverse ( ...
Add grouping separators to string
137,469
public static Document createEmptyDocument ( ) { Document output = null ; try { final DocumentBuilder db = FACTORY . newDocumentBuilder ( ) ; db . setErrorHandler ( new ParserErrorHandler ( ) ) ; output = db . newDocument ( ) ; } catch ( final Exception ex ) { LOGGER . error ( "Problem creating empty XML document." , e...
Create an empty XML structure .
137,470
public static boolean validate ( final Source input , final Source [ ] schemas ) { boolean isValid = true ; try { final SchemaFactory factory = SchemaFactory . newInstance ( XMLConstants . W3C_XML_SCHEMA_NS_URI ) ; factory . setResourceResolver ( new SchemaLSResourceResolver ( ) ) ; final Validator val = factory . newS...
Validate an XML document against an XML Schema definition .
137,471
public static void transform ( final Source input , final Source sheet , final Result output ) { try { final DOMResult intermediate = new DOMResult ( createEmptyDocument ( ) ) ; createTransformer ( sheet ) . transform ( input , intermediate ) ; format ( new DOMSource ( intermediate . getNode ( ) ) , output ) ; } catch ...
Transform an XML document according to an XSL style sheet .
137,472
static Document loadDefinition ( final File def ) { final Document document = XmlUtils . parseFile ( def ) ; if ( document == null ) { return null ; } final Node xmlnsNode = document . getFirstChild ( ) . getAttributes ( ) . getNamedItem ( "xmlns" ) ; if ( xmlnsNode != null && StringUtils . isNotBlank ( xmlnsNode . get...
Load a process definition from file .
137,473
private static void transform ( final String xmlFileName , final String xsltFileName , final String outputFileName ) { Source xsltSource = null ; if ( StringUtils . isNotBlank ( xsltFileName ) ) { xsltSource = new StreamSource ( new File ( xsltFileName ) ) ; } else { xsltSource = new StreamSource ( Thread . currentThre...
Perform the transformation called from the main method .
137,474
private static Version parseVersion ( String version ) { String [ ] parts = version . split ( "\\." ) ; int nbParts = parts . length ; int majorIndex = nbParts > 1 ? 1 : 0 ; int major = Integer . parseInt ( parts [ majorIndex ] ) ; return new Version ( major ) ; }
Parse Java version number .
137,475
public void initialize ( URL location , ResourceBundle resources ) { addEventHandler ( WindowEvent . ANY , new EventHandler < WindowEvent > ( ) { public void handle ( WindowEvent window ) { Platform . runLater ( new Runnable ( ) { public void run ( ) { if ( isLoadingError ) { close ( ) ; } } } ) ; } } ) ; Platform . ru...
Initializes the dialog . Sets default focus to OK button . Wraps the text for details message label and apply the user - defined header and details . Filter the behavior for the exception dialog for a null and non - null exception object given . Applies corresponding header background css style .
137,476
private void setHeadlessPadding ( ) { if ( dialogType == DialogType . INPUT_TEXT ) { bodyContainer . setStyle ( PreDefinedStyle . INPUT_DIALOG_HEADLESS_PADDING . getStyle ( ) ) ; } else if ( dialogType == DialogType . EXCEPTION ) { bodyContainer . setStyle ( PreDefinedStyle . EXCEPTION_DIALOG_HEADLESS_PADDING . getStyl...
Sets the padding for a headless dialog
137,477
public final void setHeaderColorStyle ( HeaderColorStyle headerColorStyle ) { this . headerColorStyle = headerColorStyle ; if ( ! headerColorStyle . getColorStyle ( ) . isEmpty ( ) ) { this . getHeaderLabel ( ) . setStyle ( headerColorStyle . getColorStyle ( ) ) ; } else { if ( headerColorStyle == HeaderColorStyle . DE...
Applies a predefined JavaFX CSS background color style for the header label
137,478
public void setFont ( String header_font_family , int header_font_size , String details_font_family , int details_font_size ) { this . headerLabel . setStyle ( "-fx-font-family: \"" + header_font_family + "\";" + "-fx-font-size:" + Integer . toString ( header_font_size ) + "px;" ) ; this . detailsLabel . setStyle ( "-f...
Sets the font sizes and the font families for the header and details label .
137,479
public void setHeaderFont ( String font_family , int font_size ) { this . headerLabel . setStyle ( "-fx-font-family: \"" + font_family + "\";" + "-fx-font-size:" + Integer . toString ( font_size ) + "px;" ) ; }
Sets both header label s font family and size .
137,480
public void setDetailsFont ( String font_family , int font_size ) { this . detailsLabel . setStyle ( "-fx-font-family: \"" + font_family + "\";" + "-fx-font-size:" + Integer . toString ( font_size ) + "px;" ) ; }
Sets both details label s font family and size .
137,481
private void send_btn_on_click ( ActionEvent event ) { if ( this . dialogType == DialogType . INPUT_TEXT ) { this . textEntry = this . inputTextField . getText ( ) ; } setResponse ( DialogResponse . SEND ) ; close ( ) ; }
Event handler when sendButton is pressed . Sets response to SEND and closes the dialog window .
137,482
public static String fingerprint ( String str ) { try { MessageDigest md = MessageDigest . getInstance ( "SHA-1" ) ; return byteArrayToHexString ( md . digest ( str . getBytes ( ) ) ) ; } catch ( NoSuchAlgorithmException nsae ) { LOGGER . warning ( "Unable to calculate the fingerprint for string [" + str + "]." ) ; ret...
Generate a fingerprint for a given string
137,483
public static String fingerprint ( Class cl , Method m ) { return fingerprint ( cl , m . getName ( ) ) ; }
Generate a fingerprint based on class and method
137,484
public static String fingerprint ( Class cl , String methodName ) { return fingerprint ( cl . getCanonicalName ( ) + "." + methodName ) ; }
Generate a fingerprint based on class and method name
137,485
public static Set < String > getContributors ( Set < String > baseContributors , ProbeTest methodAnnotation , ProbeTestClass classAnnotation ) { Set < String > contributors ; if ( baseContributors == null ) { contributors = new HashSet < > ( ) ; } else { contributors = populateContributors ( baseContributors , new Hash...
Retrieve the contributors and compile them from the different sources
137,486
private static Set < String > populateContributors ( Set < String > source , Set < String > destination ) { for ( String contributor : source ) { if ( ! emailPattern . matcher ( contributor ) . matches ( ) ) { LOGGER . warning ( "The contributor '" + contributor + "' does not respect the email pattern " + emailPattern ...
Populate the source with the destination contributors only if they match the pattern rules for the contributors
137,487
protected int binarySearchHashCode ( int elemHash ) { int left = 0 ; int right = size ( ) - 1 ; while ( left <= right ) { int mid = ( left + right ) >> 1 ; int midHash = get ( mid ) . hashCode ( ) ; if ( elemHash == midHash ) return mid ; if ( elemHash < midHash ) right = mid - 1 ; else left = mid + 1 ; } return - ( le...
Performs a binary search on hashCode values only . It will return any matching element not necessarily the first or the last .
137,488
public int indexOf ( int hashCode ) { int pos = binarySearchHashCode ( hashCode ) ; if ( pos < 0 ) return - 1 ; while ( pos > 0 && get ( pos - 1 ) . hashCode ( ) == hashCode ) pos -- ; return pos ; }
Finds the first index where the object has the provided hashCode
137,489
public boolean add ( E o ) { int size = size ( ) ; if ( size == 0 ) { super . add ( o ) ; } else { int Ohash = o . hashCode ( ) ; if ( Ohash >= get ( size - 1 ) . hashCode ( ) ) { super . add ( o ) ; } else { int index = binarySearchHashCode ( Ohash ) ; if ( index < 0 ) { super . add ( - ( index + 1 ) , o ) ; } else { ...
Adds the specified element in sorted position within this list . When two elements have the same hashCode the new item is added at the end of the list of matching hashCodes .
137,490
public static HttpParameters wrap ( HttpParameters wrapped ) { if ( wrapped == null ) return null ; if ( wrapped == EmptyParameters . getInstance ( ) ) return wrapped ; if ( wrapped instanceof ServletRequestParameters ) return wrapped ; if ( wrapped instanceof UnmodifiableHttpParameters ) return wrapped ; return new Un...
Wraps the given parameters to ensure they are unmodifiable .
137,491
public static boolean isRssEnabled ( ServletContext servletContext ) { Boolean isRssEnabled = ( Boolean ) servletContext . getAttribute ( ISS_RSS_ENABLED_CACHE_KEY ) ; if ( isRssEnabled == null ) { try { Class . forName ( RSS_SERVLET_CLASSNAME ) ; isRssEnabled = true ; } catch ( ClassNotFoundException e ) { isRssEnable...
Checks if the RSS module is installed . This is done by checking for the existence of the servlet class . This is cached in application scope to avoid throwing and catching ClassNotFoundException repeatedly .
137,492
public static boolean isProtectedExtension ( String path ) { for ( String extension : PROTECTED_EXTENSIONS ) { if ( path . endsWith ( extension ) ) return true ; } return false ; }
Checks that the given resource should not be included under any circumstances .
137,493
public static String getRssServletPath ( PageRef pageRef ) { String servletPath = pageRef . getBookRef ( ) . getPrefix ( ) + pageRef . getPath ( ) ; for ( String extension : RESOURCE_EXTENSIONS ) { if ( servletPath . endsWith ( extension ) ) { servletPath = servletPath . substring ( 0 , servletPath . length ( ) - exten...
Gets the servletPath to the RSS feed for the give page ref .
137,494
public int compareTo ( BookRef o ) { int diff = domain . compareTo ( o . domain ) ; if ( diff != 0 ) return diff ; return path . compareTo ( o . path ) ; }
Ordered by domain path .
137,495
public List < String > sources ( ) { List < String > sources = new ArrayList < > ( ) ; for ( int i = 0 ; i < this . _sections . size ( ) ; i ++ ) { for ( int j = 0 ; j < this . _sections . get ( i ) . consumer . sources ( ) . size ( ) ; j ++ ) { sources . add ( this . _sections . get ( i ) . consumer . sources ( ) . ge...
The list of original sources .
137,496
public static long syncFile ( InputStream in , RandomAccessFile out ) throws IOException { byte [ ] inBuff = new byte [ BLOCK_SIZE ] ; byte [ ] outBuff = new byte [ BLOCK_SIZE ] ; long pos = 0 ; long bytesWritten = 0 ; int numBytes ; while ( ( numBytes = in . read ( inBuff , 0 , BLOCK_SIZE ) ) != - 1 ) { if ( DEBUG ) S...
Synchronized the input to the provided output only writing data that doesn t already match the input . Returns the number of bytes written .
137,497
protected void evaluateAttributes ( E element , ELContext elContext ) throws JspTagException , IOException { String idStr = nullIfEmpty ( resolveValue ( id , String . class , elContext ) ) ; if ( idStr != null ) element . setId ( idStr ) ; }
Resolves all attributes setting into the created element as appropriate This is only called for captureLevel > = META . Attributes are resolved before the element is added to any parent node . Typically deferred expressions will be evaluated here . Overriding methods must call this implementation .
137,498
protected void doBody ( E element , CaptureLevel captureLevel ) throws JspException , IOException { JspFragment body = getJspBody ( ) ; if ( body != null ) { if ( captureLevel == CaptureLevel . BODY ) { final PageContext pageContext = ( PageContext ) getJspContext ( ) ; BufferWriter capturedOut = AutoEncodingBufferedTa...
This is only called for captureLevel > = META .
137,499
public static Properties loadFromResource ( ServletContext servletContext , String resource ) throws IOException { Properties props = new Properties ( ) ; InputStream in = servletContext . getResourceAsStream ( resource ) ; if ( in == null ) throw new LocalizedIOException ( accessor , "PropertiesUtils.readProperties.re...
Loads properties from a web resource .