블로그 이미지
올해목표 // 10월 어학연수 떠나자~ 자수씨

카테고리

전체글 (1457)
Brand New! (28)
주절주절 (213)
MOT (11)
해외쇼핑 (49)
쇼핑노트 (150)
취미생활 (94)
iPhone (4)
Eclipse (121)
Google (83)
Spring (31)
JAVA (176)
JavaScript (59)
WEB (49)
Database (20)
OS (26)
Tools (8)
Tips (26)
IT정보 (1)
Book (21)
Programming (37)
외부행사 (43)
주변인들 (17)
여행노트 (60)
학교생활 (30)
회사생활 (52)
사회생활 (5)
외국어공부 (12)
잡동사니 (30)
Total
Today
Yesterday
 
04-20 21:22
 

달력

« » 2024.4
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
 

최근에 올라온 글

최근에 달린 댓글


Spring Roo 에서는 간단하게 "security setup" 명령으로 Spring Security 기본 설정을 추가할 수 있습니다.

기본적으로 admin 과 user 계정을 제공하고 "sha-256" 로 암호화된 패스워드를 제공합니다.
계정 추가가 필요할 때는 다음과 같은 작업을 통해서 가능합니다.


*nix 계열 서버에서 아래와 같은 명령어로 암호화된 패스워드를 생성할 수 있습니다.

# echo -n vicki | sha256sum
9f6646bd8c323f20de7538195709835dea9ab11108ea88326bdfaeb32cb2d9a4  -

위와 같이 "echo -n [패스워드] | sha256sum" 명령어를 입력하면 볼드체와 같이 암호화된 값을 확인할 수 있습니다.

생성된 패스워드를 이용하여 security 설정파일에 추가합니다.

/src/main/resources/META-INF/spring/applicationContext-security.xml



이제 /login 으로 접속하여 테스트 진행합니다.

Posted by 자수씨
, |

기본적으로 Spring Roo 는 UTF-8 의 인코딩 방식으로 데이터를 처리합니다.

"finder" 를 통해 검색 페이지를 추가하게 되면 GET 방식으로 데이터를 넘기는데, 인코딩 처리가 재대로 되지 않아 올바른 한글 검색 결과를 얻을 수 없습니다.

다음과 같은 방법으로 위의 문제를 해결합니다.

[WAS_HOME]/conf/server.xml


"Connector" 엘리먼트에 URIEncoding="UTF-8" 을 추가하여 다시 확인해보면 정상적으로 동작하는 것을 확인할 수 있습니다.


Posted by 자수씨
, |


1. SQLite 초기 설정

1.1 SQLiteDialect 추가

하이버네이트에서 사용할 SQLite Dialect 를 roo 프로젝트에 추가합니다.

/src/main/java/dialect/SQLiteDialect.java



1.2 Maven SQLite Dependency 추가

아래와 같이 pom.xml 에 SQLite dependency 를 추가합니다.

/pom.xml




2. SQLite 프로젝트 설정

2.1 JPA 설정

SQLiteDialect 를 사용하도록 아래와 같이 수정합니다.

/src/main/resources/META-INF/persistence.xml




DB 접속 정보를 설정합니다. 아래와 같이 database.url 에 DB 파일 위치를 설정할 수 있습니다.

/src/main/resources/META-INF/spring/database.properties



3. 프로젝트 실행

프로젝트를 Tomcat 이나 다른 WAS 를 통해 구동하게 되면 SQLite DB 파일이 생성되게 됩니다. 이 상태로 데이터를 조작하다가 다시 시작하게 되면 DB 가 초기화 되게 됩니다.

첫번째 프로젝트를 구동후에는 다음과 같이 설정을 해야 데이터가 유지되게 됩니다.

/src/main/resources/META-INF/persistence.xml




위에서 처럼 hibernate.hbm2ddl.auto 의 값을 "update" 로 변경하게 되면 현재 있는 DB 를 수정하게 됩니다. "create" 로 값이 설정되어 있으면 실행할 때 마다 새로운 DB 를 생성하게 됩니다. "validate" 는 정상적으로 동작을 하지 않는 것 같아... "update" 를 권장합니다.

