<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:amq="http://activemq.apache.org/schema/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd   
  http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
  
  <bean id="handlerRegistry" class="com.raytheon.uf.edex.auth.HandlerRegistry" factory-method="getInstance"/>
  
  <bean id="serializeServer" class="com.raytheon.uf.edex.auth.RemoteRequestServer" factory-method="getInstance">
		<property name="registry" ref="handlerRegistry"/>
	</bean>

	<bean id="routeWrapper" class="com.raytheon.uf.edex.auth.RemoteRequestRouteWrapper">
		<property name="server" ref="serializeServer"/>
	</bean>    

    <bean id="binaryHttpBinding" class="com.raytheon.uf.edex.esb.camel.http.BinaryHttpBinding"/>

    <camelContext id="server-camel"
        xmlns="http://camel.apache.org/schema/spring"
        errorHandlerRef="errorHandler">

        <endpoint id="ebxmlThriftService" uri="jetty:http://0.0.0.0:${EBXML_THRIFT_SERVICE_PORT}/services/thrift?disableStreamCache=true&amp;chunked=false&amp;httpBindingRef=#binaryHttpBinding" />

        <route id="thriftService">
            <from ref="ebxmlThriftService" />
            <bean ref="webservice" method="openSession"/>
            <bean ref="routeWrapper" method="executeThrift"/>
            <bean ref="webservice" method="closeSession"/>
        </route>

    </camelContext>

    <bean id="webservice" class="com.raytheon.uf.edex.registry.ebxml.util.EDEXRegistryManager"/>

    <bean factory-bean="handlerRegistry" factory-method="register">
        <constructor-arg value="com.raytheon.uf.common.registry.IRegistryRequest"/>
        <constructor-arg ref="webservice"/>
    </bean>
    
    <bean id="roleStorage"
        class="com.raytheon.uf.edex.plugin.nwsauth.NwsRoleStorage" />
    <bean id="authenticator"
        class="com.raytheon.uf.edex.plugin.nwsauth.authentication.Authenticator" />
    <bean id="authStorage"
        class="com.raytheon.uf.edex.plugin.nwsauth.authentication.AuthenticationStorage" />

    <bean id="authManager" class="com.raytheon.uf.edex.auth.AuthManager">
        <property name="authenticationStorage" ref="authStorage" />
        <property name="authenticator" ref="authenticator" />
        <property name="roleStorage" ref="roleStorage" />
    </bean>

    <bean id="authFactory" class="com.raytheon.uf.edex.auth.AuthManagerFactory"
        factory-method="getInstance">
        <property name="manager" ref="authManager" />
    </bean>
</beans>