private Component buildComponent(Configuration configuration, ConfiguredComponent configuredComponent) throws ConfigurationException {
		try {
			ConfiguredComponent rootComponent = null;
			String className = configuredComponent.getClassName();
			if (className == null) {
				rootComponent = configuration.getComponent(configuredComponent.getName());
				className = rootComponent.getClassName();
			}
			Class componentClass = Class.forName(className);
			Component component = (Component)componentClass.newInstance();
			if (rootComponent != null) {
				for (String name: rootComponent.getProperties().keySet()) {
					setProperty(component, name, VariableResolver.resolve(configuration, rootComponent.getProperties().get(name)));
				}
			}
			Map<String, String> properties = configuredComponent.getProperties();
			for (String name : properties.keySet()) {
				setProperty(component, name, VariableResolver.resolve(configuration, properties.get(name)));
			}
			component.initialise(configuration);
			component.setLocation(configuredComponent.getName());
			return component;
		} catch (ClassNotFoundException e) {
			throw new ConfigurationException("Cannot instantiate " + configuredComponent.getClassName());
		} catch (IllegalAccessException e) {
			throw new ConfigurationException("Cannot instantiate " + configuredComponent.getClassName());
		} catch (InstantiationException e) {
			throw new ConfigurationException("Cannot instantiate " + configuredComponent.getClassName());
		}
	}