org.codehaus.plexus.component.manager.AbstractComponentManager Maven / Gradle / Ivy
The newest version!
package org.codehaus.plexus.component.manager;
/*
* Copyright 2001-2006 Codehaus Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.codehaus.plexus.MutablePlexusContainer;
import org.codehaus.plexus.classworlds.realm.ClassRealm;
import org.codehaus.plexus.component.builder.AbstractComponentBuildListener;
import org.codehaus.plexus.component.builder.ComponentBuilder;
import org.codehaus.plexus.component.builder.XBeanComponentBuilder;
import org.codehaus.plexus.component.factory.ComponentInstantiationException;
import org.codehaus.plexus.component.repository.ComponentDescriptor;
import org.codehaus.plexus.component.repository.exception.ComponentLifecycleException;
import org.codehaus.plexus.lifecycle.LifecycleHandler;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.PhaseExecutionException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
public abstract class AbstractComponentManager
implements ComponentManager
{
protected final MutablePlexusContainer container;
private final ClassRealm realm;
protected final ComponentDescriptor componentDescriptor;
private final Class extends T> type;
private final String role;
private final String roleHint;
protected final ComponentBuilder builder = new XBeanComponentBuilder(this);
private final LifecycleHandler lifecycleHandler;
/**
* Contains a mapping from singleton instances to the realms
* they were used to configure with. This realm will be used to
* call all lifecycle methods.
* This will define a synchronized map, make sure to synchronize the map when iterating.
*/
protected final Map