repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
roboconf/roboconf-platform
core/roboconf-dm-templating/src/main/java/net/roboconf/dm/templating/internal/TemplatingManager.java
TemplatingManager.setPollInterval
public void setPollInterval( long pollInterval ) { this.pollInterval = pollInterval; this.logger.fine( "Template watcher poll interval set to " + pollInterval ); synchronized( this.watcherLock ) { if( this.templateWatcher != null ) resetWatcher(); } }
java
public void setPollInterval( long pollInterval ) { this.pollInterval = pollInterval; this.logger.fine( "Template watcher poll interval set to " + pollInterval ); synchronized( this.watcherLock ) { if( this.templateWatcher != null ) resetWatcher(); } }
[ "public", "void", "setPollInterval", "(", "long", "pollInterval", ")", "{", "this", ".", "pollInterval", "=", "pollInterval", ";", "this", ".", "logger", ".", "fine", "(", "\"Template watcher poll interval set to \"", "+", "pollInterval", ")", ";", "synchronized", ...
Sets the poll interval for the template watcher. @param pollInterval the poll interval, in milliseconds, for the template watcher
[ "Sets", "the", "poll", "interval", "for", "the", "template", "watcher", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-dm-templating/src/main/java/net/roboconf/dm/templating/internal/TemplatingManager.java#L77-L85
train
roboconf/roboconf-platform
core/roboconf-dm-templating/src/main/java/net/roboconf/dm/templating/internal/TemplatingManager.java
TemplatingManager.setTemplatesDirectory
public void setTemplatesDirectory( String templatesDirectory ) { this.logger.fine( "Templates directory is now... " + templatesDirectory ); this.templatesDIR = Utils.isEmptyOrWhitespaces( templatesDirectory ) ? null : new File( templatesDirectory ); synchronized( this.watcherLock ) { if( this.templateWatcher != null ) resetWatcher(); } }
java
public void setTemplatesDirectory( String templatesDirectory ) { this.logger.fine( "Templates directory is now... " + templatesDirectory ); this.templatesDIR = Utils.isEmptyOrWhitespaces( templatesDirectory ) ? null : new File( templatesDirectory ); synchronized( this.watcherLock ) { if( this.templateWatcher != null ) resetWatcher(); } }
[ "public", "void", "setTemplatesDirectory", "(", "String", "templatesDirectory", ")", "{", "this", ".", "logger", ".", "fine", "(", "\"Templates directory is now... \"", "+", "templatesDirectory", ")", ";", "this", ".", "templatesDIR", "=", "Utils", ".", "isEmptyOrWh...
Sets the templates directory. @param templatesDirectory the templates directory
[ "Sets", "the", "templates", "directory", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-dm-templating/src/main/java/net/roboconf/dm/templating/internal/TemplatingManager.java#L92-L100
train
roboconf/roboconf-platform
core/roboconf-dm-templating/src/main/java/net/roboconf/dm/templating/internal/TemplatingManager.java
TemplatingManager.setOutputDirectory
public void setOutputDirectory( String outputDirectory ) { // Update the configuration this.logger.fine( "Output directory is now... " + outputDirectory ); this.outputDIR = Utils.isEmptyOrWhitespaces( outputDirectory ) ? null : new File( outputDirectory ); // Generate the files if( this.outputDIR != null && this.dm != null ) { for( ManagedApplication ma : this.dm.applicationMngr().getManagedApplications()) application( ma.getApplication(), EventType.CHANGED ); } } /** * Binds the DM. * @param dm */ public void bindManager( Manager dm ) { synchronized( this.generationLock ) { this.logger.fine( "The DM is now available in the templating manager." ); this.dm = dm; } } /** * Unbinds the DM. * @param dm */ public void unbindManager( Manager dm ) { synchronized( this.generationLock ) { this.logger.fine( "The DM is NOT available anymore in the templating manager." ); this.dm = null; } } // iPojo life cycle /** * Starts the templating manager (invoked by iPojo). */ public void start() { synchronized( this.watcherLock ) { this.logger.config( "The templating manager is starting..." ); resetWatcher(); } } /** * Stops the templating manager (invoked by iPojo). */ public void stop() { synchronized( this.watcherLock ) { this.logger.config( "The templating manager is stopping..." ); stopWatcher(); } } // Inherited methods /* * (non-Javadoc) * @see net.roboconf.dm.management.events.IDmListener#getId() */ @Override public String getId() { return ID; } /* (non-Javadoc) * @see net.roboconf.dm.management.events.IDmListener * #application(net.roboconf.core.model.beans.Application, net.roboconf.dm.management.events.EventType) */ @Override public void application( Application application, EventType eventType ) { if( this.outputDIR == null ) { this.logger.warning( "Generation from templates is skipped. Invalid output directory." ); } else if( eventType == EventType.DELETED ) { synchronized( this.generationLock ) { TemplateUtils.deleteGeneratedFiles( application, this.outputDIR ); } } else { generate( application ); } } /* (non-Javadoc) * @see net.roboconf.dm.management.events.IDmListener * #applicationTemplate(net.roboconf.core.model.beans.ApplicationTemplate, net.roboconf.dm.management.events.EventType) */ @Override public void applicationTemplate( ApplicationTemplate tpl, EventType eventType ) { // nothing } /* * (non-Javadoc) * @see net.roboconf.dm.management.events.IDmListener * #instance(net.roboconf.core.model.beans.Instance, net.roboconf.core.model.beans.Application, net.roboconf.dm.management.events.EventType) */ @Override public void instance( Instance instance, Application application, EventType eventType ) { application( application, EventType.CHANGED ); } /* (non-Javadoc) * @see net.roboconf.dm.management.events.IDmListener * #raw(java.lang.String, java.lang.Object[]) */ @Override public void raw( String message, Object... data ) { // nothing } /* * (non-Javadoc) * @see net.roboconf.dm.management.events.IDmListener * #enableNotifications() */ @Override public void enableNotifications() { // nothing } /* * (non-Javadoc) * @see net.roboconf.dm.management.events.IDmListener * #disableNotifications() */ @Override public void disableNotifications() { // nothing }
java
public void setOutputDirectory( String outputDirectory ) { // Update the configuration this.logger.fine( "Output directory is now... " + outputDirectory ); this.outputDIR = Utils.isEmptyOrWhitespaces( outputDirectory ) ? null : new File( outputDirectory ); // Generate the files if( this.outputDIR != null && this.dm != null ) { for( ManagedApplication ma : this.dm.applicationMngr().getManagedApplications()) application( ma.getApplication(), EventType.CHANGED ); } } /** * Binds the DM. * @param dm */ public void bindManager( Manager dm ) { synchronized( this.generationLock ) { this.logger.fine( "The DM is now available in the templating manager." ); this.dm = dm; } } /** * Unbinds the DM. * @param dm */ public void unbindManager( Manager dm ) { synchronized( this.generationLock ) { this.logger.fine( "The DM is NOT available anymore in the templating manager." ); this.dm = null; } } // iPojo life cycle /** * Starts the templating manager (invoked by iPojo). */ public void start() { synchronized( this.watcherLock ) { this.logger.config( "The templating manager is starting..." ); resetWatcher(); } } /** * Stops the templating manager (invoked by iPojo). */ public void stop() { synchronized( this.watcherLock ) { this.logger.config( "The templating manager is stopping..." ); stopWatcher(); } } // Inherited methods /* * (non-Javadoc) * @see net.roboconf.dm.management.events.IDmListener#getId() */ @Override public String getId() { return ID; } /* (non-Javadoc) * @see net.roboconf.dm.management.events.IDmListener * #application(net.roboconf.core.model.beans.Application, net.roboconf.dm.management.events.EventType) */ @Override public void application( Application application, EventType eventType ) { if( this.outputDIR == null ) { this.logger.warning( "Generation from templates is skipped. Invalid output directory." ); } else if( eventType == EventType.DELETED ) { synchronized( this.generationLock ) { TemplateUtils.deleteGeneratedFiles( application, this.outputDIR ); } } else { generate( application ); } } /* (non-Javadoc) * @see net.roboconf.dm.management.events.IDmListener * #applicationTemplate(net.roboconf.core.model.beans.ApplicationTemplate, net.roboconf.dm.management.events.EventType) */ @Override public void applicationTemplate( ApplicationTemplate tpl, EventType eventType ) { // nothing } /* * (non-Javadoc) * @see net.roboconf.dm.management.events.IDmListener * #instance(net.roboconf.core.model.beans.Instance, net.roboconf.core.model.beans.Application, net.roboconf.dm.management.events.EventType) */ @Override public void instance( Instance instance, Application application, EventType eventType ) { application( application, EventType.CHANGED ); } /* (non-Javadoc) * @see net.roboconf.dm.management.events.IDmListener * #raw(java.lang.String, java.lang.Object[]) */ @Override public void raw( String message, Object... data ) { // nothing } /* * (non-Javadoc) * @see net.roboconf.dm.management.events.IDmListener * #enableNotifications() */ @Override public void enableNotifications() { // nothing } /* * (non-Javadoc) * @see net.roboconf.dm.management.events.IDmListener * #disableNotifications() */ @Override public void disableNotifications() { // nothing }
[ "public", "void", "setOutputDirectory", "(", "String", "outputDirectory", ")", "{", "// Update the configuration", "this", ".", "logger", ".", "fine", "(", "\"Output directory is now... \"", "+", "outputDirectory", ")", ";", "this", ".", "outputDIR", "=", "Utils", "...
Sets the output directory. @param outputDirectory the output directory
[ "Sets", "the", "output", "directory", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-dm-templating/src/main/java/net/roboconf/dm/templating/internal/TemplatingManager.java#L107-L258
train
roboconf/roboconf-platform
core/roboconf-dm-templating/src/main/java/net/roboconf/dm/templating/internal/TemplatingManager.java
TemplatingManager.resetWatcher
private void resetWatcher() { // Stop the current watcher. stopWatcher(); // Update the template & target directories, based on the provided configuration directory. if( this.templatesDIR == null ) { this.logger.warning( "The templates directory was not specified. DM templating is temporarily disabled." ); } else if( this.outputDIR == null ) { this.logger.warning( "The templates directory was not specified. DM templating is temporarily disabled." ); } else { this.templateWatcher = new TemplateWatcher( this, this.templatesDIR, this.pollInterval ); this.templateWatcher.start(); } }
java
private void resetWatcher() { // Stop the current watcher. stopWatcher(); // Update the template & target directories, based on the provided configuration directory. if( this.templatesDIR == null ) { this.logger.warning( "The templates directory was not specified. DM templating is temporarily disabled." ); } else if( this.outputDIR == null ) { this.logger.warning( "The templates directory was not specified. DM templating is temporarily disabled." ); } else { this.templateWatcher = new TemplateWatcher( this, this.templatesDIR, this.pollInterval ); this.templateWatcher.start(); } }
[ "private", "void", "resetWatcher", "(", ")", "{", "// Stop the current watcher.", "stopWatcher", "(", ")", ";", "// Update the template & target directories, based on the provided configuration directory.", "if", "(", "this", ".", "templatesDIR", "==", "null", ")", "{", "th...
Updates the template watcher after a change in the templating manager configuration.
[ "Updates", "the", "template", "watcher", "after", "a", "change", "in", "the", "templating", "manager", "configuration", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-dm-templating/src/main/java/net/roboconf/dm/templating/internal/TemplatingManager.java#L290-L306
train
roboconf/roboconf-platform
core/roboconf-messaging-rabbitmq/src/main/java/net/roboconf/messaging/rabbitmq/internal/utils/RabbitMqUtils.java
RabbitMqUtils.configureFactory
public static void configureFactory( ConnectionFactory factory, Map<String,String> configuration ) throws IOException { final Logger logger = Logger.getLogger( RabbitMqUtils.class.getName()); logger.fine( "Configuring a connection factory for RabbitMQ." ); String messageServerIp = configuration.get( RABBITMQ_SERVER_IP ); if( messageServerIp != null ) { Map.Entry<String,Integer> entry = Utils.findUrlAndPort( messageServerIp ); factory.setHost( entry.getKey()); if( entry.getValue() > 0 ) factory.setPort( entry.getValue()); } factory.setUsername( configuration.get( RABBITMQ_SERVER_USERNAME )); factory.setPassword( configuration.get( RABBITMQ_SERVER_PASSWORD )); // Timeout for connection establishment: 5s factory.setConnectionTimeout( 5000 ); // Configure automatic reconnection factory.setAutomaticRecoveryEnabled( true ); // Recovery interval: 10s factory.setNetworkRecoveryInterval( 10000 ); // Exchanges and so on should be redeclared if necessary factory.setTopologyRecoveryEnabled( true ); // SSL if( Boolean.parseBoolean( configuration.get( RABBITMQ_USE_SSL ))) { logger.fine( "Connection factory for RabbitMQ: SSL is used." ); InputStream clientIS = null; InputStream storeIS = null; try { clientIS = new FileInputStream( configuration.get( RABBITMQ_SSL_KEY_STORE_PATH )); storeIS = new FileInputStream( configuration.get( RABBITMQ_SSL_TRUST_STORE_PATH )); char[] keyStorePassphrase = configuration.get( RABBITMQ_SSL_KEY_STORE_PASSPHRASE ).toCharArray(); KeyStore ks = KeyStore.getInstance( getValue( configuration, RABBITMQ_SSL_KEY_STORE_TYPE, DEFAULT_SSL_KEY_STORE_TYPE )); ks.load( clientIS, keyStorePassphrase ); String value = getValue( configuration, RABBITMQ_SSL_KEY_MNGR_FACTORY, DEFAULT_SSL_MNGR_FACTORY ); KeyManagerFactory kmf = KeyManagerFactory.getInstance( value ); kmf.init( ks, keyStorePassphrase ); char[] trustStorePassphrase = configuration.get( RABBITMQ_SSL_TRUST_STORE_PASSPHRASE ).toCharArray(); KeyStore tks = KeyStore.getInstance( getValue( configuration, RABBITMQ_SSL_TRUST_STORE_TYPE, DEFAULT_SSL_TRUST_STORE_TYPE )); tks.load( storeIS, trustStorePassphrase ); value = getValue( configuration, RABBITMQ_SSL_TRUST_MNGR_FACTORY, DEFAULT_SSL_MNGR_FACTORY ); TrustManagerFactory tmf = TrustManagerFactory.getInstance( value ); tmf.init( tks ); SSLContext c = SSLContext.getInstance( getValue( configuration, RABBITMQ_SSL_PROTOCOL, DEFAULT_SSL_PROTOCOL )); c.init( kmf.getKeyManagers(), tmf.getTrustManagers(), null ); factory.useSslProtocol( c ); } catch( GeneralSecurityException e ) { throw new IOException( "SSL configuration for the RabbitMQ factory failed.", e ); } finally { Utils.closeQuietly( storeIS ); Utils.closeQuietly( clientIS ); } } }
java
public static void configureFactory( ConnectionFactory factory, Map<String,String> configuration ) throws IOException { final Logger logger = Logger.getLogger( RabbitMqUtils.class.getName()); logger.fine( "Configuring a connection factory for RabbitMQ." ); String messageServerIp = configuration.get( RABBITMQ_SERVER_IP ); if( messageServerIp != null ) { Map.Entry<String,Integer> entry = Utils.findUrlAndPort( messageServerIp ); factory.setHost( entry.getKey()); if( entry.getValue() > 0 ) factory.setPort( entry.getValue()); } factory.setUsername( configuration.get( RABBITMQ_SERVER_USERNAME )); factory.setPassword( configuration.get( RABBITMQ_SERVER_PASSWORD )); // Timeout for connection establishment: 5s factory.setConnectionTimeout( 5000 ); // Configure automatic reconnection factory.setAutomaticRecoveryEnabled( true ); // Recovery interval: 10s factory.setNetworkRecoveryInterval( 10000 ); // Exchanges and so on should be redeclared if necessary factory.setTopologyRecoveryEnabled( true ); // SSL if( Boolean.parseBoolean( configuration.get( RABBITMQ_USE_SSL ))) { logger.fine( "Connection factory for RabbitMQ: SSL is used." ); InputStream clientIS = null; InputStream storeIS = null; try { clientIS = new FileInputStream( configuration.get( RABBITMQ_SSL_KEY_STORE_PATH )); storeIS = new FileInputStream( configuration.get( RABBITMQ_SSL_TRUST_STORE_PATH )); char[] keyStorePassphrase = configuration.get( RABBITMQ_SSL_KEY_STORE_PASSPHRASE ).toCharArray(); KeyStore ks = KeyStore.getInstance( getValue( configuration, RABBITMQ_SSL_KEY_STORE_TYPE, DEFAULT_SSL_KEY_STORE_TYPE )); ks.load( clientIS, keyStorePassphrase ); String value = getValue( configuration, RABBITMQ_SSL_KEY_MNGR_FACTORY, DEFAULT_SSL_MNGR_FACTORY ); KeyManagerFactory kmf = KeyManagerFactory.getInstance( value ); kmf.init( ks, keyStorePassphrase ); char[] trustStorePassphrase = configuration.get( RABBITMQ_SSL_TRUST_STORE_PASSPHRASE ).toCharArray(); KeyStore tks = KeyStore.getInstance( getValue( configuration, RABBITMQ_SSL_TRUST_STORE_TYPE, DEFAULT_SSL_TRUST_STORE_TYPE )); tks.load( storeIS, trustStorePassphrase ); value = getValue( configuration, RABBITMQ_SSL_TRUST_MNGR_FACTORY, DEFAULT_SSL_MNGR_FACTORY ); TrustManagerFactory tmf = TrustManagerFactory.getInstance( value ); tmf.init( tks ); SSLContext c = SSLContext.getInstance( getValue( configuration, RABBITMQ_SSL_PROTOCOL, DEFAULT_SSL_PROTOCOL )); c.init( kmf.getKeyManagers(), tmf.getTrustManagers(), null ); factory.useSslProtocol( c ); } catch( GeneralSecurityException e ) { throw new IOException( "SSL configuration for the RabbitMQ factory failed.", e ); } finally { Utils.closeQuietly( storeIS ); Utils.closeQuietly( clientIS ); } } }
[ "public", "static", "void", "configureFactory", "(", "ConnectionFactory", "factory", ",", "Map", "<", "String", ",", "String", ">", "configuration", ")", "throws", "IOException", "{", "final", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "RabbitMqUt...
Configures the connection factory with the right settings. @param factory the connection factory @param configuration the messaging configuration @throws IOException if something went wrong @see RabbitMqConstants
[ "Configures", "the", "connection", "factory", "with", "the", "right", "settings", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-messaging-rabbitmq/src/main/java/net/roboconf/messaging/rabbitmq/internal/utils/RabbitMqUtils.java#L87-L154
train
roboconf/roboconf-platform
core/roboconf-messaging-rabbitmq/src/main/java/net/roboconf/messaging/rabbitmq/internal/utils/RabbitMqUtils.java
RabbitMqUtils.closeConnection
public static void closeConnection( Channel channel ) throws IOException { if( channel != null ) { if( channel.isOpen()) channel.close(); if( channel.getConnection().isOpen()) channel.getConnection().close(); } }
java
public static void closeConnection( Channel channel ) throws IOException { if( channel != null ) { if( channel.isOpen()) channel.close(); if( channel.getConnection().isOpen()) channel.getConnection().close(); } }
[ "public", "static", "void", "closeConnection", "(", "Channel", "channel", ")", "throws", "IOException", "{", "if", "(", "channel", "!=", "null", ")", "{", "if", "(", "channel", ".", "isOpen", "(", ")", ")", "channel", ".", "close", "(", ")", ";", "if",...
Closes the connection to a channel. @param channel the channel to close (can be null) @throws IOException if something went wrong
[ "Closes", "the", "connection", "to", "a", "channel", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-messaging-rabbitmq/src/main/java/net/roboconf/messaging/rabbitmq/internal/utils/RabbitMqUtils.java#L162-L171
train
roboconf/roboconf-platform
core/roboconf-messaging-rabbitmq/src/main/java/net/roboconf/messaging/rabbitmq/internal/utils/RabbitMqUtils.java
RabbitMqUtils.buildExchangeName
public static String buildExchangeName( MessagingContext ctx ) { String exchangeName; if( ctx.getKind() == RecipientKind.DM ) exchangeName = buildExchangeNameForTheDm( ctx.getDomain()); else if( ctx.getKind() == RecipientKind.INTER_APP ) exchangeName = buildExchangeNameForInterApp( ctx.getDomain()); else exchangeName = RabbitMqUtils.buildExchangeNameForAgent( ctx.getDomain(), ctx.getApplicationName()); return exchangeName; }
java
public static String buildExchangeName( MessagingContext ctx ) { String exchangeName; if( ctx.getKind() == RecipientKind.DM ) exchangeName = buildExchangeNameForTheDm( ctx.getDomain()); else if( ctx.getKind() == RecipientKind.INTER_APP ) exchangeName = buildExchangeNameForInterApp( ctx.getDomain()); else exchangeName = RabbitMqUtils.buildExchangeNameForAgent( ctx.getDomain(), ctx.getApplicationName()); return exchangeName; }
[ "public", "static", "String", "buildExchangeName", "(", "MessagingContext", "ctx", ")", "{", "String", "exchangeName", ";", "if", "(", "ctx", ".", "getKind", "(", ")", "==", "RecipientKind", ".", "DM", ")", "exchangeName", "=", "buildExchangeNameForTheDm", "(", ...
Builds an exchange name from a messaging context. @param ctx a non-null context @return a non-null string
[ "Builds", "an", "exchange", "name", "from", "a", "messaging", "context", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-messaging-rabbitmq/src/main/java/net/roboconf/messaging/rabbitmq/internal/utils/RabbitMqUtils.java#L246-L257
train
stephanrauh/AngularFaces
AngularFaces_2.0/incubator/AngularFaces-widgets/src/main/java/de/beyondjava/angularFaces/core/puiEL/AngularViewContextWrapper.java
AngularViewContextWrapper.renderState
private void renderState(FacesContext context) throws IOException { // Get the view state and write it to the response.. PartialViewContext pvc = context.getPartialViewContext(); PartialResponseWriter writer = pvc.getPartialResponseWriter(); String viewStateId = Util.getViewStateId(context); writer.startUpdate(viewStateId); String state = context.getApplication().getStateManager().getViewState(context); writer.write(state); writer.endUpdate(); ClientWindow window = context.getExternalContext().getClientWindow(); if (null != window) { String clientWindowId = Util.getClientWindowId(context); writer.startUpdate(clientWindowId); writer.write(window.getId()); writer.endUpdate(); } }
java
private void renderState(FacesContext context) throws IOException { // Get the view state and write it to the response.. PartialViewContext pvc = context.getPartialViewContext(); PartialResponseWriter writer = pvc.getPartialResponseWriter(); String viewStateId = Util.getViewStateId(context); writer.startUpdate(viewStateId); String state = context.getApplication().getStateManager().getViewState(context); writer.write(state); writer.endUpdate(); ClientWindow window = context.getExternalContext().getClientWindow(); if (null != window) { String clientWindowId = Util.getClientWindowId(context); writer.startUpdate(clientWindowId); writer.write(window.getId()); writer.endUpdate(); } }
[ "private", "void", "renderState", "(", "FacesContext", "context", ")", "throws", "IOException", "{", "// Get the view state and write it to the response..", "PartialViewContext", "pvc", "=", "context", ".", "getPartialViewContext", "(", ")", ";", "PartialResponseWriter", "w...
Copied from com.sun.faces.context.PartialViewContextImpl. May have to be adapted to future Mojarra or JSF versions.
[ "Copied", "from", "com", ".", "sun", ".", "faces", ".", "context", ".", "PartialViewContextImpl", ".", "May", "have", "to", "be", "adapted", "to", "future", "Mojarra", "or", "JSF", "versions", "." ]
43d915f004645b1bbbf2625214294dab0858ba01
https://github.com/stephanrauh/AngularFaces/blob/43d915f004645b1bbbf2625214294dab0858ba01/AngularFaces_2.0/incubator/AngularFaces-widgets/src/main/java/de/beyondjava/angularFaces/core/puiEL/AngularViewContextWrapper.java#L150-L168
train
roboconf/roboconf-platform
core/roboconf-plugin-script/src/main/java/net/roboconf/plugin/script/internal/ScriptUtils.java
ScriptUtils.formatExportedVars
public static Map<String,String> formatExportedVars( Instance instance ) { // The map we will return Map<String, String> exportedVars = new HashMap<> (); // Iterate over the instance and its ancestors. // There is no loop in parent relations, so no risk of conflict in variable names. for( Instance inst = instance; inst != null; inst = inst.getParent()) { String prefix = ""; if( inst != instance ) prefix = "ANCESTOR_" + inst.getComponent().getName() + "_"; Map<String,String> exports = InstanceHelpers.findAllExportedVariables( inst ); for(Entry<String, String> entry : exports.entrySet()) { // FIXME: removing the prefix may result in inconsistencies when a facet // and a component export variables with the same "local name". // And this has nothing to do with ancestors. This is about inheritance. String vname = prefix + VariableHelpers.parseVariableName( entry.getKey()).getValue(); vname = vname.replaceAll( "(-|%s)+", "_" ); exportedVars.put( vname, entry.getValue()); } } return exportedVars; }
java
public static Map<String,String> formatExportedVars( Instance instance ) { // The map we will return Map<String, String> exportedVars = new HashMap<> (); // Iterate over the instance and its ancestors. // There is no loop in parent relations, so no risk of conflict in variable names. for( Instance inst = instance; inst != null; inst = inst.getParent()) { String prefix = ""; if( inst != instance ) prefix = "ANCESTOR_" + inst.getComponent().getName() + "_"; Map<String,String> exports = InstanceHelpers.findAllExportedVariables( inst ); for(Entry<String, String> entry : exports.entrySet()) { // FIXME: removing the prefix may result in inconsistencies when a facet // and a component export variables with the same "local name". // And this has nothing to do with ancestors. This is about inheritance. String vname = prefix + VariableHelpers.parseVariableName( entry.getKey()).getValue(); vname = vname.replaceAll( "(-|%s)+", "_" ); exportedVars.put( vname, entry.getValue()); } } return exportedVars; }
[ "public", "static", "Map", "<", "String", ",", "String", ">", "formatExportedVars", "(", "Instance", "instance", ")", "{", "// The map we will return", "Map", "<", "String", ",", "String", ">", "exportedVars", "=", "new", "HashMap", "<>", "(", ")", ";", "// ...
Formats imported variables to be used in a script as environment variables. @param instance the instance whose exported variables must be formatted @return a non-null map
[ "Formats", "imported", "variables", "to", "be", "used", "in", "a", "script", "as", "environment", "variables", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-plugin-script/src/main/java/net/roboconf/plugin/script/internal/ScriptUtils.java#L61-L87
train
roboconf/roboconf-platform
core/roboconf-plugin-script/src/main/java/net/roboconf/plugin/script/internal/ScriptUtils.java
ScriptUtils.setScriptsExecutable
public static void setScriptsExecutable( File fileOrDir ) { List<File> files = new ArrayList<> (); if( fileOrDir.isDirectory()) files.addAll( Utils.listAllFiles( fileOrDir, true )); else files.add( fileOrDir ); for( File f : files ) f.setExecutable( true ); }
java
public static void setScriptsExecutable( File fileOrDir ) { List<File> files = new ArrayList<> (); if( fileOrDir.isDirectory()) files.addAll( Utils.listAllFiles( fileOrDir, true )); else files.add( fileOrDir ); for( File f : files ) f.setExecutable( true ); }
[ "public", "static", "void", "setScriptsExecutable", "(", "File", "fileOrDir", ")", "{", "List", "<", "File", ">", "files", "=", "new", "ArrayList", "<>", "(", ")", ";", "if", "(", "fileOrDir", ".", "isDirectory", "(", ")", ")", "files", ".", "addAll", ...
Recursively sets all files and directories executable, starting from a file or base directory. @param f a file to set executable or a base directory
[ "Recursively", "sets", "all", "files", "and", "directories", "executable", "starting", "from", "a", "file", "or", "base", "directory", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-plugin-script/src/main/java/net/roboconf/plugin/script/internal/ScriptUtils.java#L156-L166
train
roboconf/roboconf-platform
core/roboconf-messaging-api/src/main/java/net/roboconf/messaging/api/reconfigurables/ReconfigurableClient.java
ReconfigurableClient.switchMessagingType
public void switchMessagingType( String factoryName ) { // Create a new client this.logger.fine( "The messaging is requested to switch its type to " + factoryName + "." ); JmxWrapperForMessagingClient newMessagingClient = null; try { IMessagingClient rawClient = createMessagingClient( factoryName ); if( rawClient != null ) { newMessagingClient = new JmxWrapperForMessagingClient( rawClient ); newMessagingClient.setMessageQueue( this.messageProcessor.getMessageQueue()); openConnection( newMessagingClient ); } } catch( Exception e ) { this.logger.warning( "An error occurred while creating a new messaging client. " + e.getMessage()); Utils.logException( this.logger, e ); // #594: print a message to be visible in a console StringBuilder sb = new StringBuilder(); sb.append( "\n\n**** WARNING ****\n" ); sb.append( "Connection failed at " ); sb.append( new SimpleDateFormat( "HH:mm:ss, 'on' EEEE dd (MMMM)" ).format( new Date())); sb.append( ".\n" ); sb.append( "The messaging configuration may be invalid.\n" ); sb.append( "Or the messaging server may not be started yet.\n\n" ); sb.append( "Consider using the 'roboconf:force-reconnect' command if you forgot to start the messaging server.\n" ); sb.append( "**** WARNING ****\n" ); this.console.println( sb.toString()); } // Replace the current client IMessagingClient oldClient; synchronized( this ) { // Simple changes this.messagingType = factoryName; oldClient = this.messagingClient; // The messaging client can NEVER be null if( newMessagingClient != null ) this.messagingClient = newMessagingClient; else resetInternalClient(); } terminateClient( oldClient, "The previous client could not be terminated correctly.", this.logger ); }
java
public void switchMessagingType( String factoryName ) { // Create a new client this.logger.fine( "The messaging is requested to switch its type to " + factoryName + "." ); JmxWrapperForMessagingClient newMessagingClient = null; try { IMessagingClient rawClient = createMessagingClient( factoryName ); if( rawClient != null ) { newMessagingClient = new JmxWrapperForMessagingClient( rawClient ); newMessagingClient.setMessageQueue( this.messageProcessor.getMessageQueue()); openConnection( newMessagingClient ); } } catch( Exception e ) { this.logger.warning( "An error occurred while creating a new messaging client. " + e.getMessage()); Utils.logException( this.logger, e ); // #594: print a message to be visible in a console StringBuilder sb = new StringBuilder(); sb.append( "\n\n**** WARNING ****\n" ); sb.append( "Connection failed at " ); sb.append( new SimpleDateFormat( "HH:mm:ss, 'on' EEEE dd (MMMM)" ).format( new Date())); sb.append( ".\n" ); sb.append( "The messaging configuration may be invalid.\n" ); sb.append( "Or the messaging server may not be started yet.\n\n" ); sb.append( "Consider using the 'roboconf:force-reconnect' command if you forgot to start the messaging server.\n" ); sb.append( "**** WARNING ****\n" ); this.console.println( sb.toString()); } // Replace the current client IMessagingClient oldClient; synchronized( this ) { // Simple changes this.messagingType = factoryName; oldClient = this.messagingClient; // The messaging client can NEVER be null if( newMessagingClient != null ) this.messagingClient = newMessagingClient; else resetInternalClient(); } terminateClient( oldClient, "The previous client could not be terminated correctly.", this.logger ); }
[ "public", "void", "switchMessagingType", "(", "String", "factoryName", ")", "{", "// Create a new client", "this", ".", "logger", ".", "fine", "(", "\"The messaging is requested to switch its type to \"", "+", "factoryName", "+", "\".\"", ")", ";", "JmxWrapperForMessaging...
Changes the internal messaging client. @param factoryName the factory name (see {@link MessagingConstants})
[ "Changes", "the", "internal", "messaging", "client", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-messaging-api/src/main/java/net/roboconf/messaging/api/reconfigurables/ReconfigurableClient.java#L160-L206
train
roboconf/roboconf-platform
core/roboconf-messaging-api/src/main/java/net/roboconf/messaging/api/reconfigurables/ReconfigurableClient.java
ReconfigurableClient.createMessagingClient
protected IMessagingClient createMessagingClient( String factoryName ) throws IOException { IMessagingClient client = null; MessagingClientFactoryRegistry registry = getRegistry(); if( registry != null ) { IMessagingClientFactory factory = registry.getMessagingClientFactory(factoryName); if( factory != null ) client = factory.createClient( this ); } return client; }
java
protected IMessagingClient createMessagingClient( String factoryName ) throws IOException { IMessagingClient client = null; MessagingClientFactoryRegistry registry = getRegistry(); if( registry != null ) { IMessagingClientFactory factory = registry.getMessagingClientFactory(factoryName); if( factory != null ) client = factory.createClient( this ); } return client; }
[ "protected", "IMessagingClient", "createMessagingClient", "(", "String", "factoryName", ")", "throws", "IOException", "{", "IMessagingClient", "client", "=", "null", ";", "MessagingClientFactoryRegistry", "registry", "=", "getRegistry", "(", ")", ";", "if", "(", "regi...
Creates a new messaging client. @param factoryName the factory name (see {@link MessagingConstants}) @return a new messaging client, or {@code null} if {@code factoryName} is {@code null} or cannot be found in the available messaging factories. @throws IOException if something went wrong
[ "Creates", "a", "new", "messaging", "client", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-messaging-api/src/main/java/net/roboconf/messaging/api/reconfigurables/ReconfigurableClient.java#L264-L275
train
roboconf/roboconf-platform
core/roboconf-messaging-api/src/main/java/net/roboconf/messaging/api/reconfigurables/ReconfigurableClient.java
ReconfigurableClient.terminateClient
static void terminateClient( IMessagingClient client, String errorMessage, Logger logger ) { try { logger.fine( "The reconfigurable client is requesting its internal connection to be closed." ); if( client != null ) client.closeConnection(); } catch( Exception e ) { logger.warning( errorMessage + " " + e.getMessage()); Utils.logException( logger, e ); } finally { // "unregisterService" was not merged with "closeConnection" // on purpose. What is specific to JMX is restricted to this class // and this bundle. Sub-classes may use "closeConnection" without // any side effect on the JMX part. if( client instanceof JmxWrapperForMessagingClient ) ((JmxWrapperForMessagingClient) client).unregisterService(); } }
java
static void terminateClient( IMessagingClient client, String errorMessage, Logger logger ) { try { logger.fine( "The reconfigurable client is requesting its internal connection to be closed." ); if( client != null ) client.closeConnection(); } catch( Exception e ) { logger.warning( errorMessage + " " + e.getMessage()); Utils.logException( logger, e ); } finally { // "unregisterService" was not merged with "closeConnection" // on purpose. What is specific to JMX is restricted to this class // and this bundle. Sub-classes may use "closeConnection" without // any side effect on the JMX part. if( client instanceof JmxWrapperForMessagingClient ) ((JmxWrapperForMessagingClient) client).unregisterService(); } }
[ "static", "void", "terminateClient", "(", "IMessagingClient", "client", ",", "String", "errorMessage", ",", "Logger", "logger", ")", "{", "try", "{", "logger", ".", "fine", "(", "\"The reconfigurable client is requesting its internal connection to be closed.\"", ")", ";",...
Closes the connection of a messaging client and terminates it properly. @param client the client (never null) @param errorMessage the error message to log in case of problem @param logger a logger
[ "Closes", "the", "connection", "of", "a", "messaging", "client", "and", "terminates", "it", "properly", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-messaging-api/src/main/java/net/roboconf/messaging/api/reconfigurables/ReconfigurableClient.java#L370-L389
train
roboconf/roboconf-platform
miscellaneous/roboconf-doc-generator/src/main/java/net/roboconf/doc/generator/internal/GraphUtils.java
GraphUtils.computeShapeWidth
public static int computeShapeWidth( AbstractType type ) { Font font = GraphUtils.getDefaultFont(); BufferedImage img = new BufferedImage( 1, 1, BufferedImage.TYPE_INT_ARGB ); FontMetrics fm = img.getGraphics().getFontMetrics( font ); int width = fm.stringWidth( type.getName()); width = Math.max( width, 80 ) + 20; return width; }
java
public static int computeShapeWidth( AbstractType type ) { Font font = GraphUtils.getDefaultFont(); BufferedImage img = new BufferedImage( 1, 1, BufferedImage.TYPE_INT_ARGB ); FontMetrics fm = img.getGraphics().getFontMetrics( font ); int width = fm.stringWidth( type.getName()); width = Math.max( width, 80 ) + 20; return width; }
[ "public", "static", "int", "computeShapeWidth", "(", "AbstractType", "type", ")", "{", "Font", "font", "=", "GraphUtils", ".", "getDefaultFont", "(", ")", ";", "BufferedImage", "img", "=", "new", "BufferedImage", "(", "1", ",", "1", ",", "BufferedImage", "."...
Computes the width of a shape for a given component or facet. @param type a type @return the width it should take once displayed as a graph vertex
[ "Computes", "the", "width", "of", "a", "shape", "for", "a", "given", "component", "or", "facet", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-doc-generator/src/main/java/net/roboconf/doc/generator/internal/GraphUtils.java#L80-L89
train
roboconf/roboconf-platform
miscellaneous/roboconf-doc-generator/src/main/java/net/roboconf/doc/generator/internal/GraphUtils.java
GraphUtils.writeGraph
public static void writeGraph( File outputFile, Component selectedComponent, Layout<AbstractType,String> layout, Graph<AbstractType,String> graph , AbstractEdgeShapeTransformer<AbstractType,String> edgeShapeTransformer, Map<String,String> options ) throws IOException { VisualizationImageServer<AbstractType,String> vis = new VisualizationImageServer<AbstractType,String>( layout, layout.getSize()); vis.setBackground( Color.WHITE ); vis.getRenderContext().setEdgeLabelTransformer( new NoStringLabeller ()); vis.getRenderContext().setEdgeShapeTransformer( edgeShapeTransformer ); vis.getRenderContext().setVertexLabelTransformer( new ToStringLabeller<AbstractType> ()); vis.getRenderContext().setVertexShapeTransformer( new VertexShape()); vis.getRenderContext().setVertexFontTransformer( new VertexFont()); Color defaultBgColor = decode( options.get( DocConstants.OPTION_IMG_BACKGROUND_COLOR ), DocConstants.DEFAULT_BACKGROUND_COLOR ); Color highlightBgcolor = decode( options.get( DocConstants.OPTION_IMG_HIGHLIGHT_BG_COLOR ), DocConstants.DEFAULT_HIGHLIGHT_BG_COLOR ); vis.getRenderContext().setVertexFillPaintTransformer( new VertexColor( selectedComponent, defaultBgColor, highlightBgcolor )); Color defaultFgColor = decode( options.get( DocConstants.OPTION_IMG_FOREGROUND_COLOR ), DocConstants.DEFAULT_FOREGROUND_COLOR ); vis.getRenderContext().setVertexLabelRenderer( new MyVertexLabelRenderer( selectedComponent, defaultFgColor )); vis.getRenderer().getVertexLabelRenderer().setPosition( Position.CNTR ); BufferedImage image = (BufferedImage) vis.getImage( new Point2D.Double( layout.getSize().getWidth() / 2, layout.getSize().getHeight() / 2), new Dimension( layout.getSize())); ImageIO.write( image, "png", outputFile ); }
java
public static void writeGraph( File outputFile, Component selectedComponent, Layout<AbstractType,String> layout, Graph<AbstractType,String> graph , AbstractEdgeShapeTransformer<AbstractType,String> edgeShapeTransformer, Map<String,String> options ) throws IOException { VisualizationImageServer<AbstractType,String> vis = new VisualizationImageServer<AbstractType,String>( layout, layout.getSize()); vis.setBackground( Color.WHITE ); vis.getRenderContext().setEdgeLabelTransformer( new NoStringLabeller ()); vis.getRenderContext().setEdgeShapeTransformer( edgeShapeTransformer ); vis.getRenderContext().setVertexLabelTransformer( new ToStringLabeller<AbstractType> ()); vis.getRenderContext().setVertexShapeTransformer( new VertexShape()); vis.getRenderContext().setVertexFontTransformer( new VertexFont()); Color defaultBgColor = decode( options.get( DocConstants.OPTION_IMG_BACKGROUND_COLOR ), DocConstants.DEFAULT_BACKGROUND_COLOR ); Color highlightBgcolor = decode( options.get( DocConstants.OPTION_IMG_HIGHLIGHT_BG_COLOR ), DocConstants.DEFAULT_HIGHLIGHT_BG_COLOR ); vis.getRenderContext().setVertexFillPaintTransformer( new VertexColor( selectedComponent, defaultBgColor, highlightBgcolor )); Color defaultFgColor = decode( options.get( DocConstants.OPTION_IMG_FOREGROUND_COLOR ), DocConstants.DEFAULT_FOREGROUND_COLOR ); vis.getRenderContext().setVertexLabelRenderer( new MyVertexLabelRenderer( selectedComponent, defaultFgColor )); vis.getRenderer().getVertexLabelRenderer().setPosition( Position.CNTR ); BufferedImage image = (BufferedImage) vis.getImage( new Point2D.Double( layout.getSize().getWidth() / 2, layout.getSize().getHeight() / 2), new Dimension( layout.getSize())); ImageIO.write( image, "png", outputFile ); }
[ "public", "static", "void", "writeGraph", "(", "File", "outputFile", ",", "Component", "selectedComponent", ",", "Layout", "<", "AbstractType", ",", "String", ">", "layout", ",", "Graph", "<", "AbstractType", ",", "String", ">", "graph", ",", "AbstractEdgeShapeT...
Writes a graph as a PNG image. @param outputFile the output file @param selectedComponent the component to highlight @param layout the layout @param graph the graph @param edgeShapeTransformer the transformer for edge shapes (straight line, curved line, etc) @throws IOException if something went wrong
[ "Writes", "a", "graph", "as", "a", "PNG", "image", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-doc-generator/src/main/java/net/roboconf/doc/generator/internal/GraphUtils.java#L109-L144
train
roboconf/roboconf-platform
miscellaneous/roboconf-doc-generator/src/main/java/net/roboconf/doc/generator/internal/GraphUtils.java
GraphUtils.decode
static Color decode( String value, String defaultValue ) { Color result; try { result = Color.decode( value ); } catch( NumberFormatException e ) { Logger logger = Logger.getLogger( GraphUtils.class.getName()); logger.severe( "The specified color " + value + " could not be parsed. Back to default value: " + defaultValue ); Utils.logException( logger, e ); result = Color.decode( defaultValue ); } return result; }
java
static Color decode( String value, String defaultValue ) { Color result; try { result = Color.decode( value ); } catch( NumberFormatException e ) { Logger logger = Logger.getLogger( GraphUtils.class.getName()); logger.severe( "The specified color " + value + " could not be parsed. Back to default value: " + defaultValue ); Utils.logException( logger, e ); result = Color.decode( defaultValue ); } return result; }
[ "static", "Color", "decode", "(", "String", "value", ",", "String", "defaultValue", ")", "{", "Color", "result", ";", "try", "{", "result", "=", "Color", ".", "decode", "(", "value", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", ...
Decodes an hexadecimal color and resolves it as an AWT color. @param value the value to decode @param defaultValue the default value to use if value is invalid @return a color (not null)
[ "Decodes", "an", "hexadecimal", "color", "and", "resolves", "it", "as", "an", "AWT", "color", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-doc-generator/src/main/java/net/roboconf/doc/generator/internal/GraphUtils.java#L153-L167
train
roboconf/roboconf-platform
core/roboconf-agent/src/main/java/net/roboconf/agent/internal/misc/UserDataHelper.java
UserDataHelper.findParametersForAmazonOrOpenStack
public AgentProperties findParametersForAmazonOrOpenStack( Logger logger ) { logger.info( "User data are being retrieved for AWS / Openstack..." ); // Copy the user data String userData = Utils.readUrlContentQuietly( "http://169.254.169.254/latest/user-data", logger ); String ip = Utils.readUrlContentQuietly( "http://169.254.169.254/latest/meta-data/public-ipv4", logger ); AgentProperties result = null; try { // Parse the user data result = AgentProperties.readIaasProperties( userData, logger ); // Verify the IP if( ! AgentUtils.isValidIP( ip )) { // Failed retrieving public IP: try private one instead ip = Utils.readUrlContentQuietly( "http://169.254.169.254/latest/meta-data/local-ipv4", logger ); } if( AgentUtils.isValidIP( ip )) result.setIpAddress( ip ); else logger.severe( "No IP address could be retrieved (either public-ipv4 or local-ipv4)." ); } catch( IOException e ) { logger.severe( "The network properties could not be read. " + e.getMessage()); Utils.logException( logger, e ); } return result; }
java
public AgentProperties findParametersForAmazonOrOpenStack( Logger logger ) { logger.info( "User data are being retrieved for AWS / Openstack..." ); // Copy the user data String userData = Utils.readUrlContentQuietly( "http://169.254.169.254/latest/user-data", logger ); String ip = Utils.readUrlContentQuietly( "http://169.254.169.254/latest/meta-data/public-ipv4", logger ); AgentProperties result = null; try { // Parse the user data result = AgentProperties.readIaasProperties( userData, logger ); // Verify the IP if( ! AgentUtils.isValidIP( ip )) { // Failed retrieving public IP: try private one instead ip = Utils.readUrlContentQuietly( "http://169.254.169.254/latest/meta-data/local-ipv4", logger ); } if( AgentUtils.isValidIP( ip )) result.setIpAddress( ip ); else logger.severe( "No IP address could be retrieved (either public-ipv4 or local-ipv4)." ); } catch( IOException e ) { logger.severe( "The network properties could not be read. " + e.getMessage()); Utils.logException( logger, e ); } return result; }
[ "public", "AgentProperties", "findParametersForAmazonOrOpenStack", "(", "Logger", "logger", ")", "{", "logger", ".", "info", "(", "\"User data are being retrieved for AWS / Openstack...\"", ")", ";", "// Copy the user data", "String", "userData", "=", "Utils", ".", "readUrl...
Configures the agent from a IaaS registry. @param logger a logger @return the agent's data, or null if they could not be parsed
[ "Configures", "the", "agent", "from", "a", "IaaS", "registry", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-agent/src/main/java/net/roboconf/agent/internal/misc/UserDataHelper.java#L68-L97
train
roboconf/roboconf-platform
core/roboconf-agent/src/main/java/net/roboconf/agent/internal/misc/UserDataHelper.java
UserDataHelper.findParametersForAzure
public AgentProperties findParametersForAzure( Logger logger ) { logger.info( "User data are being retrieved for Microsoft Azure..." ); String userData = ""; try { // Get the user data from /var/lib/waagent/ovf-env.xml and decode it String userDataEncoded = getValueOfTagInXMLFile( "/var/lib/waagent/ovf-env.xml", "CustomData" ); userData = new String( Base64.decodeBase64( userDataEncoded.getBytes( StandardCharsets.UTF_8 )), "UTF-8" ); } catch( IOException | ParserConfigurationException | SAXException e ) { logger.severe( "The agent properties could not be read. " + e.getMessage()); Utils.logException( logger, e ); } // Get the public IP Address from /var/lib/waagent/SharedConfig.xml AgentProperties result = null; String publicIPAddress; try { result = AgentProperties.readIaasProperties( userData, logger ); publicIPAddress = getSpecificAttributeOfTagInXMLFile( "/var/lib/waagent/SharedConfig.xml", "Endpoint", "loadBalancedPublicAddress" ); result.setIpAddress( publicIPAddress ); } catch( ParserConfigurationException | SAXException e ) { logger.severe( "The agent could not retrieve a public IP address. " + e.getMessage()); Utils.logException( logger, e ); } catch( IOException e ) { logger.severe( "The agent could not retrieve its configuration. " + e.getMessage()); Utils.logException( logger, e ); } return result; }
java
public AgentProperties findParametersForAzure( Logger logger ) { logger.info( "User data are being retrieved for Microsoft Azure..." ); String userData = ""; try { // Get the user data from /var/lib/waagent/ovf-env.xml and decode it String userDataEncoded = getValueOfTagInXMLFile( "/var/lib/waagent/ovf-env.xml", "CustomData" ); userData = new String( Base64.decodeBase64( userDataEncoded.getBytes( StandardCharsets.UTF_8 )), "UTF-8" ); } catch( IOException | ParserConfigurationException | SAXException e ) { logger.severe( "The agent properties could not be read. " + e.getMessage()); Utils.logException( logger, e ); } // Get the public IP Address from /var/lib/waagent/SharedConfig.xml AgentProperties result = null; String publicIPAddress; try { result = AgentProperties.readIaasProperties( userData, logger ); publicIPAddress = getSpecificAttributeOfTagInXMLFile( "/var/lib/waagent/SharedConfig.xml", "Endpoint", "loadBalancedPublicAddress" ); result.setIpAddress( publicIPAddress ); } catch( ParserConfigurationException | SAXException e ) { logger.severe( "The agent could not retrieve a public IP address. " + e.getMessage()); Utils.logException( logger, e ); } catch( IOException e ) { logger.severe( "The agent could not retrieve its configuration. " + e.getMessage()); Utils.logException( logger, e ); } return result; }
[ "public", "AgentProperties", "findParametersForAzure", "(", "Logger", "logger", ")", "{", "logger", ".", "info", "(", "\"User data are being retrieved for Microsoft Azure...\"", ")", ";", "String", "userData", "=", "\"\"", ";", "try", "{", "// Get the user data from /var/...
Configures the agent from Azure. @param logger a logger @return the agent's data, or null if they could not be parsed
[ "Configures", "the", "agent", "from", "Azure", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-agent/src/main/java/net/roboconf/agent/internal/misc/UserDataHelper.java#L105-L137
train
roboconf/roboconf-platform
core/roboconf-agent/src/main/java/net/roboconf/agent/internal/misc/UserDataHelper.java
UserDataHelper.findParametersForVmware
public AgentProperties findParametersForVmware( Logger logger ) { logger.info( "User data are being retrieved for VMWare..." ); AgentProperties result = null; File propertiesFile = new File("/tmp/roboconf.properties"); try { int retries = 30; while((! propertiesFile.exists() || ! propertiesFile.canRead()) && retries-- > 0) { logger.fine("Agent tries to read properties file " + propertiesFile + ": trial #" + (30-retries)); try { Thread.sleep( 2000 ); } catch( InterruptedException e ) { throw new IOException( "Cannot read properties file: " + e ); } } result = AgentProperties.readIaasProperties(Utils.readPropertiesFile(propertiesFile)); /* * HACK for specific IaaS configurations (using properties file in a VMWare-like manner) * Try to pick IP address... in the case we are on OpenStack or any IaaS with amazon-compatible API * Some configurations (with floating IPs) do not provide network interfaces exposing public IPs ! */ InputStream in = null; try { URL userDataUrl = new URL( "http://169.254.169.254/latest/meta-data/public-ipv4" ); in = userDataUrl.openStream(); ByteArrayOutputStream os = new ByteArrayOutputStream(); Utils.copyStreamSafely( in, os ); String ip = os.toString( "UTF-8" ); if(! AgentUtils.isValidIP( ip )) { // Failed retrieving public IP: try private one instead Utils.closeQuietly( in ); userDataUrl = new URL( "http://169.254.169.254/latest/meta-data/local-ipv4" ); in = userDataUrl.openStream(); os = new ByteArrayOutputStream(); Utils.copyStreamSafely( in, os ); ip = os.toString( "UTF-8" ); } if(AgentUtils.isValidIP( ip )) result.setIpAddress( os.toString( "UTF-8" )); } catch( IOException e ) { Utils.logException( logger, e ); } finally { Utils.closeQuietly( in ); } /* HACK ends here (see comment above). Removing it is harmless on classical VMWare configurations. */ } catch( IOException e ) { logger.fine( "Agent failed to read properties file " + propertiesFile ); result = null; } return result; }
java
public AgentProperties findParametersForVmware( Logger logger ) { logger.info( "User data are being retrieved for VMWare..." ); AgentProperties result = null; File propertiesFile = new File("/tmp/roboconf.properties"); try { int retries = 30; while((! propertiesFile.exists() || ! propertiesFile.canRead()) && retries-- > 0) { logger.fine("Agent tries to read properties file " + propertiesFile + ": trial #" + (30-retries)); try { Thread.sleep( 2000 ); } catch( InterruptedException e ) { throw new IOException( "Cannot read properties file: " + e ); } } result = AgentProperties.readIaasProperties(Utils.readPropertiesFile(propertiesFile)); /* * HACK for specific IaaS configurations (using properties file in a VMWare-like manner) * Try to pick IP address... in the case we are on OpenStack or any IaaS with amazon-compatible API * Some configurations (with floating IPs) do not provide network interfaces exposing public IPs ! */ InputStream in = null; try { URL userDataUrl = new URL( "http://169.254.169.254/latest/meta-data/public-ipv4" ); in = userDataUrl.openStream(); ByteArrayOutputStream os = new ByteArrayOutputStream(); Utils.copyStreamSafely( in, os ); String ip = os.toString( "UTF-8" ); if(! AgentUtils.isValidIP( ip )) { // Failed retrieving public IP: try private one instead Utils.closeQuietly( in ); userDataUrl = new URL( "http://169.254.169.254/latest/meta-data/local-ipv4" ); in = userDataUrl.openStream(); os = new ByteArrayOutputStream(); Utils.copyStreamSafely( in, os ); ip = os.toString( "UTF-8" ); } if(AgentUtils.isValidIP( ip )) result.setIpAddress( os.toString( "UTF-8" )); } catch( IOException e ) { Utils.logException( logger, e ); } finally { Utils.closeQuietly( in ); } /* HACK ends here (see comment above). Removing it is harmless on classical VMWare configurations. */ } catch( IOException e ) { logger.fine( "Agent failed to read properties file " + propertiesFile ); result = null; } return result; }
[ "public", "AgentProperties", "findParametersForVmware", "(", "Logger", "logger", ")", "{", "logger", ".", "info", "(", "\"User data are being retrieved for VMWare...\"", ")", ";", "AgentProperties", "result", "=", "null", ";", "File", "propertiesFile", "=", "new", "Fi...
Configures the agent from VMWare. @param logger a logger @return the agent's data, or null if they could not be parsed
[ "Configures", "the", "agent", "from", "VMWare", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-agent/src/main/java/net/roboconf/agent/internal/misc/UserDataHelper.java#L145-L205
train
roboconf/roboconf-platform
core/roboconf-agent/src/main/java/net/roboconf/agent/internal/misc/UserDataHelper.java
UserDataHelper.findParametersFromUrl
public AgentProperties findParametersFromUrl( String url, Logger logger ) { logger.info( "User data are being retrieved from URL: " + url ); AgentProperties result = null; try { URI uri = UriUtils.urlToUri( url ); Properties props = new Properties(); InputStream in = null; try { in = uri.toURL().openStream(); props.load( in ); } finally { Utils.closeQuietly( in ); } result = AgentProperties.readIaasProperties( props ); } catch( Exception e ) { logger.fine( "Agent parameters could not be read from " + url ); result = null; } return result; }
java
public AgentProperties findParametersFromUrl( String url, Logger logger ) { logger.info( "User data are being retrieved from URL: " + url ); AgentProperties result = null; try { URI uri = UriUtils.urlToUri( url ); Properties props = new Properties(); InputStream in = null; try { in = uri.toURL().openStream(); props.load( in ); } finally { Utils.closeQuietly( in ); } result = AgentProperties.readIaasProperties( props ); } catch( Exception e ) { logger.fine( "Agent parameters could not be read from " + url ); result = null; } return result; }
[ "public", "AgentProperties", "findParametersFromUrl", "(", "String", "url", ",", "Logger", "logger", ")", "{", "logger", ".", "info", "(", "\"User data are being retrieved from URL: \"", "+", "url", ")", ";", "AgentProperties", "result", "=", "null", ";", "try", "...
Retrieve the agent's configuration from an URL. @param logger a logger @return the agent's data, or null if they could not be parsed
[ "Retrieve", "the", "agent", "s", "configuration", "from", "an", "URL", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-agent/src/main/java/net/roboconf/agent/internal/misc/UserDataHelper.java#L213-L237
train
roboconf/roboconf-platform
core/roboconf-agent/src/main/java/net/roboconf/agent/internal/misc/UserDataHelper.java
UserDataHelper.reconfigureMessaging
public void reconfigureMessaging( String etcDir, Map<String,String> msgData ) throws IOException { String messagingType = msgData.get( MessagingConstants.MESSAGING_TYPE_PROPERTY ); Logger.getLogger( getClass().getName()).fine( "Messaging type for reconfiguration: " + messagingType ); if( ! Utils.isEmptyOrWhitespaces( etcDir ) && ! Utils.isEmptyOrWhitespaces( messagingType )) { // Write the messaging configuration File f = new File( etcDir, "net.roboconf.messaging." + messagingType + ".cfg" ); Logger logger = Logger.getLogger( getClass().getName()); Properties props = Utils.readPropertiesFileQuietly( f, logger ); props.putAll( msgData ); props.remove( MessagingConstants.MESSAGING_TYPE_PROPERTY ); Utils.writePropertiesFile( props, f ); // Set the messaging type f = new File( etcDir, Constants.KARAF_CFG_FILE_AGENT ); props = Utils.readPropertiesFileQuietly( f, Logger.getLogger( getClass().getName())); if( messagingType != null ) { props.put( Constants.MESSAGING_TYPE, messagingType ); Utils.writePropertiesFile( props, f ); } } }
java
public void reconfigureMessaging( String etcDir, Map<String,String> msgData ) throws IOException { String messagingType = msgData.get( MessagingConstants.MESSAGING_TYPE_PROPERTY ); Logger.getLogger( getClass().getName()).fine( "Messaging type for reconfiguration: " + messagingType ); if( ! Utils.isEmptyOrWhitespaces( etcDir ) && ! Utils.isEmptyOrWhitespaces( messagingType )) { // Write the messaging configuration File f = new File( etcDir, "net.roboconf.messaging." + messagingType + ".cfg" ); Logger logger = Logger.getLogger( getClass().getName()); Properties props = Utils.readPropertiesFileQuietly( f, logger ); props.putAll( msgData ); props.remove( MessagingConstants.MESSAGING_TYPE_PROPERTY ); Utils.writePropertiesFile( props, f ); // Set the messaging type f = new File( etcDir, Constants.KARAF_CFG_FILE_AGENT ); props = Utils.readPropertiesFileQuietly( f, Logger.getLogger( getClass().getName())); if( messagingType != null ) { props.put( Constants.MESSAGING_TYPE, messagingType ); Utils.writePropertiesFile( props, f ); } } }
[ "public", "void", "reconfigureMessaging", "(", "String", "etcDir", ",", "Map", "<", "String", ",", "String", ">", "msgData", ")", "throws", "IOException", "{", "String", "messagingType", "=", "msgData", ".", "get", "(", "MessagingConstants", ".", "MESSAGING_TYPE...
Reconfigures the messaging. @param etcDir the KARAF_ETC directory @param msgData the messaging configuration parameters
[ "Reconfigures", "the", "messaging", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-agent/src/main/java/net/roboconf/agent/internal/misc/UserDataHelper.java#L245-L272
train
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/model/helpers/InstanceHelpers.java
InstanceHelpers.findInstanceName
public static String findInstanceName( String instancePath ) { String instanceName = ""; Matcher m = Pattern.compile( "([^/]+)$" ).matcher( instancePath ); if( m.find()) instanceName = m.group( 1 ); return instanceName; }
java
public static String findInstanceName( String instancePath ) { String instanceName = ""; Matcher m = Pattern.compile( "([^/]+)$" ).matcher( instancePath ); if( m.find()) instanceName = m.group( 1 ); return instanceName; }
[ "public", "static", "String", "findInstanceName", "(", "String", "instancePath", ")", "{", "String", "instanceName", "=", "\"\"", ";", "Matcher", "m", "=", "Pattern", ".", "compile", "(", "\"([^/]+)$\"", ")", ".", "matcher", "(", "instancePath", ")", ";", "i...
Finds the name of an instance from its path. @param instancePath a non-null instance path @return an instance name, or the path itself if it is not valid (e.g. no slash)
[ "Finds", "the", "name", "of", "an", "instance", "from", "its", "path", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/model/helpers/InstanceHelpers.java#L108-L116
train
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/model/helpers/InstanceHelpers.java
InstanceHelpers.findInstancesByComponentName
public static List<Instance> findInstancesByComponentName( AbstractApplication application, String componentName ) { List<Instance> result = new ArrayList<> (); for( Instance inst : getAllInstances( application )) { if( componentName.equals( inst.getComponent().getName())) result.add( inst ); } return result; }
java
public static List<Instance> findInstancesByComponentName( AbstractApplication application, String componentName ) { List<Instance> result = new ArrayList<> (); for( Instance inst : getAllInstances( application )) { if( componentName.equals( inst.getComponent().getName())) result.add( inst ); } return result; }
[ "public", "static", "List", "<", "Instance", ">", "findInstancesByComponentName", "(", "AbstractApplication", "application", ",", "String", "componentName", ")", "{", "List", "<", "Instance", ">", "result", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", ...
Finds instances by component name. @param application an application (not null) @param componentName a component name (not null) @return a non-null list of instances
[ "Finds", "instances", "by", "component", "name", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/model/helpers/InstanceHelpers.java#L313-L322
train
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/model/helpers/InstanceHelpers.java
InstanceHelpers.findRootInstance
public static Instance findRootInstance( Instance instance ) { Instance rootInstance = instance; while( rootInstance.getParent() != null ) rootInstance = rootInstance.getParent(); return rootInstance; }
java
public static Instance findRootInstance( Instance instance ) { Instance rootInstance = instance; while( rootInstance.getParent() != null ) rootInstance = rootInstance.getParent(); return rootInstance; }
[ "public", "static", "Instance", "findRootInstance", "(", "Instance", "instance", ")", "{", "Instance", "rootInstance", "=", "instance", ";", "while", "(", "rootInstance", ".", "getParent", "(", ")", "!=", "null", ")", "rootInstance", "=", "rootInstance", ".", ...
Finds the root instance for an instance. @param instance an instance (not null) @return a non-null instance, the root instance
[ "Finds", "the", "root", "instance", "for", "an", "instance", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/model/helpers/InstanceHelpers.java#L330-L337
train
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/model/helpers/InstanceHelpers.java
InstanceHelpers.findAllScopedInstances
public static List<Instance> findAllScopedInstances( AbstractApplication app ) { List<Instance> instanceList = new ArrayList<> (); List<Instance> todo = new ArrayList<> (); todo.addAll( app.getRootInstances()); while( ! todo.isEmpty()) { Instance current = todo.remove( 0 ); todo.addAll( current.getChildren()); if( isTarget( current )) instanceList.add( current ); } return instanceList; }
java
public static List<Instance> findAllScopedInstances( AbstractApplication app ) { List<Instance> instanceList = new ArrayList<> (); List<Instance> todo = new ArrayList<> (); todo.addAll( app.getRootInstances()); while( ! todo.isEmpty()) { Instance current = todo.remove( 0 ); todo.addAll( current.getChildren()); if( isTarget( current )) instanceList.add( current ); } return instanceList; }
[ "public", "static", "List", "<", "Instance", ">", "findAllScopedInstances", "(", "AbstractApplication", "app", ")", "{", "List", "<", "Instance", ">", "instanceList", "=", "new", "ArrayList", "<>", "(", ")", ";", "List", "<", "Instance", ">", "todo", "=", ...
Finds all the scoped instances from an application. @return a non-null list
[ "Finds", "all", "the", "scoped", "instances", "from", "an", "application", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/model/helpers/InstanceHelpers.java#L360-L374
train
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/model/helpers/InstanceHelpers.java
InstanceHelpers.getAllInstances
public static List<Instance> getAllInstances( AbstractApplication application ) { List<Instance> result = new ArrayList<> (); for( Instance instance : application.getRootInstances()) result.addAll( InstanceHelpers.buildHierarchicalList( instance )); return result; }
java
public static List<Instance> getAllInstances( AbstractApplication application ) { List<Instance> result = new ArrayList<> (); for( Instance instance : application.getRootInstances()) result.addAll( InstanceHelpers.buildHierarchicalList( instance )); return result; }
[ "public", "static", "List", "<", "Instance", ">", "getAllInstances", "(", "AbstractApplication", "application", ")", "{", "List", "<", "Instance", ">", "result", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "Instance", "instance", ":", "applicat...
Gets all the instances of an application. @param application an application (not null) @return a non-null list of instances <p> The result is a list made up of ordered lists.<br> root-0, child-0-1, child-0-2, child-0-1-1, etc.<br> root-1, child-1-1, child-1-2, child-1-1-1, etc.<br> </p> <p> It means the resulting list can be considered as valid for starting instances from the root instances to the bottom leaves. </p>
[ "Gets", "all", "the", "instances", "of", "an", "application", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/model/helpers/InstanceHelpers.java#L391-L398
train
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/model/helpers/InstanceHelpers.java
InstanceHelpers.hasChildWithThisName
public static boolean hasChildWithThisName( AbstractApplication application, Instance parentInstance, String nameToSearch ) { boolean hasAlreadyAChildWithThisName = false; Collection<Instance> list = parentInstance == null ? application.getRootInstances() : parentInstance.getChildren(); for( Iterator<Instance> it = list.iterator(); it.hasNext() && ! hasAlreadyAChildWithThisName; ) { hasAlreadyAChildWithThisName = Objects.equals( nameToSearch, it.next().getName()); } return hasAlreadyAChildWithThisName; }
java
public static boolean hasChildWithThisName( AbstractApplication application, Instance parentInstance, String nameToSearch ) { boolean hasAlreadyAChildWithThisName = false; Collection<Instance> list = parentInstance == null ? application.getRootInstances() : parentInstance.getChildren(); for( Iterator<Instance> it = list.iterator(); it.hasNext() && ! hasAlreadyAChildWithThisName; ) { hasAlreadyAChildWithThisName = Objects.equals( nameToSearch, it.next().getName()); } return hasAlreadyAChildWithThisName; }
[ "public", "static", "boolean", "hasChildWithThisName", "(", "AbstractApplication", "application", ",", "Instance", "parentInstance", ",", "String", "nameToSearch", ")", "{", "boolean", "hasAlreadyAChildWithThisName", "=", "false", ";", "Collection", "<", "Instance", ">"...
Determines whether an instance name is not already used by a sibling instance. @param application the application (not null) @param parentInstance the parent instance (can be null to indicate a root instance) @param nameToSearch the name to search @return true if a child instance of <code>parentInstance</code> has the same name, false otherwise
[ "Determines", "whether", "an", "instance", "name", "is", "not", "already", "used", "by", "a", "sibling", "instance", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/model/helpers/InstanceHelpers.java#L467-L476
train
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/model/helpers/InstanceHelpers.java
InstanceHelpers.findInstanceDirectoryOnAgent
public static File findInstanceDirectoryOnAgent( Instance instance ) { String path = InstanceHelpers.computeInstancePath( instance ); path = path.substring( 1 ).replace( '/', '_' ).replace( ' ', '_' ); String installerName = ComponentHelpers.findComponentInstaller( instance.getComponent()); return new File( Constants.WORK_DIRECTORY_AGENT, installerName + "/" + path ); }
java
public static File findInstanceDirectoryOnAgent( Instance instance ) { String path = InstanceHelpers.computeInstancePath( instance ); path = path.substring( 1 ).replace( '/', '_' ).replace( ' ', '_' ); String installerName = ComponentHelpers.findComponentInstaller( instance.getComponent()); return new File( Constants.WORK_DIRECTORY_AGENT, installerName + "/" + path ); }
[ "public", "static", "File", "findInstanceDirectoryOnAgent", "(", "Instance", "instance", ")", "{", "String", "path", "=", "InstanceHelpers", ".", "computeInstancePath", "(", "instance", ")", ";", "path", "=", "path", ".", "substring", "(", "1", ")", ".", "repl...
Finds the directory where an agent stores the files for a given instance. @param instance an instance (not null) @return a file (not null, but may not exist)
[ "Finds", "the", "directory", "where", "an", "agent", "stores", "the", "files", "for", "a", "given", "instance", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/model/helpers/InstanceHelpers.java#L484-L491
train
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/model/helpers/InstanceHelpers.java
InstanceHelpers.isTarget
public static boolean isTarget( Instance instance ) { return instance.getComponent() != null && ComponentHelpers.isTarget( instance.getComponent()); }
java
public static boolean isTarget( Instance instance ) { return instance.getComponent() != null && ComponentHelpers.isTarget( instance.getComponent()); }
[ "public", "static", "boolean", "isTarget", "(", "Instance", "instance", ")", "{", "return", "instance", ".", "getComponent", "(", ")", "!=", "null", "&&", "ComponentHelpers", ".", "isTarget", "(", "instance", ".", "getComponent", "(", ")", ")", ";", "}" ]
Determines whether an instances is associated with the "target" installer or not. @param instance an instance (not null) @return true if it is associated with the "target" installer, false otherwise
[ "Determines", "whether", "an", "instances", "is", "associated", "with", "the", "target", "installer", "or", "not", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/model/helpers/InstanceHelpers.java#L548-L551
train
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/model/helpers/InstanceHelpers.java
InstanceHelpers.findRootInstancePath
public static String findRootInstancePath( String scopedInstancePath ) { String result; if( Utils.isEmptyOrWhitespaces( scopedInstancePath )) { // Do not return null result = ""; } else if( scopedInstancePath.contains( "/" )) { // Be as flexible as possible with paths String s = scopedInstancePath.replaceFirst( "^/*", "" ); int index = s.indexOf( '/' ); result = index > 0 ? s.substring( 0, index ) : s; } else { // Assumed to be a root instance name result = scopedInstancePath; } return result; }
java
public static String findRootInstancePath( String scopedInstancePath ) { String result; if( Utils.isEmptyOrWhitespaces( scopedInstancePath )) { // Do not return null result = ""; } else if( scopedInstancePath.contains( "/" )) { // Be as flexible as possible with paths String s = scopedInstancePath.replaceFirst( "^/*", "" ); int index = s.indexOf( '/' ); result = index > 0 ? s.substring( 0, index ) : s; } else { // Assumed to be a root instance name result = scopedInstancePath; } return result; }
[ "public", "static", "String", "findRootInstancePath", "(", "String", "scopedInstancePath", ")", "{", "String", "result", ";", "if", "(", "Utils", ".", "isEmptyOrWhitespaces", "(", "scopedInstancePath", ")", ")", "{", "// Do not return null", "result", "=", "\"\"", ...
Finds the root instance's path from another instance path. @param scopedInstancePath a scoped instance path (may be null) @return a non-null root instance path
[ "Finds", "the", "root", "instance", "s", "path", "from", "another", "instance", "path", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/model/helpers/InstanceHelpers.java#L583-L602
train
stephanrauh/AngularFaces
AngularFaces_2.0/AngularFaces-core/src/main/java/de/beyondjava/angularFaces/core/SessionUtils.java
SessionUtils.isDartControllerActive
public static boolean isDartControllerActive() { Map<String, Object> sessionMap = FacesContext.getCurrentInstance().getExternalContext().getSessionMap(); if (sessionMap.containsKey(DART_CONTROLLER)) { return "true".equals(sessionMap.get(DART_CONTROLLER)); } return false; }
java
public static boolean isDartControllerActive() { Map<String, Object> sessionMap = FacesContext.getCurrentInstance().getExternalContext().getSessionMap(); if (sessionMap.containsKey(DART_CONTROLLER)) { return "true".equals(sessionMap.get(DART_CONTROLLER)); } return false; }
[ "public", "static", "boolean", "isDartControllerActive", "(", ")", "{", "Map", "<", "String", ",", "Object", ">", "sessionMap", "=", "FacesContext", ".", "getCurrentInstance", "(", ")", ".", "getExternalContext", "(", ")", ".", "getSessionMap", "(", ")", ";", ...
Are we to support AngularDart instead of AngularJS? @return true if AngularDart is used
[ "Are", "we", "to", "support", "AngularDart", "instead", "of", "AngularJS?" ]
43d915f004645b1bbbf2625214294dab0858ba01
https://github.com/stephanrauh/AngularFaces/blob/43d915f004645b1bbbf2625214294dab0858ba01/AngularFaces_2.0/AngularFaces-core/src/main/java/de/beyondjava/angularFaces/core/SessionUtils.java#L61-L67
train
stephanrauh/AngularFaces
AngularFaces_2.0/AngularFaces-core/src/main/java/de/beyondjava/angularFaces/core/SessionUtils.java
SessionUtils.setControllerName
public static void setControllerName(String name) { Map<String, Object> sessionMap = FacesContext.getCurrentInstance().getExternalContext().getSessionMap(); sessionMap.put(DART_CONTROLLER_NAME, name); }
java
public static void setControllerName(String name) { Map<String, Object> sessionMap = FacesContext.getCurrentInstance().getExternalContext().getSessionMap(); sessionMap.put(DART_CONTROLLER_NAME, name); }
[ "public", "static", "void", "setControllerName", "(", "String", "name", ")", "{", "Map", "<", "String", ",", "Object", ">", "sessionMap", "=", "FacesContext", ".", "getCurrentInstance", "(", ")", ".", "getExternalContext", "(", ")", ".", "getSessionMap", "(", ...
Sets the name of the Dart controller name as defined in the dart file (@NGController's publishAs attribute). @param name the name of the Dart controller
[ "Sets", "the", "name", "of", "the", "Dart", "controller", "name", "as", "defined", "in", "the", "dart", "file", "(" ]
43d915f004645b1bbbf2625214294dab0858ba01
https://github.com/stephanrauh/AngularFaces/blob/43d915f004645b1bbbf2625214294dab0858ba01/AngularFaces_2.0/AngularFaces-core/src/main/java/de/beyondjava/angularFaces/core/SessionUtils.java#L73-L76
train
roboconf/roboconf-platform
miscellaneous/roboconf-tooling-core/src/main/java/net/roboconf/tooling/core/textactions/UncommentAction.java
UncommentAction.uncommentLine
public static String uncommentLine( String line ) { String result = line; if( ! Utils.isEmptyOrWhitespaces( line ) && line.trim().startsWith( ParsingConstants.COMMENT_DELIMITER )) result = line.replaceFirst( "^(\\s*)" + ParsingConstants.COMMENT_DELIMITER + "+", "$1" ); return result; }
java
public static String uncommentLine( String line ) { String result = line; if( ! Utils.isEmptyOrWhitespaces( line ) && line.trim().startsWith( ParsingConstants.COMMENT_DELIMITER )) result = line.replaceFirst( "^(\\s*)" + ParsingConstants.COMMENT_DELIMITER + "+", "$1" ); return result; }
[ "public", "static", "String", "uncommentLine", "(", "String", "line", ")", "{", "String", "result", "=", "line", ";", "if", "(", "!", "Utils", ".", "isEmptyOrWhitespaces", "(", "line", ")", "&&", "line", ".", "trim", "(", ")", ".", "startsWith", "(", "...
Uncomments a line. @param line a non-null line @return a non-null line
[ "Uncomments", "a", "line", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-tooling-core/src/main/java/net/roboconf/tooling/core/textactions/UncommentAction.java#L47-L55
train
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/internal/dsl/parsing/ExportedVariablesParser.java
ExportedVariablesParser.parse
public void parse( String line, File sourceFile, int lineNumber ) { // Reset this.rawNameToVariables.clear(); this.errors.clear(); this.cursor = 0; // Parse while( this.cursor < line.length()) { char c = line.charAt( this.cursor ); if( Character.isWhitespace( c ) || c == ',' ) this.cursor ++; recognizeVariable( line, sourceFile, lineNumber ); } }
java
public void parse( String line, File sourceFile, int lineNumber ) { // Reset this.rawNameToVariables.clear(); this.errors.clear(); this.cursor = 0; // Parse while( this.cursor < line.length()) { char c = line.charAt( this.cursor ); if( Character.isWhitespace( c ) || c == ',' ) this.cursor ++; recognizeVariable( line, sourceFile, lineNumber ); } }
[ "public", "void", "parse", "(", "String", "line", ",", "File", "sourceFile", ",", "int", "lineNumber", ")", "{", "// Reset", "this", ".", "rawNameToVariables", ".", "clear", "(", ")", ";", "this", ".", "errors", ".", "clear", "(", ")", ";", "this", "."...
Parses a line and extracts exported variables. @param line @param sourceFile @param lineNumber
[ "Parses", "a", "line", "and", "extracts", "exported", "variables", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/internal/dsl/parsing/ExportedVariablesParser.java#L57-L73
train
roboconf/roboconf-platform
miscellaneous/roboconf-dm-rest-client/src/main/java/net/roboconf/dm/rest/client/delegates/TargetWsDelegate.java
TargetWsDelegate.listAllTargets
public List<TargetWrapperDescriptor> listAllTargets() { this.logger.finer( "Listing all the available targets." ); WebResource path = this.resource.path( UrlConstants.TARGETS ); List<TargetWrapperDescriptor> result = this.wsClient.createBuilder( path ) .accept( MediaType.APPLICATION_JSON ) .type( MediaType.APPLICATION_JSON ) .get( new GenericType<List<TargetWrapperDescriptor>> () {}); if( result != null ) this.logger.finer( result.size() + " target descriptors were found." ); else this.logger.finer( "No target descriptor was found." ); return result != null ? result : new ArrayList<TargetWrapperDescriptor>( 0 ); }
java
public List<TargetWrapperDescriptor> listAllTargets() { this.logger.finer( "Listing all the available targets." ); WebResource path = this.resource.path( UrlConstants.TARGETS ); List<TargetWrapperDescriptor> result = this.wsClient.createBuilder( path ) .accept( MediaType.APPLICATION_JSON ) .type( MediaType.APPLICATION_JSON ) .get( new GenericType<List<TargetWrapperDescriptor>> () {}); if( result != null ) this.logger.finer( result.size() + " target descriptors were found." ); else this.logger.finer( "No target descriptor was found." ); return result != null ? result : new ArrayList<TargetWrapperDescriptor>( 0 ); }
[ "public", "List", "<", "TargetWrapperDescriptor", ">", "listAllTargets", "(", ")", "{", "this", ".", "logger", ".", "finer", "(", "\"Listing all the available targets.\"", ")", ";", "WebResource", "path", "=", "this", ".", "resource", ".", "path", "(", "UrlConst...
Lists all the targets. @return a non-null list of target descriptors
[ "Lists", "all", "the", "targets", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-dm-rest-client/src/main/java/net/roboconf/dm/rest/client/delegates/TargetWsDelegate.java#L73-L89
train
roboconf/roboconf-platform
miscellaneous/roboconf-dm-rest-client/src/main/java/net/roboconf/dm/rest/client/delegates/TargetWsDelegate.java
TargetWsDelegate.createTarget
public String createTarget( String targetContent ) throws TargetWsException { this.logger.finer( "Creating a new target." ); WebResource path = this.resource.path( UrlConstants.TARGETS ); ClientResponse response = this.wsClient.createBuilder( path ).post( ClientResponse.class, targetContent ); handleResponse( response ); return response.getEntity( String.class ); }
java
public String createTarget( String targetContent ) throws TargetWsException { this.logger.finer( "Creating a new target." ); WebResource path = this.resource.path( UrlConstants.TARGETS ); ClientResponse response = this.wsClient.createBuilder( path ).post( ClientResponse.class, targetContent ); handleResponse( response ); return response.getEntity( String.class ); }
[ "public", "String", "createTarget", "(", "String", "targetContent", ")", "throws", "TargetWsException", "{", "this", ".", "logger", ".", "finer", "(", "\"Creating a new target.\"", ")", ";", "WebResource", "path", "=", "this", ".", "resource", ".", "path", "(", ...
Creates a new target. @param targetContent non-null target properties @return the ID of the newly created target @throws TargetWsException if the creation failed
[ "Creates", "a", "new", "target", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-dm-rest-client/src/main/java/net/roboconf/dm/rest/client/delegates/TargetWsDelegate.java#L98-L107
train
roboconf/roboconf-platform
miscellaneous/roboconf-dm-rest-client/src/main/java/net/roboconf/dm/rest/client/delegates/TargetWsDelegate.java
TargetWsDelegate.deleteTarget
public void deleteTarget( String targetId ) throws TargetWsException { this.logger.finer( "Deleting target " + targetId ); WebResource path = this.resource.path( UrlConstants.TARGETS ).path( targetId ); ClientResponse response = this.wsClient.createBuilder( path ) .accept( MediaType.APPLICATION_JSON ) .delete( ClientResponse.class ); handleResponse( response ); }
java
public void deleteTarget( String targetId ) throws TargetWsException { this.logger.finer( "Deleting target " + targetId ); WebResource path = this.resource.path( UrlConstants.TARGETS ).path( targetId ); ClientResponse response = this.wsClient.createBuilder( path ) .accept( MediaType.APPLICATION_JSON ) .delete( ClientResponse.class ); handleResponse( response ); }
[ "public", "void", "deleteTarget", "(", "String", "targetId", ")", "throws", "TargetWsException", "{", "this", ".", "logger", ".", "finer", "(", "\"Deleting target \"", "+", "targetId", ")", ";", "WebResource", "path", "=", "this", ".", "resource", ".", "path",...
Deletes a target. @param targetId a target ID @throws TargetWsException if the creation failed
[ "Deletes", "a", "target", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-dm-rest-client/src/main/java/net/roboconf/dm/rest/client/delegates/TargetWsDelegate.java#L115-L125
train
roboconf/roboconf-platform
miscellaneous/roboconf-dm-rest-client/src/main/java/net/roboconf/dm/rest/client/delegates/TargetWsDelegate.java
TargetWsDelegate.associateTarget
public void associateTarget( AbstractApplication app, String instancePathOrComponentName, String targetId, boolean bind ) throws TargetWsException { if( bind ) this.logger.finer( "Associating " + app + " :: " + instancePathOrComponentName + " with " + targetId ); else this.logger.finer( "Dissociating " + app + " :: " + instancePathOrComponentName + " from " + targetId ); WebResource path = this.resource.path( UrlConstants.TARGETS ) .path( targetId ).path( "associations" ) .queryParam( "bind", Boolean.toString( bind )) .queryParam( "name", app.getName()); if( instancePathOrComponentName != null ) path = path.queryParam( "elt", instancePathOrComponentName ); if( app instanceof ApplicationTemplate ) path = path.queryParam( "qualifier", ((ApplicationTemplate) app).getVersion()); ClientResponse response = this.wsClient.createBuilder( path ) .accept( MediaType.APPLICATION_JSON ) .post( ClientResponse.class ); handleResponse( response ); }
java
public void associateTarget( AbstractApplication app, String instancePathOrComponentName, String targetId, boolean bind ) throws TargetWsException { if( bind ) this.logger.finer( "Associating " + app + " :: " + instancePathOrComponentName + " with " + targetId ); else this.logger.finer( "Dissociating " + app + " :: " + instancePathOrComponentName + " from " + targetId ); WebResource path = this.resource.path( UrlConstants.TARGETS ) .path( targetId ).path( "associations" ) .queryParam( "bind", Boolean.toString( bind )) .queryParam( "name", app.getName()); if( instancePathOrComponentName != null ) path = path.queryParam( "elt", instancePathOrComponentName ); if( app instanceof ApplicationTemplate ) path = path.queryParam( "qualifier", ((ApplicationTemplate) app).getVersion()); ClientResponse response = this.wsClient.createBuilder( path ) .accept( MediaType.APPLICATION_JSON ) .post( ClientResponse.class ); handleResponse( response ); }
[ "public", "void", "associateTarget", "(", "AbstractApplication", "app", ",", "String", "instancePathOrComponentName", ",", "String", "targetId", ",", "boolean", "bind", ")", "throws", "TargetWsException", "{", "if", "(", "bind", ")", "this", ".", "logger", ".", ...
Associates or dissociates an application and a target. @param app an application or application template @param targetId a target ID @param instancePathOrComponentName an instance path or a component name (can be null) @param bind true to create a binding, false to delete one @throws TargetWsException
[ "Associates", "or", "dissociates", "an", "application", "and", "a", "target", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-dm-rest-client/src/main/java/net/roboconf/dm/rest/client/delegates/TargetWsDelegate.java#L136-L160
train
AdamBien/enhydrator
enhydrator/src/main/java/com/airhacks/enhydrator/in/Row.java
Row.addColumn
public Row addColumn(int index, String name, Object value) { Objects.requireNonNull(name, "Name of the column cannot be null"); Objects.requireNonNull(value, "Value of " + name + " cannot be null"); final Column column = new Column(index, name, value); return this.addColumn(column); }
java
public Row addColumn(int index, String name, Object value) { Objects.requireNonNull(name, "Name of the column cannot be null"); Objects.requireNonNull(value, "Value of " + name + " cannot be null"); final Column column = new Column(index, name, value); return this.addColumn(column); }
[ "public", "Row", "addColumn", "(", "int", "index", ",", "String", "name", ",", "Object", "value", ")", "{", "Objects", ".", "requireNonNull", "(", "name", ",", "\"Name of the column cannot be null\"", ")", ";", "Objects", ".", "requireNonNull", "(", "value", "...
Adds or overrides a column with a default destination @param index the origin index @param name a unique name of the column. @param value @return reference for method chaining
[ "Adds", "or", "overrides", "a", "column", "with", "a", "default", "destination" ]
7a2a2f0a05e533b53f27fab73ce8d58aae852379
https://github.com/AdamBien/enhydrator/blob/7a2a2f0a05e533b53f27fab73ce8d58aae852379/enhydrator/src/main/java/com/airhacks/enhydrator/in/Row.java#L115-L120
train
craftercms/core
src/main/java/org/craftercms/core/util/XmlUtils.java
XmlUtils.selectObject
public static Object selectObject(Node node, String xpathQuery) { Object result = node.selectObject(xpathQuery); if (result != null && result instanceof Collection && ((Collection) result).isEmpty()) { return null; } else { return result; } }
java
public static Object selectObject(Node node, String xpathQuery) { Object result = node.selectObject(xpathQuery); if (result != null && result instanceof Collection && ((Collection) result).isEmpty()) { return null; } else { return result; } }
[ "public", "static", "Object", "selectObject", "(", "Node", "node", ",", "String", "xpathQuery", ")", "{", "Object", "result", "=", "node", ".", "selectObject", "(", "xpathQuery", ")", ";", "if", "(", "result", "!=", "null", "&&", "result", "instanceof", "C...
Executes an XPath query to retrieve an object. Normally, if the XPath result doesn't have a result, an empty collection is returned. This object checks that case and returns null accordingly.
[ "Executes", "an", "XPath", "query", "to", "retrieve", "an", "object", ".", "Normally", "if", "the", "XPath", "result", "doesn", "t", "have", "a", "result", "an", "empty", "collection", "is", "returned", ".", "This", "object", "checks", "that", "case", "and...
d3ec74d669d3f8cfcf995177615d5f126edfa237
https://github.com/craftercms/core/blob/d3ec74d669d3f8cfcf995177615d5f126edfa237/src/main/java/org/craftercms/core/util/XmlUtils.java#L46-L53
train
craftercms/core
src/main/java/org/craftercms/core/util/XmlUtils.java
XmlUtils.selectSingleNodeValue
public static String selectSingleNodeValue(Node node, String xpathQuery) { Node resultNode = node.selectSingleNode(xpathQuery); if (resultNode != null) { return resultNode.getText(); } else { return null; } }
java
public static String selectSingleNodeValue(Node node, String xpathQuery) { Node resultNode = node.selectSingleNode(xpathQuery); if (resultNode != null) { return resultNode.getText(); } else { return null; } }
[ "public", "static", "String", "selectSingleNodeValue", "(", "Node", "node", ",", "String", "xpathQuery", ")", "{", "Node", "resultNode", "=", "node", ".", "selectSingleNode", "(", "xpathQuery", ")", ";", "if", "(", "resultNode", "!=", "null", ")", "{", "retu...
Executes the specified XPath query as a single node query, returning the text value of the resulting single node.
[ "Executes", "the", "specified", "XPath", "query", "as", "a", "single", "node", "query", "returning", "the", "text", "value", "of", "the", "resulting", "single", "node", "." ]
d3ec74d669d3f8cfcf995177615d5f126edfa237
https://github.com/craftercms/core/blob/d3ec74d669d3f8cfcf995177615d5f126edfa237/src/main/java/org/craftercms/core/util/XmlUtils.java#L58-L65
train
craftercms/core
src/main/java/org/craftercms/core/util/XmlUtils.java
XmlUtils.selectNodeValues
@SuppressWarnings("unchecked") public static List<String> selectNodeValues(Node node, String xpathQuery) { List<Node> resultNodes = node.selectNodes(xpathQuery); return extractNodeValues(resultNodes); }
java
@SuppressWarnings("unchecked") public static List<String> selectNodeValues(Node node, String xpathQuery) { List<Node> resultNodes = node.selectNodes(xpathQuery); return extractNodeValues(resultNodes); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "List", "<", "String", ">", "selectNodeValues", "(", "Node", "node", ",", "String", "xpathQuery", ")", "{", "List", "<", "Node", ">", "resultNodes", "=", "node", ".", "selectNodes", "(",...
Executes the specified XPath query as a multiple node query, returning the text values of the resulting list of nodes.
[ "Executes", "the", "specified", "XPath", "query", "as", "a", "multiple", "node", "query", "returning", "the", "text", "values", "of", "the", "resulting", "list", "of", "nodes", "." ]
d3ec74d669d3f8cfcf995177615d5f126edfa237
https://github.com/craftercms/core/blob/d3ec74d669d3f8cfcf995177615d5f126edfa237/src/main/java/org/craftercms/core/util/XmlUtils.java#L84-L89
train
craftercms/core
src/main/java/org/craftercms/core/util/XmlUtils.java
XmlUtils.selectNodeValues
public static List<String> selectNodeValues(Node node, String xpathQuery, Map<String, String> namespaceUris) { List<Node> resultNodes = selectNodes(node, xpathQuery, namespaceUris); return extractNodeValues(resultNodes); }
java
public static List<String> selectNodeValues(Node node, String xpathQuery, Map<String, String> namespaceUris) { List<Node> resultNodes = selectNodes(node, xpathQuery, namespaceUris); return extractNodeValues(resultNodes); }
[ "public", "static", "List", "<", "String", ">", "selectNodeValues", "(", "Node", "node", ",", "String", "xpathQuery", ",", "Map", "<", "String", ",", "String", ">", "namespaceUris", ")", "{", "List", "<", "Node", ">", "resultNodes", "=", "selectNodes", "("...
Executes the specified namespace aware XPath query as a multiple node query, returning the text values of the resulting list of nodes.
[ "Executes", "the", "specified", "namespace", "aware", "XPath", "query", "as", "a", "multiple", "node", "query", "returning", "the", "text", "values", "of", "the", "resulting", "list", "of", "nodes", "." ]
d3ec74d669d3f8cfcf995177615d5f126edfa237
https://github.com/craftercms/core/blob/d3ec74d669d3f8cfcf995177615d5f126edfa237/src/main/java/org/craftercms/core/util/XmlUtils.java#L96-L100
train
craftercms/core
src/main/java/org/craftercms/core/util/XmlUtils.java
XmlUtils.selectSingleNode
public static Node selectSingleNode(Node node, String xpathQuery, Map<String, String> namespaceUris) { XPath xpath = DocumentHelper.createXPath(xpathQuery); xpath.setNamespaceURIs(namespaceUris); return xpath.selectSingleNode(node); }
java
public static Node selectSingleNode(Node node, String xpathQuery, Map<String, String> namespaceUris) { XPath xpath = DocumentHelper.createXPath(xpathQuery); xpath.setNamespaceURIs(namespaceUris); return xpath.selectSingleNode(node); }
[ "public", "static", "Node", "selectSingleNode", "(", "Node", "node", ",", "String", "xpathQuery", ",", "Map", "<", "String", ",", "String", ">", "namespaceUris", ")", "{", "XPath", "xpath", "=", "DocumentHelper", ".", "createXPath", "(", "xpathQuery", ")", "...
Executes the specified namespace aware XPath query as a single node query, returning the resulting single node.
[ "Executes", "the", "specified", "namespace", "aware", "XPath", "query", "as", "a", "single", "node", "query", "returning", "the", "resulting", "single", "node", "." ]
d3ec74d669d3f8cfcf995177615d5f126edfa237
https://github.com/craftercms/core/blob/d3ec74d669d3f8cfcf995177615d5f126edfa237/src/main/java/org/craftercms/core/util/XmlUtils.java#L105-L110
train
craftercms/core
src/main/java/org/craftercms/core/util/XmlUtils.java
XmlUtils.selectNodes
@SuppressWarnings("unchecked") public static List<Node> selectNodes(Node node, String xpathQuery, Map<String, String> namespaceUris) { XPath xpath = DocumentHelper.createXPath(xpathQuery); xpath.setNamespaceURIs(namespaceUris); return xpath.selectNodes(node); }
java
@SuppressWarnings("unchecked") public static List<Node> selectNodes(Node node, String xpathQuery, Map<String, String> namespaceUris) { XPath xpath = DocumentHelper.createXPath(xpathQuery); xpath.setNamespaceURIs(namespaceUris); return xpath.selectNodes(node); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "List", "<", "Node", ">", "selectNodes", "(", "Node", "node", ",", "String", "xpathQuery", ",", "Map", "<", "String", ",", "String", ">", "namespaceUris", ")", "{", "XPath", "xpath", "...
Executes the specified namespace aware XPath query as a multiple node query, returning the resulting list of nodes.
[ "Executes", "the", "specified", "namespace", "aware", "XPath", "query", "as", "a", "multiple", "node", "query", "returning", "the", "resulting", "list", "of", "nodes", "." ]
d3ec74d669d3f8cfcf995177615d5f126edfa237
https://github.com/craftercms/core/blob/d3ec74d669d3f8cfcf995177615d5f126edfa237/src/main/java/org/craftercms/core/util/XmlUtils.java#L115-L121
train
craftercms/core
src/main/java/org/craftercms/core/util/XmlUtils.java
XmlUtils.documentToPrettyString
public static String documentToPrettyString(Document document) { StringWriter stringWriter = new StringWriter(); OutputFormat prettyPrintFormat = OutputFormat.createPrettyPrint(); XMLWriter xmlWriter = new XMLWriter(stringWriter, prettyPrintFormat); try { xmlWriter.write(document); } catch (IOException e) { // Ignore, shouldn't happen. } return stringWriter.toString(); }
java
public static String documentToPrettyString(Document document) { StringWriter stringWriter = new StringWriter(); OutputFormat prettyPrintFormat = OutputFormat.createPrettyPrint(); XMLWriter xmlWriter = new XMLWriter(stringWriter, prettyPrintFormat); try { xmlWriter.write(document); } catch (IOException e) { // Ignore, shouldn't happen. } return stringWriter.toString(); }
[ "public", "static", "String", "documentToPrettyString", "(", "Document", "document", ")", "{", "StringWriter", "stringWriter", "=", "new", "StringWriter", "(", ")", ";", "OutputFormat", "prettyPrintFormat", "=", "OutputFormat", ".", "createPrettyPrint", "(", ")", ";...
Returns the given document as a XML string in a "pretty" format. @param document @return the document as an XML string
[ "Returns", "the", "given", "document", "as", "a", "XML", "string", "in", "a", "pretty", "format", "." ]
d3ec74d669d3f8cfcf995177615d5f126edfa237
https://github.com/craftercms/core/blob/d3ec74d669d3f8cfcf995177615d5f126edfa237/src/main/java/org/craftercms/core/util/XmlUtils.java#L129-L141
train
craftercms/core
src/main/java/org/craftercms/core/service/Item.java
Item.queryDescriptorValue
public String queryDescriptorValue(String xpathQuery) { if (descriptorDom != null) { String value = (String)getProperty(xpathQuery); if (value == null) { value = XmlUtils.selectSingleNodeValue(descriptorDom, xpathQuery); } return value; } else { return null; } }
java
public String queryDescriptorValue(String xpathQuery) { if (descriptorDom != null) { String value = (String)getProperty(xpathQuery); if (value == null) { value = XmlUtils.selectSingleNodeValue(descriptorDom, xpathQuery); } return value; } else { return null; } }
[ "public", "String", "queryDescriptorValue", "(", "String", "xpathQuery", ")", "{", "if", "(", "descriptorDom", "!=", "null", ")", "{", "String", "value", "=", "(", "String", ")", "getProperty", "(", "xpathQuery", ")", ";", "if", "(", "value", "==", "null",...
Queries a single descriptor node text value. First looks in the properties, if not found it executes the XPath query.
[ "Queries", "a", "single", "descriptor", "node", "text", "value", ".", "First", "looks", "in", "the", "properties", "if", "not", "found", "it", "executes", "the", "XPath", "query", "." ]
d3ec74d669d3f8cfcf995177615d5f126edfa237
https://github.com/craftercms/core/blob/d3ec74d669d3f8cfcf995177615d5f126edfa237/src/main/java/org/craftercms/core/service/Item.java#L211-L222
train
craftercms/core
src/main/java/org/craftercms/core/service/Item.java
Item.queryDescriptorValues
@SuppressWarnings("unchecked") public List<String> queryDescriptorValues(String xpathQuery) { if (descriptorDom != null) { List<String> value = (List<String>)getProperty(xpathQuery); if (CollectionUtils.isEmpty(value)) { value = XmlUtils.selectNodeValues(descriptorDom, xpathQuery); } return value; } else { return Collections.emptyList(); } }
java
@SuppressWarnings("unchecked") public List<String> queryDescriptorValues(String xpathQuery) { if (descriptorDom != null) { List<String> value = (List<String>)getProperty(xpathQuery); if (CollectionUtils.isEmpty(value)) { value = XmlUtils.selectNodeValues(descriptorDom, xpathQuery); } return value; } else { return Collections.emptyList(); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "List", "<", "String", ">", "queryDescriptorValues", "(", "String", "xpathQuery", ")", "{", "if", "(", "descriptorDom", "!=", "null", ")", "{", "List", "<", "String", ">", "value", "=", "(", "Li...
Queries multiple descriptor node text values. First looks in the properties, if not found it executes the XPath query.
[ "Queries", "multiple", "descriptor", "node", "text", "values", ".", "First", "looks", "in", "the", "properties", "if", "not", "found", "it", "executes", "the", "XPath", "query", "." ]
d3ec74d669d3f8cfcf995177615d5f126edfa237
https://github.com/craftercms/core/blob/d3ec74d669d3f8cfcf995177615d5f126edfa237/src/main/java/org/craftercms/core/service/Item.java#L228-L240
train
craftercms/core
src/main/java/org/craftercms/core/processors/impl/ItemProcessorPipeline.java
ItemProcessorPipeline.addProcessor
public void addProcessor(ItemProcessor processor) { if (processors == null) { processors = new ArrayList<>(); } processors.add(processor); }
java
public void addProcessor(ItemProcessor processor) { if (processors == null) { processors = new ArrayList<>(); } processors.add(processor); }
[ "public", "void", "addProcessor", "(", "ItemProcessor", "processor", ")", "{", "if", "(", "processors", "==", "null", ")", "{", "processors", "=", "new", "ArrayList", "<>", "(", ")", ";", "}", "processors", ".", "add", "(", "processor", ")", ";", "}" ]
Adds a processor to the pipeline of processors.
[ "Adds", "a", "processor", "to", "the", "pipeline", "of", "processors", "." ]
d3ec74d669d3f8cfcf995177615d5f126edfa237
https://github.com/craftercms/core/blob/d3ec74d669d3f8cfcf995177615d5f126edfa237/src/main/java/org/craftercms/core/processors/impl/ItemProcessorPipeline.java#L76-L82
train
craftercms/core
src/main/java/org/craftercms/core/processors/impl/ItemProcessorPipeline.java
ItemProcessorPipeline.addProcessors
public void addProcessors(Collection<ItemProcessor> processors) { if (processors == null) { processors = new ArrayList<>(); } processors.addAll(processors); }
java
public void addProcessors(Collection<ItemProcessor> processors) { if (processors == null) { processors = new ArrayList<>(); } processors.addAll(processors); }
[ "public", "void", "addProcessors", "(", "Collection", "<", "ItemProcessor", ">", "processors", ")", "{", "if", "(", "processors", "==", "null", ")", "{", "processors", "=", "new", "ArrayList", "<>", "(", ")", ";", "}", "processors", ".", "addAll", "(", "...
Adds several processors to the pipeline of processors.
[ "Adds", "several", "processors", "to", "the", "pipeline", "of", "processors", "." ]
d3ec74d669d3f8cfcf995177615d5f126edfa237
https://github.com/craftercms/core/blob/d3ec74d669d3f8cfcf995177615d5f126edfa237/src/main/java/org/craftercms/core/processors/impl/ItemProcessorPipeline.java#L87-L93
train
craftercms/core
src/main/java/org/craftercms/core/store/impl/AbstractFileBasedContentStoreAdapter.java
AbstractFileBasedContentStoreAdapter.createXmlReader
protected SAXReader createXmlReader() { SAXReader xmlReader = new SAXReader(); xmlReader.setMergeAdjacentText(true); xmlReader.setStripWhitespaceText(true); xmlReader.setIgnoreComments(true); try { xmlReader.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); xmlReader.setFeature("http://xml.org/sax/features/external-general-entities", false); xmlReader.setFeature("http://xml.org/sax/features/external-parameter-entities", false); }catch (SAXException ex){ LOGGER.error("Unable to turn off external entity loading, This could be a security risk.", ex); } return xmlReader; }
java
protected SAXReader createXmlReader() { SAXReader xmlReader = new SAXReader(); xmlReader.setMergeAdjacentText(true); xmlReader.setStripWhitespaceText(true); xmlReader.setIgnoreComments(true); try { xmlReader.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); xmlReader.setFeature("http://xml.org/sax/features/external-general-entities", false); xmlReader.setFeature("http://xml.org/sax/features/external-parameter-entities", false); }catch (SAXException ex){ LOGGER.error("Unable to turn off external entity loading, This could be a security risk.", ex); } return xmlReader; }
[ "protected", "SAXReader", "createXmlReader", "(", ")", "{", "SAXReader", "xmlReader", "=", "new", "SAXReader", "(", ")", ";", "xmlReader", ".", "setMergeAdjacentText", "(", "true", ")", ";", "xmlReader", ".", "setStripWhitespaceText", "(", "true", ")", ";", "x...
Creates and configures an XML SAX reader.
[ "Creates", "and", "configures", "an", "XML", "SAX", "reader", "." ]
d3ec74d669d3f8cfcf995177615d5f126edfa237
https://github.com/craftercms/core/blob/d3ec74d669d3f8cfcf995177615d5f126edfa237/src/main/java/org/craftercms/core/store/impl/AbstractFileBasedContentStoreAdapter.java#L219-L234
train
craftercms/core
src/main/java/org/craftercms/core/controller/rest/RestControllerBase.java
RestControllerBase.createMessageModel
protected Map<String, Object> createMessageModel(String attributeName, Object attributeValue) { Map<String, Object> model = new HashMap<>(1); model.put(attributeName, attributeValue); return model; }
java
protected Map<String, Object> createMessageModel(String attributeName, Object attributeValue) { Map<String, Object> model = new HashMap<>(1); model.put(attributeName, attributeValue); return model; }
[ "protected", "Map", "<", "String", ",", "Object", ">", "createMessageModel", "(", "String", "attributeName", ",", "Object", "attributeValue", ")", "{", "Map", "<", "String", ",", "Object", ">", "model", "=", "new", "HashMap", "<>", "(", "1", ")", ";", "m...
Use instead of singleton model since it can modified
[ "Use", "instead", "of", "singleton", "model", "since", "it", "can", "modified" ]
d3ec74d669d3f8cfcf995177615d5f126edfa237
https://github.com/craftercms/core/blob/d3ec74d669d3f8cfcf995177615d5f126edfa237/src/main/java/org/craftercms/core/controller/rest/RestControllerBase.java#L105-L110
train
craftercms/core
src/main/java/org/craftercms/core/processors/impl/AbstractTaggingProcessor.java
AbstractTaggingProcessor.addNewField
protected void addNewField(Item item, String values) { if(logger.isDebugEnabled()) { logger.debug("Tagging item with field: " + newField + " and value: " + values); } Document document = item.getDescriptorDom(); if(document != null) { Element root = document.getRootElement(); if(root != null) { for(String value : values.split(",")) { Element newElement = root.addElement(newField); newElement.setText(value); } } } }
java
protected void addNewField(Item item, String values) { if(logger.isDebugEnabled()) { logger.debug("Tagging item with field: " + newField + " and value: " + values); } Document document = item.getDescriptorDom(); if(document != null) { Element root = document.getRootElement(); if(root != null) { for(String value : values.split(",")) { Element newElement = root.addElement(newField); newElement.setText(value); } } } }
[ "protected", "void", "addNewField", "(", "Item", "item", ",", "String", "values", ")", "{", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(", "\"Tagging item with field: \"", "+", "newField", "+", "\" and value: \"", ...
Tags the item adding the new field with the specified values. @param item @param values
[ "Tags", "the", "item", "adding", "the", "new", "field", "with", "the", "specified", "values", "." ]
d3ec74d669d3f8cfcf995177615d5f126edfa237
https://github.com/craftercms/core/blob/d3ec74d669d3f8cfcf995177615d5f126edfa237/src/main/java/org/craftercms/core/processors/impl/AbstractTaggingProcessor.java#L73-L87
train
craftercms/core
src/main/java/org/craftercms/core/util/UrlUtils.java
UrlUtils.getShortName
public static String getShortName(String longName, String containsShortNameRegex, int shortNameRegexGroup) { Pattern pattern = Pattern.compile(containsShortNameRegex); Matcher matcher = pattern.matcher(longName); if (matcher.matches()) { return matcher.group(shortNameRegexGroup); } else { return longName; } }
java
public static String getShortName(String longName, String containsShortNameRegex, int shortNameRegexGroup) { Pattern pattern = Pattern.compile(containsShortNameRegex); Matcher matcher = pattern.matcher(longName); if (matcher.matches()) { return matcher.group(shortNameRegexGroup); } else { return longName; } }
[ "public", "static", "String", "getShortName", "(", "String", "longName", ",", "String", "containsShortNameRegex", ",", "int", "shortNameRegexGroup", ")", "{", "Pattern", "pattern", "=", "Pattern", ".", "compile", "(", "containsShortNameRegex", ")", ";", "Matcher", ...
Returns the short name representation of a long name. @param longName @param containsShortNameRegex the regex that identifies whether the long name contains a short name. This regex should also contain a group expression that can be use to capture for the short name (see the Pattern class javadoc). @param shortNameRegexGroup the index of the captured group that represents the short name (see the Pattern class javadoc) @return the short name, or the long name if there was no short name match @see Pattern
[ "Returns", "the", "short", "name", "representation", "of", "a", "long", "name", "." ]
d3ec74d669d3f8cfcf995177615d5f126edfa237
https://github.com/craftercms/core/blob/d3ec74d669d3f8cfcf995177615d5f126edfa237/src/main/java/org/craftercms/core/util/UrlUtils.java#L48-L57
train
arquillian/arquillian-recorder
arquillian-recorder/arquillian-recorder-api/src/main/java/org/arquillian/extension/recorder/Configuration.java
Configuration.setConfiguration
public Configuration<T> setConfiguration(Map<String, String> configuration) { Validate.notNull(configuration, "Properties for configuration of recorder extension can not be a null object!"); this.configuration = configuration; return this; }
java
public Configuration<T> setConfiguration(Map<String, String> configuration) { Validate.notNull(configuration, "Properties for configuration of recorder extension can not be a null object!"); this.configuration = configuration; return this; }
[ "public", "Configuration", "<", "T", ">", "setConfiguration", "(", "Map", "<", "String", ",", "String", ">", "configuration", ")", "{", "Validate", ".", "notNull", "(", "configuration", ",", "\"Properties for configuration of recorder extension can not be a null object!\"...
Gets configuration from Arquillian descriptor and creates instance of it. @param configuration configuration of extension from arquillian.xml @return this @throws IllegalArgumentException if {@code configuration} is a null object
[ "Gets", "configuration", "from", "Arquillian", "descriptor", "and", "creates", "instance", "of", "it", "." ]
e3417111deb03a2e2d9b96d38b986db17e2c1d19
https://github.com/arquillian/arquillian-recorder/blob/e3417111deb03a2e2d9b96d38b986db17e2c1d19/arquillian-recorder/arquillian-recorder-api/src/main/java/org/arquillian/extension/recorder/Configuration.java#L41-L45
train
arquillian/arquillian-recorder
arquillian-recorder/arquillian-recorder-api/src/main/java/org/arquillian/extension/recorder/Configuration.java
Configuration.setProperty
public void setProperty(String name, String value) { Validate.notNullOrEmpty(name, "Name of property can not be a null object nor an empty string!"); Validate.notNull(value, "Value of property can not be a null object!"); configuration.put(name, value); }
java
public void setProperty(String name, String value) { Validate.notNullOrEmpty(name, "Name of property can not be a null object nor an empty string!"); Validate.notNull(value, "Value of property can not be a null object!"); configuration.put(name, value); }
[ "public", "void", "setProperty", "(", "String", "name", ",", "String", "value", ")", "{", "Validate", ".", "notNullOrEmpty", "(", "name", ",", "\"Name of property can not be a null object nor an empty string!\"", ")", ";", "Validate", ".", "notNull", "(", "value", "...
Sets some property. @param name acts as a key @param value value assigned to the {@code name} key @throws IllegalArgumentException if {@code name} is null or empty or {@code value} is null
[ "Sets", "some", "property", "." ]
e3417111deb03a2e2d9b96d38b986db17e2c1d19
https://github.com/arquillian/arquillian-recorder/blob/e3417111deb03a2e2d9b96d38b986db17e2c1d19/arquillian-recorder/arquillian-recorder-api/src/main/java/org/arquillian/extension/recorder/Configuration.java#L84-L89
train
arquillian/arquillian-recorder
arquillian-recorder-reporter/arquillian-recorder-reporter-impl/src/main/java/org/arquillian/recorder/reporter/exporter/impl/AsciiDocExporter.java
AsciiDocExporter.writeTime
protected void writeTime(Date start, Date stop, long duration) throws IOException { writer.append(".").append(this.resourceBundle.getString("asciidoc.reporter.time")).append(NEW_LINE); writer.append("****").append(NEW_LINE); writer.append("*").append(this.resourceBundle.getString("asciidoc.reporter.start")).append("*").append(" ") .append(SIMPLE_DATE_FORMAT.format(start)).append(NEW_LINE).append(NEW_LINE); writer.append("*").append(this.resourceBundle.getString("asciidoc.reporter.stop")).append("*").append(" ") .append(SIMPLE_DATE_FORMAT.format(stop)).append(NEW_LINE).append(NEW_LINE); writer.append("*").append(this.resourceBundle.getString("asciidoc.reporter.duration")).append("*").append(" ") .append(convertDuration(duration, TimeUnit.MILLISECONDS, TimeUnit.SECONDS)).append("s") .append(NEW_LINE); writer.append("****").append(NEW_LINE).append(NEW_LINE); }
java
protected void writeTime(Date start, Date stop, long duration) throws IOException { writer.append(".").append(this.resourceBundle.getString("asciidoc.reporter.time")).append(NEW_LINE); writer.append("****").append(NEW_LINE); writer.append("*").append(this.resourceBundle.getString("asciidoc.reporter.start")).append("*").append(" ") .append(SIMPLE_DATE_FORMAT.format(start)).append(NEW_LINE).append(NEW_LINE); writer.append("*").append(this.resourceBundle.getString("asciidoc.reporter.stop")).append("*").append(" ") .append(SIMPLE_DATE_FORMAT.format(stop)).append(NEW_LINE).append(NEW_LINE); writer.append("*").append(this.resourceBundle.getString("asciidoc.reporter.duration")).append("*").append(" ") .append(convertDuration(duration, TimeUnit.MILLISECONDS, TimeUnit.SECONDS)).append("s") .append(NEW_LINE); writer.append("****").append(NEW_LINE).append(NEW_LINE); }
[ "protected", "void", "writeTime", "(", "Date", "start", ",", "Date", "stop", ",", "long", "duration", ")", "throws", "IOException", "{", "writer", ".", "append", "(", "\".\"", ")", ".", "append", "(", "this", ".", "resourceBundle", ".", "getString", "(", ...
Method that is called to write test suite time to AsciiDoc document. @param start time. @param stop end time. @param duration in millis.
[ "Method", "that", "is", "called", "to", "write", "test", "suite", "time", "to", "AsciiDoc", "document", "." ]
e3417111deb03a2e2d9b96d38b986db17e2c1d19
https://github.com/arquillian/arquillian-recorder/blob/e3417111deb03a2e2d9b96d38b986db17e2c1d19/arquillian-recorder-reporter/arquillian-recorder-reporter-impl/src/main/java/org/arquillian/recorder/reporter/exporter/impl/AsciiDocExporter.java#L180-L193
train
arquillian/arquillian-recorder
arquillian-recorder-reporter/arquillian-recorder-reporter-impl/src/main/java/org/arquillian/recorder/reporter/exporter/impl/AsciiDocExporter.java
AsciiDocExporter.writeDocumentHeader
protected void writeDocumentHeader() throws IOException { writer.append("= ").append(this.configuration.getTitle()).append(NEW_LINE); if(isAttributesFileSet()) { writer.append("include::").append(this.configuration.getAsciiDocAttributesFile()).append("[]").append(NEW_LINE); } if (isAsciidoctorOutput()) { writer.append(":icons: font").append(NEW_LINE); } writer.append(NEW_LINE); }
java
protected void writeDocumentHeader() throws IOException { writer.append("= ").append(this.configuration.getTitle()).append(NEW_LINE); if(isAttributesFileSet()) { writer.append("include::").append(this.configuration.getAsciiDocAttributesFile()).append("[]").append(NEW_LINE); } if (isAsciidoctorOutput()) { writer.append(":icons: font").append(NEW_LINE); } writer.append(NEW_LINE); }
[ "protected", "void", "writeDocumentHeader", "(", ")", "throws", "IOException", "{", "writer", ".", "append", "(", "\"= \"", ")", ".", "append", "(", "this", ".", "configuration", ".", "getTitle", "(", ")", ")", ".", "append", "(", "NEW_LINE", ")", ";", "...
First method called when report is being created. This method is used to set the document title and AsciiDoc document attributes.
[ "First", "method", "called", "when", "report", "is", "being", "created", ".", "This", "method", "is", "used", "to", "set", "the", "document", "title", "and", "AsciiDoc", "document", "attributes", "." ]
e3417111deb03a2e2d9b96d38b986db17e2c1d19
https://github.com/arquillian/arquillian-recorder/blob/e3417111deb03a2e2d9b96d38b986db17e2c1d19/arquillian-recorder-reporter/arquillian-recorder-reporter-impl/src/main/java/org/arquillian/recorder/reporter/exporter/impl/AsciiDocExporter.java#L204-L215
train
arquillian/arquillian-recorder
arquillian-recorder-reporter/arquillian-recorder-reporter-impl/src/main/java/org/arquillian/recorder/reporter/exporter/impl/AsciiDocExporter.java
AsciiDocExporter.writeContainerProperties
protected void writeContainerProperties(Map<String, String> properties) throws IOException { if (properties.size() > 0) { writer.append("[cols=\"2*\", options=\"header\"]").append(NEW_LINE); writer.append(".").append(this.resourceBundle.getString("asciidoc.reporter.properties")).append(NEW_LINE); writer.append("|===").append(NEW_LINE).append(NEW_LINE); writer.append("|KEY").append(NEW_LINE); writer.append("|VALUE").append(NEW_LINE).append(NEW_LINE); Set<Entry<String, String>> entrySet = properties.entrySet(); for (Entry<String, String> entry : entrySet) { writer.append("|").append(entry.getKey()).append(NEW_LINE); writer.append("|").append(entry.getValue()).append(NEW_LINE).append(NEW_LINE); } writer.append("|===").append(NEW_LINE).append(NEW_LINE); } }
java
protected void writeContainerProperties(Map<String, String> properties) throws IOException { if (properties.size() > 0) { writer.append("[cols=\"2*\", options=\"header\"]").append(NEW_LINE); writer.append(".").append(this.resourceBundle.getString("asciidoc.reporter.properties")).append(NEW_LINE); writer.append("|===").append(NEW_LINE).append(NEW_LINE); writer.append("|KEY").append(NEW_LINE); writer.append("|VALUE").append(NEW_LINE).append(NEW_LINE); Set<Entry<String, String>> entrySet = properties.entrySet(); for (Entry<String, String> entry : entrySet) { writer.append("|").append(entry.getKey()).append(NEW_LINE); writer.append("|").append(entry.getValue()).append(NEW_LINE).append(NEW_LINE); } writer.append("|===").append(NEW_LINE).append(NEW_LINE); } }
[ "protected", "void", "writeContainerProperties", "(", "Map", "<", "String", ",", "String", ">", "properties", ")", "throws", "IOException", "{", "if", "(", "properties", ".", "size", "(", ")", ">", "0", ")", "{", "writer", ".", "append", "(", "\"[cols=\\\"...
Method that is called to write container properties to AsciiDoc document. @param properties container properties as a map
[ "Method", "that", "is", "called", "to", "write", "container", "properties", "to", "AsciiDoc", "document", "." ]
e3417111deb03a2e2d9b96d38b986db17e2c1d19
https://github.com/arquillian/arquillian-recorder/blob/e3417111deb03a2e2d9b96d38b986db17e2c1d19/arquillian-recorder-reporter/arquillian-recorder-reporter-impl/src/main/java/org/arquillian/recorder/reporter/exporter/impl/AsciiDocExporter.java#L225-L245
train
arquillian/arquillian-recorder
arquillian-recorder-reporter/arquillian-recorder-reporter-impl/src/main/java/org/arquillian/recorder/reporter/exporter/impl/AsciiDocExporter.java
AsciiDocExporter.writeProperties
protected void writeProperties(List<PropertyEntry> propertyEntries) throws IOException { if (containsAnyKeyValueEntryOrFileEntry(propertyEntries)) { writer.append("[cols=\"2*\", options=\"header\"]").append(NEW_LINE); writer.append(".").append(this.resourceBundle.getString("asciidoc.reporter.properties")).append(NEW_LINE); writer.append("|===").append(NEW_LINE).append(NEW_LINE); writer.append("|KEY").append(NEW_LINE); writer.append("|VALUE").append(NEW_LINE).append(NEW_LINE); writePropertiesRows(propertyEntries); writer.append("|===").append(NEW_LINE).append(NEW_LINE); } writeTables(propertyEntries); }
java
protected void writeProperties(List<PropertyEntry> propertyEntries) throws IOException { if (containsAnyKeyValueEntryOrFileEntry(propertyEntries)) { writer.append("[cols=\"2*\", options=\"header\"]").append(NEW_LINE); writer.append(".").append(this.resourceBundle.getString("asciidoc.reporter.properties")).append(NEW_LINE); writer.append("|===").append(NEW_LINE).append(NEW_LINE); writer.append("|KEY").append(NEW_LINE); writer.append("|VALUE").append(NEW_LINE).append(NEW_LINE); writePropertiesRows(propertyEntries); writer.append("|===").append(NEW_LINE).append(NEW_LINE); } writeTables(propertyEntries); }
[ "protected", "void", "writeProperties", "(", "List", "<", "PropertyEntry", ">", "propertyEntries", ")", "throws", "IOException", "{", "if", "(", "containsAnyKeyValueEntryOrFileEntry", "(", "propertyEntries", ")", ")", "{", "writer", ".", "append", "(", "\"[cols=\\\"...
Method that is called to write properties to AsciiDoc document. @param propertyEntries list of properties to write to the report
[ "Method", "that", "is", "called", "to", "write", "properties", "to", "AsciiDoc", "document", "." ]
e3417111deb03a2e2d9b96d38b986db17e2c1d19
https://github.com/arquillian/arquillian-recorder/blob/e3417111deb03a2e2d9b96d38b986db17e2c1d19/arquillian-recorder-reporter/arquillian-recorder-reporter-impl/src/main/java/org/arquillian/recorder/reporter/exporter/impl/AsciiDocExporter.java#L262-L278
train
arquillian/arquillian-recorder
arquillian-recorder-reporter/arquillian-recorder-reporter-impl/src/main/java/org/arquillian/recorder/reporter/exporter/impl/AsciiDocExporter.java
AsciiDocExporter.writeExtensions
protected void writeExtensions(List<ExtensionReport> extensionReports) throws IOException { writer.append("== ").append(this.resourceBundle.getString("asciidoc.reporter.extensions")).append(NEW_LINE) .append(NEW_LINE); for (ExtensionReport extensionReport : extensionReports) { writer.append("[cols=\"2*\"]").append(NEW_LINE); writer.append(".").append(extensionReport.getQualifier()).append(NEW_LINE); writer.append("|===").append(NEW_LINE).append(NEW_LINE); writer.append("2+|").append(extensionReport.getQualifier()).append(NEW_LINE).append(NEW_LINE); writer.append("h|KEY").append(NEW_LINE); writer.append("h|VALUE").append(NEW_LINE).append(NEW_LINE); writeConfigurationRows(extensionReport.getConfiguration()); writer.append("|===").append(NEW_LINE).append(NEW_LINE); } }
java
protected void writeExtensions(List<ExtensionReport> extensionReports) throws IOException { writer.append("== ").append(this.resourceBundle.getString("asciidoc.reporter.extensions")).append(NEW_LINE) .append(NEW_LINE); for (ExtensionReport extensionReport : extensionReports) { writer.append("[cols=\"2*\"]").append(NEW_LINE); writer.append(".").append(extensionReport.getQualifier()).append(NEW_LINE); writer.append("|===").append(NEW_LINE).append(NEW_LINE); writer.append("2+|").append(extensionReport.getQualifier()).append(NEW_LINE).append(NEW_LINE); writer.append("h|KEY").append(NEW_LINE); writer.append("h|VALUE").append(NEW_LINE).append(NEW_LINE); writeConfigurationRows(extensionReport.getConfiguration()); writer.append("|===").append(NEW_LINE).append(NEW_LINE); } }
[ "protected", "void", "writeExtensions", "(", "List", "<", "ExtensionReport", ">", "extensionReports", ")", "throws", "IOException", "{", "writer", ".", "append", "(", "\"== \"", ")", ".", "append", "(", "this", ".", "resourceBundle", ".", "getString", "(", "\"...
Method that is called to write extensions to AsciiDoc document. @param extensionReports list. @throws IOException
[ "Method", "that", "is", "called", "to", "write", "extensions", "to", "AsciiDoc", "document", "." ]
e3417111deb03a2e2d9b96d38b986db17e2c1d19
https://github.com/arquillian/arquillian-recorder/blob/e3417111deb03a2e2d9b96d38b986db17e2c1d19/arquillian-recorder-reporter/arquillian-recorder-reporter-impl/src/main/java/org/arquillian/recorder/reporter/exporter/impl/AsciiDocExporter.java#L352-L374
train
arquillian/arquillian-recorder
arquillian-recorder-reporter/arquillian-recorder-reporter-impl/src/main/java/org/arquillian/recorder/reporter/exporter/impl/AsciiDocExporter.java
AsciiDocExporter.writeVideo
protected void writeVideo(VideoEntry videoEntry) throws IOException { writer.append("video::").append(videoEntry.getLink()).append("[]").append(NEW_LINE).append(NEW_LINE); }
java
protected void writeVideo(VideoEntry videoEntry) throws IOException { writer.append("video::").append(videoEntry.getLink()).append("[]").append(NEW_LINE).append(NEW_LINE); }
[ "protected", "void", "writeVideo", "(", "VideoEntry", "videoEntry", ")", "throws", "IOException", "{", "writer", ".", "append", "(", "\"video::\"", ")", ".", "append", "(", "videoEntry", ".", "getLink", "(", ")", ")", ".", "append", "(", "\"[]\"", ")", "."...
Method that is called to write video. @param videoEntry video entry to write
[ "Method", "that", "is", "called", "to", "write", "video", "." ]
e3417111deb03a2e2d9b96d38b986db17e2c1d19
https://github.com/arquillian/arquillian-recorder/blob/e3417111deb03a2e2d9b96d38b986db17e2c1d19/arquillian-recorder-reporter/arquillian-recorder-reporter-impl/src/main/java/org/arquillian/recorder/reporter/exporter/impl/AsciiDocExporter.java#L404-L408
train
arquillian/arquillian-recorder
arquillian-recorder-reporter/arquillian-recorder-reporter-impl/src/main/java/org/arquillian/recorder/reporter/exporter/impl/AsciiDocExporter.java
AsciiDocExporter.writeScreenshot
protected void writeScreenshot(ScreenshotEntry screenshotEntry) throws IOException { int heigth = screenshotEntry.getHeight() * Integer.parseInt(this.configuration.getImageHeight()) / 100; int width = screenshotEntry.getWidth() * Integer.parseInt(this.configuration.getImageWidth()) / 100; boolean large = width > Integer.parseInt(this.configuration.getMaxImageWidth()); if (large) { writer.append(".").append(screenshotEntry.getPhase().name()).append(NEW_LINE); writer.append(screenshotEntry.getLink()).append(" -> file://").append(screenshotEntry.getPath()).append("[") .append(this.resourceBundle.getString("asciidoc.reporter.screenshot")) .append("]").append(NEW_LINE).append(NEW_LINE); } else { writer.append(".").append(screenshotEntry.getPhase().name()).append(NEW_LINE); writer.append("image::").append(screenshotEntry.getLink()) .append("[screenshot," + width + "," + heigth + "]") .append(NEW_LINE).append(NEW_LINE); } }
java
protected void writeScreenshot(ScreenshotEntry screenshotEntry) throws IOException { int heigth = screenshotEntry.getHeight() * Integer.parseInt(this.configuration.getImageHeight()) / 100; int width = screenshotEntry.getWidth() * Integer.parseInt(this.configuration.getImageWidth()) / 100; boolean large = width > Integer.parseInt(this.configuration.getMaxImageWidth()); if (large) { writer.append(".").append(screenshotEntry.getPhase().name()).append(NEW_LINE); writer.append(screenshotEntry.getLink()).append(" -> file://").append(screenshotEntry.getPath()).append("[") .append(this.resourceBundle.getString("asciidoc.reporter.screenshot")) .append("]").append(NEW_LINE).append(NEW_LINE); } else { writer.append(".").append(screenshotEntry.getPhase().name()).append(NEW_LINE); writer.append("image::").append(screenshotEntry.getLink()) .append("[screenshot," + width + "," + heigth + "]") .append(NEW_LINE).append(NEW_LINE); } }
[ "protected", "void", "writeScreenshot", "(", "ScreenshotEntry", "screenshotEntry", ")", "throws", "IOException", "{", "int", "heigth", "=", "screenshotEntry", ".", "getHeight", "(", ")", "*", "Integer", ".", "parseInt", "(", "this", ".", "configuration", ".", "g...
Method that is called to write screenshot. This method is responsible to check the size of image. @param screenshotEntry screenshot entry to write @throws IOException
[ "Method", "that", "is", "called", "to", "write", "screenshot", ".", "This", "method", "is", "responsible", "to", "check", "the", "size", "of", "image", "." ]
e3417111deb03a2e2d9b96d38b986db17e2c1d19
https://github.com/arquillian/arquillian-recorder/blob/e3417111deb03a2e2d9b96d38b986db17e2c1d19/arquillian-recorder-reporter/arquillian-recorder-reporter-impl/src/main/java/org/arquillian/recorder/reporter/exporter/impl/AsciiDocExporter.java#L416-L438
train
arquillian/arquillian-recorder
arquillian-recorder-reporter/arquillian-recorder-reporter-impl/src/main/java/org/arquillian/recorder/reporter/exporter/impl/AsciiDocExporter.java
AsciiDocExporter.writeDeployments
protected void writeDeployments(List<DeploymentReport> deploymentReports) throws IOException { for (DeploymentReport deploymentReport : deploymentReports) { writer.append("[cols=\"3*\", options=\"header\"]").append(NEW_LINE); writer.append(".").append(this.resourceBundle.getString("asciidoc.reporter.deployment")).append(NEW_LINE); writer.append("|===").append(NEW_LINE).append(NEW_LINE); writer.append("|NAME").append(NEW_LINE); writer.append("|ARCHIVE").append(NEW_LINE); writer.append("|ORDER").append(NEW_LINE).append(NEW_LINE); writer.append("|").append(deploymentReport.getName()).append(NEW_LINE); writer.append("|").append(deploymentReport.getArchiveName()).append(NEW_LINE); writer.append("|").append(Integer.toString(deploymentReport.getOrder())).append(NEW_LINE).append(NEW_LINE); writer.append("|===").append(NEW_LINE).append(NEW_LINE); if (!"_DEFAULT_".equals(deploymentReport.getProtocol())) { writer.append("NOTE: ").append(deploymentReport.getProtocol()).append(NEW_LINE).append(NEW_LINE); } } }
java
protected void writeDeployments(List<DeploymentReport> deploymentReports) throws IOException { for (DeploymentReport deploymentReport : deploymentReports) { writer.append("[cols=\"3*\", options=\"header\"]").append(NEW_LINE); writer.append(".").append(this.resourceBundle.getString("asciidoc.reporter.deployment")).append(NEW_LINE); writer.append("|===").append(NEW_LINE).append(NEW_LINE); writer.append("|NAME").append(NEW_LINE); writer.append("|ARCHIVE").append(NEW_LINE); writer.append("|ORDER").append(NEW_LINE).append(NEW_LINE); writer.append("|").append(deploymentReport.getName()).append(NEW_LINE); writer.append("|").append(deploymentReport.getArchiveName()).append(NEW_LINE); writer.append("|").append(Integer.toString(deploymentReport.getOrder())).append(NEW_LINE).append(NEW_LINE); writer.append("|===").append(NEW_LINE).append(NEW_LINE); if (!"_DEFAULT_".equals(deploymentReport.getProtocol())) { writer.append("NOTE: ").append(deploymentReport.getProtocol()).append(NEW_LINE).append(NEW_LINE); } } }
[ "protected", "void", "writeDeployments", "(", "List", "<", "DeploymentReport", ">", "deploymentReports", ")", "throws", "IOException", "{", "for", "(", "DeploymentReport", "deploymentReport", ":", "deploymentReports", ")", "{", "writer", ".", "append", "(", "\"[cols...
Method that is called to write deployment information to AsciiDoc document. @param deploymentReports list. @throws IOException
[ "Method", "that", "is", "called", "to", "write", "deployment", "information", "to", "AsciiDoc", "document", "." ]
e3417111deb03a2e2d9b96d38b986db17e2c1d19
https://github.com/arquillian/arquillian-recorder/blob/e3417111deb03a2e2d9b96d38b986db17e2c1d19/arquillian-recorder-reporter/arquillian-recorder-reporter-impl/src/main/java/org/arquillian/recorder/reporter/exporter/impl/AsciiDocExporter.java#L472-L496
train
arquillian/arquillian-recorder
arquillian-recorder-reporter/arquillian-recorder-reporter-api/src/main/java/org/arquillian/recorder/reporter/model/ReportConfiguration.java
ReportConfiguration.setMaxImageWidth
public void setMaxImageWidth(String maxImageWidth) { try { if (Integer.parseInt(maxImageWidth) > 0) { this.maxImageWidth = maxImageWidth; } } catch (NumberFormatException ex) { LOGGER.info(String.format("You are trying to parse '%s' as a number for maxImageWidth.", maxImageWidth)); } }
java
public void setMaxImageWidth(String maxImageWidth) { try { if (Integer.parseInt(maxImageWidth) > 0) { this.maxImageWidth = maxImageWidth; } } catch (NumberFormatException ex) { LOGGER.info(String.format("You are trying to parse '%s' as a number for maxImageWidth.", maxImageWidth)); } }
[ "public", "void", "setMaxImageWidth", "(", "String", "maxImageWidth", ")", "{", "try", "{", "if", "(", "Integer", ".", "parseInt", "(", "maxImageWidth", ")", ">", "0", ")", "{", "this", ".", "maxImageWidth", "=", "maxImageWidth", ";", "}", "}", "catch", ...
String has to be given as an integer number bigger than 0. @param maxImageWidth maximum image width for image to be displayed fully, otherwise it is displayed as a link
[ "String", "has", "to", "be", "given", "as", "an", "integer", "number", "bigger", "than", "0", "." ]
e3417111deb03a2e2d9b96d38b986db17e2c1d19
https://github.com/arquillian/arquillian-recorder/blob/e3417111deb03a2e2d9b96d38b986db17e2c1d19/arquillian-recorder-reporter/arquillian-recorder-reporter-api/src/main/java/org/arquillian/recorder/reporter/model/ReportConfiguration.java#L61-L69
train
arquillian/arquillian-recorder
arquillian-recorder-reporter/arquillian-recorder-reporter-impl/src/main/java/org/arquillian/recorder/reporter/exporter/impl/HTMLExporter.java
HTMLExporter.validatePath
private void validatePath(PropertyEntry entry) { if (entry instanceof VideoEntry) { VideoEntry e = (VideoEntry) entry; if (e.getPath().contains(configuration.getRootDir().getAbsolutePath())) { e.setLink(e.getPath().substring(configuration.getRootDir().getAbsolutePath().length() + 1)); } } else if (entry instanceof ScreenshotEntry) { ScreenshotEntry e = (ScreenshotEntry) entry; if (e.getPath().contains(configuration.getRootDir().getAbsolutePath())) { e.setLink(e.getPath().substring(configuration.getRootDir().getAbsolutePath().length() + 1)); } } }
java
private void validatePath(PropertyEntry entry) { if (entry instanceof VideoEntry) { VideoEntry e = (VideoEntry) entry; if (e.getPath().contains(configuration.getRootDir().getAbsolutePath())) { e.setLink(e.getPath().substring(configuration.getRootDir().getAbsolutePath().length() + 1)); } } else if (entry instanceof ScreenshotEntry) { ScreenshotEntry e = (ScreenshotEntry) entry; if (e.getPath().contains(configuration.getRootDir().getAbsolutePath())) { e.setLink(e.getPath().substring(configuration.getRootDir().getAbsolutePath().length() + 1)); } } }
[ "private", "void", "validatePath", "(", "PropertyEntry", "entry", ")", "{", "if", "(", "entry", "instanceof", "VideoEntry", ")", "{", "VideoEntry", "e", "=", "(", "VideoEntry", ")", "entry", ";", "if", "(", "e", ".", "getPath", "(", ")", ".", "contains",...
Validates if the file path is in absolute form and if so relativize it. @param entry
[ "Validates", "if", "the", "file", "path", "is", "in", "absolute", "form", "and", "if", "so", "relativize", "it", "." ]
e3417111deb03a2e2d9b96d38b986db17e2c1d19
https://github.com/arquillian/arquillian-recorder/blob/e3417111deb03a2e2d9b96d38b986db17e2c1d19/arquillian-recorder-reporter/arquillian-recorder-reporter-impl/src/main/java/org/arquillian/recorder/reporter/exporter/impl/HTMLExporter.java#L171-L183
train
mlk/AssortmentOfJUnitRules
src/main/java/com/github/mlk/junit/rules/HadoopDFSRule.java
HadoopDFSRule.write
public void write(String filename, String content) throws IOException { FSDataOutputStream s = getMfs().create(new Path(filename)); s.writeBytes(content); s.close(); }
java
public void write(String filename, String content) throws IOException { FSDataOutputStream s = getMfs().create(new Path(filename)); s.writeBytes(content); s.close(); }
[ "public", "void", "write", "(", "String", "filename", ",", "String", "content", ")", "throws", "IOException", "{", "FSDataOutputStream", "s", "=", "getMfs", "(", ")", ".", "create", "(", "new", "Path", "(", "filename", ")", ")", ";", "s", ".", "writeByte...
Writes the following content to the Hadoop cluster. @param filename File to be created @param content The content to write @throws IOException Anything.
[ "Writes", "the", "following", "content", "to", "the", "Hadoop", "cluster", "." ]
e3ab4f77419c6a009949f0b1c6e58f516dc29d64
https://github.com/mlk/AssortmentOfJUnitRules/blob/e3ab4f77419c6a009949f0b1c6e58f516dc29d64/src/main/java/com/github/mlk/junit/rules/HadoopDFSRule.java#L68-L72
train
mlk/AssortmentOfJUnitRules
src/main/java/com/github/mlk/junit/rules/HadoopDFSRule.java
HadoopDFSRule.copyResource
public void copyResource(String filename, String resource) throws IOException { write(filename, IOUtils.toByteArray(getClass().getResource(resource))); }
java
public void copyResource(String filename, String resource) throws IOException { write(filename, IOUtils.toByteArray(getClass().getResource(resource))); }
[ "public", "void", "copyResource", "(", "String", "filename", ",", "String", "resource", ")", "throws", "IOException", "{", "write", "(", "filename", ",", "IOUtils", ".", "toByteArray", "(", "getClass", "(", ")", ".", "getResource", "(", "resource", ")", ")",...
Copies the content of the given resource into Hadoop. @param filename File to be created @param resource Resource to copy @throws IOException Anything
[ "Copies", "the", "content", "of", "the", "given", "resource", "into", "Hadoop", "." ]
e3ab4f77419c6a009949f0b1c6e58f516dc29d64
https://github.com/mlk/AssortmentOfJUnitRules/blob/e3ab4f77419c6a009949f0b1c6e58f516dc29d64/src/main/java/com/github/mlk/junit/rules/HadoopDFSRule.java#L81-L83
train
mlk/AssortmentOfJUnitRules
src/main/java/com/github/mlk/junit/rules/HadoopDFSRule.java
HadoopDFSRule.read
public String read(String filename) throws IOException { Path p = new Path(filename); int size = (int) getMfs().getFileStatus(p).getLen(); FSDataInputStream is = getMfs().open(p); byte[] content = new byte[size]; is.readFully(content); return new String(content); }
java
public String read(String filename) throws IOException { Path p = new Path(filename); int size = (int) getMfs().getFileStatus(p).getLen(); FSDataInputStream is = getMfs().open(p); byte[] content = new byte[size]; is.readFully(content); return new String(content); }
[ "public", "String", "read", "(", "String", "filename", ")", "throws", "IOException", "{", "Path", "p", "=", "new", "Path", "(", "filename", ")", ";", "int", "size", "=", "(", "int", ")", "getMfs", "(", ")", ".", "getFileStatus", "(", "p", ")", ".", ...
Fully reads the content of the given file. @param filename File to read @return Content of the file @throws IOException Anything
[ "Fully", "reads", "the", "content", "of", "the", "given", "file", "." ]
e3ab4f77419c6a009949f0b1c6e58f516dc29d64
https://github.com/mlk/AssortmentOfJUnitRules/blob/e3ab4f77419c6a009949f0b1c6e58f516dc29d64/src/main/java/com/github/mlk/junit/rules/HadoopDFSRule.java#L105-L112
train
mlk/AssortmentOfJUnitRules
src/main/java/com/github/mlk/junit/rules/HadoopDFSRule.java
HadoopDFSRule.exists
public boolean exists(Path filename) throws IOException { try { return getMfs().listFiles(filename, true).hasNext(); } catch (FileNotFoundException e) { return false; } }
java
public boolean exists(Path filename) throws IOException { try { return getMfs().listFiles(filename, true).hasNext(); } catch (FileNotFoundException e) { return false; } }
[ "public", "boolean", "exists", "(", "Path", "filename", ")", "throws", "IOException", "{", "try", "{", "return", "getMfs", "(", ")", ".", "listFiles", "(", "filename", ",", "true", ")", ".", "hasNext", "(", ")", ";", "}", "catch", "(", "FileNotFoundExcep...
Checks if the given path exists on Hadoop. @param filename Filename to check @throws IOException Anything @return true if the file exists
[ "Checks", "if", "the", "given", "path", "exists", "on", "Hadoop", "." ]
e3ab4f77419c6a009949f0b1c6e58f516dc29d64
https://github.com/mlk/AssortmentOfJUnitRules/blob/e3ab4f77419c6a009949f0b1c6e58f516dc29d64/src/main/java/com/github/mlk/junit/rules/HadoopDFSRule.java#L145-L151
train
Ellzord/JALSE
src/main/java/jalse/actions/Actions.java
Actions.requireNotShutdown
public static <T extends ExecutorService> T requireNotShutdown(final T executorService) { if (executorService.isShutdown()) { throw new IllegalArgumentException("ExecutorService is shutdown"); } return executorService; }
java
public static <T extends ExecutorService> T requireNotShutdown(final T executorService) { if (executorService.isShutdown()) { throw new IllegalArgumentException("ExecutorService is shutdown"); } return executorService; }
[ "public", "static", "<", "T", "extends", "ExecutorService", ">", "T", "requireNotShutdown", "(", "final", "T", "executorService", ")", "{", "if", "(", "executorService", ".", "isShutdown", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\...
Validates the supplied service is not shutdown. @param executorService Service to check. @return The service.
[ "Validates", "the", "supplied", "service", "is", "not", "shutdown", "." ]
43fc6572de9b16eb8474aa21a88b6b2d11291615
https://github.com/Ellzord/JALSE/blob/43fc6572de9b16eb8474aa21a88b6b2d11291615/src/main/java/jalse/actions/Actions.java#L81-L86
train
Ellzord/JALSE
src/main/java/jalse/tags/Tags.java
Tags.getRootContainer
public static RootContainer getRootContainer(final EntityContainer container) { // Root must be identifable if (!(container instanceof Identifiable)) { return null; } EntityContainer parent = container instanceof Entity ? ((Entity) container).getContainer() : null; UUID rootID = null; // Check not root if (parent == null) { rootID = ((Identifiable) container).getID(); } // Get parents root else if (container instanceof Taggable) { final RootContainer parentRoot = ((Taggable) container).getSingletonTag(RootContainer.class); if (parentRoot != null) { rootID = parentRoot.getValue(); } } // Find root if (rootID == null) { // Get top level entity while (parent instanceof Entity) { final Entity e = (Entity) parent; rootID = e.getID(); parent = e.getContainer(); } // Container root (null, container or JALSE) if (!(parent instanceof Identifiable)) { return null; } } return new RootContainer(rootID); }
java
public static RootContainer getRootContainer(final EntityContainer container) { // Root must be identifable if (!(container instanceof Identifiable)) { return null; } EntityContainer parent = container instanceof Entity ? ((Entity) container).getContainer() : null; UUID rootID = null; // Check not root if (parent == null) { rootID = ((Identifiable) container).getID(); } // Get parents root else if (container instanceof Taggable) { final RootContainer parentRoot = ((Taggable) container).getSingletonTag(RootContainer.class); if (parentRoot != null) { rootID = parentRoot.getValue(); } } // Find root if (rootID == null) { // Get top level entity while (parent instanceof Entity) { final Entity e = (Entity) parent; rootID = e.getID(); parent = e.getContainer(); } // Container root (null, container or JALSE) if (!(parent instanceof Identifiable)) { return null; } } return new RootContainer(rootID); }
[ "public", "static", "RootContainer", "getRootContainer", "(", "final", "EntityContainer", "container", ")", "{", "// Root must be identifable", "if", "(", "!", "(", "container", "instanceof", "Identifiable", ")", ")", "{", "return", "null", ";", "}", "EntityContaine...
Gets or calculates the root container. @param container Container to check for. @return Root container for the supplied container.
[ "Gets", "or", "calculates", "the", "root", "container", "." ]
43fc6572de9b16eb8474aa21a88b6b2d11291615
https://github.com/Ellzord/JALSE/blob/43fc6572de9b16eb8474aa21a88b6b2d11291615/src/main/java/jalse/tags/Tags.java#L25-L61
train
Ellzord/JALSE
src/main/java/jalse/actions/AbstractManualActionContext.java
AbstractManualActionContext.reset
protected void reset() { done.set(false); performing.set(false); cancelled.set(false); estimated.set(0L); }
java
protected void reset() { done.set(false); performing.set(false); cancelled.set(false); estimated.set(0L); }
[ "protected", "void", "reset", "(", ")", "{", "done", ".", "set", "(", "false", ")", ";", "performing", ".", "set", "(", "false", ")", ";", "cancelled", ".", "set", "(", "false", ")", ";", "estimated", ".", "set", "(", "0L", ")", ";", "}" ]
Resets the context to its starting state.
[ "Resets", "the", "context", "to", "its", "starting", "state", "." ]
43fc6572de9b16eb8474aa21a88b6b2d11291615
https://github.com/Ellzord/JALSE/blob/43fc6572de9b16eb8474aa21a88b6b2d11291615/src/main/java/jalse/actions/AbstractManualActionContext.java#L202-L207
train
projectodd/stilts
stomp-server-core/src/main/java/org/projectodd/stilts/stomp/server/StompServer.java
StompServer.start
public synchronized void start() throws Exception { if (running) { return; } List<Connector> startedConnectors = new ArrayList<Connector>(); for (Connector each : this.connectors) { try { each.setServer( this ); each.start(); startedConnectors.add( each ); } catch (Exception e) { for (Connector stop : startedConnectors) { try { stop.stop(); } catch (Exception e2) { } } throw e; } } running = true; }
java
public synchronized void start() throws Exception { if (running) { return; } List<Connector> startedConnectors = new ArrayList<Connector>(); for (Connector each : this.connectors) { try { each.setServer( this ); each.start(); startedConnectors.add( each ); } catch (Exception e) { for (Connector stop : startedConnectors) { try { stop.stop(); } catch (Exception e2) { } } throw e; } } running = true; }
[ "public", "synchronized", "void", "start", "(", ")", "throws", "Exception", "{", "if", "(", "running", ")", "{", "return", ";", "}", "List", "<", "Connector", ">", "startedConnectors", "=", "new", "ArrayList", "<", "Connector", ">", "(", ")", ";", "for",...
Start this server. @throws Throwable
[ "Start", "this", "server", "." ]
6ba81d4162325b98f591c206520476cf575d0567
https://github.com/projectodd/stilts/blob/6ba81d4162325b98f591c206520476cf575d0567/stomp-server-core/src/main/java/org/projectodd/stilts/stomp/server/StompServer.java#L75-L98
train
projectodd/stilts
stomp-server-core/src/main/java/org/projectodd/stilts/stomp/server/StompServer.java
StompServer.stop
public synchronized void stop() throws Exception { if (!running) { return; } for (Connector each : this.connectors) { try { each.stop(); each.setServer( null ); } catch (Exception e) { // ignore } } running = false; }
java
public synchronized void stop() throws Exception { if (!running) { return; } for (Connector each : this.connectors) { try { each.stop(); each.setServer( null ); } catch (Exception e) { // ignore } } running = false; }
[ "public", "synchronized", "void", "stop", "(", ")", "throws", "Exception", "{", "if", "(", "!", "running", ")", "{", "return", ";", "}", "for", "(", "Connector", "each", ":", "this", ".", "connectors", ")", "{", "try", "{", "each", ".", "stop", "(", ...
Stop this server. @throws Exception @throws Throwable
[ "Stop", "this", "server", "." ]
6ba81d4162325b98f591c206520476cf575d0567
https://github.com/projectodd/stilts/blob/6ba81d4162325b98f591c206520476cf575d0567/stomp-server-core/src/main/java/org/projectodd/stilts/stomp/server/StompServer.java#L106-L121
train
Ellzord/JALSE
src/main/java/jalse/actions/DefaultActionScheduler.java
DefaultActionScheduler.cancelAllScheduledForActor
@Override public void cancelAllScheduledForActor() { final Set<ActionContext<T>> toCancel; synchronized (contexts) { toCancel = new HashSet<>(contexts); contexts.clear(); } // Cancel all toCancel.forEach(cxt -> { if (!cxt.isDone()) { cxt.cancel(); } }); }
java
@Override public void cancelAllScheduledForActor() { final Set<ActionContext<T>> toCancel; synchronized (contexts) { toCancel = new HashSet<>(contexts); contexts.clear(); } // Cancel all toCancel.forEach(cxt -> { if (!cxt.isDone()) { cxt.cancel(); } }); }
[ "@", "Override", "public", "void", "cancelAllScheduledForActor", "(", ")", "{", "final", "Set", "<", "ActionContext", "<", "T", ">", ">", "toCancel", ";", "synchronized", "(", "contexts", ")", "{", "toCancel", "=", "new", "HashSet", "<>", "(", "contexts", ...
Cancel all tasks scheduled to the current engine for the actor by this scheduler.
[ "Cancel", "all", "tasks", "scheduled", "to", "the", "current", "engine", "for", "the", "actor", "by", "this", "scheduler", "." ]
43fc6572de9b16eb8474aa21a88b6b2d11291615
https://github.com/Ellzord/JALSE/blob/43fc6572de9b16eb8474aa21a88b6b2d11291615/src/main/java/jalse/actions/DefaultActionScheduler.java#L45-L59
train
Ellzord/JALSE
src/main/java/jalse/actions/AbstractFutureActionContext.java
AbstractFutureActionContext.getFuture
protected Future<?> getFuture() { long stamp = lock.tryOptimisticRead(); Future<?> future = this.future; if (!lock.validate(stamp)) { // Not valid so wait for read lock stamp = lock.readLock(); try { future = this.future; } finally { lock.unlockRead(stamp); } } return future; }
java
protected Future<?> getFuture() { long stamp = lock.tryOptimisticRead(); Future<?> future = this.future; if (!lock.validate(stamp)) { // Not valid so wait for read lock stamp = lock.readLock(); try { future = this.future; } finally { lock.unlockRead(stamp); } } return future; }
[ "protected", "Future", "<", "?", ">", "getFuture", "(", ")", "{", "long", "stamp", "=", "lock", ".", "tryOptimisticRead", "(", ")", ";", "Future", "<", "?", ">", "future", "=", "this", ".", "future", ";", "if", "(", "!", "lock", ".", "validate", "(...
Gets the future associated to the action task. @return Future or null if none has been set.
[ "Gets", "the", "future", "associated", "to", "the", "action", "task", "." ]
43fc6572de9b16eb8474aa21a88b6b2d11291615
https://github.com/Ellzord/JALSE/blob/43fc6572de9b16eb8474aa21a88b6b2d11291615/src/main/java/jalse/actions/AbstractFutureActionContext.java#L81-L93
train
Ellzord/JALSE
src/main/java/jalse/actions/AbstractFutureActionContext.java
AbstractFutureActionContext.setFuture
protected void setFuture(final Future<?> future) { final long stamp = lock.writeLock(); try { this.future = future; } finally { lock.unlockWrite(stamp); } }
java
protected void setFuture(final Future<?> future) { final long stamp = lock.writeLock(); try { this.future = future; } finally { lock.unlockWrite(stamp); } }
[ "protected", "void", "setFuture", "(", "final", "Future", "<", "?", ">", "future", ")", "{", "final", "long", "stamp", "=", "lock", ".", "writeLock", "(", ")", ";", "try", "{", "this", ".", "future", "=", "future", ";", "}", "finally", "{", "lock", ...
Sets the future of the associated action task. @param future Future to set.
[ "Sets", "the", "future", "of", "the", "associated", "action", "task", "." ]
43fc6572de9b16eb8474aa21a88b6b2d11291615
https://github.com/Ellzord/JALSE/blob/43fc6572de9b16eb8474aa21a88b6b2d11291615/src/main/java/jalse/actions/AbstractFutureActionContext.java#L113-L120
train
Ellzord/JALSE
src/main/java/jalse/entities/functions/Functions.java
Functions.defaultValue
public static Object defaultValue(final Class<?> type) { final Object value = WRAPPER_DEFAULTS.get(Objects.requireNonNull(type)); if (value == null) { throw new IllegalArgumentException("Not primitive wrapper"); } return value; }
java
public static Object defaultValue(final Class<?> type) { final Object value = WRAPPER_DEFAULTS.get(Objects.requireNonNull(type)); if (value == null) { throw new IllegalArgumentException("Not primitive wrapper"); } return value; }
[ "public", "static", "Object", "defaultValue", "(", "final", "Class", "<", "?", ">", "type", ")", "{", "final", "Object", "value", "=", "WRAPPER_DEFAULTS", ".", "get", "(", "Objects", ".", "requireNonNull", "(", "type", ")", ")", ";", "if", "(", "value", ...
Gets the default value for a primitive wrapper. @param type Primitive wrapper type. @return The default value.
[ "Gets", "the", "default", "value", "for", "a", "primitive", "wrapper", "." ]
43fc6572de9b16eb8474aa21a88b6b2d11291615
https://github.com/Ellzord/JALSE/blob/43fc6572de9b16eb8474aa21a88b6b2d11291615/src/main/java/jalse/entities/functions/Functions.java#L140-L146
train
Ellzord/JALSE
src/main/java/jalse/entities/functions/Functions.java
Functions.firstGenericTypeArg
public static Type firstGenericTypeArg(final Type pt) { return pt instanceof ParameterizedType ? ((ParameterizedType) pt).getActualTypeArguments()[0] : null; }
java
public static Type firstGenericTypeArg(final Type pt) { return pt instanceof ParameterizedType ? ((ParameterizedType) pt).getActualTypeArguments()[0] : null; }
[ "public", "static", "Type", "firstGenericTypeArg", "(", "final", "Type", "pt", ")", "{", "return", "pt", "instanceof", "ParameterizedType", "?", "(", "(", "ParameterizedType", ")", "pt", ")", ".", "getActualTypeArguments", "(", ")", "[", "0", "]", ":", "null...
Gets the first generic type argument for a parameterised type. @param pt Type to take from. @return The first generic type argument or null if not a parameterised type.
[ "Gets", "the", "first", "generic", "type", "argument", "for", "a", "parameterised", "type", "." ]
43fc6572de9b16eb8474aa21a88b6b2d11291615
https://github.com/Ellzord/JALSE/blob/43fc6572de9b16eb8474aa21a88b6b2d11291615/src/main/java/jalse/entities/functions/Functions.java#L155-L157
train
Ellzord/JALSE
src/main/java/jalse/entities/functions/Functions.java
Functions.getSingleIDSupplier
public static Supplier<UUID> getSingleIDSupplier(final Method m) throws IllegalArgumentException { // Check only has one ID max final EntityID[] entityIDs = m.getAnnotationsByType(EntityID.class); if (entityIDs.length > 1) { throw new IllegalArgumentException("Cannot have more than one entity ID"); } // Get and validate ID Supplier<UUID> idSupplier = null; if (entityIDs.length == 1) { idSupplier = toIDSupplier(entityIDs[0]); } return idSupplier; }
java
public static Supplier<UUID> getSingleIDSupplier(final Method m) throws IllegalArgumentException { // Check only has one ID max final EntityID[] entityIDs = m.getAnnotationsByType(EntityID.class); if (entityIDs.length > 1) { throw new IllegalArgumentException("Cannot have more than one entity ID"); } // Get and validate ID Supplier<UUID> idSupplier = null; if (entityIDs.length == 1) { idSupplier = toIDSupplier(entityIDs[0]); } return idSupplier; }
[ "public", "static", "Supplier", "<", "UUID", ">", "getSingleIDSupplier", "(", "final", "Method", "m", ")", "throws", "IllegalArgumentException", "{", "// Check only has one ID max", "final", "EntityID", "[", "]", "entityIDs", "=", "m", ".", "getAnnotationsByType", "...
Gets a single ID supplier from a method. @param m Method to check. @return The single ID supplier or {@code null} if none found. @throws IllegalArgumentException If there are multiple ID suppliers found.
[ "Gets", "a", "single", "ID", "supplier", "from", "a", "method", "." ]
43fc6572de9b16eb8474aa21a88b6b2d11291615
https://github.com/Ellzord/JALSE/blob/43fc6572de9b16eb8474aa21a88b6b2d11291615/src/main/java/jalse/entities/functions/Functions.java#L185-L199
train
Ellzord/JALSE
src/main/java/jalse/entities/functions/Functions.java
Functions.returnTypeIs
public static boolean returnTypeIs(final Method m, final Class<?> clazz) { return clazz.equals(toClass(m.getGenericReturnType())); }
java
public static boolean returnTypeIs(final Method m, final Class<?> clazz) { return clazz.equals(toClass(m.getGenericReturnType())); }
[ "public", "static", "boolean", "returnTypeIs", "(", "final", "Method", "m", ",", "final", "Class", "<", "?", ">", "clazz", ")", "{", "return", "clazz", ".", "equals", "(", "toClass", "(", "m", ".", "getGenericReturnType", "(", ")", ")", ")", ";", "}" ]
Whether the method return type matches the supplied type. @param m Method to check. @param clazz Possible return type to check. @return Whether the actual return type matches the check type.
[ "Whether", "the", "method", "return", "type", "matches", "the", "supplied", "type", "." ]
43fc6572de9b16eb8474aa21a88b6b2d11291615
https://github.com/Ellzord/JALSE/blob/43fc6572de9b16eb8474aa21a88b6b2d11291615/src/main/java/jalse/entities/functions/Functions.java#L254-L256
train
Ellzord/JALSE
src/main/java/jalse/entities/functions/Functions.java
Functions.wrap
public static Class<?> wrap(final Class<?> type) { if (!type.isPrimitive()) { throw new IllegalArgumentException("Not primitive"); } return PRIMITIVES_WRAPPERS.get(type); }
java
public static Class<?> wrap(final Class<?> type) { if (!type.isPrimitive()) { throw new IllegalArgumentException("Not primitive"); } return PRIMITIVES_WRAPPERS.get(type); }
[ "public", "static", "Class", "<", "?", ">", "wrap", "(", "final", "Class", "<", "?", ">", "type", ")", "{", "if", "(", "!", "type", ".", "isPrimitive", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Not primitive\"", ")", ";", ...
Gets the wrapper type for the primitive type. @param type Primitive type to wrap. @return The primitive wrapper type. @throws IllegalArgumentException If the type is not primitive.
[ "Gets", "the", "wrapper", "type", "for", "the", "primitive", "type", "." ]
43fc6572de9b16eb8474aa21a88b6b2d11291615
https://github.com/Ellzord/JALSE/blob/43fc6572de9b16eb8474aa21a88b6b2d11291615/src/main/java/jalse/entities/functions/Functions.java#L355-L360
train
Ellzord/JALSE
src/main/java/jalse/tags/TagTypeSet.java
TagTypeSet.containsOfType
public boolean containsOfType(final Class<? extends Tag> type) { read.lock(); try { return tags.containsKey(type); } finally { read.unlock(); } }
java
public boolean containsOfType(final Class<? extends Tag> type) { read.lock(); try { return tags.containsKey(type); } finally { read.unlock(); } }
[ "public", "boolean", "containsOfType", "(", "final", "Class", "<", "?", "extends", "Tag", ">", "type", ")", "{", "read", ".", "lock", "(", ")", ";", "try", "{", "return", "tags", ".", "containsKey", "(", "type", ")", ";", "}", "finally", "{", "read",...
Checks whether the tag set contains any tags of that type. @param type Type of tag. @return {@code true} if the set contains any tags of the specified type or {@code false} if it does not.
[ "Checks", "whether", "the", "tag", "set", "contains", "any", "tags", "of", "that", "type", "." ]
43fc6572de9b16eb8474aa21a88b6b2d11291615
https://github.com/Ellzord/JALSE/blob/43fc6572de9b16eb8474aa21a88b6b2d11291615/src/main/java/jalse/tags/TagTypeSet.java#L98-L105
train
Ellzord/JALSE
src/main/java/jalse/tags/TagTypeSet.java
TagTypeSet.getOfType
@SuppressWarnings("unchecked") public <T extends Tag> Set<T> getOfType(final Class<T> type) { read.lock(); try { final Set<T> tagsOfType = (Set<T>) tags.get(type); return tagsOfType != null ? Collections.unmodifiableSet(tagsOfType) : Collections.emptySet(); } finally { read.unlock(); } }
java
@SuppressWarnings("unchecked") public <T extends Tag> Set<T> getOfType(final Class<T> type) { read.lock(); try { final Set<T> tagsOfType = (Set<T>) tags.get(type); return tagsOfType != null ? Collections.unmodifiableSet(tagsOfType) : Collections.emptySet(); } finally { read.unlock(); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", "extends", "Tag", ">", "Set", "<", "T", ">", "getOfType", "(", "final", "Class", "<", "T", ">", "type", ")", "{", "read", ".", "lock", "(", ")", ";", "try", "{", "final", "Set"...
Gets all of the tags matching the specified type. @param type Type of tag. @return All tags of that type or an empty set if none are found.
[ "Gets", "all", "of", "the", "tags", "matching", "the", "specified", "type", "." ]
43fc6572de9b16eb8474aa21a88b6b2d11291615
https://github.com/Ellzord/JALSE/blob/43fc6572de9b16eb8474aa21a88b6b2d11291615/src/main/java/jalse/tags/TagTypeSet.java#L114-L123
train
Ellzord/JALSE
src/main/java/jalse/tags/TagTypeSet.java
TagTypeSet.removeOfType
public boolean removeOfType(final Class<? extends Tag> type) { write.lock(); try { return tags.remove(type) != null; } finally { write.unlock(); } }
java
public boolean removeOfType(final Class<? extends Tag> type) { write.lock(); try { return tags.remove(type) != null; } finally { write.unlock(); } }
[ "public", "boolean", "removeOfType", "(", "final", "Class", "<", "?", "extends", "Tag", ">", "type", ")", "{", "write", ".", "lock", "(", ")", ";", "try", "{", "return", "tags", ".", "remove", "(", "type", ")", "!=", "null", ";", "}", "finally", "{...
Removes all tags of the specified type. @param type Type of tag. @return Whether any tags were removed.
[ "Removes", "all", "tags", "of", "the", "specified", "type", "." ]
43fc6572de9b16eb8474aa21a88b6b2d11291615
https://github.com/Ellzord/JALSE/blob/43fc6572de9b16eb8474aa21a88b6b2d11291615/src/main/java/jalse/tags/TagTypeSet.java#L171-L178
train
Ellzord/JALSE
src/main/java/jalse/entities/Entities.java
Entities.anyEntityOfType
public static <T extends Entity> Optional<T> anyEntityOfType(final EntityContainer container, final Class<T> type) { return container.streamEntitiesOfType(type).findAny(); }
java
public static <T extends Entity> Optional<T> anyEntityOfType(final EntityContainer container, final Class<T> type) { return container.streamEntitiesOfType(type).findAny(); }
[ "public", "static", "<", "T", "extends", "Entity", ">", "Optional", "<", "T", ">", "anyEntityOfType", "(", "final", "EntityContainer", "container", ",", "final", "Class", "<", "T", ">", "type", ")", "{", "return", "container", ".", "streamEntitiesOfType", "(...
Gets any entity within the container marked with the specified type. @param container Entity container. @param type Entity type. @return Gets an Optional of the resulting entity or an empty Optional if it was not found. @see Entity#markAsType(Class)
[ "Gets", "any", "entity", "within", "the", "container", "marked", "with", "the", "specified", "type", "." ]
43fc6572de9b16eb8474aa21a88b6b2d11291615
https://github.com/Ellzord/JALSE/blob/43fc6572de9b16eb8474aa21a88b6b2d11291615/src/main/java/jalse/entities/Entities.java#L94-L96
train
Ellzord/JALSE
src/main/java/jalse/entities/Entities.java
Entities.findEntityRecursively
public static boolean findEntityRecursively(final EntityContainer container, final UUID id) { final AtomicBoolean found = new AtomicBoolean(); walkEntityTree(container, e -> { if (id.equals(e.getID())) { found.set(true); return EntityVisitResult.EXIT; } else { return EntityVisitResult.CONTINUE; } }); return found.get(); }
java
public static boolean findEntityRecursively(final EntityContainer container, final UUID id) { final AtomicBoolean found = new AtomicBoolean(); walkEntityTree(container, e -> { if (id.equals(e.getID())) { found.set(true); return EntityVisitResult.EXIT; } else { return EntityVisitResult.CONTINUE; } }); return found.get(); }
[ "public", "static", "boolean", "findEntityRecursively", "(", "final", "EntityContainer", "container", ",", "final", "UUID", "id", ")", "{", "final", "AtomicBoolean", "found", "=", "new", "AtomicBoolean", "(", ")", ";", "walkEntityTree", "(", "container", ",", "e...
Walks through the entity tree looking for an entity. @param container Entity container. @param id Entity ID to look for. @return Whether the entity was found. @see #walkEntityTree(EntityContainer, EntityVisitor)
[ "Walks", "through", "the", "entity", "tree", "looking", "for", "an", "entity", "." ]
43fc6572de9b16eb8474aa21a88b6b2d11291615
https://github.com/Ellzord/JALSE/blob/43fc6572de9b16eb8474aa21a88b6b2d11291615/src/main/java/jalse/entities/Entities.java#L143-L156
train
Ellzord/JALSE
src/main/java/jalse/entities/Entities.java
Entities.getRootContainer
public static EntityContainer getRootContainer(final EntityContainer container) { Objects.requireNonNull(container); if (container instanceof Entity) { final EntityContainer parent = ((Entity) container).getContainer(); if (parent != null) { return getRootContainer(parent); } } return container; }
java
public static EntityContainer getRootContainer(final EntityContainer container) { Objects.requireNonNull(container); if (container instanceof Entity) { final EntityContainer parent = ((Entity) container).getContainer(); if (parent != null) { return getRootContainer(parent); } } return container; }
[ "public", "static", "EntityContainer", "getRootContainer", "(", "final", "EntityContainer", "container", ")", "{", "Objects", ".", "requireNonNull", "(", "container", ")", ";", "if", "(", "container", "instanceof", "Entity", ")", "{", "final", "EntityContainer", "...
Gets the highest level parent of this container. @param container Container to get parent for. @return Highest level parent (or this container if it has no parent).
[ "Gets", "the", "highest", "level", "parent", "of", "this", "container", "." ]
43fc6572de9b16eb8474aa21a88b6b2d11291615
https://github.com/Ellzord/JALSE/blob/43fc6572de9b16eb8474aa21a88b6b2d11291615/src/main/java/jalse/entities/Entities.java#L209-L219
train
Ellzord/JALSE
src/main/java/jalse/entities/Entities.java
Entities.isMarkedAsType
public static Predicate<Entity> isMarkedAsType(final Class<? extends Entity> type) { return i -> i.isMarkedAsType(type); }
java
public static Predicate<Entity> isMarkedAsType(final Class<? extends Entity> type) { return i -> i.isMarkedAsType(type); }
[ "public", "static", "Predicate", "<", "Entity", ">", "isMarkedAsType", "(", "final", "Class", "<", "?", "extends", "Entity", ">", "type", ")", "{", "return", "i", "->", "i", ".", "isMarkedAsType", "(", "type", ")", ";", "}" ]
Checks to see if the entity has been tagged with the type. @param type Entity type to check for. @return Predicate of {@code true} if the entity is of the type or {@code false} if it is not.
[ "Checks", "to", "see", "if", "the", "entity", "has", "been", "tagged", "with", "the", "type", "." ]
43fc6572de9b16eb8474aa21a88b6b2d11291615
https://github.com/Ellzord/JALSE/blob/43fc6572de9b16eb8474aa21a88b6b2d11291615/src/main/java/jalse/entities/Entities.java#L270-L272
train
Ellzord/JALSE
src/main/java/jalse/entities/Entities.java
Entities.isOrSubtype
public static boolean isOrSubtype(final Class<? extends Entity> descendant, final Class<? extends Entity> ancestor) { return ancestor.isAssignableFrom(descendant); }
java
public static boolean isOrSubtype(final Class<? extends Entity> descendant, final Class<? extends Entity> ancestor) { return ancestor.isAssignableFrom(descendant); }
[ "public", "static", "boolean", "isOrSubtype", "(", "final", "Class", "<", "?", "extends", "Entity", ">", "descendant", ",", "final", "Class", "<", "?", "extends", "Entity", ">", "ancestor", ")", "{", "return", "ancestor", ".", "isAssignableFrom", "(", "desce...
Checks if the specified type is equal to or a descendant from the specified ancestor type. @param descendant Descendant type. @param ancestor Ancestor type. @return Whether the descendant is equal or descended from the ancestor type.
[ "Checks", "if", "the", "specified", "type", "is", "equal", "to", "or", "a", "descendant", "from", "the", "specified", "ancestor", "type", "." ]
43fc6572de9b16eb8474aa21a88b6b2d11291615
https://github.com/Ellzord/JALSE/blob/43fc6572de9b16eb8474aa21a88b6b2d11291615/src/main/java/jalse/entities/Entities.java#L283-L286
train
Ellzord/JALSE
src/main/java/jalse/entities/Entities.java
Entities.isSubtype
public static boolean isSubtype(final Class<? extends Entity> descendant, final Class<? extends Entity> ancestor) { return !ancestor.equals(descendant) && ancestor.isAssignableFrom(descendant); }
java
public static boolean isSubtype(final Class<? extends Entity> descendant, final Class<? extends Entity> ancestor) { return !ancestor.equals(descendant) && ancestor.isAssignableFrom(descendant); }
[ "public", "static", "boolean", "isSubtype", "(", "final", "Class", "<", "?", "extends", "Entity", ">", "descendant", ",", "final", "Class", "<", "?", "extends", "Entity", ">", "ancestor", ")", "{", "return", "!", "ancestor", ".", "equals", "(", "descendant...
Checks if the specified type is a descendant from the specified ancestor type. @param descendant Descendant type. @param ancestor Ancestor type. @return Whether the descendant is descended from the ancestor type.
[ "Checks", "if", "the", "specified", "type", "is", "a", "descendant", "from", "the", "specified", "ancestor", "type", "." ]
43fc6572de9b16eb8474aa21a88b6b2d11291615
https://github.com/Ellzord/JALSE/blob/43fc6572de9b16eb8474aa21a88b6b2d11291615/src/main/java/jalse/entities/Entities.java#L297-L299
train
Ellzord/JALSE
src/main/java/jalse/entities/Entities.java
Entities.newRecursiveAttributeListener
public static <T> EntityListener newRecursiveAttributeListener(final NamedAttributeType<T> namedType, final Supplier<AttributeListener<T>> supplier) { return newRecursiveAttributeListener(namedType, supplier, Integer.MAX_VALUE); }
java
public static <T> EntityListener newRecursiveAttributeListener(final NamedAttributeType<T> namedType, final Supplier<AttributeListener<T>> supplier) { return newRecursiveAttributeListener(namedType, supplier, Integer.MAX_VALUE); }
[ "public", "static", "<", "T", ">", "EntityListener", "newRecursiveAttributeListener", "(", "final", "NamedAttributeType", "<", "T", ">", "namedType", ",", "final", "Supplier", "<", "AttributeListener", "<", "T", ">", ">", "supplier", ")", "{", "return", "newRecu...
Creates an recursive entity listener for named attribute type and the supplied attribute listener supplier with Integer.MAX_VALUE recursion limit. @param namedType Named attribute type being listened for by supplier's listeners. @param supplier Supplier of the attribute listener to be added to created entities. @return Recursive attribute listener for named type and supplier.
[ "Creates", "an", "recursive", "entity", "listener", "for", "named", "attribute", "type", "and", "the", "supplied", "attribute", "listener", "supplier", "with", "Integer", ".", "MAX_VALUE", "recursion", "limit", "." ]
43fc6572de9b16eb8474aa21a88b6b2d11291615
https://github.com/Ellzord/JALSE/blob/43fc6572de9b16eb8474aa21a88b6b2d11291615/src/main/java/jalse/entities/Entities.java#L311-L314
train
Ellzord/JALSE
src/main/java/jalse/entities/Entities.java
Entities.newRecursiveAttributeListener
public static <T> EntityListener newRecursiveAttributeListener(final NamedAttributeType<T> namedType, final Supplier<AttributeListener<T>> supplier, final int depth) { if (depth <= 0) { throw new IllegalArgumentException(); } return new RecursiveAttributeListener<>(namedType, supplier, depth); }
java
public static <T> EntityListener newRecursiveAttributeListener(final NamedAttributeType<T> namedType, final Supplier<AttributeListener<T>> supplier, final int depth) { if (depth <= 0) { throw new IllegalArgumentException(); } return new RecursiveAttributeListener<>(namedType, supplier, depth); }
[ "public", "static", "<", "T", ">", "EntityListener", "newRecursiveAttributeListener", "(", "final", "NamedAttributeType", "<", "T", ">", "namedType", ",", "final", "Supplier", "<", "AttributeListener", "<", "T", ">", ">", "supplier", ",", "final", "int", "depth"...
Creates an recursive entity listener for named attribute type and the supplied attribute listener supplier with specified recursion limit. @param namedType Named attribute type being listened for by supplier's listeners. @param supplier Supplier of the attribute listener to be added to created entities. @param depth The recursion limit of the listener. @return Recursive attribute listener for named type and supplier.
[ "Creates", "an", "recursive", "entity", "listener", "for", "named", "attribute", "type", "and", "the", "supplied", "attribute", "listener", "supplier", "with", "specified", "recursion", "limit", "." ]
43fc6572de9b16eb8474aa21a88b6b2d11291615
https://github.com/Ellzord/JALSE/blob/43fc6572de9b16eb8474aa21a88b6b2d11291615/src/main/java/jalse/entities/Entities.java#L328-L334
train
Ellzord/JALSE
src/main/java/jalse/entities/Entities.java
Entities.newRecursiveEntityListener
public static EntityListener newRecursiveEntityListener(final Supplier<EntityListener> supplier, final int depth) { if (depth <= 0) { throw new IllegalArgumentException(); } return new RecursiveEntityListener(supplier, depth); }
java
public static EntityListener newRecursiveEntityListener(final Supplier<EntityListener> supplier, final int depth) { if (depth <= 0) { throw new IllegalArgumentException(); } return new RecursiveEntityListener(supplier, depth); }
[ "public", "static", "EntityListener", "newRecursiveEntityListener", "(", "final", "Supplier", "<", "EntityListener", ">", "supplier", ",", "final", "int", "depth", ")", "{", "if", "(", "depth", "<=", "0", ")", "{", "throw", "new", "IllegalArgumentException", "("...
Creates a recursive entity listener for the supplied entity listener supplier and specified recursion limit. @param supplier Supplier of the entity listener to be added to created entities. @param depth The recursion limit of the listener. @return Recursive entity listener with specified recursion limit.
[ "Creates", "a", "recursive", "entity", "listener", "for", "the", "supplied", "entity", "listener", "supplier", "and", "specified", "recursion", "limit", "." ]
43fc6572de9b16eb8474aa21a88b6b2d11291615
https://github.com/Ellzord/JALSE/blob/43fc6572de9b16eb8474aa21a88b6b2d11291615/src/main/java/jalse/entities/Entities.java#L358-L363
train
linkedin/linkedin-zookeeper
org.linkedin.zookeeper-impl/src/main/java/org/linkedin/zookeeper/tracker/ZKStringDataReader.java
ZKStringDataReader.isEqual
@Override public boolean isEqual(String data1, String data2) { return LangUtils.isEqual(data1, data2); }
java
@Override public boolean isEqual(String data1, String data2) { return LangUtils.isEqual(data1, data2); }
[ "@", "Override", "public", "boolean", "isEqual", "(", "String", "data1", ",", "String", "data2", ")", "{", "return", "LangUtils", ".", "isEqual", "(", "data1", ",", "data2", ")", ";", "}" ]
Compare 2 data equality @return <code>true</code> if equal (in the {@link Object#equals(Object)} definition)
[ "Compare", "2", "data", "equality" ]
600b1d01318594ed425ede566bbbdc94b026a53e
https://github.com/linkedin/linkedin-zookeeper/blob/600b1d01318594ed425ede566bbbdc94b026a53e/org.linkedin.zookeeper-impl/src/main/java/org/linkedin/zookeeper/tracker/ZKStringDataReader.java#L51-L55
train
projectodd/stilts
stomp-server-core/src/main/java/org/projectodd/stilts/stomp/server/protocol/websockets/ServerHandshakeHandler.java
ServerHandshakeHandler.handleHttpRequest
protected void handleHttpRequest(final ChannelHandlerContext channelContext, final HttpRequest request) throws Exception { if (isWebSocketsUpgradeRequest( request )) { final Handshake handshake = findHandshake( request ); if (handshake != null) { HttpResponse response = handshake.generateResponse( request ); response.addHeader( Names.UPGRADE, Values.WEBSOCKET ); response.addHeader( Names.CONNECTION, Values.UPGRADE ); final ChannelPipeline pipeline = channelContext.getChannel().getPipeline(); reconfigureUpstream( pipeline, handshake ); Channel channel = channelContext.getChannel(); ChannelFuture future = channel.write( response ); future.addListener( new ChannelFutureListener() { public void operationComplete(ChannelFuture future) throws Exception { reconfigureDownstream( pipeline, handshake ); pipeline.replace( ServerHandshakeHandler.this, "websocket-disconnection-negotiator", new WebSocketDisconnectionNegotiator() ); forwardConnectEventUpstream( channelContext ); decodeHost( channelContext, request ); decodeSession( channelContext, request ); } } ); return; } } // Send an error page otherwise. sendHttpResponse( channelContext, request, new DefaultHttpResponse( HttpVersion.HTTP_1_1, HttpResponseStatus.FORBIDDEN ) ); }
java
protected void handleHttpRequest(final ChannelHandlerContext channelContext, final HttpRequest request) throws Exception { if (isWebSocketsUpgradeRequest( request )) { final Handshake handshake = findHandshake( request ); if (handshake != null) { HttpResponse response = handshake.generateResponse( request ); response.addHeader( Names.UPGRADE, Values.WEBSOCKET ); response.addHeader( Names.CONNECTION, Values.UPGRADE ); final ChannelPipeline pipeline = channelContext.getChannel().getPipeline(); reconfigureUpstream( pipeline, handshake ); Channel channel = channelContext.getChannel(); ChannelFuture future = channel.write( response ); future.addListener( new ChannelFutureListener() { public void operationComplete(ChannelFuture future) throws Exception { reconfigureDownstream( pipeline, handshake ); pipeline.replace( ServerHandshakeHandler.this, "websocket-disconnection-negotiator", new WebSocketDisconnectionNegotiator() ); forwardConnectEventUpstream( channelContext ); decodeHost( channelContext, request ); decodeSession( channelContext, request ); } } ); return; } } // Send an error page otherwise. sendHttpResponse( channelContext, request, new DefaultHttpResponse( HttpVersion.HTTP_1_1, HttpResponseStatus.FORBIDDEN ) ); }
[ "protected", "void", "handleHttpRequest", "(", "final", "ChannelHandlerContext", "channelContext", ",", "final", "HttpRequest", "request", ")", "throws", "Exception", "{", "if", "(", "isWebSocketsUpgradeRequest", "(", "request", ")", ")", "{", "final", "Handshake", ...
Handle initial HTTP portion of the handshake. @param channelContext @param request @throws Exception
[ "Handle", "initial", "HTTP", "portion", "of", "the", "handshake", "." ]
6ba81d4162325b98f591c206520476cf575d0567
https://github.com/projectodd/stilts/blob/6ba81d4162325b98f591c206520476cf575d0567/stomp-server-core/src/main/java/org/projectodd/stilts/stomp/server/protocol/websockets/ServerHandshakeHandler.java#L101-L134
train
projectodd/stilts
stomp-server-core/src/main/java/org/projectodd/stilts/stomp/server/protocol/websockets/ServerHandshakeHandler.java
ServerHandshakeHandler.findHandshake
protected Handshake findHandshake(HttpRequest request) { for (Handshake handshake : this.handshakes) { if (handshake.matches( request )) { return handshake; } } return null; }
java
protected Handshake findHandshake(HttpRequest request) { for (Handshake handshake : this.handshakes) { if (handshake.matches( request )) { return handshake; } } return null; }
[ "protected", "Handshake", "findHandshake", "(", "HttpRequest", "request", ")", "{", "for", "(", "Handshake", "handshake", ":", "this", ".", "handshakes", ")", "{", "if", "(", "handshake", ".", "matches", "(", "request", ")", ")", "{", "return", "handshake", ...
Locate a matching handshake version. @param request The HTTP request. @return The matching handshake, otherwise <code>null</code> if none match.
[ "Locate", "a", "matching", "handshake", "version", "." ]
6ba81d4162325b98f591c206520476cf575d0567
https://github.com/projectodd/stilts/blob/6ba81d4162325b98f591c206520476cf575d0567/stomp-server-core/src/main/java/org/projectodd/stilts/stomp/server/protocol/websockets/ServerHandshakeHandler.java#L183-L191
train
projectodd/stilts
stomp-server-core/src/main/java/org/projectodd/stilts/stomp/server/protocol/websockets/ServerHandshakeHandler.java
ServerHandshakeHandler.reconfigureUpstream
protected void reconfigureUpstream(ChannelPipeline pipeline, Handshake handshake) { pipeline.replace( "http-decoder", "websockets-decoder", handshake.newDecoder() ); ChannelHandler[] additionalHandlers = handshake.newAdditionalHandlers(); String currentTail = "websockets-decoder"; for (ChannelHandler each : additionalHandlers) { String handlerName = "additional-" + each.getClass().getSimpleName(); pipeline.addAfter( currentTail, handlerName, each ); currentTail = handlerName; } }
java
protected void reconfigureUpstream(ChannelPipeline pipeline, Handshake handshake) { pipeline.replace( "http-decoder", "websockets-decoder", handshake.newDecoder() ); ChannelHandler[] additionalHandlers = handshake.newAdditionalHandlers(); String currentTail = "websockets-decoder"; for (ChannelHandler each : additionalHandlers) { String handlerName = "additional-" + each.getClass().getSimpleName(); pipeline.addAfter( currentTail, handlerName, each ); currentTail = handlerName; } }
[ "protected", "void", "reconfigureUpstream", "(", "ChannelPipeline", "pipeline", ",", "Handshake", "handshake", ")", "{", "pipeline", ".", "replace", "(", "\"http-decoder\"", ",", "\"websockets-decoder\"", ",", "handshake", ".", "newDecoder", "(", ")", ")", ";", "C...
Remove HTTP handlers, replace with web-socket handlers. @param pipeline The pipeline to reconfigure.
[ "Remove", "HTTP", "handlers", "replace", "with", "web", "-", "socket", "handlers", "." ]
6ba81d4162325b98f591c206520476cf575d0567
https://github.com/projectodd/stilts/blob/6ba81d4162325b98f591c206520476cf575d0567/stomp-server-core/src/main/java/org/projectodd/stilts/stomp/server/protocol/websockets/ServerHandshakeHandler.java#L198-L207
train
projectodd/stilts
stomp-server-core/src/main/java/org/projectodd/stilts/stomp/server/protocol/websockets/ServerHandshakeHandler.java
ServerHandshakeHandler.isWebSocketsUpgradeRequest
protected boolean isWebSocketsUpgradeRequest(HttpRequest request) { String connectionHeader = request.getHeader( Names.CONNECTION ); String upgradeHeader = request.getHeader( Names.UPGRADE ); if (connectionHeader == null || upgradeHeader == null) { return false; } if (connectionHeader.trim().toLowerCase().contains( Values.UPGRADE.toLowerCase() )) { if (upgradeHeader.trim().equalsIgnoreCase( Values.WEBSOCKET )) { return true; } } return false; }
java
protected boolean isWebSocketsUpgradeRequest(HttpRequest request) { String connectionHeader = request.getHeader( Names.CONNECTION ); String upgradeHeader = request.getHeader( Names.UPGRADE ); if (connectionHeader == null || upgradeHeader == null) { return false; } if (connectionHeader.trim().toLowerCase().contains( Values.UPGRADE.toLowerCase() )) { if (upgradeHeader.trim().equalsIgnoreCase( Values.WEBSOCKET )) { return true; } } return false; }
[ "protected", "boolean", "isWebSocketsUpgradeRequest", "(", "HttpRequest", "request", ")", "{", "String", "connectionHeader", "=", "request", ".", "getHeader", "(", "Names", ".", "CONNECTION", ")", ";", "String", "upgradeHeader", "=", "request", ".", "getHeader", "...
Determine if this request represents a web-socket upgrade request. @param request The request to inspect. @return <code>true</code> if this request is indeed a web-socket upgrade request, otherwise <code>false</code>.
[ "Determine", "if", "this", "request", "represents", "a", "web", "-", "socket", "upgrade", "request", "." ]
6ba81d4162325b98f591c206520476cf575d0567
https://github.com/projectodd/stilts/blob/6ba81d4162325b98f591c206520476cf575d0567/stomp-server-core/src/main/java/org/projectodd/stilts/stomp/server/protocol/websockets/ServerHandshakeHandler.java#L225-L240
train