org.codehaus.plexus.context.Context.getContextData()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(121)

本文整理了Java中org.codehaus.plexus.context.Context.getContextData()方法的一些代码示例,展示了Context.getContextData()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Context.getContextData()方法的具体详情如下:
包路径:org.codehaus.plexus.context.Context
类名称:Context
方法名:getContextData

Context.getContextData介绍

[英]Utility method to retrieve containerContext data. the returned Map is an unmodifiable view.
[中]检索containerContext数据的实用方法。返回的映射是不可修改的视图。

代码示例

代码示例来源:origin: org.apache.maven.plugin-testing/maven-plugin-testing-harness

protected void setUp()
  throws Exception
{
  assertTrue( "Maven 3.2.4 or better is required",
        MAVEN_VERSION == null || new DefaultArtifactVersion( "3.2.3" ).compareTo( MAVEN_VERSION ) < 0 );
  configurator = getContainer().lookup( ComponentConfigurator.class, "basic" );
  InputStream is = getClass().getResourceAsStream( "/" + getPluginDescriptorLocation() );
  XmlStreamReader reader = new XmlStreamReader( is );
  InterpolationFilterReader interpolationFilterReader =
    new InterpolationFilterReader( new BufferedReader( reader ), container.getContext().getContextData() );
  PluginDescriptor pluginDescriptor = new PluginDescriptorBuilder().build( interpolationFilterReader );
  Artifact artifact =
    lookup( RepositorySystem.class ).createArtifact( pluginDescriptor.getGroupId(),
                             pluginDescriptor.getArtifactId(),
                             pluginDescriptor.getVersion(), ".jar" );
  artifact.setFile( getPluginArtifactFile() );
  pluginDescriptor.setPluginArtifact( artifact );
  pluginDescriptor.setArtifacts( Arrays.asList( artifact ) );
  for ( ComponentDescriptor<?> desc : pluginDescriptor.getComponents() )
  {
    getContainer().addComponentDescriptor( desc );
  }
  mojoDescriptors = new HashMap<String, MojoDescriptor>();
  for ( MojoDescriptor mojoDescriptor : pluginDescriptor.getMojos() )
  {
    mojoDescriptors.put( mojoDescriptor.getGoal(), mojoDescriptor );
  }
}

代码示例来源:origin: org.eclipse.sisu/org.eclipse.sisu.plexus

public ContextMapAdapter( final Context context )
{
  contextData = context.getContextData();
}

代码示例来源:origin: org.eclipse.sisu/org.eclipse.sisu.plexus

public void configure( final Binder binder )
  {
    binder.bind( Context.class ).toInstance( context );
    binder.bind( ParameterKeys.PROPERTIES ).toInstance( context.getContextData() );
    binder.bind( MutableBeanLocator.class ).toInstance( qualifiedBeanLocator );
    binder.bind( PlexusBeanLocator.class ).toInstance( plexusBeanLocator );
    binder.bind( BeanManager.class ).toInstance( plexusBeanManager );
    binder.bind( PlexusContainer.class ).to( MutablePlexusContainer.class );
    binder.bind( MutablePlexusContainer.class ).to( DefaultPlexusContainer.class );
    // use provider wrapper to avoid repeated injections later on when configuring plugin injectors
    binder.bind( DefaultPlexusContainer.class ).toProvider( Providers.of( DefaultPlexusContainer.this ) );
  }
}

代码示例来源:origin: ingenieux/beanstalker

for (Map.Entry<Object, Object> e : context.getContextData().entrySet()) {
 if (!("" + e.getKey()).startsWith(BEANSTALK_TAG_PREFIX)) continue;

代码示例来源:origin: org.sonatype.nexus/nexus-configuration

public void contextualize( Context context )
  throws ContextException
{
  regexBasedInterpolator.addValueSource( new MapBasedValueSource( context.getContextData() ) );
  // FIXME: bad, everything should come from Plexus context
  regexBasedInterpolator.addValueSource( new MapBasedValueSource( System.getenv() ) );
  // FIXME: bad, everything should come from Plexus context
  regexBasedInterpolator.addValueSource( new MapBasedValueSource( System.getProperties() ) );
}

代码示例来源:origin: org.codehaus.plexus/plexus-appserver-host

contextMap.putAll( containerContext.getContextData() );

代码示例来源:origin: io.takari.maven.plugins/takari-plugin-testing

Map contextData = container.getContext().getContextData();
@SuppressWarnings("unchecked")
InterpolationFilterReader interpolationFilterReader = new InterpolationFilterReader(new BufferedReader(reader), contextData);

代码示例来源:origin: com.simpligility.org.apache.maven.plugin-testing/maven-plugin-testing-harness

protected void setUp()
  throws Exception
{
  configurator = getContainer().lookup( ComponentConfigurator.class, "basic" );
  InputStream is = getClass().getResourceAsStream( "/" + getPluginDescriptorLocation() );
  XmlStreamReader reader = new XmlStreamReader( is );
  InterpolationFilterReader interpolationFilterReader =
    new InterpolationFilterReader( new BufferedReader( reader ), container.getContext().getContextData() );
  PluginDescriptor pluginDescriptor = new PluginDescriptorBuilder().build( interpolationFilterReader );
  Artifact artifact =
    lookup( RepositorySystem.class ).createArtifact( pluginDescriptor.getGroupId(),
                             pluginDescriptor.getArtifactId(),
                             pluginDescriptor.getVersion(), ".jar" );
  artifact.setFile( new File( getBasedir() ).getCanonicalFile() );
  pluginDescriptor.setPluginArtifact( artifact );
  pluginDescriptor.setArtifacts( Arrays.asList( artifact ) );
  for ( ComponentDescriptor<?> desc : pluginDescriptor.getComponents() )
  {
    getContainer().addComponentDescriptor( desc );
  }
  mojoDescriptors = new HashMap<String, MojoDescriptor>();
  for ( MojoDescriptor mojoDescriptor : pluginDescriptor.getMojos() )
  {
    mojoDescriptors.put( mojoDescriptor.getGoal(), mojoDescriptor );
  }
}

代码示例来源:origin: org.eclipse.sisu/org.eclipse.sisu.plexus

private final Map<Object, Object> context()
{
  final Context context = new DefaultContext();
  context.put( "basedir", getBasedir() );
  // Per-test context customization
  customizeContext( context );
  // Provide 'plexus.home' fall-back
  if ( !context.contains( PLEXUS_HOME ) )
  {
    context.put( PLEXUS_HOME, plexusHome() );
  }
  return context.getContextData();
}

相关文章

微信公众号

最新文章

更多