æ°ä»ãããSeasarã®ã話
ãªãã ãæè¿ã«ãªã£ã¦ããããããåå¹´ãããã§ãããããSeasarã¯ã©ããªã®ï¼ãã£ã¦è©±ãããããã¡ãããããããã«ãªãã¾ããã
ããã¾ã§ã¯ãSeasarèªä½ã¯åºç¤ã®åºç¤ã®åå°ã¿ãããªãã®ã§ããããã Seasar èªä½ã®è©±ããããã¨ã¯éã«ãªãã£ããã§ãããããã«æ¥ã¦ Seasar ã®è©±ã£ã¦ãªãã ãæ°é®®ã§ã^^ã
ãããããã 9 å¹´ãããåãã Seasar ã使ã£ã¦ã¾ãããã使ã£ã¦ãã¾ããããä»ã§ã使ãã¾ããSeasarã«ã³ãã¡ã§ãããããç»å£ããã¦é ãã¾ããããé·ãä»ãåã£ã¦ã¾ãã®ã§ãSeasarã«å人çãªæããããã¾ããããã¯ã¾ãä»åº¦ãå¥ã¨ã³ããªã§æ¸ãã¾ãããã
ããã ãã«ããã¯ã Seasar ã®ãã¨ãèããããã¨ãå¤ãç«å ´ã§ã¯ããã¾ãã(ã¼ã㯠Seasar æ¬ä½ã®ã³ããã¿ã§ã¯ããã¾ããã...)
ã¾ããSpring Framework ã JavaEE ã¨å³å¯ã«æ¯ã¹ãããã§ã¯ãªããè²ã èãã¦ãã¨ããã絶対çåªä½ã¯ãªã!? ã¨ãããããã£ããé¢ããã¦ãé¨åãå¤ãã ããã¨æ³åã¯ããã®ã§ãã...(Seasarèªä½ã¯é·ããã¨ç¹ã«å¤åã¯ãã¦ããªãã§ãããã)
ãã®å®ç¸¾ããã決ãã¦æªããã®ã§ã¯ãªããã¨ã¯ããããã£ã¦ãã¦ããSeasar使ããã£ã¦äººãããã°ããããããããããªããã£ã¦æãã§ã¯ããã¾ãã
...
...
ãã ããã ããã ã£ããã¼ã ã確ãã«ããã¼ãèããã¨ã
ãããã¨ç´ ç´ã«ã¯ä½¿ã£ã¦ãªããªãã
ã¨ããã¨ãããããã®ã§ãææ¾ãã§ããããï¼ãã«ã¯ãªããªãã®ããã¨ã
ã ãããã¡ãã£ã¨æ´çããªãã¨ããªã¼ã£ã¦ã
DBå¨ãã¯...
Seasarã使ãã¨ã使ããªãã£ã¦è©±ãããã¨ãã¯ããã®ä¸ã§åããå¨è¾ºãã¬ã¼ã ã¯ã¼ã¯ã®ã話ããSeasarã®è©±ãããã¨ãã«ã¯æé»ã«å«ã¾ãããã¨ã
主ã«ã¯ãO/Rãããã¼ã«Webãã¬ã¼ã ã¯ã¼ã¯ã
ã¾ããDBå¨ãã
ãããã¾ããããã jflute ã§ããã^^ã
DBFluteã§ããã¾ãã§ãã...ããã¾ããm(_ _)mã
å¥ã«ã¼ãã主å°ããããã¸ã§ã¯ãã ãã§ãªããå¨ãã®ããã¸ã§ã¯ãã§ã©ãã©ã使ã£ã¦ããã¦ããã®ã§ã(.NET ã§ã DBFlute 使ã£ã¦ãã)
ä»ã®ç¾å ´ã§ããSpring ã ããã Seasar ã ãããããã®è¾ºã¯è²ã ã¨ãã¬ãã¨ãã¦ããã©ã¡ãã«ããDBå¨ãã¯DBFluteã使ã£ã¦é ãã¦ãã¾ãã
ãªã®ã§å®ã¯...å®ã¯...9å¹´ããã£ãã®ã«...DBå¨ãã¯ãç´ ã®S2Daoããã£ã¦ãªãããS2JDBCãã¾ã¨ãã«ã¯ä½¿ã£ããã¨ãªãã®ã§ãã¼ï¼ï¼ï¼ã(ã¾ãããã£ã¡ãåå¼·ã¯ãããã使ã£ã¦ã人ã®è©±ã¯ããããèãããã©ã)
ã¨ããããåå¼·ããããããããããã S2Dao (ã ã) ã§ã¯ã¤ããã ããã¨èãã¦ãS2Dao ãæ¡å¼µãå§ã㦠DBFlute ã«ãªã£ã¦ããã¾ããã(ãã¾ã S2Dao ã«ã¯éä¾å)
S2JDBCãå ã«åºã¦ããçµå±ã¯ããããã¨æ¡å¼µãã¦ããDBFluteã£ã½ãããã¡ãã£ã¦ãããç¥ãã¾ãããç¬ã
Webå¨ãã¯...
ããã¦ãWebå¨ãã
Teedaããã使ã£ã¦ãããã§ããã©ã
ãã®å¾ãæ代ã¯ãã£ãã SAStruts ã«ãªãã¾ããã
ã§ããããã¾ãä½æ°ã«ç´ ã®ã¾ã¾ã§ä½¿ã£ããã¨ããªã...ã§ãããã¡ããå¨ãã§ã¯ããã¨ä½¿ããã¦ããã®ã§è²ã ã¨è©±ã«ã¯èãã¦ã¦ãããã¦ããã身è¿ãªã¨ããã§ä½¿ãã¨ãªãã¾ããã£ãããã§ã£ï¼
...
...
ãããç¥ã人ãç¥ããSAFluteã
-> SAFlute | DBFlute
é£ã³æãããã¨ã¯ãã£ã¦ãªãã§ãããSAStrutsãç´ ã®ã¾ã¾ä½¿ããããã¯ãã¯ããã«è¯ãæãã«ããã¤ããã(ç¾å ´ããã®è©å¤ã¯ã¨ã¦ãè¯ãã§ã)
ãã¡ãããæ¬å½ã¯ Teeda ã¨ã Ymir ã¨ãã®é«æ©è½ãªæ©è½ãåãè¾¼ãã ãããããã Struts ä¾åããããããªã¨ãããã¾ãããã¨ããããã¯å¤§ããªä¸æºãªãéçºã¯ã§ããããã«ãªã£ããã¨ã(ã¨ãããä½ããã£ããjfluteãããã«ç´ãã¡ããã®ã§)
Seasarã®ä½¿ãæ¹ã¨ããé¢ã§ã¯...
ãã¦ãSeasarèªä½ã®ã話ã
o Dxo ã BeanUtil ã¯çµ¶å¯¾ã«ä½¿ããªã
o Dtoã¯DI対象ã«ããªã
o ã¹ãã¼ããããã¤ã¨ãã¿ãªãã®ãåãã
o Interceptorãããã¾ã使ããªã
o S2Unitã使ã£ã¦ãªã...
o S2ClassBuilderã¯çµ¶å¯¾ã«ä½¿ã
o diconã«ã³ã³ãã£ã°å¤ãåãè¾¼ã¾ãªã
o S2DBCPã¯ããããï¼ã
o actionããã±ã¼ã¸ã¯ä½¿ãããwebããã±ã¼ã¸ã«
o ãã£ã¼ã«ãã®é è½ã¯ Eclipse ã§ã¨ã©ã¼ã«
Dxo ã BeanUtil ã¯çµ¶å¯¾ã«ä½¿ããªã
ããã¯åºãå½åãããã絶対ã«ãã¡ã¼ãã¨æã£ã¦ã¦ç¾å ´ã«ä¸»å¼µãç¶ãããã©ãããã¯æåã¯ãªããªãåãå ¥ãããã¾ããã§ããã(ãã¯ããç®ã®åã®ï¼åã®åç´ä½æ¥ã®çç¥ã®èªæã¯å¼·ãã£ã)
ã§ãã使ã£ã¦ãããã¸ã§ã¯ãã¯ä½ããããå¿ ããããã§ãã©ãã£ã¦ãä»ã§ã¯å°ãªãã¨ãjfluteã®å¨ãã§ã¯ä½¿ã£ã¦ã人ã¯è¦ãããªãã
ããªã㧠Dxo ã ããªãã ï¼ãããããªããï¼ãã£ã¦è¨ã£ã¦ã人ã...ãããã¯ãã¡ã ãããããã®ã¯ãã¡ã§ãããã£ã¦ç¬ãæåããã ãåè«ãã¦ãã®ã«ã¼^^ãã¾ãããã£ãããã£ãã
ãã®ãã¿ã¼ã³ããããã¸ã§ã¯ããä¼ç¤¾ãã¾ããã§ä½åº¦ããã£ã¦ãè¡ãã¨ãè¡ãã¨ãã§jfluteã¯åããã¨ãè¨ãç¶ãã¦ããæãã§ãã
æè¿ã§ã¯ãDBFluteã®ããã¥ã¡ã³ãã§ç大ã«ãã¡ã ã¨è¨ã£ã¦ã¾ã^^ã
-> Entityã¨DTOã¨ã®è©°ãæ¿ãã¯å°éã« | DBFlute
Dtoã¯DI対象ã«ããªã
Dto ã¯èªå㧠new ãã¾ãããããªå¼·ããã£ããããããããããªãã§ããããã®æ¹ããããããããã!? ãããã
ãªã®ã§ãDtoCreatorã¯å¿ ãå¤ãã¾ããã¨ãããããããã Dto ã£ã¦ååèªä½ããã¾ã使ããªãããªãä½ã«å¯¾ãã transfer ãªã®ããã¯ã£ããããªãã£ã¦ãDtoããããæã«æ°¾æ¿«ããã®ã§ãã¬ã¤ã¤ãã¨ã«ã¡ãã£ã¨éã£ãæå³ãæããããã¨ããã¾ããã
ã¹ãã¼ããããã¤ã¨ãã¿ãªãã®ãåãã
ã¹ãã¼ããããã¤ç®¡çããã³ã³ãã¼ãã³ãã®ããã±ã¼ã¸ã¨ããããããªãã³ã³ãã¼ãã³ãã®ããã±ã¼ã¸ãæ確ã«åãã¾ãã(ãããããªã: ãã¿ã«diconã«ç»é²ããã³ã³ãã¼ãã³ã)
æåã¯ãåãã«ãã¡ãã£ã¦ãã¾ãããå¥ã«ãã¡ãã£ã¦ãå¹³æ°ã¯å¹³æ°ãªãã§ããã©ããªãã ã LinkageError ã ClassCastException ãèµ·ãã¦...HotDeploy ãã¨ããã¨ãã«å¹ããªããªã£ãã...(ãã®ã¨ãã¯ããã« Tomcat åèµ·åã£ã¦æ¡ä»¶åå°ã®ããã«)
NamingConventionã§å³å¯ã«Ignoreè¨å®ããã°OKãªã®ããã§ãããæ··å¨ãã¦ãã¨ã§ãããã©ããã¦ãã¹ãã¼ãå¤ããã¹ãã¼ããªã¯ã©ã¹ãåç §ããã¦ãã¾ãã®ã§ãããããã¯åãã¡ãã£ãæ¹ãä¸è©±ãªãã
ããã§ãäºæ ããããªãããã§ã¯ãªãã§ãããæ確ã«ãç»é¢ããã¸ãã¯ã®ããã°ã©ã ã¨ãæ¥åç¬èªã®ãã¬ã¼ã ã¯ã¼ã¯(å ±éé¨å)ãåãããã¨ã§ãHotDeployãã©ãã«ã¯ã»ã¨ãã©ãªããªãã¾ããã
ãããããã¨ã§ãSeasarã®å¼·ã¿ã§ãã HotDeploy ããã£ããã¨äº«åã§ããããã«ãããã¯ãããã£ã±ãããããã§ãããããã¯ã
Interceptorãããã¾ã使ããªã
ã¾ããActionã¯ã©ã¹ã«é¢ãã¦ã¯ã£ã¦æãã§ããã
ActionCallback ã§ä»£æ¿ãã¾ãã
-> SAFlute - ActionCallback
Interceptorã¯ç¢ºãã«ä¾¿å©ã§ãããªã®ã§ãã®åãInterceptorå°çãããè¦ãããã®ã§ã(StackTraceãã¨ã¦ã追ãã¥ããã)
ãã¨ãã¢ããã¼ã·ã§ã³è¦ç´æ¹å¼ã® Interceptor ã使ãã¾ããããã ã§ãããããã«ãã Interceptor ãªã®ã§ãããã¯diconã§æ示çãªæ¹ãããããããããªã£ã¦ã
S2Unitã使ã£ã¦ãªã
ããããUTFluteã£ã¦ããã¢ãã¯ãªãã¤ä½¿ã£ã¦ã¾ãããã
-> UTFluteã§ãããã | jfluteã®æ¥è¨
ãã¡ãããUTFlute 㯠S2Unit ããã³ãã«ããã¦é ãã¦ãã¾ãããã®ä¸ã§ã以ä¸ã®ãããªæãã® UnitTest ã©ã¤ããéããããã«ã
o ãã¹ããã¼ã¿ã¯ãReplaceSchemaã§ãããããç¨æãã
-> ãã¹ãã±ã¼ã¹ç®¡çã®ã¨ã¯ã»ã«ã§ãã¼ã¿ã¯ä½ããªã
-> ãã¹ãã±ã¼ã¹ãã¨ã«ãã¼ã¿ç»é²ããã¨ãã¹ãããããé
ã
-> DBå¤æ´æã®ãã¼ã¿ä¿®æ£éãå端ãããªã
o DIã³ã³ããã®ã¤ã³ã¹ã¿ã³ã¹ã¯ãJUnitèµ·ååä½ã§ãã£ãã·ã¥
-> ãã¹ãã±ã¼ã¹ãã¨ã«èµ·åããã¨ãã¹ãããããé
ã
-> ãã¹ããã¼ã¿ã®ä¸å
åã¨åãããã¨ããããéãå®è¡ã§ãã
o newããã¤ã³ã¹ã¿ã³ã¹ã«DIãã§ããããã«ãã¦ãã
-> ããã¯ã¾ããUTFluteã®ãã¼ã¸ãèªãã§
UTFluteãä½ã£ãã®ã¯ãããªã«æã§ã¯ãªãã®ã§ããã®æ㯠S2Unit 使ã£ã¦ãã¾ããããè²ã ã¨ããã¥ããã¨ããããã£ã¦ããã¤ããã¤ãæ¡å¼µãçµå±ããã¼ã㨠UTFlute ã«ãªã£ãã¨ããæãã§ãã
S2ClassBuilderã¯çµ¶å¯¾ã«ä½¿ã
ããç¡ãã§ã¯ãSeasar使ããã¨ã¯æããªããããã®åå¨æã
-> S2ClassBuilder | DBFlute
ãEclipseããã¸ã§ã¯ããä¸ã¤ã ããã®ããã¸ã§ã¯ããªãã¦ãå®åã®ã¢ããªéçºã§ã¯æ» å¤ã«ããã¾ããã
ãã¬ã¼ã ã¯ã¼ã¯ã®æ¡å¼µã«ãããæ¥åã®å ±édiconã®æ¡å¼µã«ãããdiconã³ãã¼æ¡å¼µã¯çµ¶å¯¾ã«ãããããªããã®ã§ãã(ã¨ããããSpring Frameworkã«ã欲ãããã ãã©ããªãã®ããª!?)
ãã ãSeasaræ¬ä½ã«ã¯çµã¿è¾¼ã¾ãã¦ããªãã®ã§ãæ示çã«ã使ããã¨ããªãã¨ããã¾ããããã¾ã®ç¾å ´ã®ããã¸ã§ã¯ãã§ã¯ãå¿ ã使ã£ã¦ãã¾ããã¨ããããSAFluteã¯ããã使ããã¨ãåæã«ãã¦ãã¾ãã
diconã«ã³ã³ãã£ã°å¤ãåãè¾¼ã¾ãªã
ããã絶対ã«ããã¾ãããSAFluteã§ã¯ãjdbc.diconãããããã¼ã«ã«ã»çµåã»æ¬çªã§åããã£ã¦ãããããªãã¨ã¯ãã¦ã¾ãããdiconã®ç°å¢ãã¨ã³ãã¼ã¯çµ¶å¯¾ã«ããªãã
10å以ä¸ã®diconããã¼ã«ã«ã»çµåã»æ¬çªã§åããã¦ãã¦ããã®ããã管çããã¥ããã£ã¦ã®ãè¦ããã¨ãããã®ã§ã
diconãè¨å®ãã¡ã¤ã«ã¨ã¯æã£ã¦ãªããã§ãããããã³ã³ãã¼ãã³ãã®çæã¨ä¾åé¢ä¿ã®ãã¸ãã¯ãã ã¨ãããããã¾ãã¾ XML ã«ãªã£ã¦ããã ããã ããããããã³ãã¼ããã£ã¦ããã®ã¯ãã¸ãã¯ãã³ãã¼ããã®ã¨åãã
ã³ã³ãã£ã°å¤ãä½ãå¤ãã£ã¦ãªãã®ã«ãæ¬çªdiconãä¿®æ£ããªãã¨ãããªããªãã¦çµ¶å¯¾ã«ããã§ãããã¾ããç´åãã¦ããã¾ãã¿ãããªéçºã ã¨å¥ã«ããã§ãããç¶ç¶çéçºã®ç¾å ´ã ã¨ã絶対ã«ï¼ã§ããã
S2DBCPã¯ããããï¼ã
å³å¯ã«ä»ã®DBCPã¨æ¯ã¹ããããããªãã§ããããã©ã³ã¶ã¯ã·ã§ã³å¨ããããã©ã«ãã§æ´åããã¦ã¦ããã£ãã使ãã¦éç¨ãåé¡ãªããã£ã¦ããã£ã¦ããã®ã¯ãããã¯ããã§ãããããªã£ã¦ã
å人çã«ã¯ãããã®é¨åã®ã½ã¼ã¹ãèªãã®ã¯æ¥½ãã^^
actionããã±ã¼ã¸ã¯ä½¿ãããwebããã±ã¼ã¸ã«
SAStrutsã®ã話ã§ã¯ããã¾ãããActionã¯ã©ã¹ãactionããã±ã¼ã¸ã«ãFormã¯ã©ã¹ãformããã±ã¼ã¸ã«ã
ã§ã¯ãªãï¼
webããã±ã¼ã¸ã«ãActionãFormãå ¥ãã¾ããç»é¢è¡¨ç¤ºç¨Bean(Dto)ããValidatorããä¸ã¤ã®ç»é¢ã§å¿ è¦ãªã¯ã©ã¹ãéã¾ã£ã¦ããæ¹ã管çãããããã®ã§ã
ç»é¢ä¾åããªãLogicã¯ã©ã¹ã¨ãã ããlogicããã±ã¼ã¸ã¨ãã«é ç½®ãã¾ãã
ãã£ã¼ã«ãã®é è½ã¯ Eclipse ã§ã¨ã©ã¼ã«
DIã³ã³ãã¼ãã³ãã®ãã£ã¼ã«ãã®é è½ãããã¨ãã¹ã¼ãã¼ã¯ã©ã¹ã®é è½ããããã£ã¼ã«ãã«ã¯DIãããªããªã£ã¦ãã¾ãã¨ããäºæ ãããã¾ãããããEclipseã®è¨å®ã§ã¨ã©ã¼ã«ãã¡ãã£ã¦ãã¾ãã
ã©ã使ã£ããããããªï¼
ããã¨æãã¤ããã®ã ãããµãµã£ã¨æ¸ãã¦ã¿ã¾ããã...
...
...
ãã£ãç´ ç´ãããªãã§ãã^^
ã¨ããæãã§ãé·ãçµé¨ã®ä¸ã§å¹ããã¦ããã
ãSeasarãªãããããã風ã«ä½¿ãããªãã
ã£ã¦æãã®ç¬èªã®ããæ¹ããã£ã¦ãSeasarã®ãã¼ã¸ãæ¬ã¨ãã§ç´¹ä»ããããªã¼ã½ããã¯ã¹ãªæ¹æ³ãDolteng ã§ä½ãããæ§æãªã©ãå®ã¯ä½¿ã£ããã¨ããªãã§ãã
ããããã®ã¾ã¾ä½ããããªã¼ã½ããã¯ã¹ãªã¾ã¾ã ã£ãããå°ãªãã¨ãã¼ããçµé¨ãã¦ããç¾å ´ã¨åãæ©ã¿ãæã¤ç¾å ´ãªãããã®éãã®æ©ã¿ãçºçããã ããã¨æ³åãã¦ãã¾ãã
ããèããã¨ã人ã«ãSeasarã¯ã©ããªã®ï¼ãã£ã¦èããã¦ããã®æ¹æ³è«çãªã¨ãããä¼ããã«ããããï¼ãã¨ã¯ããªããªãè¨ããç«å ´ã§ã¯ãªãã®ããã§ããã
ãã ãSeasarã¯ã¨ã¦ãè¯ããåå°ãã«ãªã£ã¦ãã¾ãããå°ãªãã¨ããå®è£ ã®éããããã¦ãå¤åã¸ã®èæ§ãããããæ±ããããç¶ç¶çéçºã®ç¾å ´ã§ã¯ã
...
...
ã©ã¡ããã¨ããã¨ã
ãã©ã使ã£ããããããªï¼ã
ã£ã¦ãã話ã®æ¹ããããããã^^ã