Posted by 자수씨
, |



지금까지 Spring Roo 를 디버깅하기 위해 오랬동안 돌아왔습니다.
이제 그 결실을 맞보러~


Spring Roo addon 디버깅

1. 새로운 roo 프로젝트 생성

> roo-dev

Listening for transport dt_socket at address: 6889
    ____  ____  ____
   / __ \/ __ \/ __ \
  / /_/ / / / / / / /
 / _, _/ /_/ / /_/ /
/_/ |_|\____/\____/    1.1.5.RELEASE [rev d3a68c3]

Welcome to Spring Roo. For assistance press TAB or type "hint" then hit ENTER.
roo>

dt_socket 6889 번 포트로 리스닝 중이라는 멘트와 함께 Roo Shell 이 실행되었습니다.

아래의 roo script 를 이용하여 프로젝트를 구성합니다.

project --topLevelPackage kr.co.vicki.roo.sample.rentshop
persistence setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY
entity --class ~.domain.Car --testAutomatically
field string --fieldName modelName --notNull
field number --fieldName displacement --type java.lang.Integer --notNull 0
entity --class ~.domain.Customer --testAutomatically
field string --fieldName name --notNull
entity --class ~.domain.Rent --testAutomatically
field reference --fieldName car --type ~.domain.Car --notNull
field number --fieldName period --type java.lang.Integer --notNull 0



2. STS 디버깅 환경 설정

이전 포스트에서 설정한 포트를 이용하여 Remote Java Application 설정을 구성합니다.






3. Web MVC Controller Add-on 디버깅

프로젝트도 만들었고 디버깅할 수 있는 환경도 구성되었습니다.

org.springframework.roo.addon.web.mvc.controller 프로젝트의 아래 소스코드를 열어서 중단점을 설정합니다.
/org.springframework.roo.addon.web.mvc.controller/src/main/java/org/springframework/roo/addon/web/mvc/controller/ControllerOperationsImpl.java



위에서 구성하였던 Remote Java Application 를 실행합니다.


아래와 같이 roo 명령을 실행하면 STS 에서 디버깅이 가능합니다.

    ____  ____  ____
   / __ \/ __ \/ __ \

  / /_/ / / / / / / /
 / _, _/ /_/ / /_/ /
/_/ |_|\____/\____/    1.1.5.RELEASE [rev d3a68c3]


Welcome to Spring Roo. For assistance press TAB or type "hint" then hit ENTER.
roo> controller all --package ~.web


처음 디버깅 할 경우 source 에 대한 경로 설정이 되어 있지 않기 때문에 아래의 캡쳐 이미지를 참조하여 source 를 설정합니다.



이제~ Spring Roo Add-on 소스 중단 점을 디버깅 할 수 있게 되었습니다.




실제로 addon 을 개발하고 디버깅하는 것은 아니였지만, 제공되는 addon 을 디버깅 함으로써 flow 를 파악할 수 있게되었습니다.
후훗~





Posted by 자수씨
, |


Spring Roo 소스를 내려받아 이클립스 환경에서 개발이 가능하도록 빌드까지 완료하였습니다.

이제는 STS (SpringSource Tool Suite) 에 디버깅 환경을 구성하는 일이 남았습니다.



STS 에서 Spring Roo 디버깅 환경 구성

1. STS 다운로드 및 설치

아래 페이지에서 STS 를 다운로드 받습니다.
http://www.springsource.com/downloads/sts

installer 로 설치를 하면 무언가 찌꺼기가 남을 것 같아 압축파일을 받아 해당 압축을 푸는 것으로 설치를 완료합니다.



2. Spring Roo 소스 Import

STS 에서 Spring Roo 소스를 Import 합니다. (이전 포스트에서 eclipse:eclipse goal 로 메이븐 빌드를 수행하여 STS 에서 프로젝트로 인식이 가능합니다.)

File > Import > Existing Maven Projects
Root Directory: [Spring Roo Git Repository]

