<commit_before><?xml version="1.0" encoding="UTF-8"?>

<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xmlns:security="http://www.springframework.org/schema/security"
       xmlns="http://www.springframework.org/schema/beans"
       xsi:schemaLocation="http://www.springframework.org/schema/mvc
           http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
	       http://www.springframework.org/schema/beans 
           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
	       http://www.springframework.org/schema/context 
           http://www.springframework.org/schema/context/spring-context-3.0.xsd
           http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd">

    <!-- Activates various annotations to be detected in bean classes -->
    <context:annotation-config />

    <!-- Scans the classpath of this application for @Components to deploy as beans -->
    <context:component-scan base-package="edu.ucar.unidata.rosetta"/>

    <!-- Configures the @Controller programming model -->
    <mvc:annotation-driven/>

    <!-- RosettaProperties injection -->
    <bean id="applicationProperties"
          class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <list>
                <value>classpath:application.properties</value>
            </list>
        </property>
    </bean>

    <!-- Static resources since we are handling all requests.
         These are front end resources (css, etc.) and xml files -->
    <mvc:resources mapping="/resources/**" location="/frontEndResources/, /WEB-INF/classes/resources/"/>
    <mvc:resources mapping="/download/**" location="file:/usr/local/tomcat/rosetta/downloads/"/>


    <!-- Configure Spring-Security  -->
    <security:global-method-security pre-post-annotations="enabled" proxy-target-class="true"/>
    <security:http pattern="/resources/**" security="none"/>
    <security:http auto-config="true" use-expressions="true">

        <security:access-denied-handler error-page="/denied" />

        <security:form-login
                login-processing-url="/j_spring_security_check"
                login-page="/login"
                username-parameter="userName"
                password-parameter="password"
                authentication-success-handler-ref="customAuthenticationSuccessHandler"
                authentication-failure-handler-ref="authenticationFailureHandler"/>

        <security:logout
                invalidate-session="true"
                logout-success-url="/login"
                logout-url="/j_spring_security_logout"/>

        <security:intercept-url pattern="/index.jsp" access="permitAll" />
        <security:intercept-url pattern="/register" access="permitAll" />
        <security:intercept-url pattern="/login/**" access="permitAll" />
        <security:intercept-url pattern="/denied" access="permitAll" />
        <security:intercept-url pattern="/error" access="permitAll" />
        <security:intercept-url pattern="/cfType" access="permitAll" />
        <security:intercept-url pattern="/convertAndDownload" access="permitAll" />
        <security:intercept-url pattern="/customFileTypeAttributes" access="permitAll" />
        <security:intercept-url pattern="/fileUpload" access="permitAll" />
        <security:intercept-url pattern="/generalMetadata" access="permitAll" />
        <security:intercept-url pattern="/variableMetadata" access="permitAll" />
        <security:intercept-url pattern="/**" access="isAuthenticated()" />

        <!-- enable csrf protection -->
        <security:csrf/>
    </security:http>

    <!-- Declare an authentication-manager to use a custom userDetailsService -->
    <security:authentication-manager>
        <security:authentication-provider user-service-ref="userDetailsService">
            <security:password-encoder ref="passwordEncoder"/>
        </security:authentication-provider>
    </security:authentication-manager>

    <!-- Use a password encoder since the user's passwords are stored encrypted in the database -->
    <bean id="passwordEncoder" class="org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder"/>

    <bean id="customAuthenticationSuccessHandler" class="edu.ucar.unidata.rosetta.service.CustomAuthenticationSuccessHandler"/>

    <bean id="authenticationFailureHandler"
          class="org.springframework.security.web.authentication.ExceptionMappingAuthenticationFailureHandler">
        <property name="exceptionMappings">
            <props>
                <prop key="org.springframework.security.authentication.BadCredentialsException">/login/badCredentials</prop>
                <prop key="org.springframework.security.authentication.LockedException">/login/accountLocked</prop>
                <prop key="org.springframework.security.authentication.DisabledException">/login/accountDisabled</prop>
            </props>
        </property>
    </bean>


    <!-- Taming the pesky derby.log file -->
    <bean id="setDerbyLog" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
        <property name="targetClass"><value>java.lang.System</value></property>
        <property name="targetMethod"><value>setProperty</value></property>
        <property name="arguments">
            <list>
                <value>derby.stream.error.file</value>
                <value>${derby.stream.error.file}</value>
            </list>
        </property>
    </bean>

    <!-- File upload multipart resolver -->
    <bean id="multipartResolver"
          class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
        <property name="maxUploadSize" value="${rosetta.maxUpload}"/>
    </bean>

    <!-- Message source resolver to use messages.properties file in the 'war/WEB-INF/classes' directory -->
    <bean id="messageSource"
          class="org.springframework.context.support.ResourceBundleMessageSource">
        <property name="basename" value="messages"/>
    </bean>

    <!-- Resolves view names to decouple view from controller: ModelAndView("WEB-INF/views/XXXX.jsp"); -->
    <bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
        <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"></property>
        <property name="prefix" value="/WEB-INF/views/"></property>
        <property name="suffix" value=".jsp"></property>
    </bean>

    <!-- Declaration for resource use -->
    <bean id="fileManager" class="edu.ucar.unidata.rosetta.service.FileManagerImpl"/>
    <bean id="cfTypeValidator" class="edu.ucar.unidata.rosetta.service.validators.CFTypeValidator"/>
    <bean id="fileValidator" class="edu.ucar.unidata.rosetta.service.validators.FileValidator"/>
    <bean id="serverInfo" class="edu.ucar.unidata.rosetta.service.ServerInfoBean"
          init-method="init"/>
    <bean id="dbInitManager" class="edu.ucar.unidata.rosetta.service.resources.EmbeddedDerbyDbInitManager"/>

    <!-- DAO injection -->
    <bean id="dataManager" class="edu.ucar.unidata.rosetta.service.DataManagerImpl">
        <property name="cfTypeDao" ref="cfTypeDao"/>
        <property name="communityDao" ref="communityDao"/>
        <property name="dataDao" ref="dataDao"/>
        <property name="delimiterDao" ref="delimiterDao"/>
        <property name="fileTypeDao" ref="fileTypeDao"/>
        <property name="platformDao" ref="platformDao"/>
        <property name="propertiesDao" ref="propertiesDao"/>
    </bean>

    <bean id="metadataManager" class="edu.ucar.unidata.rosetta.service.MetadataManagerImpl">
        <property name="metadataDao" ref="metadataDao"/>
    </bean>

    <bean id="userDetailsService" class="edu.ucar.unidata.rosetta.service.user.UserDetailsServiceImpl">
        <property name="userDao" ref="userDao"/>
    </bean>

    <bean id="userManager" class="edu.ucar.unidata.rosetta.service.user.UserManagerImpl">
        <property name="userDao" ref="userDao"/>
    </bean>

    <bean id="cfTypeDao" class="edu.ucar.unidata.rosetta.repository.resources.JdbcCfTypeDao">
        <property name="dataSource" ref="dbDataSource"/>
    </bean>

    <bean id="communityDao" class="edu.ucar.unidata.rosetta.repository.resources.JdbcCommunityDao">
        <property name="dataSource" ref="dbDataSource"/>
    </bean>

    <bean id="dataDao" class="edu.ucar.unidata.rosetta.repository.JdbcDataDao">
        <property name="dataSource" ref="dbDataSource"/>
    </bean>

    <bean id="delimiterDao" class="edu.ucar.unidata.rosetta.repository.resources.JdbcDelimiterDao">
        <property name="dataSource" ref="dbDataSource"/>
    </bean>

    <bean id="fileTypeDao" class="edu.ucar.unidata.rosetta.repository.resources.JdbcFileTypeDao">
        <property name="dataSource" ref="dbDataSource"/>
    </bean>

    <bean id="metadataDao" class="edu.ucar.unidata.rosetta.repository.JdbcMetadataDao">
        <property name="dataSource" ref="dbDataSource"/>
    </bean>

    <bean id="platformDao" class="edu.ucar.unidata.rosetta.repository.resources.JdbcPlatformDao">
        <property name="dataSource" ref="dbDataSource"/>
    </bean>

    <bean id="propertiesDao" class="edu.ucar.unidata.rosetta.repository.JdbcPropertiesDao">
        <property name="dataSource" ref="dbDataSource"/><commit_msg>package change for service layer and validators<commit_after><?xml version="1.0" encoding="UTF-8"?>

