<commit_before>package org.csstudio.diag.interconnectionServer.server;

import java.text.SimpleDateFormat;

import org.csstudio.platform.logging.CentralLogger;
import org.csstudio.utility.ldap.engine.Engine;

public class LdapSupport {
	
	private static LdapSupport thisLdapSupportInstance = null;
	
	public LdapSupport() {
		/*
		 * nothing to do
		 */
	}
	public static LdapSupport getInstance() {
		//
		// get an instance of our singleton
		//
		if ( thisLdapSupportInstance == null) {
			synchronized (LdapSupport.class) {
				if (thisLdapSupportInstance == null) {
					thisLdapSupportInstance = new LdapSupport();
				}
			}
		}
		return thisLdapSupportInstance;
	}
	
	
	public String getLogicalIocName ( String ipAddress, String ipName) {
		
		/*
		 * error handling
		 */
		if ( ipAddress.length() < 8) {
			/*
			 * can't be a valid IP address
			 */
			return "invalid IP address";
		}
		
		/*TODO
		 * connect to LDAP
		 * search in EpicsControls namespace
		 * find logical IOC name  stored in econ by matching epicsIocIpAddress with the IP address here
		 */
		
		/*
		 * in the meantime ...
		 */

		if ( ipAddress.equals("172.16.17.32")) {
			return "mkk10KVB1";
		} else if ( ipAddress.equals("172.16.17.32")) {
			return "mthKryoStand";
		} else if ( ipAddress.equals("172.16.17.32")) {
			return "ttfKryoCMTB";
		} else if ( ipAddress.equals("172.16.17.32")) {
			return "utilityIOC";
		} else if ( ipAddress.equals("172.16.31.10")) {
			return "ttfKryoLinac";
		} else if ( ipAddress.equals("172.16.17.32")) {
			return "krykWetter";
		} else if ( ipAddress.equals("192.168.3.11")) {
			return "Bernds_Test_IOC";
		} else if ( ipAddress.equals("172.16.58.3")) {
			return "-epicsVME39-";
		} else if ( ipAddress.equals("192.168.127.12")) {
			return "ttfKryoSK47a";
		} else if ( ipAddress.equals("172.16.58.3")) {
			return "ttfKryoCB";
		} else if ( ipAddress.equals("172.16.17.32")) {
			return "utilityIOC";
		} else if ( ipAddress.equals("172.16.17.32")) {
			return "heraKryoFel";
		} else if ( ipAddress.equals("172.16.31.10")) {
			return "ttfKryoVC2";
		} else if ( ipAddress.equals("192.168.127.12")) {
			return "-epicsVME19-";
		} else if ( ipAddress.equals("172.16.58.3")) {
			return "ttfDiagLinac";
		} else return "~" + ipName + "~";
		
		/*
		 *epicsGPFC01       mkk10KVA1       : Keine Datei Y:\directoryServer\mkk10KVA1.BootLine.dat gefunden
epicsGPFC02       mkk10KVB1       172.16.17.32
epicsGPFC03       mkk10KVC1       172.16.58.3
epicsGPFC04       mkk10KVC2       172.16.17.32
epicsGPFC05       mkk10KV6A       192.168.3.11
epicsGPFC06       mkk10KV2B       172.16.31.10
epicsGPFC07       mkk10KV3B       172.16.17.32
epicsPC21         mthKryoStand    172.16.17.32
epicsPC24         wienerVME       192.168.127.12
epicsPC25         ttfKryoCMTB     172.16.17.32
epicsPC26         ttfKryoXCB      172.16.31.10
epicsPPC02        mkkPPC02        172.16.31.10
epicsPPC11        mkkSender       : Keine Datei Y:\directoryServer\mkkSender.BootLine.dat gefunden
epicsPPC12        ttfKryoSK47a    192.168.127.12
epicsPPC13        mkkPPC03        : Keine Datei Y:\directoryServer\mkkPPC03.BootLine.dat gefunden
epicsPPC14        ttfKryoVC2      172.16.31.10
epicsPPC18        mkkModbus       192.168.127.12
epicsPPC19        ttfKryoVC1      172.16.17.32
epicsVME00        utilityIOC      172.16.17.32
epicsVME01        mkkTempPuls     : Keine Datei Y:\directoryServer\mkkTempPuls.BootLine.dat gefunden<commit_msg>Add some more IP -> logicalIocName entries<commit_after>package org.csstudio.diag.interconnectionServer.server;

import java.text.SimpleDateFormat;

import org.csstudio.platform.logging.CentralLogger;
import org.csstudio.utility.ldap.engine.Engine;

public class LdapSupport {
	
	private static LdapSupport thisLdapSupportInstance = null;
	
	public LdapSupport() {
		/*
		 * nothing to do
		 */
	}
	public static LdapSupport getInstance() {
		//
		// get an instance of our singleton
		//
		if ( thisLdapSupportInstance == null) {
			synchronized (LdapSupport.class) {
				if (thisLdapSupportInstance == null) {
					thisLdapSupportInstance = new LdapSupport();
				}
			}
		}
		return thisLdapSupportInstance;
	}
	
	
	public String getLogicalIocName ( String ipAddress, String ipName) {
		
		/*
		 * error handling
		 */
		if ( ipAddress.length() < 8) {
			/*
			 * can't be a valid IP address
			 */
			return "invalid IP address";
		}
		
		/*TODO
		 * connect to LDAP
		 * search in EpicsControls namespace
		 * find logical IOC name  stored in econ by matching epicsIocIpAddress with the IP address here
		 */
		
		/*
		 * in the meantime ...
		 */

		if ( ipAddress.equals("172.16.17.32")) {
			return "mkk10KVB1";
		} else if ( ipAddress.equals("172.16.17.32")) {
			return "mthKryoStand";
		} else if ( ipAddress.equals("172.16.17.32")) {
			return "ttfKryoCMTB";
		} else if ( ipAddress.equals("172.16.17.32")) {
			return "utilityIOC";
		} else if ( ipAddress.equals("172.16.31.10")) {
			return "ttfKryoLinac";
		} else if ( ipAddress.equals("172.16.17.32")) {
			return "krykWetter";
		} else if ( ipAddress.equals("192.168.3.11")) {
			return "Bernds_Test_IOC";
		} else if ( ipAddress.equals("172.16.58.3")) {
			return "ttfKryoLinac";
		} else if ( ipAddress.equals("192.168.127.12")) {
			return "ttfKryoSK47a";
		} else if ( ipAddress.equals("172.16.58.3")) {
			return "ttfKryoCB";
		} else if ( ipAddress.equals("172.16.17.32")) {
			return "utilityIOC";
		} else if ( ipAddress.equals("172.16.17.32")) {
			return "heraKryoFel";
		} else if ( ipAddress.equals("172.16.31.10")) {
			return "ttfKryoVC2";
		} else if ( ipAddress.equals("192.168.127.12")) {
			return "mthKryoStand";
		} else if ( ipAddress.equals("172.16.58.3")) {
			return "ttfDiagLinac";
		} else if ( ipAddress.equals("192.168.127.12")) {
			return "ttfKryoFV";
		} else return "~" + ipName + "~";
		
		/*
		 * es fehlen: 192.168.127.12 und 172.16.58.3
		 * 
		 *epicsGPFC01       mkk10KVA1       : Keine Datei Y:\directoryServer\mkk10KVA1.BootLine.dat gefunden
epicsGPFC02       mkk10KVB1       172.16.17.32
epicsGPFC03       mkk10KVC1       172.16.58.3
epicsGPFC04       mkk10KVC2       172.16.17.32
epicsGPFC05       mkk10KV6A       192.168.3.11
epicsGPFC06       mkk10KV2B       172.16.31.10
epicsGPFC07       mkk10KV3B       172.16.17.32
epicsPC21         mthKryoStand    172.16.17.32
epicsPC24         wienerVME       192.168.127.12
epicsPC25         ttfKryoCMTB     172.16.17.32
epicsPC26         ttfKryoXCB      172.16.31.10
epicsPPC02        mkkPPC02        172.16.31.10
epicsPPC11        mkkSender       : Keine Datei Y:\directoryServer\mkkSender.BootLine.dat gefunden
epicsPPC12        ttfKryoSK47a    192.168.127.12
epicsPPC13        mkkPPC03        : Keine Datei Y:\directoryServer\mkkPPC03.BootLine.dat gefunden
epicsPPC14        ttfKryoVC2      172.16.31.10
epicsPPC18        mkkModbus       192.168.127.12
epicsPPC19        ttfKryoVC1      172.16.17.32
epicsVME00        utilityIOC      172.16.17.32
epicsVME01        mkkTempPuls     : Keine Datei Y:\directoryServer\mkkTempPuls.BootLine.dat gefunden
{'fraction_non_alphanumeric': 0.12225216281378527, 'fraction_numerical': 0.1086370727556375, 'mean_word_length': 2.6482152095188827, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 65, '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': '5569569', 'n_tokens_mistral': 3337, 'n_tokens_neox': 2668, 'n_words': 496}