@Override public Iterable<AdminCommand.Provider> getAllProviders() { return Service.load( AdminCommand.Provider.class ); } };
@Override public AdminCommand.Provider findProvider( String name ) { return Service.load( AdminCommand.Provider.class, name ); }
public ExtensionInitializer( NeoServer neoServer ) { this.neoServer = neoServer; lifecycles = Service.load( PluginLifecycle.class ); }
private static Iterable loadKernelExtension() { return Service.load( KernelExtensionFactory.class ); } }
/** * Load the {@link CheckPointThresholdPolicy} by the given name. * * @throws NoSuchElementException if the policy was not found. */ public static CheckPointThresholdPolicy loadPolicy( String policyName ) throws NoSuchElementException { return Service.load( CheckPointThresholdPolicy.class, policyName ); }
static Iterable<ServerPlugin> load() { return Service.load( ServerPlugin.class ); }
public RepresentationFormatRepository( AbstractNeoServer injectorProvider ) { this.injectorProvider = injectorProvider; this.formats = new HashMap<>(); for ( RepresentationFormat format : Service.load( RepresentationFormat.class ) ) { formats.put( format.mediaType, format ); } }
public GraphDatabaseFactoryState() { settingsClasses = new CopyOnWriteArrayList<>(); settingsClasses.add( GraphDatabaseSettings.class ); kernelExtensions = new CopyOnWriteArrayList<>(); for ( KernelExtensionFactory<?> factory : Service.load( KernelExtensionFactory.class ) ) { kernelExtensions.add( factory ); } urlAccessRules = new ConcurrentHashMap<>(); }
/** * This is deprecated. Use {@link TestGraphDatabaseFactory} instead */ @Deprecated public ImpermanentGraphDatabase( File storeDir, Map<String, String> params ) { this( storeDir, params, Iterables.cast( Service.load( KernelExtensionFactory.class ) ) ); }
public static ManagementSupport load() { ManagementSupport support = new ManagementSupport(); for ( ManagementSupport candidate : Service.load( ManagementSupport.class ) ) { // Can we know that there aren't going to be multiple instances? support = candidate; } return support; }
private static ConstraintSemantics loadConstraintSemantics() { Iterable<ConstraintSemantics> semantics = Service.load( ConstraintSemantics.class ); List<ConstraintSemantics> candidates = Iterables.asList( semantics ); checkState( !candidates.isEmpty(), format( "At least one implementation of %s should be available.", ConstraintSemantics.class ) ); return Collections.max( candidates, Comparator.comparingInt( ConstraintSemantics::getPriority ) ); }
private KernelExtensionFactory<?> loadInstance() { return extClass.cast( Service.load( KernelExtensionFactory.class, key ) ); } }
/** * Load all available factories via {@link Service}. * * @return list of available factories. */ @VisibleForTesting List<StatementLocksFactory> serviceLoadFactories() { return Iterables.asList( Service.load( StatementLocksFactory.class ) ); } }
/** * Gets all {@link RecordFormats} that the selector is aware of. * @return An iterable over all known record formats. */ public static Iterable<RecordFormats> allFormats() { Iterable<RecordFormats.Factory> loadableFormatFactories = Service.load( RecordFormats.Factory.class ); Iterable<RecordFormats> loadableFormats = map( RecordFormats.Factory::newInstance, loadableFormatFactories ); return concat( KNOWN_FORMATS, loadableFormats ); }
public void registerAllOfflineProviders( Config config, File storeDirectory, FileSystemAbstraction fs ) { for ( DiagnosticsOfflineReportProvider provider : Service.load( DiagnosticsOfflineReportProvider.class ) ) { provider.init( fs, config, storeDirectory ); registerOfflineProvider( provider ); } } }
@Test void whenContextClassLoaderDuplicatesServiceShouldLoadItOnce() { Thread.currentThread().setContextClassLoader( Service.class.getClassLoader() ); Iterable<FooService> services = Service.load( FooService.class ); assertEquals( 1, Iterables.count( services ) ); }
@Test void shouldLoadServiceInDefaultEnvironment() { FooService fooService = Service.load( FooService.class, "foo" ); assertTrue( fooService instanceof BarService ); }
@Test void whenContextCallsLoaderBlocksServicesFolderShouldLoadClassFromKernelClassloader() { Thread.currentThread().setContextClassLoader( new ServiceBlockClassLoader( contextClassLoader ) ); FooService fooService = Service.load( FooService.class, "foo" ); assertTrue( fooService instanceof BarService ); }
@Test void whenContextClassLoaderOverridesServiceShouldLoadThatClass() { Thread.currentThread().setContextClassLoader( new ServiceRedirectClassLoader( contextClassLoader ) ); FooService fooService = Service.load( FooService.class, "foo" ); assertTrue( fooService instanceof BazService ); }
@SuppressWarnings( "unchecked" ) public static DatabaseKernelExtensions instantiateKernelExtensions( File databaseDirectory, FileSystemAbstraction fileSystem, Config config, LogService logService, PageCache pageCache, JobScheduler jobScheduler, RecoveryCleanupWorkCollector recoveryCollector, DatabaseInfo databaseInfo, Monitors monitors, TokenHolders tokenHolders ) { Dependencies deps = new Dependencies(); deps.satisfyDependencies( fileSystem, config, logService, pageCache, recoveryCollector, monitors, jobScheduler, tokenHolders ); @SuppressWarnings( "rawtypes" ) Iterable kernelExtensions = Service.load( KernelExtensionFactory.class ); KernelContext kernelContext = new SimpleKernelContext( databaseDirectory, databaseInfo, deps ); return new DatabaseKernelExtensions( kernelContext, kernelExtensions, deps, KernelExtensionFailureStrategies.ignore() ); } }