org.codehaus.plexus.context.Context类的使用及代码示例

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

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

Context介绍

[英]Context of the plexus container.
[中]丛容器的上下文。

代码示例

代码示例来源:origin: org.apache.maven/maven-project

public void contextualize( Context context )
  throws ContextException
{
  container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
}

代码示例来源:origin: org.apache.maven/maven-project

container.getContext().put("SystemProperties", null);
if ( activators != null )

代码示例来源:origin: org.wisdom-framework/wisdom-maven-plugin

/**
 * Gets the list of watchers from the given Plexus context.
 *
 * @param context the Plexus context
 * @return the list of watcher, empty if none. Modifying the resulting list, updates the stored list.
 */
static synchronized List<Watcher> get(Context context) {
  List<Watcher> watchers;
  if (context.contains(WATCHERS_KEY)) {
    try {
      watchers = (List<Watcher>) context.get(WATCHERS_KEY);
    } catch (ContextException e) {
      throw new IllegalStateException("Cannot extract the watcher from the context", e);
    }
  } else {
    watchers = new ArrayList<>();
    context.put(WATCHERS_KEY, watchers);
  }
  return watchers;
}

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

public void contextualize( Context context )
  throws ContextException
{
  container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
  container.addContextValue( ApplicationServerConstants.APP_SERVER_CONTEXT_KEY, this );
  if ( context.contains( ApplicationServerConstants.APP_SERVER_HOME_KEY ) )
  {
    appServerHome = new File( (String) context.get( ApplicationServerConstants.APP_SERVER_HOME_KEY ) );
  }
  else if ( context.contains( "plexus.home" ) )
  {
    appServerHome = new File( (String) context.get( "plexus.home" ) );
  }
  if ( context.contains( ApplicationServerConstants.APP_SERVER_BASE_KEY ) )
  {
    appServerBase = new File( (String) context.get( ApplicationServerConstants.APP_SERVER_BASE_KEY ) );
  }
  else
  {
    appServerBase = appServerHome;
  }
}

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

contextMap.putAll( containerContext.getContextData() );
  appserver = serverContainer.getContext().get( ApplicationServerConstants.APP_SERVER_CONTEXT_KEY );

代码示例来源: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();
}

代码示例来源: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.codehaus.plexus/com.springsource.org.codehaus.plexus.container

/**
 * Returns true if the map or the parent map contains the key.
 *
 * @param key The key to search for.
 * @return Returns true if the key was found.
 */
public boolean contains( Object key )
{
  Object data = contextData.get( key );
  if ( null != data )
  {
    if ( data instanceof Hidden )
    {
      return false;
    }
    return true;
  }
  // If data was null, check the parent
  if ( null == parent )
  {
    return false;
  }
  return parent.contains( key );
}

代码示例来源:origin: org.codehaus.mojo/build-context

public static Map getContextContainerMap( String containerKey, Context context, boolean create )
{
  Map containerMap = null;
  if ( context.contains( containerKey ) )
  {
    try
    {
      containerMap = (Map) context.get( containerKey );
    }
    catch ( ContextException e )
    {
      throw new IllegalStateException( "Failed to retrieve BuildAdvisor "
              + "serialization map from context, though the context claims it exists. Error: "
              + e.getMessage() );
    }
  }
  else if ( create )
  {
    containerMap = new HashMap();
    context.put( containerKey, containerMap );
  }
  return containerMap;
}

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

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

代码示例来源:origin: org.apache.maven/maven-project

public void contextualize(Context context) throws ContextException 
{
  properties = (Properties)context.get("SystemProperties");
}

代码示例来源:origin: org.codehaus.plexus/plexus-container-default

public void addContextValue( Object key, Object value )
{
  containerContext.put( key, value );
}

代码示例来源: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: apache/maven

public void contextualize( Context context )
  throws ContextException
{
  properties = (Properties) context.get( "SystemProperties" );
}

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

/**
 * {@inheritDoc}
 * @see org.codehaus.plexus.PlexusContainer#addContextValue(java.lang.Object, java.lang.Object)
 */
public void addContextValue( Object key, Object value )
{
  context.put( key, value );
}

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

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

代码示例来源:origin: apache/maven

public void contextualize( Context context )
    throws ContextException
  {
    container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
  }
}

代码示例来源:origin: org.codehaus.redback/plexus-spring

/**
 * {@inheritDoc}
 * @see org.codehaus.plexus.PlexusContainer#addContextValue(java.lang.Object, java.lang.Object)
 */
public void addContextValue( Object key, Object value )
{
  context.put( key, value );
}

代码示例来源: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: fabric8io/docker-maven-plugin

@Override
public void contextualize(Context context) throws ContextException {
  authConfigFactory = new AuthConfigFactory((PlexusContainer) context.get(PlexusConstants.PLEXUS_KEY));
}

相关文章

微信公众号

最新文章

更多