<commit_before>package org.cagrid.dorian.service.impl;

import org.cagrid.dorian.ca.impl.CertificateAuthority;
import org.cagrid.dorian.ca.impl.CertificateAuthorityManager;
import org.cagrid.dorian.ca.impl.CertificateAuthorityProperties;
import org.cagrid.dorian.federation.impl.IdentityFederationProperties;
import org.cagrid.dorian.federation.impl.TrustedIdPManager;
import org.cagrid.dorian.idp.impl.AssertionCredentialsManager;
import org.cagrid.dorian.idp.impl.IdentityProvider;
import org.cagrid.dorian.idp.impl.IdentityProviderProperties;
import org.cagrid.dorian.service.Dorian;
import org.cagrid.dorian.service.DorianConstants;
import org.cagrid.tools.database.Database;
import org.cagrid.tools.events.EventManager;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.AbstractResource;

public class BeanUtils {

	private XmlBeanFactory factory;

	public BeanUtils(AbstractResource dorianConf, AbstractResource dorianProperties) throws Exception {
		this.factory = new XmlBeanFactory(dorianConf);
		PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer();
		cfg.setLocation(dorianProperties);
		cfg.postProcessBeanFactory(factory);
	}

	public DorianProperties getDorianProperties() throws Exception {
		DorianProperties props = (DorianProperties) factory.getBean(DorianConstants.DORIAN_PROPERTIES_BEAN);
		return props;
	}

	public IdentityFederationProperties getIdentityFederationProperties() throws Exception {
		IdentityFederationProperties props = (IdentityFederationProperties) factory.getBean(DorianConstants.IDENTITY_FEDERATION_PROPERTIES_BEAN);
		return props;
	}

	public IdentityProvider getIdentityProvider() throws Exception {
		return new IdentityProvider(this.getIdentityProviderProperties(), this.getDatabase(), this.getCertificateAuthorityManager().getDefaultCertificateAuthority(), this.getEventManager());
	}

	public EventManager getEventManager() throws Exception {
		return (EventManager) factory.getBean(DorianConstants.EVENT_MANAGER_BEAN);
	}

	public TrustedIdPManager getTrustedIdPManager() throws Exception {
		return (TrustedIdPManager) factory.getBean(DorianConstants.TRUSTED_IDP_MANAGER_BEAN);
	}

	public IdentityProviderProperties getIdentityProviderProperties() throws Exception {
		return (IdentityProviderProperties) factory.getBean(DorianConstants.IDP_PROPERTIES_BEAN);
	}

	public AssertionCredentialsManager getAssertionCredentialsManager() throws Exception {
		return new AssertionCredentialsManager(getIdentityProviderProperties(), getCertificateAuthorityManager().getDefaultCertificateAuthority(), getDatabase());
	}

	public org.cagrid.dorian.idp.impl.UserManager getIdPUserManager() throws Exception {
		return (org.cagrid.dorian.idp.impl.UserManager) factory.getBean(DorianConstants.IDP_USER_MANAGER_BEAN);
	}

	public Database getDatabase() throws Exception {
		return (Database) factory.getBean(DorianConstants.DATABASE_BEAN);
	}

	public CertificateAuthorityProperties getCertificateAuthorityProperties() throws Exception {
		return (CertificateAuthorityProperties) factory.getBean(DorianConstants.CA_PROPERTIES_BEAN);

	}

	public CertificateAuthorityProperties getLegacyCertificateAuthorityProperties() throws Exception {
		return (CertificateAuthorityProperties) factory.getBean(DorianConstants.LEGACY_CA_PROPERTIES_BEAN);

	}

