本文整理汇总了Java中org.picocontainer.MutablePicoContainer类的典型用法代码示例。如果您正苦于以下问题:Java MutablePicoContainer类的具体用法?Java MutablePicoContainer怎么用?Java MutablePicoContainer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MutablePicoContainer类属于org.picocontainer包,在下文中一共展示了MutablePicoContainer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newFactory
import org.picocontainer.MutablePicoContainer; //导入依赖的package包/类
public static <T> T newFactory(@NotNull final Class<T> clusterClientInterface,
@NotNull final Config clusterConfig,
@NotNull final ActorRegistry actorRegistry) {
requireNonNull(clusterClientInterface);
requireNonNull(clusterConfig);
requireNonNull(actorRegistry);
String factoryClassName = clusterConfig.getString(FACTORY_CLASS);
Config factoryConfig = clusterConfig.getConfig(FACTORY_CONFIG);
MutablePicoContainer container = new DefaultPicoContainer();
container.addComponent(factoryConfig);
container.addComponent(actorRegistry);
try {
Class<? extends T> factoryClass = Class.forName(factoryClassName) // NOSONAR
.asSubclass(clusterClientInterface); // NOSONAR
container.addComponent(factoryClass);
return container.getComponent(factoryClass);
} catch (ClassNotFoundException e) {
throw propagate(e);
}
}
示例2: createReactor
import org.picocontainer.MutablePicoContainer; //导入依赖的package包/类
/**
* Inject dependencies to create a reactor.
*/
private Reactor<Serializable> createReactor(final ActorKey key, //
final Metrics metrics, //
final Class<? extends Reactor> clazz, //
final ActorClusterClient client, //
final Config config) {
MutablePicoContainer pico = new DefaultPicoContainer();
pico.addComponent(key);
pico.addComponent(config);
pico.addComponent((Sender) (to, payload) -> {
requireNonNull(to);
requireNonNull(payload);
client.actorSender().send(new ActorKey(to), ActorInputMessage.message(key.getName(), payload));
});
pico.addComponent(metrics);
pico.addComponent(clazz);
return pico.getComponent(clazz);
}
示例3: setDummyWorkspacePathResolverProvider
import org.picocontainer.MutablePicoContainer; //导入依赖的package包/类
private void setDummyWorkspacePathResolverProvider(WorkspacePathResolver workspacePathResolver) {
MutablePicoContainer container = (MutablePicoContainer) getProject().getPicoContainer();
Class<WorkspacePathResolverProvider> key = WorkspacePathResolverProvider.class;
Object oldProvider = container.getComponentInstance(key);
container.unregisterComponent(key.getName());
container.registerComponentInstance(
key.getName(), (WorkspacePathResolverProvider) () -> workspacePathResolver);
if (!settingsInitialized) {
Disposer.register(
parentDisposable,
() -> {
container.unregisterComponent(key.getName());
if (oldProvider != null) {
container.registerComponentInstance(key.getName(), oldProvider);
}
});
}
}
示例4: setupAppEngine
import org.picocontainer.MutablePicoContainer; //导入依赖的package包/类
private void setupAppEngine(AppEngineStandardLibraryPanel libraryPanel, Library library) {
CloudSdkService sdkService = mock(CloudSdkService.class);
when(sdkService.getLibraries()).thenReturn(new File[] {});
MavenRepositoryLibraryDownloader libraryDownloader =
mock(MavenRepositoryLibraryDownloader.class);
when(libraryDownloader.downloadLibrary(
any(Module.class), any(AppEngineStandardMavenLibrary.class)))
.thenReturn(library);
MutablePicoContainer applicationContainer =
(MutablePicoContainer) ApplicationManager.getApplication().getPicoContainer();
applicationContainer.unregisterComponent(CloudSdkService.class.getName());
applicationContainer.registerComponentInstance(CloudSdkService.class.getName(), sdkService);
applicationContainer.unregisterComponent(MavenRepositoryLibraryDownloader.class.getName());
applicationContainer.registerComponentInstance(
MavenRepositoryLibraryDownloader.class.getName(), libraryDownloader);
FrameworkSupportInModuleConfigurable configurable =
selectFramework(AppEngineStandardFrameworkType.ID);
if (libraryPanel != null && configurable instanceof AppEngineSupportConfigurable) {
((AppEngineSupportConfigurable) configurable).setAppEngineStandardLibraryPanel(libraryPanel);
}
AppEngineStandardSupportProvider.setSdkPath(
configurable, AppEngineCodeInsightTestCase.getSdkPath());
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:27,代码来源:AppEngineStandardSupportProviderTest.java
示例5: createPicoContatiner
import org.picocontainer.MutablePicoContainer; //导入依赖的package包/类
private MutablePicoContainer createPicoContatiner() {
final MutablePicoContainer picoContainer = new PicoBuilder()
.withBehaviors(new OptInCaching())
.withComponentFactory(new CompositeInjection(new AnnotatedFieldInjection(Inject.class)))
.build();
picoContainer.addComponent(PicoContainer.class, picoContainer);
picoContainer.as(Characteristics.CACHE).addComponent(Pico2InjectContext.class);
picoContainer.as(Characteristics.CACHE).addComponent(TestLazySingleton.class);
picoContainer.as(Characteristics.CACHE).addComponent(TestEagerSingleton.class);
picoContainer.addComponent(TestPrototype.class);
picoContainer.addComponent("key", "value");
return picoContainer;
}
示例6: unregisterComponentAdapter
import org.picocontainer.MutablePicoContainer; //导入依赖的package包/类
synchronized boolean unregisterComponentAdapter(@NotNull ExtensionComponentAdapter componentAdapter) {
try {
if (myExtensionAdapters.remove(componentAdapter)) {
return true;
}
if (myLoadedAdapters.contains(componentAdapter)) {
final Object componentKey = componentAdapter.getComponentKey();
myOwner.getMutablePicoContainer().unregisterComponent(componentKey);
final MutablePicoContainer[] pluginContainers = myOwner.getPluginContainers();
for (MutablePicoContainer pluginContainer : pluginContainers) {
pluginContainer.unregisterComponent(componentKey);
}
@SuppressWarnings("unchecked") T extension = (T)componentAdapter.getExtension();
internalUnregisterExtension(extension, componentAdapter.getPluginDescriptor());
return true;
}
return false;
}
finally {
clearCache();
}
}
示例7: unregisterExtension
import org.picocontainer.MutablePicoContainer; //导入依赖的package包/类
@Override
public void unregisterExtension(@NotNull String pluginName, @NotNull Element extensionElement) {
String epName = extractEPName(extensionElement);
if (!myExtensionElement2extension.containsKey(extensionElement)) {
XMLOutputter xmlOutputter = new XMLOutputter();
Format format = Format.getCompactFormat().setIndent(" ").setTextMode(Format.TextMode.NORMALIZE);
xmlOutputter.setFormat(format);
StringWriter stringWriter = new StringWriter();
try {
xmlOutputter.output(extensionElement, stringWriter);
}
catch (IOException e) {
throw new RuntimeException(e);
}
myLogger.warn(stringWriter.toString());
throw new IllegalArgumentException("Trying to unregister extension element that was never registered");
}
ExtensionComponentAdapter adapter = myExtensionElement2extension.remove(extensionElement);
if (adapter == null) return;
if (getExtensionPoint(epName).unregisterComponentAdapter(adapter)) {
MutablePicoContainer pluginContainer = internalGetPluginContainer();
pluginContainer.unregisterComponent(adapter.getComponentKey());
}
}
示例8: ComponentContainer
import org.picocontainer.MutablePicoContainer; //导入依赖的package包/类
protected ComponentContainer(MutablePicoContainer picoContainer) {
this.parent = null;
this.pico = picoContainer;
this.componentKeys = new ComponentKeys();
propertyDefinitions = new PropertyDefinitions();
addSingleton(propertyDefinitions);
addSingleton(this);
}
示例9: createPicoContainer
import org.picocontainer.MutablePicoContainer; //导入依赖的package包/类
public static MutablePicoContainer createPicoContainer() {
ReflectionLifecycleStrategy lifecycleStrategy = new ReflectionLifecycleStrategy(new NullComponentMonitor(), "start", "stop", "close") {
@Override
public void start(Object component) {
Profiler profiler = Profiler.createIfTrace(Loggers.get(ComponentContainer.class));
profiler.start();
super.start(component);
profiler.stopTrace(component.getClass().getCanonicalName() + " started");
}
};
return new ExtendedDefaultPicoContainer(new OptInCaching(), lifecycleStrategy, null);
}
示例10: newPicoLifecycleException
import org.picocontainer.MutablePicoContainer; //导入依赖的package包/类
private PicoLifecycleException newPicoLifecycleException(boolean initialCheckedException) {
MutablePicoContainer container = ComponentContainer.createPicoContainer().as(Characteristics.CACHE);
if (initialCheckedException) {
container.addComponent(CheckedFailureComponent.class);
} else {
container.addComponent(UncheckedFailureComponent.class);
}
try {
container.start();
return null;
} catch (PicoLifecycleException e) {
return e;
}
}
示例11: initComponent
import org.picocontainer.MutablePicoContainer; //导入依赖的package包/类
@Override
public void initComponent() {
MutablePicoContainer picoContainer = (MutablePicoContainer) ApplicationManager.getApplication().getPicoContainer();
BranchNameFrameTitleBuilder.setDefaultBuilder(
(FrameTitleBuilder) picoContainer.getComponentInstance(FRAME_TITLE_BUILDER)
);
picoContainer.unregisterComponent(FRAME_TITLE_BUILDER);
picoContainer.registerComponentImplementation(FRAME_TITLE_BUILDER, BranchNameFrameTitleBuilder.class);
}
示例12: initComponent
import org.picocontainer.MutablePicoContainer; //导入依赖的package包/类
@Override
public void initComponent() {
// use https://github.com/Steve-Murphy/mavenversion-plugin as a template.
MutablePicoContainer picoContainer = (MutablePicoContainer) ApplicationManager.getApplication().getPicoContainer();
CustomFrameTitleBuilder.setDefaultBuilder((FrameTitleBuilder) picoContainer.getComponentInstance(FRAME_TITLE_BUILDER));
picoContainer.unregisterComponent(FRAME_TITLE_BUILDER);
picoContainer.registerComponentImplementation(FRAME_TITLE_BUILDER, CustomFrameTitleBuilder.class);
}
示例13: initWfsConfiguration
import org.picocontainer.MutablePicoContainer; //导入依赖的package包/类
public static void initWfsConfiguration(
Configuration config, GeoServer gs, ISOFeatureTypeSchemaBuilder schemaBuilder) {
MutablePicoContainer context = config.getContext();
//seed the cache with entries from the catalog
FeatureTypeCache featureTypeCache = new FeatureTypeCache();
Collection featureTypes = gs.getCatalog().getFeatureTypes();
for (Iterator f = featureTypes.iterator(); f.hasNext();) {
FeatureTypeInfo meta = (FeatureTypeInfo) f.next();
if ( !meta.enabled() ) {
continue;
}
FeatureType featureType = null;
try {
featureType = meta.getFeatureType();
}
catch(Exception e) {
throw new RuntimeException(e);
}
featureTypeCache.put(featureType);
}
//add the wfs handler factory to handle feature elements
context.registerComponentInstance(featureTypeCache);
context.registerComponentInstance(new ISOWFSHandlerFactory(gs.getCatalog(), schemaBuilder));
}
示例14: registerBindings
import org.picocontainer.MutablePicoContainer; //导入依赖的package包/类
protected void registerBindings(MutablePicoContainer container) {
//Types
container.registerComponentImplementation(WFS_ISO.ALLSOMETYPE, AllSomeTypeBinding.class);
container.registerComponentImplementation(WFS_ISO.DELETEELEMENTTYPE,
DeleteElementTypeBinding.class);
container.registerComponentImplementation(WFS_ISO.DESCRIBEFEATURETYPETYPE,
DescribeFeatureTypeTypeBinding.class);
container.registerComponentImplementation(WFS_ISO.EMPTYTYPE, EmptyTypeBinding.class);
container.registerComponentImplementation(WFS_ISO.FEATURECOLLECTIONTYPE,
FeatureCollectionTypeBinding.class);
container.registerComponentImplementation(WFS_ISO.FEATURESLOCKEDTYPE,
FeaturesLockedTypeBinding.class);
container.registerComponentImplementation(WFS_ISO.FEATURESNOTLOCKEDTYPE,
FeaturesNotLockedTypeBinding.class);
container.registerComponentImplementation(WFS_ISO.GETCAPABILITIESTYPE,
GetCapabilitiesTypeBinding.class);
container.registerComponentImplementation(WFS_ISO.GETFEATURETYPE, GetFeatureTypeBinding.class);
container.registerComponentImplementation(WFS_ISO.GETFEATUREWITHLOCKTYPE,
GetFeatureWithLockTypeBinding.class);
container.registerComponentImplementation(WFS_ISO.INSERTELEMENTTYPE,
InsertElementTypeBinding.class);
container.registerComponentImplementation(WFS_ISO.INSERTRESULTTYPE,
InsertResultTypeBinding.class);
container.registerComponentImplementation(WFS_ISO.LOCKFEATURETYPE, LockFeatureTypeBinding.class);
container.registerComponentImplementation(WFS_ISO.LOCKTYPE, LockTypeBinding.class);
container.registerComponentImplementation(WFS_ISO.NATIVETYPE, NativeTypeBinding.class);
container.registerComponentImplementation(WFS_ISO.PROPERTYTYPE, PropertyTypeBinding.class);
container.registerComponentImplementation(WFS_ISO.QUERYTYPE, QueryTypeBinding.class);
container.registerComponentImplementation(WFS_ISO.STATUSTYPE, StatusTypeBinding.class);
container.registerComponentImplementation(WFS_ISO.TRANSACTIONRESULTTYPE,
TransactionResultTypeBinding.class);
container.registerComponentImplementation(WFS_ISO.TRANSACTIONTYPE, TransactionTypeBinding.class);
container.registerComponentImplementation(WFS_ISO.UPDATEELEMENTTYPE,
UpdateElementTypeBinding.class);
container.registerComponentImplementation(WFS_ISO.WFS_LOCKFEATURERESPONSETYPE,
WFS_LockFeatureResponseTypeBinding.class);
container.registerComponentImplementation(WFS_ISO.WFS_TRANSACTIONRESPONSETYPE,
WFS_TransactionResponseTypeBinding.class);
}
示例15: configureContext
import org.picocontainer.MutablePicoContainer; //导入依赖的package包/类
public void configureContext(MutablePicoContainer context) {
super.configureContext(context);
context.registerComponentInstance(Ows10Factory.eINSTANCE);
context.registerComponentInstance(WfsFactory.eINSTANCE);
context.registerComponentInstance(new ISOWFSHandlerFactory(catalog, schemaBuilder));
context.registerComponentInstance(catalog);
context.registerComponentImplementation(PropertyTypePropertyExtractor.class);
//TODO: this code is copied from the 1.1 configuration, FACTOR IT OUT!!!
//seed the cache with entries from the catalog
context.registerComponentInstance(FeatureTypeCache.class, new CatalogFeatureTypeCache(getCatalog()));
}