本文整理汇总了Java中org.jboss.forge.furnace.addons.AddonRegistry类的典型用法代码示例。如果您正苦于以下问题:Java AddonRegistry类的具体用法?Java AddonRegistry怎么用?Java AddonRegistry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AddonRegistry类属于org.jboss.forge.furnace.addons包,在下文中一共展示了AddonRegistry类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setup
import org.jboss.forge.furnace.addons.AddonRegistry; //导入依赖的package包/类
public void setup(File repoDir) {
furnace = FurnaceFactory.getInstance(Thread.currentThread()
.getContextClassLoader(), Thread.currentThread()
.getContextClassLoader());
furnace.addRepository(AddonRepositoryMode.IMMUTABLE, repoDir);
Future<Furnace> future = furnace.startAsync();
try {
future.get();
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException("Furnace failed to start.", e);
}
AddonRegistry addonRegistry = furnace.getAddonRegistry();
commandFactory = addonRegistry.getServices(CommandFactory.class).get();
controllerFactory = (CommandControllerFactory) addonRegistry
.getServices(CommandControllerFactory.class.getName()).get();
dependencyResolver = (DependencyResolver) addonRegistry
.getServices(DependencyResolver.class.getName()).get();
}
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:21,代码来源:FurnaceProducer.java
示例2: testProxyCallsDelegateAppropriately
import org.jboss.forge.furnace.addons.AddonRegistry; //导入依赖的package包/类
@Test
@Ignore
public void testProxyCallsDelegateAppropriately() throws Exception
{
AddonRegistry registry = LocalServices.getFurnace(getClass().getClassLoader())
.getAddonRegistry();
Imported<ConcreteC> imported = registry.getServices(ConcreteC.class);
ConcreteC c = imported.get();
Assert.assertNotNull(c);
String payload = "PAYLOAD";
c.setPayload(payload);
Assert.assertEquals(payload, c.getPayload());
Assert.assertEquals(payload.toString(), c.toString());
}
开发者ID:forge,项目名称:furnace,代码行数:18,代码来源:ProxyMethodHandlerDispatchTest.java
示例3: testLogRecordProxy
import org.jboss.forge.furnace.addons.AddonRegistry; //导入依赖的package包/类
@Test
public void testLogRecordProxy() throws Exception
{
AddonRegistry registry = LocalServices.getFurnace(getClass().getClassLoader())
.getAddonRegistry();
ClassLoader thisLoader = ClassLoaderAdapterJavaUtilLoggingTest.class.getClassLoader();
ClassLoader dep1Loader = registry.getAddon(AddonId.from("dep", "1")).getClassLoader();
Class<?> foreignType = dep1Loader.loadClass(JavaUtilLoggingFactory.class.getName());
LogRecord logRecord = (LogRecord) foreignType.getMethod("getLogRecord")
.invoke(foreignType.newInstance());
Assert.assertNotNull(logRecord);
Assert.assertTrue(logRecord.getClass().equals(LogRecord.class));
Object delegate = foreignType.newInstance();
JavaUtilLoggingFactory enhancedFactory = (JavaUtilLoggingFactory) ClassLoaderAdapterBuilder.callingLoader(thisLoader)
.delegateLoader(dep1Loader).enhance(delegate);
Assert.assertTrue(Proxies.isForgeProxy(enhancedFactory));
LogRecord result = enhancedFactory.getLogRecord();
Assert.assertFalse(Proxies.isForgeProxy(result));
}
开发者ID:forge,项目名称:furnace,代码行数:24,代码来源:ClassLoaderAdapterJavaUtilLoggingTest.java
示例4: testParameterPassthroughIfTypeIsShared
import org.jboss.forge.furnace.addons.AddonRegistry; //导入依赖的package包/类
@Test
public void testParameterPassthroughIfTypeIsShared() throws Exception
{
AddonRegistry registry = LocalServices.getFurnace(getClass().getClassLoader())
.getAddonRegistry();
ClassLoader thisLoader = ClassLoaderAdapterPassthroughTest.class.getClassLoader();
ClassLoader loader1 = registry.getAddon(AddonId.from("dep", "1")).getClassLoader();
ClassWithGetterAndSetter local = new ClassWithGetterAndSetter();
local.setPassthrough((ClassWithPassthroughMethod) loader1
.loadClass(ClassWithPassthroughMethod.class.getName())
.newInstance());
Object delegate = loader1.loadClass(ClassWithGetterAndSetter.class.getName()).newInstance();
ClassWithGetterAndSetter enhanced = (ClassWithGetterAndSetter) ClassLoaderAdapterBuilder
.callingLoader(thisLoader).delegateLoader(loader1).enhance(delegate);
enhanced.setPassthrough(new ClassWithPassthroughMethod());
Assert.assertNotNull(enhanced);
Assert.assertNotNull(enhanced.getPassthrough());
Assert.assertFalse(Proxies.isForgeProxy(enhanced.getPassthrough()));
Assert.assertFalse(enhanced.assertPassthroughNotProxied());
}
开发者ID:forge,项目名称:furnace,代码行数:25,代码来源:ClassLoaderAdapterPassthroughTest.java
示例5: testOptionalProxyAsParameter
import org.jboss.forge.furnace.addons.AddonRegistry; //导入依赖的package包/类
@Test
public void testOptionalProxyAsParameter() throws Exception
{
AddonRegistry registry = LocalServices.getFurnace(getClass().getClassLoader())
.getAddonRegistry();
ClassLoader thisLoader = ClassLoaderAdapterJavaOptionalTest.class.getClassLoader();
ClassLoader dep1Loader = registry.getAddon(AddonId.from("dep", "1")).getClassLoader();
Class<?> loadedType = dep1Loader.loadClass(MockOptionalService.class.getName());
Object delegate = loadedType.newInstance();
MockOptionalService enhanced = (MockOptionalService) ClassLoaderAdapterBuilder.callingLoader(thisLoader)
.delegateLoader(dep1Loader).enhance(delegate);
MockParentInterface1 mpi = new MockParentInterface1()
{
@Override
public Object getResult()
{
return "My Result";
}
};
Assert.assertThat(enhanced.getResult(Optional.empty()), nullValue());
Assert.assertThat(enhanced.getResult(Optional.of(mpi)), equalTo("My Result"));
}
开发者ID:forge,项目名称:furnace,代码行数:23,代码来源:ClassLoaderAdapterJavaOptionalTest.java
示例6: testIterableTypesAreProxied
import org.jboss.forge.furnace.addons.AddonRegistry; //导入依赖的package包/类
@Test
public void testIterableTypesAreProxied() throws Exception
{
AddonRegistry registry = LocalServices.getFurnace(getClass().getClassLoader())
.getAddonRegistry();
ClassLoader thisLoader = CLACProxiedIterableTest.class.getClassLoader();
ClassLoader dep1Loader = registry.getAddon(AddonId.from("dep", "1")).getClassLoader();
Class<?> foreignType = dep1Loader.loadClass(IterableFactory.class.getName());
Iterable<?> proxy = (Iterable<?>) foreignType.getMethod("getIterable")
.invoke(foreignType.newInstance());
Assert.assertFalse(Proxies.isForgeProxy(proxy));
Object delegate = foreignType.newInstance();
IterableFactory enhancedFactory = (IterableFactory) ClassLoaderAdapterBuilder.callingLoader(thisLoader)
.delegateLoader(dep1Loader).enhance(delegate);
Assert.assertTrue(Proxies.isForgeProxy(enhancedFactory));
Iterable<?> enhancedInstance = enhancedFactory.getIterable();
Assert.assertTrue(Proxies.isForgeProxy(enhancedInstance));
Iterator<?> iterator = enhancedInstance.iterator();
Assert.assertNotNull(iterator);
}
开发者ID:forge,项目名称:furnace,代码行数:25,代码来源:CLACProxiedIterableTest.java
示例7: testCustomIterableTypesAreProxied
import org.jboss.forge.furnace.addons.AddonRegistry; //导入依赖的package包/类
@Test
public void testCustomIterableTypesAreProxied() throws Exception
{
AddonRegistry registry = LocalServices.getFurnace(getClass().getClassLoader())
.getAddonRegistry();
ClassLoader thisLoader = CLACProxiedIterableTest.class.getClassLoader();
ClassLoader dep1Loader = registry.getAddon(AddonId.from("dep", "1")).getClassLoader();
Class<?> foreignType = dep1Loader.loadClass(IterableFactory.class.getName());
Iterable<?> proxy = (Iterable<?>) foreignType.getMethod("getIterable")
.invoke(foreignType.newInstance());
Assert.assertFalse(Proxies.isForgeProxy(proxy));
Object delegate = foreignType.newInstance();
IterableFactory enhancedFactory = (IterableFactory) ClassLoaderAdapterBuilder.callingLoader(thisLoader)
.delegateLoader(dep1Loader).enhance(delegate);
Assert.assertTrue(Proxies.isForgeProxy(enhancedFactory));
Iterable<?> enhancedInstance = enhancedFactory.getCustomIterable();
Assert.assertTrue(Proxies.isForgeProxy(enhancedInstance));
Iterator<?> iterator = enhancedInstance.iterator();
Assert.assertNotNull(iterator);
}
开发者ID:forge,项目名称:furnace,代码行数:25,代码来源:CLACProxiedIterableTest.java
示例8: testCollectionsReturnUnwrappedResultsIfUnwrappedTypeIsCompatible
import org.jboss.forge.furnace.addons.AddonRegistry; //导入依赖的package包/类
@Test
public void testCollectionsReturnUnwrappedResultsIfUnwrappedTypeIsCompatible() throws Exception
{
AddonRegistry registry = LocalServices.getFurnace(getClass().getClassLoader())
.getAddonRegistry();
ClassLoader thisLoader = CLACProxiedCollectionsReturnTypeUnwrappingTest.class.getClassLoader();
ClassLoader dep1Loader = registry.getAddon(AddonId.from("dep1", "1")).getClassLoader();
ClassLoader dep2Loader = registry.getAddon(AddonId.from("dep2", "2")).getClassLoader();
Class<?> foreignProfileType = dep1Loader.loadClass(ProfileFactory.class.getName());
Object delegate = foreignProfileType.newInstance();
ProfileFactory factory = (ProfileFactory) ClassLoaderAdapterBuilder.callingLoader(thisLoader)
.delegateLoader(dep1Loader).whitelist(Sets.toSet(Arrays.asList(dep1Loader, dep2Loader)))
.enhance(delegate);
Profile profile = factory.createProfile();
ProfileManager manager = factory.createProfileManager();
manager.setProfileListCallGet(Arrays.asList(profile));
}
开发者ID:forge,项目名称:furnace,代码行数:22,代码来源:CLACProxiedCollectionsReturnTypeUnwrappingTest.java
示例9: testIterableTypesAreProxied
import org.jboss.forge.furnace.addons.AddonRegistry; //导入依赖的package包/类
@Test
public void testIterableTypesAreProxied() throws Exception
{
AddonRegistry registry = LocalServices.getFurnace(getClass().getClassLoader())
.getAddonRegistry();
ClassLoader thisLoader = CLACProxiedCollectionsTest.class.getClassLoader();
ClassLoader dep1Loader = registry.getAddon(AddonId.from("dep", "1")).getClassLoader();
Class<?> foreignType = dep1Loader.loadClass(ProfileCommand.class.getName());
Object delegate = foreignType.newInstance();
ProfileCommand enhanced = (ProfileCommand) ClassLoaderAdapterBuilder.callingLoader(thisLoader)
.delegateLoader(dep1Loader).enhance(delegate);
ProfileManagerImpl manager = new ProfileManagerImpl();
enhanced.setManager(manager);
enhanced.configureProfile();
Assert.assertTrue(Proxies.isForgeProxy(enhanced));
}
开发者ID:forge,项目名称:furnace,代码行数:20,代码来源:CLACProxiedCollectionsTest.java
示例10: testSimpleFileProxy
import org.jboss.forge.furnace.addons.AddonRegistry; //导入依赖的package包/类
@Test
public void testSimpleFileProxy() throws Exception
{
AddonRegistry registry = LocalServices.getFurnace(getClass().getClassLoader())
.getAddonRegistry();
ClassLoader thisLoader = ClassLoaderAdapterJavaIOTest.class.getClassLoader();
ClassLoader dep1Loader = registry.getAddon(AddonId.from("dep", "1")).getClassLoader();
Class<?> foreignType = dep1Loader.loadClass(JavaIOFactory.class.getName());
File file = (File) foreignType.getMethod("getFile")
.invoke(foreignType.newInstance());
Assert.assertNotNull(file);
Assert.assertTrue(file.getClass().equals(File.class));
Object delegate = foreignType.newInstance();
JavaIOFactory enhancedFactory = (JavaIOFactory) ClassLoaderAdapterBuilder.callingLoader(thisLoader)
.delegateLoader(dep1Loader).enhance(delegate);
Assert.assertTrue(Proxies.isForgeProxy(enhancedFactory));
File result = enhancedFactory.getFile();
Assert.assertFalse(Proxies.isForgeProxy(result));
enhancedFactory.useFile(new File("foo"));
}
开发者ID:forge,项目名称:furnace,代码行数:26,代码来源:ClassLoaderAdapterJavaIOTest.java
示例11: testWhitelistLookupConvertsClassReturnTypes
import org.jboss.forge.furnace.addons.AddonRegistry; //导入依赖的package包/类
@Test
public void testWhitelistLookupConvertsClassReturnTypes() throws Exception
{
ClassLoader thisLoader = ClassLoaderAdapterWhitelistLoaderLookupTest.class.getClassLoader();
AddonRegistry registry = LocalServices.getFurnace(getClass().getClassLoader())
.getAddonRegistry();
ClassLoader loader1 = registry.getAddon(AddonId.from("dep1", "1")).getClassLoader();
ClassLoader loader2 = registry.getAddon(AddonId.from("dep2", "1")).getClassLoader();
ClassLoader loader3 = registry.getAddon(AddonId.from("dep3", "1")).getClassLoader();
AddonRegistry enhancedRegistry = ClassLoaderAdapterBuilder.callingLoader(thisLoader)
.delegateLoader(loader2)
.whitelist(new HashSet<>(Arrays.asList(loader1, loader3))).enhance(registry);
Assert.assertNotSame(MockContextConsumer.class, registry.getServices(MockContextConsumer.class.getName()).get()
.getClass());
Assert.assertNotSame(MockContextConsumer.class, enhancedRegistry.getServices(MockContextConsumer.class)
.get().getClass());
Assert.assertSame(MockContextConsumer.class, enhancedRegistry.getServices(MockContextConsumer.class)
.get().getNativeClass());
}
开发者ID:forge,项目名称:furnace,代码行数:26,代码来源:ClassLoaderAdapterWhitelistLoaderLookupTest.java
示例12: testProxyNotPropagatedIfClassLoadersBothInWhitelist
import org.jboss.forge.furnace.addons.AddonRegistry; //导入依赖的package包/类
@Test
public void testProxyNotPropagatedIfClassLoadersBothInWhitelist() throws Exception
{
AddonRegistry registry = LocalServices.getFurnace(getClass().getClassLoader())
.getAddonRegistry();
ClassLoader thisLoader = ClassLoaderAdapterWhitelistLoaderPassthroughTest.class.getClassLoader();
ClassLoader loader1 = registry.getAddon(AddonId.from("dep1", "1")).getClassLoader();
ClassLoader loader2 = registry.getAddon(AddonId.from("dep2", "1")).getClassLoader();
ClassLoader loader3 = registry.getAddon(AddonId.from("dep3", "1")).getClassLoader();
MockContext context = new MockContext();
Object delegate = loader1.loadClass(MockContextConsumer.class.getName()).newInstance();
MockContextConsumer enhancedConsumer = (MockContextConsumer) ClassLoaderAdapterBuilder
.callingLoader(thisLoader).delegateLoader(loader1)
.whitelist(new HashSet<>(Arrays.asList(loader1, loader2, loader3)))
.enhance(delegate);
Object payload = loader2.loadClass(MockContextPayloadImpl.class.getName()).newInstance();
context.getAttributes().put(MockContextPayload.class.getName(), payload);
enhancedConsumer.processContext(context);
Object object = context.getAttributes().get(MockContextPayload.class.getName());
Assert.assertFalse(Proxies.isForgeProxy(object));
}
开发者ID:forge,项目名称:furnace,代码行数:27,代码来源:ClassLoaderAdapterWhitelistLoaderPassthroughTest.java
示例13: testReturnTypeNativeAccessAfterParameterTypeEnhancementFromEnhancedClass
import org.jboss.forge.furnace.addons.AddonRegistry; //导入依赖的package包/类
@Test
public void testReturnTypeNativeAccessAfterParameterTypeEnhancementFromEnhancedClass() throws Exception
{
AddonRegistry registry = LocalServices.getFurnace(getClass().getClassLoader())
.getAddonRegistry();
ClassLoader thisLoader = ClassLoaderAdapterCollisionsTest.class.getClassLoader();
ClassLoader dep1Loader = registry.getAddon(AddonId.from("dep1", "1")).getClassLoader();
ClassLoader dep2Loader = registry.getAddon(AddonId.from("dep2", "2")).getClassLoader();
ClassImplementsInterfaceWithArrayParameterModification modifier = (ClassImplementsInterfaceWithArrayParameterModification) ClassLoaderAdapterBuilder
.callingLoader(thisLoader)
.delegateLoader(dep1Loader)
.enhance(dep1Loader.loadClass(ClassImplementsInterfaceWithArrayParameterModification.class.getName())
.newInstance());
modifier.setValueClassLoader(dep2Loader);
List<InterfaceValue> values = new ArrayList<>();
modifier.modifyParameter(new ClassImplementsInterfaceModifiableContext(values));
InterfaceValue result = values.get(0);
ClassImplementsInterfaceExtendsInterfaceValue value = (ClassImplementsInterfaceExtendsInterfaceValue) result;
Assert.assertNotNull(value);
}
开发者ID:forge,项目名称:furnace,代码行数:24,代码来源:ClassLoaderAdapterCollisionsTest.java
示例14: testSidewaysCollision
import org.jboss.forge.furnace.addons.AddonRegistry; //导入依赖的package包/类
@Test
public void testSidewaysCollision() throws Exception
{
AddonRegistry registry = LocalServices.getFurnace(getClass().getClassLoader())
.getAddonRegistry();
ClassLoader A = this.getClass().getClassLoader();
ClassLoader B = registry.getAddon(AddonId.from("B", "1")).getClassLoader();
ClassLoader C = registry.getAddon(AddonId.from("C", "1")).getClassLoader();
Class<?> typeAction1 = B.loadClass(Action1.class.getName());
Action action1 = getProxiedInstance(A, B, typeAction1);
Class<?> typePayload1 = C.loadClass(Payload1.class.getName());
Payload payload1 = getProxiedInstance(A, C, typePayload1);
Context context = new ContextImpl();
ContextValue<Payload> value = new ContextValueImpl<Payload>();
value.set(payload1);
context.set(value);
action1.handle(context);
}
开发者ID:forge,项目名称:furnace,代码行数:23,代码来源:SidewaysProxyAnonymousCollisionTest.java
示例15: testExportedInstanceExposesServiceTypeAndSourceAddon
import org.jboss.forge.furnace.addons.AddonRegistry; //导入依赖的package包/类
@Test
public void testExportedInstanceExposesServiceTypeAndSourceAddon() throws Exception
{
Furnace furnace = LocalServices.getFurnace(getClass().getClassLoader());
Assert.assertNotNull(furnace);
AddonRegistry registry = furnace.getAddonRegistry();
boolean found = false;
for (Addon addon : registry.getAddons())
{
ExportedInstance<ExportedInstanceApiTest> instance = addon.getServiceRegistry()
.getExportedInstance(ExportedInstanceApiTest.class);
if (instance != null)
{
found = true;
Assert.assertEquals(ExportedInstanceApiTest.class, instance.getActualType());
Assert.assertEquals(addon, instance.getSourceAddon());
break;
}
}
Assert.assertTrue("Could not locate service in any addon.", found);
}
开发者ID:forge,项目名称:furnace,代码行数:22,代码来源:ExportedInstanceApiTest.java
示例16: locateNativeClass
import org.jboss.forge.furnace.addons.AddonRegistry; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public <T> Class<T> locateNativeClass(Class<T> type)
{
Class<T> result = type;
AddonRegistry registry = furnace.getAddonRegistry();
for (Addon addon : registry.getAddons())
{
try
{
ClassLoader classLoader = addon.getClassLoader();
result = (Class<T>) classLoader.loadClass(type.getName());
break;
}
catch (ClassNotFoundException e)
{
}
}
return result;
}
开发者ID:forge,项目名称:intellij-idea-plugin,代码行数:20,代码来源:ForgeService.java
示例17: undeploy
import org.jboss.forge.furnace.addons.AddonRegistry; //导入依赖的package包/类
@Override
public void undeploy(Archive<?> archive) throws DeploymentException
{
undeploying = true;
AddonId addonToUndeploy = getAddonEntry(deploymentInstance.get());
AddonRegistry registry = runnable.getForge().getAddonRegistry();
System.out.println("Undeploying [" + addonToUndeploy + "] ... ");
try
{
Addon addonToStop = registry.getAddon(addonToUndeploy);
if (addonToStop.getStatus().isLoaded())
((MutableAddonRepository) addonToStop.getRepository()).disable(addonToUndeploy);
Addons.waitUntilStopped(addonToStop);
}
catch (Exception e)
{
throw new DeploymentException("Failed to undeploy " + addonToUndeploy, e);
}
finally
{
repository.undeploy(addonToUndeploy);
}
}
开发者ID:koentsje,项目名称:forge-furnace,代码行数:25,代码来源:ForgeDeployableContainer.java
示例18: getAddonRegistry
import org.jboss.forge.furnace.addons.AddonRegistry; //导入依赖的package包/类
@Override
public AddonRegistry getAddonRegistry(AddonRepository... repositories)
{
assertIsAlive();
AddonRegistry result = getLifecycleManager().findView(repositories);
if (result == null)
{
if (repositories == null || repositories.length == 0)
{
result = new AddonRegistryImpl(lock, getLifecycleManager(), getRepositories(), "ROOT");
getLifecycleManager().addView(result);
}
else
{
result = new AddonRegistryImpl(lock, getLifecycleManager(), Arrays.asList(repositories),
String.valueOf(registryCount++));
getLifecycleManager().addView(result);
getLifecycleManager().forceUpdate();
}
}
return result;
}
开发者ID:koentsje,项目名称:forge-furnace,代码行数:26,代码来源:FurnaceImpl.java
示例19: setUp
import org.jboss.forge.furnace.addons.AddonRegistry; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
AddonRegistry addonRegistry = Furnace.instance(getClass().getClassLoader()).getAddonRegistry();
projectFactory = addonRegistry.getServices(ProjectFactory.class).get();
uiTestHarness = addonRegistry.getServices(UITestHarness.class).get();
project = projectFactory.createTempProject();
}
开发者ID:forge,项目名称:springboot-addon,代码行数:8,代码来源:SetupCommandTest.java
示例20: getResourceFactory
import org.jboss.forge.furnace.addons.AddonRegistry; //导入依赖的package包/类
protected ResourceFactory getResourceFactory() {
AddonRegistry addonRegistry = furnace.getAddonRegistry();
Imported<ResourceFactory> resourceFactoryImport = addonRegistry.getServices(ResourceFactory.class);
ResourceFactory resourceFactory = null;
try {
resourceFactory = resourceFactoryImport.get();
} catch (Exception e) {
LOG.warn("Failed to get ResourceFactory injected: " + e, e);
}
if (resourceFactory == null) {
// lets try one more time - might work this time?
resourceFactory = resourceFactoryImport.get();
}
return resourceFactory;
}
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:16,代码来源:CommandsResource.java
注:本文中的org.jboss.forge.furnace.addons.AddonRegistry类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论