public Configuration createFinalConfiguration()

in src/java/org/apache/fulcrum/yaafi/framework/factory/ServiceContainerConfiguration.java [211:341]


	public Configuration createFinalConfiguration() {
		DefaultConfiguration result = null;

		if (this.getContainerConfiguration() != null) {
			return this.getContainerConfiguration();
		} else {
			// the root element is "fulcrum-yaafi"

			result = new DefaultConfiguration(ServiceConstants.ROLE_NAME);

			// add the following fragement
			//
			// <containerFlavour>merlin</containerFlavour>

			DefaultConfiguration containerFlavourConfig = new DefaultConfiguration(
					ServiceConstants.CONTAINERFLAVOUR_CONFIG_KEY);

			containerFlavourConfig.setValue(this.getContainerFlavour());

			result.addChild(containerFlavourConfig);

			// add the following fragement
			//
			// <containerClazzName>...</containerClazzName>

			DefaultConfiguration containerClazzNameConfig = new DefaultConfiguration(
					ServiceConstants.CONTAINERCLAZZNAME_CONFIG_KEY);

			containerClazzNameConfig.setValue(this.getServiceContainerClazzName());

			result.addChild(containerClazzNameConfig);

			// add the following fragement
			//
			// <componentRoles>
			// <location>../conf/componentRoles.xml</location>
			// <isEncrypted>true</isEncrypted>
			// </componentRoles>

			DefaultConfiguration componentRolesConfig = new DefaultConfiguration(ServiceConstants.COMPONENT_ROLE_KEYS);

			DefaultConfiguration componentRolesLocation = new DefaultConfiguration(
					ServiceConstants.COMPONENT_LOCATION_KEY);

			componentRolesLocation.setValue(this.getComponentRolesLocation());

			DefaultConfiguration componentRolesIsEncrypted = new DefaultConfiguration(
					ServiceConstants.COMPONENT_ISENCRYPTED_KEY);

			componentRolesIsEncrypted.setValue(this.isComponentRolesEncrypted());

			componentRolesConfig.addChild(componentRolesLocation);
			componentRolesConfig.addChild(componentRolesIsEncrypted);

			result.addChild(componentRolesConfig);

			// add the following fragement
			//
			// <componentConfiguration>
			// <location>../conf/componentRoles.xml</location>
			// <isEncrypted>true</isEncrypted>
			// </componentConfiguration>

			DefaultConfiguration componentConfigurationConfig = new DefaultConfiguration(
					ServiceConstants.COMPONENT_CONFIG_KEY);

			DefaultConfiguration componentConfigurationLocation = new DefaultConfiguration(
					ServiceConstants.COMPONENT_LOCATION_KEY);

			componentConfigurationLocation.setValue(this.getComponentConfigurationLocation());

			DefaultConfiguration componentConfigurationIsEncrypted = new DefaultConfiguration(
					ServiceConstants.COMPONENT_ISENCRYPTED_KEY);

			componentConfigurationIsEncrypted.setValue(this.isComponentConfigurationEncrypted());

			componentConfigurationConfig.addChild(componentConfigurationLocation);
			componentConfigurationConfig.addChild(componentConfigurationIsEncrypted);

			result.addChild(componentConfigurationConfig);

			// Add the following fragement
			//
			// <parameters>
			// <location>../conf/parameters.properties</location>
			// <isEncrypted>true</isEncrypted>
			// </parameters>

			DefaultConfiguration parameterConfigurationConfig = new DefaultConfiguration(
					ServiceConstants.COMPONENT_PARAMETERS_KEY);

			DefaultConfiguration parameterConfigurationLocation = new DefaultConfiguration(
					ServiceConstants.COMPONENT_LOCATION_KEY);

			parameterConfigurationLocation.setValue(this.getParametersLocation());

			DefaultConfiguration parameterConfigurationIsEncrypted = new DefaultConfiguration(
					ServiceConstants.COMPONENT_ISENCRYPTED_KEY);

			parameterConfigurationIsEncrypted.setValue(this.isParametersEncrypted());

			parameterConfigurationConfig.addChild(parameterConfigurationLocation);
			parameterConfigurationConfig.addChild(parameterConfigurationIsEncrypted);

			result.addChild(parameterConfigurationConfig);

			// Add the following fragement
			//
			// <serviceManagers>
			// <serviceManagers>springFrameworkService</serviceManager>
			// </serviceManagers>

			if (this.hasServiceManagerList()) {
				DefaultConfiguration serviceManagerListConfig = new DefaultConfiguration(
						ServiceConstants.SERVICEMANAGER_LIST_KEY);

				for (int i = 0; i < this.serviceManagerList.length; i++) {
					DefaultConfiguration serviceManagerConfig = new DefaultConfiguration(
							ServiceConstants.SERVICEMANAGER_KEY);

					serviceManagerConfig.setValue(this.serviceManagerList[i]);

					serviceManagerListConfig.addChild(serviceManagerConfig);
				}

				result.addChild(serviceManagerListConfig);
			}

			return result;
		}
	}