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); }
public ComponentDescriptor getComponentDescriptor( String role, String hint, ClassRealm classRealm) { ComponentDescriptor result = componentRepository.getComponentDescriptor(role, hint, classRealm); ClassRealm tmpRealm = classRealm.getParentRealm(); while (result == null && tmpRealm != null) { result = componentRepository.getComponentDescriptor(role, hint, classRealm); tmpRealm = tmpRealm.getParentRealm(); } if (result == null && parentContainer != null) { result = parentContainer.getComponentDescriptor(role, hint, classRealm); } return result; }
public ComponentDescriptor getComponentDescriptor(String componentKey) { ComponentDescriptor result = componentRepository.getComponentDescriptor(componentKey); if (result == null && parentContainer != null) { result = parentContainer.getComponentDescriptor(componentKey); } return result; }
public Map getComponentDescriptorMap(String role, ClassRealm realm) { Map result = new WeakHashMap(); if (parentContainer != null) { Map m = parentContainer.getComponentDescriptorMap(role, realm); if (m != null) { result.putAll(m); } } Map componentDescriptors = componentRepository.getComponentDescriptorMap(role, realm); if (componentDescriptors != null) { result.putAll(componentDescriptors); } return result; }
public Object lookup(String componentKey) throws ComponentLookupException { Object component = null; ComponentManager componentManager = componentManagerManager.findComponentManagerByComponentKey(componentKey); // The first time we lookup a component a component manager will not exist so we ask the // component manager manager to create a component manager for us. if (componentManager == null) { ComponentDescriptor descriptor = componentRepository.getComponentDescriptor(componentKey); if (descriptor == null) { if (parentContainer != null) { return parentContainer.lookup(componentKey); } getLogger().error("Nonexistent component: " + componentKey); String message = "Component descriptor cannot be found in the component repository: " + componentKey + "."; throw new ComponentLookupException(message); } componentManager = createComponentManager(descriptor); } try { component = componentManager.getComponent(); } catch (ComponentInstantiationException e) { throw new ComponentLookupException( "Unable to lookup component '" + componentKey + "', it could not be created", e); } catch (ComponentLifecycleException e) { throw new ComponentLookupException( "Unable to lookup component '" + componentKey + "', it could not be started", e); } componentManagerManager.associateComponentWithComponentManager(component, componentManager); return component; }
public Map getComponentDescriptorMap(String role) { Map result = null; if (parentContainer != null) { result = parentContainer.getComponentDescriptorMap(role); } Map componentDescriptors = componentRepository.getComponentDescriptorMap(role); if (componentDescriptors != null) { if (result != null) { result.putAll(componentDescriptors); } else { result = componentDescriptors; } } return result; }
public boolean hasComponent(String role, String roleHint, ClassRealm realm) { return componentRepository.hasComponent(role, roleHint, realm); }
public boolean hasComponent(String componentKey, ClassRealm realm) { return componentRepository.hasComponent(componentKey, realm); }
public void addComponentDescriptor(ComponentDescriptor componentDescriptor) throws ComponentRepositoryException { componentRepository.addComponentDescriptor(componentDescriptor); }
public boolean hasComponent(String role, String roleHint) { return componentRepository.hasComponent(role, roleHint); }
public boolean hasComponent(String componentKey) { return componentRepository.hasComponent(componentKey); }