<commit_before>package uk.nhs.ciao.fhir;

import java.util.Properties;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.support.StaticApplicationContext;
import org.springframework.core.env.PropertiesPropertySource;

import uk.nhs.ciao.camel.CamelApplication;
import uk.nhs.ciao.exceptions.CIAOConfigurationException;

import static uk.nhs.ciao.util.GlobalConstants.*;

/**
 * To test the CIP pointing at TKW use one of the following:
 * 
 * Simple trace, single match:
 * curl http://localhost:8080/fhir/Patient?family=PURVES
 * curl http://localhost:8080/fhir/Patient?family=LEWINGTON
 * curl http://localhost:8080/fhir/Patient?family=STAMBUKDELIFSCHITZ
 * 
 * Specifying XML format:
 * curl -H "Accept: application/xml+fhir" http://localhost:8080/fhir/Patient?family=PURVES
 * curl http://localhost:8080/fhir/Patient?family=PURVES&_format=xml
 * 
 * No match:
 * curl http://localhost:8080/fhir/Patient?family=NOMATCH
 * 
 * SOAP Fault:
 * curl http://localhost:8080/fhir/Patient?family=SOAPFAULT
 * 
 * Business Fault:
 * curl http://localhost:8080/fhir/Patient?family=MCCI
 * 
 * @author <NAME>
 *
 */
public class RunCIP extends CamelApplication {
	private static final Logger logger = LoggerFactory.getLogger(RunCIP.class);
	
	/**
	 * This is the main class for running CIAO as a simple java process (e.g. within docker)
	 * @param args Command line arguments (e.g. ETCD URL)
	 * @throws Exception
	 */
	public static void main(String[] args) throws Exception {
		new RunCIP(args).run();
	}
	
	public RunCIP(final String[] args) throws CIAOConfigurationException {
		super(CONFIG_FILE, args);
	}
	
	@Override
	protected StaticApplicationContext createParentApplicationContext()
			throws CIAOConfigurationException {
		final StaticApplicationContext context = super.createParentApplicationContext();
		
		final String sslConfig;
		if (Boolean.parseBoolean(getCIAOConfig().getConfigValue("TLS_ENABLED"))) {
			logger.info("TLS enabled");
			sslConfig = "tls";
		} else {
			logger.info("TLS NOT enabled");
			sslConfig = "vanilla";
		}
		
		final Properties additionalProperties = new Properties();
		additionalProperties.setProperty("sslConfig", sslConfig);
		
		context.getEnvironment().getPropertySources().addFirst(new PropertiesPropertySource(
				"additionalProperties", additionalProperties));
		
		return context;
	}
}<commit_msg>Updated RunCIP to use CamelApplicationRunner<commit_after>package uk.nhs.ciao.fhir;

import java.util.Properties;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.support.StaticApplicationContext;
import org.springframework.core.env.PropertiesPropertySource;

import uk.nhs.ciao.camel.CamelApplication;
import uk.nhs.ciao.camel.CamelApplicationRunner;
import uk.nhs.ciao.exceptions.CIAOConfigurationException;
import static uk.nhs.ciao.util.GlobalConstants.*;

/**
 * To test the CIP pointing at TKW use one of the following:
 * 
 * Simple trace, single match:
 * curl http://localhost:8080/fhir/Patient?family=PURVES
 * curl http://localhost:8080/fhir/Patient?family=LEWINGTON
 * curl http://localhost:8080/fhir/Patient?family=STAMBUKDELIFSCHITZ
 * 
 * Specifying XML format:
 * curl -H "Accept: application/xml+fhir" http://localhost:8080/fhir/Patient?family=PURVES
 * curl http://localhost:8080/fhir/Patient?family=PURVES&_format=xml
 * 
 * No match:
 * curl http://localhost:8080/fhir/Patient?family=NOMATCH
 * 
 * SOAP Fault:
 * curl http://localhost:8080/fhir/Patient?family=SOAPFAULT
 * 
 * Business Fault:
 * curl http://localhost:8080/fhir/Patient?family=MCCI
 * 
 * @author <NAME>
 *
 */
public class RunCIP extends CamelApplication {
	private static final Logger logger = LoggerFactory.getLogger(RunCIP.class);
	
	/**
	 * This is the main class for running CIAO as a simple java process (e.g. within docker)
	 * @param args Command line arguments (e.g. ETCD URL)
	 * @throws Exception
	 */
	public static void main(String[] args) throws Exception {
		final CamelApplication application = new RunCIP(args);
		CamelApplicationRunner.runApplication(application);
	}
	
	public RunCIP(final String[] args) throws CIAOConfigurationException {
		super(CONFIG_FILE, args);
	}
	
	@Override
	protected StaticApplicationContext createParentApplicationContext()
			throws CIAOConfigurationException {
		final StaticApplicationContext context = super.createParentApplicationContext();
		
		final String sslConfig;
		if (Boolean.parseBoolean(getCIAOConfig().getConfigValue("TLS_ENABLED"))) {
			logger.info("TLS enabled");
			sslConfig = "tls";
		} else {
			logger.info("TLS NOT enabled");
			sslConfig = "vanilla";
		}
		
		final Properties additionalProperties = new Properties();
		additionalProperties.setProperty("sslConfig", sslConfig);
		
		context.getEnvironment().getPropertySources().addFirst(new PropertiesPropertySource(
				"additionalProperties", additionalProperties));
		
		return context;
	}
}
{'fraction_non_alphanumeric': 0.11234817813765183, 'fraction_numerical': 0.013765182186234818, 'mean_word_length': 5.107540173053152, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1875775', 'n_tokens_mistral': 1644, 'n_tokens_neox': 1461, 'n_words': 324}