<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
	xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:wsa="http://cxf.apache.org/ws/addressing"
	xmlns:p="http://www.springframework.org/schema/p" xmlns:http="http://cxf.apache.org/transports/http/configuration"
	xmlns:t="http://dnetlib.eu/springbeans/t" xmlns:template="http://dnetlib.eu/springbeans/template"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
                                    http://cxf.apache.org/ws/addressing http://cxf.apache.org/schemas/ws-addr-conf.xsd
                                    http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd
                                    http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
                            http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
                            http://dnetlib.eu/springbeans/template http://dnetlib.eu/springbeans/template.xsd">
	<!--  beans -->
	<bean id="isRegistryService" class="eu.dnetlib.enabling.is.registry.ISRegistryServiceImpl"
		init-method="start" destroy-method="stop" p:isLookup-ref="isLookUpService" p:isStore-ref="isStoreService"
		p:pendingManager-ref="pendingManager" p:resourceValidator-ref="resourceValidator" p:xqueryUtils-ref="xqueryUtils" />

	<bean id="registryBlackboardManager"
		class="eu.dnetlib.enabling.is.registry.RegistryBlackboardManagerImpl"
		p:messageFactory-ref="blackboardMessageFactory" p:isLookup-ref="isLookUpService"
		p:registryService-ref="isRegistryService" />

	<alias alias="pendingManager" name="${services.registry.pending.resource.manager}" />

	<bean id="compatPendingManager"
		class="eu.dnetlib.enabling.is.registry.CompatPendingResourceManagerImpl"
		p:isRegistry-ref="isRegistryService" p:resourceKindResolver-ref="resourceKindResolverChain" />
		
	<bean id="idPreservingPendingManager"
		class="eu.dnetlib.enabling.is.registry.IdPreservingPendingResourceManagerImpl"
		p:resourceValidator-ref="resourceValidator"	p:xqueryUtils-ref="xqueryUtils"
		p:isRegistry-ref="isRegistryService" p:isStore-ref="isStoreService"
		p:resourceKindResolver-ref="resourceKindResolverChain" />			

	<bean id="resourceKindResolverChain"
		class="eu.dnetlib.enabling.is.registry.ResourceKindResolverChain">
		<property name="resolvers">
			<list>
				<ref bean="resourceKindResolver" />
				<ref bean="nameBasedResourceKindResolver" />
			</list>
		</property>
	</bean>

	<bean id="nameBasedResourceKindResolver"
		class="eu.dnetlib.enabling.is.registry.NameBasedResourceKindResolver" />

	<bean id="resourceKindResolver"
		class="eu.dnetlib.enabling.is.registry.ApplicationProfileResourceKindResolver" />

	<bean id="resourceIdentifierResolver"
		class="eu.dnetlib.enabling.tools.CompatResourceIdentifierResolverImpl" />

	<bean id="resourceValidator"
		class="eu.dnetlib.enabling.is.registry.schema.OpaqueResourceValidatorImpl"
		p:schemaDao-ref="resourceSchemaDao" />

	<bean id="resourceSchemaDao"
		class="eu.dnetlib.enabling.is.registry.schema.ResourceSchemaDAOImpl"
		p:isLookup-ref="isLookUpService" />
		
	<bean id="profileValidationStrategy" class="eu.dnetlib.enabling.is.registry.validation.ProfileValidationStrategy" />
	
	<bean id="alwaysAcceptProfileValidator" class="eu.dnetlib.enabling.is.registry.validation.AlwaysAcceptProfileValidator" />

	<!-- endpoints -->
	<jaxws:endpoint id="isRegistryServiceEndpoint"
		implementor="#isRegistryService" implementorClass="eu.dnetlib.enabling.is.registry.rmi.ISRegistryService"
		address="/isRegistry" />

	<template:instance name="serviceRegistrationManager"
		t:serviceRegistrationManagerClass="eu.dnetlib.enabling.tools.registration.ValidatingServiceRegistrationManagerImpl"
		t:name="isRegistryServiceRegistrationManager" t:service="isRegistryService"
		t:endpoint="isRegistryServiceEndpoint" t:jobScheduler="jobScheduler" />
</beans>