<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xmlns:security="http://www.springframework.org/schema/security"
       xmlns="http://www.springframework.org/schema/beans"
       xsi:schemaLocation="http://www.springframework.org/schema/mvc
           http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
	       http://www.springframework.org/schema/beans 
           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
	       http://www.springframework.org/schema/context 
           http://www.springframework.org/schema/context/spring-context-3.0.xsd
           http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd">

    <!-- Activates various annotations to be detected in bean classes -->
    <context:annotation-config />

    <!-- Scans the classpath of this application for @Components to deploy as beans -->
    <context:component-scan base-package="edu.ucar.unidata.rosetta"/>

    <!-- Configures the @Controller programming model -->
    <mvc:annotation-driven/>

    <!-- RosettaProperties injection -->
    <bean id="applicationProperties"
          class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <list>
                <value>classpath:application.properties</value>
            </list>
        </property>
    </bean>

    <!-- Static resources since we are handling all requests.
         These are front end resources (css, etc.) and xml files -->
    <mvc:resources mapping="/resources/**" location="/frontEndResources/, /WEB-INF/classes/resources/"/>
    <mvc:resources mapping="/download/**" location="file:/usr/local/tomcat/rosetta/downloads/"/>


    <!-- Configure Spring-Security  -->
    <security:global-method-security pre-post-annotations="enabled" proxy-target-class="true"/>
    <security:http pattern="/resources/**" security="none"/>
    <security:http auto-config="true" use-expressions="true">

        <security:access-denied-handler error-page="/denied" />

        <security:form-login
                login-processing-url="/j_spring_security_check"
                login-page="/login"
                username-parameter="userName"
                password-parameter="password"
                authentication-success-handler-ref="customAuthenticationSuccessHandler"
                authentication-failure-handler-ref="authenticationFailureHandler"/>

        <security:logout
                invalidate-session="true"
                logout-success-url="/login"
                logout-url="/j_spring_security_logout"/>

        <security:intercept-url pattern="/index.jsp" access="permitAll" />
        <security:intercept-url pattern="/register" access="permitAll" />
        <security:intercept-url pattern="/login/**" access="permitAll" />
        <security:intercept-url pattern="/denied" access="permitAll" />
        <security:intercept-url pattern="/error" access="permitAll" />
        <security:intercept-url pattern="/cfType" access="permitAll" />
        <security:intercept-url pattern="/convertAndDownload" access="permitAll" />
        <security:intercept-url pattern="/customFileTypeAttributes" access="permitAll" />
        <security:intercept-url pattern="/fileUpload" access="permitAll" />
        <security:intercept-url pattern="/generalMetadata" access="permitAll" />
        <security:intercept-url pattern="/variableMetadata" access="permitAll" />
        <security:intercept-url pattern="/**" access="isAuthenticated()" />

        <!-- enable csrf protection -->
        <security:csrf/>
    </security:http>

    <!-- Declare an authentication-manager to use a custom userDetailsService -->
    <security:authentication-manager>
        <security:authentication-provider user-service-ref="userDetailsService">
            <security:password-encoder ref="passwordEncoder"/>
        </security:authentication-provider>
    </security:authentication-manager>

    <!-- Use a password encoder since the user's passwords are stored encrypted in the database -->
    <bean id="passwordEncoder" class="org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder"/>

    <bean id="customAuthenticationSuccessHandler" class="edu.ucar.unidata.rosetta.service.CustomAuthenticationSuccessHandler"/>

    <bean id="authenticationFailureHandler"
          class="org.springframework.security.web.authentication.ExceptionMappingAuthenticationFailureHandler">
        <property name="exceptionMappings">
            <props>
                <prop key="org.springframework.security.authentication.BadCredentialsException">/login/badCredentials</prop>
                <prop key="org.springframework.security.authentication.LockedException">/login/accountLocked</prop>
                <prop key="org.springframework.security.authentication.DisabledException">/login/accountDisabled</prop>
            </props>
        </property>
    </bean>


    <!-- Taming the pesky derby.log file -->
    <bean id="setDerbyLog" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
        <property name="targetClass"><value>java.lang.System</value></property>
        <property name="targetMethod"><value>setProperty</value></property>
        <property name="arguments">
            <list>
                <value>derby.stream.error.file</value>
                <value>${derby.stream.error.file}</value>
            </list>
        </property>
    </bean>

    <!-- File upload multipart resolver -->
    <bean id="multipartResolver"
          class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
        <property name="maxUploadSize" value="${rosetta.maxUpload}"/>
    </bean>

    <!-- Message source resolver to use messages.properties file in the 'war/WEB-INF/classes' directory -->
    <bean id="messageSource"
          class="org.springframework.context.support.ResourceBundleMessageSource">
        <property name="basename" value="messages"/>
    </bean>

    <!-- Resolves view names to decouple view from controller: ModelAndView("WEB-INF/views/XXXX.jsp"); -->
    <bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
        <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"></property>
        <property name="prefix" value="/WEB-INF/views/"></property>
        <property name="suffix" value=".jsp"></property>
    </bean>

    <!-- Declaration for resource use -->
    <bean id="fileManager" class="edu.ucar.unidata.rosetta.service.wizard.FileManagerImpl"/>
    <bean id="cfTypeValidator" class="edu.ucar.unidata.rosetta.service.validators.wizard.CFTypeValidator"/>
    <bean id="fileValidator" class="edu.ucar.unidata.rosetta.service.validators.wizard.FileValidator"/>
    <bean id="serverInfo" class="edu.ucar.unidata.rosetta.service.ServerInfoBean"
          init-method="init"/>
    <bean id="dbInitManager" class="edu.ucar.unidata.rosetta.service.resources.EmbeddedDerbyDbInitManager"/>

    <!-- DAO injection -->
    <bean id="dataManager" class="edu.ucar.unidata.rosetta.service.wizard.DataManagerImpl">
        <property name="cfTypeDao" ref="cfTypeDao"/>
        <property name="communityDao" ref="communityDao"/>
        <property name="dataDao" ref="dataDao"/>
        <property name="delimiterDao" ref="delimiterDao"/>
        <property name="fileTypeDao" ref="fileTypeDao"/>
        <property name="platformDao" ref="platformDao"/>
        <property name="propertiesDao" ref="propertiesDao"/>
    </bean>

    <bean id="metadataManager" class="edu.ucar.unidata.rosetta.service.wizard.MetadataManagerImpl">
        <property name="metadataDao" ref="metadataDao"/>
    </bean>

    <bean id="userDetailsService" class="edu.ucar.unidata.rosetta.service.user.UserDetailsServiceImpl">
        <property name="userDao" ref="userDao"/>
    </bean>

    <bean id="userManager" class="edu.ucar.unidata.rosetta.service.user.UserManagerImpl">
        <property name="userDao" ref="userDao"/>
    </bean>

    <bean id="cfTypeDao" class="edu.ucar.unidata.rosetta.repository.resources.JdbcCfTypeDao">
        <property name="dataSource" ref="dbDataSource"/>
    </bean>

    <bean id="communityDao" class="edu.ucar.unidata.rosetta.repository.resources.JdbcCommunityDao">
        <property name="dataSource" ref="dbDataSource"/>
    </bean>

    <bean id="dataDao" class="edu.ucar.unidata.rosetta.repository.wizard.JdbcDataDao">
        <property name="dataSource" ref="dbDataSource"/>
    </bean>

    <bean id="delimiterDao" class="edu.ucar.unidata.rosetta.repository.resources.JdbcDelimiterDao">
        <property name="dataSource" ref="dbDataSource"/>
    </bean>

    <bean id="fileTypeDao" class="edu.ucar.unidata.rosetta.repository.resources.JdbcFileTypeDao">
        <property name="dataSource" ref="dbDataSource"/>
    </bean>

    <bean id="metadataDao" class="edu.ucar.unidata.rosetta.repository.wizard.JdbcMetadataDao">
        <property name="dataSource" ref="dbDataSource"/>
    </bean>

    <bean id="platformDao" class="edu.ucar.unidata.rosetta.repository.resources.JdbcPlatformDao">
        <property name="dataSource" ref="dbDataSource"/>
    </bean>

    <bean id="propertiesDao" class="edu.ucar.unidata.rosetta.repository.wizard.JdbcPropertiesDao">
        <property name="dataSource" ref="dbDataSource"/>
{'fraction_non_alphanumeric': 0.1471141781681305, 'fraction_numerical': 0.0014638226683396068, 'mean_word_length': 3.441374506617135, 'pattern_counts': {'":': 0, '<': 297, '<?xml version=': 2, '>': 297, 'https://': 0, 'lorem ipsum': 0, 'www.': 26, 'xml': 14}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2483694', 'n_tokens_mistral': 5410, 'n_tokens_neox': 5327, 'n_words': 791}