// Path: src/main/java/model/persistance/Settings.java
// public class Settings {
// 	// old Settings path in registry
// 	// myPrefs = prefsRoot.node("DownloaderTool.preferences");
// 
// 	// methode to remove all entries:
// 	// public void removeNode() {
// 	// try {
// 	// myPrefs.removeNode();
// 	// } catch (BackingStoreException e) {
// 	// e.printStackTrace();
// 	// }
// 	// }
// 	private static final String ILIAS_STORE_FOLDER = System.getProperty("user.home") + "/"
// 			+ ".ilias";
// 	private static Settings instance;
// 	private Storer storer;
// 	private List<Storable> storableObjects;
// 
// 	private User user;
// 	private Flags flags;
// 	private FileStates fileStates;
// 	private IliasFolderSettings iliasFolderSettings;
// 
// 	private Settings() {
// 		storableObjects = new ArrayList<Storable>();
// 		storer = new Storer(ILIAS_STORE_FOLDER);
// 	}
// 
// 	public static Settings getInstance() {
// 		if (instance == null) {
// 			instance = new Settings();
// 		}
// 		return instance;
// 	}
// 
// 	public User getUser() {
// 		if (user == null) {
// 			user = (User) load(new User());
// 			if (user == null) {
// 				user = new User();
// 			}
// 			storableObjects.add(user);
// 		}
// 		return user;
// 	}
// 
// 	public Flags getFlags() {
// 		if (flags == null) {
// 			flags = (Flags) load(new Flags());
// 			if (flags == null) {
// 				flags = new Flags();
// 			}
// 			storableObjects.add(flags);
// 		}
// 		return flags;
// 
// 	}
// 
// 	public FileStates getFileStates() {
// 		if (fileStates == null) {
// 			fileStates = (FileStates) load(new FileStates());
// 			if (fileStates == null) {
// 				fileStates = new FileStates();
// 			}
// 			storableObjects.add(fileStates);
// 		}
// 		return fileStates;
// 	}
// 
// 	public IliasFolderSettings getIliasFolderSettings() {
// 		if (iliasFolderSettings == null) {
// 			iliasFolderSettings = (IliasFolderSettings) load(new IliasFolderSettings());
// 			if (iliasFolderSettings == null) {
// 				iliasFolderSettings = new IliasFolderSettings();
// 			}
// 			storableObjects.add(iliasFolderSettings);
// 		}
// 		return iliasFolderSettings;
// 	}
// 
// 	public void toggleFileIgnored(IliasFile file) {
// 		if (file.isIgnored()) {
// 			file.setIgnored(false);
// 		} else {
// 			file.setIgnored(true);
// 		}
// 	}
// 
// 	private Storable load(Storable storeable) {
// 		storeable = storer.load(storeable);
// 		return storeable;
// 	}
// 
// 	public void store() {
// 		for (Storable storableObject : storableObjects) {
// 			storer.store(storableObject);
// 		}
// 	}
// 
// }


import java.io.IOException;
import java.security.KeyManagementException;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import javax.net.ssl.SSLContext;
import org.apache.http.client.CookieStore;
import org.apache.http.conn.ssl.NoopHostnameVerifier;
import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
import org.apache.http.cookie.Cookie;
import org.apache.http.impl.client.*;
import org.apache.http.ssl.SSLContextBuilder;
import model.persistance.Settings;
package plugin;





public abstract class IliasPlugin {

	public enum LoginStatus {
		WRONG_PASSWORD, CONNECTION_FAILED, SUCCESS
	};

	protected CloseableHttpClient client;
	private CookieStore cookieStore;
	private SSLContext sslContext;

	public IliasPlugin() {
		newClient();
	}