Root Directory 는 이전 포스트에서 내려받았던 Spring Roo 소스 경로를 설정해주시면 됩니다.



3. roo-dev 설정

Spring Roo 디버깅을 위해 roo-dev 를 이용하여 shell 을 띄울 수 있도록 설정을 합니다.

[Spring Roo Git Repository]\bootstrap\roo-dev.bat 수정

...
set REMOTE_DEBUG=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,address=6889,suspend=n
rem Hop, hop, hop...
java -Djline.nobell=true %ROO_OPTS% -Droo.args="%*" -DdevelopmentMode=true -Dorg.osgi.framework.storage="%ROO_HOME%\bootstrap\target\osgi\cache" -Dfelix.auto.deploy.dir="%ROO_HOME%\bootstrap\target\osgi\bundle" -Dfelix.config.properties="file:%ROO_HOME%\bootstrap\target\osgi\conf\config.properties" %REMOTE_DEBUG% -cp "%ROO_CP%" org.springframework.roo.bootstrap.Main
echo Roo exited with code %errorlevel%

디버깅 포트는 자기가 원하는 것으로 지정하면 됩니다. 저는 그냥 6889 로...


새로운 Roo 프로젝트 생성 시 roo-dev 를 이용하기 위해 아래와 같은 환경변수를 등록 및 수정을 합니다.

환경 변수 ROO_DEV_HOME 추가: [Spring Roo Git Repository]\bootstrap
PATH에 추가: %ROO_DEV_HOME%;



이제 개발환경 설정은 완료되었습니다. 재대로 이야기 하자면 디버깅 환경 구성이 완료되었습니다.

Posted by 자수씨
, |



Spring Roo 소스를 빌드하다 보니, gpg.exe 프로그램이 없다는 문제가 발생하였습니다.

gpg 는 GNU Privacy Guard 의 약자로 http://en.wikipedia.org/wiki/GNU_Privacy_Guard 에서 어떤 것인지를 확인하실 수 잇습니다.



GNU Privacy Guard 설치

1. Gpg4win 다운로드
http://gnupg.org/ 에서 OS 에 맞는 프로그램을 설치합니다.

개발환경이 윈도우기 때문에 gpg4win 프로그램을 다운로드 받습니다.
http://www.gpg4win.org/download.html

2011년 7월 24일 기준, Gpg4win 2.1.0 다운로드를 하였으며, gpg-key 만을 생성하는 것이기 때문에 light 버전으로도 가능합니다.


2. key-pair 생성

위에서 설치한 gpg 프로그램을 이용하여 key-pair 를 생성합니다.

C:\Program Files\GNU\GnuPG>gpg --gen-key
gpg (GnuPG) 2.0.17; Copyright (C) 2011 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Please select what kind of key you want:
   (1) RSA and RSA (default)
   (2) DSA and Elgamal
   (3) DSA (sign only)
   (4) RSA (sign only)
Your selection? 1
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048) 2048
Requested keysize is 2048 bits
Please specify how long the key should be valid.
         0 = key does not expire
      <n>  = key expires in n days
      <n>w = key expires in n weeks
      <n>m = key expires in n months
      <n>y = key expires in n years
Key is valid for? (0) 0
Key does not expire at all
Is this correct? (y/N) y
GnuPG needs to construct a user ID to identify your key.
Real name: Vicki Yi
Email address: vicki@*******
Comment: -_-;;;
You selected this USER-ID:
    "Vicki Yi (-_-;;;) <vicki@*******>"
Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O
You need a Passphrase to protect your secret key.
gpg: AllowSetForegroundWindow(6148) failed: 액세스가 거부되었습니다.
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
gpg: C:/Users/Administrator/AppData/Roaming/gnupg/trustdb.gpg: trustdb created
gpg: key D8F5138B marked as ultimately trusted
public and secret key created and signed.
gpg: checking the trustdb
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
pub   2048R/D8F5138B 2011-07-23
      Key fingerprint = **** **** **** **** ****  **** **** **** **** ****
uid                  Vicki Yi (-_-;;;) <vicki@*******>
sub   2048R/ED2C781B 2011-07-23

