<commit_before>package de.haw_hamburg.vs_ws2015.spahl_haug.brocker_rest;

import de.haw_hamburg.vs_ws2015.spahl_haug.servicerepository.RegisterServiceDTO;
import de.haw_hamburg.vs_ws2015.spahl_haug.servicerepository.ResponseRegisterServiceDTO;
import de.haw_hamburg.vs_ws2015.spahl_haug.servicerepository.SSLUtil;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;

import java.io.IOException;
import java.io.InputStream;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.UnknownHostException;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.util.Enumeration;
import java.util.Properties;

@Component
public class ApplicationStartup implements ApplicationListener<ContextRefreshedEvent> {

	private int getServerPort() {
		final Properties prop = new Properties();
		final String propFileName = "application.properties";

		final InputStream inputStream = getClass().getClassLoader().getResourceAsStream(propFileName);

		if (inputStream != null) {
			try {
				prop.load(inputStream);
			} catch (final IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		} else {

		}
		return Integer.valueOf(prop.getProperty("server.port"));
	}

	@Override
	public void onApplicationEvent(final ContextRefreshedEvent arg0) {

		final RegisterServiceDTO dto = new RegisterServiceDTO();
		dto.setName("spahl_haug_broker");
		dto.setDescription("BrokerService von <NAME> und <NAME>");
		dto.setService("boker");
		try {
			SSLUtil.turnOffSslChecking();
			dto.setUri("http://" + getLocalHostLANAddress().getHostAddress() + ":"+ getServerPort() + "/broker");
		} catch (final UnknownHostException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (final KeyManagementException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (final NoSuchAlgorithmException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		final RestTemplate restTemplate = new RestTemplate();
		final String base64Creds = "<KEY>";
		final HttpHeaders headers = new HttpHeaders();<commit_msg>remove brocker from uri<commit_after>package de.haw_hamburg.vs_ws2015.spahl_haug.brocker_rest;

import de.haw_hamburg.vs_ws2015.spahl_haug.servicerepository.RegisterServiceDTO;
import de.haw_hamburg.vs_ws2015.spahl_haug.servicerepository.ResponseRegisterServiceDTO;
import de.haw_hamburg.vs_ws2015.spahl_haug.servicerepository.SSLUtil;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;

import java.io.IOException;
import java.io.InputStream;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.UnknownHostException;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.util.Enumeration;
import java.util.Properties;

@Component
public class ApplicationStartup implements ApplicationListener<ContextRefreshedEvent> {

	private int getServerPort() {
		final Properties prop = new Properties();
		final String propFileName = "application.properties";

		final InputStream inputStream = getClass().getClassLoader().getResourceAsStream(propFileName);

		if (inputStream != null) {
			try {
				prop.load(inputStream);
			} catch (final IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		} else {

		}
		return Integer.valueOf(prop.getProperty("server.port"));
	}

	@Override
	public void onApplicationEvent(final ContextRefreshedEvent arg0) {

		final RegisterServiceDTO dto = new RegisterServiceDTO();
		dto.setName("spahl_haug_broker");
		dto.setDescription("BrokerService von <NAME> und <NAME>");
		dto.setService("boker");
		try {
			SSLUtil.turnOffSslChecking();
			dto.setUri("http://" + getLocalHostLANAddress().getHostAddress() + ":"+ getServerPort());
		} catch (final UnknownHostException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (final KeyManagementException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (final NoSuchAlgorithmException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		final RestTemplate restTemplate = new RestTemplate();
		final String base64Creds = "<KEY>";
		final HttpHeaders headers = new HttpHeaders();
{'fraction_non_alphanumeric': 0.10290556900726393, 'fraction_numerical': 0.008071025020177562, 'mean_word_length': 5.6716016150740245, 'pattern_counts': {'":': 2, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '3963417', 'n_tokens_mistral': 1566, 'n_tokens_neox': 1421, 'n_words': 293}