applicationContext.xml 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE beans PUBLIC
  3. "-//SPRING//DTD BEAN//EN"
  4. "http://www.springframework.org/dtd/spring-beans.dtd">
  5. <beans>
  6. <bean id="propertyConfigurer"
  7. class="magoffin.matt.xweb.util.XwebParamPropertiesPlaceholderConfigurer">
  8. <property name="order" value="1"/>
  9. <property name="locations">
  10. <list>
  11. <value>classpath:/env.properties</value>
  12. </list>
  13. </property>
  14. <property name="settingDao" ref="parameterDaoEnvironment"/>
  15. </bean>
  16. <bean id="messageSource" class="magoffin.matt.xweb.util.JdbcMessagesSource">
  17. <property name="jdbcTemplate" ref="myJdbcTemplate"/>
  18. <property name="parentMessageSource">
  19. <bean class="magoffin.matt.xweb.util.ResourceBundleMessagesSource">
  20. <property name="basenames">
  21. <list>
  22. <value>messages</value>
  23. <value>domain-messages</value>
  24. </list>
  25. </property>
  26. </bean>
  27. </property>
  28. </bean>
  29. <!--
  30. transformerFactory: a default JAXP TranformerFactory
  31. -->
  32. <bean id="transformerFactory" class="javax.xml.transform.TransformerFactory"
  33. factory-method="newInstance">
  34. <!-- set any desired features or attributes here -->
  35. </bean>
  36. <!--
  37. cacheManager: the EHCache CacheManager to enable injecting caches into beans
  38. -->
  39. <bean id="cacheManager" class="net.sf.ehcache.CacheManager" factory-method="create"/>
  40. <bean id="myJdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
  41. <constructor-arg index="0"><ref bean="myDataSource"/></constructor-arg>
  42. </bean>
  43. <bean id="myTransactionInterceptor"
  44. class="org.springframework.transaction.interceptor.TransactionInterceptor">
  45. <property name="transactionManager">
  46. <ref bean="transactionManager"/>
  47. </property>
  48. <property name="transactionAttributeSource">
  49. <value>
  50. magoffin.matt.ieat.biz.RecipeBiz.add*=PROPAGATION_REQUIRED
  51. magoffin.matt.ieat.biz.RecipeBiz.remove*=PROPAGATION_REQUIRED
  52. magoffin.matt.ieat.biz.RecipeBiz.store*=PROPAGATION_REQUIRED
  53. magoffin.matt.ieat.biz.RecipeBiz.*ById=PROPAGATION_REQUIRED
  54. magoffin.matt.ieat.biz.UserBiz.forgot*=PROPAGATION_REQUIRED
  55. magoffin.matt.ieat.biz.UserBiz.store*=PROPAGATION_REQUIRED
  56. magoffin.matt.ieat.biz.UserBiz.confirm*=PROPAGATION_REQUIRED
  57. magoffin.matt.ieat.biz.UserBiz.register*=PROPAGATION_REQUIRED
  58. magoffin.matt.ieat.biz.UserBiz.logon*=PROPAGATION_REQUIRED
  59. </value>
  60. </property>
  61. </bean>
  62. <bean id="recipeBizTarget" class="magoffin.matt.ieat.biz.impl.RecipeBizImpl"
  63. init-method="init">
  64. <property name="baseDao"><ref local="baseDao"/></property>
  65. <property name="courseDao"><ref local="courseDao"/></property>
  66. <property name="difficultyDao"><ref local="difficultyDao"/></property>
  67. <property name="ethnicityDao"><ref local="ethnicityDao"/></property>
  68. <property name="ingredientDao"><ref local="ingredientDao"/></property>
  69. <property name="mealDao"><ref local="mealDao"/></property>
  70. <property name="prepTimeDao"><ref local="prepTimeDao"/></property>
  71. <property name="recipeDao"><ref local="recipeDao"/></property>
  72. <property name="systemDao" ref="systemDao"/>
  73. <property name="unitDao"><ref local="unitDao"/></property>
  74. <property name="recipeValidator"><ref local="recipeValidator"/></property>
  75. <property name="domainObjectFactory"><ref bean="domainObjectFactory"/></property>
  76. <property name="imageBasePath">
  77. <value>${recipe.image.base.path}</value>
  78. </property>
  79. <property name="imageSupportedExtensions">
  80. <set>
  81. <value>gif</value>
  82. <value>jpg</value>
  83. <value>png</value>
  84. </set>
  85. </property>
  86. </bean>
  87. <bean id="recipeSecurityAdvisor"
  88. class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
  89. <property name="advice">
  90. <bean class="magoffin.matt.ieat.aop.RecipeSecurityInterceptor">
  91. <property name="recipeDao"><ref local="recipeDao"/></property>
  92. </bean>
  93. </property>
  94. <property name="mappedNames">
  95. <list>
  96. <value>removeRecipe</value>
  97. <value>setRecipeImage</value>
  98. <value>storeRecipe</value>
  99. </list>
  100. </property>
  101. </bean>
  102. <bean id="featureCommentsSecurityAdvisor"
  103. class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
  104. <property name="advice">
  105. <bean class="magoffin.matt.ieat.aop.FeatureSecurityInterceptor">
  106. <property name="feature" value="feature.comments"/>
  107. <property name="featureEnabled" value="${feature.comments}"/>
  108. </bean>
  109. </property>
  110. <property name="mappedNames">
  111. <list>
  112. <value>addCommentToRecipe</value>
  113. </list>
  114. </property>
  115. </bean>
  116. <bean id="featureRecipeImagesSecurityAdvisor"
  117. class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
  118. <property name="advice">
  119. <bean class="magoffin.matt.ieat.aop.FeatureSecurityInterceptor">
  120. <property name="feature" value="feature.recipeimages"/>
  121. <property name="featureEnabled" value="${feature.recipeimages}"/>
  122. </bean>
  123. </property>
  124. <property name="mappedNames">
  125. <list>
  126. <value>storeRecipeImage</value>
  127. </list>
  128. </property>
  129. </bean>
  130. <bean id="featureRegistrationSecurityAdvisor"
  131. class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
  132. <property name="advice">
  133. <bean class="magoffin.matt.ieat.aop.FeatureSecurityInterceptor">
  134. <property name="feature" value="feature.registration"/>
  135. <property name="featureEnabled" value="${feature.registration}"/>
  136. </bean>
  137. </property>
  138. <property name="mappedNames">
  139. <list>
  140. <value>confirmRegisteredUser</value>
  141. <value>registerUser</value>
  142. </list>
  143. </property>
  144. </bean>
  145. <bean id="mealSecurityAdvisor"
  146. class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
  147. <property name="advice">
  148. <bean class="magoffin.matt.ieat.aop.MealSecurityInterceptor">
  149. <property name="mealDao"><ref local="mealDao"/></property>
  150. </bean>
  151. </property>
  152. <property name="mappedNames">
  153. <list>
  154. <value>getMealById</value>
  155. <value>removeMeal</value>
  156. <value>storeMeal</value>
  157. </list>
  158. </property>
  159. </bean>
  160. <!-- Ingredient search indexing support -->
  161. <bean id="recipeBizIngredientIndexAdvisor"
  162. class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
  163. <property name="advice">
  164. <bean class="magoffin.matt.ieat.aop.IngredientIndexInterceptor">
  165. <property name="recipeSearchIndexBiz"><ref local="recipeSearchIndexBiz"/></property>
  166. </bean>
  167. </property>
  168. <property name="mappedNames">
  169. <list>
  170. <value>storeIngredient</value>
  171. </list>
  172. </property>
  173. </bean>
  174. <!-- Recipe search indexing support -->
  175. <bean id="recipeBizRecipeIndexAdvisor"
  176. class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
  177. <property name="advice">
  178. <bean class="magoffin.matt.ieat.aop.RecipeIndexInterceptor">
  179. <property name="recipeSearchIndexBiz"><ref local="recipeSearchIndexBiz"/></property>
  180. </bean>
  181. </property>
  182. <property name="mappedNames">
  183. <list>
  184. <value>storeRecipe</value>
  185. <value>storeRecipeRating</value>
  186. </list>
  187. </property>
  188. </bean>
  189. <bean id="recipeBizRecipeIndexDeleteAdvisor"
  190. class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
  191. <property name="advice">
  192. <bean class="magoffin.matt.ieat.aop.RecipeIndexDeleteInterceptor">
  193. <property name="recipeSearchIndexBiz"><ref local="recipeSearchIndexBiz"/></property>
  194. </bean>
  195. </property>
  196. <property name="mappedNames">
  197. <list>
  198. <value>removeRecipe</value>
  199. </list>
  200. </property>
  201. </bean>
  202. <bean id="recipeBiz" class="org.springframework.aop.framework.ProxyFactoryBean">
  203. <property name="target"><ref local="recipeBizTarget"/></property>
  204. <property name="proxyInterfaces">
  205. <list>
  206. <value>magoffin.matt.ieat.biz.RecipeBiz</value>
  207. </list>
  208. </property>
  209. <property name="interceptorNames">
  210. <list>
  211. <value>recipeSecurityAdvisor</value>
  212. <value>featureCommentsSecurityAdvisor</value>
  213. <value>featureRecipeImagesSecurityAdvisor</value>
  214. <value>mealSecurityAdvisor</value>
  215. <value>recipeBizIngredientIndexAdvisor</value>
  216. <value>recipeBizRecipeIndexAdvisor</value>
  217. <value>recipeBizRecipeIndexDeleteAdvisor</value>
  218. <value>myTransactionInterceptor</value>
  219. </list>
  220. </property>
  221. </bean>
  222. <bean id="encryptor" class="magoffin.matt.util.DataEncryption">
  223. <constructor-arg index="0"><value>${crypto.provider}</value></constructor-arg>
  224. <constructor-arg index="1"><value>${crypto.key.type}</value></constructor-arg>
  225. <constructor-arg index="2"><value>${crypto.cipher.type}</value></constructor-arg>
  226. <constructor-arg index="3"><value>${crypto.key}</value></constructor-arg>
  227. <constructor-arg index="4"><value>${crypto.pbe.salt}</value></constructor-arg>
  228. </bean>
  229. <bean id="userBizTarget" class="magoffin.matt.ieat.biz.impl.UserBizImpl" init-method="init">
  230. <property name="salt"><value>${crypto.salt}</value></property>
  231. <property name="userDao"><ref local="userDao"/></property>
  232. <property name="encryptor"><ref local="encryptor"/></property>
  233. <property name="userValidator"><ref local="userValidator"/></property>
  234. </bean>
  235. <bean id="registrationEmailAdvisor"
  236. class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
  237. <property name="advice">
  238. <bean class="magoffin.matt.ieat.aop.UserEmailInterceptor">
  239. <property name="mailMergeSupport">
  240. <bean class="magoffin.matt.ieat.util.MailMergeSupport">
  241. <property name="templatePath"><value>magoffin/matt/ieat/mailtemplates</value></property>
  242. <property name="templateName"><value>registration.txt</value></property>
  243. <property name="mailSender"><ref bean="mailSender"/></property>
  244. <property name="messageTemplate"><ref local="mailMessage"/></property>
  245. <property name="messageSource"><ref local="messageSource"/></property>
  246. <property name="subjectMessageKey"><value>registration-complete.mail.subject</value></property>
  247. </bean>
  248. </property>
  249. <property name="confirmUrl"><value>${url.registration.confirm}</value></property>
  250. </bean>
  251. </property>
  252. <property name="mappedNames">
  253. <list>
  254. <value>registerUser</value>
  255. </list>
  256. </property>
  257. </bean>
  258. <bean id="welcomeEmailAdvisor"
  259. class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
  260. <property name="advice">
  261. <bean class="magoffin.matt.ieat.aop.UserEmailInterceptor">
  262. <property name="mailMergeSupport">
  263. <bean class="magoffin.matt.ieat.util.MailMergeSupport">
  264. <property name="templatePath"><value>magoffin/matt/ieat/mailtemplates</value></property>
  265. <property name="templateName"><value>welcome.txt</value></property>
  266. <property name="mailSender"><ref bean="mailSender"/></property>
  267. <property name="messageTemplate"><ref local="mailMessage"/></property>
  268. <property name="messageSource"><ref local="messageSource"/></property>
  269. <property name="subjectMessageKey"><value>welcome.mail.subject</value></property>
  270. </bean>
  271. </property>
  272. <property name="confirmUrl"><value>${url.welcome}</value></property>
  273. </bean>
  274. </property>
  275. <property name="mappedNames">
  276. <list>
  277. <value>confirmRegisteredUser</value>
  278. </list>
  279. </property>
  280. </bean>
  281. <bean id="forgotPasswordEmailAdvisor"
  282. class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
  283. <property name="advice">
  284. <bean class="magoffin.matt.ieat.aop.UserLoginEmailInterceptor">
  285. <property name="mailMergeSupport">
  286. <bean class="magoffin.matt.ieat.util.MailMergeSupport">
  287. <property name="templatePath"><value>magoffin/matt/ieat/mailtemplates</value></property>
  288. <property name="templateName"><value>forgot-password.txt</value></property>
  289. <property name="mailSender"><ref bean="mailSender"/></property>
  290. <property name="messageTemplate"><ref local="mailMessage"/></property>
  291. <property name="messageSource"><ref local="messageSource"/></property>
  292. <property name="subjectMessageKey"><value>forgot-password.mail.subject</value></property>
  293. </bean>
  294. </property>
  295. <property name="userDao"><ref bean="userDao"/></property>
  296. <property name="confirmUrl"><value>${url.forgot-password.confirm}</value></property>
  297. </bean>
  298. </property>
  299. <property name="mappedNames">
  300. <list>
  301. <value>forgotPassword</value>
  302. </list>
  303. </property>
  304. </bean>
  305. <bean id="userRegistrationIndexAdvisor"
  306. class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
  307. <property name="advice">
  308. <bean class="magoffin.matt.ieat.aop.UserArgumentIndexInterceptor">
  309. <property name="recipeSearchIndexBiz"><ref local="recipeSearchIndexBiz"/></property>
  310. <property name="userDao"><ref local="userDao"/></property>
  311. </bean>
  312. </property>
  313. <property name="mappedNames">
  314. <list>
  315. <value>registerUser</value>
  316. </list>
  317. </property>
  318. </bean>
  319. <bean id="userIndexAdvisor"
  320. class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
  321. <property name="advice">
  322. <bean class="magoffin.matt.ieat.aop.UserIndexInterceptor">
  323. <property name="recipeSearchIndexBiz"><ref local="recipeSearchIndexBiz"/></property>
  324. </bean>
  325. </property>
  326. <property name="mappedNames">
  327. <list>
  328. <value>storeUser</value>
  329. </list>
  330. </property>
  331. </bean>
  332. <bean id="userIndexDeleteAdvisor"
  333. class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
  334. <property name="advice">
  335. <bean class="magoffin.matt.ieat.aop.UserIndexDeleteInterceptor">
  336. <property name="recipeSearchIndexBiz"><ref local="recipeSearchIndexBiz"/></property>
  337. </bean>
  338. </property>
  339. <property name="mappedNames">
  340. <list>
  341. <value>removeUser</value>
  342. </list>
  343. </property>
  344. </bean>
  345. <bean id="userBiz" class="org.springframework.aop.framework.ProxyFactoryBean">
  346. <property name="target"><ref local="userBizTarget"/></property>
  347. <property name="proxyInterfaces">
  348. <list>
  349. <value>magoffin.matt.ieat.biz.UserBiz</value>
  350. </list>
  351. </property>
  352. <property name="interceptorNames">
  353. <list>
  354. <value>featureRegistrationSecurityAdvisor</value>
  355. <value>forgotPasswordEmailAdvisor</value>
  356. <value>userRegistrationIndexAdvisor</value>
  357. <value>userIndexAdvisor</value>
  358. <value>userIndexDeleteAdvisor</value>
  359. <value>myTransactionInterceptor</value>
  360. <value>registrationEmailAdvisor</value>
  361. <value>welcomeEmailAdvisor</value>
  362. </list>
  363. </property>
  364. </bean>
  365. <bean id="recipeSearchIndexBizTarget"
  366. class="magoffin.matt.ieat.biz.impl.lucene.RecipeSearchBizLuceneImpl"
  367. init-method="init">
  368. <property name="lucene" ref="luceneService"/>
  369. <property name="domainObjectFactory" ref="domainObjectFactory"/>
  370. </bean>
  371. <bean id="luceneService" class="magoffin.matt.lucene.LuceneSearchService"
  372. init-method="initialize" destroy-method="finish">
  373. <property name="baseIndexDirectoryPath" value="${lucene.index.base.path}"/>
  374. <property name="optimizeTriggerCount" value="${lucene.index.optimize.trigger}"/>
  375. <property name="updateBufferSize" value="${lucene.update.buffer.size}"/>
  376. <property name="updateBufferFlushMs" value="${lucene.update.buffer.flush}"/>
  377. <property name="discardedIndexReaderMinCloseTime" value="60000"/>
  378. <property name="discardedIndexReaderProcessorMs" value="120000"/>
  379. <property name="neverOptimize" value="${lucene.index.optimize.never}"/>
  380. <property name="indexTimeZone" ref="indexTimeZone"/>
  381. <property name="plugins">
  382. <list>
  383. <ref local="ingredientLucenePlugin"/>
  384. <ref local="recipeLucenePlugin"/>
  385. <ref local="unitLucenePlugin"/>
  386. <ref local="userLucenePlugin"/>
  387. </list>
  388. </property>
  389. </bean>
  390. <bean id="ingredientLucenePlugin"
  391. class="magoffin.matt.ieat.biz.impl.lucene.IngredientLucenePlugin">
  392. <property name="config">
  393. <bean class="magoffin.matt.lucene.BasicIndexConfig"/>
  394. </property>
  395. <property name="analyzer" ref="standardAnalyzer"/>
  396. <property name="domainObjectFactory" ref="domainObjectFactory"/>
  397. <property name="messages" ref="messageSource"/>
  398. <property name="ingredientDao" ref="ingredientDao"/>
  399. </bean>
  400. <bean id="recipeLucenePlugin"
  401. class="magoffin.matt.ieat.biz.impl.lucene.RecipeLucenePlugin">
  402. <property name="config">
  403. <bean class="magoffin.matt.lucene.BasicIndexConfig"/>
  404. </property>
  405. <property name="analyzer" ref="standardAnalyzer"/>
  406. <property name="domainObjectFactory" ref="domainObjectFactory"/>
  407. <property name="messages" ref="messageSource"/>
  408. <property name="recipeDao" ref="recipeDao"/>
  409. <property name="userDao" ref="userDao"/>
  410. <property name="averageRatingNumberFormat">
  411. <bean class="java.text.NumberFormat" factory-method="getInstance">
  412. <property name="maximumFractionDigits" value="0"/>
  413. </bean>
  414. </property>
  415. </bean>
  416. <bean id="unitLucenePlugin"
  417. class="magoffin.matt.ieat.biz.impl.lucene.UnitLucenePlugin">
  418. <property name="config">
  419. <bean class="magoffin.matt.lucene.BasicIndexConfig"/>
  420. </property>
  421. <property name="analyzer" ref="standardAnalyzer"/>
  422. <property name="domainObjectFactory" ref="domainObjectFactory"/>
  423. <property name="messages" ref="messageSource"/>
  424. <property name="unitDao" ref="unitDao"/>
  425. </bean>
  426. <bean id="userLucenePlugin"
  427. class="magoffin.matt.ieat.biz.impl.lucene.UserLucenePlugin">
  428. <property name="config">
  429. <bean class="magoffin.matt.lucene.BasicIndexConfig"/>
  430. </property>
  431. <property name="analyzer" ref="standardAnalyzer"/>
  432. <property name="domainObjectFactory" ref="domainObjectFactory"/>
  433. <property name="messages" ref="messageSource"/>
  434. <property name="userDao" ref="userDao"/>
  435. </bean>
  436. <bean id="standardAnalyzer"
  437. class="magoffin.matt.ieat.biz.impl.lucene.StandardEatAnalyzer">
  438. <property name="snowballStemmerName" value="${lucene.snowball.stemmer.name}"/>
  439. <property name="indexKeyLength" value="1"/>
  440. </bean>
  441. <bean id="indexTimeZone" class="java.util.TimeZone" factory-method="getTimeZone">
  442. <constructor-arg index="0" type="java.lang.String" value="${index.timezone.java}"/>
  443. </bean>
  444. <bean id="recipeSearchIndexBiz" name="recipeSearchBiz"
  445. class="org.springframework.aop.framework.ProxyFactoryBean">
  446. <property name="target"><ref local="recipeSearchIndexBizTarget"/></property>
  447. <property name="proxyInterfaces">
  448. <list>
  449. <value>magoffin.matt.ieat.biz.RecipeSearchBiz</value>
  450. <value>magoffin.matt.ieat.biz.RecipeSearchIndexBiz</value>
  451. </list>
  452. </property>
  453. <property name="interceptorNames">
  454. <list>
  455. <value>recipeIndexCacheAdvisor</value>
  456. <value>userIndexCacheAdvisor</value>
  457. </list>
  458. </property>
  459. </bean>
  460. <bean id="recipeIndexCacheAdvisor"
  461. class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
  462. <property name="advice">
  463. <bean class="magoffin.matt.ieat.aop.IndexSearchResultsCacheInterceptor">
  464. <property name="cache">
  465. <bean class="net.sf.ehcache.constructs.blocking.BlockingCache">
  466. <constructor-arg index="0">
  467. <bean class="org.springframework.cache.ehcache.EhCacheFactoryBean">
  468. <property name="cacheManager" ref="cacheManager"/>
  469. <property name="cacheName" value="magoffin.matt.ieat.recipe_index_cache"/>
  470. </bean>
  471. </constructor-arg>
  472. <property name="timeoutMillis" value="5000"/>
  473. </bean>
  474. </property>
  475. </bean>
  476. </property>
  477. <property name="mappedNames">
  478. <list>
  479. <value>findRecipesForIndex</value>
  480. </list>
  481. </property>
  482. </bean>
  483. <bean id="userIndexCacheAdvisor"
  484. class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
  485. <property name="advice">
  486. <bean class="magoffin.matt.ieat.aop.IndexSearchResultsCacheInterceptor">
  487. <property name="cache">
  488. <bean class="net.sf.ehcache.constructs.blocking.BlockingCache">
  489. <constructor-arg index="0">
  490. <bean class="org.springframework.cache.ehcache.EhCacheFactoryBean">
  491. <property name="cacheManager" ref="cacheManager"/>
  492. <property name="cacheName" value="magoffin.matt.ieat.user_index_cache"/>
  493. </bean>
  494. </constructor-arg>
  495. <property name="timeoutMillis" value="5000"/>
  496. </bean>
  497. </property>
  498. </bean>
  499. </property>
  500. <property name="mappedNames">
  501. <list>
  502. <value>findUsersForIndex</value>
  503. </list>
  504. </property>
  505. </bean>
  506. <bean id="mailMessage" class="org.springframework.mail.SimpleMailMessage">
  507. <property name="from"><value>${mail.from}</value></property>
  508. </bean>
  509. <bean id="alterRecipeSizeValidator" class="magoffin.matt.ieat.validation.AlterRecipeSizeValidator"/>
  510. <bean id="emailRecipeValidator" class="magoffin.matt.ieat.validation.EmailRecipeValidator"/>
  511. <bean id="ingredientValidator" class="magoffin.matt.ieat.validation.IngredientValidator"/>
  512. <bean id="logonValidator" class="magoffin.matt.ieat.validation.LogonValidator"/>
  513. <bean id="mealValidator" class="magoffin.matt.ieat.validation.MealValidator"/>
  514. <bean id="mealRecipeValidator" class="magoffin.matt.ieat.validation.MealRecipeValidator"/>
  515. <bean id="recipeCommentsValidator" class="magoffin.matt.ieat.validation.RecipeCommentsValidator"/>
  516. <bean id="recipeValidator" class="magoffin.matt.ieat.validation.RecipeValidator"/>
  517. <bean id="recipeMLImportValidator" class="magoffin.matt.ieat.validation.RecipeImportValidator">
  518. <property name="rioBiz" ref="recipeIOBiz"/>
  519. <property name="recipeSearchBiz" ref="recipeSearchBiz"/>
  520. <property name="ingredientDao" ref="ingredientDao"/>
  521. <property name="unitDao" ref="unitDao"/>
  522. <property name="systemDao" ref="systemDao"/>
  523. <property name="domainObjectFactory" ref="domainObjectFactory"/>
  524. <property name="importType" value="1"/>
  525. </bean>
  526. <bean id="recipeSearchValidator" class="magoffin.matt.ieat.validation.RecipeSearchValidator"/>
  527. <bean id="userValidator" class="magoffin.matt.ieat.validation.UserValidator"/>
  528. <!-- Job (periodic task) configuration -->
  529. <!--
  530. Job: cleanStaleRegistrationsJob
  531. Delete users that have registered but not confirmed that registration
  532. after a number of days. This is to clean out users that are not using
  533. the application.
  534. -->
  535. <bean id="cleanStaleRegistrationsJob"
  536. class="org.springframework.scheduling.quartz.JobDetailBean">
  537. <property name="jobClass">
  538. <value>magoffin.matt.ieat.task.RemoveStaleUserRegistrations</value>
  539. </property>
  540. <property name="jobDataAsMap">
  541. <map>
  542. <entry key="userDao"><ref bean="userDao"/></entry>
  543. <entry key="numDaysCutoff"><value>14</value></entry>
  544. </map>
  545. </property>
  546. </bean>
  547. <!--
  548. Trigger: cleanStaleRegistrationsTrigger
  549. Run the cleanStaleRegistrationsJob job every day early in the morning.
  550. -->
  551. <bean id="cleanStaleRegistrationsTrigger"
  552. class="org.springframework.scheduling.quartz.CronTriggerBean">
  553. <property name="jobDetail">
  554. <ref bean="cleanStaleRegistrationsJob"/>
  555. </property>
  556. <property name="cronExpression">
  557. <!-- run every morning at 2 AM -->
  558. <value>0 0 2 * * ?</value>
  559. </property>
  560. </bean>
  561. <!-- The job scheduler -->
  562. <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
  563. <property name="triggers">
  564. <list>
  565. <ref local="cleanStaleRegistrationsTrigger"/>
  566. </list>
  567. </property>
  568. </bean>
  569. <!-- RecipeIOBiz -->
  570. <bean id="recipeIOBiz" class="magoffin.matt.ieat.biz.impl.RecipeIOBizImpl" init-method="init">
  571. <property name="jaxbContext"><value>magoffin.matt.ieat.domain</value></property>
  572. <property name="domainObjectFactory"><ref bean="domainObjectFactory"/></property>
  573. <property name="messagesSource"><ref local="messageSource"/></property>
  574. <property name="cacheXslt"><value>${xslt.cache}</value></property>
  575. <property name="recipeMl2ieatStylesheet">
  576. <value>magoffin/matt/ieat/biz/impl/recipeml-to-ieat.xsl</value>
  577. </property>
  578. <property name="ieat2RecipeMlStylesheet">
  579. <value>magoffin/matt/ieat/biz/impl/ieat-to-recipeml.xsl</value>
  580. </property>
  581. <property name="ieat2TextStylesheet">
  582. <value>magoffin/matt/ieat/biz/impl/ieat-to-text.xsl</value>
  583. </property>
  584. <property name="emailRecipeMailMergeSupport">
  585. <bean class="magoffin.matt.ieat.util.MailMergeSupport">
  586. <property name="templatePath"><value>magoffin/matt/ieat/mailtemplates</value></property>
  587. <property name="templateName"><value>recipe.txt</value></property>
  588. <property name="mailSender"><ref bean="mailSender"/></property>
  589. <property name="messageTemplate"><ref local="mailMessage"/></property>
  590. <property name="messageSource"><ref local="messageSource"/></property>
  591. <property name="subjectMessageKey"><value>email-recipe.mail.subject</value></property>
  592. </bean>
  593. </property>
  594. </bean>
  595. <!-- DAO configuration elements -->
  596. <bean id="abstractHibernateDao" abstract="true">
  597. <property name="sessionFactory"><ref bean="mySessionFactory"/></property>
  598. </bean>
  599. <bean id="baseDao" class="magoffin.matt.ieat.dao.hbm.BaseDaoImpl"
  600. parent="abstractHibernateDao"/>
  601. <bean id="courseDao" class="magoffin.matt.ieat.dao.hbm.CourseDaoImpl"
  602. parent="abstractHibernateDao"/>
  603. <bean id="difficultyDao" class="magoffin.matt.ieat.dao.hbm.DifficultyDaoImpl"
  604. parent="abstractHibernateDao"/>
  605. <bean id="ethnicityDao" class="magoffin.matt.ieat.dao.hbm.EthnicityDaoImpl"
  606. parent="abstractHibernateDao"/>
  607. <bean id="ingredientDao" class="magoffin.matt.ieat.dao.hbm.IngredientDaoImpl" init-method="init"
  608. parent="abstractHibernateDao">
  609. <property name="jdbcTemplate"><ref bean="myJdbcTemplate"/></property>
  610. <property name="sqlIndexAll">
  611. <value>select ingredientid, ingr_name from ingredient order by ingredientid</value>
  612. </property>
  613. </bean>
  614. <bean id="mealDao" class="magoffin.matt.ieat.dao.hbm.MealDaoImpl"
  615. parent="abstractHibernateDao"/>
  616. <bean id="prepTimeDao" class="magoffin.matt.ieat.dao.hbm.PrepTimeDaoImpl"
  617. parent="abstractHibernateDao"/>
  618. <bean id="recipeDao" class="magoffin.matt.ieat.dao.hbm.RecipeDaoImpl" init-method="init"
  619. parent="abstractHibernateDao">
  620. <property name="jdbcTemplate"><ref bean="myJdbcTemplate"/></property>
  621. <property name="domainObjectFactory">
  622. <ref bean="domainObjectFactory"/>
  623. </property>
  624. <property name="sqlIndexAll">
  625. <!--
  626. SQL to index recipe data. This may produce duplicate rows, but must be
  627. in recipe ID order; must result in the following columns:
  628. 1: recipeId
  629. 2: name
  630. 3: excerpt
  631. 4: directions
  632. 5: step value (multi)
  633. 6: ingredient id (multi)
  634. 7: rating user id (multi)
  635. 8: rating (multi)
  636. 9: owner id
  637. -->
  638. <value>select r.recipeid, r.recipe_name, r.excerpt, r.directions, s.value_,
  639. i.ingredientid, rr.userid, rr.rating, r.ownerid from recipe r
  640. left outer join recipestep s on r.recipeid = s.recipeid
  641. left outer join recipeingredient i on r.recipeid = i.recipeid
  642. left outer join reciperating rr on r.recipeid = rr.recipeid
  643. order by r.recipeid, s.pos, i.pos</value>
  644. </property>
  645. <property name="sqlReassignBase">
  646. <!--
  647. SQL to reassign the base for a set of recipes.
  648. 1: new baseId
  649. 2: old baseId
  650. -->
  651. <value>update recipe set baseid = ? where baseid = ?</value>
  652. </property>
  653. <property name="sqlReassignCourse">
  654. <!--
  655. SQL to reassign the course for a set of recipes.
  656. 1: new courseId
  657. 2: old courseId
  658. -->
  659. <value>update recipe set courseid = ? where courseid = ?</value>
  660. </property>
  661. <property name="sqlReassignDifficulty">
  662. <!--
  663. SQL to reassign the difficulty for a set of recipes.
  664. 1: new difficultyId
  665. 2: old difficultyId
  666. -->
  667. <value>update recipe set difficultyid = ? where difficultyid = ?</value>
  668. </property>
  669. <property name="sqlReassignEthnicity">
  670. <!--
  671. SQL to reassign the ethnicity for a set of recipes.
  672. 1: new ethnicityId
  673. 2: old ethnicityId
  674. -->
  675. <value>update recipe set ethnicityid = ? where ethnicityid = ?</value>
  676. </property>
  677. <property name="sqlReassignIngredient">
  678. <!--
  679. SQL to reassign the ingredient for a set of recipes.
  680. 1: new ingredientId
  681. 2: old ingredientId
  682. -->
  683. <value>update recipeingredient set ingredientid = ? where ingredientid = ?</value>
  684. </property>
  685. <property name="sqlReassignPrepTime">
  686. <!--
  687. SQL to reassign the prepTime for a set of recipes.
  688. 1: new prepTimeId
  689. 2: old prepTimeId
  690. -->
  691. <value>update recipe set preptimeid = ? where preptimeid = ?</value>
  692. </property>
  693. </bean>
  694. <bean id="systemDao" class="magoffin.matt.ieat.dao.hbm.SystemDaoImpl"
  695. parent="abstractHibernateDao"/>
  696. <bean id="parameterDaoEnvironment"
  697. class="magoffin.matt.xweb.util.XwebJdbcParamDao">
  698. <property name="jdbcTemplate" ref="myJdbcTemplate"/>
  699. <property name="keyPrefix" value="env:"/>
  700. </bean>
  701. <bean id="unitDao" class="magoffin.matt.ieat.dao.hbm.UnitDaoImpl"
  702. parent="abstractHibernateDao">
  703. <property name="jdbcTemplate" ref="myJdbcTemplate"/>
  704. <property name="sqlIndexAll">
  705. <!--
  706. SQL to index unit table, must result in following columns:
  707. 1: unitId,
  708. 2: name (value)
  709. 3: abbreviation
  710. -->
  711. <value>select unitid, value_, abbreviation from unit order by unitid</value>
  712. </property>
  713. </bean>
  714. <bean id="userDao" class="magoffin.matt.ieat.dao.hbm.UserDaoImpl"
  715. parent="abstractHibernateDao">
  716. <property name="jdbcTemplate" ref="myJdbcTemplate"/>
  717. <property name="sqlIndexAll">
  718. <!--
  719. SQL to index user table, must result in following columns:
  720. 1: userId,
  721. 2: name
  722. 3: login
  723. 4: email
  724. 5: accessLevel
  725. 6: createdDate
  726. 7: lastLoginDate
  727. -->
  728. <value>select userid, user_name, login, email, accesslevel, createddate, lastlogindate
  729. from users order by userid</value>
  730. </property>
  731. </bean>
  732. </beans>