package com.sixsq.slipstream.connector.openstack;

/*
 * +=================================================================+
 * SlipStream Server (WAR)
 * =====
 * Copyright (C) 2013 SixSq Sarl (sixsq.com)
 * =====
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * -=================================================================-
 */

import com.sixsq.slipstream.connector.SystemConfigurationParametersFactoryBase;
import com.sixsq.slipstream.exceptions.ValidationException;

import java.util.Arrays;

public class OpenStackSystemConfigurationParametersFactory extends SystemConfigurationParametersFactoryBase {

	public OpenStackSystemConfigurationParametersFactory(String connectorInstanceName) throws ValidationException {
		super(connectorInstanceName);
	}

	@Override
	protected void initReferenceParameters() throws ValidationException {
		super.initReferenceParameters();
		super.putMandatoryEndpoint();
		super.putMandatoryContextualizationType();
		super.putMandatoryOrchestratorUsernameAndPassword();

		putMandatoryParameter(constructKey(OpenStackUserParametersFactory.ORCHESTRATOR_INSTANCE_TYPE_PARAMETER_NAME),
				"OpenStack Flavor for the orchestrator. " +
				"The actual image should support the desired Flavor");

		putMandatoryParameter(constructKey(OpenStackUserParametersFactory.SERVICE_TYPE_PARAMETER_NAME),
				"Type-name of the service which provides the instances functionality",
				"compute");

		putMandatoryParameter(constructKey(OpenStackUserParametersFactory.SERVICE_NAME_PARAMETER_NAME),
				"Name of the service which provides the instances functionality",
				"",
				"Usually the value is 'nova'. " +
					"It can be left empty if there is only one service of this type for the specified region.",
				140);

        putMandatoryParameter(constructKey(OpenStackUserParametersFactory.NETWORK_PUBLIC_NAME),
                "Mapping for Public network", "");

        putMandatoryParameter(constructKey(OpenStackUserParametersFactory.NETWORK_PRIVATE_NAME),
                "Mapping for Private network", "");


		putMandatoryEnumParameter(constructKey(OpenStackUserParametersFactory.IDENTITY_VERSION_PARAMETER_NAME),
				"Identity API version", Arrays.asList("v2", "v3"), "v2",
				"If the 'domain' feature is enable, you have to select 'v3'.", 10);

		putMandatoryOrchestratorSecurityGroups();

		putMandatoryUpdateUrl();

    }

}

@@ -1681,16 +1681,17 @@
 %22 +%0A%09%09%09%09
+%09
 %22The act
@@ -1734,16 +1734,441 @@
  Flavor%22
+,%0A%09%09%09%09100);%0A%0A%09%09putMandatoryEnumParameter(constructKey(OpenStackUserParametersFactory.IDENTITY_VERSION_PARAMETER_NAME),%0A%09%09%09%09%22Identity API version%22, Arrays.asList(%22v2%22, %22v3%22), %22v2%22,%0A%09%09%09%09%22If the 'domain' feature is enable, you have to select 'v3'.%22,%0A%09%09%09%09110);%0A%0A%09%09putMandatoryParameter(constructKey(OpenStackUserParametersFactory.SERVICE_REGION_PARAMETER_NAME),%0A%09%09%09%09%22Region used by this cloud connector%22,%0A%09%09%09%09%22RegionOne%22,%0A%09%09%09%09120
 );%0A%0A%09%09pu
@@ -2349,16 +2349,25 @@
 compute%22
+,%0A%09%09%09%09130
 );%0A%0A%09%09pu
@@ -2821,27 +2821,40 @@
 ic network%22,
- %22%22
+%0A%09%09%09%09%22%22,%0A%09%09%09%09150
 );%0A%0A        
@@ -2992,256 +2992,30 @@
 rk%22,
- %22%22);%0A%0A%0A%09%09putMandatoryEnumParameter(constructKey(OpenStackUserParametersFactory.IDENTITY_VERSION_PARAMETER_NAME),%0A%09%09%09%09%22Identity API version%22, Arrays.asList(%22v2%22, %22v3%22), %22v2%22,%0A%09%09%09%09%22If the 'domain' feature is enable, you have to select 'v3'.%22, 1
+%0A%09%09%09%09%22%22,%0A%09%09%09%0916
 0);%0A%0A
+%0A%0A
 %09%09pu

Add deterministic order for the system parameters.