当前位置: 首页>>代码示例>>Java>>正文


Java DefaultContainerConfiguration.setComponentVisibility方法代码示例

本文整理汇总了Java中org.codehaus.plexus.DefaultContainerConfiguration.setComponentVisibility方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultContainerConfiguration.setComponentVisibility方法的具体用法?Java DefaultContainerConfiguration.setComponentVisibility怎么用?Java DefaultContainerConfiguration.setComponentVisibility使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.codehaus.plexus.DefaultContainerConfiguration的用法示例。


在下文中一共展示了DefaultContainerConfiguration.setComponentVisibility方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createTest

import org.codehaus.plexus.DefaultContainerConfiguration; //导入方法依赖的package包/类
@Override
protected Object createTest()
    throws Exception
{
    final TestClass testClass = getTestClass();

    final DefaultContainerConfiguration config = new DefaultContainerConfiguration();

    config.setAutoWiring( true );
    config.setClassPathScanning( PlexusConstants.SCANNING_ON );
    config.setComponentVisibility( PlexusConstants.GLOBAL_VISIBILITY );
    config.setName( testClass.getName() );

    final DefaultPlexusContainer container = new DefaultPlexusContainer( config );
    final ClassSpace cs = new URLClassSpace( Thread.currentThread()
                                                   .getContextClassLoader() );

    container.addPlexusInjector( Arrays.<PlexusBeanModule> asList( new PlexusAnnotatedBeanModule(
                                                                                                  cs,
                                                                                                  Collections.emptyMap() ) ) );

    return container.lookup( testClass.getJavaClass() );
}
 
开发者ID:release-engineering,项目名称:pom-manipulation-ext,代码行数:24,代码来源:PlexusTestRunner.java

示例2: initialize

import org.codehaus.plexus.DefaultContainerConfiguration; //导入方法依赖的package包/类
@PostConstruct
public void initialize()
    throws PlexusSisuBridgeException
{
    DefaultContainerConfiguration conf = new DefaultContainerConfiguration();

    conf.setAutoWiring( containerAutoWiring );
    conf.setClassPathScanning( containerClassPathScanning );
    conf.setComponentVisibility( containerComponentVisibility );

    conf.setContainerConfigurationURL( overridingComponentsXml );

    ClassWorld classWorld = new ClassWorld();

    ClassLoader tccl = Thread.currentThread().getContextClassLoader();

    containerRealm = new ClassRealm( classWorld, "maven", tccl );

    // olamy hackhish but plexus-sisu need a URLClassLoader with URL filled

    if ( tccl instanceof URLClassLoader )
    {
        URL[] urls = ( (URLClassLoader) tccl ).getURLs();
        for ( URL url : urls )
        {
            containerRealm.addURL( url );
        }
    }

    conf.setRealm( containerRealm );

    //conf.setClassWorld( classWorld );

    ClassLoader ori = Thread.currentThread().getContextClassLoader();

    try
    {
        Thread.currentThread().setContextClassLoader( containerRealm );
        plexusContainer = new DefaultPlexusContainer( conf );
    }
    catch ( PlexusContainerException e )
    {
        throw new PlexusSisuBridgeException( e.getMessage(), e );
    }
    finally
    {
        Thread.currentThread().setContextClassLoader( ori );
    }
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:50,代码来源:PlexusSisuBridge.java


注:本文中的org.codehaus.plexus.DefaultContainerConfiguration.setComponentVisibility方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。