public void registerRestApiExtensions ( ) { if ( restApiExtensionsRegistered ) { throw H2O . fail ( "APIs already registered" ) ; } // Log core extension registrations here so the message is grouped in the right spot. for ( AbstractH2OExtension e : getCoreExtensions ( ) ) { e . printInitialized ( ) ; } Log . info ( "Registered " + coreExtensions . size ( ) + " core extensions in: " + registerCoreExtensionsMillis + "ms" ) ; Log . info ( "Registered H2O core extensions: " + Arrays . toString ( getCoreExtensionNames ( ) ) ) ; if ( listenerExtensions . size ( ) > 0 ) { Log . info ( "Registered: " + listenerExtensions . size ( ) + " listener extensions in: " + registerListenerExtensionsMillis + "ms" ) ; Log . info ( "Registered Listeners extensions: " + Arrays . toString ( getListenerExtensionNames ( ) ) ) ; } if ( authExtensions . size ( ) > 0 ) { Log . info ( "Registered: " + authExtensions . size ( ) + " auth extensions in: " + registerAuthExtensionsMillis + "ms" ) ; Log . info ( "Registered Auth extensions: " + Arrays . toString ( getAuthExtensionNames ( ) ) ) ; } long before = System . currentTimeMillis ( ) ; RequestServer . DummyRestApiContext dummyRestApiContext = new RequestServer . DummyRestApiContext ( ) ; ServiceLoader < RestApiExtension > restApiExtensionLoader = ServiceLoader . load ( RestApiExtension . class ) ; for ( RestApiExtension r : restApiExtensionLoader ) { try { if ( isEnabled ( r ) ) { r . registerEndPoints ( dummyRestApiContext ) ; r . registerSchemas ( dummyRestApiContext ) ; restApiExtensions . put ( r . getName ( ) , r ) ; } } catch ( Exception e ) { Log . info ( "Cannot register extension: " + r + ". Skipping it..." ) ; } } restApiExtensionsRegistered = true ; long registerApisMillis = System . currentTimeMillis ( ) - before ; Log . info ( "Registered: " + RequestServer . numRoutes ( ) + " REST APIs in: " + registerApisMillis + "ms" ) ; Log . info ( "Registered REST API extensions: " + Arrays . toString ( getRestApiExtensionNames ( ) ) ) ; // Register all schemas SchemaServer . registerAllSchemasIfNecessary ( dummyRestApiContext . getAllSchemas ( ) ) ; }
Register REST API routes .