idx
int64
0
41.2k
question
stringlengths
74
4.04k
target
stringlengths
7
750
22,000
public final void receive ( final LogEvent logEvent ) { final String sClassName = logEvent . getSource ( ) . getClass ( ) . getName ( ) ; Logger logger = loggersMap . get ( sClassName ) ; if ( logger == null ) { logger = LoggerFactory . getLogger ( logEvent . getSource ( ) . getClass ( ) ) ; loggersMap . put ( sClassNa...
This method receives the log event and logs it .
22,001
public static InputStream routeStreamThroughProcess ( final Process p , final InputStream origin , final boolean closeInput ) { InputStream processSTDOUT = p . getInputStream ( ) ; OutputStream processSTDIN = p . getOutputStream ( ) ; StreamUtil . doBackgroundCopy ( origin , processSTDIN , DUMMY_MONITOR , true , closeI...
Given a Process this function will route the flow of data through it & out again
22,002
public static long eatInputStream ( InputStream is ) { try { long eaten = 0 ; try { Thread . sleep ( STREAM_SLEEP_TIME ) ; } catch ( InterruptedException e ) { } int avail = Math . min ( is . available ( ) , CHUNKSIZE ) ; byte [ ] eatingArray = new byte [ CHUNKSIZE ] ; while ( avail > 0 ) { is . read ( eatingArray , 0 ...
Eats an inputstream discarding its contents
22,003
public static void streamCopy ( InputStream input , Writer output ) throws IOException { if ( input == null ) throw new IllegalArgumentException ( "Must provide something to read from" ) ; if ( output == null ) throw new IllegalArgumentException ( "Must provide something to write to" ) ; streamCopy ( new InputStreamRea...
Copies the contents of an InputStream using the default encoding into a Writer
22,004
private void recache ( ) { if ( mask == 0 && prefix != 0 ) { this . mask = - 1 << ( 32 - prefix ) ; this . maskedNetwork = IpHelper . aton ( network ) & mask ; } }
Repopulates the transient fields based on the IP and prefix
22,005
public long get ( final TimeUnit toUnit ) { if ( this . unit == toUnit ) return period ; else return toUnit . convert ( period , this . unit ) ; }
Get this timeout represented in a different unit
22,006
public static Timeout max ( Timeout ... timeouts ) { Timeout max = null ; for ( Timeout timeout : timeouts ) { if ( timeout != null ) if ( max == null || max . getMilliseconds ( ) < timeout . getMilliseconds ( ) ) max = timeout ; } if ( max != null ) return max ; else throw new IllegalArgumentException ( "Must specify ...
Filter through a number of timeouts to find the one with the longest period
22,007
public static Timeout min ( Timeout ... timeouts ) { Timeout min = null ; for ( Timeout timeout : timeouts ) { if ( timeout != null ) if ( min == null || min . getMilliseconds ( ) > timeout . getMilliseconds ( ) ) min = timeout ; } if ( min != null ) return min ; else throw new IllegalArgumentException ( "Must specify ...
Filter through a number of timeouts to find the one with the shortest period
22,008
public static Timeout sum ( Timeout ... timeouts ) { long sum = 0 ; for ( Timeout timeout : timeouts ) if ( timeout != null ) sum += timeout . getMilliseconds ( ) ; if ( sum != 0 ) return new Timeout ( sum ) ; else return Timeout . ZERO ; }
Adds together all the supplied timeouts
22,009
public synchronized static boolean hasSudo ( ) { if ( ! sudoTested ) { String [ ] cmdArr = new String [ ] { "which" , "sudo" } ; List < String > cmd = new ArrayList < String > ( cmdArr . length ) ; Collections . addAll ( cmd , cmdArr ) ; ProcessBuilder whichsudo = new ProcessBuilder ( cmd ) ; try { Process p = whichsud...
Determines whether sudo is supported on the local machine
22,010
public final void channelRead ( final ChannelHandlerContext ctx , final Object msg ) { try { JNRPERequest req = ( JNRPERequest ) msg ; ReturnValue ret = commandInvoker . invoke ( req . getCommand ( ) , req . getArguments ( ) ) ; JNRPEResponse res = new JNRPEResponse ( ) ; res . setResult ( ret . getStatus ( ) . intValu...
Method channelRead .
22,011
private static void applyConfigs ( final ClassLoader classloader , final GuiceConfig config ) { for ( String configFile : getPropertyFiles ( config ) ) { try { for ( PropertyFile properties : loadConfig ( classloader , configFile ) ) config . setAll ( properties ) ; } catch ( IOException e ) { throw new IllegalArgument...
Discover and add to the configuration any properties on disk and on the network
22,012
public String parse ( final String threshold , final RangeConfig tc ) { configure ( tc ) ; return threshold . substring ( 1 ) ; }
Parses the threshold to remove the matched braket .
22,013
public String getOptionValue ( final String optionName ) { if ( optionName . length ( ) == 1 ) { return getOptionValue ( optionName . charAt ( 0 ) ) ; } return ( String ) commandLine . getValue ( "--" + optionName ) ; }
Returns the value of the specified option .
22,014
public String getOptionValue ( final char shortOption , final String defaultValue ) { return ( String ) commandLine . getValue ( "-" + shortOption , defaultValue ) ; }
Returns the value of the specified option If the option is not present returns the default value .
22,015
public TimecodeRange add ( SampleCount samples ) { final Timecode newStart = start . add ( samples ) ; final Timecode newEnd = end . add ( samples ) ; return new TimecodeRange ( newStart , newEnd ) ; }
Move the range right by the specified number of samples
22,016
public synchronized void opportunisticallyRefreshUserData ( final String username , final String password ) { if ( shouldOpportunisticallyRefreshUserData ( ) ) { this . lastOpportunisticUserDataRefresh = System . currentTimeMillis ( ) ; Thread thread = new Thread ( ( ) -> refreshAllUserData ( ldap . parseUser ( usernam...
Temporarily borrow a user s credentials to run an opportunistic user data refresh
22,017
public String relative ( String url ) { try { final URI uri = absolute ( url ) . build ( ) ; return new URI ( null , null , uri . getPath ( ) , uri . getQuery ( ) , uri . getFragment ( ) ) . toString ( ) ; } catch ( URISyntaxException e ) { throw new IllegalArgumentException ( e ) ; } }
Return only the path for a given URL
22,018
void reload ( NetworkConfig config ) { try { log . trace ( "Load config data from " + config . path + " into " + config ) ; final ConfigPropertyData read = configService . read ( config . path , configInstanceId , config . getLastRevision ( ) ) ; if ( read == null || read . properties == null || read . properties . isE...
Called to initiate an intelligent reload of a particular config
22,019
@ Named ( "logdata" ) public CloudTable getLogDataTable ( @ Named ( "azure.storage-connection-string" ) String storageConnectionString , @ Named ( "azure.logging-table" ) String logTableName ) throws URISyntaxException , StorageException , InvalidKeyException { CloudStorageAccount storageAccount = CloudStorageAccount ....
For the Azure Log Store the underlying table to use
22,020
public final ReturnValue execute ( final ICommandLine cl ) { if ( cl . hasOption ( 'U' ) ) { setUrl ( cl . getOptionValue ( 'U' ) ) ; } if ( cl . hasOption ( 'O' ) ) { setObject ( cl . getOptionValue ( 'O' ) ) ; } if ( cl . hasOption ( 'A' ) ) { setAttribute ( cl . getOptionValue ( 'A' ) ) ; } if ( cl . hasOption ( 'I'...
Executes the plugin .
22,021
public static boolean overlapping ( Version min1 , Version max1 , Version min2 , Version max2 ) { return min1 . equals ( min2 ) || max1 . equals ( max2 ) || min2 . within ( min1 , max1 ) || max2 . within ( min1 , min2 ) || min1 . within ( min2 , max2 ) || max1 . within ( min2 , max2 ) ; }
Determines if 2 version ranges have any overlap
22,022
public String createPartitionAndRowQuery ( final DateTime from , final DateTime to ) { final String parMin = TableQuery . generateFilterCondition ( "PartitionKey" , TableQuery . QueryComparisons . GREATER_THAN_OR_EQUAL , from . toLocalDate ( ) . toString ( ) ) ; final String rowMin = TableQuery . generateFilterConditio...
Create a filter condition that returns log lines between two dates . Designed to be used in addition to other criteria
22,023
public ServiceInstanceEntity get ( final String serviceId ) { try { return serviceCache . get ( serviceId , ( ) -> dao . getById ( serviceId ) ) ; } catch ( Exception e ) { throw new RuntimeException ( "Error loading service: " + serviceId , e ) ; } }
Get service information reading from cache if possible
22,024
public ReturnValue execute ( final String [ ] argsAry ) throws BadThresholdException { try { HelpFormatter hf = new HelpFormatter ( ) ; Parser cliParser = new Parser ( ) ; cliParser . setGroup ( mainOptionsGroup ) ; cliParser . setHelpFormatter ( hf ) ; CommandLine cl = cliParser . parse ( argsAry ) ; InjectionUtils . ...
Executes the proxied plugin passing the received arguments as parameters .
22,025
public void printHelp ( final PrintWriter out ) { HelpFormatter hf = new HelpFormatter ( ) ; StringBuilder sbDivider = new StringBuilder ( "=" ) ; while ( sbDivider . length ( ) < hf . getPageWidth ( ) ) { sbDivider . append ( '=' ) ; } out . println ( sbDivider . toString ( ) ) ; out . println ( "PLUGIN NAME : " + pro...
Prints the help related to the plugin to a specified output .
22,026
public static Timecode max ( final Timecode ... timecodes ) { Timecode max = null ; for ( Timecode timecode : timecodes ) if ( max == null || lt ( max , timecode ) ) max = timecode ; return max ; }
Returns the larger of a number of timecodes
22,027
public static Timecode min ( final Timecode ... timecodes ) { Timecode min = null ; for ( Timecode timecode : timecodes ) if ( min == null || ge ( min , timecode ) ) min = timecode ; return min ; }
Returns the smaller of some timecodes
22,028
public long getDurationMillis ( ) { List < Element > durations = element . getChildren ( "Duration" ) ; if ( durations . size ( ) != 0 ) { final String durationString = durations . get ( 0 ) . getValue ( ) ; final long duration = Long . parseLong ( durationString ) ; return duration ; } else { throw new RuntimeExceptio...
Gets duration of video track in milliseconds .
22,029
private static Group configureCommandLine ( ) { DefaultOptionBuilder oBuilder = new DefaultOptionBuilder ( ) ; ArgumentBuilder aBuilder = new ArgumentBuilder ( ) ; GroupBuilder gBuilder = new GroupBuilder ( ) ; DefaultOption listOption = oBuilder . withLongName ( "list" ) . withShortName ( "l" ) . withDescription ( "Li...
Configure the command line parser .
22,030
private static void printHelp ( final IPluginRepository pr , final String pluginName ) { try { PluginProxy pp = ( PluginProxy ) pr . getPlugin ( pluginName ) ; if ( pp == null ) { System . out . println ( "Plugin " + pluginName + " does not exists." ) ; } else { pp . printHelp ( ) ; } } catch ( Exception e ) { e . prin...
Prints the help about a plugin .
22,031
private static void printVersion ( ) { System . out . println ( "JNRPE version " + VERSION ) ; System . out . println ( "Copyright (c) 2011 Massimiliano Ziccardi" ) ; System . out . println ( "Licensed under the Apache License, Version 2.0" ) ; System . out . println ( ) ; }
Prints the JNRPE Server version .
22,032
@ SuppressWarnings ( "unchecked" ) private static void printUsage ( final Exception e ) { printVersion ( ) ; if ( e != null ) { System . out . println ( e . getMessage ( ) + "\n" ) ; } HelpFormatter hf = new HelpFormatter ( ) ; StringBuilder sbDivider = new StringBuilder ( "=" ) ; while ( sbDivider . length ( ) < hf . ...
Prints the JNRPE Server usage and eventually the error about the last invocation .
22,033
private static JNRPEConfiguration loadConfiguration ( final String configurationFilePath ) throws ConfigurationException { File confFile = new File ( configurationFilePath ) ; if ( ! confFile . exists ( ) || ! confFile . canRead ( ) ) { throw new ConfigurationException ( "Cannot access config file : " + configurationFi...
Loads the JNRPE configuration from the INI or the XML file .
22,034
private static IPluginRepository loadPluginDefinitions ( final String sPluginDirPath ) throws PluginConfigurationException { File fDir = new File ( sPluginDirPath ) ; DynaPluginRepository repo = new DynaPluginRepository ( ) ; repo . load ( fDir ) ; return repo ; }
Loads a plugin repository from a directory .
22,035
private static void printPluginList ( final IPluginRepository pr ) { System . out . println ( "List of installed plugins : " ) ; for ( PluginDefinition pd : pr . getAllPlugins ( ) ) { System . out . println ( " * " + pd . getName ( ) ) ; } System . exit ( 0 ) ; }
Prints the list of installed plugins .
22,036
public void setAttribute ( String name , String value ) { if ( value != null ) getElement ( ) . setAttribute ( name , value ) ; else getElement ( ) . removeAttribute ( name ) ; }
Helper method to set the value of an attribute on this Element
22,037
protected Element getElement ( String name , int index ) { List < Element > children = getElement ( ) . getChildren ( name ) ; if ( children . size ( ) > index ) return children . get ( index ) ; else return null ; }
Helper method to retrieve a child element with a particular name and index
22,038
private static TimeUnit pickUnit ( final Duration iso ) { final long millis = iso . toMillis ( ) ; if ( millis < 1000 ) return TimeUnit . MILLISECONDS ; final long SECOND = 1000 ; final long MINUTE = 60 * SECOND ; final long HOUR = 60 * MINUTE ; final long DAY = 24 * HOUR ; if ( millis % DAY == 0 ) return TimeUnit . DA...
Identify the largest unit that can accurately represent the provided duration
22,039
@ SuppressWarnings ( "unchecked" ) public Iterator < T > iterator ( ) { final List < T > services = new ArrayList < T > ( ) ; if ( m_serviceTracker != null ) { final Object [ ] trackedServices = m_serviceTracker . getServices ( ) ; if ( trackedServices != null ) { for ( Object trackedService : trackedServices ) { servi...
Returns an iterator over the tracked services at the call point in time . Note that a susequent call can produce a different list of services as the services are dynamic . If there are no services available returns an empty iterator .
22,040
public < T > T get ( Class < T > clazz , final String name ) { JAXBNamedResourceFactory < T > cached = cachedReferences . get ( name ) ; if ( cached == null ) { cached = new JAXBNamedResourceFactory < T > ( this . config , this . factory , name , clazz ) ; cachedReferences . put ( name , cached ) ; } return cached . ge...
Resolve the JAXB resource permitting caching behind the scenes
22,041
public < T > T getOnce ( final Class < T > clazz , final String name ) { return new JAXBNamedResourceFactory < T > ( this . config , this . factory , name , clazz ) . get ( ) ; }
Resolve the JAXB resource once without caching anything
22,042
public static String pretty ( final Source source ) { StreamResult result = new StreamResult ( new StringWriter ( ) ) ; pretty ( source , result ) ; return result . getWriter ( ) . toString ( ) ; }
Serialise the provided source to a pretty - printed String with the default indent settings
22,043
public static void pretty ( final Source input , final StreamResult output ) { try { Transformer transformer = TransformerFactory . newInstance ( ) . newTransformer ( ) ; transformer . setOutputProperty ( OutputKeys . ENCODING , "utf-8" ) ; transformer . setOutputProperty ( OutputKeys . OMIT_XML_DECLARATION , "no" ) ; ...
Serialise the provided source to the provided destination pretty - printing with the default indent settings
22,044
public void process ( Writer writer ) { try { template . process ( data , writer ) ; } catch ( IOException e ) { throw new RuntimeException ( "Error writing template to writer" , e ) ; } catch ( TemplateException e ) { throw new RuntimeException ( e . getMessage ( ) , e ) ; } }
Render the template to a Writer
22,045
private void storeWithSubscribers ( final List < LogLineTableEntity > lines ) { synchronized ( subscribers ) { if ( subscribers . isEmpty ( ) ) return ; for ( LogSubscriber subscriber : subscribers ) { subscriber . append ( lines ) ; } if ( System . currentTimeMillis ( ) > nextSubscriberPurge ) { purgeIdleSubscribers (...
Makes the provided log lines available to all log tail subscribers
22,046
public UserLogin getLogin ( @ Named ( JAXRS_SERVER_WEBAUTH_PROVIDER ) CurrentUser user ) { return ( UserLogin ) user ; }
Auto - cast the user manager s CurrentUser to a UserLogin
22,047
public final IPluginInterface getPlugin ( final String name ) throws UnknownPluginException { PluginDefinition pluginDef = pluginsDefinitionsMap . get ( name ) ; if ( pluginDef == null ) { throw new UnknownPluginException ( name ) ; } try { IPluginInterface pluginInterface = pluginDef . getPluginInterface ( ) ; if ( pl...
Returns the implementation of the plugin identified by the given name .
22,048
public static org . w3c . dom . Element convert ( org . jdom2 . Element node ) throws JDOMException { if ( node == null ) return null ; try { DOMOutputter outputter = new DOMOutputter ( ) ; return outputter . output ( node ) ; } catch ( JDOMException e ) { throw new RuntimeException ( "Error converting JDOM to DOM: " +...
Convert a JDOM Element to a DOM Element
22,049
public static org . jdom2 . Element convert ( org . w3c . dom . Element node ) { if ( node == null ) return null ; DOMBuilder builder = new DOMBuilder ( ) ; return builder . build ( node ) ; }
Convert a DOM Element to a JDOM Element
22,050
public static synchronized void register ( Class < ? > clazz , boolean indexable ) { if ( ! resources . containsKey ( clazz ) ) { resources . put ( clazz , new RestResource ( clazz ) ) ; if ( indexable ) { IndexableServiceRegistry . register ( clazz ) ; } revision ++ ; } }
Register a new resource - N . B . currently this resource cannot be safely unregistered without restarting the webapp
22,051
public void validate ( final Node document ) throws SchemaValidationException { try { final Validator validator = schema . newValidator ( ) ; validator . validate ( new DOMSource ( document ) ) ; } catch ( SAXException | IOException e ) { throw new SchemaValidationException ( e . getMessage ( ) , e ) ; } }
Validate some XML against this schema
22,052
public String parse ( final String threshold , final RangeConfig tc ) { tc . setNegativeInfinity ( true ) ; if ( threshold . startsWith ( INFINITY ) ) { return threshold . substring ( INFINITY . length ( ) ) ; } else { return threshold . substring ( NEG_INFINITY . length ( ) ) ; } }
Parses the threshold to remove the matched - inf or inf string .
22,053
@ SuppressWarnings ( "rawtypes" ) private static void inject ( final Class c , final IPluginInterface plugin , final IJNRPEExecutionContext context ) throws IllegalAccessException { final Field [ ] fields = c . getDeclaredFields ( ) ; for ( final Field f : fields ) { final Annotation an = f . getAnnotation ( Inject . c...
Perform the real injection .
22,054
@ SuppressWarnings ( "rawtypes" ) public static void inject ( final IPluginInterface plugin , final IJNRPEExecutionContext context ) { try { Class clazz = plugin . getClass ( ) ; inject ( clazz , plugin , context ) ; while ( IPluginInterface . class . isAssignableFrom ( clazz . getSuperclass ( ) ) ) { clazz = clazz . g...
Inject JNRPE code inside the passed in plugin . The annotation is searched in the whole hierarchy .
22,055
public String parse ( final String threshold , final RangeConfig tc ) throws RangeException { StringBuilder numberString = new StringBuilder ( ) ; for ( int i = 0 ; i < threshold . length ( ) ; i ++ ) { if ( Character . isDigit ( threshold . charAt ( i ) ) ) { numberString . append ( threshold . charAt ( i ) ) ; contin...
Parses the threshold to remove the matched number string .
22,056
public boolean assessMatch ( final OgnlContext ognlContext ) throws OgnlException { if ( ! inputRun ) { throw new IllegalArgumentException ( "Attempted to match on a rule whose rulesets input has not yet been produced" ) ; } final Object result = condition . run ( ognlContext , ognlContext ) ; if ( result == null || ! ...
returns true if the rules condition holds should not be called until after the rule sets input has been produced
22,057
public static KeyStore loadCertificates ( final File pemFile ) { try ( final PemReader pem = new PemReader ( new FileReader ( pemFile ) ) ) { final KeyStore ks = createEmptyKeyStore ( ) ; int certIndex = 0 ; Object obj ; while ( ( obj = parse ( pem . readPemObject ( ) ) ) != null ) { if ( obj instanceof Certificate ) {...
Load one or more X . 509 Certificates from a PEM file
22,058
public T get ( ) { T value = get ( null ) ; if ( value == null ) throw new RuntimeException ( "Missing property for JAXB resource: " + name ) ; else return value ; }
Resolve this property reference to a deserialised JAXB value
22,059
private T loadResourceValue ( final URL resource ) { try ( final InputStream is = resource . openStream ( ) ) { cached = null ; return setCached ( clazz . cast ( factory . getInstance ( clazz ) . deserialise ( is ) ) ) ; } catch ( IOException e ) { throw new RuntimeException ( "Error loading JAXB resource " + name + " ...
Load from a classpath resource ; reloads every time
22,060
private void analyze ( final List < Metric > metrics , final long elapsed , final Date now , final Date date ) { long diff = 0 ; boolean behind = false ; if ( now . before ( date ) ) { behind = true ; diff = date . getTime ( ) - now . getTime ( ) ; } else if ( now . after ( date ) ) { diff = now . getTime ( ) - date . ...
Analizes the data and produces the metrics .
22,061
public String parse ( final String threshold , final RangeConfig tc ) { tc . setPositiveInfinity ( true ) ; if ( threshold . startsWith ( INFINITY ) ) { return threshold . substring ( INFINITY . length ( ) ) ; } else { return threshold . substring ( POS_INFINITY . length ( ) ) ; } }
Parses the threshold to remove the matched inf or + inf string .
22,062
public static String sha1hmac ( String key , String plaintext ) { return sha1hmac ( key , plaintext , ENCODE_HEX ) ; }
Performs HMAC - SHA1 on the UTF - 8 byte representation of strings
22,063
public static String sha1hmac ( String key , String plaintext , int encoding ) { byte [ ] signature = sha1hmac ( key . getBytes ( ) , plaintext . getBytes ( ) ) ; return encode ( signature , encoding ) ; }
Performs HMAC - SHA1 on the UTF - 8 byte representation of strings returning the hexidecimal hash as a result
22,064
private void register ( final Bundle bundle ) { LOG . debug ( "Scanning bundle [" + bundle . getSymbolicName ( ) + "]" ) ; final List < T > resources = m_scanner . scan ( bundle ) ; m_mappings . put ( bundle , resources ) ; if ( resources != null && resources . size ( ) > 0 ) { LOG . debug ( "Found resources " + resour...
Scans entries using the bundle scanner and registers the result of scanning process . Then notify the observers . If an exception appears during notification it is ignored .
22,065
private void unregister ( final Bundle bundle ) { if ( bundle == null ) return ; LOG . debug ( "Releasing bundle [" + bundle . getSymbolicName ( ) + "]" ) ; final List < T > resources = m_mappings . get ( bundle ) ; if ( resources != null && resources . size ( ) > 0 ) { LOG . debug ( "Un-registering " + resources ) ; f...
Un - registers each entry from the unregistered bundle by first notifying the observers . If an exception appears during notification it is ignored .
22,066
public static void verifyChain ( List < X509Certificate > chain ) { if ( chain == null || chain . isEmpty ( ) ) throw new IllegalArgumentException ( "Must provide a chain that is non-null and non-empty" ) ; for ( int i = 0 ; i < chain . size ( ) ; i ++ ) { final X509Certificate certificate = chain . get ( i ) ; final i...
Verifies that a certificate chain is valid
22,067
public static void main ( String args [ ] ) { String home = "/home/user1/content/myfolder" ; String file = "/home/user1/figures/fig.png" ; System . out . println ( "home = " + home ) ; System . out . println ( "file = " + file ) ; System . out . println ( "path = " + getRelativePath ( new File ( home ) , new File ( fil...
test the function
22,068
private InjectingEntityResolver createEntityResolver ( EntityResolver resolver ) { if ( getEntities ( ) != null ) { return new InjectingEntityResolver ( getEntities ( ) , resolver , getType ( ) , getLog ( ) ) ; } else { return null ; } }
Creates an XML entity resolver .
22,069
protected URL getNonDefaultStylesheetURL ( ) { if ( getNonDefaultStylesheetLocation ( ) != null ) { URL url = this . getClass ( ) . getClassLoader ( ) . getResource ( getNonDefaultStylesheetLocation ( ) ) ; return url ; } else { return null ; } }
Returns the URL of the default stylesheet .
22,070
private String [ ] scanIncludedFiles ( ) { final DirectoryScanner scanner = new DirectoryScanner ( ) ; scanner . setBasedir ( sourceDirectory ) ; scanner . setIncludes ( new String [ ] { inputFilename } ) ; scanner . scan ( ) ; return scanner . getIncludedFiles ( ) ; }
Returns the list of docbook files to include .
22,071
void setHTTPResponse ( HTTPResponse resp ) { lock . lock ( ) ; try { if ( response != null ) { throw ( new IllegalStateException ( "HTTPResponse was already set" ) ) ; } response = resp ; ready . signalAll ( ) ; } finally { lock . unlock ( ) ; } }
Set the HTTPResponse instance .
22,072
HTTPResponse getHTTPResponse ( ) { lock . lock ( ) ; try { while ( response == null ) { try { ready . await ( ) ; } catch ( InterruptedException intx ) { LOG . log ( Level . FINEST , "Interrupted" , intx ) ; } } return response ; } finally { lock . unlock ( ) ; } }
Get the HTTPResponse instance .
22,073
private static List < String > loadServicesImplementations ( final Class < ? > ofClass ) { List < String > result = new ArrayList < String > ( ) ; String override = System . getProperty ( ofClass . getName ( ) ) ; if ( override != null ) { result . add ( override ) ; } ClassLoader loader = ServiceLib . class . getClass...
Generates a list of implementation class names by using the Jar SPI technique . The order in which the class names occur in the service manifest is significant .
22,074
private static < T > T attemptLoad ( final Class < T > ofClass , final String className ) { if ( LOG . isLoggable ( Level . FINEST ) ) { LOG . finest ( "Attempting service load: " + className ) ; } Level level ; Throwable thrown ; try { Class < ? > clazz = Class . forName ( className ) ; if ( ! ofClass . isAssignableFr...
Attempts to load the specified implementation class . Attempts will fail if - for example - the implementation depends on a class not found on the classpath .
22,075
private static void finalClose ( final Closeable closeMe ) { if ( closeMe != null ) { try { closeMe . close ( ) ; } catch ( IOException iox ) { LOG . log ( Level . FINEST , "Could not close: " + closeMe , iox ) ; } } }
Check and close a closeable object trapping and ignoring any exception that might result .
22,076
public synchronized ConfigurationAgent getConfigurationAgent ( ) { if ( this . configurationAgent == null ) { if ( isService ) { this . configurationAgent = new ConfigurationAgent ( this . serviceName , this . projectId , this . sslEnabled , this . nfvoIp , this . nfvoPort , this . version , this . serviceKey ) ; } els...
Returns a ConfigurationAgent with which requests regarding Configurations can be sent to the NFVO .
22,077
public synchronized NetworkServiceDescriptorAgent getNetworkServiceDescriptorAgent ( ) { if ( this . networkServiceDescriptorAgent == null ) { if ( isService ) { this . networkServiceDescriptorAgent = new NetworkServiceDescriptorAgent ( this . serviceName , this . projectId , this . sslEnabled , this . nfvoIp , this . ...
Returns a NetworkServiceDescriptorAgent with which requests regarding NetworkServiceDescriptors can be sent to the NFVO .
22,078
public synchronized NetworkServiceRecordAgent getNetworkServiceRecordAgent ( ) { if ( this . networkServiceRecordAgent == null ) { if ( isService ) { this . networkServiceRecordAgent = new NetworkServiceRecordAgent ( this . serviceName , this . projectId , this . sslEnabled , this . nfvoIp , this . nfvoPort , this . ve...
Returns a NetworkServiceRecordAgent with which requests regarding NetworkServiceRecords can be sent to the NFVO .
22,079
public synchronized VimInstanceAgent getVimInstanceAgent ( ) { if ( this . vimInstanceAgent == null ) { if ( isService ) { this . vimInstanceAgent = new VimInstanceAgent ( this . serviceName , this . projectId , this . sslEnabled , this . nfvoIp , this . nfvoPort , this . version , this . serviceKey ) ; } else { this ....
Returns a VimInstanceAgent with which requests regarding VimInstances can be sent to the NFVO .
22,080
public synchronized VirtualLinkAgent getVirtualLinkAgent ( ) { if ( this . virtualLinkAgent == null ) { if ( isService ) { this . virtualLinkAgent = new VirtualLinkAgent ( this . serviceName , this . projectId , this . sslEnabled , this . nfvoIp , this . nfvoPort , this . version , this . serviceKey ) ; } else { this ....
Returns a VirtualLinkAgent with which requests regarding VirtualLinks can be sent to the NFVO .
22,081
public synchronized VirtualNetworkFunctionDescriptorAgent getVirtualNetworkFunctionDescriptorRestAgent ( ) { if ( this . virtualNetworkFunctionDescriptorAgent == null ) { if ( isService ) { this . virtualNetworkFunctionDescriptorAgent = new VirtualNetworkFunctionDescriptorAgent ( this . serviceName , this . projectId ,...
Returns a VirtualNetworkFunctionDescriptorAgent with which requests regarding VirtualNetworkFunctionDescriptors can be sent to the NFVO .
22,082
public synchronized VNFFGAgent getVNFFGAgent ( ) { if ( this . vnffgAgent == null ) { if ( isService ) { this . vnffgAgent = new VNFFGAgent ( this . serviceName , this . projectId , this . sslEnabled , this . nfvoIp , this . nfvoPort , this . version , this . serviceKey ) ; } else { this . vnffgAgent = new VNFFGAgent (...
Returns a VNFFGAgent with which requests regarding VNFFGAgent can be sent to the NFVO .
22,083
public synchronized EventAgent getEventAgent ( ) { if ( this . eventAgent == null ) { if ( isService ) { this . eventAgent = new EventAgent ( this . serviceName , this . projectId , this . sslEnabled , this . nfvoIp , this . nfvoPort , this . version , this . serviceKey ) ; } else { this . eventAgent = new EventAgent (...
Returns an EventAgent with which requests regarding Events can be sent to the NFVO .
22,084
public synchronized VNFPackageAgent getVNFPackageAgent ( ) { if ( this . vnfPackageAgent == null ) { if ( isService ) { this . vnfPackageAgent = new VNFPackageAgent ( this . serviceName , this . projectId , this . sslEnabled , this . nfvoIp , this . nfvoPort , this . version , this . serviceKey ) ; } else { this . vnfP...
Returns a VNFPackageAgent with which requests regarding VNFPackages can be sent to the NFVO .
22,085
public synchronized ProjectAgent getProjectAgent ( ) { if ( this . projectAgent == null ) { if ( isService ) { this . projectAgent = new ProjectAgent ( this . serviceName , this . projectId , this . sslEnabled , this . nfvoIp , this . nfvoPort , this . version , this . serviceKey ) ; } else { this . projectAgent = new ...
Returns a ProjectAgent with which requests regarding Projects can be sent to the NFVO .
22,086
public synchronized UserAgent getUserAgent ( ) { if ( this . userAgent == null ) { if ( isService ) { this . userAgent = new UserAgent ( this . serviceName , this . projectId , this . sslEnabled , this . nfvoIp , this . nfvoPort , this . version , this . serviceKey ) ; } else { this . userAgent = new UserAgent ( this ....
Returns a UserAgent with which requests regarding Users can be sent to the NFVO .
22,087
private String getProjectIdForProjectName ( String projectName ) throws SDKException { String projectId = this . getProjectAgent ( ) . findAll ( ) . stream ( ) . filter ( p -> p . getName ( ) . equals ( projectName ) ) . findFirst ( ) . orElseThrow ( ( ) -> new SDKException ( "Did not find a Project named " + projectNa...
Return the project id for a given project name .
22,088
private void resetAgents ( ) { this . configurationAgent = null ; this . keyAgent = null ; this . userAgent = null ; this . vnfPackageAgent = null ; this . projectAgent = null ; this . eventAgent = null ; this . vnffgAgent = null ; this . virtualNetworkFunctionDescriptorAgent = null ; this . virtualLinkAgent = null ; t...
Set all the agent objects to null .
22,089
@ Help ( help = "Get all the VirtualNetworkFunctionDescriptors of a NetworkServiceDescriptor with specific id" ) public List < VirtualNetworkFunctionDescriptor > getVirtualNetworkFunctionDescriptors ( final String idNSD ) throws SDKException { String url = idNSD + "/vnfdescriptors" ; return Arrays . asList ( ( VirtualN...
Get all VirtualNetworkFunctionDescriptors contained in a NetworkServiceDescriptor specified by its ID .
22,090
@ Help ( help = "Get a specific VirtualNetworkFunctionDescriptor of a particular NetworkServiceDescriptor specified by their IDs" ) public VirtualNetworkFunctionDescriptor getVirtualNetworkFunctionDescriptor ( final String idNSD , final String idVfn ) throws SDKException { String url = idNSD + "/vnfdescriptors" + "/" +...
Return a VirtualNetworkFunctionDescriptor that is contained in a particular NetworkServiceDescriptor .
22,091
@ Help ( help = "Delete the VirtualNetworkFunctionDescriptor of a NetworkServiceDescriptor with specific id" ) public void deleteVirtualNetworkFunctionDescriptors ( final String idNSD , final String idVnf ) throws SDKException { String url = idNSD + "/vnfdescriptors" + "/" + idVnf ; requestDelete ( url ) ; }
Delete a specific VirtualNetworkFunctionDescriptor that is contained in a particular NetworkServiceDescriptor .
22,092
@ Help ( help = "create the VirtualNetworkFunctionDescriptor of a NetworkServiceDescriptor with specific id" ) public VirtualNetworkFunctionDescriptor createVNFD ( final String idNSD , final VirtualNetworkFunctionDescriptor virtualNetworkFunctionDescriptor ) throws SDKException { String url = idNSD + "/vnfdescriptors" ...
Create a VirtualNetworkFunctionDescriptor in a specific NetworkServiceDescriptor .
22,093
@ Help ( help = "Update the VirtualNetworkFunctionDescriptor of a NetworkServiceDescriptor with specific id" ) public VirtualNetworkFunctionDescriptor updateVNFD ( final String idNSD , final String idVfn , final VirtualNetworkFunctionDescriptor virtualNetworkFunctionDescriptor ) throws SDKException { String url = idNSD...
Update a specific VirtualNetworkFunctionDescriptor that is contained in a particular NetworkServiceDescriptor .
22,094
@ Help ( help = "Get all the VirtualNetworkFunctionDescriptor Dependency of a NetworkServiceDescriptor with specific id" ) public List < VNFDependency > getVNFDependencies ( final String idNSD ) throws SDKException { String url = idNSD + "/vnfdependencies" ; return Arrays . asList ( ( VNFDependency [ ] ) requestGetAll ...
Return a List with all the VNFDependencies that are contained in a specific NetworkServiceDescriptor .
22,095
@ Help ( help = "get the VirtualNetworkFunctionDescriptor dependency with specific id of a NetworkServiceDescriptor with specific id" ) public VNFDependency getVNFDependency ( final String idNSD , final String idVnfd ) throws SDKException { String url = idNSD + "/vnfdependencies" + "/" + idVnfd ; return ( VNFDependency...
Return a specific VNFDependency that is contained in a particular NetworkServiceDescriptor .
22,096
@ Help ( help = "Delete the VirtualNetworkFunctionDescriptor dependency of a NetworkServiceDescriptor with specific id" ) public void deleteVNFDependency ( final String idNSD , final String idVnfd ) throws SDKException { String url = idNSD + "/vnfdependencies" + "/" + idVnfd ; requestDelete ( url ) ; }
Delete a VNFDependency .
22,097
@ Help ( help = "Create the VirtualNetworkFunctionDescriptor dependency of a NetworkServiceDescriptor with specific id" ) public VNFDependency createVNFDependency ( final String idNSD , final VNFDependency vnfDependency ) throws SDKException { String url = idNSD + "/vnfdependencies" + "/" ; return ( VNFDependency ) req...
Add a new VNFDependency to a specific NetworkServiceDescriptor .
22,098
@ Help ( help = "Update the VirtualNetworkFunctionDescriptor dependency of a NetworkServiceDescriptor with specific id" ) public VNFDependency updateVNFD ( final String idNSD , final String idVnfDep , final VNFDependency vnfDependency ) throws SDKException { String url = idNSD + "/vnfdependencies" + "/" + idVnfDep ; re...
Update a specific VNFDependency which is contained in a particular NetworkServiceDescriptor .
22,099
@ Help ( help = "Get all the PhysicalNetworkFunctionDescriptors of a NetworkServiceDescriptor with specific id" ) public List < PhysicalNetworkFunctionDescriptor > getPhysicalNetworkFunctionDescriptors ( final String idNSD ) throws SDKException { String url = idNSD + "/pnfdescriptors" ; return Arrays . asList ( ( Physi...
Returns the List of PhysicalNetworkFunctionDescriptors that are contained in a specific NetworkServiceDescriptor .