idx int64 0 41.2k | question stringlengths 83 4.15k | target stringlengths 5 715 |
|---|---|---|
19,500 | public void sendBinarySync ( Session session , InputStream inputStream ) throws IOException { if ( session == null ) { return ; } if ( inputStream == null ) { throw new IllegalArgumentException ( "inputStream must not be null" ) ; } log . debugf ( "Attempting to send binary data to client [%s]" , session . getId ( ) ) ; if ( session . isOpen ( ) ) { long size = new CopyStreamRunnable ( session , inputStream ) . copyInputToOutput ( ) ; log . debugf ( "Finished sending binary data to client [%s]: size=[%s]" , session . getId ( ) , size ) ; } return ; } | Sends binary data to a client synchronously . |
19,501 | public void uiClientSessionOpen ( Session session ) { log . infoWsSessionOpened ( session . getId ( ) , endpoint ) ; wsEndpoints . getUiClientSessions ( ) . addSession ( session . getId ( ) , session ) ; WelcomeResponse welcomeResponse = new WelcomeResponse ( ) ; welcomeResponse . setSessionId ( session . getId ( ) ) ; try { new WebSocketHelper ( ) . sendBasicMessageSync ( session , welcomeResponse ) ; } catch ( IOException e ) { log . warnf ( e , "Could not send [%s] to UI client session [%s]." , WelcomeResponse . class . getName ( ) , session . getId ( ) ) ; } } | When a UI client connects this method is called . This will immediately send a welcome message to the UI client . |
19,502 | private void doStart ( ) throws LifecycleException { tomcat . getServer ( ) . addLifecycleListener ( new TomcatLifecycleListener ( ) ) ; logger . info ( "Deploying application to [" + getConfig ( ) . getDeployUrl ( ) + "]" ) ; tomcat . start ( ) ; if ( getConfig ( ) . getPort ( ) == EmbedVaadinConfig . DEFAULT_PORT ) { getConfig ( ) . setPort ( getTomcat ( ) . getConnector ( ) . getLocalPort ( ) ) ; } logger . info ( "Application has been deployed to [" + getConfig ( ) . getDeployUrl ( ) + "]" ) ; if ( config . shouldOpenBrowser ( ) ) { BrowserUtils . openBrowser ( getConfig ( ) . getOpenBrowserUrl ( ) ) ; } if ( isWaiting ( ) ) { tomcat . getServer ( ) . await ( ) ; } } | Fires the embedded tomcat that is assumed to be fully configured . |
19,503 | private void doStop ( ) throws LifecycleException { logger . info ( "Stopping tomcat." ) ; long startTime = System . currentTimeMillis ( ) ; tomcat . stop ( ) ; long duration = System . currentTimeMillis ( ) - startTime ; logger . info ( "Tomcat shutdown finished in " + duration + " ms." ) ; } | Stops the embedded tomcat . |
19,504 | public LogTarget addDelegate ( Log log ) { LogProxyTarget logProxyTarget = new LogProxyTarget ( log ) ; this . addTarget ( logProxyTarget ) ; return logProxyTarget ; } | Adds a ProxyTarget for an other Logger |
19,505 | public Object addingService ( ServiceReference reference ) { HttpService httpService = ( HttpService ) context . getService ( reference ) ; String alias = this . getAlias ( ) ; String name = this . getProperty ( RESOURCE_NAME ) ; if ( name == null ) name = alias ; try { httpService . registerResources ( alias , name , httpContext ) ; } catch ( NamespaceException e ) { e . printStackTrace ( ) ; } return httpService ; } | Http Service is up add my resource . |
19,506 | public final void setTypeName ( final String typeName ) { if ( typeName == null ) { type = LOOKING_AT ; } else if ( typeName . equalsIgnoreCase ( TYPES [ 0 ] ) ) { type = MATCHES ; } else if ( typeName . equalsIgnoreCase ( TYPES [ 1 ] ) ) { type = LOOKING_AT ; } else if ( typeName . equalsIgnoreCase ( TYPES [ 2 ] ) ) { type = FIND ; } } | Sets the type name of the matching . |
19,507 | public static Reflect onObject ( Object object ) { if ( object == null ) { return new Reflect ( null , null ) ; } return new Reflect ( object , object . getClass ( ) ) ; } | Creates an instance of Reflect associated with an object |
19,508 | public static Reflect onClass ( String clazz ) throws Exception { return new Reflect ( null , ReflectionUtils . getClassForName ( clazz ) ) ; } | Creates an instance of Reflect associated with a class |
19,509 | public boolean containsField ( String name ) { if ( StringUtils . isNullOrBlank ( name ) ) { return false ; } return ClassDescriptorCache . getInstance ( ) . getClassDescriptor ( clazz ) . getFields ( accessAll ) . stream ( ) . anyMatch ( f -> f . getName ( ) . equals ( name ) ) ; } | Determines if a field with the given name is associated with the class |
19,510 | public Reflect create ( ) throws ReflectionException { try { return on ( clazz . getConstructor ( ) , accessAll ) ; } catch ( NoSuchMethodException e ) { if ( accessAll ) { try { return on ( clazz . getDeclaredConstructor ( ) , accessAll ) ; } catch ( NoSuchMethodException e2 ) { throw new ReflectionException ( e2 ) ; } } throw new ReflectionException ( e ) ; } } | Creates an instance of the class being reflected using the no - argument constructor . |
19,511 | public Reflect create ( Object ... args ) throws ReflectionException { return create ( ReflectionUtils . getTypes ( args ) , args ) ; } | Creates an instance of the class being reflected using the most specific constructor available . |
19,512 | public Reflect create ( Class [ ] types , Object ... args ) throws ReflectionException { try { return on ( clazz . getConstructor ( types ) , accessAll , args ) ; } catch ( NoSuchMethodException e ) { for ( Constructor constructor : getConstructors ( ) ) { if ( ReflectionUtils . typesMatch ( constructor . getParameterTypes ( ) , types ) ) { return on ( constructor , accessAll , args ) ; } } throw new ReflectionException ( e ) ; } } | Create reflect . |
19,513 | public Method getMethod ( final String name ) { if ( StringUtils . isNullOrBlank ( name ) ) { return null ; } return getMethods ( ) . stream ( ) . filter ( method -> method . getName ( ) . equals ( name ) ) . findFirst ( ) . orElse ( null ) ; } | Gets method . |
19,514 | public boolean containsMethod ( final String name ) { if ( StringUtils . isNullOrBlank ( name ) ) { return false ; } return ClassDescriptorCache . getInstance ( ) . getClassDescriptor ( clazz ) . getMethods ( accessAll ) . stream ( ) . anyMatch ( f -> f . getName ( ) . equals ( name ) ) ; } | Contains method . |
19,515 | public Reflect invoke ( String methodName , Object ... args ) throws ReflectionException { Class [ ] types = ReflectionUtils . getTypes ( args ) ; try { return on ( clazz . getMethod ( methodName , types ) , object , accessAll , args ) ; } catch ( NoSuchMethodException e ) { Method method = ReflectionUtils . bestMatchingMethod ( getMethods ( ) , methodName , types ) ; if ( method != null ) { return on ( method , object , accessAll , args ) ; } throw new ReflectionException ( e ) ; } } | Invokes a method with a given name and arguments with the most specific method possible |
19,516 | public Reflect set ( String fieldName , Object value ) throws ReflectionException { Field field = null ; boolean isAccessible = false ; try { if ( hasField ( fieldName ) ) { field = getField ( fieldName ) ; isAccessible = field . isAccessible ( ) ; field . setAccessible ( accessAll ) ; } else { throw new NoSuchElementException ( ) ; } value = convertValueType ( value , field . getType ( ) ) ; field . set ( object , value ) ; return this ; } catch ( IllegalAccessException e ) { throw new ReflectionException ( e ) ; } finally { if ( field != null ) { field . setAccessible ( isAccessible ) ; } } } | Sets the value of a field . Will perform conversion on the value if needed . |
19,517 | public TypedQuery < Long > count ( Filter filter ) { CriteriaQuery < Long > query = cb . createQuery ( Long . class ) ; Root < T > from = query . from ( getEntityClass ( ) ) ; if ( filter != null ) { Predicate where = new CriteriaMapper ( from , cb ) . create ( filter ) ; query . where ( where ) ; } return getEntityManager ( ) . createQuery ( query . select ( cb . count ( from ) ) ) ; } | Creates a new TypedQuery that queries the amount of entities of the entity class of this QueryFactory that a query for the given Filter would return . |
19,518 | public static String generateMD5 ( final String input ) { try { return generateMD5 ( input . getBytes ( "UTF-8" ) ) ; } catch ( UnsupportedEncodingException e ) { LOG . debug ( "An error occurred generating the MD5 Hash of the input string" , e ) ; return null ; } } | Generates a MD5 Hash for a specific string |
19,519 | public static Properties loadClasspath ( String path ) throws IOException { InputStream input = PropUtils . class . getClassLoader ( ) . getResourceAsStream ( path ) ; Properties prop = null ; try { prop = load ( input ) ; } finally { IOUtils . close ( input ) ; } return prop ; } | Loads properties from a file in the classpath . |
19,520 | public Tuple shiftLeft ( ) { if ( degree ( ) < 2 ) { return Tuple0 . INSTANCE ; } Object [ ] copy = new Object [ degree ( ) - 1 ] ; System . arraycopy ( array ( ) , 1 , copy , 0 , copy . length ) ; return NTuple . of ( copy ) ; } | Shifts the first element of the tuple resulting in a tuple of degree - 1 . |
19,521 | public Tuple slice ( int start , int end ) { Preconditions . checkArgument ( start >= 0 , "Start index must be >= 0" ) ; Preconditions . checkArgument ( start < end , "Start index must be < end index" ) ; if ( start >= degree ( ) ) { return Tuple0 . INSTANCE ; } return new NTuple ( Arrays . copyOfRange ( array ( ) , start , Math . min ( end , degree ( ) ) ) ) ; } | Takes a slice of the tuple from an inclusive start to an exclusive end index . |
19,522 | public < T > Tuple appendLeft ( T object ) { if ( degree ( ) == 0 ) { return Tuple1 . of ( object ) ; } Object [ ] copy = new Object [ degree ( ) + 1 ] ; System . arraycopy ( array ( ) , 0 , copy , 1 , degree ( ) ) ; copy [ 0 ] = object ; return NTuple . of ( copy ) ; } | Appends an item the beginning of the tuple resulting in a new tuple of degree + 1 |
19,523 | private boolean isIncluded ( String className ) { if ( includes == null || includes . size ( ) == 0 ) { return false ; } return includes . stream ( ) . filter ( pattern -> SelectorUtils . matchPath ( pattern , className , "." , true ) ) . count ( ) > 0 ; } | Check is class is included . |
19,524 | private boolean isExcluded ( String className ) { if ( excludes == null || excludes . size ( ) == 0 ) { return false ; } return excludes . stream ( ) . filter ( pattern -> SelectorUtils . matchPath ( pattern , className , "." , true ) ) . count ( ) == 0 ; } | Check if class is excluded |
19,525 | private void generateSchema ( Class clazz ) { try { File targetFile = new File ( getGeneratedResourcesDirectory ( ) , clazz . getName ( ) + ".json" ) ; getLog ( ) . info ( "Generate JSON schema: " + targetFile . getName ( ) ) ; SchemaFactoryWrapper schemaFactory = new SchemaFactoryWrapper ( ) ; OBJECT_MAPPER . acceptJsonFormatVisitor ( OBJECT_MAPPER . constructType ( clazz ) , schemaFactory ) ; JsonSchema jsonSchema = schemaFactory . finalSchema ( ) ; OBJECT_MAPPER . writerWithDefaultPrettyPrinter ( ) . writeValue ( targetFile , jsonSchema ) ; } catch ( IOException ex ) { throw new RuntimeException ( ex ) ; } } | Generate JSON schema for given POJO |
19,526 | protected Class < ? > loadClass ( String name , boolean resolve ) throws ClassNotFoundException { synchronized ( LaunchedURLClassLoader . LOCK_PROVIDER . getLock ( this , name ) ) { Class < ? > loadedClass = findLoadedClass ( name ) ; if ( loadedClass == null ) { Handler . setUseFastConnectionExceptions ( true ) ; try { loadedClass = doLoadClass ( name ) ; } finally { Handler . setUseFastConnectionExceptions ( false ) ; } } if ( resolve ) { resolveClass ( loadedClass ) ; } return loadedClass ; } } | Attempt to load classes from the URLs before delegating to the parent loader . |
19,527 | @ SuppressWarnings ( "unchecked" ) public static int compare ( Object o1 , Object o2 ) { if ( o1 == null && o2 == null ) { return 0 ; } else if ( o1 == null ) { return 1 ; } else if ( o2 == null ) { return - 1 ; } return Cast . < Comparable > as ( o1 ) . compareTo ( o2 ) ; } | Compare int . |
19,528 | public static < T > SerializableComparator < T > hashCodeComparator ( ) { return ( o1 , o2 ) -> { if ( o1 == o2 ) { return 0 ; } else if ( o1 == null ) { return 1 ; } else if ( o2 == null ) { return - 1 ; } return Integer . compare ( o1 . hashCode ( ) , o2 . hashCode ( ) ) ; } ; } | Compares two objects based on their hashcode . |
19,529 | public final void addFolder ( final Folder folder ) { Contract . requireArgNotNull ( "folder" , folder ) ; if ( folders == null ) { folders = new ArrayList < > ( ) ; } folders . add ( folder ) ; } | Adds a folder to the list . If the list does not exist it s created . |
19,530 | public Iterator < int [ ] > fastPassByReferenceIterator ( ) { final int [ ] assignments = new int [ dimensions . length ] ; if ( dimensions . length > 0 ) assignments [ 0 ] = - 1 ; return new Iterator < int [ ] > ( ) { public boolean hasNext ( ) { for ( int i = 0 ; i < assignments . length ; i ++ ) { if ( assignments [ i ] < dimensions [ i ] - 1 ) return true ; } return false ; } public int [ ] next ( ) { assignments [ 0 ] ++ ; for ( int i = 0 ; i < assignments . length ; i ++ ) { if ( assignments [ i ] >= dimensions [ i ] ) { assignments [ i ] = 0 ; if ( i < assignments . length - 1 ) { assignments [ i + 1 ] ++ ; } } else { break ; } } return assignments ; } } ; } | This is its own function because people will inevitably attempt this optimization of not cloning the array we hand to the iterator to save on GC and it should not be default behavior . If you know what you re doing then this may be the iterator for you . |
19,531 | private int getTableAccessOffset ( int [ ] assignment ) { assert ( assignment . length == dimensions . length ) ; int offset = 0 ; for ( int i = 0 ; i < assignment . length ; i ++ ) { assert ( assignment [ i ] < dimensions [ i ] ) ; offset = ( offset * dimensions [ i ] ) + assignment [ i ] ; } return offset ; } | Compute the distance into the one dimensional factorTable array that corresponds to a setting of all the neighbors of the factor . |
19,532 | public static String center ( String s , int length ) { if ( s == null ) { return null ; } int start = ( int ) Math . floor ( Math . max ( 0 , ( length - s . length ( ) ) / 2d ) ) ; return padEnd ( repeat ( ' ' , start ) + s , length , ' ' ) ; } | Center string . |
19,533 | public static int compare ( String s1 , String s2 , boolean ignoreCase ) { if ( s1 == null && s2 == null ) { return 0 ; } else if ( s1 == null ) { return - 1 ; } else if ( s2 == null ) { return 1 ; } return ignoreCase ? s1 . compareToIgnoreCase ( s2 ) : s1 . compareTo ( s2 ) ; } | Null safe comparison of strings |
19,534 | public static String firstNonNullOrBlank ( String ... strings ) { if ( strings == null || strings . length == 0 ) { return null ; } for ( String s : strings ) { if ( isNotNullOrBlank ( s ) ) { return s ; } } return null ; } | First non null or blank string . |
19,535 | public static String leftTrim ( CharSequence input ) { if ( input == null ) { return null ; } return StringFunctions . LEFT_TRIM . apply ( input . toString ( ) ) ; } | Left trim . |
19,536 | public static String removeDiacritics ( CharSequence input ) { if ( input == null ) { return null ; } return StringFunctions . DIACRITICS_NORMALIZATION . apply ( input . toString ( ) ) ; } | Normalizes a string by removing the diacritics . |
19,537 | public static String rightTrim ( CharSequence input ) { if ( input == null ) { return null ; } return StringFunctions . RIGHT_TRIM . apply ( input . toString ( ) ) ; } | Right trim . |
19,538 | public static boolean safeEquals ( String s1 , String s2 , boolean caseSensitive ) { if ( s1 == s2 ) { return true ; } else if ( s1 == null || s2 == null ) { return false ; } else if ( caseSensitive ) { return s1 . equals ( s2 ) ; } return s1 . equalsIgnoreCase ( s2 ) ; } | Safe equals . |
19,539 | public static List < String > split ( CharSequence input , char separator ) { if ( input == null ) { return new ArrayList < > ( ) ; } Preconditions . checkArgument ( separator != '"' , "Separator cannot be a quote" ) ; try ( CSVReader reader = CSV . builder ( ) . delimiter ( separator ) . reader ( new StringReader ( input . toString ( ) ) ) ) { List < String > all = new ArrayList < > ( ) ; List < String > row ; while ( ( row = reader . nextRow ( ) ) != null ) { all . addAll ( row ) ; } return all ; } } | Properly splits a delimited separated string . |
19,540 | public static String toCanonicalForm ( CharSequence input ) { if ( input == null ) { return null ; } return StringFunctions . CANONICAL_NORMALIZATION . apply ( input . toString ( ) ) ; } | Normalize to canonical form . |
19,541 | public static String toTitleCase ( CharSequence input ) { if ( input == null ) { return null ; } return StringFunctions . TITLE_CASE . apply ( input . toString ( ) ) ; } | Converts an input string to title case |
19,542 | public static String trim ( CharSequence input ) { if ( input == null ) { return null ; } return StringFunctions . TRIM . apply ( input . toString ( ) ) ; } | Trims a string of unicode whitespace and invisible characters |
19,543 | public static String unescape ( String input , char escapeCharacter ) { if ( input == null ) { return null ; } StringBuilder builder = new StringBuilder ( ) ; for ( int i = 0 ; i < input . length ( ) ; ) { if ( input . charAt ( i ) == escapeCharacter ) { builder . append ( input . charAt ( i + 1 ) ) ; i = i + 2 ; } else { builder . append ( input . charAt ( i ) ) ; i ++ ; } } return builder . toString ( ) ; } | Unescape string . |
19,544 | public static void validateAddress ( String address ) { Matcher matcher = ADDRESS_PATTERN . matcher ( address ) ; if ( ! matcher . matches ( ) ) { String message = "The address must have the format X.X.X.X" ; throw new IllegalArgumentException ( message ) ; } for ( int i = 1 ; i <= 4 ; i ++ ) { int component = Integer . parseInt ( matcher . group ( i ) ) ; if ( component < 0 || component > 255 ) { String message = "All address components must be in the range [0, 255]" ; throw new IllegalArgumentException ( message ) ; } } } | Verifies that the given address is valid |
19,545 | public static void validatePeriod ( Duration period ) { if ( period . equals ( Duration . ZERO ) ) { String message = "The period must be nonzero" ; throw new IllegalArgumentException ( message ) ; } } | Verifies that the given period is valid |
19,546 | public static void validateTimeout ( Duration timeout ) { if ( timeout . equals ( Duration . ZERO ) ) { String message = "The timeout must be nonzero" ; throw new IllegalArgumentException ( message ) ; } } | Verifies that the given timeout is valid |
19,547 | public boolean setProperties ( Dictionary < String , String > properties ) { this . properties = properties ; if ( this . properties != null ) { if ( properties . get ( "debug" ) != null ) debug = Integer . parseInt ( properties . get ( "debug" ) ) ; if ( properties . get ( "input" ) != null ) input = Integer . parseInt ( properties . get ( "input" ) ) ; if ( properties . get ( "output" ) != null ) output = Integer . parseInt ( properties . get ( "output" ) ) ; listings = Boolean . parseBoolean ( properties . get ( "listings" ) ) ; if ( properties . get ( "readonly" ) != null ) readOnly = Boolean . parseBoolean ( properties . get ( "readonly" ) ) ; if ( properties . get ( "sendfileSize" ) != null ) sendfileSize = Integer . parseInt ( properties . get ( "sendfileSize" ) ) * 1024 ; fileEncoding = properties . get ( "fileEncoding" ) ; globalXsltFile = properties . get ( "globalXsltFile" ) ; contextXsltFile = properties . get ( "contextXsltFile" ) ; localXsltFile = properties . get ( "localXsltFile" ) ; readmeFile = properties . get ( "readmeFile" ) ; if ( properties . get ( "useAcceptRanges" ) != null ) useAcceptRanges = Boolean . parseBoolean ( properties . get ( "useAcceptRanges" ) ) ; if ( input < 256 ) input = 256 ; if ( output < 256 ) output = 256 ; if ( debug > 0 ) { log ( "DefaultServlet.init: input buffer size=" + input + ", output buffer size=" + output ) ; } return this . setDocBase ( this . properties . get ( BASE_PATH ) ) ; } else { return this . setDocBase ( null ) ; } } | Set servlet the properties . |
19,548 | @ SuppressWarnings ( { "rawtypes" , "unchecked" } ) public boolean setDocBase ( String basePath ) { proxyDirContext = null ; if ( basePath == null ) return false ; Hashtable env = new Hashtable ( ) ; File file = new File ( basePath ) ; if ( ! file . exists ( ) ) return false ; if ( ! file . isDirectory ( ) ) return false ; env . put ( ProxyDirContext . CONTEXT , file . getPath ( ) ) ; FileDirContext fileContext = new FileDirContext ( env ) ; fileContext . setDocBase ( file . getPath ( ) ) ; proxyDirContext = new ProxyDirContext ( env , fileContext ) ; return true ; } | Set the local file path to serve files from . |
19,549 | public static Properties loadProperties ( final Class < ? > clasz , final String filename ) { checkNotNull ( "clasz" , clasz ) ; checkNotNull ( "filename" , filename ) ; final String path = getPackagePath ( clasz ) ; final String resPath = path + "/" + filename ; return loadProperties ( clasz . getClassLoader ( ) , resPath ) ; } | Load properties from classpath . |
19,550 | public static Properties loadProperties ( final ClassLoader loader , final String resource ) { checkNotNull ( "loader" , loader ) ; checkNotNull ( "resource" , resource ) ; final Properties props = new Properties ( ) ; try ( final InputStream inStream = loader . getResourceAsStream ( resource ) ) { if ( inStream == null ) { throw new IllegalArgumentException ( "Resource '" + resource + "' not found!" ) ; } props . load ( inStream ) ; } catch ( final IOException ex ) { throw new RuntimeException ( ex ) ; } return props ; } | Loads a resource from the classpath as properties . |
19,551 | public static Properties loadProperties ( final URL baseUrl , final String filename ) { return loadProperties ( createUrl ( baseUrl , "" , filename ) ) ; } | Load a file from an directory . |
19,552 | public static Properties loadProperties ( final URL fileURL ) { checkNotNull ( "fileURL" , fileURL ) ; final Properties props = new Properties ( ) ; try ( final InputStream inStream = fileURL . openStream ( ) ) { props . load ( inStream ) ; } catch ( final IOException ex ) { throw new RuntimeException ( ex ) ; } return props ; } | Load a file from an URL . |
19,553 | private ScenarioManager createScenarioManager ( Class < ? extends Scenario > scenarioClass , String scenarioID , String initialState , Properties properties ) throws ShanksException { Constructor < ? extends Scenario > c ; Scenario s = null ; try { c = scenarioClass . getConstructor ( new Class [ ] { String . class , String . class , Properties . class , Logger . class } ) ; s = c . newInstance ( scenarioID , initialState , properties , this . getLogger ( ) ) ; } catch ( SecurityException e ) { throw new ShanksException ( e ) ; } catch ( NoSuchMethodException e ) { throw new ShanksException ( e ) ; } catch ( IllegalArgumentException e ) { throw new ShanksException ( e ) ; } catch ( InstantiationException e ) { throw new ShanksException ( e ) ; } catch ( IllegalAccessException e ) { throw new ShanksException ( e ) ; } catch ( InvocationTargetException e ) { throw new ShanksException ( e ) ; } logger . fine ( "Scenario created" ) ; ScenarioPortrayal sp = s . createScenarioPortrayal ( ) ; if ( sp == null && ! properties . get ( Scenario . SIMULATION_GUI ) . equals ( Scenario . NO_GUI ) ) { logger . severe ( "ScenarioPortrayals is null" ) ; logger . severe ( "Impossible to follow with the execution..." ) ; throw new ShanksException ( "ScenarioPortrayals is null. Impossible to continue with the simulation..." ) ; } ScenarioManager sm = new ScenarioManager ( s , sp , logger ) ; return sm ; } | This method will set all required information about Scenario |
19,554 | public void startSimulation ( ) throws ShanksException { schedule . scheduleRepeating ( Schedule . EPOCH , 0 , this . scenarioManager , 2 ) ; schedule . scheduleRepeating ( Schedule . EPOCH , 1 , this . notificationManager , 1 ) ; this . addAgents ( ) ; this . addSteppables ( ) ; } | The initial configuration of the scenario |
19,555 | private void addAgents ( ) throws ShanksException { for ( Entry < String , ShanksAgent > agentEntry : this . agents . entrySet ( ) ) { stoppables . put ( agentEntry . getKey ( ) , schedule . scheduleRepeating ( Schedule . EPOCH , 2 , agentEntry . getValue ( ) , 1 ) ) ; } } | Add ShanksAgent s to the simulation using registerShanksAgent method |
19,556 | public void registerShanksAgent ( ShanksAgent agent ) throws ShanksException { if ( ! this . agents . containsKey ( agent . getID ( ) ) ) { this . agents . put ( agent . getID ( ) , agent ) ; } else { throw new DuplicatedAgentIDException ( agent . getID ( ) ) ; } } | This method adds and registers the ShanksAgent |
19,557 | public void unregisterShanksAgent ( String agentID ) { if ( this . agents . containsKey ( agentID ) ) { if ( stoppables . containsKey ( agentID ) ) { this . agents . remove ( agentID ) ; this . stoppables . remove ( agentID ) . stop ( ) ; } else { logger . warning ( "No stoppable found while trying to stop the agent. Attempting direct stop..." ) ; this . agents . remove ( agentID ) . stop ( ) ; } } } | Unregisters an agent . |
19,558 | public boolean containsStartTag ( final File file , final String tagName ) { Contract . requireArgNotNull ( "file" , file ) ; FileExistsValidator . requireArgValid ( "file" , file ) ; IsFileValidator . requireArgValid ( "file" , file ) ; Contract . requireArgNotNull ( "tagName" , tagName ) ; final String xml = readFirstPartOfFile ( file ) ; return xml . indexOf ( "<" + tagName ) > - 1 ; } | Checks if the given file contains a start tag within the first 1024 bytes . |
19,559 | @ SuppressWarnings ( "unchecked" ) public < TYPE > TYPE create ( final Reader reader , final JAXBContext jaxbContext ) throws UnmarshalObjectException { Contract . requireArgNotNull ( "reader" , reader ) ; Contract . requireArgNotNull ( "jaxbContext" , jaxbContext ) ; try { final Unmarshaller unmarshaller = jaxbContext . createUnmarshaller ( ) ; final TYPE obj = ( TYPE ) unmarshaller . unmarshal ( reader ) ; return obj ; } catch ( final JAXBException ex ) { throw new UnmarshalObjectException ( "Unable to parse XML from reader" , ex ) ; } } | Creates an instance by reading the XML from a reader . |
19,560 | @ SuppressWarnings ( "unchecked" ) public < TYPE > TYPE create ( final File file , final JAXBContext jaxbContext ) throws UnmarshalObjectException { Contract . requireArgNotNull ( "file" , file ) ; FileExistsValidator . requireArgValid ( "file" , file ) ; IsFileValidator . requireArgValid ( "file" , file ) ; Contract . requireArgNotNull ( "jaxbContext" , jaxbContext ) ; try { final FileReader fr = new FileReader ( file ) ; try { return ( TYPE ) create ( fr , jaxbContext ) ; } finally { fr . close ( ) ; } } catch ( final IOException ex ) { throw new UnmarshalObjectException ( "Unable to parse XML from file: " + file , ex ) ; } } | Creates an instance by reading the XML from a file . |
19,561 | @ SuppressWarnings ( "unchecked" ) public < TYPE > TYPE create ( final String xml , final JAXBContext jaxbContext ) throws UnmarshalObjectException { Contract . requireArgNotNull ( "xml" , xml ) ; Contract . requireArgNotNull ( "jaxbContext" , jaxbContext ) ; return ( TYPE ) create ( new StringReader ( xml ) , jaxbContext ) ; } | Creates an instance by from a given XML . |
19,562 | public < TYPE > void write ( final TYPE obj , final File file , final JAXBContext jaxbContext ) throws MarshalObjectException { Contract . requireArgNotNull ( "obj" , obj ) ; Contract . requireArgNotNull ( "file" , file ) ; Contract . requireArgNotNull ( "jaxbContext" , jaxbContext ) ; try { final FileWriter fw = new FileWriter ( file ) ; try { write ( obj , fw , jaxbContext ) ; } finally { fw . close ( ) ; } } catch ( final IOException ex ) { throw new MarshalObjectException ( "Unable to write XML to file: " + file , ex ) ; } } | Marshals the object as XML to a file . |
19,563 | public < TYPE > String write ( final TYPE obj , final JAXBContext jaxbContext ) throws MarshalObjectException { Contract . requireArgNotNull ( "obj" , obj ) ; Contract . requireArgNotNull ( "jaxbContext" , jaxbContext ) ; final StringWriter writer = new StringWriter ( ) ; write ( obj , writer , jaxbContext ) ; return writer . toString ( ) ; } | Marshals the object as XML to a string . |
19,564 | public < TYPE > void write ( final TYPE obj , final Writer writer , final JAXBContext jaxbContext ) throws MarshalObjectException { Contract . requireArgNotNull ( "obj" , obj ) ; Contract . requireArgNotNull ( "writer" , writer ) ; Contract . requireArgNotNull ( "jaxbContext" , jaxbContext ) ; try { final Marshaller marshaller = jaxbContext . createMarshaller ( ) ; marshaller . setProperty ( Marshaller . JAXB_FORMATTED_OUTPUT , formattedOutput ) ; marshaller . marshal ( obj , writer ) ; } catch ( final JAXBException ex ) { throw new MarshalObjectException ( "Unable to write XML to writer" , ex ) ; } } | Marshals the object as XML to a writer . |
19,565 | public boolean shouldConfigureVirtualenv ( ) { if ( this . configureVirtualenv == ConfigureVirtualenv . NO ) { return false ; } else if ( this . configureVirtualenv == ConfigureVirtualenv . YES ) { return true ; } else { final Optional < File > whichVirtualenv = this . which ( "virtualenv" ) ; return whichVirtualenv . isPresent ( ) ; } } | Determines if a virtualenv should be created for Galaxy . |
19,566 | public boolean isPre20141006Release ( File galaxyRoot ) { if ( galaxyRoot == null ) { throw new IllegalArgumentException ( "galaxyRoot is null" ) ; } else if ( ! galaxyRoot . exists ( ) ) { throw new IllegalArgumentException ( "galaxyRoot=" + galaxyRoot . getAbsolutePath ( ) + " does not exist" ) ; } File configDirectory = new File ( galaxyRoot , CONFIG_DIR_NAME ) ; return ! ( new File ( configDirectory , "galaxy.ini.sample" ) ) . exists ( ) ; } | Determines if this is a pre - 2014 . 10 . 06 release of Galaxy . |
19,567 | private File getConfigSampleIni ( File galaxyRoot ) { if ( isPre20141006Release ( galaxyRoot ) ) { return new File ( galaxyRoot , "universe_wsgi.ini.sample" ) ; } else { File configDirectory = new File ( galaxyRoot , CONFIG_DIR_NAME ) ; return new File ( configDirectory , "galaxy.ini.sample" ) ; } } | Gets the sample config ini for this Galaxy installation . |
19,568 | private File getConfigIni ( File galaxyRoot ) { if ( isPre20141006Release ( galaxyRoot ) ) { return new File ( galaxyRoot , "universe_wsgi.ini" ) ; } else { File configDirectory = new File ( galaxyRoot , CONFIG_DIR_NAME ) ; return new File ( configDirectory , "galaxy.ini" ) ; } } | Gets the config ini for this Galaxy installation . |
19,569 | @ SuppressWarnings ( "unchecked" ) public void init ( ServletConfig config ) throws ServletException { super . init ( config ) ; Enumeration < String > paramNames = this . getInitParameterNames ( ) ; while ( paramNames . hasMoreElements ( ) ) { String paramName = paramNames . nextElement ( ) ; this . setProperty ( paramName , this . getInitParameter ( paramName ) ) ; } if ( Boolean . TRUE . toString ( ) . equalsIgnoreCase ( this . getInitParameter ( LOG_PARAM ) ) ) logger = Logger . getLogger ( PROPERTY_PREFIX ) ; } | web servlet init method . |
19,570 | public String getRequestParam ( HttpServletRequest request , String param , String defaultValue ) { String value = request . getParameter ( servicePid + '.' + param ) ; if ( ( value == null ) && ( properties != null ) ) value = properties . get ( servicePid + '.' + param ) ; if ( value == null ) value = request . getParameter ( param ) ; if ( ( value == null ) && ( properties != null ) ) value = properties . get ( param ) ; if ( value == null ) value = defaultValue ; return value ; } | Get this param from the request or from the servlet s properties . |
19,571 | private static Map < String , Object > readMap ( StreamingInput input ) throws IOException { boolean readEnd = false ; if ( input . peek ( ) == Token . OBJECT_START ) { readEnd = true ; input . next ( ) ; } Token t ; Map < String , Object > result = new HashMap < String , Object > ( ) ; while ( ( t = input . peek ( ) ) != Token . OBJECT_END && t != null ) { input . next ( Token . KEY ) ; String key = input . getString ( ) ; Object value = readDynamic ( input ) ; result . put ( key , value ) ; } if ( readEnd ) { input . next ( Token . OBJECT_END ) ; } return result ; } | Read a single map from the input optionally while reading object start and end tokens . |
19,572 | private static List < Object > readList ( StreamingInput input ) throws IOException { input . next ( Token . LIST_START ) ; List < Object > result = new ArrayList < Object > ( ) ; while ( input . peek ( ) != Token . LIST_END ) { Object value = readDynamic ( input ) ; result . add ( value ) ; } input . next ( Token . LIST_END ) ; return result ; } | Read a list from the input . |
19,573 | private static Object readDynamic ( StreamingInput input ) throws IOException { switch ( input . peek ( ) ) { case VALUE : input . next ( ) ; return input . getValue ( ) ; case NULL : input . next ( ) ; return input . getValue ( ) ; case LIST_START : return readList ( input ) ; case OBJECT_START : return readMap ( input ) ; } throw new SerializationException ( "Unable to read file, unknown start of value: " + input . peek ( ) ) ; } | Depending on the next token read either a value a list or a map . |
19,574 | public void execute ( ) throws MojoExecutionException { try { repositoryPath = findRepoPath ( this . ceylonRepository ) ; ArtifactRepositoryLayout layout = new CeylonRepoLayout ( ) ; getLog ( ) . debug ( "Layout: " + layout . getClass ( ) ) ; localRepository = new DefaultArtifactRepository ( ceylonRepository , repositoryPath . toURI ( ) . toURL ( ) . toString ( ) , layout ) ; getLog ( ) . debug ( "Repository: " + localRepository ) ; } catch ( MalformedURLException e ) { throw new MojoExecutionException ( "MalformedURLException: " + e . getMessage ( ) , e ) ; } if ( project . getFile ( ) != null ) { readModel ( project . getFile ( ) ) ; } if ( skip ) { getLog ( ) . info ( "Skipping artifact installation" ) ; return ; } if ( ! installAtEnd ) { installProject ( project ) ; } else { MavenProject lastProject = reactorProjects . get ( reactorProjects . size ( ) - 1 ) ; if ( lastProject . equals ( project ) ) { for ( MavenProject reactorProject : reactorProjects ) { installProject ( reactorProject ) ; } } else { getLog ( ) . info ( "Installing " + project . getGroupId ( ) + ":" + project . getArtifactId ( ) + ":" + project . getVersion ( ) + " at end" ) ; } } } | MoJo execute . |
19,575 | private void installProject ( final MavenProject mavenProject ) throws MojoExecutionException { Artifact artifact = mavenProject . getArtifact ( ) ; String packaging = mavenProject . getPackaging ( ) ; boolean isPomArtifact = "pom" . equals ( packaging ) ; try { if ( ! isPomArtifact ) { File file = artifact . getFile ( ) ; if ( file != null && file . isFile ( ) ) { install ( file , artifact , localRepository ) ; File artifactFile = new File ( localRepository . getBasedir ( ) , localRepository . pathOf ( artifact ) ) ; installAdditional ( artifactFile , ".sha1" , CeylonUtil . calculateChecksum ( artifactFile ) , false ) ; String deps = calculateDependencies ( mavenProject ) ; if ( ! "" . equals ( deps ) ) { installAdditional ( artifactFile , "module.properties" , deps , false ) ; installAdditional ( artifactFile , ".module" , deps , true ) ; } } else { throw new MojoExecutionException ( "The packaging for this project did not assign a file to the build artifact" ) ; } } } catch ( Exception e ) { throw new MojoExecutionException ( e . getMessage ( ) , e ) ; } } | Does the actual installation of the project s main artifact . |
19,576 | void install ( final File file , final Artifact artifact , final ArtifactRepository repo ) throws MojoExecutionException { File destFile = new File ( repo . getBasedir ( ) + File . separator + repo . getLayout ( ) . pathOf ( artifact ) ) ; destFile . getParentFile ( ) . mkdirs ( ) ; try { FileUtils . copyFile ( file , destFile ) ; } catch ( IOException e ) { throw new MojoExecutionException ( e . getMessage ( ) , e ) ; } } | The actual copy . |
19,577 | String calculateDependencies ( final MavenProject proj ) throws MojoExecutionException { Module module = new Module ( new ModuleIdentifier ( CeylonUtil . ceylonModuleBaseName ( proj . getGroupId ( ) , proj . getArtifactId ( ) ) , proj . getVersion ( ) , false , false ) ) ; for ( Dependency dep : proj . getDependencies ( ) ) { if ( dep . getVersion ( ) != null && ! "" . equals ( dep . getVersion ( ) ) ) { if ( ! "test" . equals ( dep . getScope ( ) ) && dep . getSystemPath ( ) == null ) { module . addDependency ( new ModuleIdentifier ( CeylonUtil . ceylonModuleBaseName ( dep . getGroupId ( ) , dep . getArtifactId ( ) ) , dep . getVersion ( ) , dep . isOptional ( ) , false ) ) ; } } else { throw new MojoExecutionException ( "Dependency version for " + dep + " in project " + proj + "could not be determined from the POM. Aborting." ) ; } } StringBuilder builder = new StringBuilder ( CeylonUtil . STRING_BUILDER_SIZE ) ; for ( ModuleIdentifier depMod : module . getDependencies ( ) ) { builder . append ( depMod . getName ( ) ) ; if ( depMod . isOptional ( ) ) { builder . append ( "?" ) ; } builder . append ( "=" ) . append ( depMod . getVersion ( ) ) ; builder . append ( System . lineSeparator ( ) ) ; } return builder . toString ( ) ; } | Determines dependencies from the Maven project model . |
19,578 | File findRepoPath ( final String repoAlias ) { if ( "user" . equals ( repoAlias ) ) { return new File ( System . getProperty ( "user.home" ) + CeylonUtil . PATH_SEPARATOR + ".ceylon/repo" ) ; } else if ( "cache" . equals ( repoAlias ) ) { return new File ( System . getProperty ( "user.home" ) + CeylonUtil . PATH_SEPARATOR + ".ceylon/cache" ) ; } else if ( "system" . equals ( repoAlias ) ) { throw new IllegalArgumentException ( "Ceylon Repository 'system' should not be written to" ) ; } else if ( "remote" . equals ( repoAlias ) ) { throw new IllegalArgumentException ( "Ceylon Repository 'remote' should use the ceylon:deploy Maven goal" ) ; } else if ( "local" . equals ( repoAlias ) ) { return new File ( project . getBasedir ( ) , "modules" ) ; } else { throw new IllegalArgumentException ( "Property ceylonRepository must one of 'user', 'cache' or 'local'. Defaults to 'user'" ) ; } } | Find the Ceylon repository path from the alias . |
19,579 | void installAdditional ( final File installedFile , final String fileExt , final String payload , final boolean chop ) throws MojoExecutionException { File additionalFile = null ; if ( chop ) { String path = installedFile . getAbsolutePath ( ) ; additionalFile = new File ( path . substring ( 0 , path . lastIndexOf ( '.' ) ) + fileExt ) ; } else { if ( fileExt . indexOf ( '.' ) > 0 ) { additionalFile = new File ( installedFile . getParentFile ( ) , fileExt ) ; } else { additionalFile = new File ( installedFile . getAbsolutePath ( ) + fileExt ) ; } } getLog ( ) . debug ( "Installing additional file to " + additionalFile ) ; try { additionalFile . getParentFile ( ) . mkdirs ( ) ; FileUtils . fileWrite ( additionalFile . getAbsolutePath ( ) , "UTF-8" , payload ) ; } catch ( IOException e ) { throw new MojoExecutionException ( "Failed to install additional file to " + additionalFile , e ) ; } } | Installs additional files into the same repo directory as the artifact . |
19,580 | public boolean complete ( Number value ) { return root . complete ( new Tree ( ( Tree ) null , null , value ) ) ; } | If not already completed sets the value to the given numeric value . |
19,581 | public boolean complete ( String value ) { return root . complete ( new Tree ( ( Tree ) null , null , value ) ) ; } | If not already completed sets the value to the given text . |
19,582 | public boolean complete ( Date value ) { return root . complete ( new Tree ( ( Tree ) null , null , value ) ) ; } | If not already completed sets the value to the given date . |
19,583 | public boolean complete ( UUID value ) { return root . complete ( new Tree ( ( Tree ) null , null , value ) ) ; } | If not already completed sets the value to the given UUID . |
19,584 | public boolean complete ( InetAddress value ) { return root . complete ( new Tree ( ( Tree ) null , null , value ) ) ; } | If not already completed sets the value to the given InetAddress . |
19,585 | public static final Promise race ( Promise ... promises ) { if ( promises == null || promises . length == 0 ) { return Promise . resolve ( ) ; } @ SuppressWarnings ( "unchecked" ) CompletableFuture < Tree > [ ] futures = new CompletableFuture [ promises . length ] ; for ( int i = 0 ; i < promises . length ; i ++ ) { futures [ i ] = promises [ i ] . future ; } CompletableFuture < Object > any = CompletableFuture . anyOf ( futures ) ; return new Promise ( r -> { any . whenComplete ( ( object , error ) -> { try { if ( error != null ) { r . reject ( error ) ; return ; } r . resolve ( ( Tree ) object ) ; } catch ( Throwable cause ) { r . reject ( cause ) ; } } ) ; } ) ; } | Returns a new Promise that is completed when any of the given Promises complete with the same result . Otherwise if it completed exceptionally the returned Promise also does so with a CompletionException holding this exception as its cause . |
19,586 | @ SuppressWarnings ( "unchecked" ) protected static final Tree toTree ( Object object ) { if ( object == null ) { return new Tree ( ( Tree ) null , null , null ) ; } if ( object instanceof Tree ) { return ( Tree ) object ; } if ( object instanceof Map ) { return new Tree ( ( Map < String , Object > ) object ) ; } return new Tree ( ( Tree ) null , null , object ) ; } | Converts an Object to a Tree . |
19,587 | public Object addingService ( ServiceReference reference ) { HttpService httpService = ( HttpService ) context . getService ( reference ) ; this . properties = this . updateDictionaryConfig ( this . properties , true ) ; try { String alias = this . getAlias ( ) ; String servicePid = this . properties . get ( BundleConstants . SERVICE_PID ) ; if ( servlet == null ) { servlet = this . makeServlet ( alias , this . properties ) ; if ( servlet instanceof WebappServlet ) ( ( WebappServlet ) servlet ) . init ( context , servicePid , this . properties ) ; } else if ( servlet instanceof WebappServlet ) ( ( WebappServlet ) servlet ) . setProperties ( properties ) ; if ( servicePid != null ) serviceRegistration = context . registerService ( ManagedService . class . getName ( ) , new HttpConfigurator ( context , servicePid ) , this . properties ) ; httpService . registerServlet ( alias , servlet , this . properties , httpContext ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } return httpService ; } | Http Service is up add my servlets . |
19,588 | public Servlet makeServlet ( String alias , Dictionary < String , String > dictionary ) { String servletClass = dictionary . get ( BundleConstants . SERVICE_CLASS ) ; return ( Servlet ) ClassServiceUtility . getClassService ( ) . makeObjectFromClassName ( servletClass ) ; } | Create the servlet . The SERVLET_CLASS property must be supplied . |
19,589 | public void removeService ( ServiceReference reference , Object service ) { if ( serviceRegistration != null ) { serviceRegistration . unregister ( ) ; serviceRegistration = null ; } String alias = this . getAlias ( ) ; ( ( HttpService ) service ) . unregister ( alias ) ; if ( servlet instanceof WebappServlet ) ( ( WebappServlet ) servlet ) . free ( ) ; servlet = null ; } | Http Service is down remove my servlet . |
19,590 | public String getAlias ( ) { String alias = this . properties . get ( BaseWebappServlet . ALIAS ) ; if ( alias == null ) alias = this . properties . get ( BaseWebappServlet . ALIAS . substring ( BaseWebappServlet . PROPERTY_PREFIX . length ( ) ) ) ; return HttpServiceTracker . addURLPath ( null , alias ) ; } | Get the web context path from the service name . |
19,591 | public String calculateWebAlias ( Dictionary < String , String > dictionary ) { String alias = dictionary . get ( BaseWebappServlet . ALIAS ) ; if ( alias == null ) alias = dictionary . get ( BaseWebappServlet . ALIAS . substring ( BaseWebappServlet . PROPERTY_PREFIX . length ( ) ) ) ; if ( alias == null ) alias = this . getAlias ( ) ; if ( alias == null ) alias = context . getProperty ( BaseWebappServlet . ALIAS ) ; if ( alias == null ) alias = context . getProperty ( BaseWebappServlet . ALIAS . substring ( BaseWebappServlet . PROPERTY_PREFIX . length ( ) ) ) ; if ( alias == null ) alias = DEFAULT_WEB_ALIAS ; return alias ; } | Figure out the correct web alias . |
19,592 | public void configPropertiesUpdated ( Dictionary < String , String > properties ) { if ( HttpServiceTracker . propertiesEqual ( properties , configProperties ) ) return ; configProperties = properties ; ServiceReference reference = context . getServiceReference ( HttpService . class . getName ( ) ) ; if ( reference == null ) return ; HttpService httpService = ( HttpService ) context . getService ( reference ) ; String oldAlias = this . getAlias ( ) ; this . changeServletProperties ( servlet , properties ) ; String alias = properties . get ( BaseWebappServlet . ALIAS ) ; boolean restartRequired = false ; if ( ! oldAlias . equals ( alias ) ) restartRequired = true ; else if ( servlet instanceof WebappServlet ) restartRequired = ( ( WebappServlet ) servlet ) . restartRequired ( ) ; if ( ! restartRequired ) return ; try { httpService . unregister ( oldAlias ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } this . properties . put ( BaseWebappServlet . ALIAS , alias ) ; if ( servlet instanceof WebappServlet ) if ( ( ( WebappServlet ) servlet ) . restartRequired ( ) ) { ( ( WebappServlet ) servlet ) . free ( ) ; servlet = null ; } this . addingService ( reference ) ; } | Update the servlet s properties . Called when the configuration changes . |
19,593 | public boolean changeServletProperties ( Servlet servlet , Dictionary < String , String > properties ) { if ( servlet instanceof WebappServlet ) { Dictionary < String , String > dictionary = ( ( WebappServlet ) servlet ) . getProperties ( ) ; properties = BaseBundleActivator . putAll ( properties , dictionary ) ; } return this . setServletProperties ( servlet , properties ) ; } | Change the servlet properties to these properties . |
19,594 | public boolean setServletProperties ( Servlet servlet , Dictionary < String , String > properties ) { this . properties = properties ; if ( servlet instanceof WebappServlet ) return ( ( WebappServlet ) servlet ) . setProperties ( properties ) ; return true ; } | Set the serlvlet s properties . |
19,595 | public static boolean propertiesEqual ( Dictionary < String , String > properties , Dictionary < String , String > dictionary ) { Enumeration < String > props = properties . keys ( ) ; while ( props . hasMoreElements ( ) ) { String key = props . nextElement ( ) ; if ( ! properties . get ( key ) . equals ( dictionary . get ( key ) ) ) return false ; } props = dictionary . keys ( ) ; while ( props . hasMoreElements ( ) ) { String key = props . nextElement ( ) ; if ( ! dictionary . get ( key ) . equals ( properties . get ( key ) ) ) return false ; } return true ; } | Are these properties equal . |
19,596 | private String buildLogPath ( File bootstrapLogDir , String logFileName ) { return new File ( bootstrapLogDir , logFileName ) . getAbsolutePath ( ) ; } | Constructs a path of a file under the bootstrap log directory . |
19,597 | private void executeGalaxyScript ( final String scriptName ) { final String bashScript = String . format ( "cd %s; if [ -d .venv ]; then . .venv/bin/activate; fi; %s" , getPath ( ) , scriptName ) ; IoUtils . executeAndWait ( "bash" , "-c" , bashScript ) ; } | Executes a script within the Galaxy root directory . |
19,598 | public void stateMachine ( ShanksSimulation sim ) throws Exception { logger . fine ( "Using default state machine for ScenarioManager" ) ; this . checkFailures ( sim ) ; this . generateFailures ( sim ) ; this . generateScenarioEvents ( sim ) ; this . generateNetworkElementEvents ( sim ) ; long step = sim . getSchedule ( ) . getSteps ( ) ; if ( step % 500 == 0 ) { logger . info ( "Step: " + step ) ; logger . finest ( "In step " + step + ", there are " + sim . getScenario ( ) . getCurrentFailures ( ) . size ( ) + " current failures." ) ; logger . finest ( "In step " + step + ", there are " + sim . getNumOfResolvedFailures ( ) + " resolved failures." ) ; } } | This method implements the state machine of the scenario manager |
19,599 | public EmbedVaadinComponent withTheme ( String theme ) { assertNotNull ( theme , "theme could not be null." ) ; getConfig ( ) . setTheme ( theme ) ; return self ( ) ; } | Specifies the vaadin theme to use for the application . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.