	public CertificateAuthority getCertificateAuthority() throws Exception {
		return (CertificateAuthority) factory.getBean(DorianConstants.CA_BEAN);<commit_msg>no message<commit_after>package org.cagrid.dorian.service.impl;

import org.cagrid.dorian.ca.impl.CertificateAuthority;
import org.cagrid.dorian.ca.impl.CertificateAuthorityManager;
import org.cagrid.dorian.ca.impl.CertificateAuthorityProperties;
import org.cagrid.dorian.federation.impl.IdentityFederationProperties;
import org.cagrid.dorian.federation.impl.TrustedIdPManager;
import org.cagrid.dorian.idp.impl.AssertionCredentialsManager;
import org.cagrid.dorian.idp.impl.IdentityProvider;
import org.cagrid.dorian.idp.impl.IdentityProviderProperties;
import org.cagrid.dorian.service.Dorian;
import org.cagrid.dorian.service.DorianConstants;
import org.cagrid.tools.database.Database;
import org.cagrid.tools.events.EventManager;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.AbstractResource;

public class BeanUtils {

	private XmlBeanFactory factory;

	public BeanUtils(AbstractResource dorianConf, AbstractResource dorianProperties) throws Exception {
		this.factory = new XmlBeanFactory(dorianConf);
		PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer();
		cfg.setLocation(dorianProperties);
		cfg.postProcessBeanFactory(factory);
	}

	public DorianProperties getDorianProperties() throws Exception {
		DorianProperties props = (DorianProperties) factory.getBean(DorianConstants.DORIAN_PROPERTIES_BEAN);
		return props;
	}

	public IdentityFederationProperties getIdentityFederationProperties() throws Exception {
		IdentityFederationProperties props = (IdentityFederationProperties) factory.getBean(DorianConstants.IDENTITY_FEDERATION_PROPERTIES_BEAN);
		return props;
	}

	public IdentityProvider getIdentityProvider() throws Exception {
		return new IdentityProvider(this.getIdentityProviderProperties(), this.getDatabase(), this.getCertificateAuthorityManager().getDefaultCertificateAuthority(), this.getEventManager());
	}

	public EventManager getEventManager() throws Exception {
		return (EventManager) factory.getBean(DorianConstants.EVENT_MANAGER_BEAN);
	}

	public TrustedIdPManager getTrustedIdPManager() throws Exception {
		return (TrustedIdPManager) factory.getBean(DorianConstants.TRUSTED_IDP_MANAGER_BEAN);
	}

	public IdentityProviderProperties getIdentityProviderProperties() throws Exception {
		return (IdentityProviderProperties) factory.getBean(DorianConstants.IDP_PROPERTIES_BEAN);
	}

	public AssertionCredentialsManager getAssertionCredentialsManager() throws Exception {
		return new AssertionCredentialsManager(getIdentityProviderProperties(), getCertificateAuthorityManager().getDefaultCertificateAuthority(), getDatabase());
	}

	public org.cagrid.dorian.idp.impl.UserManager getIdPUserManager() throws Exception {
		return new org.cagrid.dorian.idp.impl.UserManager(getDatabase(), getIdentityProviderProperties());
	}

	public Database getDatabase() throws Exception {
		return (Database) factory.getBean(DorianConstants.DATABASE_BEAN);
	}

	public CertificateAuthorityProperties getCertificateAuthorityProperties() throws Exception {
		return (CertificateAuthorityProperties) factory.getBean(DorianConstants.CA_PROPERTIES_BEAN);

	}

	public CertificateAuthorityProperties getLegacyCertificateAuthorityProperties() throws Exception {
		return (CertificateAuthorityProperties) factory.getBean(DorianConstants.LEGACY_CA_PROPERTIES_BEAN);

	}

	public CertificateAuthority getCertificateAuthority() throws Exception {
		return (CertificateAuthority) factory.getBean(DorianConstants.CA_BEAN);
{'fraction_non_alphanumeric': 0.07914572864321608, 'fraction_numerical': 0.0, 'mean_word_length': 8.341590612777054, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '4159188', 'n_tokens_mistral': 2116, 'n_tokens_neox': 1964, 'n_words': 323}