idx
int64 0
41.2k
| question
stringlengths 74
4.21k
| target
stringlengths 5
888
|
|---|---|---|
1,800
|
public CoverageDataResults getValuesUnbounded ( BoundingBox requestBoundingBox ) { CoverageDataRequest request = new CoverageDataRequest ( requestBoundingBox ) ; return getValuesUnbounded ( request ) ; }
|
Get the unbounded coverage data values within the bounding box . Unbounded results retrieves and returns each coverage data pixel . The results size equals the width and height of all matching pixels .
|
1,801
|
protected Double getBilinearInterpolationValue ( GriddedTile griddedTile , TImage image , Double [ ] [ ] leftLastColumns , Double [ ] [ ] topLeftRows , Double [ ] [ ] topRows , int y , int x , float widthRatio , float heightRatio , float destTop , float destLeft , float srcTop , float srcLeft ) { float xSource = getXSource ( x , destLeft , srcLeft , widthRatio ) ; float ySource = getYSource ( y , destTop , srcTop , heightRatio ) ; CoverageDataSourcePixel sourcePixelX = getXSourceMinAndMax ( xSource ) ; CoverageDataSourcePixel sourcePixelY = getYSourceMinAndMax ( ySource ) ; Double [ ] [ ] values = new Double [ 2 ] [ 2 ] ; populateValues ( griddedTile , image , leftLastColumns , topLeftRows , topRows , sourcePixelX , sourcePixelY , values ) ; Double value = null ; if ( values != null ) { value = getBilinearInterpolationValue ( sourcePixelX , sourcePixelY , values ) ; } return value ; }
|
Get the bilinear interpolation coverage data value
|
1,802
|
protected Double getNearestNeighborValue ( GriddedTile griddedTile , TImage image , Double [ ] [ ] leftLastColumns , Double [ ] [ ] topLeftRows , Double [ ] [ ] topRows , int y , int x , float widthRatio , float heightRatio , float destTop , float destLeft , float srcTop , float srcLeft ) { float xSource = getXSource ( x , destLeft , srcLeft , widthRatio ) ; float ySource = getYSource ( y , destTop , srcTop , heightRatio ) ; List < int [ ] > nearestNeighbors = getNearestNeighbors ( xSource , ySource ) ; Double value = null ; for ( int [ ] nearestNeighbor : nearestNeighbors ) { value = getValueOverBorders ( griddedTile , image , leftLastColumns , topLeftRows , topRows , nearestNeighbor [ 0 ] , nearestNeighbor [ 1 ] ) ; if ( value != null ) { break ; } } return value ; }
|
Get the nearest neighbor coverage data value
|
1,803
|
private Double getValueOverBorders ( GriddedTile griddedTile , TImage image , Double [ ] [ ] leftLastColumns , Double [ ] [ ] topLeftRows , Double [ ] [ ] topRows , int x , int y ) { Double value = null ; if ( x < image . getWidth ( ) && y < image . getHeight ( ) ) { if ( x >= 0 && y >= 0 ) { value = getValue ( griddedTile , image , x , y ) ; } else if ( x < 0 && y < 0 ) { if ( topLeftRows != null ) { int row = ( - 1 * y ) - 1 ; if ( row < topLeftRows . length ) { int column = x + topLeftRows [ row ] . length ; if ( column >= 0 ) { value = topLeftRows [ row ] [ column ] ; } } } } else if ( x < 0 ) { if ( leftLastColumns != null ) { int column = ( - 1 * x ) - 1 ; if ( column < leftLastColumns . length ) { int row = y ; if ( row < leftLastColumns [ column ] . length ) { value = leftLastColumns [ column ] [ row ] ; } } } } else { if ( topRows != null ) { int row = ( - 1 * y ) - 1 ; if ( row < topRows . length ) { int column = x ; if ( column < topRows [ row ] . length ) { value = topRows [ row ] [ column ] ; } } } } } return value ; }
|
Get the coverage data value from the coordinate location . If the coordinate crosses the left top or top left tile attempts to get the coverage data value from previously processed border coverage data values .
|
1,804
|
public boolean topicExists ( String topicName ) { Map < String , List < PartitionInfo > > topicInfo = getTopicInfo ( ) ; return topicInfo != null && topicInfo . containsKey ( topicName ) ; }
|
Checks if a Kafka topic exists .
|
1,805
|
public List < PartitionInfo > getPartitionInfo ( String topicName ) { Map < String , List < PartitionInfo > > topicInfo = getTopicInfo ( ) ; List < PartitionInfo > partitionInfo = topicInfo != null ? topicInfo . get ( topicName ) : null ; return partitionInfo != null ? Collections . unmodifiableList ( partitionInfo ) : null ; }
|
Gets partition information of a topic .
|
1,806
|
@ SuppressWarnings ( "unchecked" ) public Set < String > getTopics ( ) { Map < String , List < PartitionInfo > > topicInfo = getTopicInfo ( ) ; Set < String > topics = topicInfo != null ? topicInfo . keySet ( ) : null ; return topics != null ? Collections . unmodifiableSet ( topics ) : Collections . EMPTY_SET ; }
|
Gets all available topics .
|
1,807
|
private KafkaConsumer < String , byte [ ] > _getConsumer ( String topic , boolean autoCommitOffsets ) { KafkaConsumer < String , byte [ ] > consumer = topicConsumers . get ( topic ) ; if ( consumer == null ) { consumer = KafkaHelper . createKafkaConsumer ( bootstrapServers , consumerGroupId , consumeFromBeginning , autoCommitOffsets , consumerProperties ) ; KafkaConsumer < String , byte [ ] > existingConsumer = topicConsumers . putIfAbsent ( topic , consumer ) ; if ( existingConsumer != null ) { consumer . close ( ) ; consumer = existingConsumer ; } else { _checkAndSubscribe ( consumer , topic ) ; } } return consumer ; }
|
Prepares a consumer to consume messages from a Kafka topic .
|
1,808
|
private BlockingQueue < ConsumerRecord < String , byte [ ] > > _getBuffer ( String topic ) { BlockingQueue < ConsumerRecord < String , byte [ ] > > buffer = topicBuffers . get ( topic ) ; if ( buffer == null ) { buffer = new LinkedBlockingQueue < ConsumerRecord < String , byte [ ] > > ( ) ; BlockingQueue < ConsumerRecord < String , byte [ ] > > existingBuffer = topicBuffers . putIfAbsent ( topic , buffer ) ; if ( existingBuffer != null ) { buffer = existingBuffer ; } } return buffer ; }
|
Gets a buffer to store consumed messages from a Kafka topic .
|
1,809
|
private KafkaMsgConsumerWorker _getWorker ( String topic , boolean autoCommitOffsets ) { KafkaMsgConsumerWorker worker = topicWorkers . get ( topic ) ; if ( worker == null ) { Collection < IKafkaMessageListener > msgListeners = topicMsgListeners . get ( topic ) ; worker = new KafkaMsgConsumerWorker ( this , topic , msgListeners , executorService ) ; KafkaMsgConsumerWorker existingWorker = topicWorkers . putIfAbsent ( topic , worker ) ; if ( existingWorker != null ) { worker = existingWorker ; } else { worker . start ( ) ; } } return worker ; }
|
Prepares a worker to consume messages from a Kafka topic .
|
1,810
|
public boolean addMessageListener ( String topic , IKafkaMessageListener messageListener , boolean autoCommitOffsets ) { synchronized ( topicMsgListeners ) { if ( topicMsgListeners . put ( topic , messageListener ) ) { _getWorker ( topic , autoCommitOffsets ) ; return true ; } } return false ; }
|
Adds a message listener to a topic .
|
1,811
|
private void _fetch ( BlockingQueue < ConsumerRecord < String , byte [ ] > > buffer , String topic , long waitTime , TimeUnit waitTimeUnit ) { KafkaConsumer < String , byte [ ] > consumer = _getConsumer ( topic ) ; synchronized ( consumer ) { _checkAndSubscribe ( consumer , topic ) ; Set < String > subscription = consumer . subscription ( ) ; ConsumerRecords < String , byte [ ] > crList = subscription != null && subscription . contains ( topic ) ? consumer . poll ( waitTimeUnit . toMillis ( waitTime ) ) : null ; if ( crList != null ) { for ( ConsumerRecord < String , byte [ ] > cr : crList ) { buffer . offer ( cr ) ; } } } }
|
Fetches messages from Kafka and puts into buffer .
|
1,812
|
public static boolean seekToBeginning ( KafkaConsumer < ? , ? > consumer , String topic ) { boolean result = false ; synchronized ( consumer ) { Set < TopicPartition > topicParts = consumer . assignment ( ) ; if ( topicParts != null ) { for ( TopicPartition tp : topicParts ) { if ( StringUtils . equals ( topic , tp . topic ( ) ) ) { consumer . seekToBeginning ( Arrays . asList ( tp ) ) ; consumer . position ( tp ) ; result = true ; } } if ( result ) { consumer . commitSync ( ) ; } } } return result ; }
|
Seeks the consumer s cursor to the beginning of a topic .
|
1,813
|
public static Properties buildKafkaProducerProps ( ProducerType type , String bootstrapServers ) { return buildKafkaProducerProps ( type , bootstrapServers , null ) ; }
|
Builds default producer s properties .
|
1,814
|
public static Properties buildKafkaConsumerProps ( String bootstrapServers , String consumerGroupId , boolean consumeFromBeginning , boolean autoCommitOffsets ) { return buildKafkaConsumerProps ( bootstrapServers , consumerGroupId , consumeFromBeginning , autoCommitOffsets , null ) ; }
|
Builds default consumer s properties .
|
1,815
|
private Document loadDocument ( String file ) { Document doc = null ; URL url = null ; File f = new File ( file ) ; if ( f . exists ( ) ) { try { url = f . toURI ( ) . toURL ( ) ; } catch ( MalformedURLException e ) { throw new ConfigurationException ( "Unable to load " + file , e ) ; } } if ( url == null ) { url = ClassLoader . getSystemResource ( file ) ; } InputStream is = null ; if ( url == null ) { if ( errorIfMissing ) { throw new ConfigurationException ( "Could not open files of the name " + file ) ; } else { LOG . info ( "Unable to locate configuration files of the name " + file + ", skipping" ) ; return doc ; } } try { is = url . openStream ( ) ; InputSource in = new InputSource ( is ) ; in . setSystemId ( url . toString ( ) ) ; doc = DomHelper . parse ( in , dtdMappings ) ; } catch ( Exception e ) { throw new ConfigurationException ( "Unable to load " + file , e ) ; } finally { try { is . close ( ) ; } catch ( IOException e ) { LOG . error ( "Unable to close input stream" , e ) ; } } if ( doc != null ) { LOG . debug ( "Wallmod configuration parsed" ) ; } return doc ; }
|
Load the XML configuration on memory as a DOM structure with SAX . Additional information about elements location is added . Non valid DTDs or XML structures are detected .
|
1,816
|
public void initIvy ( ) throws ParseException , IOException , ConfigurationException { if ( ivy == null ) { IvySettings ivySettings = new IvySettings ( ) ; File settingsFile = new File ( IVY_SETTINGS_FILE ) ; if ( settingsFile . exists ( ) ) { ivySettings . load ( settingsFile ) ; } else { URL settingsURL = ClassLoader . getSystemResource ( IVY_SETTINGS_FILE ) ; if ( settingsURL == null ) { settingsURL = this . getClass ( ) . getClassLoader ( ) . getResource ( IVY_SETTINGS_FILE ) ; if ( settingsURL == null ) throw new ConfigurationException ( "Ivy settings file (" + IVY_SETTINGS_FILE + ") could not be found in classpath" ) ; } ivySettings . load ( settingsURL ) ; } ivy = Ivy . newInstance ( ivySettings ) ; } ivyfile = File . createTempFile ( "ivy" , ".xml" ) ; ivyfile . deleteOnExit ( ) ; applyVerbose ( ) ; String [ ] confs = new String [ ] { "default" } ; resolveOptions = new ResolveOptions ( ) . setConfs ( confs ) ; if ( isOffLine ) { resolveOptions = resolveOptions . setUseCacheOnly ( true ) ; } else { Map < String , Object > params = configuration . getParameters ( ) ; if ( params != null ) { Object value = params . get ( "offline" ) ; if ( value != null ) { String offlineOpt = value . toString ( ) ; if ( offlineOpt != null ) { boolean offline = Boolean . parseBoolean ( offlineOpt ) ; if ( offline ) { resolveOptions = resolveOptions . setUseCacheOnly ( true ) ; } } } } } }
|
Ivy configuration initialization
|
1,817
|
private ConfigurationProvider locateConfigurationProvider ( ) { if ( configurationProvider == null ) return new IvyConfigurationProvider ( options . isOffline ( ) , options . isVerbose ( ) ) ; else return configurationProvider ; }
|
Takes care of chosing the proper configuration provider
|
1,818
|
public List < File > patch ( String ... chains ) throws InvalidConfigurationException { final List < File > result = new LinkedList < File > ( ) ; run ( result , new WalkmodCommand ( ) { public void execute ( Options options , File executionDir , String ... chains ) throws Exception { WalkModFacade facade = new WalkModFacade ( OptionsBuilder . options ( options ) . executionDirectory ( executionDir ) . build ( ) ) ; result . addAll ( facade . patch ( chains ) ) ; } } , ExecutionModeEnum . PATCH , chains ) ; return result ; }
|
Generates a list of patches according the transformation chains
|
1,819
|
public void init ( ) throws Exception { userDir = new File ( System . getProperty ( "user.dir" ) ) . getAbsolutePath ( ) ; System . setProperty ( "user.dir" , options . getExecutionDirectory ( ) . getAbsolutePath ( ) ) ; if ( ! cfg . exists ( ) ) { ConfigurationManager manager = new ConfigurationManager ( cfg , false , locateConfigurationProvider ( ) ) ; try { manager . runProjectConfigurationInitializers ( ) ; if ( options . isVerbose ( ) ) { log . info ( "CONFIGURATION FILE [" + cfg . getAbsolutePath ( ) + "] CREATION COMPLETE" ) ; } } catch ( IOException aux ) { if ( options . isVerbose ( ) ) { log . error ( "The system can't create the file [ " + cfg . getAbsolutePath ( ) + "]" ) ; } if ( options . isThrowException ( ) ) { System . setProperty ( "user.dir" , userDir ) ; throw aux ; } } } else { if ( options . isVerbose ( ) ) { log . error ( "The configuration file [" + cfg . getAbsolutePath ( ) + "] already exists" ) ; } } System . setProperty ( "user.dir" , userDir ) ; }
|
Initializes an empty walkmod configuration file
|
1,820
|
public void addChainConfig ( ChainConfig chainCfg , boolean recursive , String before ) throws Exception { long startTime = System . currentTimeMillis ( ) ; Exception exception = null ; if ( ! cfg . exists ( ) ) { init ( ) ; } userDir = new File ( System . getProperty ( "user.dir" ) ) . getAbsolutePath ( ) ; System . setProperty ( "user.dir" , options . getExecutionDirectory ( ) . getAbsolutePath ( ) ) ; try { ConfigurationManager manager = new ConfigurationManager ( cfg , false ) ; ProjectConfigurationProvider cfgProvider = manager . getProjectConfigurationProvider ( ) ; cfgProvider . addChainConfig ( chainCfg , recursive , before ) ; } catch ( Exception e ) { exception = e ; } finally { System . setProperty ( "user.dir" , userDir ) ; updateMsg ( startTime , exception ) ; } }
|
Adds a new chain configuration into the configuration file
|
1,821
|
public void addTransformationConfig ( String chain , String path , boolean recursive , TransformationConfig transformationCfg , Integer order , String before ) throws Exception { long startTime = System . currentTimeMillis ( ) ; Exception exception = null ; if ( ! cfg . exists ( ) ) { init ( ) ; } userDir = new File ( System . getProperty ( "user.dir" ) ) . getAbsolutePath ( ) ; System . setProperty ( "user.dir" , options . getExecutionDirectory ( ) . getAbsolutePath ( ) ) ; try { ConfigurationManager manager = new ConfigurationManager ( cfg , false ) ; ProjectConfigurationProvider cfgProvider = manager . getProjectConfigurationProvider ( ) ; cfgProvider . addTransformationConfig ( chain , path , transformationCfg , recursive , order , before ) ; } catch ( Exception e ) { exception = e ; } finally { System . setProperty ( "user.dir" , userDir ) ; updateMsg ( startTime , exception ) ; } }
|
Adds a new transformation configuration into the configuration file
|
1,822
|
public void setReader ( String chain , String type , String path , boolean recursive , Map < String , String > params ) throws Exception { if ( ( type != null && ! "" . equals ( type . trim ( ) ) ) || ( path != null && ! "" . equals ( path . trim ( ) ) ) ) { long startTime = System . currentTimeMillis ( ) ; Exception exception = null ; if ( ! cfg . exists ( ) ) { init ( ) ; } userDir = new File ( System . getProperty ( "user.dir" ) ) . getAbsolutePath ( ) ; System . setProperty ( "user.dir" , options . getExecutionDirectory ( ) . getAbsolutePath ( ) ) ; try { ConfigurationManager manager = new ConfigurationManager ( cfg , false ) ; ProjectConfigurationProvider cfgProvider = manager . getProjectConfigurationProvider ( ) ; cfgProvider . setReader ( chain , type , path , recursive , params ) ; } catch ( Exception e ) { exception = e ; } finally { System . setProperty ( "user.dir" , userDir ) ; updateMsg ( startTime , exception ) ; } } }
|
Sets an specific reader for an specific chain .
|
1,823
|
public void removePluginConfig ( PluginConfig pluginConfig , boolean recursive ) throws Exception { long startTime = System . currentTimeMillis ( ) ; Exception exception = null ; if ( ! cfg . exists ( ) ) { init ( ) ; } userDir = new File ( System . getProperty ( "user.dir" ) ) . getAbsolutePath ( ) ; System . setProperty ( "user.dir" , options . getExecutionDirectory ( ) . getAbsolutePath ( ) ) ; try { ConfigurationManager manager = new ConfigurationManager ( cfg , false ) ; ProjectConfigurationProvider cfgProvider = manager . getProjectConfigurationProvider ( ) ; cfgProvider . removePluginConfig ( pluginConfig , recursive ) ; } catch ( Exception e ) { exception = e ; } finally { System . setProperty ( "user.dir" , userDir ) ; updateMsg ( startTime , exception ) ; } }
|
Removes a plugin from the configuration file .
|
1,824
|
public void removeModules ( List < String > modules ) throws Exception { long startTime = System . currentTimeMillis ( ) ; Exception exception = null ; if ( ! cfg . exists ( ) ) { init ( ) ; } userDir = new File ( System . getProperty ( "user.dir" ) ) . getAbsolutePath ( ) ; System . setProperty ( "user.dir" , options . getExecutionDirectory ( ) . getAbsolutePath ( ) ) ; try { ConfigurationManager manager = new ConfigurationManager ( cfg , false ) ; ProjectConfigurationProvider cfgProvider = manager . getProjectConfigurationProvider ( ) ; cfgProvider . removeModules ( modules ) ; } catch ( Exception e ) { exception = e ; } finally { System . setProperty ( "user.dir" , userDir ) ; updateMsg ( startTime , exception ) ; } }
|
Removes the module list from the configuration file
|
1,825
|
public Configuration getConfiguration ( ) throws Exception { Configuration result = null ; if ( cfg . exists ( ) ) { userDir = new File ( System . getProperty ( "user.dir" ) ) . getAbsolutePath ( ) ; System . setProperty ( "user.dir" , options . getExecutionDirectory ( ) . getAbsolutePath ( ) ) ; try { ConfigurationManager manager = new ConfigurationManager ( cfg , false ) ; manager . executeConfigurationProviders ( ) ; result = manager . getConfiguration ( ) ; } finally { System . setProperty ( "user.dir" , userDir ) ; } } return result ; }
|
Returns the equivalent configuration representation of the Walkmod config file .
|
1,826
|
public void removeChains ( List < String > chains , boolean recursive ) throws Exception { long startTime = System . currentTimeMillis ( ) ; Exception exception = null ; if ( cfg . exists ( ) ) { userDir = new File ( System . getProperty ( "user.dir" ) ) . getAbsolutePath ( ) ; System . setProperty ( "user.dir" , options . getExecutionDirectory ( ) . getAbsolutePath ( ) ) ; try { ConfigurationManager manager = new ConfigurationManager ( cfg , false ) ; manager . getProjectConfigurationProvider ( ) . removeChains ( chains , recursive ) ; } catch ( Exception e ) { exception = e ; } finally { System . setProperty ( "user.dir" , userDir ) ; updateMsg ( startTime , exception ) ; } } }
|
Removes the chains from the Walkmod config file .
|
1,827
|
public List < BeanDefinition > inspectPlugin ( PluginConfig plugin ) { Configuration conf = new ConfigurationImpl ( ) ; Collection < PluginConfig > plugins = new LinkedList < PluginConfig > ( ) ; plugins . add ( plugin ) ; conf . setPlugins ( plugins ) ; ConfigurationManager manager = new ConfigurationManager ( conf , false , locateConfigurationProvider ( ) ) ; manager . executeConfigurationProviders ( ) ; return conf . getAvailableBeans ( plugin ) ; }
|
Retrieves the bean definitions that contains an specific plugin .
|
1,828
|
public void addConfigurationParameter ( String param , String value , String type , String category , String name , String chain , boolean recursive ) throws Exception { long startTime = System . currentTimeMillis ( ) ; Exception exception = null ; if ( cfg . exists ( ) ) { userDir = new File ( System . getProperty ( "user.dir" ) ) . getAbsolutePath ( ) ; System . setProperty ( "user.dir" , options . getExecutionDirectory ( ) . getAbsolutePath ( ) ) ; try { ConfigurationManager manager = new ConfigurationManager ( cfg , false ) ; manager . getProjectConfigurationProvider ( ) . addConfigurationParameter ( param , value , type , category , name , chain , recursive ) ; } catch ( Exception e ) { exception = e ; } finally { System . setProperty ( "user.dir" , userDir ) ; updateMsg ( startTime , exception ) ; } } }
|
Sets an specific parameter value into a bean .
|
1,829
|
public void addIncludesToChain ( String chain , List < String > includes , boolean recursive , boolean setToReader , boolean setToWriter ) { long startTime = System . currentTimeMillis ( ) ; Exception exception = null ; if ( cfg . exists ( ) ) { userDir = new File ( System . getProperty ( "user.dir" ) ) . getAbsolutePath ( ) ; System . setProperty ( "user.dir" , options . getExecutionDirectory ( ) . getAbsolutePath ( ) ) ; try { ConfigurationManager manager = new ConfigurationManager ( cfg , false ) ; manager . getProjectConfigurationProvider ( ) . addIncludesToChain ( chain , includes , recursive , setToReader , setToWriter ) ; } catch ( Exception e ) { exception = e ; } finally { System . setProperty ( "user.dir" , userDir ) ; updateMsg ( startTime , exception ) ; } } }
|
Adds a list of includes rules into a chain
|
1,830
|
public static URL getResource ( String resourceName , Class < ? > callingClass ) { URL url = Thread . currentThread ( ) . getContextClassLoader ( ) . getResource ( resourceName ) ; if ( url == null ) { url = ClassLoaderUtil . class . getClassLoader ( ) . getResource ( resourceName ) ; } if ( url == null ) { ClassLoader cl = callingClass . getClassLoader ( ) ; if ( cl != null ) { url = cl . getResource ( resourceName ) ; } } if ( ( url == null ) && ( resourceName != null ) && ( ( resourceName . length ( ) == 0 ) || ( resourceName . charAt ( 0 ) != '/' ) ) ) { return getResource ( '/' + resourceName , callingClass ) ; } return url ; }
|
Load a given resource .
|
1,831
|
public static Attributes addLocationAttributes ( Locator locator , Attributes attrs ) { if ( locator == null || attrs . getIndex ( URI , SRC_ATTR ) != - 1 ) { return attrs ; } AttributesImpl newAttrs = attrs instanceof AttributesImpl ? ( AttributesImpl ) attrs : new AttributesImpl ( attrs ) ; return newAttrs ; }
|
Add location attributes to a set of SAX attributes .
|
1,832
|
public static void remove ( Element elem , boolean recurse ) { elem . removeAttributeNS ( URI , SRC_ATTR ) ; elem . removeAttributeNS ( URI , LINE_ATTR ) ; elem . removeAttributeNS ( URI , COL_ATTR ) ; if ( recurse ) { NodeList children = elem . getChildNodes ( ) ; for ( int i = 0 ; i < children . getLength ( ) ; i ++ ) { Node child = children . item ( i ) ; if ( child . getNodeType ( ) == Node . ELEMENT_NODE ) { remove ( ( Element ) child , recurse ) ; } } } }
|
Remove the location attributes from a DOM element .
|
1,833
|
public KafkaClient setProducerProperties ( Properties props ) { if ( props == null ) { producerProperties = null ; } else { producerProperties = new Properties ( ) ; producerProperties . putAll ( props ) ; } return this ; }
|
Sets custom producer configuration properties .
|
1,834
|
public boolean addMessageListener ( String consumerGroupId , boolean consumeFromBeginning , String topic , IKafkaMessageListener messageListener ) { KafkaMsgConsumer kafkaConsumer = getKafkaConsumer ( consumerGroupId , consumeFromBeginning ) ; return kafkaConsumer . addMessageListener ( topic , messageListener ) ; }
|
Adds a message listener for a topic .
|
1,835
|
public void flush ( ) { for ( ProducerType type : ProducerType . ALL_TYPES ) { KafkaProducer < String , byte [ ] > producer = getJavaProducer ( type ) ; if ( producer != null ) { producer . flush ( ) ; } } }
|
Flushes any messages in producer queue .
|
1,836
|
public OptionsBuilder path ( String path ) { options . put ( Options . CHAIN_PATH , path != null ? path : DEFAULT_PATH ) ; return this ; }
|
Sets the path option . Null value resets to default value .
|
1,837
|
public OptionsBuilder dynamicArgs ( Map < String , ? > dynamicArgs ) { final Map < String , Object > m = dynamicArgs != null ? Collections . unmodifiableMap ( new HashMap < String , Object > ( dynamicArgs ) ) : Collections . < String , Object > emptyMap ( ) ; options . put ( Options . DYNAMIC_ARGS , m ) ; return this ; }
|
Seths the dynamic arguments
|
1,838
|
public OptionsBuilder executionDirectory ( File executionDirectory ) { options . put ( Options . EXECUTION_DIRECTORY , executionDirectory != null ? executionDirectory : defaultExecutionDirectory ( ) ) ; return this ; }
|
Sets the execution directory
|
1,839
|
public OptionsBuilder configurationFile ( String configFile ) { if ( configFile != null ) { options . put ( Options . CONFIGURATION_FILE , new File ( configFile ) ) ; } else { options . remove ( Options . CONFIGURATION_FILE ) ; } return this ; }
|
Sets the walkmod configuration file .
|
1,840
|
private void injectServletCallback ( String method ) { Label tryStart = new Label ( ) ; Label tryEnd = new Label ( ) ; Label catchStart = new Label ( ) ; Label catchEnd = new Label ( ) ; visitTryCatchBlock ( tryStart , tryEnd , catchStart , "java/lang/NoClassDefFoundError" ) ; mark ( tryStart ) ; loadArgs ( ) ; invokeStatic ( Type . getType ( SERVLET_CALLBACK_TYPE ) , Method . getMethod ( method ) ) ; mark ( tryEnd ) ; visitJumpInsn ( GOTO , catchEnd ) ; mark ( catchStart ) ; pop ( ) ; mark ( catchEnd ) ; }
|
Inject a callback to our servlet handler .
|
1,841
|
public static double getTotalGCPercentage ( ) { long totalCollectionTime = getTotalCollectionTime ( ) ; if ( totalCollectionTime == - 1 ) { return - 1.0 ; } long uptime = ManagementFactory . getRuntimeMXBean ( ) . getUptime ( ) ; return ( ( double ) totalCollectionTime / ( double ) uptime ) ; }
|
Returns the time spent in GC as a proportion of the time elapsed since the JVM was started . If no data is available returns - 1 .
|
1,842
|
public static void premain ( String agentArgs , Instrumentation inst ) { try { String bootDelegation = System . getProperty ( OSGI_BOOTDELEGATION_PROPERTY , "" ) ; if ( ! bootDelegation . equals ( "" ) ) { bootDelegation += "," ; } bootDelegation += BOOTDELEGATION_PACKAGES ; System . setProperty ( OSGI_BOOTDELEGATION_PROPERTY , bootDelegation ) ; } catch ( Exception e ) { } try { String jarUrl = ( Agent . class . getResource ( "Agent.class" ) . toString ( ) ) ; int jarIndex = jarUrl . indexOf ( JAR_URL ) ; if ( jarIndex == - 1 ) { System . err . println ( "Javametrics: Unable to start javaagent: Agent class not loaded from jar: " + jarUrl ) ; return ; } String libUrl = jarUrl . substring ( 0 , jarIndex ) ; int jmIndex = libUrl . lastIndexOf ( JAVAMETRICS ) ; libUrl = jarUrl . substring ( 0 , jmIndex ) ; String jarName = jarUrl . substring ( jmIndex , jarIndex + JAR_URL . length ( ) ) ; URL [ ] urls = { new URL ( libUrl + jarName ) , new URL ( libUrl + ASM_JAR_URL ) , new URL ( libUrl + ASM_COMMONS_JAR_URL ) } ; URLClassLoader ucl = new URLClassLoader ( urls ) { public Class < ? > loadClass ( String name ) throws ClassNotFoundException { try { return findClass ( name ) ; } catch ( ClassNotFoundException cnf ) { } return super . loadClass ( name ) ; } } ; Class < ? > cl = ucl . loadClass ( CLASSTRANSFORMER_CLASS ) ; inst . addTransformer ( ( ClassFileTransformer ) cl . newInstance ( ) ) ; } catch ( NoClassDefFoundError ncdfe ) { System . err . println ( "Javametrics: Unable to start javaagent: " + ncdfe ) ; ncdfe . printStackTrace ( ) ; } catch ( Exception e ) { System . err . println ( "Javametrics: Unable to start javaagent: " + e ) ; e . printStackTrace ( ) ; } }
|
Entry point for the agent via - javaagent command line parameter
|
1,843
|
private void visitHttp ( int version , int access , String name , String signature , String superName , String [ ] interfaces ) { if ( interfaces != null ) { for ( String iface : interfaces ) { if ( HTTP_JSP_INTERFACE . equals ( iface ) ) { jspImplementers . add ( name ) ; httpInstrumentJsp = true ; if ( Agent . debug ) { System . err . println ( "Javametrics: " + name + " implements " + HTTP_JSP_INTERFACE ) ; } } } } if ( jspImplementers . contains ( superName ) ) { jspImplementers . add ( name ) ; httpInstrumentJsp = true ; if ( Agent . debug ) { System . err . println ( "Javametrics: " + name + " extends " + superName + " that implements " + HTTP_JSP_INTERFACE ) ; } } if ( ! httpInstrumentJsp && servletExtenders . contains ( superName ) ) { servletExtenders . add ( name ) ; httpInstrumentServlet = true ; if ( Agent . debug ) { System . err . println ( "Javametrics: " + name + " extends " + superName ) ; } } }
|
Check if HTTP request instrumentation is required
|
1,844
|
private MethodVisitor visitHttpMethod ( MethodVisitor mv , int access , String name , String desc , String signature , String [ ] exceptions ) { MethodVisitor httpMv = mv ; if ( ( httpInstrumentJsp && name . equals ( "_jspService" ) ) || ( httpInstrumentServlet && ( name . equals ( "doGet" ) || name . equals ( "doPost" ) || name . equals ( "service" ) ) ) ) { if ( HTTP_REQUEST_METHOD_DESC . equals ( desc ) ) { httpMv = new ServletCallBackAdapter ( className , mv , access , name , desc ) ; } } return httpMv ; }
|
Instrument HTTP request methods
|
1,845
|
protected void injectMethodTimer ( ) { methodEntertime = newLocal ( Type . LONG_TYPE ) ; invokeStatic ( Type . getType ( System . class ) , Method . getMethod ( CURRENT_TIME_MILLIS_METHODNAME ) ) ; storeLocal ( methodEntertime ) ; if ( Agent . debug ) { getStatic ( Type . getType ( System . class ) , "err" , Type . getType ( PrintStream . class ) ) ; push ( "Javametrics: Calling instrumented method: " + className + "." + methodName ) ; invokeVirtual ( Type . getType ( PrintStream . class ) , Method . getMethod ( "void println(java.lang.String)" ) ) ; } }
|
Inject a local variable containing timestamp at method entry
|
1,846
|
public void setSupplementaryDataValue ( String name , String value ) { supplementaryData . put ( name , value ) ; }
|
Setter for supplementary data value .
|
1,847
|
public boolean isHashValid ( String secret ) { String generatedHash = generateHash ( secret ) ; return generatedHash . equals ( this . hash ) ; }
|
Helper method to determine if the HPP response security hash is valid .
|
1,848
|
public static void validate ( HppRequest hppRequest ) { Set < ConstraintViolation < HppRequest > > constraintViolations = validator . validate ( hppRequest ) ; if ( constraintViolations . size ( ) > 0 ) { List < String > validationMessages = new ArrayList < String > ( ) ; Iterator < ConstraintViolation < HppRequest > > i = constraintViolations . iterator ( ) ; while ( i . hasNext ( ) ) { ConstraintViolation < HppRequest > constraitViolation = i . next ( ) ; validationMessages . add ( constraitViolation . getMessage ( ) ) ; } LOGGER . info ( "HppRequest failed validation with the following errors {}" , validationMessages ) ; throw new RealexValidationException ( "HppRequest failed validation" , validationMessages ) ; } }
|
Method validates HPP request object using JSR - 303 bean validation .
|
1,849
|
public static void validate ( HppResponse hppResponse , String secret ) { if ( ! hppResponse . isHashValid ( secret ) ) { LOGGER . error ( "HppResponse contains an invalid security hash." ) ; throw new RealexValidationException ( "HppResponse contains an invalid security hash" ) ; } }
|
Method validates HPP response hash .
|
1,850
|
public HppRequest addAutoSettleFlag ( boolean autoSettleFlag ) { this . autoSettleFlag = autoSettleFlag ? Flag . TRUE . getFlag ( ) : Flag . FALSE . getFlag ( ) ; return this ; }
|
Helper method to add autop settle flag .
|
1,851
|
public HppRequest addReturnTss ( boolean returnTss ) { this . returnTss = returnTss ? Flag . TRUE . getFlag ( ) : Flag . FALSE . getFlag ( ) ; return this ; }
|
Helper method to add return TSS .
|
1,852
|
public HppRequest addCardStorageEnable ( boolean cardStorageEnable ) { this . cardStorageEnable = cardStorageEnable ? Flag . TRUE . getFlag ( ) : Flag . FALSE . getFlag ( ) ; return this ; }
|
Helper method to add card storage enable flag .
|
1,853
|
public HppRequest addOfferSaveCard ( boolean offerSaveCard ) { this . offerSaveCard = offerSaveCard ? Flag . TRUE . getFlag ( ) : Flag . FALSE . getFlag ( ) ; return this ; }
|
Helper method to add offer to save card .
|
1,854
|
public HppRequest addPayerExists ( boolean payerExists ) { this . payerExists = payerExists ? Flag . TRUE . getFlag ( ) : Flag . FALSE . getFlag ( ) ; return this ; }
|
Helper method to add payer exists flag .
|
1,855
|
public HppRequest addSupplementaryDataValue ( String name , String value ) { supplementaryData . put ( name , value ) ; return this ; }
|
Helper method to add supplementary data .
|
1,856
|
public HppRequest addValidateCardOnly ( boolean validateCardOnly ) { this . validateCardOnly = validateCardOnly ? Flag . TRUE . getFlag ( ) : Flag . FALSE . getFlag ( ) ; return this ; }
|
Helper method to add validate card only flag .
|
1,857
|
public HppRequest addDccEnable ( boolean dccEnable ) { this . dccEnable = dccEnable ? Flag . TRUE . getFlag ( ) : Flag . FALSE . getFlag ( ) ; return this ; }
|
Helper method to add DCC enable flag .
|
1,858
|
public HppRequest generateDefaults ( String secret ) { if ( null == this . timeStamp || "" . equals ( this . timeStamp ) ) { this . timeStamp = GenerationUtils . generateTimestamp ( ) ; } if ( null == this . orderId || "" . equals ( this . orderId ) ) { this . orderId = GenerationUtils . generateOrderId ( ) ; } hash ( secret ) ; return this ; }
|
Generates default values for fields such as hash timestamp and order ID .
|
1,859
|
public ServerFilter groups ( Group ... groups ) { allItemsNotNull ( groups , "Groups" ) ; groupFilter = groupFilter . and ( Filter . or ( map ( groups , Group :: asFilter ) ) ) ; return this ; }
|
Method allow to restrict searched servers by groups
|
1,860
|
public ServerFilter where ( Predicate < ServerMetadata > filter ) { checkNotNull ( filter , "Filter must be not a null" ) ; predicate = predicate . and ( filter ) ; return this ; }
|
Method allow to specify custom search servers predicate
|
1,861
|
public ServerFilter nameContains ( String ... subStrings ) { allItemsNotNull ( subStrings , "Name keywords" ) ; predicate = predicate . and ( combine ( ServerMetadata :: getName , in ( asList ( subStrings ) , Predicates :: containsIgnoreCase ) ) ) ; return this ; }
|
Method allow to restrict servers by keywords that contains in target server name . Matching is case insensitive . Comparison use search substring algorithms .
|
1,862
|
public ServerFilter descriptionContains ( String ... subStrings ) { allItemsNotNull ( subStrings , "Description keywords" ) ; predicate = predicate . and ( combine ( ServerMetadata :: getDescription , in ( asList ( subStrings ) , Predicates :: containsIgnoreCase ) ) ) ; return this ; }
|
Method allow to find server that description contains one of specified keywords . Matching is case insensitive .
|
1,863
|
public ServerFilter powerStates ( PowerState ... states ) { allItemsNotNull ( states , "Power states" ) ; predicate = predicate . and ( combine ( s -> s . getDetails ( ) . getPowerState ( ) , in ( map ( states , PowerState :: getCode ) ) ) ) ; return this ; }
|
Method allow to find servers with specified power state of target servers
|
1,864
|
public NetworkFilter nameContains ( String ... subStrings ) { checkNotNull ( subStrings , "Name match criteria must be not a null" ) ; predicate = predicate . and ( combine ( NetworkMetadata :: getName , in ( asList ( subStrings ) , Predicates :: containsIgnoreCase ) ) ) ; return this ; }
|
Method allow to filter networks by key phrase that contains in its name . Filtering will be case insensitive and will use substring matching .
|
1,865
|
public NetworkFilter names ( String ... names ) { checkNotNull ( names , "Name match criteria must be not a null" ) ; predicate = predicate . and ( combine ( NetworkMetadata :: getName , in ( asList ( names ) , Predicates :: containsIgnoreCase ) ) ) ; return this ; }
|
Method allow to filter networks by names . Filtering will be case insensitive and will use string equality comparison .
|
1,866
|
public NetworkFilter where ( Predicate < NetworkMetadata > filter ) { checkNotNull ( filter , "Filter predicate must be not a null" ) ; this . predicate = this . predicate . and ( filter ) ; return this ; }
|
Method allow to filter networks using predicate .
|
1,867
|
public GroupFilter dataCentersWhere ( Predicate < DataCenterMetadata > predicate ) { dataCenterFilter . where ( dataCenterFilter . getPredicate ( ) . or ( predicate ) ) ; return this ; }
|
Method allow to provide filtering predicate that restrict group by data centers that contains its .
|
1,868
|
public GroupFilter nameContains ( String ... subStrings ) { checkNotNull ( subStrings , "Name match criteria must be not a null" ) ; predicate = predicate . and ( combine ( GroupMetadata :: getName , in ( asList ( subStrings ) , Predicates :: containsIgnoreCase ) ) ) ; return this ; }
|
Method allow to filter groups by key phrase that contains in its name . Filtering will be case insensitive and will use substring matching .
|
1,869
|
public GroupFilter names ( String ... names ) { checkNotNull ( names , "Name match criteria must be not a null" ) ; predicate = predicate . and ( combine ( GroupMetadata :: getName , in ( asList ( names ) , Predicates :: containsIgnoreCase ) ) ) ; return this ; }
|
Method allow to filter groups by names . Filtering will be case insensitive and will use string equality comparison .
|
1,870
|
public GroupFilter where ( Predicate < GroupMetadata > filter ) { checkNotNull ( filter , "Filter predicate must be not a null" ) ; this . predicate = this . predicate . and ( filter ) ; return this ; }
|
Method allow to filter groups using predicate .
|
1,871
|
public AutoscalePolicyFilter nameContains ( String ... names ) { allItemsNotNull ( names , "Autoscale policy names" ) ; predicate = predicate . and ( combine ( AutoscalePolicyMetadata :: getName , in ( asList ( names ) , Predicates :: containsIgnoreCase ) ) ) ; return this ; }
|
Method allow to find autoscale policies that contains some substring in name . Filtering is case insensitive .
|
1,872
|
public AutoscalePolicyFilter names ( String ... names ) { allItemsNotNull ( names , "Autoscale policies names" ) ; predicate = predicate . and ( combine ( AutoscalePolicyMetadata :: getName , in ( names ) ) ) ; return this ; }
|
Method allow to find autoscale policies by its names Filtering is case sensitive .
|
1,873
|
public String getCidr ( ) { if ( cidr != null ) { return cidr ; } if ( ipAddress != null ) { if ( mask != null ) { return new SubnetUtils ( ipAddress , mask ) . getCidrSignature ( ) ; } if ( cidrMask != null ) { return new SubnetUtils ( ipAddress + cidrMask ) . getCidrSignature ( ) ; } } return null ; }
|
Returns IP address in CIDR format .
|
1,874
|
@ Test ( groups = { SAMPLES } ) public void getBillingStatisticsByAllDatacenters ( ) { Statistics summarize = statisticsService . billingStats ( ) . forDataCenters ( new DataCenterFilter ( ) . dataCenters ( DE_FRANKFURT , US_EAST_STERLING ) ) . summarize ( ) ; assertNotNull ( summarize ) ; }
|
Step 1 . App query total billing statistics by all datacenters
|
1,875
|
@ Test ( groups = { SAMPLES } ) public void getBillingStatisticsGroupedByDatacenters ( ) { List < BillingStatsEntry > stats = statisticsService . billingStats ( ) . forGroups ( new GroupFilter ( ) . nameContains ( nameCriteria ) ) . groupByDataCenter ( ) ; assertNotNull ( stats ) ; }
|
Step 2 . App query billing statistics grouped by datacenters
|
1,876
|
@ Test ( groups = { SAMPLES } ) public void getDE1BillingStatsGroupedByServers ( ) { List < BillingStatsEntry > stats = statisticsService . billingStats ( ) . forDataCenters ( new DataCenterFilter ( ) . dataCenters ( DE_FRANKFURT ) ) . groupByServer ( ) ; assertNotNull ( stats ) ; }
|
Step 3 . App query billing statistics grouped by servers within DE1 Datacenter
|
1,877
|
@ Test ( groups = { SAMPLES } ) public void getMonitoringStatisticsByAllDatacenters ( ) { List < MonitoringStatsEntry > summarize = statisticsService . monitoringStats ( ) . forDataCenters ( new DataCenterFilter ( ) . dataCenters ( DE_FRANKFURT , US_EAST_STERLING ) ) . forTime ( new ServerMonitoringFilter ( ) . last ( Duration . ofDays ( 2 ) ) ) . summarize ( ) ; assertNotNull ( summarize ) ; }
|
Step 4 . App query total monitoring statistics by all datacenters
|
1,878
|
@ Test ( groups = { SAMPLES } ) public void getMonitoringStatisticsGroupedByDatacenters ( ) { List < MonitoringStatsEntry > stats = statisticsService . monitoringStats ( ) . forGroups ( new GroupFilter ( ) . nameContains ( nameCriteria ) ) . forTime ( new ServerMonitoringFilter ( ) . last ( Duration . ofDays ( 2 ) ) ) . groupByDataCenter ( ) ; assertNotNull ( stats ) ; }
|
Step 5 . App query monitoring statistics grouped by datacenters
|
1,879
|
@ Test ( groups = { SAMPLES } ) public void getDE1MonitoringStatsGroupedByServers ( ) { List < MonitoringStatsEntry > stats = statisticsService . monitoringStats ( ) . forDataCenters ( new DataCenterFilter ( ) . dataCenters ( DE_FRANKFURT ) ) . forTime ( new ServerMonitoringFilter ( ) . last ( Duration . ofDays ( 2 ) ) ) . groupByServer ( ) ; groupService . find ( new GroupFilter ( ) . dataCenters ( DataCenter . DE_FRANKFURT ) ) ; assertNotNull ( stats ) ; }
|
Step 6 . App query monitoring statistics grouped by servers within DE1 Datacenter
|
1,880
|
@ Test ( groups = { SAMPLES } ) public void getDE1MonitoringStatsForLastHourGroupedByServers ( ) { List < MonitoringStatsEntry > stats = statisticsService . monitoringStats ( ) . forDataCenters ( new DataCenterFilter ( ) . dataCenters ( DE_FRANKFURT ) ) . forTime ( new ServerMonitoringFilter ( ) . last ( Duration . ofHours ( 1 ) ) . type ( MonitoringType . REALTIME ) . interval ( Duration . ofMinutes ( 10 ) ) ) . groupByDataCenter ( ) ; assertNotNull ( stats ) ; }
|
Step 7 . App query monitoring statistics for last hour grouped by DataCenter
|
1,881
|
@ Test ( groups = { SAMPLES } ) public void getInvoiceDataForPreviousMonth ( ) { InvoiceData invoice = invoiceService . getInvoice ( LocalDate . now ( ) . minusMonths ( 1 ) ) ; assertNotNull ( invoice ) ; }
|
Step 8 . App query invoice statistics for previous month
|
1,882
|
@ Test ( groups = { SAMPLES } ) public void getInvoiceDataForStartOf2015 ( ) { InvoiceData invoice = invoiceService . getInvoice ( 2015 , 1 ) ; assertNotNull ( invoice ) ; }
|
Step 8 . App query invoice statistics for Jan - 15
|
1,883
|
public OperationFuture < LoadBalancer > create ( LoadBalancerConfig config ) { String dataCenterId = dataCenterService . findByRef ( config . getDataCenter ( ) ) . getId ( ) ; LoadBalancerMetadata loadBalancer = loadBalancerClient . create ( dataCenterId , new LoadBalancerRequest ( ) . name ( config . getName ( ) ) . description ( config . getDescription ( ) ) . status ( config . getStatus ( ) ) ) ; LoadBalancer loadBalancerRef = LoadBalancer . refById ( loadBalancer . getId ( ) , DataCenter . refById ( dataCenterId ) ) ; return new OperationFuture < > ( loadBalancerRef , new SequentialJobsFuture ( ( ) -> new CreateLoadBalancerJobFuture ( this , loadBalancerRef ) , ( ) -> addLoadBalancerPools ( config , loadBalancerRef ) ) ) ; }
|
Create load balancer
|
1,884
|
public OperationFuture < LoadBalancer > update ( LoadBalancer loadBalancer , LoadBalancerConfig config ) { LoadBalancerMetadata loadBalancerMetadata = findByRef ( loadBalancer ) ; loadBalancerClient . update ( loadBalancerMetadata . getDataCenterId ( ) , loadBalancerMetadata . getId ( ) , new LoadBalancerRequest ( ) . name ( config . getName ( ) ) . description ( config . getDescription ( ) ) . status ( config . getStatus ( ) ) ) ; return new OperationFuture < > ( loadBalancer , updateLoadBalancerPools ( config , LoadBalancer . refById ( loadBalancerMetadata . getId ( ) , DataCenter . refById ( loadBalancerMetadata . getDataCenterId ( ) ) ) ) ) ; }
|
Update load balancer
|
1,885
|
public OperationFuture < List < LoadBalancer > > update ( List < LoadBalancer > loadBalancerList , LoadBalancerConfig config ) { loadBalancerList . forEach ( loadBalancer -> update ( loadBalancer , config ) ) ; return new OperationFuture < > ( loadBalancerList , new NoWaitingJobFuture ( ) ) ; }
|
Update load balancer list
|
1,886
|
public OperationFuture < List < LoadBalancer > > update ( LoadBalancerFilter loadBalancerFilter , LoadBalancerConfig config ) { checkNotNull ( loadBalancerFilter , "Load balancer filter must be not null" ) ; List < LoadBalancer > loadBalancerList = findLazy ( loadBalancerFilter ) . map ( metadata -> LoadBalancer . refById ( metadata . getId ( ) , DataCenter . refById ( metadata . getDataCenterId ( ) ) ) ) . collect ( toList ( ) ) ; return update ( loadBalancerList , config ) ; }
|
Update filtered load balancers
|
1,887
|
public OperationFuture < LoadBalancer > delete ( LoadBalancer loadBalancer ) { LoadBalancerMetadata loadBalancerMetadata = findByRef ( loadBalancer ) ; loadBalancerClient . delete ( loadBalancerMetadata . getDataCenterId ( ) , loadBalancerMetadata . getId ( ) ) ; return new OperationFuture < > ( loadBalancer , new NoWaitingJobFuture ( ) ) ; }
|
Delete load balancer
|
1,888
|
public OperationFuture < List < LoadBalancer > > delete ( LoadBalancer ... loadBalancer ) { return delete ( Arrays . asList ( loadBalancer ) ) ; }
|
Delete array of load balancers
|
1,889
|
public OperationFuture < List < LoadBalancer > > delete ( LoadBalancerFilter filter ) { List < LoadBalancer > loadBalancerList = findLazy ( filter ) . map ( metadata -> LoadBalancer . refById ( metadata . getId ( ) , DataCenter . refById ( metadata . getDataCenterId ( ) ) ) ) . collect ( toList ( ) ) ; return delete ( loadBalancerList ) ; }
|
Delete filtered load balancers
|
1,890
|
public OperationFuture < List < LoadBalancer > > delete ( List < LoadBalancer > loadBalancerList ) { List < JobFuture > jobs = loadBalancerList . stream ( ) . map ( reference -> delete ( reference ) . jobFuture ( ) ) . collect ( toList ( ) ) ; return new OperationFuture < > ( loadBalancerList , new ParallelJobsFuture ( jobs ) ) ; }
|
Delete load balancer list
|
1,891
|
public OperationFuture < FirewallPolicy > create ( FirewallPolicyConfig config ) { String dataCenterId = dataCenterService . findByRef ( config . getDataCenter ( ) ) . getId ( ) ; FirewallPolicyMetadata firewall = firewallPolicyClient . create ( dataCenterId , composeFirewallPolicyRequest ( config ) ) ; return new OperationFuture < > ( FirewallPolicy . refById ( firewall . getId ( ) , DataCenter . refById ( dataCenterId ) ) , new NoWaitingJobFuture ( ) ) ; }
|
Create firewall policy
|
1,892
|
public OperationFuture < FirewallPolicy > update ( FirewallPolicy firewallPolicy , FirewallPolicyConfig config ) { FirewallPolicyMetadata metadata = findByRef ( firewallPolicy ) ; firewallPolicyClient . update ( metadata . getDataCenterId ( ) , metadata . getId ( ) , composeFirewallPolicyRequest ( config ) ) ; return new OperationFuture < > ( firewallPolicy , new NoWaitingJobFuture ( ) ) ; }
|
Update firewall policy
|
1,893
|
public OperationFuture < List < FirewallPolicy > > update ( List < FirewallPolicy > firewallPolicyList , FirewallPolicyConfig config ) { firewallPolicyList . forEach ( firewallPolicy -> update ( firewallPolicy , config ) ) ; return new OperationFuture < > ( firewallPolicyList , new NoWaitingJobFuture ( ) ) ; }
|
Update firewall policy list
|
1,894
|
public OperationFuture < List < FirewallPolicy > > update ( FirewallPolicyFilter firewallPolicyFilter , FirewallPolicyConfig config ) { checkNotNull ( firewallPolicyFilter , "Firewall policy filter must be not null" ) ; List < FirewallPolicy > firewallPolicyList = findLazy ( firewallPolicyFilter ) . map ( metadata -> FirewallPolicy . refById ( metadata . getId ( ) , DataCenter . refById ( metadata . getDataCenterId ( ) ) ) ) . collect ( toList ( ) ) ; return update ( firewallPolicyList , config ) ; }
|
Update filtered firewall policies
|
1,895
|
public OperationFuture < FirewallPolicy > delete ( FirewallPolicy firewallPolicy ) { FirewallPolicyMetadata metadata = findByRef ( firewallPolicy ) ; firewallPolicyClient . delete ( metadata . getDataCenterId ( ) , metadata . getId ( ) ) ; return new OperationFuture < > ( firewallPolicy , new NoWaitingJobFuture ( ) ) ; }
|
Delete firewall policy
|
1,896
|
public OperationFuture < List < FirewallPolicy > > delete ( FirewallPolicy ... firewallPolicies ) { return delete ( Arrays . asList ( firewallPolicies ) ) ; }
|
Delete array of firewall policy
|
1,897
|
public OperationFuture < List < FirewallPolicy > > delete ( FirewallPolicyFilter filter ) { return delete ( findLazy ( filter ) . map ( metadata -> FirewallPolicy . refById ( metadata . getId ( ) , DataCenter . refById ( metadata . getDataCenterId ( ) ) ) ) . collect ( toList ( ) ) ) ; }
|
Delete filtered firewall policy
|
1,898
|
public OperationFuture < List < FirewallPolicy > > delete ( List < FirewallPolicy > firewallPolicyList ) { List < JobFuture > jobs = firewallPolicyList . stream ( ) . map ( reference -> delete ( reference ) . jobFuture ( ) ) . collect ( toList ( ) ) ; return new OperationFuture < > ( firewallPolicyList , new ParallelJobsFuture ( jobs ) ) ; }
|
Delete firewall policy list
|
1,899
|
public OperationFuture < AlertPolicy > create ( AlertPolicyConfig createConfig ) { AlertPolicyMetadata policy = client . createAlertPolicy ( converter . buildCreateAlertPolicyRequest ( createConfig ) ) ; return new OperationFuture < > ( AlertPolicy . refById ( policy . getId ( ) ) , new NoWaitingJobFuture ( ) ) ; }
|
Create Alert policy
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.