<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>

    <!-- Web Project Service -->

    <!-- Web Project service bean -->
    <bean id="WebProjectService" class="org.springframework.aop.framework.ProxyFactoryBean">
        <property name="proxyInterfaces">
            <value>org.alfresco.wcm.webproject.WebProjectService</value>
        </property>
        <property name="target">
            <ref bean="webProjectService"/>
        </property>
        <property name="interceptorNames">
            <list>
                <idref local="WebProjectService_transaction"/>
                <idref bean="AuditMethodInterceptor"/>
                <idref bean="exceptionTranslator"/>
                <idref local="WebProjectService_security"/>
            </list>
        </property>
    </bean>

    <!-- Web Project service transaction bean -->
    <bean id="WebProjectService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor">
        <property name="transactionManager">
            <ref bean="transactionManager"/>
        </property>
        <property name="transactionAttributes">
            <props>
                <prop key="get*">${server.transaction.mode.readOnly}</prop>
                <prop key="list*">${server.transaction.mode.readOnly}</prop>
                <prop key="is*">${server.transaction.mode.readOnly}</prop>
                <prop key="find*">${server.transaction.mode.readOnly}</prop>
                <prop key="*">${server.transaction.mode.default}</prop>
            </props>
        </property>
    </bean>
    
    <!-- Web Project service security bean -->
    <bean id="WebProjectService_security" class="org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor" />
    
	
    <bean id="webProjectService" class="org.alfresco.wcm.webproject.WebProjectServiceImpl">
       <property name="nodeService" ref="NodeService"/>
       <property name="searchService" ref="SearchService"/>
       <property name="avmService" ref="AVMService"/>
       <property name="avmLockingService" ref="AVMLockingService"/>
       <property name="authorityService" ref="AuthorityService"/>
       <property name="permissionService" ref="PermissionService"/>
       <property name="personService" ref="PersonService"/>
       <property name="sandboxFactory" ref="sandboxFactory"/>
       <property name="virtServerRegistry" ref="VirtServerRegistry"/>
       <property name="previewURIServiceRegistry" ref="previewURIServiceRegistry"/>
       <property name="transactionService" ref="transactionService"/>
    </bean>


    <!-- Asset Service -->
   
    <!-- Asset service bean -->
    <bean id="AssetService" class="org.springframework.aop.framework.ProxyFactoryBean">
        <property name="proxyInterfaces">
            <value>org.alfresco.wcm.asset.AssetService</value>
        </property>
        <property name="target">
            <ref bean="assetService"/>
        </property>
        <property name="interceptorNames">
            <list>
                <idref local="AssetService_transaction"/>
                <idref bean="AuditMethodInterceptor"/>
                <idref bean="exceptionTranslator"/>
                <idref local="AssetService_security"/>
            </list>
        </property>
    </bean>

    <!-- Asset service transaction bean -->
    <bean id="AssetService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor">
        <property name="transactionManager">
            <ref bean="transactionManager"/>
        </property>
        <property name="transactionAttributes">
            <props>
                <prop key="get*">${server.transaction.mode.readOnly}</prop>
                <prop key="getContentWriter">${server.transaction.mode.default}</prop>
                <prop key="getContentReader">${server.transaction.mode.default}</prop>
                <prop key="list*">${server.transaction.mode.readOnly}</prop>
                <prop key="is*">${server.transaction.mode.readOnly}</prop>
                <prop key="find*">${server.transaction.mode.readOnly}</prop>
                <prop key="*">${server.transaction.mode.default}</prop>
            </props>
        </property>
    </bean>
    
    <!-- Asset service security bean -->
    <bean id="AssetService_security" class="org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor" />
    
    
    <bean id="assetService" class="org.alfresco.wcm.asset.AssetServiceImpl">
       <property name="avmService" ref="AVMLockingAwareService"/>
       <property name="avmLockingService" ref="AVMLockingService"/>
       <property name="nodeService" ref="avmLockingAwareNodeService"/> <!-- locking-aware AVMNodeService -->
       <property name="virtServerRegistry" ref="VirtServerRegistry"/>
    </bean>
    
    <!-- or can make avmNodeService locking-aware by default (and then inject NodeService above) -->
    
    <bean id="mlPropertyInterceptorLockingAware" class="org.alfresco.repo.node.MLPropertyInterceptor">
      <property name="nodeService">
         <ref bean="mlAwareLockingAwareNodeService" />
      </property>
      <property name="multilingualContentService">
         <ref bean="multilingualContentService" />
      </property>
      <property name="dictionaryService">
         <ref bean="dictionaryService" />
      </property>
   </bean>
   
    <bean id="avmLockingAwareNodeService" class="org.springframework.aop.framework.ProxyFactoryBean" >
      <property name="targetName">
         <value>mlAwareLockingAwareNodeService</value>
      </property>
      <property name="proxyInterfaces">
         <list>
            <value>org.alfresco.service.cmr.repository.NodeService</value>
         </list>
      </property>
      <property name="interceptorNames">
         <list>
            <value>mlPropertyInterceptorLockingAware</value>
         </list>
      </property>
   </bean>
   
   <bean id="mlAwareLockingAwareNodeService" class="org.alfresco.repo.avm.AVMNodeService" init-method="init">
		<property name="dictionaryService">
			<ref bean="dictionaryService"/>
		</property>
		<property name="avmService">
			<ref bean="AVMLockingAwareService"/>
		</property>
		<property name="policyComponent">
			<ref bean="policyComponent"/>
		</property>
	</bean>
    

    <!-- Sandbox Service -->
   
    <!-- Sandbox service bean -->
    <bean id="SandboxService" class="org.springframework.aop.framework.ProxyFactoryBean">
        <property name="proxyInterfaces">
            <value>org.alfresco.wcm.sandbox.SandboxService</value>
        </property>
        <property name="target">
            <ref bean="sandboxService"/>
        </property>
        <property name="interceptorNames">
            <list>
                <idref local="SandboxService_transaction"/>
                <idref bean="AuditMethodInterceptor"/>
                <idref bean="exceptionTranslator"/>
                <idref local="SandboxService_security"/>
            </list>
        </property>
    </bean>

    <!-- Sandbox service transaction bean -->
    <bean id="SandboxService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor">
        <property name="transactionManager">
            <ref bean="transactionManager"/>
        </property>
        <property name="transactionAttributes">
            <props>
                <prop key="get*">${server.transaction.mode.readOnly}</prop>
                <prop key="list*">${server.transaction.mode.readOnly}</prop>
                <prop key="is*">${server.transaction.mode.readOnly}</prop>
                <prop key="find*">${server.transaction.mode.readOnly}</prop>
                <prop key="*">${server.transaction.mode.default}</prop>
            </props>
        </property>
    </bean>
    
    <!-- Sandbox service security bean -->
    <bean id="SandboxService_security" class="org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor" />
    
	
    <bean id="sandboxService" class="org.alfresco.wcm.sandbox.SandboxServiceImpl">
       <property name="webProjectService" ref="WebProjectService"/>
       <property name="assetService" ref="AssetService"/>
       <property name="sandboxFactory" ref="sandboxFactory"/>
       <property name="avmService" ref="AVMService"/>
       <property name="avmSyncService" ref="AVMSyncService"/>
       <property name="nameMatcher" ref="globalPathExcluder"/>
       <property name="virtServerRegistry" ref="VirtServerRegistry"/>
       <property name="transactionService" ref="transactionService"/>
       <property name="workflowService" ref="WorkflowService"/>
       <property name="avmLockingService" ref="AVMLockingService"/>
    </bean>

    <!--
    <bean id="sandboxScript" parent="baseJavaScriptExtension" class="org.alfresco.wcm.sandbox.script.Sandboxes">
        <property name="extensionName">
            <value>sandboxes</value>
        </property>
        <property name="serviceRegistry" ref="ServiceRegistry"/>
        <property name="sandboxService" ref="SandboxService"/>
    </bean>
    -->
    
    <bean id="sandboxFactory" class="org.alfresco.wcm.sandbox.SandboxFactory">
       <property name="nodeService" ref="NodeService"/>
       <property name="permissionService" ref="PermissionService"/>
       <property name="avmService" ref="AVMService"/>
       <property name="avmLockingService" ref="AVMLockingService"/>
       <property name="virtServerRegistry" ref="VirtServerRegistry"/>
       <property name="authorityService" ref="AuthorityService"/>
    </bean>
    
    
    <!--  Java script API ROOT Scopeable object for WCM -->
    <bean id="webProjectsScript" parent="baseJavaScriptExtension" class="org.alfresco.wcm.webproject.script.WebProjects">
        <property name="extensionName">
            <value>webprojects</value>
        </property>
        <property name="serviceRegistry" ref="ServiceRegistry"/>
        <property name="webProjectService" ref="WebProjectService"/>
        <property name="sandboxService" ref="SandboxService"/>
        <property name="assetService" ref="AssetService"/>
        <property name="namespaceService" ref="NamespaceService"/>
    </bean>
    
    <!-- PreviewURI Service -->
    
    <!-- PreviewURI service bean - note: named WCMPreviewURIService to allow backwards compatibility with deprecated "PreviewURIService" (as hard-coded in AVMUtil) -->
    <bean id="WCMPreviewURIService" class="org.springframework.aop.framework.ProxyFactoryBean">
        <property name="proxyInterfaces">
            <value>org.alfresco.wcm.preview.PreviewURIService</value>
        </property>
        <property name="target">
            <ref bean="previewURIService"/>
        </property>
        <property name="interceptorNames">
            <list>
                <idref local="PreviewURIService_transaction"/>
                <idref bean="AuditMethodInterceptor"/>
                <idref bean="exceptionTranslator"/>
                <idref local="PreviewURIService_security"/>
            </list>
        </property>
    </bean>

    <!-- PreviewURI Service service transaction bean -->
    <bean id="PreviewURIService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor">
        <property name="transactionManager">
            <ref bean="transactionManager"/>
        </property>
        <property name="transactionAttributes">
            <props>
                <prop key="get*">${server.transaction.mode.readOnly}</prop>
                <prop key="*">${server.transaction.mode.default}</prop>
            </props>
        </property>
    </bean>
    
    <!-- PreviewURIService service security bean -->
    <bean id="PreviewURIService_security" class="org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor" />
    
    <bean id="previewURIService" class="org.alfresco.wcm.preview.PreviewURIServiceImpl">
        <property name="webProjectService" ref="WebProjectService"/>
        <property name="previewURIServiceRegistry" ref="previewURIServiceRegistry"/>
    </bean>
    
    <!-- override this bean in a custom-wcm-preview-context.xml file to extend/change list of preview providers -->
    <bean id="previewURIServiceRegistry" class="org.alfresco.wcm.preview.PreviewURIServiceRegistryImpl">
        <property name="defaultProviderName">
           <value>Virtualisation Server Preview</value>
       </property>
       <property name="previewURIServiceProvidersByName">
           <map>
               <entry key="Virtualisation Server Preview">
                   <ref bean="virtServerPreviewURIService"/>
               </entry>
               <!--
               <entry key="NOOP Preview">
                   <ref bean="nullPreviewURIService"/>
               </entry>
               -->
           </map>
       </property>
    </bean>
    
    <bean id="basePreviewURIServiceProvider" class="org.alfresco.wcm.preview.AbstractPreviewURIServiceProvider" abstract="true"/>
    
    <bean id="virtServerPreviewURIService" class="org.alfresco.wcm.preview.VirtualisationServerPreviewURIService" parent="basePreviewURIServiceProvider">
        <property name="avmService" ref="AVMService"/>
        <property name="virtServerRegistry" ref="VirtServerRegistry"/>
    </bean>
    
    <bean id="nullPreviewURIService" class="org.alfresco.wcm.preview.NullPreviewURIService" parent="basePreviewURIServiceProvider"/>
    
    <!-- WCM example actions -->
    
    <bean id="wcm-submit" class="org.alfresco.wcm.actions.WCMSandboxSubmitAction" parent="action-executer">
        <property name="sandboxService">
            <ref bean="SandboxService"/>
        </property>
        <property name="publicAction">
            <value>false</value>
        </property>
    </bean>
    
    <bean id="wcm-revert-snapshot" class="org.alfresco.wcm.actions.WCMSandboxRevertSnapshotAction" parent="action-executer">
        <property name="sandboxService">
            <ref bean="SandboxService"/>
        </property>
        <property name="publicAction">
            <value>false</value>
        </property>
    </bean>
    
    <bean id="wcm-undo" class="org.alfresco.wcm.actions.WCMSandboxUndoAction" parent="action-executer">
        <property name="sandboxService">
            <ref bean="SandboxService"/>
        </property>
        <property name="publicAction">
            <value>false</value>
        </property>
    </bean>
    
    <!-- I18N -->
    
    <bean id="wcmServicesResourceBundles" class="org.alfresco.i18n.ResourceBundleBootstrapComponent">
        <property name="resourceBundles">
            <list>
                <value>alfresco.messages.wcm-services</value>
            </list>
        </property>
    </bean>
    
</beans>