本文整理匯總了Java中org.codehaus.plexus.component.repository.exception.ComponentLookupException類的典型用法代碼示例。如果您正苦於以下問題:Java ComponentLookupException類的具體用法?Java ComponentLookupException怎麽用?Java ComponentLookupException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ComponentLookupException類屬於org.codehaus.plexus.component.repository.exception包,在下文中一共展示了ComponentLookupException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: lookupList
import org.codehaus.plexus.component.repository.exception.ComponentLookupException; //導入依賴的package包/類
public <T> List<T> lookupList( Class<T> clazz )
throws PlexusSisuBridgeException
{
ClassLoader ori = Thread.currentThread().getContextClassLoader();
try
{
Thread.currentThread().setContextClassLoader( containerRealm );
return plexusContainer.lookupList( clazz );
}
catch ( ComponentLookupException e )
{
throw new PlexusSisuBridgeException( e.getMessage(), e );
}
finally
{
Thread.currentThread().setContextClassLoader( ori );
}
}
示例2: createProjectLikeEmbedder
import org.codehaus.plexus.component.repository.exception.ComponentLookupException; //導入依賴的package包/類
public static @NonNull MavenEmbedder createProjectLikeEmbedder() throws PlexusContainerException {
final String mavenCoreRealmId = "plexus.core";
ContainerConfiguration dpcreq = new DefaultContainerConfiguration()
.setClassWorld( new ClassWorld(mavenCoreRealmId, EmbedderFactory.class.getClassLoader()) )
.setClassPathScanning( PlexusConstants.SCANNING_INDEX )
.setName("maven");
DefaultPlexusContainer pc = new DefaultPlexusContainer(dpcreq, new ExtensionModule());
pc.setLoggerManager(new NbLoggerManager());
Properties userprops = new Properties();
userprops.putAll(getCustomGlobalUserProperties());
EmbedderConfiguration configuration = new EmbedderConfiguration(pc, cloneStaticProps(), userprops, true, getSettingsXml());
try {
return new MavenEmbedder(configuration);
//MEVENIDE-634 make all instances non-interactive
// WagonManager wagonManager = (WagonManager) embedder.getPlexusContainer().lookup(WagonManager.ROLE);
// wagonManager.setInteractive(false);
} catch (ComponentLookupException ex) {
throw new PlexusContainerException(ex.toString(), ex);
}
}
示例3: setupHintedShader
import org.codehaus.plexus.component.repository.exception.ComponentLookupException; //導入依賴的package包/類
private void setupHintedShader()
throws MojoExecutionException
{
if ( shaderHint != null )
{
try
{
shader = (Shader) plexusContainer.lookup( Shader.ROLE, shaderHint );
}
catch ( ComponentLookupException e )
{
throw new MojoExecutionException( "unable to lookup own Shader implementation with hint:'" + shaderHint
+ "'", e );
}
}
}
示例4: lookup
import org.codehaus.plexus.component.repository.exception.ComponentLookupException; //導入依賴的package包/類
public <T> T lookup( Class<T> clazz )
throws PlexusSisuBridgeException
{
ClassLoader ori = Thread.currentThread().getContextClassLoader();
try
{
Thread.currentThread().setContextClassLoader( containerRealm );
return plexusContainer.lookup( clazz );
}
catch ( ComponentLookupException e )
{
throw new PlexusSisuBridgeException( e.getMessage(), e );
}
finally
{
Thread.currentThread().setContextClassLoader( ori );
}
}
示例5: lookupMap
import org.codehaus.plexus.component.repository.exception.ComponentLookupException; //導入依賴的package包/類
public <T> Map<String, T> lookupMap( Class<T> clazz )
throws PlexusSisuBridgeException
{
ClassLoader ori = Thread.currentThread().getContextClassLoader();
try
{
Thread.currentThread().setContextClassLoader( containerRealm );
return plexusContainer.lookupMap( clazz );
}
catch ( ComponentLookupException e )
{
throw new PlexusSisuBridgeException( e.getMessage(), e );
}
finally
{
Thread.currentThread().setContextClassLoader( ori );
}
}
示例6: executeUserFilterComponents
import org.codehaus.plexus.component.repository.exception.ComponentLookupException; //導入依賴的package包/類
protected void executeUserFilterComponents(MavenResourcesExecution mavenResourcesExecution)
throws MojoExecutionException, MavenFilteringException {
if (mavenFilteringHints != null) {
for (String hint : mavenFilteringHints) {
try {
mavenFilteringComponents.add((MavenResourcesFiltering) plexusContainer
.lookup(MavenResourcesFiltering.class.getName(), hint));
} catch (ComponentLookupException e) {
throw new MojoExecutionException(e.getMessage(), e);
}
}
} else {
getLog().debug("no use filter components");
}
if (mavenFilteringComponents != null && !mavenFilteringComponents.isEmpty()) {
getLog().debug("execute user filters");
for (MavenResourcesFiltering filter : mavenFilteringComponents) {
filter.filterResources(mavenResourcesExecution);
}
}
}
示例7: getDefaultLifecycle
import org.codehaus.plexus.component.repository.exception.ComponentLookupException; //導入依賴的package包/類
private Lifecycle getDefaultLifecycle( MavenProject project )
throws MojoExecutionException
{
ClassRealm projectRealm = project.getClassRealm();
if ( projectRealm == null )
projectRealm = container.getContainerRealm();
ClassRealm oldLookupRealm = container.setLookupRealm( projectRealm );
ClassLoader oldContextClassLoader = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader( projectRealm );
try
{
return container.lookup( LifecycleMapping.class, project.getPackaging() ).getLifecycles().get( "default" );
}
catch ( ComponentLookupException e )
{
throw new MojoExecutionException( "Unable to get lifecycle for project " + project.getId(), e );
}
finally
{
Thread.currentThread().setContextClassLoader( oldContextClassLoader );
container.setLookupRealm( oldLookupRealm );
}
}
示例8: insertShards
import org.codehaus.plexus.component.repository.exception.ComponentLookupException; //導入依賴的package包/類
private void insertShards() throws ComponentLookupException, SQLException {
long currentShardId = beginShardId;
long currentDcClusterShardId = beginDcClusterShardId;
for(int i=0; i < shardCount ; i++){
String shardName = gtShardName(i);
String insertShard = String.format(
"insert into SHARD_TBL " +
"(id,shard_name,cluster_id) values (%d, '%s', %d);", currentShardId, shardName, clusterId);
executeSqlScript(insertShard);
for(Long dc_cluster_id : dcClusterIds){
String insertDcClusterShard = String.format(
"insert into DC_CLUSTER_SHARD_TBL " +
"(dc_cluster_shard_id,dc_cluster_id,shard_id,setinel_id,dc_cluster_shard_phase) " +
"values (%d,%d,%d,1,1);", currentDcClusterShardId, dc_cluster_id, currentShardId);
executeSqlScript(insertDcClusterShard);
dcClusterShardIds.add(currentDcClusterShardId);
currentDcClusterShardId++;
}
currentShardId++;
}
}
示例9: createTest
import org.codehaus.plexus.component.repository.exception.ComponentLookupException; //導入依賴的package包/類
@Test
@DirtiesContext
public void createTest() throws ComponentLookupException {
long eventId = migrationService.createMigrationEvent(createEventDemo(1,2));
MigrationEventTbl result = migrationService.find(eventId);
MigrationClusterTbl result_cluster = migrationService.findMigrationCluster(eventId, 1);
ClusterTbl cluster = clusterService.find(1);
List<MigrationShardTbl> result_shards = migrationService.findMigrationShards(result_cluster.getId());
Assert.assertEquals(eventId, result.getId());
Assert.assertEquals("unit test", result.getOperator());
Assert.assertNotNull(result_cluster);
Assert.assertEquals(1, result_cluster.getClusterId());
Assert.assertEquals(2, result_cluster.getDestinationDcId());
Assert.assertEquals(MigrationStatus.Initiated.toString(), result_cluster.getStatus());
Assert.assertEquals(ClusterStatus.Lock.toString(), cluster.getStatus());
Assert.assertEquals(2, result_shards.size());
}
示例10: getToolchain
import org.codehaus.plexus.component.repository.exception.ComponentLookupException; //導入依賴的package包/類
private Toolchain getToolchain()
{
Toolchain tc = null;
try
{
if ( session != null ) // session is null in tests..
{
ToolchainManager toolchainManager =
(ToolchainManager) session.getContainer().lookup( ToolchainManager.ROLE );
if ( toolchainManager != null )
{
tc = toolchainManager.getToolchainFromBuildContext( toolchain, session );
}
}
}
catch ( ComponentLookupException componentLookupException )
{
// just ignore, could happen in pre-2.0.9 builds..
}
return tc;
}
示例11: getToolchain
import org.codehaus.plexus.component.repository.exception.ComponentLookupException; //導入依賴的package包/類
/**
* Gets the Java toolchain.
*
* @return the Java toolchain.
*/
protected Toolchain getToolchain()
{
Toolchain tc = null;
try
{
if ( session != null ) // session is null in tests..
{
ToolchainManager toolchainManager =
(ToolchainManager) session.getContainer().lookup( ToolchainManager.ROLE );
if ( toolchainManager != null )
{
tc = toolchainManager.getToolchainFromBuildContext( "jdk", session );
}
}
}
catch ( ComponentLookupException componentLookupException )
{
// just ignore, could happen in pre-2.0.9 builds..
}
return tc;
}
示例12: registerTask
import org.codehaus.plexus.component.repository.exception.ComponentLookupException; //導入依賴的package包/類
protected <Task extends JnlpDependencyTask> Task registerTask( List<JnlpDependencyTask> tasks, String roleHint,
JnlpDependencyConfig config )
{
try
{
// create task
Task result = (Task) container.lookup( JnlpDependencyTask.ROLE, roleHint );
// check configution
result.check( config );
// register task
tasks.add( result );
return result;
}
catch ( ComponentLookupException e )
{
throw new RuntimeException( "Could not find task with roleHint: " + roleHint, e );
}
}
示例13: setupHintedShader
import org.codehaus.plexus.component.repository.exception.ComponentLookupException; //導入依賴的package包/類
private void setupHintedShader()
throws MojoExecutionException
{
if ( shaderHint != null )
{
try
{
shader = (Shader) plexusContainer.lookup( Shader.ROLE, shaderHint );
}
catch ( ComponentLookupException e )
{
throw new MojoExecutionException(
"unable to lookup own Shader implementation with hint:'" + shaderHint + "'", e );
}
}
}
示例14: execute
import org.codehaus.plexus.component.repository.exception.ComponentLookupException; //導入依賴的package包/類
@Override
public void execute(Object component, @SuppressWarnings("rawtypes") ComponentManager manager, ClassRealm realm)
throws PhaseExecutionException {
if (component instanceof Configurable) {
// get a configurator
Configurator configurator;
try {
configurator = manager.getContainer().lookup(Configurator.class);
}
catch (ComponentLookupException e) {
throw new PhaseExecutionException("Could not allocate configurator", e);
}
String instanceName = manager.getRoleHint();
if (instanceName == null || "default".equals(instanceName)) {
configurator.configure((Configurable) component);
}
else {
configurator.configure(instanceName, (Configurable) component);
}
}
}
示例15: getBundleName
import org.codehaus.plexus.component.repository.exception.ComponentLookupException; //導入依賴的package包/類
@Override
public String getBundleName(Artifact artifact)
{
//return artifact.getGroupId() + " " + artifact.getArtifactId(); // don't have access to the name
try
{
Model pom = Maven.getModel(artifact);
String name = pom.getName();
System.out.println(pom);
if(Strings.isNullOrEmpty(name))
return artifact.getArtifactId();
return name;
}
catch(ModelBuildingException | ComponentLookupException e)
{
System.err.println("Exception: " + e);
return artifact.getArtifactId(); // don't have access to the name
}
}