AppFuse as backend for Spring-RCP Standalone

Modify Maven configuration

Add the following dependency in the pom.xml:

<dependency>
	<groupId>com.company.app</groupId>
	<artifactId>app-core</artifactId>
	<version>${app.version}</version>
</dependency>

The rebuild the project definition using mvn eclipse:eclipse.

Modify Context configuration

Add the following two bean definitions to the file richclient-application-context.xml:

<!-- Resolves ${...} placeholders from client.properties -->
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
       <property name="locations">
           <list>
               <value>classpath:jdbc.properties</value>
               <value>classpath:mail.properties</value>
               <value>classpath:remoting.properties</value>
           </list>
       </property>
</bean>
 
<!-- JDBC Database properties -->
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
       <property name="driverClassName" value="${jdbc.driverClassName}"/>
       <property name="url" value="${jdbc.url}"/>
       <property name="username" value="${jdbc.username}"/>
       <property name="password" value="${jdbc.password}"/>
   </bean>

Modify security configuration

Add the following bean definitions to the security.xml:

<bean id="passwordEncoder" class="org.acegisecurity.providers.encoding.ShaPasswordEncoder"/>
 
<bean id="daoAuthenticationProvider" class="org.acegisecurity.providers.dao.DaoAuthenticationProvider">
	 <property name="userDetailsService" ref="userDao"/>
	 <property name="passwordEncoder" ref="passwordEncoder"/>
</bean>
 
<bean id="authenticationManager" class="org.acegisecurity.providers.ProviderManager">
	<property name="providers">
	  <list>
		<ref bean="daoAuthenticationProvider"/>
	  </list>
	</property>
</bean>

Add property files

Copy the following two property files from the AppFuse project to src/main/resources

  • src/test/resources/jdbc.properties
  • src/test/resources/mail.properties

Using AppFuse in the client

Add two of the AppFuse configuration files to your RCP runtime configuration:

String appfuseDaoContextPath = "applicationContext-dao.xml";
String appfuseServiceContextPath = "applicationContext-service.xml";
 
String zcrmApplicationContextPath = "applicationContext.xml";
 
try {
    new ApplicationLauncher(startupContextPath, new String[] {
		[...]
    		appfuseDaoContextPath,
    		appfuseServiceContextPath,
    		zcrmApplicationContextPath
    });
 
} catch (RuntimeException e) {
    logger.error("RuntimeException during startup", e);
}
Recent changes RSS feed Creative Commons License Donate Driven by DokuWiki