private LifecycleHandler findLifecycleHandler(ComponentDescriptor descriptor)
      throws UndefinedLifecycleHandlerException {
    String lifecycleHandlerId = descriptor.getLifecycleHandler();

    LifecycleHandler lifecycleHandler;

    if (lifecycleHandlerId == null) {
      lifecycleHandler = lifecycleHandlerManager.getDefaultLifecycleHandler();
    } else {
      lifecycleHandler = lifecycleHandlerManager.getLifecycleHandler(lifecycleHandlerId);
    }

    return lifecycleHandler;
  }
示例#2
0
  private void initializeCoreComponents()
      throws ComponentConfigurationException, ComponentRepositoryException, ContextException {
    BasicComponentConfigurator configurator = new BasicComponentConfigurator();

    PlexusConfiguration c = configuration.getChild("component-repository");

    processCoreComponentConfiguration("component-repository", configurator, c);

    componentRepository.configure(configuration);

    componentRepository.setClassRealm(plexusRealm);

    componentRepository.initialize();

    // Lifecycle handler manager

    c = configuration.getChild("lifecycle-handler-manager");

    processCoreComponentConfiguration("lifecycle-handler-manager", configurator, c);

    lifecycleHandlerManager.initialize();

    // Component manager manager

    c = configuration.getChild("component-manager-manager");

    processCoreComponentConfiguration("component-manager-manager", configurator, c);

    componentManagerManager.setLifecycleHandlerManager(lifecycleHandlerManager);

    // Component discoverer manager

    c = configuration.getChild("component-discoverer-manager");

    processCoreComponentConfiguration("component-discoverer-manager", configurator, c);

    componentDiscovererManager.initialize();

    // Component factory manager

    c = configuration.getChild("component-factory-manager");

    processCoreComponentConfiguration("component-factory-manager", configurator, c);

    if (componentFactoryManager instanceof Contextualizable) {
      Context context = getContext();

      context.put(PlexusConstants.PLEXUS_KEY, this);

      ((Contextualizable) componentFactoryManager).contextualize(getContext());
    }

    // Component factory manager

    c = configuration.getChild("component-composer-manager");

    processCoreComponentConfiguration("component-composer-manager", configurator, c);
  }