List of usage examples for org.apache.commons.discovery.tools DiscoverSingleton find
public static Object find(Class spiClass) throws DiscoveryException
From source file:com.googlecode.arit.discovery.EnvironmentCacheScannerTest.java
@Test public void test() throws Exception { System.setProperty(DummyProvider.class.getName(), DummyProviderImpl.class.getName()); final Object instance = DiscoverSingleton.find(DummyProvider.class); EnvironmentCacheScanner enumeratorFactory = context.getBean(EnvironmentCacheScanner.class); assertTrue(enumeratorFactory.isAvailable()); final boolean[] found = { false }; enumeratorFactory.scanForResources(new ResourceListener() { public void onResourceFound(Resource<?> resource) { assertSame(instance, resource.getResourceObject()); found[0] = true;/*w w w.j a va 2s . c o m*/ } }); assertTrue(found[0]); }
From source file:com.okidokiteam.gouken.kernel.CoreVault.java
private void loadAndStartFramework(Map<String, Object> p) throws BundleException, IOException, RepositoryException, KernelException { FrameworkFactory factory = (FrameworkFactory) DiscoverSingleton.find(FrameworkFactory.class); m_framework = factory.newFramework(p); // p.put( FelixConstants.SYSTEMBUNDLE_ACTIVATORS_PROP, Arrays.asList( new Activator() ) ); // m_framework = new Felix( p ); m_framework.init();// w ww. j a v a2 s .c o m m_framework.start(); }
From source file:org.ops4j.pax.exam.runtime.PaxExamRuntime.java
/** * Discovers the test container. Discovery is performed via Appache Commons discovery mechanism. * * @return discovered test container/*from w ww . j av a 2 s .c om*/ */ public static TestContainerFactory getTestContainerFactory() { return (TestContainerFactory) DiscoverSingleton.find(TestContainerFactory.class); }
From source file:picocash.services.ServiceDiscover.java
public static Object getSingleton(Class<?> clazz) { return DiscoverSingleton.find(clazz); }