idx int64 0 41.2k | question stringlengths 83 4.15k | target stringlengths 5 715 |
|---|---|---|
10,700 | public final void evaluate ( ) { final POSEvaluator evaluator = new POSEvaluator ( this . posTagger ) ; try { evaluator . evaluate ( this . testSamples ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } System . out . println ( evaluator . getWordAccuracy ( ) ) ; } | Evaluate word accuracy . |
10,701 | public final void detailEvaluate ( ) { final List < EvaluationMonitor < POSSample > > listeners = new LinkedList < EvaluationMonitor < POSSample > > ( ) ; final POSTaggerFineGrainedReportListener detailedFListener = new POSTaggerFineGrainedReportListener ( System . out ) ; listeners . add ( detailedFListener ) ; final ... | Detail evaluation of a model outputting the report a file . |
10,702 | private static Stream < Node > streamChildNodes ( Node node ) { int children = node . getChildNodes ( ) . getLength ( ) ; Node firstChild = node . getFirstChild ( ) ; if ( firstChild == null ) return Stream . empty ( ) ; return Stream . iterate ( firstChild , prev -> prev != null ? prev . getNextSibling ( ) : null ) . ... | Needs to be thread - safe childNodes NodeList is not! |
10,703 | private static Stream < Node > streamAttributes ( Node node ) { final NamedNodeMap attributes = node . getAttributes ( ) ; if ( attributes == null ) return Stream . empty ( ) ; return IntStream . range ( 0 , attributes . getLength ( ) ) . mapToObj ( attributes :: item ) ; } | Needs to be thread - safe |
10,704 | protected void changeState ( final State newState ) { if ( state . compareAndSet ( newState . oppositeState ( ) , newState ) ) { changeSupport . firePropertyChange ( PROPERTY_NAME , ! isOpen ( newState ) , isOpen ( newState ) ) ; } } | Changes the internal state of this circuit breaker . If there is actually a change of the state value all registered change listeners are notified . |
10,705 | private static boolean isDelimiter ( final char ch , final char [ ] delimiters ) { if ( delimiters == null ) { return CharUtils . isWhitespace ( ch ) ; } for ( final char delimiter : delimiters ) { if ( ch == delimiter ) { return true ; } } return false ; } | Is the character a delimiter . |
10,706 | public T get ( ) throws ConcurrentException { T result = reference . get ( ) ; if ( result == null ) { result = initialize ( ) ; if ( ! reference . compareAndSet ( null , result ) ) { result = reference . get ( ) ; } } return result ; } | Returns the object managed by this initializer . The object is created if it is not available yet and stored internally . This method always returns the same object . |
10,707 | public final List < Morpheme > getMorphemes ( final String [ ] tokens , final String [ ] posTags ) { final List < String > lemmas = lemmatize ( tokens , posTags ) ; final List < Morpheme > morphemes = getMorphemesFromStrings ( tokens , posTags , lemmas ) ; return morphemes ; } | Get lemmas from a tokenized and pos tagged sentence . |
10,708 | public List < String > lemmatize ( String [ ] tokens , String [ ] posTags ) { String [ ] annotatedLemmas = lemmatizer . lemmatize ( tokens , posTags ) ; String [ ] decodedLemmas = lemmatizer . decodeLemmas ( tokens , annotatedLemmas ) ; final List < String > lemmas = new ArrayList < String > ( Arrays . asList ( decoded... | Produce lemmas from a tokenized sentence and its postags . |
10,709 | private void initializeTransientFields ( final Class < L > listenerInterface , final ClassLoader classLoader ) { @ SuppressWarnings ( "unchecked" ) final L [ ] array = ( L [ ] ) Array . newInstance ( listenerInterface , 0 ) ; this . prototypeArray = array ; createProxy ( listenerInterface , classLoader ) ; } | Initialize transient fields . |
10,710 | private void createProxy ( final Class < L > listenerInterface , final ClassLoader classLoader ) { proxy = listenerInterface . cast ( Proxy . newProxyInstance ( classLoader , new Class [ ] { listenerInterface } , createInvocationHandler ( ) ) ) ; } | Create the proxy object . |
10,711 | @ GwtIncompatible ( "incompatible method" ) public final String translate ( final CharSequence input ) { if ( input == null ) { return null ; } try { final StringWriter writer = new StringWriter ( input . length ( ) * 2 ) ; translate ( input , writer ) ; return writer . toString ( ) ; } catch ( final IOException ioe ) ... | Helper for non - Writer usage . |
10,712 | @ GwtIncompatible ( "incompatible method" ) private static boolean memberEquals ( final Class < ? > type , final Object o1 , final Object o2 ) { if ( o1 == o2 ) { return true ; } if ( o1 == null || o2 == null ) { return false ; } if ( type . isArray ( ) ) { return arrayMemberEquals ( type . getComponentType ( ) , o1 , ... | Helper method for checking whether two objects of the given type are equal . This method is used to compare the parameters of two annotation instances . |
10,713 | @ GwtIncompatible ( "incompatible method" ) private static boolean arrayMemberEquals ( final Class < ? > componentType , final Object o1 , final Object o2 ) { if ( componentType . isAnnotation ( ) ) { return annotationArrayMemberEquals ( ( Annotation [ ] ) o1 , ( Annotation [ ] ) o2 ) ; } if ( componentType . equals ( ... | Helper method for comparing two objects of an array type . |
10,714 | @ GwtIncompatible ( "incompatible method" ) private static boolean annotationArrayMemberEquals ( final Annotation [ ] a1 , final Annotation [ ] a2 ) { if ( a1 . length != a2 . length ) { return false ; } for ( int i = 0 ; i < a1 . length ; i ++ ) { if ( ! equals ( a1 [ i ] , a2 [ i ] ) ) { return false ; } } return tru... | Helper method for comparing two arrays of annotations . |
10,715 | private static int arrayMemberHash ( final Class < ? > componentType , final Object o ) { if ( componentType . equals ( Byte . TYPE ) ) { return Arrays . hashCode ( ( byte [ ] ) o ) ; } if ( componentType . equals ( Short . TYPE ) ) { return Arrays . hashCode ( ( short [ ] ) o ) ; } if ( componentType . equals ( Intege... | Helper method for generating a hash code for an array . |
10,716 | public static StrMatcher charSetMatcher ( final char ... chars ) { if ( chars == null || chars . length == 0 ) { return NONE_MATCHER ; } if ( chars . length == 1 ) { return new CharMatcher ( chars [ 0 ] ) ; } return new CharSetMatcher ( chars ) ; } | Constructor that creates a matcher from a set of characters . |
10,717 | public static StrMatcher charSetMatcher ( final String chars ) { if ( StringUtils . isEmpty ( chars ) ) { return NONE_MATCHER ; } if ( chars . length ( ) == 1 ) { return new CharMatcher ( chars . charAt ( 0 ) ) ; } return new CharSetMatcher ( chars . toCharArray ( ) ) ; } | Constructor that creates a matcher from a string representing a set of characters . |
10,718 | public static StrMatcher stringMatcher ( final String str ) { if ( StringUtils . isEmpty ( str ) ) { return NONE_MATCHER ; } return new StringMatcher ( str ) ; } | Constructor that creates a matcher from a string . |
10,719 | public final void evaluate ( ) { final LemmatizerEvaluator evaluator = new LemmatizerEvaluator ( this . lemmatizer ) ; try { evaluator . evaluate ( this . testSamples ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } System . out . println ( evaluator . getWordAccuracy ( ) ) ; } | Evaluate and print word accuracy . |
10,720 | private static String modify ( final String str , final String [ ] set , final boolean expect ) { final CharSet chars = CharSet . getInstance ( set ) ; final StringBuilder buffer = new StringBuilder ( str . length ( ) ) ; final char [ ] chrs = str . toCharArray ( ) ; for ( final char chr : chrs ) { if ( chars . contain... | Implementation of delete and keep |
10,721 | private static boolean deepEmpty ( final String [ ] strings ) { if ( strings != null ) { for ( final String s : strings ) { if ( StringUtils . isNotEmpty ( s ) ) { return false ; } } } return true ; } | Determines whether or not all the Strings in an array are empty or not . |
10,722 | private int readArgumentIndex ( final String pattern , final ParsePosition pos ) { final int start = pos . getIndex ( ) ; seekNonWs ( pattern , pos ) ; final StringBuilder result = new StringBuilder ( ) ; boolean error = false ; for ( ; ! error && pos . getIndex ( ) < pattern . length ( ) ; next ( pos ) ) { char c = pa... | Read the argument index from the current format element |
10,723 | private String parseFormatDescription ( final String pattern , final ParsePosition pos ) { final int start = pos . getIndex ( ) ; seekNonWs ( pattern , pos ) ; final int text = pos . getIndex ( ) ; int depth = 1 ; for ( ; pos . getIndex ( ) < pattern . length ( ) ; next ( pos ) ) { switch ( pattern . charAt ( pos . get... | Parse the format component of a format element . |
10,724 | private boolean containsElements ( final Collection < ? > coll ) { if ( coll == null || coll . isEmpty ( ) ) { return false ; } for ( final Object name : coll ) { if ( name != null ) { return true ; } } return false ; } | Learn whether the specified Collection contains non - null elements . |
10,725 | public WnsNotificationResponse pushTile ( String channelUri , WnsTile tile ) throws WnsException { return this . pushTile ( channelUri , null , tile ) ; } | Pushes a tile to channelUri |
10,726 | public WnsNotificationResponse pushTile ( String channelUri , WnsNotificationRequestOptional optional , WnsTile tile ) throws WnsException { return this . client . push ( xmlResourceBuilder , channelUri , tile , this . retryPolicy , optional ) ; } | Pushes a tile to channelUri using optional headers |
10,727 | public List < WnsNotificationResponse > pushTile ( List < String > channelUris , WnsTile tile ) throws WnsException { return this . pushTile ( channelUris , null , tile ) ; } | Pushes a tile to channelUris |
10,728 | public WnsNotificationResponse pushToast ( String channelUri , WnsToast toast ) throws WnsException { return this . pushToast ( channelUri , null , toast ) ; } | Pushes a toast to channelUri |
10,729 | public WnsNotificationResponse pushToast ( String channelUri , WnsNotificationRequestOptional optional , WnsToast toast ) throws WnsException { return this . client . push ( xmlResourceBuilder , channelUri , toast , this . retryPolicy , optional ) ; } | Pushes a toast to channelUri using optional headers |
10,730 | public List < WnsNotificationResponse > pushToast ( List < String > channelUris , WnsToast toast ) throws WnsException { return this . pushToast ( channelUris , null , toast ) ; } | Pushes a toast to channelUris |
10,731 | public WnsNotificationResponse pushBadge ( String channelUri , WnsNotificationRequestOptional optional , WnsBadge badge ) throws WnsException { return this . client . push ( xmlResourceBuilder , channelUri , badge , this . retryPolicy , optional ) ; } | Pushes a badge to channelUri using optional headers |
10,732 | public List < WnsNotificationResponse > pushBadge ( List < String > channelUris , WnsBadge badge ) throws WnsException { return this . pushBadge ( channelUris , null , badge ) ; } | Pushes a badge to channelUris |
10,733 | public WnsNotificationResponse pushRaw ( String channelUri , WnsNotificationRequestOptional optional , WnsRaw raw ) throws WnsException { return this . client . push ( rawResourceBuilder , channelUri , raw , this . retryPolicy , optional ) ; } | Pushes a raw message to channelUri using optional headers |
10,734 | public List < WnsNotificationResponse > pushRaw ( List < String > channelUris , WnsRaw raw ) throws WnsException { return this . pushRaw ( channelUris , null , raw ) ; } | Pushes a raw message to channelUris |
10,735 | public void render ( File outputDirectory , ApplicationTemplate applicationTemplate , File applicationDirectory , Renderer renderer , Map < String , String > options , Map < String , String > typeAnnotations ) throws IOException { options = fixOptions ( options ) ; buildRenderer ( outputDirectory , applicationTemplate ... | Renders a Roboconf application into a given format . |
10,736 | private IRenderer buildRenderer ( File outputDirectory , ApplicationTemplate applicationTemplate , File applicationDirectory , Renderer renderer , Map < String , String > typeAnnotations ) { IRenderer result = null ; switch ( renderer ) { case HTML : result = new HtmlRenderer ( outputDirectory , applicationTemplate , a... | Builds the right renderer . |
10,737 | public static void save ( File f , Application app ) throws IOException { Properties properties = new Properties ( ) ; if ( ! Utils . isEmptyOrWhitespaces ( app . getDisplayName ( ) ) ) properties . setProperty ( APPLICATION_NAME , app . getDisplayName ( ) ) ; if ( ! Utils . isEmptyOrWhitespaces ( app . getDescription ... | Saves an application descriptor . |
10,738 | public static void addResourceAfterAngularJS ( String library , String resource ) { FacesContext ctx = FacesContext . getCurrentInstance ( ) ; UIViewRoot v = ctx . getViewRoot ( ) ; Map < String , Object > viewMap = v . getViewMap ( ) ; @ SuppressWarnings ( "unchecked" ) Map < String , String > resourceMap = ( Map < St... | Registers a JS file that needs to be include in the header of the HTML file but after jQuery and AngularJS . |
10,739 | public Collection < InstanceContextBean > apply ( Collection < InstanceContextBean > instances ) { final ArrayList < InstanceContextBean > result = new ArrayList < InstanceContextBean > ( ) ; for ( InstanceContextBean instance : instances ) { boolean installerMatches = this . installerName == null || this . installerNa... | Applies this filter to the given instances . |
10,740 | protected String acquireIpAddress ( TargetHandlerParameters parameters , String machineId ) { String result = null ; String ips = parameters . getTargetProperties ( ) . get ( IP_ADDRESSES ) ; ips = ips == null ? "" : ips ; for ( String ip : Utils . splitNicely ( ips , "," ) ) { if ( Utils . isEmptyOrWhitespaces ( ip ) ... | Acquires an IP address among available ones . |
10,741 | private InstanceContext findAgentContext ( Application application , Instance instance ) { Instance scopedInstance = InstanceHelpers . findScopedInstance ( instance ) ; return new InstanceContext ( application , scopedInstance ) ; } | Builds an instance context corresponding to an agent . |
10,742 | public static < T extends Serializable > byte [ ] serializeObject ( T object ) throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream ( ) ; ObjectOutputStream out = new ObjectOutputStream ( os ) ; out . writeObject ( object ) ; return os . toByteArray ( ) ; } | Serializes an object . |
10,743 | public static < T extends Serializable > T deserializeObject ( byte [ ] bytes , Class < T > clazz ) throws IOException , ClassNotFoundException { ByteArrayInputStream is = new ByteArrayInputStream ( bytes ) ; ObjectInputStream deserializer = new ObjectInputStream ( is ) ; return clazz . cast ( deserializer . readObject... | Deserializes an object . |
10,744 | static void checkErrors ( Collection < RoboconfError > errors , Logger logger ) throws InvalidApplicationException { if ( RoboconfErrorHelpers . containsCriticalErrors ( errors ) ) throw new InvalidApplicationException ( errors ) ; Collection < RoboconfError > warnings = RoboconfErrorHelpers . findWarnings ( errors ) ;... | A method to check errors . |
10,745 | private ManagedApplication createNewApplication ( String name , String description , ApplicationTemplate tpl , File configurationDirectory ) throws AlreadyExistingException , IOException { this . logger . info ( "Creating application " + name + " from template " + tpl + "..." ) ; if ( Utils . isEmptyOrWhitespaces ( nam... | Creates a new application from a template . |
10,746 | private static String getFileExtension ( final String filename ) { String extension = "" ; int i = filename . lastIndexOf ( '.' ) ; int p = Math . max ( filename . lastIndexOf ( '/' ) , filename . lastIndexOf ( '\\' ) ) ; if ( i > p ) extension = filename . substring ( i + 1 ) ; return extension ; } | Get the file name extension from its name . |
10,747 | public static Graphs loadGraph ( File graphFile , File graphDirectory , ApplicationLoadResult alr ) { FromGraphDefinition fromDef = new FromGraphDefinition ( graphDirectory ) ; Graphs graph = fromDef . buildGraphs ( graphFile ) ; alr . getParsedFiles ( ) . addAll ( fromDef . getProcessedImports ( ) ) ; if ( ! fromDef .... | Loads a graph file . |
10,748 | public static InstancesLoadResult loadInstances ( File instancesFile , File rootDirectory , Graphs graph , String applicationName ) { InstancesLoadResult result = new InstancesLoadResult ( ) ; INST : { if ( ! instancesFile . exists ( ) ) { RoboconfError error = new RoboconfError ( ErrorCode . PROJ_MISSING_INSTANCE_EP )... | Loads instances from a file . |
10,749 | public static void writeInstances ( File targetFile , Collection < Instance > rootInstances ) throws IOException { FileDefinition def = new FromInstances ( ) . buildFileDefinition ( rootInstances , targetFile , false , true ) ; ParsingModelIo . saveRelationsFile ( def , false , "\n" ) ; } | Writes all the instances into a file . |
10,750 | public static AbstractLifeCycleManager build ( Instance instance , String appName , IAgentClient messagingClient ) { AbstractLifeCycleManager result ; switch ( instance . getStatus ( ) ) { case DEPLOYED_STARTED : result = new DeployedStarted ( appName , messagingClient ) ; break ; case DEPLOYED_STOPPED : result = new D... | Builds the right handler depending on the current instance s state . |
10,751 | public void updateStateFromImports ( Instance impactedInstance , PluginInterface plugin , Import importChanged , InstanceStatus statusChanged ) throws IOException , PluginException { boolean haveAllImports = ImportHelpers . hasAllRequiredImports ( impactedInstance , this . logger ) ; if ( haveAllImports ) { if ( impact... | Updates the status of an instance based on the imports . |
10,752 | public static void copyInstanceResources ( Instance instance , Map < String , byte [ ] > fileNameToFileContent ) throws IOException { File dir = InstanceHelpers . findInstanceDirectoryOnAgent ( instance ) ; Utils . createDirectory ( dir ) ; if ( fileNameToFileContent != null ) { for ( Map . Entry < String , byte [ ] > ... | Copies the resources of an instance on the disk . |
10,753 | public static void executeScriptResources ( File scriptsDir ) throws IOException { if ( scriptsDir . isDirectory ( ) ) { List < File > scriptFiles = Utils . listAllFiles ( scriptsDir ) ; Logger logger = Logger . getLogger ( AgentUtils . class . getName ( ) ) ; for ( File script : scriptFiles ) { if ( script . getName (... | Executes a script resource on a given instance . |
10,754 | public static void deleteInstanceResources ( Instance instance ) throws IOException { File dir = InstanceHelpers . findInstanceDirectoryOnAgent ( instance ) ; Utils . deleteFilesRecursively ( dir ) ; } | Deletes the resources for a given instance . |
10,755 | public static Map < String , byte [ ] > collectLogs ( String karafData ) throws IOException { Map < String , byte [ ] > logFiles = new HashMap < > ( 2 ) ; if ( ! Utils . isEmptyOrWhitespaces ( karafData ) ) { String [ ] names = { "karaf.log" , "roboconf.log" } ; for ( String name : names ) { File log = new File ( karaf... | Collect the main log files into a map . |
10,756 | public static void injectConfigurations ( String karafEtc , String applicationName , String scopedInstancePath , String domain , String ipAddress ) { File injectionDir = new File ( karafEtc , INJECTED_CONFIGS_DIR ) ; if ( injectionDir . isDirectory ( ) ) { for ( File source : Utils . listAllFiles ( injectionDir , ".cfg... | Generates configuration files from templates . |
10,757 | private void cleanupAfterView ( ) { FacesContext ctx = FacesContext . getCurrentInstance ( ) ; ResponseWriter orig = ( ResponseWriter ) ctx . getAttributes ( ) . get ( ORIGINAL_WRITER ) ; assert ( null != orig ) ; ctx . setResponseWriter ( orig ) ; } | Copied from com . sun . faces . context . PartialViewContextImpl . |
10,758 | public static File findTemplateDirectory ( ApplicationTemplate tpl , File configurationDirectory ) { StringBuilder sb = new StringBuilder ( TEMPLATES ) ; sb . append ( "/" ) ; sb . append ( tpl . getName ( ) ) ; if ( ! Utils . isEmptyOrWhitespaces ( tpl . getVersion ( ) ) ) { sb . append ( " - " ) ; sb . append ( tpl .... | Finds the directory that contains the files for an application template . |
10,759 | public static void saveInstances ( Application app ) { File targetFile = new File ( app . getDirectory ( ) , Constants . PROJECT_DIR_INSTANCES + "/" + INSTANCES_FILE ) ; try { Utils . createDirectory ( targetFile . getParentFile ( ) ) ; RuntimeModelIo . writeInstances ( targetFile , app . getRootInstances ( ) ) ; } cat... | Saves the instances into a file . |
10,760 | public static InstancesLoadResult restoreInstances ( ManagedApplication ma ) { File sourceFile = new File ( ma . getDirectory ( ) , Constants . PROJECT_DIR_INSTANCES + "/" + INSTANCES_FILE ) ; Graphs graphs = ma . getApplication ( ) . getTemplate ( ) . getGraphs ( ) ; InstancesLoadResult result ; if ( sourceFile . exis... | Restores instances and set them in the application . |
10,761 | public static File findIcon ( String name , String qualifier , File configurationDirectory ) { if ( configurationDirectory == null ) return null ; File root ; if ( ! Utils . isEmptyOrWhitespaces ( qualifier ) ) { ApplicationTemplate tpl = new ApplicationTemplate ( name ) . version ( qualifier ) ; root = ConfigurationUt... | Finds the icon associated with an application template . |
10,762 | public static void loadApplicationBindings ( Application app ) { File descDir = new File ( app . getDirectory ( ) , Constants . PROJECT_DIR_DESC ) ; File appBindingsFile = new File ( descDir , APP_BINDINGS_FILE ) ; Logger logger = Logger . getLogger ( ConfigurationUtils . class . getName ( ) ) ; Properties props = Util... | Loads the application bindings into an application . |
10,763 | public static void saveApplicationBindings ( Application app ) { File descDir = new File ( app . getDirectory ( ) , Constants . PROJECT_DIR_DESC ) ; File appBindingsFile = new File ( descDir , APP_BINDINGS_FILE ) ; Map < String , String > format = new HashMap < > ( ) ; for ( Map . Entry < String , Set < String > > entr... | Saves the application bindings into the DM s directory . |
10,764 | protected ParsingError error ( ErrorCode errorCode , ErrorDetails ... details ) { return new ParsingError ( errorCode , this . context . getCommandFile ( ) , this . line , details ) ; } | A shortcut method to create a parsing error with relevant information . |
10,765 | public static List < String > getPropertyValues ( AbstractBlockHolder holder , String propertyName ) { List < String > result = new ArrayList < > ( ) ; for ( BlockProperty p : holder . findPropertiesBlockByName ( propertyName ) ) { result . addAll ( Utils . splitNicely ( p . getValue ( ) , ParsingConstants . PROPERTY_S... | Gets and splits property values separated by a comma . |
10,766 | public static Map < String , String > getData ( AbstractBlockHolder holder ) { BlockProperty p = holder . findPropertyBlockByName ( ParsingConstants . PROPERTY_INSTANCE_DATA ) ; Map < String , String > result = new HashMap < > ( ) ; String propertyValue = p == null ? null : p . getValue ( ) ; for ( String s : Utils . s... | Gets and splits data separated by a comma . |
10,767 | public synchronized void setHttpServerIp ( final String serverIp ) { this . httpServerIp = serverIp ; this . dmClient . setHttpServerIp ( serverIp ) ; this . logger . finer ( "Server IP set to " + this . httpServerIp ) ; } | Getters and Setters |
10,768 | private void resetClients ( boolean shutdown ) { final List < HttpAgentClient > clients ; synchronized ( this ) { clients = new ArrayList < > ( this . agentClients ) ; this . agentClients . clear ( ) ; } for ( HttpAgentClient client : clients ) { try { final ReconfigurableClient < ? > reconfigurable = client . getRecon... | Closes messaging clients or requests a replacement to the reconfigurable client . |
10,769 | public void handlerAppears ( IMonitoringHandler handler ) { if ( handler != null ) { this . logger . info ( "Monitoring handler '" + handler . getName ( ) + "' is now available." ) ; this . handlers . add ( handler ) ; listHandlers ( this . handlers , this . logger ) ; } } | This method is invoked by iPojo every time a new monitoring handler appears . |
10,770 | public void handlerDisappears ( IMonitoringHandler handler ) { if ( handler == null ) { this . logger . info ( "An invalid monitoring handler is removed." ) ; } else { this . handlers . remove ( handler ) ; this . logger . info ( "Monitoring handler '" + handler . getName ( ) + "' is not available anymore." ) ; } listH... | This method is invoked by iPojo every time a monitoring handler disappears . |
10,771 | public static void listHandlers ( List < IMonitoringHandler > handlers , Logger logger ) { if ( handlers . isEmpty ( ) ) { logger . info ( "No monitoring handler was found." ) ; } else { StringBuilder sb = new StringBuilder ( "Available monitoring handlers: " ) ; for ( Iterator < IMonitoringHandler > it = handlers . it... | This method lists the available handlers and logs them . |
10,772 | public String validate ( ) { String result = null ; if ( this . messagingConfiguration == null || this . messagingConfiguration . isEmpty ( ) ) result = "The message configuration cannot be null or empty." ; else if ( this . messagingConfiguration . get ( MessagingConstants . MESSAGING_TYPE_PROPERTY ) == null ) result ... | Validates this bean . |
10,773 | public static AgentProperties readIaasProperties ( String rawProperties , Logger logger ) throws IOException { Properties props = Utils . readPropertiesQuietly ( rawProperties , logger ) ; return readIaasProperties ( props ) ; } | Creates a new bean from raw properties that will be parsed . |
10,774 | public static AgentProperties readIaasProperties ( Properties props ) throws IOException { File msgResourcesDirectory = new File ( System . getProperty ( "java.io.tmpdir" ) , "roboconf-messaging" ) ; props = UserDataHelpers . processUserData ( props , msgResourcesDirectory ) ; AgentProperties result = new AgentProperti... | Creates a new bean from properties . |
10,775 | private static String updatedField ( Properties props , String fieldName ) { String property = props . getProperty ( fieldName ) ; if ( property != null ) property = property . replace ( "\\:" , ":" ) ; return property ; } | Gets a property and updates it to prevent escaped characters . |
10,776 | public static Message deserializeObject ( byte [ ] bytes ) throws IOException , ClassNotFoundException { ByteArrayInputStream is = new ByteArrayInputStream ( bytes ) ; ObjectInputStream deserializer = new ObjectInputStream ( is ) ; return ( Message ) deserializer . readObject ( ) ; } | Deserializes a message . |
10,777 | public static Map < String , String > buildHeaders ( String reqCorsHeader , String requestUri ) { Map < String , String > result = new LinkedHashMap < > ( ) ; result . put ( CORS_ALLOW_ORIGIN , requestUri ) ; result . put ( CORS_ALLOW_METHODS , VALUE_ALLOWED_METHODS ) ; result . put ( CORS_ALLOW_CREDENTIALS , VALUE_ALL... | Finds the right headers to set on the response to prevent CORS issues . |
10,778 | public static Version parseVersion ( String rawVersion ) { Version result = null ; Matcher m = Pattern . compile ( "^(\\d+)\\.(\\d+)(\\.\\d+)?([.-].+)?$" ) . matcher ( rawVersion ) ; if ( m . find ( ) ) { result = new Version ( Integer . parseInt ( m . group ( 1 ) ) , Integer . parseInt ( m . group ( 2 ) ) , m . group ... | Creates a version object from a string . |
10,779 | public static boolean containsCriticalErrors ( Collection < ? extends RoboconfError > errors ) { boolean result = false ; for ( RoboconfError error : errors ) { if ( ( result = error . getErrorCode ( ) . getLevel ( ) == ErrorLevel . SEVERE ) ) break ; } return result ; } | Determines whether a collection of errors contains at least one critical error . |
10,780 | public static Collection < RoboconfError > findWarnings ( Collection < ? extends RoboconfError > errors ) { Collection < RoboconfError > result = new ArrayList < > ( ) ; for ( RoboconfError error : errors ) { if ( error . getErrorCode ( ) . getLevel ( ) == ErrorLevel . WARNING ) result . add ( error ) ; } return result... | Finds all the warnings among a collection of Roboconf errors . |
10,781 | public static void filterErrors ( Collection < ? extends RoboconfError > errors , ErrorCode ... errorCodes ) { List < ErrorCode > codesToSkip = new ArrayList < > ( ) ; codesToSkip . addAll ( Arrays . asList ( errorCodes ) ) ; Collection < RoboconfError > toRemove = new ArrayList < > ( ) ; for ( RoboconfError error : er... | Filters errors by removing those associated with specific error codes . |
10,782 | private void renderApplication ( ) throws IOException { StringBuilder sb = new StringBuilder ( ) ; sb . append ( renderDocumentTitle ( ) ) ; sb . append ( renderPageBreak ( ) ) ; sb . append ( renderParagraph ( this . messages . get ( "intro" ) ) ) ; sb . append ( renderPageBreak ( ) ) ; sb . append ( renderDocumentInd... | Renders an applicationTemplate . |
10,783 | private void renderRecipe ( ) throws IOException { StringBuilder sb = new StringBuilder ( ) ; if ( ! Constants . GENERATED . equalsIgnoreCase ( this . applicationTemplate . getName ( ) ) ) { sb . append ( renderDocumentTitle ( ) ) ; sb . append ( renderPageBreak ( ) ) ; sb . append ( renderParagraph ( this . messages .... | Renders a recipe . |
10,784 | private StringBuilder renderFacets ( ) throws IOException { StringBuilder sb = new StringBuilder ( ) ; if ( ! this . applicationTemplate . getGraphs ( ) . getFacetNameToFacet ( ) . isEmpty ( ) ) { sb . append ( renderTitle1 ( this . messages . get ( "facets" ) ) ) ; sb . append ( renderParagraph ( this . messages . get... | Renders information about the facets . |
10,785 | private Object renderApplicationDescription ( ) throws IOException { String s ; if ( this . locale == null && ! Utils . isEmptyOrWhitespaces ( this . applicationTemplate . getDescription ( ) ) ) s = this . applicationTemplate . getDescription ( ) ; else s = readCustomInformation ( this . applicationDirectory , DocConst... | Renders the application s description . |
10,786 | private void saveImage ( final Component comp , DiagramType type , AbstractRoboconfTransformer transformer , StringBuilder sb ) throws IOException { String baseName = comp . getName ( ) + "_" + type ; String relativePath = "png/" + baseName + ".png" ; if ( this . options . containsKey ( DocConstants . OPTION_GEN_IMAGES... | Generates and saves an image . |
10,787 | private String readCustomInformation ( File applicationDirectory , String prefix , String suffix ) throws IOException { StringBuilder sb = new StringBuilder ( ) ; sb . append ( prefix ) ; if ( this . locale != null ) sb . append ( "_" + this . locale ) ; sb . append ( suffix ) ; sb . insert ( 0 , "/" ) ; sb . insert ( ... | Reads user - specified information from the project . |
10,788 | private List < String > convertImports ( Collection < ImportedVariable > importedVariables ) { List < String > result = new ArrayList < > ( ) ; for ( ImportedVariable var : importedVariables ) { String componentOrFacet = VariableHelpers . parseVariableName ( var . getName ( ) ) . getKey ( ) ; String s = applyLink ( var... | Converts imports to a human - readable text . |
10,789 | private List < String > convertExports ( Map < String , String > exports ) { List < String > result = new ArrayList < > ( ) ; for ( Map . Entry < String , String > entry : exports . entrySet ( ) ) { String componentOrFacet = VariableHelpers . parseVariableName ( entry . getKey ( ) ) . getKey ( ) ; String s = Utils . is... | Converts exports to a human - readable text . |
10,790 | private List < String > getImportComponents ( Component component ) { List < String > result = new ArrayList < > ( ) ; Map < String , Boolean > map = ComponentHelpers . findComponentDependenciesFor ( component ) ; for ( Map . Entry < String , Boolean > entry : map . entrySet ( ) ) { String s = applyLink ( entry . getKe... | Converts component dependencies to a human - readable text . |
10,791 | private String renderListAsLinks ( List < String > names ) { List < String > newNames = new ArrayList < > ( ) ; for ( String s : names ) newNames . add ( applyLink ( s , s ) ) ; return renderList ( newNames ) ; } | Renders a list as a list of links . |
10,792 | public void uploadZippedApplicationTemplate ( File applicationFile ) throws ManagementWsException , IOException { if ( applicationFile == null || ! applicationFile . exists ( ) || ! applicationFile . isFile ( ) ) throw new IOException ( "Expected an existing file as parameter." ) ; this . logger . finer ( "Loading an a... | Uploads a ZIP file and loads its application template . |
10,793 | public void loadUnzippedApplicationTemplate ( String localFilePath ) throws ManagementWsException { this . logger . finer ( "Loading an application from a local directory: " + localFilePath ) ; WebResource path = this . resource . path ( UrlConstants . APPLICATIONS ) . path ( "templates" ) . path ( "local" ) ; if ( loc... | Loads an application template from a directory located on the DM s file system . |
10,794 | public Application createApplication ( String applicationName , String templateName , String templateQualifier ) throws ManagementWsException { this . logger . finer ( "Creating application " + applicationName + " from " + templateName + " - " + templateQualifier + "..." ) ; ApplicationTemplate tpl = new ApplicationTem... | Creates an application from a template . |
10,795 | public List < Application > listApplications ( String exactName ) throws ManagementWsException { if ( exactName != null ) this . logger . finer ( "List/finding the application named " + exactName + "." ) ; else this . logger . finer ( "Listing all the applications." ) ; WebResource path = this . resource . path ( UrlCo... | Lists applications . |
10,796 | public void shutdownApplication ( String applicationName ) throws ManagementWsException { this . logger . finer ( "Removing application " + applicationName + "..." ) ; WebResource path = this . resource . path ( UrlConstants . APPLICATIONS ) . path ( applicationName ) . path ( "shutdown" ) ; ClientResponse response = t... | Shutdowns an application . |
10,797 | public static String fileTypeAsString ( int fileType ) { String result ; switch ( fileType ) { case AGGREGATOR : result = "aggregator" ; break ; case GRAPH : result = "graph" ; break ; case INSTANCE : result = "intsnace" ; break ; case UNDETERMINED : result = "undetermined" ; break ; default : result = "unknown" ; brea... | Transforms a file type into a string . |
10,798 | public static RbcfInfo findInstances ( Manager manager , String applicationName , String scopedInstancePath , PrintStream out ) { ManagedApplication ma = null ; List < Instance > scopedInstances = new ArrayList < > ( ) ; Instance scopedInstance ; if ( ( ma = manager . applicationMngr ( ) . findManagedApplicationByName ... | Finds instances for a given application . |
10,799 | static NovaApi novaApi ( Map < String , String > targetProperties ) throws TargetException { validate ( targetProperties ) ; return ContextBuilder . newBuilder ( PROVIDER_NOVA ) . endpoint ( targetProperties . get ( API_URL ) ) . credentials ( identity ( targetProperties ) , targetProperties . get ( PASSWORD ) ) . buil... | Creates a JCloud context for Nova . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.