	public final CloseableHttpClient getClient() {
		CookieStore clonedCookieStore = new BasicCookieStore();

		for (Cookie cookie : this.cookieStore.getCookies()) {
			clonedCookieStore.addCookie(cookie);
		}

		CloseableHttpClient clonedClient;

// Path: src/main/java/model/persistance/Settings.java
// public class Settings {
// 	// old Settings path in registry
// 	// myPrefs = prefsRoot.node("DownloaderTool.preferences");
// 
// 	// methode to remove all entries:
// 	// public void removeNode() {
// 	// try {
// 	// myPrefs.removeNode();
// 	// } catch (BackingStoreException e) {
// 	// e.printStackTrace();
// 	// }
// 	// }
// 	private static final String ILIAS_STORE_FOLDER = System.getProperty("user.home") + "/"
// 			+ ".ilias";
// 	private static Settings instance;
// 	private Storer storer;
// 	private List<Storable> storableObjects;
// 
// 	private User user;
// 	private Flags flags;
// 	private FileStates fileStates;
// 	private IliasFolderSettings iliasFolderSettings;
// 
// 	private Settings() {
// 		storableObjects = new ArrayList<Storable>();
// 		storer = new Storer(ILIAS_STORE_FOLDER);
// 	}
// 
// 	public static Settings getInstance() {
// 		if (instance == null) {
// 			instance = new Settings();
// 		}
// 		return instance;
// 	}
// 
// 	public User getUser() {
// 		if (user == null) {
// 			user = (User) load(new User());
// 			if (user == null) {
// 				user = new User();
// 			}
// 			storableObjects.add(user);
// 		}
// 		return user;
// 	}
// 
// 	public Flags getFlags() {
// 		if (flags == null) {
// 			flags = (Flags) load(new Flags());
// 			if (flags == null) {
// 				flags = new Flags();
// 			}
// 			storableObjects.add(flags);
// 		}
// 		return flags;
// 
// 	}
// 
// 	public FileStates getFileStates() {
// 		if (fileStates == null) {
// 			fileStates = (FileStates) load(new FileStates());
// 			if (fileStates == null) {
// 				fileStates = new FileStates();
// 			}
// 			storableObjects.add(fileStates);
// 		}
// 		return fileStates;
// 	}
// 
// 	public IliasFolderSettings getIliasFolderSettings() {
// 		if (iliasFolderSettings == null) {
// 			iliasFolderSettings = (IliasFolderSettings) load(new IliasFolderSettings());
// 			if (iliasFolderSettings == null) {
// 				iliasFolderSettings = new IliasFolderSettings();
// 			}
// 			storableObjects.add(iliasFolderSettings);
// 		}
// 		return iliasFolderSettings;
// 	}
// 
// 	public void toggleFileIgnored(IliasFile file) {
// 		if (file.isIgnored()) {
// 			file.setIgnored(false);
// 		} else {
// 			file.setIgnored(true);
// 		}
// 	}
// 
// 	private Storable load(Storable storeable) {
// 		storeable = storer.load(storeable);
// 		return storeable;
// 	}
// 
// 	public void store() {
// 		for (Storable storableObject : storableObjects) {
// 			storer.store(storableObject);
// 		}
// 	}
// 
// }


// Path: src/main/java/plugin/IliasPlugin.java
import java.io.IOException;
import java.security.KeyManagementException;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import javax.net.ssl.SSLContext;
import org.apache.http.client.CookieStore;
import org.apache.http.conn.ssl.NoopHostnameVerifier;
import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
import org.apache.http.cookie.Cookie;
import org.apache.http.impl.client.*;
import org.apache.http.ssl.SSLContextBuilder;
import model.persistance.Settings;

package plugin;





public abstract class IliasPlugin {

	public enum LoginStatus {
		WRONG_PASSWORD, CONNECTION_FAILED, SUCCESS
	};

	protected CloseableHttpClient client;
	private CookieStore cookieStore;
	private SSLContext sslContext;

	public IliasPlugin() {
		newClient();
	}

	public final CloseableHttpClient getClient() {
		CookieStore clonedCookieStore = new BasicCookieStore();

		for (Cookie cookie : this.cookieStore.getCookies()) {
			clonedCookieStore.addCookie(cookie);
		}

		CloseableHttpClient clonedClient;

		if (!Settings.getInstance().getFlags().isConnectSecure()) {