C:\Program Files\GNU\GnuPG>


중간에 key-pair 비밀번호 입력하는 창이 나옵니다. 적절한 암호를 입력합니다.


3. Maven 빌드 3차

pgp 설치도 끝났고, key-pair 도 생성했으니, 다시 Spring Roo 소스를 빌드합니다.

> mvn clean install eclipse:clean eclipse:eclipse

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Spring Roo ........................................ SUCCESS [1.044s]
[INFO] Spring Roo - Deployment Support ................... SUCCESS [0.236s]
[INFO] Spring Roo - OSGi Bundle Module Parent ............ SUCCESS [1.970s]
[INFO] Spring Roo - OSGi Roo Bundle Module Parent ........ SUCCESS [0.512s]
[INFO] Spring Roo - Bootstrap ............................ SUCCESS [2.451s]
[INFO] Spring Roo - OSGi Start Level Control ............. SUCCESS [1.893s]
[INFO] Spring Roo - Support .............................. SUCCESS [2.678s]
[INFO] Spring Roo - Support for OSGi Features ............ SUCCESS [1.695s]
[INFO] Spring Roo - URL Stream API Contract .............. SUCCESS [1.489s]
[INFO] Spring Roo - Shell ................................ SUCCESS [2.571s]
[INFO] Spring Roo - Shell (OSGi Launcher) ................ SUCCESS [2.257s]
[INFO] Spring Roo - URL Stream - JDK ..................... SUCCESS [1.846s]
[INFO] Spring Roo - Shell - JLine ........................ SUCCESS [2.027s]
[INFO] Spring Roo - Shell - JLine (OSGi Launcher) ........ SUCCESS [1.612s]
[INFO] Spring Roo - Metadata ............................. SUCCESS [2.249s]
[INFO] Spring Roo - User Agent Analysis (UAA) Integration  SUCCESS [1.924s]
[INFO] Spring Roo - Felix Interoperability ............... SUCCESS [2.522s]
[INFO] Spring Roo - Model ................................ SUCCESS [2.215s]
[INFO] Spring Roo - File Undo ............................ SUCCESS [1.650s]
[INFO] Spring Roo - File Monitor ......................... SUCCESS [1.786s]
[INFO] Spring Roo - File Monitor - Polling ............... SUCCESS [1.618s]
[INFO] Spring Roo - File Monitor - Polling (Roo Launcher)  SUCCESS [1.521s]
[INFO] Spring Roo - Process Manager ...................... SUCCESS [2.276s]
[INFO] Spring Roo - Project .............................. SUCCESS [2.675s]
[INFO] Spring Roo - Classpath ............................ SUCCESS [4.070s]
[INFO] Spring Roo - Classpath (JavaParser Implementation)  SUCCESS [2.328s]
[INFO] Spring Roo - Addon - toString ..................... SUCCESS [2.235s]
[INFO] Spring Roo - Addon - JavaBean Method Manager ...... SUCCESS [1.939s]
[INFO] Spring Roo - Addon - Plural Details ............... SUCCESS [2.198s]
[INFO] Spring Roo - Addon - Property Files ............... SUCCESS [1.761s]
[INFO] Spring Roo - Addon - @Configurable Support ........ SUCCESS [2.113s]
[INFO] Spring Roo - Addon - Email ........................ SUCCESS [2.147s]
[INFO] Spring Roo - Addon - JPA .......................... SUCCESS [2.465s]
[INFO] Spring Roo - Addon - JMS .......................... SUCCESS [1.927s]
[INFO] Spring Roo - Addon - Test Data On Demand .......... SUCCESS [2.639s]
[INFO] Spring Roo - Addon - Automated Integration Testing  SUCCESS [2.189s]
[INFO] Spring Roo - Addon - Serializable ................. SUCCESS [2.300s]
[INFO] Spring Roo - Addon - Entity ....................... SUCCESS [2.448s]
[INFO] Spring Roo - Addon - Finder ....................... SUCCESS [2.746s]
[INFO] Spring Roo - Addon - Logging ...................... SUCCESS [1.813s]
[INFO] Spring Roo - Addon - Property Editor .............. SUCCESS [1.945s]
[INFO] Spring Roo - Addon - Backup ....................... SUCCESS [2.351s]
[INFO] Spring Roo - Addon - JSON ......................... SUCCESS [2.122s]
[INFO] Spring Roo - Addon - Web MVC Controller ........... SUCCESS [4.669s]
[INFO] Spring Roo - Addon - Web MVC JSP View ............. SUCCESS [3.836s]
[INFO] Spring Roo - Addon - Web MVC Embedded Extensions .. SUCCESS [3.839s]
[INFO] Spring Roo - Addon - Spring Security .............. SUCCESS [2.066s]
[INFO] Spring Roo - Addon - Solr ......................... SUCCESS [3.471s]
[INFO] Spring Roo - Addon - Web - Flow ................... SUCCESS [2.180s]
[INFO] Spring Roo - Addon - Web Selenium Test Generator .. SUCCESS [2.708s]
[INFO] Spring Roo - Addon - Google Web Toolkit ........... SUCCESS [7.913s]
[INFO] Spring Roo - Addon - JDBC Driver Acquisition ...... SUCCESS [2.183s]
[INFO] Spring Roo - Addon - Database Reverse Engineering . SUCCESS [3.592s]
[INFO] Spring Roo - Addon - Creator ...................... SUCCESS [2.083s]
[INFO] Spring Roo - Addon - RooBot Client ................ SUCCESS [2.402s]
[INFO] Spring Roo - Addon - Op4J ......................... SUCCESS [2.341s]
[INFO] Spring Roo - Addon - GIT .......................... SUCCESS [15.080s]
[INFO] Spring Roo - Addon - Cloud Foundry ................ SUCCESS [41.389s]
[INFO] Spring Roo - Annotations (ASLv2/GPLv3 Dual Licensed)  SUCCESS [2.483s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3:11.783s
[INFO] Finished at: Sun Jul 24 01:27:22 KST 2011
[INFO] Final Memory: 147M/247M
[INFO] ------------------------------------------------------------------------


중간에 key-pair 생성 시 입력했던 비빌번호를 입력하는 창이 나옵니다. 혹시 해당 입력 창에 아무것도 입력이 되지 않는다면 아래 페이지를 참고하시기 바랍니다.
http://edin.no-ip.com/blog/hswong3i/cant-type-anything-pinentry-exe

  1. Go to C:\Program Files\GNU\GnuPG
  2. Backup pinentry.exe as pinentry.exe.orig
  3. Copy pinentry-w32.exe as pinentry.exe
  4. Test with Thunderbird, done!!





정상적으로 빌드가 완료되었습니다~~

Posted by 자수씨
, |


지난 포스트에서 Spring Roo 소스를 내려받았습니다. Spring Roo 소스는 메이븐 환경으로 구성되어 있습니다.

Maven 빌드를 통해 이클립스에서 개발이 가능하도록 구성을 진행합니다.


Maven 빌드

1. Maven 빌드
기존에 사용하던 메이븐을 이용하여 Spring Roo 소스를 빌드를 합니다.

> mvn clean install eclipse:clean eclipse:eclipse

[WARNING] Rule 1: org.apache.maven.plugins.enforcer.RequireMavenVersion failed w
ith message:
Detected Maven Version: 2.2.1 is not in the allowed range 3.0.1.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Some Enforcer rules have failed. Look above for specific messages explain
ing why the rule failed.
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15 seconds
[INFO] Finished at: Sun Jul 24 00:45:23 KST 2011
[INFO] Final Memory: 26M/63M
[INFO] ------------------------------------------------------------------------



Spring Roo 는 메이븐 3.0.1 버전 이상이어야만 빌드가 가능한가 봅니다.


2. Maven (3.0.1 버전 이상) 설치
메이븐 프로젝트 페이지에서 최신버전을 다운로드 받습니다.
http://maven.apache.org/download.html

다운로드 받는 Maven 의 압축을 풀고 환경변수 MAVEN_HOME 을 지정합니다.


3. Maven 빌드 2차
새로 설치한 메이븐을 이용하여 Spring Roo 소스를 다시 빌드합니다.

> mvn clean install eclipse:clean eclipse:eclipse

'gpg.exe'은(는) 내부 또는 외부 명령, 실행할 수 있는 프로그램, 또는
배치 파일이 아닙니다.



뭐든 한번에 쭈욱 되지는 않나 봅니다;;;


Posted by 자수씨
, |



Spring Roo addon 을 개발하려고 여러가지 방법을 강구하였으나, 레퍼런스도 많이 없고 해서 직접 디버깅이 가능한 환경을 구성해서 확인을 하려고 합니다. 하지만 Roo Shell 자체가 OSGi 환경인지라... 간단하게 되지는 않았습니다.



Spring Roo 소스를 내려 받기

1. GIT 설치하기
Spring Roo 는 GIT 로 버전관리를 하고 있었습니다. 기존에 GIT 이 설치되어 있지 않다면 GIT 을 설치합니다.

윈도우 환경 기준으로 손쉽게 설치할 수 있는 msysGit 을 설치하였습니다.

msysGit: http://code.google.com/p/msysgit/downloads/list

2011년 7월 24일 기준, Git-1.7.6-preview20110708.exe 파일을 다운로드 후 실행

설치 중에 "Adjusting your PATH environment" 에서 "Run Git from the Windows Command Propmt" 를 선택해야지만 커맨드 창에서 git 을 바로 사용할 수 있음. 선택하지 않으면 별도로 PATH 를 지정해주어야 합니다.


2. 소스 체크아웃
소스 저장소에서 Spring Roo 소스를 내려받습니다. (소스 저장소가 github 로 이관되었습니다.)
> git clone git://git.springsource.org/roo/roo.git
> git clone https://github.com/SpringSource/spring-roo.git
 

원하는 버전을 체크아웃 받습니다. (2011년 7월 24일 기준, 1.1.5.RELEASE 가 최신 릴리즈 버전이라서...)
> cd spring-roo
> git checkout 1.1.5.RELEASE



Posted by 자수씨
, |



Spring Roo 는 i18n 을 제공합니다.

자동으로 생성되는 웹 페이지에 대해서도 다국어 설정이 가능합니다.

지난 포스트에서 생성했던 프로젝트를 이용하여 다국어 설정을 해보도록 하겠습니다.


RentShop 프로젝트에서 Roo Shell 을 실행시킵니다.

스페인어를 추가하려면 아래와 같은 명령을 통해 가능합니다.
roo> web mvc install language --code es


다시 톰캣을 실행시켜 확인해보니, 아래 스페인 국기가 새로 추가되고 해당 국기를 누르면 스페인어로 변경이 됩니다.




그렇다면 한국어로도 가능하다는 이야기!!

roo> web mvc install language --code ko
Could not parse language code

위와 같이 명령어를 치면 언어 코드를 파싱할 수 없다고 합니다.


한국어를 지원하기 위해서는 해당 기능을 제공하는 Spring Roo addon 을 생성해야 합니다.


이 작업을 하기 전에 famfamfam 에서 태극기 아이콘을 내려받고, RentShop 프로젝트의 아래 경로에 있는 messages.properties 를 번역하여 message_ko.properties 를 준비합니다.
(/RentShop/src/main/webapp/WEB-INF/i18n/messages.properties)

한국어 addon 을 위한 프로젝트의 디렉토리를 생성하고 Roo Shell 을 실행시킵니다.
messages_ko.properties 파일과 kr.png 파일을 프로젝트 상위 디렉토리에 위치시킨후 addon 을 생성시키고 해당 작업이 완료되면 packaging 을 진행합니다.

roo> addon create i18n --topLevelPackage kr.co.vicki.roo.addon.i18n --locale ko --messageBundle ../messages_ko.properties --flagGraphic ../kr.png
roo> perform package



Spring Roo addon 은 OSGi 번들로 결과물이 나오게 되는데 해당 번들을 install 시켜 사용이 가능하도록 합니다.
(Roo Shell 에서 osgi ps 명령으로 해당 번들의 상태 확인이 가능합니다.)

roo> osgi start --url file:///D:/temp/roo/i18n/target/kr.co.vicki.roo.addon.i18n-0.1.0.BUILD-SNAPSHOT.jar
roo> osgi ps
START LEVEL 99
   ID   State         Level  Name
...
[  66] [Active     ] [    1] kr-co-vicki-roo-addon-i18n (0.1.0.BUILD-SNAPSHOT)



이제 다시 한국어에 대한 다국어를 추가합니다.

roo> web mvc install language --code ko




어색한 번역이지만 잘나옵니다. 호호홋








Posted by 자수씨
, |


Spring Roo~ 작년에 봤을 때는 듣보잡처럼 보였는데, 지금 보니깐 감동의 물결이 넘실거립니다.

설치에 대해서는 튜토리얼을 보면 되기 때문에 나중에 정리할 여유가 생기면 하기로 하고... 지금은 설치가 된 상태를 가정하여 작성합니다.

구동 환경
Spring Roo 1.1.4 RELEASE
Maven 2.2.1.RELEASE
STS 2.7.0 RELEASE (필수는 아님)


새로운 프로젝트 디렉토리를 생성하고 roo shell 을 실행시킵니다.
# mkdir RentShop
# cd RentShop
# roo

roo>



프로젝트를 생성합니다. 프로젝트 생성 시에는 최상위 패키지를 지정해야 합니다.
roo> project --topLevelPackage kr.co.vicki.roo.sample.rentshop


퍼시스턴스 레이어를 설정합니다. 프로바이더는 하이버네이트로, 데이터베이스는 테스트 용이므로 메모리 DB를 사용합니다.
roo> persistence setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY


엔티티 클래스를 생성합니다. Car, Customer, Rent
roo> entity --class ~.domain.Car --testAutomatically
roo> field string --fieldName modelName --notNull
roo> field number --fieldName displacement --type java.lang.Integer --notNull 0
roo> entity --class ~.domain.Customer --testAutomatically
roo> field string --fieldName name --notNull
roo> entity --class ~.domain.Rent --testAutomatically
roo> field reference --fieldName car --type ~.domain.Car --notNull
roo> field number --fieldName period --type java.lang.Integer --notNull 0


컨트롤러를 생성합니다. 패키지를 지정가능합니다. 위에 엔티티 생성시에도 나왔던 '~' 는 프로젝트 생성 시 지정했던 topLevelPackage 를 의미합니다.
roo> controller all --package ~.web



이걸로 간단한 샘플 프로젝트는 끝이 났습니다. 톰캣을 띄워 확인합니다.
# mvn tomcat:run

....
2011. 7. 13 오전 1:03:51 org.apache.catalina.startup.Embedded start
정보: Starting tomcat server
2011. 7. 13 오전 1:03:51 org.apache.catalina.core.StandardEngine start
정보: Starting Servlet Engine: Apache Tomcat/6.0.29
2011. 7. 13 오전 1:03:51 org.apache.catalina.core.ApplicationContext log
정보: Initializing Spring root WebApplicationContext
2011. 7. 13 오전 1:03:53 org.apache.catalina.core.ApplicationContext log
정보: Initializing Spring FrameworkServlet 'RentShop'
2011. 7. 13 오전 1:03:53 org.apache.coyote.http11.Http11Protocol init
정보: Initializing Coyote HTTP/1.1 on http-8080
2011. 7. 13 오전 1:03:53 org.apache.coyote.http11.Http11Protocol start
정보: Starting Coyote HTTP/1.1 on http-8080



위에 보이는 컨텍스트를 확인하여 생성된 프로젝트에 접속을 합니다.
http://localhost:8080/RentShop





먼가 투박해보이기는 하지만 CRUD 페이지가 뚝딱 만들어졌습니다.

아직 진가를 보여주기에는 부족해보이지만 실제로 Spring Roo 를 어딘가에 적용할지를 생각한다면... WOW 입니다~


Posted by 자수씨
, |

글 보관함

최근에 받은 트랙백