public void initialize()

in src/java/org/apache/fulcrum/yaafi/framework/container/ServiceContainerImpl.java [348:417]


	public void initialize() throws Exception {
		this.getLogger().debug("YAAFI Service Framework is starting up");

		// set the directories being used

		this.setApplicationRootDir((File) this.getContext().get(AvalonYaafiConstants.URN_AVALON_HOME));

		this.setTempRootDir((File) this.getContext().get(AvalonYaafiConstants.URN_AVALON_TEMP));

		// get the configuration files

		this.roleConfiguration = loadConfiguration(this.componentRolesLocation, this.isComponentRolesEncrypted());

		if (this.roleConfiguration == null) {
			String msg = "Unable to locate the role configuration : " + this.componentRolesLocation;
			this.getLogger().error(msg);
			throw new ConfigurationException(msg);
		}

		this.serviceConfiguration = loadConfiguration(this.componentConfigurationLocation,
				this.isComponentConfigurationEncrypted());

		// create the configuration properties

		Properties componentConfigurationProperties = this.loadComponentConfigurationProperties();

		// expand the componentConfiguration using the componentConfigurationProperties

		ConfigurationUtil.expand(this.getLogger(), (DefaultConfiguration) this.serviceConfiguration,
				componentConfigurationProperties);

		// create the default parameters

		if (this.getParameters() == null) {
			this.parameters = this.loadParameters(this.parametersLocation, this.isParametersEncrypted());
		}

		// create the service implementation instances

		List<ServiceComponent> currServiceList = this.createServiceComponents(this.roleConfiguration, this.getLogger());

		this.setServiceList(currServiceList);

		// fill the service map mapping from a service name to an instance

		for (int i = 0; i < this.getServiceList().size(); i++) {
			ServiceComponent serviceComponent = (ServiceComponent) this.getServiceList().get(i);
			this.getServiceMap().put(serviceComponent.getName(), serviceComponent);
		}

		// ensure that fallback service managers are available

		for (int i = 0; i < this.fallbackServiceManagerList.size(); i++) {
			String currServiceManagerName = (String) this.fallbackServiceManagerList.get(i);
			if (this.getServiceMap().get(currServiceManagerName) == null) {
				String msg = "The following fallback service manager was not found : " + currServiceManagerName;
				throw new IllegalArgumentException(msg);
			}
		}

		// run the various lifecycle stages

		this.incarnateAll(this.getServiceList());

		// we are up and running

		this.isCurrentlyDisposing = false;
		this.isAlreadyDisposed = false;
		this.getLogger().debug("YAAFI Avalon Service Container is up and running");
	}