本文整理汇总了Java中org.jboss.forge.furnace.services.Imported类的典型用法代码示例。如果您正苦于以下问题:Java Imported类的具体用法?Java Imported怎么用?Java Imported使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Imported类属于org.jboss.forge.furnace.services包,在下文中一共展示了Imported类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testProxyCallsDelegateAppropriately
import org.jboss.forge.furnace.services.Imported; //导入依赖的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
示例2: getServices
import org.jboss.forge.furnace.services.Imported; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public <T> Imported<T> getServices(final Class<T> type)
{
if (getVersion() != cacheVersion)
{
cacheVersion = getVersion();
importedCache.clear();
}
String cacheKey = type.getName()
+ (type.getClassLoader() == null ? "SystemCL" : type.getClassLoader().toString());
Imported<?> imported = importedCache.get(cacheKey);
if (imported == null)
{
imported = new ImportedImpl<>(this, lock, type);
importedCache.put(cacheKey, imported);
}
return (Imported<T>) imported;
}
开发者ID:forge,项目名称:furnace,代码行数:21,代码来源:AddonRegistryImpl.java
示例3: initialize
import org.jboss.forge.furnace.services.Imported; //导入依赖的package包/类
private void initialize()
{
Imported<UIContextListener> listener = ForgeService.getInstance()
.lookupImported(UIContextListener.class);
for (UIContextListener uiContextListener : listener)
{
if (uiContextListener != null)
{
try
{
uiContextListener.contextInitialized(this);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
}
开发者ID:forge,项目名称:intellij-idea-plugin,代码行数:20,代码来源:UIContextImpl.java
示例4: close
import org.jboss.forge.furnace.services.Imported; //导入依赖的package包/类
@Override
public void close()
{
super.close();
Imported<UIContextListener> listener = ForgeService.getInstance()
.lookupImported(UIContextListener.class);
for (UIContextListener uiContextListener : listener)
{
if (uiContextListener != null)
{
try
{
uiContextListener.contextDestroyed(this);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
}
开发者ID:forge,项目名称:intellij-idea-plugin,代码行数:23,代码来源:UIContextImpl.java
示例5: getWindupConfigurationOptions
import org.jboss.forge.furnace.services.Imported; //导入依赖的package包/类
/**
* Returns all of the {@link ConfigurationOption} in the specified {@link Addon}.
*/
public static Iterable<ConfigurationOption> getWindupConfigurationOptions(Addon addon)
{
IdentityHashMap<ClassLoader, Addon> classLoaderToAddon = new IdentityHashMap<>();
for (Addon loadedAddon : FurnaceHolder.getAddonRegistry().getAddons())
{
classLoaderToAddon.put(loadedAddon.getClassLoader(), loadedAddon);
}
List<ConfigurationOption> results = new ArrayList<>();
Imported<ConfigurationOption> options = FurnaceHolder.getAddonRegistry()
.getServices(ConfigurationOption.class);
for (ConfigurationOption option : options)
{
ClassLoader optionClassLoader = option.getClass().getClassLoader();
Addon optionAddon = classLoaderToAddon.get(optionClassLoader);
if (optionAddon.equals(addon))
{
results.add(option);
}
}
return results;
}
开发者ID:windup,项目名称:windup,代码行数:26,代码来源:WindupConfiguration.java
示例6: ParserContext
import org.jboss.forge.furnace.services.Imported; //导入依赖的package包/类
/**
* Initialize tag handlers based upon the provided furnace instance.
*/
public ParserContext(Furnace furnace, RuleLoaderContext ruleLoaderContext)
{
this.ruleLoaderContext = ruleLoaderContext;
@SuppressWarnings("rawtypes")
Imported<ElementHandler> loadedHandlers = furnace.getAddonRegistry().getServices(ElementHandler.class);
for (ElementHandler<?> handler : loadedHandlers)
{
NamespaceElementHandler annotation = Annotations.getAnnotation(handler.getClass(),
NamespaceElementHandler.class);
if (annotation != null)
{
HandlerId handlerID = new HandlerId(annotation.namespace(), annotation.elementName());
if (handlers.containsKey(handlerID))
{
String className1 = Proxies.unwrapProxyClassName(handlers.get(handlerID).getClass());
String className2 = Proxies.unwrapProxyClassName(handler.getClass());
throw new WindupException("Multiple handlers registered with id: " + handlerID + " Classes are: "
+ className1 + " and " + className2);
}
handlers.put(handlerID, handler);
}
}
}
开发者ID:windup,项目名称:windup,代码行数:28,代码来源:ParserContext.java
示例7: produce
import org.jboss.forge.furnace.services.Imported; //导入依赖的package包/类
@Override
public <T> Collection<T> produce(final Class<T> type)
{
final Collection<T> result = new HashSet<>();
final Furnace furnace = FurnaceHolder.getFurnace();
// Furnace may be not available if the ServiceLoader is called before FurnaceHolder
// has received the Furnace PostConstruct event, so check for null and if it isStarted
if (furnace != null && furnace.getStatus().isStarted())
{
final Imported<T> services = furnace.getAddonRegistry().getServices(type);
for (final T service : services)
{
result.add(service);
}
}
return result;
}
开发者ID:windup,项目名称:windup,代码行数:19,代码来源:FurnaceServiceEnricher.java
示例8: fireListeners
import org.jboss.forge.furnace.services.Imported; //导入依赖的package包/类
private void fireListeners()
{
Imported<AfterGraphInitializationListener> afterInitializationListeners = furnace.getAddonRegistry().getServices(
AfterGraphInitializationListener.class);
Map<String, Object> confProps = new HashMap<>();
Iterator<?> keyIter = conf.getKeys();
while (keyIter.hasNext())
{
String key = (String) keyIter.next();
confProps.put(key, conf.getProperty(key));
}
if (!afterInitializationListeners.isUnsatisfied())
{
for (AfterGraphInitializationListener listener : afterInitializationListeners)
{
listener.afterGraphStarted(confProps, this);
if (listener instanceof BeforeGraphCloseListener)
{
beforeGraphCloseListenerBuffer.put(listener.getClass().toString(), (BeforeGraphCloseListener) listener);
}
}
}
}
开发者ID:windup,项目名称:windup,代码行数:25,代码来源:GraphContextImpl.java
示例9: getResourceFactory
import org.jboss.forge.furnace.services.Imported; //导入依赖的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
示例10: getConverterFactory
import org.jboss.forge.furnace.services.Imported; //导入依赖的package包/类
public ConverterFactory getConverterFactory() {
if (converterFactory == null) {
AddonRegistry addonRegistry = furnace.getAddonRegistry();
Imported<ConverterFactory> converterFactoryImport = addonRegistry.getServices(ConverterFactory.class);
converterFactory = converterFactoryImport.get();
}
return converterFactory;
}
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:9,代码来源:CommandsResource.java
示例11: testWhitelistLookupConvertsClassTypes
import org.jboss.forge.furnace.services.Imported; //导入依赖的package包/类
@Test
public void testWhitelistLookupConvertsClassTypes() 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());
Imported<MockContextConsumer> importedByName = enhancedRegistry.getServices(MockContextConsumer.class.getName());
Assert.assertFalse(importedByName.isUnsatisfied());
MockContextConsumer consumerByName = importedByName.get();
Assert.assertSame(MockContextConsumer.class, consumerByName.getClass().getSuperclass());
Imported<MockContextConsumer> importedByClass = enhancedRegistry.getServices(MockContextConsumer.class);
Assert.assertFalse(importedByClass.isUnsatisfied());
MockContextConsumer consumerByClass = importedByClass.get();
Assert.assertNotSame(MockContextConsumer.class, consumerByClass.getClass());
}
开发者ID:forge,项目名称:furnace,代码行数:30,代码来源:ClassLoaderAdapterWhitelistLoaderLookupTest.java
示例12: testDoesNotResolveNonService
import org.jboss.forge.furnace.services.Imported; //导入依赖的package包/类
@Test(expected = ContainerException.class)
public void testDoesNotResolveNonService() throws Exception
{
AddonRegistry registry = LocalServices.getFurnace(getClass().getClassLoader())
.getAddonRegistry();
Imported<MockServiceConsumer> importedByName = registry.getServices(MockServiceConsumer.class.getName());
Assert.assertTrue(importedByName.isUnsatisfied());
importedByName.get();
}
开发者ID:forge,项目名称:furnace,代码行数:11,代码来源:ImportedLookupTest.java
示例13: shouldResolveImpls
import org.jboss.forge.furnace.services.Imported; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void shouldResolveImpls() throws Exception
{
AddonRegistry registry = LocalServices.getFurnace(getClass().getClassLoader())
.getAddonRegistry();
Imported<MockInterface> imported = registry.getServices(MockInterface.class);
Assert.assertTrue(imported.isAmbiguous());
Assert.assertEquals(3, Iterators.asList(imported).size());
Assert.assertThat(registry.getExportedTypes(MockInterface.class).size(), equalTo(3));
Assert.assertThat(imported, CoreMatchers.<MockInterface> hasItems(
instanceOf(MockImpl1.class),
instanceOf(MockImpl2.class),
instanceOf(SubMockImpl1.class)));
}
开发者ID:forge,项目名称:furnace,代码行数:16,代码来源:ServiceLookupTest.java
示例14: testIsAmbiguous
import org.jboss.forge.furnace.services.Imported; //导入依赖的package包/类
@Test
public void testIsAmbiguous() throws Exception
{
Furnace furnace = LocalServices.getFurnace(getClass().getClassLoader());
AddonRegistry registry = furnace.getAddonRegistry();
Imported<MockInterface> services = registry.getServices(MockInterface.class);
Assert.assertFalse(services.isUnsatisfied());
Assert.assertTrue(services.isAmbiguous());
}
开发者ID:forge,项目名称:furnace,代码行数:10,代码来源:ImportedTest.java
示例15: testIsAmbiguousUsingClassName
import org.jboss.forge.furnace.services.Imported; //导入依赖的package包/类
@Test
public void testIsAmbiguousUsingClassName() throws Exception
{
Furnace furnace = LocalServices.getFurnace(getClass().getClassLoader());
AddonRegistry registry = furnace.getAddonRegistry();
Imported<MockInterface> services = registry.getServices(MockInterface.class.getName());
Assert.assertFalse(services.isUnsatisfied());
Assert.assertTrue(services.isAmbiguous());
}
开发者ID:forge,项目名称:furnace,代码行数:10,代码来源:ImportedTest.java
示例16: lookup
import org.jboss.forge.furnace.services.Imported; //导入依赖的package包/类
public <S> S lookup(Class<S> service)
{
Imported<S> exportedInstance = null;
if (furnace != null)
{
exportedInstance = furnace.getAddonRegistry().getServices(service);
}
return (exportedInstance == null || exportedInstance.isUnsatisfied()) ? null : exportedInstance.get();
}
开发者ID:forge,项目名称:intellij-idea-plugin,代码行数:10,代码来源:ForgeService.java
示例17: lookupImported
import org.jboss.forge.furnace.services.Imported; //导入依赖的package包/类
public <S> Imported<S> lookupImported(Class<S> service)
{
if (furnace == null)
{
createFurnace();
}
Imported<S> importedService = null;
if (furnace != null)
{
importedService = furnace.getAddonRegistry().getServices(service);
}
return importedService;
}
开发者ID:forge,项目名称:intellij-idea-plugin,代码行数:14,代码来源:ForgeService.java
示例18: findFreeMarkerExtensions
import org.jboss.forge.furnace.services.Imported; //导入依赖的package包/类
/**
* Gets freemarker extensions (eg, custom functions) provided by furnace addons
*/
public static Map<String, Object> findFreeMarkerExtensions(Furnace furnace, GraphRewrite event)
{
Imported<WindupFreeMarkerMethod> freeMarkerMethods = furnace.getAddonRegistry().getServices(
WindupFreeMarkerMethod.class);
Map<String, Object> results = new HashMap<>();
for (WindupFreeMarkerMethod freeMarkerMethod : freeMarkerMethods)
{
freeMarkerMethod.setContext(event);
if (results.containsKey(freeMarkerMethod.getMethodName()))
{
throw new WindupException(Util.WINDUP_BRAND_NAME_ACRONYM+" contains two freemarker extension providing the same name: "
+ freeMarkerMethod.getMethodName());
}
results.put(freeMarkerMethod.getMethodName(), freeMarkerMethod);
}
Imported<WindupFreeMarkerTemplateDirective> freeMarkerDirectives = furnace.getAddonRegistry().getServices(
WindupFreeMarkerTemplateDirective.class);
for (WindupFreeMarkerTemplateDirective freeMarkerDirective : freeMarkerDirectives)
{
freeMarkerDirective.setContext(event);
if (results.containsKey(freeMarkerDirective.getDirectiveName()))
{
throw new WindupException(Util.WINDUP_BRAND_NAME_ACRONYM+" contains two freemarker extension providing the same name: "
+ freeMarkerDirective.getDirectiveName());
}
results.put(freeMarkerDirective.getDirectiveName(), freeMarkerDirective);
}
return results;
}
开发者ID:windup,项目名称:windup,代码行数:36,代码来源:FreeMarkerUtil.java
示例19: getServices
import org.jboss.forge.furnace.services.Imported; //导入依赖的package包/类
@Override
public <T> Imported<T> getServices(final Class<T> type)
{
return new ImportedImpl<>(this, lock, type);
}
开发者ID:koentsje,项目名称:forge-furnace,代码行数:6,代码来源:AddonRegistryImpl.java
示例20: testGroovyRuleProviderFactory
import org.jboss.forge.furnace.services.Imported; //导入依赖的package包/类
@Test
public void testGroovyRuleProviderFactory() throws Exception
{
RuleLoaderContext ruleLoaderContext = new RuleLoaderContext();
Imported<RuleProviderLoader> loaders = furnace.getAddonRegistry().getServices(
RuleProviderLoader.class);
Assert.assertNotNull(loaders);
List<RuleProvider> allProviders = new ArrayList<>();
for (RuleProviderLoader loader : loaders)
{
allProviders.addAll(loader.getProviders(ruleLoaderContext));
}
boolean foundRuleProviderOrigin = false;
boolean foundRuleOrigin = false;
boolean foundRhamtRuleProviderOrigin = false;
boolean foundRhamtRuleOrigin = false;
for (RuleProvider provider : allProviders)
{
String providerOrigin = provider.getMetadata().getOrigin();
if (providerOrigin.contains(EXAMPLE_GROOVY_WINDUP_FILE))
{
foundRuleProviderOrigin = true;
}
if (providerOrigin.contains(EXAMPLE_GROOVY_RHAMT_FILE))
{
foundRhamtRuleProviderOrigin = true;
}
Rule rule = RuleBuilder.define();
Context ruleContext = (Context) rule;
AbstractRuleProvider.enhanceRuleMetadata(provider, rule);
String ruleOrigin = ((String) ruleContext.get(RuleMetadataType.ORIGIN));
if (ruleOrigin.contains(EXAMPLE_GROOVY_WINDUP_FILE))
{
foundRuleOrigin = true;
}
else if (ruleOrigin.contains(EXAMPLE_GROOVY_RHAMT_FILE))
{
foundRhamtRuleOrigin = true;
}
}
Assert.assertTrue("Script path should have been set in Rule Metatada", foundRuleOrigin);
Assert.assertTrue("Script path should have been set in Rule Provider Metatada", foundRuleProviderOrigin);
Assert.assertTrue("Script path should have been set in RHAMT Rule Metatada", foundRhamtRuleOrigin);
Assert.assertTrue("Script path should have been set in RHAMT Rule Provider Metatada", foundRhamtRuleProviderOrigin);
Assert.assertTrue(allProviders.size() > 0);
}
开发者ID:windup,项目名称:windup,代码行数:54,代码来源:LoadGroovyRulesTest.java
注:本文中的org.jboss.forge.furnace.services.Imported类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论