'98..Etc'에 해당되는 글 370건

  1. 2009.02.25 Tortoise SVN 사용법
  2. 2009.02.24 윈도우에서 Subversion 서버 운영하기
  3. 2009.02.24 SVN 간단 설치법
  4. 2009.02.23 GlassFish + 이클립스 설정기 - Missing classpath entry \lib\appserv-rt.jar
  5. 2009.02.23 GlassFish Project - v2.1 FinalBuild
  6. 2009.02.23 glassfish
  7. 2009.02.11 [Velocity] [번역중.. ] Developer's Guide
  8. 2009.02.09 전 세계 실시간 TV보기 & CCTV 보기
  9. 2009.01.30 아파치 + 리눅스 + 톰켓 설치
  10. 2009.01.30 톰캣 DB connection 관련 Server.xml/Web.xml 설정
  11. 2009.01.29 내가 가진 도메인을 이용하여 독립적인 이 메일주소를 만들어 보자.
  12. 2009.01.29 php 배우기
  13. 2009.01.29 Apache Load balancing && Terracotta Sessions Clustering
  14. 2009.01.28 리눅스 쉘 스크립트
  15. 2009.01.28 고급 Bash 스크립팅 가이드
  16. 2009.01.28 Weblogic 8.1에서 Production mode 설정
  17. 2009.01.28 Weblogic에서 DataSource로 디비(DB) 연결하기
  18. 2009.01.28 리다이렉트 방식에 대해서.....
  19. 2009.01.23 velocity로 java 문법 사용하기
  20. 2009.01.23 [velocity] 총 정리
  21. 2009.01.23 Velocity란 무엇인가?
  22. 2009.01.23 Eclipse Plug-In : Velocity WebEditor 설치 방법
  23. 2009.01.23 JSTL과 Velocity를 활용한 UI 레이어 구현 방법
  24. 2009.01.23 velocity 문법 간단 정리 1
  25. 2009.01.19 웹관련 Tool들...
  26. 2009.01.15 Concurrent Versions System (cvs) 1
  27. 2009.01.15 Eclipse 3.2.2 download...
  28. 2009.01.15 windows 7 설치 후...
  29. 2009.01.08 PostBooks ERP, accounting, CRM by xTuple
  30. 2009.01.08 Customizing Openbravo ERP look and feel
98..Etc/SVN2009. 2. 25. 00:25
반응형

Tortoise SVN 사용법

이 글은 Tortoise SVN(거북이 SVN)에 대한 간단한 매뉴얼로써 활용될 수 있습니다. 설치부터 시작해 체크아웃, 갱신 등의 전반적인 사용법까지 다루겠습니다.

SVN 이란?

SVN이란 버전관리 시스템의 하나입니다. 여기서 버전 관리 시스템이란 구성원들간의 프로젝트 소스 코드의 공유, 버전 관리(옛날 버전의 소스 코드를 조회 가능함) 그리고 소스 코드의 백업 등의 용도로 사용되는 시스템을 말하며 CVS와 SVN 등이 잘 알려져 있습니다.
참고 : Tong - Zard님의 Eclipse통

Tortoise SVN이란?

SVN을 제공하는 오픈 소스의 강력한 버전 관리 툴입니다.

설치
1.
Tortoise SVN 홈페이지(http://tortoisesvn.net/)에 접속합니다.

사용자 삽입 이미지

http://tortoisesvn.net/

2. 좌측의 메뉴 중 Download에 접근해 Current Version을 확인합니다.
사용자 삽입 이미지

The current version 1.4.3.

3. 그 아래의 Download Application에서 자신의 운영 플랫폼에 맞는 것을 찾아 클릭합니다.
사용자 삽입 이미지

Download Application.

4. 설치 파일을 다운로드 받습니다.
사용자 삽입 이미지

사용자 삽입 이미지

다운로드 완료.

5. 다운로드 받은 설치 파일을 실행시킵니다.

사용자 삽입 이미지

거북이 SVN 설치 시작.

6. 라이센스에 관한 설명을 확인한 후 동의 하신다면 위쪽 라디오 버튼을 선택하고 NEXT 버튼을 클릭합니다.

사용자 삽입 이미지

라이센스 설명.

7. 설치 요소와 설치 경로를 설정한 후 NEXT 버튼을 누릅니다. (그냥 기본값에서  NEXT 버튼을 클릭해도 상관 없습니다.)

사용자 삽입 이미지

설치 요소 선택/경로 변경

8. 설정한 인스톨 옵션에 이상이 없다면 INSTALL 버튼을 클릭합니다.

사용자 삽입 이미지

설치 전 마지막 확인.

9. 설치를 완료한 후 FINISH 버튼을 누릅니다.
사용자 삽입 이미지

설치 중.

사용자 삽입 이미지

설치 완료.

10. 시스템을 재시작 합니다.

사용자 삽입 이미지

재시작을 한다.

11. 마찬가지로 Tortoise SVN 홈페이지 다운로드 메뉴의 하단에 위치한 Languages packs에서 Korean 언어 팩을 찾아 설치합니다.

사용자 삽입 이미지

언어팩 설치 완료.

12. 설치를 확인합니다.

사용자 삽입 이미지

설치 확인.

13. 이제 부터 언어 설정을 한국어로 설정합니다. 설치가 완료되었다면 마우스 오른쪽 버튼을 클릭하였을 시 나오는 팝업 메뉴에 관련 메뉴가 추가되어 있을 것입니다. 일단, 이 중에서 TortoiseSVN -> Settings를 클릭해 보십시오.

사용자 삽입 이미지

Settings.

14. 일반 탭에 위치한 Language 설정을 한국어로 선택하고 확인을 누릅니다.

사용자 삽입 이미지
15. 바르게 설정이 되었는지 확인합니다.

사용자 삽입 이미지

한글화된 메뉴


Tortoise SVN 사용법 - 체크아웃

Tortoise SVN 사용법

이 글은 Tortoise SVN(거북이 SVN)에 대한 간단한 매뉴얼로써 활용될 수 있습니다. 설치부터 시작해 체크아웃, 갱신 등의 전반적인 사용법까지 다루겠습니다.

체크아웃이란?

SVN은 특정한 '저장소(Repository)'에 기록된 정보들을 통해 소스 코드의 버전을 관리합니다. 이 체크아웃이라는 것은 이러한 '저장소'에 접근해 소스 코드와 버전관리를 위한 파일들을 받아 오는 행위를 의미합니다.

체크아웃을 하는 방법

1.
체크아웃받을 폴더를 새로 하나 생성합니다.

사용자 삽입 이미지

I4 Studio

2. 생성된 폴더를 연 후에 그 안에서 마우스 오른쪽 버튼을 클릭해봅니다.

사용자 삽입 이미지

마우스 오른쪽 버튼.

3. 보이는 메뉴들 중 SVN 체크아웃(K)를 찾아 클릭합니다.

사용자 삽입 이미지

체크아웃.

4. '저장소 URL :'라벨 바로 밑에 위치한 입력폼에 'svn://(저장소 주소)'를 입력합니다.

사용자 삽입 이미지

svn://svn.i4studio.net/

5. 입력이 완료되었다면 확인을 눌러봅니다. 해당 저장소에 접근을 하는데 인증정보가 필요하다면 아래와 같은 대화상자가 뜹니다.

사용자 삽입 이미지

인증 대화상자

6. 사용자명과 암호를 입력하신 후 확인을 누릅니다. 일반적으로 체크아웃시 인증 절차가 필요하다면 대부분의 다른 동작에서도 인증 절차가 필요합니다. 반복적인 작업을 피하기 위해 인증 정보의 저장을 원하시는 경우엔 인증 정보 저장 체크박스를 체크합니다.

사용자 삽입 이미지

인증 정보.

7. 성공적으로 인증 절차가 끝났다면 아래와 같은 상태가 됩니다. 만약 그렇지 않고 오류창 따위가 뜬다면 서버 관리자에게 문의하여 봅니다.

사용자 삽입 이미지

체크아웃 완료.

8. 위의 창에서 확인 버튼을 누르고 1번에서 생성한 폴더의 상태를 확인해봅니다. 폴더 아이콘의 위로 초록색의 체크 아이콘이 추가된 것을 볼 수 있습니다. 그 다음 폴더의 내용을 확인해봅시다. 접근한 저장소에 공유된 파일이 있었다면 빈 폴더에 여러가지 폴더/파일들이 생성된 것을 볼 수 있습니다.

사용자 삽입 이미지

초록색 체크 아이콘.

사용자 삽입 이미지

추가된 폴더/파일.

Posted by 1010
98..Etc/SVN2009. 2. 24. 23:59
반응형
Posted by 1010
98..Etc/SVN2009. 2. 24. 23:52
반응형
Posted by 1010
98..Etc/GlassFish2009. 2. 23. 14:17
반응형
회사에서 GlassFish 를 다운받고 서버쪽에 GlassFish 를 추가했는데 안나오는 겁니다.
(플러그인이 재대로 설치가 안된 듯...)
https://glassfishplugins.dev.java.net/download/index.html << 여기서 플러그인을 다운받습니다.

일단 집에서와 비슷한 환경으로 설치를 하였습니다.... 만 WTP 에서 Server 설정을 하려 하는데
아래와 같은 화면이 반겨주었습니다.

Missing classpath entry ~~\appserv-rt.jar


GlassFish 설치경로에 lib 폴더를 가보았더니 appserv-rt.jar 파일은 없고 appserv-rt.jar.pack.gz 이런 파일만 있었습니다.
gz 파일인지 알고 압축을 풀어도 안되고... 찾아보니 pack.gz 라는 압축방식인가 그런가 봅니다.
역시 구글링을 해본 결과... setup 을 덜 한 것 같았습니다.

사람들이 말하는대로 lib\ant\bin\ant -f setup.xml 명령을 해주면....
먼가 설치가 쫘르르르르 진행됩니다.


다시 이클립스에서 서버를 설정하면.... 일단은 다음 단계로 넘어갈 수 있다는 것이지요..

GlassFish 삽질기는 계속됩니다....

[참고자료]
GlassFish 플러그인 - https://glassfishplugins.dev.java.net/download/index.html
GlassFish Plugins Forum Thread - http://forums.java.net/jive/thread.jspa?threadID=38230&tstart=0
Posted by 1010
98..Etc/GlassFish2009. 2. 23. 14:07
반응형
GlassFish Project - v2.1 FinalBuild
(also known as v2.1 b60e Promoted Build)

| New to GlassFish | FAQ |Resources | GlassFish Project Home | How-Tos |

This promoted build provides necessary infrastructure support for the SailFin Application Server (Telco app server). This release also contains fixes that did not make it into GlassFish V2 Update Release. Please refer to the GlassFish V2.1 Wiki Page for details on improvements that are going into this release. Note: Multilingual support available for French, German, Spanish, Japanese, Simplified Chinese, Traditional Chinese, and Korean.

Promoted builds are weekly builds of GlassFish which have passed a minimum level of testing which includes the quicklook tests, a sub-set of CTS tests (representative collection of 344 J2EE 1.4 tests) and a sub-set of SQE tests (22 in number). A build is not promoted unless it passes all quicklook, CTS smoke and SQE smoke tests. 

Note: This list offers files for different platforms. Please be sure to select the proper file for your platform. Carefully review the files listed below to select the one you want, then click the link to download.  Some browsers may require you to right-click/CTRL-click to save these files to your computer.

The majority of the GlassFish code is available under a dual license consisting of the Common Development and Distribution License ( CDDL) v1.0 and the GNU General Public License (GPL) v2.  The following page contains details about the components in GlassFish and the licenses under which they are covered.

Instructions to unbundle and configure GlassFish

To install and configure GlassFish you need to have JDK 5 or JDK 6 installed on your system. The configuration processing depends on Ant (1.6.5).  The bundle includes an Ant distribution that has been extended with tasks to facilitate developing Java EE 5 applications for the application server.

  1. Download one of the bundles to disk, set JAVA_HOME to the JDK you have installed on your system.
  2. Run:
       % java -Xmx256m -jar filename.jar
    This command will unbundle GlassFish and create a new directory structure rooted under a directory named 'glassfish'.
  3.  % cd glassfish
  4. If you are using a machine with an operating system that is a derivative of UNIX(tm), set the execute permission for the Ant binaries that are included with the GlassFish bundle.
    	% chmod -R +x lib/ant/bin
    	% lib/ant/bin/ant -f setup.xml 
    OR for Windows:
    	% lib\ant\bin\ant -f setup.xml 

For GlassFish V2 UR1 with Clustering supported installation, just change step 4 from the above installation

% lib/ant/bin/ant -f setup-cluster.xml 
OR  for Windows:
% lib\ant\bin\ant -f setup-cluster.xml 

To get started with GlassFish, see the quick start guide.

See Configuring the Cluster/Load Balancer with GlassFish V2 for how to do the load balancing after creating Clusters on GlassFish V2.

Binary builds

The Open Sourcing Clustering features are included in this promotion.

Solaris SPARC Platform

Solaris x86 Platform

Windows Platform

Linux Platform

MacOS Platform

AIX Platform


Source bundle


Source code for GlassFish is available in the bundle below. Some technologies are developed in other projects and only a binary version is available in the GlassFish project source tree. To find more information on where to find sources see this page.

Build Information

Bugs fixed in this build. 
Posted by 1010
98..Etc/GlassFish2009. 2. 23. 14:04
반응형
Glassfish는 J2EE 5를 따르는 오픈소스 애플리케이션 서버를 말한다.
참고로 J2EE 5 는
-JavaServer Pages(JSP) 2.1
-JavaServer Faces(JSF) 1.2
-Servlet 2.5
-Enterprise JavaBeans 3.0
-Java API for Web Services(JAX-WS) 2.0
-Java Architecture for XML Binding(JAXB) 2.0
-Web Services Metadata for the Java Platform 1.0
라는 여러 표준의 버젼을 따른다.

다운로드는 아래의 링크에서 맘에 드는 버젼으로 선택한다.
https://glassfish.dev.java.net/public/downloadsindex.html

Glassfish 설치하기
Jar를 다운로드 했다면, jar파일이 있는 위치에서 다음의 명령어를 친다.
java -Xmx256m -jar jar파일명
그러면 동의하라는 반 강제적 화면이 나타나고,
스크롤을 아래로 주루룩 내린 후 동의를 하면,
파일들의 압축이 풀릴것이다.


Glassfish를 설치하고 나서 가장 황당했던것이, bin 디렉토리에 아무것도 실행파일이 없다는 것이다.

관련 문서도 눌러 보면 Glassfish에 대한 문서가 아니라, Sun Java System Application Server 에 대한 문서고... - -;

Glassfish의 압축을 푼 root 디렉토리를 보면 setup.xml과 setup-cluster.xml 두개의 파일이 존재한다.
클러스터 구성할 것이 아니라면 setup.xml을 사용하면 된다.

Ant를 이용하여 설치하기
그래서, 가장 먼저 ant를 설치해야 한다. (그런데 친절하게도 glassfish\lib\ant 디렉토리가 포함되어 있으며, 여기의 실행파일을 사용해도 된다.)
ant의 bin 디렉토리를 갖고 있는 장비의 path에 등록을 하고,
setup.xml 파일이 있는 위치에서 다음의 명령을 수행한다.
ant -buildfile setup.xml

아니면 귀찮으면 다음과 같이 해도 된다.

lib\ant\bin\ant -f setup.xml

그러면 아래와 같은 결과가 떨어지면서 필요한 파일들이 생성된다.

아래의 내용을 펼치면 된다. ^^;

내용 닫기

D:\glassfish>ant -buildfile setup.xml
Buildfile: setup.xml

all:

get.java.home:

setup.init:

check-java:

get.java.home:

setup.init:

validate-java:
     [echo] Current Java Version 1.6.0_11

get.java.home:

setup.init:

glassfish-jarunpack:
     [echo] Applying UnPack200 on Packed jars using JDK1.5
     [echo] D:\glassfish/lib/Pack200Task.jar

get.java.home:

setup.init:

nonmac-jarunpack:

jarpack-tasks:

jar-unpack:
[unpack200] Unpacking with Unpack200
[unpack200] Source File :D:\glassfish\lib\appserv-ext.jar.pack.gz
[unpack200] Dest.  File :D:\glassfish\lib\appserv-ext.jar
   [delete] Deleting: D:\glassfish\lib\appserv-ext.jar.pack.gz

jarpack-tasks:

jar-unpack:
[unpack200] Unpacking with Unpack200
[unpack200] Source File :D:\glassfish\lib\toplink-essentials.jar.pack.gz
[unpack200] Dest.  File :D:\glassfish\lib\toplink-essentials.jar
   [delete] Deleting: D:\glassfish\lib\toplink-essentials.jar.pack.gz

jarpack-tasks:

jar-unpack:
[unpack200] Unpacking with Unpack200
[unpack200] Source File :D:\glassfish\lib\appserv-rt.jar.pack.gz
[unpack200] Dest.  File :D:\glassfish\lib\appserv-rt.jar
   [delete] Deleting: D:\glassfish\lib\appserv-rt.jar.pack.gz

jarpack-tasks:

jar-unpack:
[unpack200] Unpacking with Unpack200
[unpack200] Source File :D:\glassfish\lib\appserv-cmp.jar.pack.gz
[unpack200] Dest.  File :D:\glassfish\lib\appserv-cmp.jar
   [delete] Deleting: D:\glassfish\lib\appserv-cmp.jar.pack.gz

jarpack-tasks:

jar-unpack:
[unpack200] Unpacking with Unpack200
[unpack200] Source File :D:\glassfish\lib\appserv-jstl.jar.pack.gz
[unpack200] Dest.  File :D:\glassfish\lib\appserv-jstl.jar
   [delete] Deleting: D:\glassfish\lib\appserv-jstl.jar.pack.gz

jarpack-tasks:

jar-unpack:
[unpack200] Unpacking with Unpack200
[unpack200] Source File :D:\glassfish\lib\appserv-tags.jar.pack.gz
[unpack200] Dest.  File :D:\glassfish\lib\appserv-tags.jar
   [delete] Deleting: D:\glassfish\lib\appserv-tags.jar.pack.gz

jarpack-tasks:

jar-unpack:
[unpack200] Unpacking with Unpack200
[unpack200] Source File :D:\glassfish\lib\endorsed\activation.jar.pack.gz
[unpack200] Dest.  File :D:\glassfish\lib\endorsed\activation.jar
   [delete] Deleting: D:\glassfish\lib\endorsed\activation.jar.pack.gz

jarpack-tasks:

jar-unpack:
[unpack200] Unpacking with Unpack200
[unpack200] Source File :D:\glassfish\lib\endorsed\webservices-api.jar.pack.gz
[unpack200] Dest.  File :D:\glassfish\lib\endorsed\webservices-api.jar
   [delete] Deleting: D:\glassfish\lib\endorsed\webservices-api.jar.pack.gz

jarpack-tasks:

jar-unpack:
[unpack200] Unpacking with Unpack200
[unpack200] Source File :D:\glassfish\lib\webservices-rt.jar.pack.gz
[unpack200] Dest.  File :D:\glassfish\lib\webservices-rt.jar
   [delete] Deleting: D:\glassfish\lib\webservices-rt.jar.pack.gz

jarpack-tasks:

jar-unpack:
[unpack200] Unpacking with Unpack200
[unpack200] Source File :D:\glassfish\lib\webservices-tools.jar.pack.gz
[unpack200] Dest.  File :D:\glassfish\lib\webservices-tools.jar
   [delete] Deleting: D:\glassfish\lib\webservices-tools.jar.pack.gz

jarpack-tasks:

jar-unpack:
[unpack200] Unpacking with Unpack200
[unpack200] Source File :D:\glassfish\lib\com-sun-commons-launcher.jar.pack.gz
[unpack200] Dest.  File :D:\glassfish\lib\com-sun-commons-launcher.jar
   [delete] Deleting: D:\glassfish\lib\com-sun-commons-launcher.jar.pack.gz

jarpack-tasks:

jar-unpack:
[unpack200] Unpacking with Unpack200
[unpack200] Source File :D:\glassfish\lib\j2ee-svc.jar.pack.gz
[unpack200] Dest.  File :D:\glassfish\lib\j2ee-svc.jar
   [delete] Deleting: D:\glassfish\lib\j2ee-svc.jar.pack.gz

jarpack-tasks:

jar-unpack:
[unpack200] Unpacking with Unpack200
[unpack200] Source File :D:\glassfish\lib\jsf-impl.jar.pack.gz
[unpack200] Dest.  File :D:\glassfish\lib\jsf-impl.jar
   [delete] Deleting: D:\glassfish\lib\jsf-impl.jar.pack.gz

jarpack-tasks:

jar-unpack:
[unpack200] Unpacking with Unpack200
[unpack200] Source File :D:\glassfish\lib\sun-appserv-ant.jar.pack.gz
[unpack200] Dest.  File :D:\glassfish\lib\sun-appserv-ant.jar
   [delete] Deleting: D:\glassfish\lib\sun-appserv-ant.jar.pack.gz

jarpack-tasks:

jar-unpack:
[unpack200] Unpacking with Unpack200
[unpack200] Source File :D:\glassfish\lib\javaee.jar.pack.gz
[unpack200] Dest.  File :D:\glassfish\lib\javaee.jar
   [delete] Deleting: D:\glassfish\lib\javaee.jar.pack.gz

jarpack-tasks:

jar-unpack:
[unpack200] Unpacking with Unpack200
[unpack200] Source File :D:\glassfish\lib\appserv-admin.jar.pack.gz
[unpack200] Dest.  File :D:\glassfish\lib\appserv-admin.jar
   [delete] Deleting: D:\glassfish\lib\appserv-admin.jar.pack.gz

jarpack-tasks:

jar-unpack:
[unpack200] Unpacking with Unpack200
[unpack200] Source File :D:\glassfish\lib\admin-cli.jar.pack.gz
[unpack200] Dest.  File :D:\glassfish\lib\admin-cli.jar
   [delete] Deleting: D:\glassfish\lib\admin-cli.jar.pack.gz

jarpack-tasks:

jar-unpack:
[unpack200] Unpacking with Unpack200
[unpack200] Source File :D:\glassfish\lib\appserv-deployment-client.jar.pack.gz
[unpack200] Dest.  File :D:\glassfish\lib\appserv-deployment-client.jar
   [delete] Deleting: D:\glassfish\lib\appserv-deployment-client.jar.pack.gz

jarpack-tasks:

jar-unpack:
[unpack200] Unpacking with Unpack200
[unpack200] Source File :D:\glassfish\lib\appserv-se.jar.pack.gz
[unpack200] Dest.  File :D:\glassfish\lib\appserv-se.jar
   [delete] Deleting: D:\glassfish\lib\appserv-se.jar.pack.gz

jarpack-tasks:

jar-unpack:
[unpack200] Unpacking with Unpack200
[unpack200] Source File :D:\glassfish\lib\admin-cli-ee.jar.pack.gz
[unpack200] Dest.  File :D:\glassfish\lib\admin-cli-ee.jar
   [delete] Deleting: D:\glassfish\lib\admin-cli-ee.jar.pack.gz

get.java.home:

setup.init:

-do.copy.common:
     [copy] Copying 1 file to D:\glassfish\config

do.copy.windows:
     [copy] Copying 1 file to D:\glassfish\config
     [copy] Copying 1 file to D:\glassfish\bin
     [copy] Copying 1 file to D:\glassfish\bin
     [copy] Copying 1 file to D:\glassfish\bin
     [copy] Copying 1 file to D:\glassfish\bin
     [copy] Copying 1 file to D:\glassfish\bin
     [copy] Copying 1 file to D:\glassfish\bin
     [copy] Copying 1 file to D:\glassfish\bin
     [copy] Copying 1 file to D:\glassfish\bin
     [copy] Copying 1 file to D:\glassfish\bin
     [copy] Copying 1 file to D:\glassfish\bin
     [copy] Copying 1 file to D:\glassfish\bin
     [copy] Copying 1 file to D:\glassfish\bin
     [copy] Copying 1 file to D:\glassfish\bin
     [copy] Copying 1 file to D:\glassfish\bin
     [copy] Copying 1 file to D:\glassfish\bin
     [copy] Copying 1 file to D:\glassfish\bin
     [copy] Copying 1 file to D:\glassfish\updatecenter\bin

do.copy.unix:

do.copy:

get.java.home:

setup.init:

-do.tokenrep.common:

do.token.windows:

do.token.unix:

do.token.jdic.windows:

do.token.jdic.solaris-sparc:

do.token.jdic.solaris-x86:

do.token.jdic.linux:

do.token.jdic.mac:

do.token.jdic:

do.token.enable.uc:

do.token:

get.java.home:

setup.init:

do.chmod.unix:

do.chmod:

create-local-registry:

setup.reg:
     [echo] Creating the service registry file..
     [java] From Local service registry  ..

get.java.home:

setup.init:

set.env.win:

set.env.unix:

set.env:

create.domain:
     [exec] 포트 4848을(를) Admin에 대해 사용합니다.
     [exec] 포트 8080을(를) HTTP Instance에 대해 사용합니다.
     [exec] 포트 7676을(를) JMS에 대해 사용합니다.
     [exec] 포트 3700을(를) IIOP에 대해 사용합니다.
     [exec] 포트 8181을(를) HTTP_SSL에 대해 사용합니다.
     [exec] 기본 포트 3820을(를) IIOP_SSL에 대해 사용합니다.
     [exec] 기본 포트 3920을(를) IIOP_MUTUALAUTH에 대해 사용합니다.
     [exec] 기본 포트 8686을(를) JMX_ADMIN에 대해 사용합니다.
     [exec] 프로필을 사용하여 도메인을 만드는 중입니다: developer(구성 파일의 변
수 AS_ADMIN_PROFILE로에 지정)
     [exec] 지정된 로켈[ko_KR]의 파일을 [D:\glassfish\lib\install\templates\loca
les\ko_KR\index.html]에서 찾지 못했습니다. 대신 기본 (en_US) index.html을 사용합
니다.
     [exec] 보안 저장소 사용: JKS
     [exec] 도메인 domain1이(가) 만들어졌습니다.
     [exec] 이 도메인 [domain1]의 관리자 이름 [admin]에 관련된 로그인 정보를 [C:
\Documents and Settings\smlee\.asadminpass]에 성공적으로 저장했습니다.
     [exec] 이 파일은 계속 보호되어야 합니다. 이 파일에 저장된 정보는 asadmin 명
령에서 이 도메인을 관리하는 데 사용됩니다.
   [delete] Deleting: D:\glassfish\passfile

BUILD SUCCESSFUL
Total time: 29 seconds
D:\glassfish>



ant 스크립트를 수행한 이후에 몇가지 설정을 마치면 서버를 기동할 수 있다.

http://docs.sun.com/app/docs/doc/819-3193/aboaa?a=view

링크를 보면 몇몇가지 설정할 게 있으니 참조하기 바란다.
간단하게 정리하면(윈도우용)
1. bin 디렉토리를 path에 추가
2. AS_ADMIN_USER 라는 것을 환경 변수에 추가하고, 설치할때의 PC나 서버 계정을 추가한다.

서버를 다음의 명령어로 시작할 수 있다.

asadmin start-domain domain1


정상적으로 수행되었다면 다음과 같은 메시지가 나타난다.

도메인 domain1을(를) 시작합니다. 잠시 기다려 주십시오.
로그가 D:\glassfish\domains\domain1\logs\server.log(으)로 리디렉션되었습니다.
마스터 비밀번호를 입력하십시오>
출력을 D:/glassfish/domains/domain1/logs/server.log(으)로 리디렉션하는 중
도메인 domain1에서 클라이언트 요청을 받을 준비가 되었습니다. 백그라운드에서 추가
 서비스를 시작하는 중입니다.
다음에서 해당 구성 및 로그를 사용하여 도메인 [domain1]이(가) [Sun Java System Ap
plication Server 9.1_02 (build b04-fcs)]을(를) 실행하는 중입니다: [D:\glassfish\
domains].
관리 콘솔은 [http://localhost:4848]에서 사용할 수 있습니다.
"asadmin" 명령에도 같은 포트 [4848]을(를) 사용합니다.
사용자 웹 응용 프로그램은 다음 URL에서 사용할 수 있습니다:
[http://localhost:8080 https://localhost:8181 ].
다음 웹 내용을 사용할 수 있습니다:
[/web1  /__wstx-services ].
표준 JMX 클라이언트(예, JConsole)는 도메인 관리를 위해 JMXServiceURL:
[service:jmx:rmi:///jndi/rmi://smlee:8686/jmxrmi]에 연결될 수 있습니다.
도메인은 최소한 다음 포트에서 연결을 수신합니다:
[8080 8181 4848 3700 3820 3920 8686 ].
도메인이 Application Server 클러스터 및 다른 독립 실행형 인스턴스를 지원하지 않
습니다.


설치시 유의사항
서버를 수행할때 리눅스는 상관 없겠지만,
PC 이름이 한글일 경우 서버가 정상적으로 뜨지 않을 수 있다.
이 경우 domain1/logs 디렉토리의 server.log 파일에 다음과 같은 메시지가 나타난다.

com.sun.appserv.server.ServerLifecycleException
 at com.sun.enterprise.admin.server.core.JmxConnectorLifecycle.onStartup(JmxConnectorLifecycle.java:153)
 at com.sun.enterprise.server.ApplicationServer.onStartup(ApplicationServer.java:442)
 at com.sun.enterprise.server.ondemand.OnDemandServer.onStartup(OnDemandServer.java:120)
 at com.sun.enterprise.server.PEMain.run(PEMain.java:411)
 at com.sun.enterprise.server.PEMain.main(PEMain.java:338)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at com.sun.enterprise.server.PELaunch.main(PELaunch.java:412)
Caused by: java.lang.NullPointerException
 at javax.management.remote.JMXConnectorServerFactory.newJMXConnectorServer(JMXConnectorServerFactory.java:283)
 at com.sun.enterprise.admin.jmx.remote.server.rmi.JmxConnectorServerDriver.startConnectorServer(JmxConnectorServerDriver.java:215)
 at com.sun.enterprise.admin.server.core.JmxConnectorLifecycle.onStartup(JmxConnectorLifecycle.java:134)
 ... 9 more
Posted by 1010
98..Etc/velocity2009. 2. 11. 18:33
반응형

소개


Velocity는 Java기반의 템플릿 엔진이고, 개발자가 쉽게 생성하고, 그 형식의 문서를 만들 수 있고, 사용자의 데이터를 보여줄 수 있도록 지원하는 간단하고 강력한 개발 도구입니다. 이 가이드에서는 Velocity를 사용한 개발의 기본 개요에 대해서 설명해 갑니다. 그리고, Velocity의 사용법을 위해 2개의 주요한 사용법에 초점을 맞힙니다. :


  • Servlet 베이스 WWW 개발
  • 일반적인 애플리케이션에서의 사용

    Velocity를 사용해 당신의 Servelt에서 클래스에 기반한 VelocityServlet 클래스를 사용해 매우 쉽게 Servlet을 개발하는 것과

    역할에서는 유틸리티 클래스를 사용해 애플리케이션 개발을 하는 것에 관하여, 여러분은 이들 사이에 본질적인 차이는 없다는 것을 알게될 것입니다.


    시작에 앞서

     

    이 정보는 Velocity 사이트와 문서의 어느 다른 곳에서 찾아내질지도 모릅니다만, 그것은 완전하게 여기에 포함되고 있습니다. Velocity를 여러분의 컴퓨터에서 실행하는 것은, 매우 간단합니다. 모든 디렉토리에서의 참조는 Velocity 배포 트리의 루트 상대 패스됨에 주의해 주십시오.


        1. Velocity 배포를 입수해 주십시오. release와, nightly snapshot와, 직접 CVS code repository 등을 이용하는 것이 가능합니다. 좋게 동작한다고는 생각합니다만, 하지만, 최신의 기능을 위해, nightly snapshot이 아마 최선의 방법이겠지요. 상세 정보는, 여기를 참조해 주십시오.

        2. Java 구축 툴인 Jakarta Ant 을 아직 인스톨 하지 않고 있는 경우에는, 우선 그것을 인스톨 해 주십시오. Velocity를 구축하는데 필요하고, Velocity를 사용하는것에도 필요합니다.

        3. 배포는 build 디렉토리로 이동합니다.

        4. ant <build target> 타입은 <build target> 이하의 내용 중 하나입니다. :

    • jar bin 디렉토리에 완전한 Velocity jar를 생성합니다. 이 jar는, 'velocity-X. jar'라고 합니다. 여기에서의 「X」는, 현재의 버전 번호입니다. 이 jar는 Velocity에 대해 필수 종속을 필요로하지 않습니다. 여러분이 이 대상(target)을 사용한다면, 여러분은 반드시Jakarta Commons의 Collections 컴포넌트 jar을 얻어야 하고, 당신의 CLASSPATH (or WEB-INF/lib)를 포함시켜야 합니다. 여러분이 그 내장된 logging이나 템플릿 변환을 사용하는 것을 원한다면, 여러분의 CLASSPATH나 webapp의 WEB-INF/lib에 그 적절한 jar를 포함해야 합니다. 편의상, 여러분은 ORO나 Logkit, Commons Collections에 포함된 jar로 생성하기 위한 대상(target)으로 jar-dep로 사용할 수 있습니다.
    • jar-dep Jakarta Avalon Logkit 패키지로부터 logging을 위해 필수 지원을 포함하고, Jakarta Commons으로 세부적인 환경을 지원하고, Jakarta ORO 패키지를 사용해서 웹매크로(WebMacro) 템플릿 변환을 필수지원하여, bin 디렉토리에 완전한 Velocity jar를 생성됩니다.
    • jar-core bin 디렉토리에 'velocity-core-X.jar'라는 이름의 작은 사이즈의 Velocity jar를 생성합니다. 이 jar에는 Velocity 기능의 코어가 포함되고 있습니다만, Anakia, Texen 같은 유틸리티와, VelocityServer를 지원하는 기본 클래스는 예지는 포함되고 있지 않습니다. 그것은 정규 jar 와 같은 외부의 종속성 요구사항을 가지고 있습니다.
    • jar-util 'velocity-util X.jar'라는 유틸리티 Velocity jar를 bin 디렉토리에 생성합니다. 이 jar는, 유틸리티 코드, 특히 Anakia, Texen과 WebMacro 템플릿 변환 유틸리티를 포함합니다. 그것은 정규 jar 와 같은 외부의 종속성 요구사항을 가지고 있습니다.
    • jar-servlet 'velocity-servlet-X.jar'라는 유틸리티 Velocity jar를 bin 디렉토리에 생성합니다. 이 jar는, servlet 프로그래머를 위한 유틸리티 코드를 포함합니다. 그것은 정규 jar 와 같은 외부의 종속성 요구사항을 가지고 있습니다.
    • jar-j2ee J2EE 지원을 필요로 하는 모든 컴포넌트를 포함하는 'jar' 대상처럼, 완전한 jar를 생성합니다. 현재, 이것은 org.apache.velocity.runtime.resource.loader.DataSourceResourceLoader만을 포함합니다. 일반적으로, 그것은 'velocity-j2ee-X.jar'라하고, bin 디렉토리에 있습니다. 주의: 만약 이 생성 대상을 사용하고 싶을 경우, 반드시 build/lib 디렉토리에 j2ee. jar를 복사(또는 링크)을 해 두어야 합니다. 우리는, 배포의 일부로써 그것을 제공하고 있지 않습니다. 좋은 소스는 http://java. sun. com/에 있습니다. 그것은 정규 jar 와 같은 외부의 종속성 요구사항을 가지고 있습니다.
    • jar-J2EE-dep J2EE 지원하고, Jakarta Avalon Logkit으로 logging지원을 포함하고, 과 Jakarta ORO패키지로 부터 regexp 지원하는 완전한 jar를 생성합니다. 상기의 jar-deps 타겟을 참조해 주십시오.
    • examples 은 예제 디렉토리에 있는 예제 프로그램으로 예제 코드를 생성합니다. 이것은 또, forumdemo 예제 프로젝트 생성의 생성 대상이 될 것 입니다.
    • forumdemo examples/forumdemo 디렉토리에 예제 웹에플리케이션을 생성합니다.
    • docs 은, Velocity의 Anakia XML 변환 툴을 사용해 이들 문서를 docs 디렉토리에 생성합니다. stylesheets를 대신에 Velocity 템플릿를 사용하는 것이 가능합니다.-시도해 보세요! 주: 이 대상은, jakarta-site2 프로젝트가 jakarta-velocity 배포 디렉토리와 같은 디렉토리로에 위치하도록 해야 합니다. 이 대상의 상세한 정보는 build.xml 파일을 보세요.
    • jar-src 모든 Velocity 소스코드를 하나의 jar에 정리되고, bin 디레크토리에 위치합니다.
    • javadocs docs/api 디렉토리에 Javadoc클래스 문서로 생성됩니다.
    • test (after jar) will test Velocity against it's testbed suite of test routines - test (jar 후에)는 테스트 루틴(일련의 작업)의  testbed 세트를 대비하여 Velocity를 테스트를 할 것입니다.
    • help 이용 할 수 있는 생성 대상의 일람을 표시합니다.

        5. 반드시 필요하지는 않지만 , 생성을 테스트하는것은 좋은 생각입니다. 위에서 보여진 test 타겟을 사용해 주십시오.

        6. 그렇습니다.! Velocity는 사용될 준비가 되었습니다. 클래스 패스 또는 다른 적절한 장소에 jar를 둡니다(만약 servlet에서 사용하는 것이라면 webapp의 lib 디렉토리 등)

        7. 예를 실행해 보고 싶을 경우는, (처음의 경우에는 특히 권장합니다 ), ant examples를 통해 예제의 build를 사용하세요.


    부록

     

    Velocity는 collections과 같은 Java 2 API의 요소(elements)를 사용하고, Java 2 Standard Edition SDK (Software Development Kit)에 의해 생성됩니다. Velocity의 실행은 Java 2 Standard Edition RTE (Run Time Environment)(또는 물론 SDK를 사용할 수 있다.)가 사용되어진다.

    Velocity는 또한 일반적인 기능성을 위해 몇몇의 패키지들에 의존합니다. 그들은 편의상 build/lib 디렉토리에 포함됩니다. 그러나 기본생성대상(:default build target) (위를 참조하세요.)에 그들은 포함되지 않습니다. 만약 기본생성대상(:default build target)을 사용하길 원한다면, 반드시 classpath에 의존(dependencies)을 추가해야 합니다.

    • Jakarta Commons Collections - 필수.
    • Jakarta Avalon Logkit - 옵션, 매우 공통적입니다. 만약 Velocity에서 기본 파일기반 logging을 사용한다면 필요합니다.
    • Jakarta ORO - 옵션. the org.apache.velocity.convert.WebMacro template변경 유틸리티를 사용할 때 필요합니다.

    리소스


    대부분의 리소스와 예제를 프로그래머에게 이용할 수 있게하고, 우리는 당신이 우리의 예제를 보고, 문서와 소스코드를 보는 것을 권합니다. 이하는 훌륭한 소스의 일부입니다  :


  • 유저와 개발자 커뮤니티 : mail-lists에 참가하여 주십시오.
  • Mail-list 보관소 : http://www.mail-archive.com라면 충분합니다. 검색박스에 'velocity' 낱말에 넣고 -user, -dev 보관소 둘다 보아 주십시오
  • 소스 코드 : src/java/... : Velocity 프로젝트의 모든 소스 코드가 있습니다
  • 애플리케이션 예제 1 : examples/app_example1 : 응용 프로그램에서 Velocity를 어떻게 사용하는가 보인 간단한 예제
  • 애플리케이션 예제 2 :examples/app_example2 : Velocity 응용 유틸리티 클래스를 사용한 응용 프로그램에서 Velocity를 사용을 보여주는  간단한 예제
  • servlet 예제 : examples/servlet_example1 : servlet에서 Velocity를 사용하는 방법을 보인 간단한 예제
  • logger 예제 : examples/logger_example : 모든 로그 메시지를 수신하기 위해 Velocity를 등록하고, 고객 logging 클래스를 생성하는 방법을 보여주는 간단한 예
  • XML 예제 : examples/xmlapp_example : Velocity 템플릿을 사용하여 XML 문서 데이타에의 접근과 JDOM의 사용법이 간단한 예제. 문서 트리를 떠돌아 다니는 순환 Velocimacro의 데모를 포함합니다.
  • event 예제 : examples/event_example : Velocity 1.1의 API로 이벤트 운용을 사용한 예제
  • Anakia 에플리케이션 : examples/anakia : XML 데이타의 스타일시트 렌더링(stylesheet renderings)을 생성하기 위해 Velocity를 사용한 애플리케이션 예제
  • Forumdemo web app : examples/forumdemo : servlet 기반의 포럼 애플리케이션의 움직임 본보기 
  • 문서 : docs : Velocity 프로젝트를 위해 html로 생성된 모든 문서
  • API 문서 : docs/api : Velocity 프로젝트를 위해 생성된 Javadoc 문서
  • 템플릿 : test/templates : testbed 디렉토리에 템플릿의 큰 집합(collection), VTL(Velocity Template Language)의 사용법이 훌륭한 소스가 있습니다.
  • context example : examples/context_example : two examples showing how the Velocity context can be extended. For advanced users.
  • context 예제 : examples/context_example : Velocity context을 확장할 수 있는 방법을 보여주는 2개의 예제가 있습니다. 고급자용.

     

    위의 모든 디렉토리의 참조는, 배포 루트 디렉토리의 상대 패스입니다.


    Velocity 사용 방법


        'The Fundamental Pattern'

     

        응용프로그램과 servlet 에서 Velocity를 사용하는 경우 (또는 정확하게는 기타의 경우도 ), 이하의 것을 실행해야 합니다.

    1. Velocity의 초기화. 이것은, Velocity를 위한 쌍방의 패턴을 사용할 때에 적용하고, Singleton과 마찬가로 '실행시 인스턴스 분리' (상세하게 붙어서는 하기 참조 ) 한 번만 실행합니다.
    2. Context 오브젝트의 생성 (상세는 나중에..)
    3. Context에 당신의 데이타 오브젝트의 추가
    4. 템플릿의 선택
    5. 출력을 생성하기 위해(때문에) 당신의 데이타와 템플릿의 머지('Merge')

        코드에서, org.apache.velocity.app.Velocity 클래스를 통해 Singleton 패턴을 사용하려면, 이렇게 합니다.


    import java.io.StringWriter; 
    import org.apache.velocity.VelocityContext;
    import org.apache.velocity.Template;
    import org.apache.velocity.app.Velocity;
    import org.apache.velocity.exception.ResourceNotFoundException;
    import org.apache.velocity.exception.ParseErrorException;
    import org.apache.velocity.exception.MethodInvocationException;
    Velocity.init(); 
    VelocityContext context = new VelocityContext(); 
    context.put( "name", new String("Velocity") ); 
    Template template = null; 
    try { template = Velocity.getTemplate("mytemplate.vm"); 
    } catch( ResourceNotFoundException rnfe ) {
     // couldn't find the template
    } catch( ParseErrorException pee ) {
     // syntax error : problem parsing the template
    } catch( MethodInvocationException mie ) {
     // something invoked in the template // threw an exception
    } catch( Exception e ) {}
    StringWriter sw = new StringWriter(); 
    template.merge( context, sw );

        이것이 기본적인 패턴입니다. 대단히 단순하지 않나요? 이것은, 일반적으로 당신이 템플릿을 렌더링하는데 Velocity를 사용할 때에 실행하는 것입니다. 당신은 아마도 당연히 이런 코드를 쓰고 있지 않을 것입니다.-우리는 servlet과 응용프로그램의 둘다를 위해서, 보다 간단하게 만들기 위해 도움되는 2∼3의 툴을 준비하고 있습니다. 이 가이드의 후반부에, 우리는 두개의 servlet에서 일반적인 애플리케이션 처럼 Velocity를 사용하는 것에 대해서 설명할 것입니다. 그리고, 우리는 쉽게 만들기 위해 제공하는 툴을 검토합니다. 어느쪽의 경우도 상기의 순서가 그 화면 뒤에서, 움직이고 있는 것은 사실입니다.


    To Singleton Or Not To Singleton


        Velocity 1. 2 버젼이나 이후 버젼부터, 개발자는 현재 Velocity 엔진을 사용하기 위해, Singleton 모델과 Separte Instance 모델의  2개의 옵션이 있습니다.  어느쪽의 방법도 같은 Velocity 코드의 코어를 사용하고, Velocity에 의해 간단하게 당신의 Java 에플리케이션에 통합되는 것이 가능합니다.


        Singleton Model

     

        이것은 legacy  패턴, JVM(또는 Web 에플리케이션, depending)에서 하나의 Velocity 엔진의 instance가 모두 공유됩니다. 이것은 리소스의 공유와 지역적 설정을 위해 매우 편리한 방법입니다. 예컨대, 이것은 servlet 2. 2이후 버젼과 호환되는 독자적인 Velocity의 instance를 가질 수 있는 각각의 Web 에플리케이션이고,  템플릿, 로그, 기타 처럼 리소스 공유를 Web 에플리케이션의 servlet이 지원하는, web 에플리케이션에서 사용하기 위한 매우 적절한 모델입니다.

    싱글 톤은, org.apache.velocity.app.Velocity 클래스에서 접근하는 것이 가능하고, 이하처럼 사용합니다.


    import org.apache.velocity.app.Velocity; 
    import org.apache.velocity.Template; ...
    /* * Configure the engine - as an example, we are using 
     * ourselves as the logger - see logging examples
     */
    Velocity.setProperty( Velocity.RUNTIME_LOG_LOGSYSTEM, this); 
    /* * now initialize the engine */ 
    Velocity.init();
    ... 
    Template t = Velocity.getTemplate("foo.vm");

        Singleton 모델은, org.apache.velocity.servlet.VelocityServlet 베이스 클래스에서 사용되고, 유틸리티 클래스는, servlet을 간단하게 작성하기 위해 배포되는 것에 주의해 주십시오. 이 클래스를 확장하는 것은 Velocity를 사용하는 servlets를 쓰는 것이 가장 공통적이고편리한 방법입니다만, 다른 목적을 위해 이 클래스를 사용하지 않는 것은 당신의 자유입니다.


        Separate Instance

     

        새로운 1. 2버젼부터, Separate instance는 같은 JVM(또는 Web 에플리케이션 )에서 Velocity의 인스턴스를 대부분 생성, 설정,사용하는것을 지원합니다.


    이것은 같은 에플리케이션에서 템플릿 디렉토리와, 로그, 기타 등의 설정을 분할하고 싶을 때에 도움이 됩니다. Separate instance를 사용하기 위해서는, org.apache.velocity.app.VelocityEngine 클래스를 사용합니다. 상기의 Singleton의 예제와 비슷한 예제가 있습니다.

    import org.apache.velocity.app.VelocityEngine; 
    import org.apache.velocity.Template;
    ... 
    /* * create a new instance of the engine */ 
    VelocityEngine ve = new VelocityEngine(); 
    /* * configure the engine. In this case, we are using 
     * ourselves as a logger (see logging examples..)
     */
    ve.setProperty( VelocityEngine.RUNTIME_LOG_LOGSYSTEM, this); 
    /* * initialize the engine */ 
    ve.init(); 
    ... 
    Template t = ve.getTemplate("foo.vm");

    보이는것 처럼, 이것은 매우 심플하고 간단한 것입니다. 단순한 문법의 변경에서의 제외하고, Velocity를 사용하면 Singleton과 Separate instance의 요구때문에 당신의 에플리케이션과 템플릿의 고 레벨의 구조를 변경할 필요는 없습니다.


    프로그래머로써, 당신이 사용해야 하는 클래스는 싱글 톤 모델을 사용하는 경우에는 org.apache.velocity.app.Velocity 클래스를, non-Singleton 모델 ('Separate instance')은 org.apache.velocity.app.VelocityEngine을 Velocity 내부에 영향을 미친다.


    에플리케이션에서 org.apache.velocity.runtime 패키지의 internal Runtime, RuntimeConstants, RuntimeSingleton or RuntimeInstance 클래스를 결정해 사용하지 말아 주십시오. 이것들은 내부 사용만을 상정하고 있고, 오래지 않아 변경될 것입니다. 위에서 언급했듯이 당신이 사용할 클래스는 org.apache.velocity.app 패키지, 그리고 VelocityVelocityEngine 클래스입니다.

     만약 어느것이든지 그들 클래스로가 잘못되었거나 필요하다면, 변경을 제안하는 것에 주저하지 말아 주십시오-이들 클래스는 에플리케이션 개발자를 대상으로 합니다.


    The Context

     

        The Basics


        'context'의 개념은, Velocity에 있어서 주요하고, 시스템의 일부의 사이에서 데이타 중심의 콘테이너를 이동시키는 공통의 테크닉입니다. context의 사고방식은 Java layer(혹은, 당신 프로그래머)와 template layer(또는 설계자(designer))사이에서 데이타의 'carrier'라 합니다. 프로그래머로써의 당신은, 다양한 타입(당신의 에플리케이션이 요구하는 것은 무엇이든지)의 오브젝트를 모으게 되고, context에서 그것들을 두게 됩니다. 설계자(designer), 이들 objects와 그들의 methods에, 그리고, properties는 references라는 template elements를 통해 접근 가능하게 되게 됩니다. 일반적으로, 당신은 에플리케이션의 자료를 결정하기 위해 설계자(designer)와 일하게 됩니다. 어떤 의미에서, 이것은 템플릿에서 접근하는 설계자(designer)를 위한 데이터 설정을 생성하는 'API'가 될 것입니다.

    따라서, 개발 프로세스의 양상으로의 그것은 약간의 시간과 신중한 분석을 바치는 가치가 있습니다.

  • Posted by 1010
    98..Etc/Etc...2009. 2. 9. 10:25
    반응형

    전 세계 실시간 TV보기 & CCTV 보기

     

    나라별 실시간 웹캠 (CCTV) 보기

    한국

    일본

    덴마크

    리투아니아

    오스트리아

    마케도니아

    노르웨이

    벨기에

    불가리아

    그레나다

    체코

    영국

    에스토니아

    태국

    핀란드

    프랑스

    독일

    그리스

    헝가리

    아이슬란드

    대만

    미국

    호주

    이탈리아

    슬로바키아

    슬로베니아

    볼리비아

    터키

    캐나다

    네덜란드

    폴란드

    포르투갈

    루마니아

    러시아

    이스라엘

    멕시코

    스페인

    스웨덴

    스위스

    아르헨티나

    브라질

    중국

    파나마

    콜롬비아

    싱가폴

    이집트

    남아공

    동물캠

    라디오

       

    나라별 실시간TV 보기

    한국

    일본

    알바니아

    안도라

    오스트리아

    아제르바..

    스리랑카

    벨기에

    불가리아

    크로아티아

    체코

    영국

    에스토니아

    태국

    핀란드

    프랑스

    독일

    그리스

    헝가리

    아이슬란드

    대만

    아일랜드

    호주

    이탈리아

    코소보

    라트비아

    룩셈부르크

    터키

    몰타

    네덜란드

    폴란드

    포르투갈

    루마니아

    러시아

    우즈베키..

    슬로베니아

    스페인

    스웨덴

    스위스

    우크라이나

    바티칸

    베트남

    뉴질랜드

    캐나다

    코스타리카

    도미니카

    멕시코

    푸에트로..

    남아공

    미국1

    미국2

    미국3

    미국4

    미국5

    미국6

    미국7

    미국7

    아르헨티나

    벨리즈

    브라질

    칠레

    콜롬비아

    이집트

    쿠바

    엘살바도르

    아이티

    니카라과

    파나마

    페루

    코트디브..

    베네수엘라

    중국

    그루지야

    인도

    이란

    이라크

    가나

    이스라엘

    쿠르디스탄

    말레이시아

    오만

    필리핀

    카타르

    리비아






    ------------------------------------------------------------------------

    sbs 실시간TV http://0620.tv
    mbc 실시간TV http://0620.tv
    kbs 실시간TV http://0620.tv
    ebs 실시간TV http://0620.tv
    미국 실시간TV http://0620.tv
    영국 실시간TV http://0620.tv
    일본 실시간TV http://0620.tv
    캐나다 실시간TV http://0620.tv
    중국 실시간TV http://0620.tv
    헝가리 실시간TV http://0620.tv
    스포츠 실시간TV http://0620.tv
    축구 실시간TV http://0620.tv
    유럽축구 실시간TV http://0620.tv
    홈쇼핑 실시간TV http://0620.tv
    아프리카 실시간TV http://0620.tv
    호주 실시간TV http://0620.tv
    일본TV 실시간TV http://0620.tv
    미국드라마 실시간TV http://0620.tv
    영화 실시간TV http://0620.tv
    체코 실시간TV http://0620.tv
    전세계 실시간TV http://0620.tv
    벨기에 실시간TV http://0620.tv
    축구중계 실시간TV http://0620.tv
    야구중계 실시간TV http://0620.tv
    메이저리그 실시간TV http://0620.tv
    NBA 실시간TV http://0620.tv
    싸이클 실시간TV http://0620.tv
    이종격투기 실시간TV http://0620.tv
    K1 실시간TV http://0620.tv
    WWE 실시간TV http://0620.tv
    bbc 실시간TV http://0620.tv
    미국espn 실시간TV http://0620.tv
    맨체스터 실시간TV http://0620.tv
    아프리카 실시간TV http://0620.tv
    아시아 실시간TV http://0620.tv
    유럽 실시간TV http://0620.tv
    폴란드 실시간TV http://0620.tv
    프랑스 실시간TV http://0620.tv
    축구채널 실시간TV http://0620.tv
    이탈리아 실시간TV http://0620.tv
    프리미어리그 실시간TV http://0620.tv
    실시간중계 실시간TV http://0620.tv
    실시간 축구중계 실시간TV http://0620.tv
    스위스 실시간TV http://0620.tv
    스페인 실시간TV http://0620.tv
    일본쇼프로 실시간TV http://0620.tv
    독일 실시간TV http://0620.tv
    음악방송 실시간TV http://0620.tv
    뮤직비디오 실시간TV http://0620.tv
    MTV 실시간TV http://0620.tv
    기독교방송 실시간TV http://0620.tv
    전세계 기독교채널 실시간TV http://0620.tv
    종교 실시간TV http://0620.tv
    프라이드 실시간TV http://0620.tv
    박지성 축구 실시간TV http://0620.tv
    맨체스터유나이티드 실시간TV http://0620.tv
    맨유 실시간TV http://0620.tv
    이영표 실시간TV http://0620.tv
    이동국 축구 실시간TV http://0620.tv
    미들스브로 실시간TV http://0620.tv
    다큐멘터리 실시간TV http://0620.tv
    네덜란드 실시간TV http://0620.tv
    케이블TV 실시간TV http://0620.tv
    생방송 실시간TV http://0620.tv
    실시간 축구중계 실시간TV http://0620.tv
    인터넷 축구중계 실시간TV http://0620.tv
    유럽축구 실시간TV http://0620.tv
    축구방송 실시간TV http://0620.tv
    힙합 방송 실시간TV http://0620.tv
    무료 실시간TV http://0620.tv
    챔피언스리그 실시간TV http://0620.tv
    일본방송 실시간TV http://0620.tv
    일본TV 쇼프로 실시간TV http://0620.tv
    실시간 웹캠 실시간TV http://0620.tv
    웹캠 실시간TV http://0620.tv
    라이브 웹캠 실시간TV http://0620.tv
    전세계 라이브웹캠 실시간TV http://0620.tv
    Live 웹캠
    실시간 라디오 실시간TV http://0620.tv
    전세계 음악 실시간TV http://0620.tv
    재즈 실시간TV http://0620.tv
    Live TV 실시간TV http://0620.tv
    만화 실시간TV http://0620.tv
    전세계 홈쇼핑 실시간TV http://0620.tv
    외국 홈쇼핑 채널 실시간TV http://0620.tv
    익스트림 채널 실시간TV http://0620.tv
    알바니아 실시간TV http://0620.tv
    브라질 실시간TV http://0620.tv

    Posted by 1010
    98..Etc/Etc...2009. 1. 30. 19:21
    반응형

    아파치 + 리눅스 + 톰켓 설치(1)

     

    JSP에 입문하신 여러분들께 제가 권하고자 하는 JSP엔진은 바로 톰켓입니다.

    이 시점에서


    '아..네..근데 JSP엔진이뭐죠?'


    하고 질문하시는 초강력 울트라 캡숑 나이스 짱 왕초보님이 계실겁니다.

    모르는 건 당연합니다. 물론 저도 몰랐었죠.

    JSP엔진이라 함은 JSP를 돌리기 위해서 필요한 말 그대로 엔진이라 생각하면 될 겁니다.

    자동차가 가려면 자동차엔진이 필요하고, 비행기가 날려면 비행기 엔진이 필요하듯이 말이지요.

    ASP가 돌려면 IIS가 필요하고, PHP가 돌려면 PHP를 설치해야 하듯이 말이지요.


    ' 아니, ASP는 뭐고 IIS는 뭐죠? PHP는 먹는건가요? '


    라고 질문하시려 했다면 잠시만 참으세요. 그 정도로만 이해하셔도 충분합니다.

    어쨌든 여기서는 JSP엔진으로 톰켓을 설치하게 되는 것입니다.

    JSP엔진에도 종류가 여러 가지가 있지요.

    Jrun이라든가 resin이라든가, AparchJserv등등등...

    참고적으로 Jrun은 돈많이 내고 써야하는 거구요. ApacheJserv는 톰켓의 이전 버전 정도로

    생각하시면 될겁니다.

    서두가 길었죠? 자, 그럼 설치를 시작해보겠습니다.


    1. 리눅스의 설치


    여기서 리눅스의 설치는 생략하도록 하겠습니다. 지금은 리눅스보다는 아파치와 톰켓의 설치가

    우선적으로 설명이 되어야 하거든요. 어쨌든 시중에 있는 배포본은 매우 설치가 쉽도록

    되어있습니다. 많은 분들이 원하신다면 강좌를 올리겠습니다만,

    아마도 대부분은 리눅스를 설치하실 수 있으실 겁니다.


    2. 아파치의 설치

     제 주위엔 남못지 않은 강력한 초보님들이 꽤나 계시답니다.

    한번은 어떤 초보님이 이런 불만을 토하시더군요.
     

    '아파치 좀 공부할려고 말이야....., 야후에다가 '아파치'치고 검색했더니,

     맨 무슨 헬기만 나와..!!!

     사오정 검색은 싫어!'


    라고 말이지요. 그렇습니다. 우리가 알고 있는 아파치는 탱크잡는 헬기를 말하지요.

    그러나 이제부터 여러분께서는 아파치하면 웹서버가 떠올라야 합니다.

    인터넷상에서 웹서비스를 하려면 웹서버가 설치되어 있어야 하지요.

    지금 바로 그 아파치를 설치하려합니다.


    그러면 이제 아파치를 다운 받겠습니다.

    http://www.apache.kr.net으로 가시면 Download라고 있을겁니다.

    거기서 .tar.gz식으로 끝나는 아파치 최신 버전을 다운받으시기 바랍니다.

    .zip으로 끝나는 아파치는 윈도우용이니 여기서는 필요가 없습니다.

    리눅스에서 넷스케이프로 받으셨다면 일단 /usr/local/ 밑에 받아놓으시기 바랍니다.

    윈도우에서 받으셨다면 ftp로 다른 컴퓨터에 있는 리눅스에 옮기시거나,

    리눅스가 본인 컴퓨터에 함께 설치되어 있다면 리눅스에서 mount를 하여

    윈도우에 있는 아파치를 리눅스로 옮겨다 놓으시기 바랍니다.


    어찌됐던 디리던 디리던던~~

    지금까지의 작업으로

    리눅스의 /usr/local/ 디렉토리 밑에 apache의 최신버전이 놓여 있어야겠죠?

    8월현재 아파치 최신버전은 1.3.12로군요.

    자, 이제 리눅스에 root계정으로 들어가시기 바랍니다.

    어떻게 들어가냐구요?

    login : root

    password : ***** (본인 컴퓨터의 root계정 패스워드를 칩니다.)

    $>

    이런 프롬프트가 뜨면,

    $> cd /usr/local

    을 칩니다. /usr/local 밑으로 위치를 이동하는 것이지요. 앞에 / 가 붙음에 유의 하세요.

    절대경로에는 / 가 붙습니다.

    $> ls

    치시면 방금 다운받은 aparche가 보이지요.

    그럼 아파치의 압축을 풀겠습니다.

    $> tar xvzf aparche_1.3.12.tar.Z


    치시면 뭐가 쫙 풀리죠? 방금 여러분은 압축되어있던 아파치를 푸신겁니다.

    apache_1.3.12라는 디렉토리가 하나 생겼을겁니다.

    그러면

    $> cd apache_1.3.12

    치고 들어가셔셔

    $>./configure --prefix=/usr/local/apache  --enable-shared=max  --enable-rule=SHARED_CORE  --enable-module=so


    하십니다.(1열로 쫙 붙여쓰세요.) 설치를 위한 환경설정을 하는 것이지요.

    앞에 ./치시는거 잊지 마시고요.

    ./는 현재 경로를 나타내는 말입니다.

    그러면 막 환경설정을 알아서 하겁니다.

    그럼 이제 설치를 하지요.

    $> make

    치셔서 컴파일을 하시고

    $> make install

    치셔서 설치하시면 아파치 설치가 끝납니다.


    $> cd /usr/local/apache/conf


    로 이동하셔서


    $> vi  httpd.conf


    파일을 엽니다.

    #ServerName을 찾으셔서 앞에 #를 지워서 주석 제거하시고

    ServerName localhost

    이렇게 씁니다. 혹은 해당아이피나 호스트명을 씁니다.

    그런 다음,


    $> /usr/local/apache/bin/apachectl start


    해서 아파치를 시작하십니다.

    브라우저에서 http://localhost 하고 엔터 쳐서 화면이 뜨면 설치 성공입니다.

    수고하셨습니다.

    그럼 이제 쉬실 분들은 잠시 쉬시고, 톰켓을 설치하도록 하겠습니다.

    다 쉬셨으면 다음을 클릭하고 톰켓 설치로 넘어가겠습니다.

    다음--> 



    아파치 + 리눅스 + 톰켓 설치(2)


    잘 쉬셨습니까?

    어떤분은 한 하루정도 푹 쉬시고 이 페이지로 오신 분도 계시리라 생각이 듭니다.

    아마도 일주일만에 오신 분도 계시겠지요. 쉴땐 팍팍 쉬는겁니다.~

    그러면 푹 쉬셨으니 이제 기다리시던 톰켓 설치에 들어가도록 하겠습니다.

     

    1. JDK의 설치

     

    '톰켓 설치한다며..? 왠 JDK?

    라고 말씀하시는 분께는 죄송스런 얘기지만, JDK도 설치를 하셔야합니다.

    왜냐? JSP는 아시다시피 JAVA로 이루어진 언어지요. 그런데 그 언어가 돌아가려면

    현재의 컴퓨터에 JAVA개발환경이 갖추어져 있어야 합니다.

    그래서 필요한 것이 JAVA Development Kit 이라는 것이지요. 줄여서 JDK입니다.


    그럼 이제 JDK를 설치하도록 하겠습니다.

    http://www.blackdown.org에 가시면 왼쪽에 Download라고 있습니다.

    거기로 들어가시면 나라별로 다운로드할 장소가 나오지요.

    아무 나라나 선택하셔서 i386이라는 폴더에 들어가셔서

    jdk1_2_2-linux-i386.tar.gz를 다운받으시기 바랍니다.

    저는 개인적으로 네덜란드를 주로 사용합니다. 우연히 딱 찍은게 네덜란드인데

    그런대로 속도가 나오는 것 같더군요.

    이래서 괜시리 네덜란드에 대한 이미지가 좋아지게 되는군요.

    위치는 역시 /usr/local 밑에 다운받습니다.


    $> cd /usr/local/

    $> ls


    치시면 방금받는 JDK가 보이지요?

    역시 압축을 풀도록 하겠습니다.


    $> tar xvzf jdk1_2_2-linux-i386.tar.gz


    쫙 풀리죠?

    전 항상 느끼는 거지만 압축을 풀 때마다 쌓인 스트레스가 해소되는 느낌을 받습니다.

    정말 말그대로 쫘~악 하고 풀리니까요.


    $> ls


    하고 보시면 jdk1_2_2라는 디렉토리가 생겨있는걸 보실 수 있습니다.

    사용상의 편의를 위해서 디렉토리의 이름을 바꿉니다.


    $> mv   jdk1_2_2   jdk


    mv는 이동하라는 명령어인데 jdk1_2_2를 jdk라는 이름으로 이동했으니,

    이름바꾸기랑 다를바가 없죠.

    이렇게 해서 설치가 끝났습니다. 벌써?

    무척 간단하죠? 그냥 다운받고 압축을 푸니 설치가 끝이로군요.

    하지만 중요한 것은 jdk를 패스에 추가하는 것입니다.

    처음 설치하시는 분께는 여기서부터가 조금 어렵습니다.

    부끄럽지만 저도 한 때는 패스라는 개념이 안잡혀서 혼란스러워하던 때가 있었지요.

    패스가 path를 말하는 건지 pass를 말하는건지도 헛갈려 했었지요.

    '실은 내가 그 수준인데 말이지...'

    하시는 분들도 있을겁니다. 제가 여기서 정답을 말씀드리지 않고 넘어가면,

    그분께선 남몰래 저를 원망하시겠지요.

    그래서 정답을 말씀드리자면, 정답은 path입니다.  패뜨~


    자, 일단 현재 권한이 root권한이어야 합니다.

    처음에 로긴할 때 root로 로긴했다면 상관이 없구요, 다른 계정으로 로긴했다면


    $> su root


    를 치시고 패스워드 치셔서 root권한으로 전환하시기 바랍니다.

    그럼 이제 위치를 이동하겠습니다.


    $>cd /etc


    그다음 환경설정을 시작해야겠지요.


    $> vi  profile


    그럼 파일이 열리지요?

    제일 밑에 다음과 같이 적어주시기 바랍니다.

    export JAVA_HOME=/usr/local/jdk/
    export CLASSPATH=./:$JAVA_HOME/lib/tools.jar:/usr/local/jakarta-tomcat/lib/servlet.jar
    export PATH=$PATH:$JAVA_HOME/bin

    이렇게 적어주시고
    :wq치시고 빠져나오시기 바랍니다.

    /usr/local/jakarta-tomcat/lib/servlet.jar

    이 부분은 서블릿을 돌리기위해 톰켓의 servlet.jar를 패스에 추가하는 부분입니다.

    그럼 이제 지금 바꾼 환경을 적용하도록 하겠습니다.

    $> source profile


    그럼 환경설정이 끝납니다.

    현재 상태에서


    $> javac


    쳤을 때 뭐라고 쫙 나오면 설치 성공입니다.

    명령을 찾을수 없다고 나오면 다시 한번 살펴보시고 설치하시기 바랍니다.

     

    2. Tomcat의 설치


    드디어 Tomcat을 설치합니다.

    이제부터 톰켓이라는 JSP/서블릿 엔진을 설치하도록 하겠습니다.

    '서블릿이 모야?'

    라고 질문하시겠죠?

    간단히 말하자면, 서블릿은 CGI의 자바버전입니다.

    'CGI는 또 모냐? 구체적으로 좀 얘기해 달란말이쥐...'

    하하... 그래서 제가 준비한 강좌가 또 있습니다.

    kimho의 JSP와 서블릿의 개념에 대한 강좌입니다.

    지금 너무 궁금해 죽겠다 하시는 분께서는 위 메뉴에서

    JSP공부하기를 클릭하셔서 보시구요,

    일단 설치부터 마무리 하겠다 하시는 분께서는 남은 설치를 마무리하시고

    보시기 바랍니다. 나중에 봐도 늦지는 않거든요.

    그럼 이제 톰켓을 다운받으시겠습니다.

    http://jakarta.apache.org 에 가시면 왼쪽에 Download가 있습니다.

    거기서 Binary를 선택하시고, 오른쪽에 Tomcat3.1이라고 링크되어 있는곳을

    클릭하세요. 그런다음 톰켓3.1버전을 다운 받으십니다.

    jakarta-tomcat.tar.gz 입니다.

    역시 위치는 /usr/local입니다.


    그리고 한가지 더..., 다운받는곳의 링크들 밑에 linux와 win32가 있는데, linux로 들어가셔서

    mod_jserv.so라는 파일을 받으십니다. 이 파일은 잠시후에 설명하겠지만,

    아파치와 톰켓을 붙일 때 사용합니다. 먼소린지 모르시겠죠? 이따 설명이 나옵니다.

    만약 다운받은 파일이름이

    mod_jserv.so..so

    이런식으로 되어 있다면 이름을 제대로 바꾸십니다.


    $> mv  mod_jserv.so..so   mod_jserv.so


    자, 이제 언제나 그랬듯이 압축을 쫘~악 풀도록 하겠습니다.


    $> tar xvzf jakarta-tomcat.tar.gz


    오~예~ 해소되는 기분...


    그러면 /usr/local 밑에 jakarta-tomcat이라는 디렉토리가 생겼을 것입니다.

    디렉토리 이름을 꼭 jakarta-tomcat으로 해주세요. 이 강좌는 이 이름을 바탕으로 썼습니다.

    기뻐해 주십시요. 톰켓의 설치가 끝났습니다.

    언제나 기쁜일은 부지불식간에 오는 것 같습니다...^^


    그럼 이제 테스트를 해볼까요?


    $> cd /usr/local/jakarta-tomcat/bin

    $> ./startup.sh


    이렇게 톰켓을 시동시킨후,

    브라우저창에서 http://localhost:8080으로 접속하시기 바랍니다.

    톰켓의 기본 포트는 8080입니다.

    지금 현재 윈도우에서 리눅스로 텔넷 접속으로 설치중이신 분은

    브라우저에서 아무리 http://localhost:8080치셔도 안나오겠죠?

    localhost 란 자기 자신의 주소를 가리키는거지깐요.

    리눅스상태에서 http://localhost:8080으로 접속하십니다.

    혹은 윈도우상에서 리눅스쪽의 상태를 확인하시려면

    http://아이피주소:8080이겠죠? 예를들면 http://211.11.11.11:8080 이 되겠죠?

    고양이 한 마리가 보이면 성공입니다.

    축하드립니다.


    아파치와 톰켓을 붙이자

     

    아파치와 톰켓을 붙이는 이유

    아파치를 설치하지 않고, 톰켓만 설치해도 톰켓의 index페이지는 뜹니다.
    다시말해, 톰켓만 설치하고 웹서비스를 하는게 가능하다는 얘기입니다.
    그렇다면 어째서 아파치와 연동하는 것일까요?
    웹서버의 기능에서 아파치가 월등히 우수합니다.
    현재 전 세계적으로 웹서버 시장의 60%를 아파치가 점유하고 있습니다.
    그만큼 강력하다는 것이지요.
    직접 써보시다보면 아시겠지만, 아파치의 탁월한 기능에 대해 놀라지 않을수가 없습니다.
    아파치와 톰켓을 연동했을때 돌아가는 구조는 이렇습니다.
    일반적인 웹서비스는 성능이 우수한 아파치를 통해서 합니다.
    그런데 그중에서 jsp와 관련된 요청이 들어오면 아파치는 jserv모듈을 이용하여 톰켓과 연동하여 결과물을 가져옵니다.
    클라이언트 + 아파치 + 톰켓의 3Tier구조가 되는 것이지요.

    웹서비스의 기본포트는 80입니다. 포트번호를 치지 않고

    http://www.kimho.pe.kr 이라고 치는 것은 실은

    http://www.kimho.pe.kr:80하고 같은 것이지요.

    톰켓에서는 아파치와 톰켓을 붙일 때 사용하는 파일로 mod_jserv.so라는 모듈을 제공합니다.

    아까 다운받으신 mod_jserv.so라는 파일을

    /usr/local/apache/libexec/ 밑으로 옮기십니다.


    $> cp /usr/local/mod_jserv.so  /usr/local/apache/libexec/


    그런다음


    $> cd /usr/local/apahce/conf


    로 이동하셔서


    $> vi  httpd.conf


    이 httpd.conf라는 아파치 설정 파일을 열어서 젤 밑에다가

    Include /usr/local/jakarta-tomcat/conf/tomcat.conf

    이렇게 쓰십니다. 웹서비스의 환경설정에 tomcat.conf에 있는 환경설정도 함께

    적용된다는 뜻입니다.

    톰켓의 conf디렉토리의 tomcat.conf도 여셔서

    ApJservMount default /root 라고 되어있는 부분 밑에

    ApJservMount   /    /root

    이렇게 추가시켜주세요.

    이제 80포트로 접속시에도 톰켓의 디렉토리를 뒤져서 화면상에 보여주게 됩니다.

    테스트를 해볼까요?


    $> /usr/local/apache/bin/apachectl start


    로 아파치를 스타트 시키시고,

    http://localhost/examples

    쳐서 내용이 나오면 성공입니다. 8080이라는 포트번호를 쓰지 않아도 결과가 보이니까요.


     '어째서 http://localhost라고 테스트 하지 않는거지?'

    하고 의문을 품으시는 상당히 예리하신 분이 계시죠? 정말 예리하십니다.

    이유는  http://localhost로 접속시 아파치에서는 디폴트로 index.html이라는

    파일을 열도록 설정되어 있는데, 아파치의 웹서비스 디렉토리에 이미 이 파일이 있기 때문에

    설정 전이나 후나 결과는 같은 index.html을 보여주기 때문입니다.


    이렇게 해서 모든 설치를 마쳤습니다.

    이제부터는 본격적으로 프로그램을 짜고, 공부를 해야겠지요.

    JSP파일은 톰켓의 ROOT디렉토리 밑에 놓으시면 됩니다.

    수고하셨습니다.

    Posted by 1010
    98..Etc/Tomcat2009. 1. 30. 19:18
    반응형

    // tomcat - server.xml파일에 DB Connection생성을 위한 설정(<Host>태그 내부에 추가함)


    <Context Path="/myapp" docBase="myapp" debug="5" reloadable="true" crossContext="true">

    <Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource"

                    maxActive="100" maxIdle="30" maxWait="10000"

                    username="sys" password="password" driverClassName="com.mysql.jdbc.Driver"

                    url="jdbc:mysql://localhost:3306/javatest?autoReconnect=true"/>

    </Context>


    //내용설명

    Context - path : URL 호출시 사용될 이름

                - docBase : 실제 웹 어플리케이션이 위치한 폴더명

                - debug : 로그 작성 레벨

                - reloadable : 톰캣서버의 재시작 없이 수정된 내용을 불러오기 위한 옵션

                - crossContext : myapp이외의 Context에서도 사용 가능하도록 하는 옵션

    Resource - name : Resource명칭(JNDI Lookup 시 사용할 명칭)

                  - auth : Resource 관리자를 지정. 여기서는 톰캣컨테이너가 관리자임

                  - type : Resource 의 형태 지정. 데이타소스 형태를 지정함

                  - maxActive : 최대 연결 가능한 Connection 숫자를 지정함

                  - maxIdle : Connection pool 유지를 위해 최대 대기 connection 숫자

                  - maxWait : Connection 재 사용을 위해 대기해야 하는 최대 시간(단위:ms)

                  - username : DB접속 계정

                  - password : DB접속 암호

                  - driverClassName : DB와 접속하기 위한 driver 클래스를 지정. 예에서는 MySql임

                  - url : 접속한 DB가 위치한 서버명, 포트명, 사용할 데이타베이스명을 지정



    // tomcat - web.xml파일에 DB Connection생성을 위한 설정

    <resource-ref>

                  <description> DB Connection </description>

                  <res-ref-name>jdbc/TestDB</res-ref-name>

                  <res-type>javax.sql.DataSource</res-type>

                  <res-auth>Container</res-auth>

    </resource-ref>


    //내용설명

    resource-ref - description : 참조할 resource에 대한 설명

                      - res-ref-name : 참조할 resource의 명칭. Server.xml에 정의된 이름과 일치해야함

                      - res-type : 참조할 resource 형태로 여기서는 DataSource를 지정함

                      - res-auth : 참조할 resource를 관리할 주체로 톰캣컨테이너를 지정함

    Posted by 1010
    98..Etc/Etc...2009. 1. 29. 17:29
    반응형

    내가 가진 도메인을 이용하여 독립적인 이 메일주소를 만들어 보자.

    포털에 등록하여 사용하는 개성없고 똑같은 이메일 주소보다 내 개성이 물씬 풍기는 partner@, my@, ceo@ 등과 같은 메일주소는 좀더 '있어' 보이지 않는가? -_-

    사실 자기 도메인으로 만들어진 고유한 이메일 주소를 갖는 건 모든 네티즌의 꿈이다. 물론 간단히 가질 수도 있다. 유료 이메일 서비스를 이용하면 된다. 그러나 우리가 원하는 것은 돈 들이지 않고 이용하는 것이다.

    이제 돈 걱정 하지 않고도 자신만의 독특한 이메일 주소를 공짜로 가질 수 있게 되었다. 구글이 제공하는 어플리케이션 중에서 이메일 기능을 이용하면, 무료이면서도 웬만한 유료 웹메일보다 더 강력한 이메일 서비스를 구축할 수 있다. (다른 기능도 공짜인 게 많다. 알아서 사용하시길.. ^^)

    다음은 구글 어플리케이션의 메일 기능이 갖는 장점이다. 

    - 완전 무료다.
    - 웹메일이라 사용이 쉽다.
    - 메일 footer에 쓸데없는 꼬리표가 붙지 않는다.
       공짜 메일에 덕지덕지 붙는 꼬리표 없이 깨끗한 이메일을 보낼 수 있다.
    - 구글이 제공하는 gmail 과 동일한 기능과 성능을 보여준다.


    이제 이 공짜 이메일을 사용해보도록 하자. 

    참고로, 이 글은 '완전초보'를 위한 설명임을 밝혀둔다. '파워유저' 분들은 패스~해주시길. ^^
    이 글에서는 편의상 exmydo.com 이라는 도메인을 사용하여 설명을 하겠다.


    1. 구글 어플리케이션 홈페이지에 접속하여 가입절차를 진행한다

    1-1. 접속주소 : https://www.google.com/a/
    1-2. 오른쪽 상단에 있는 [버전 비교 및 가입] 을 누른다

    뉴스로그


    1-3. 무료로 사용할 것이므로 표준형 [가입하기]를 클릭한다.

    1-4. 도메인 이름 선택 (3단계 중 1단계)

    사용할 도메인을 입력하고 [내 도메인 사용]을 선택한다

    뉴스로그


    정상적인 소유 도메인이면 다음 단계로 진행되지만, 미등록 도메인이면 도메인 등록가능 페이지를 보여주고, 이미 신청된 다른 사람 소유의 도메인이라면 에러 메세지를 보여준다.

    1-5. Google 표준형 애플리케이션에 가입하십시오. (3단계 중 2단계)

    정보란에 적당한 내용들을 입력한다

    이메일 주소는 현재 정상적으로 사용하는 메일주소를 적는다.
    혹시 계정을 분실하거나 했을 때 확인 가능한 비상용이라 보면 된다.

    뉴스로그


    1-6. 설정 - 첫 관리자 계정을 만드십시오. (3단계 중 3단계)

    접속시 관리자로 설정할 메일주소를 결정한다.
    예를 들어 my@exmydo.com 을 exmydo.com 의 관리 계정으로 사용한다면 my 라고 입력한다.

    뉴스로그


    아래의 동의 버튼을 누른다.

    1-7. 가입 마무리




    자동 접속되면서 해당 도메인의 소유권 검증과 각 서비스 설정 화면이 나타난다.
    메일 뿐만 아니라 웹페이지, 캘린더, 오피스 등 여러가지 무료 서비스를 함께 사용할 수 있다.

    도메인의 소유권증명 절차를 진행한다.

    뉴스로그



    2. 도메인 소유권 증명 및 네임서버 변경

    2-1. 도메인의 소유권 증명

    위의 1-7. 에서 계속 진행한다. 혹시 창을 모두 닫아 버렸다면 다시 접속한다.

    https://www.google.com/a/cpanel/exmydo.com/Dashboard 

    혹시 접속이 안되는 경우  
    https://www.google.com/a/exmydo.com/ 으로 접속하면 로그인 페이지가 나온다. 

    앞서 관리자로 가입했던 계정으로 접속

    해당 도메인의 관리 페이지가 나타난다. 

    네임서버를 직접 관리하거나 관리자가 있거나 하는 경우 아래의 방법을 이용한다. 

    뉴스로그


    도메인 소유권을 확인하십시오 를 누른다.

    뉴스로그


    여기서는 도메인이 실제 본인의 소유(또는 본인이 도메인의 정보 수정 권한이 있다)라는 것을 증명해야 한다.
    확인 방법은 두가지가 있다.


    2-1-1. HTML 파일 업로드로 소유권 증명하기

    뉴스로그

    화면에 보이는 파일명으로 파일을 만들어서 그 아래 지정된 텍스트를 이 문서의 가장 위에 입력한 다음, 이파일을 해당 도메인의 디렉토리에 업로드한다. (파일명, 텍스트 등은 위의 예와 다를수 있다.)

    위의 방법은 웹사이트을 운영하고 있는 경우 편리하게 확인할 수 있는 방법이다. 정리하면,

    - 파일을 생성한다. googlehostedservice.html
    - 파일을 메모장 등으로 열어 제일 위에 한줄 추가 google8ffca4c5464de85f
    - 저장한 다음 이 파일을 exmydo.com 의 사이트 첫페이지가 열리는 곳(index 문서가 존재하는곳)에 업로드
    - [확인] 을 누른다.

    뉴스로그

     
    위와 같이 텍스트로만 된 문서를 만들어서 업로드 한다.


    2-1-2. CNAME 레코드 변경을 통한 확인 방법

    뉴스로그


    이 방법은 화면에 나타나는 고유문자로 된 접속 레코드를 zone 파일 설정에 추가 하는 방식이다.

    - 해당 도메인의 DNS 설정하는 zone파일에 아래의 내용을 추가 합니다.
       google8ffca4c5464de85f . exmydo.com
       예를 들면
       google8ffca4c5464de85f.exmydo.com. IN CNAME google.com.

    - 편리한 접속을 위해 아래의 내용도 추가해 준다.
       (mail.exmydo.com 으로 접속가능하게 된다)
       mail  IN  CNAME  ghs.google.com.
    - 네임서버를 재시작 한다.
    - [확인]을 누른다.

    위의 둘 중 하나를 지정한 후 아래의 [확인]을 누르면 구글에서 자동으로 확인을 하며,
    즉시 확인 되지 않는 경우에는 48시간 정도가 걸린다는 메세지가 나타난다.


    2-2. 무료 DNS 관리 서비스를 이용한 손쉬운 네임서버 변경 및 수정, 소유권 증명하기

    이 방법은 네임서버를 보유하고 있거나 시스템에 대해서 잘 알거나 관리자가 있거나 하는 경우에 사용한다. 만일 이같은 조건에 부합하지 않다면, 무료로 DNS 관리 서비스를 제공하는 곳을 이용하여 몇가지 조치를 해주어도 동일한 효과를 얻을 수 있다.

    웹호스팅을 받고 있는 경우라면, 해당 호스팅 회사에 dns 를 수정해 달라고 요청하면 된다.
    호스팅업체에 특별히 미움을 받거나 한 경우가 아니라면 필요한 부분을 수정해줄 것이다. ^^


    2-2-1. [참고] 무료 DNS 서비스 가입하기

    아래 사이트에 가입하면 무료 DNS 서비스를 이용할 수 있다.
    (당연히 나와는 아무런 관련 없는 사이트다).  
    http://kr.dnsever.com/ 

    이곳 말고도 무료 DNS 서비스를 제공하는 업체는 더 있다. 꼭 이곳이 아니어도 된다.
    이곳의 사용법은 해당 사이트에서 살펴 보시고 여기서는 필요한 부분만 간단히 설명한다.

    - 가입하신후 도메인을 추가 한다. exmydo.com 을 추가
    - 도메인의 네임서버를 dnsever 에서 요구하는 것으로 먼저 변경
    - 메일서버(MX) 관리 메뉴에서 메일서버를 추가
    - 고급기능 메뉴에서 도메인별명(CNAME) 관리에서 위의 CNAME 레코드 변경 등의
       수정이 가능하다.
       (자세한 내용은 2-3-3 참조)



    2-3. 메일서버 지정

    도메인소유권 증명이 끝나면 메일을 정상적으로 사용하기 위해 메일서버를 설정해야 한다.
    위의 작업들과 중복되는 게 있으므로, 네임서버 수정 등을 할 때 아래 작업까지 한꺼번에 처리하면 편리할 것이다. 메일서버 설정 작업은 도메인소유권 증명이 완료되는 것과는 상관없이 미리 처리해 두는 것이 좋다.

    - 다시 서비스 설정메뉴로 접속 (위의 2-1. 참고)

    뉴스로그


    - 이메일 항목에서 [이메일 활성화]를 누른다.

    메일서버를 어떻게 지정하여야 하는지에 대한 자세한 설명이 나타난다.
    이미 서버관리자 또는 이에 대한 이해가 가능한 경우에는 이때 나오는 설명을 참고하여 처리하면 된다.
    아래는 이에 대한 필요한 부분만을 단순히 정리하여 열거한 것이다.

    2-3-1. zone 파일을 직접 수정할수 있다면 아래 처럼 수정한다.
    (위에서 가입한 dnsever.com 을 이용하려면 아래 2-3-2 를 참고 한다)

    뉴스로그


    예컨대, zone 파일에 아래와 같이 내용을 추가한다.

    exmydo.com. IN MX 1 ASPMX.L.GOOGLE.COM.
    exmydo.com. IN MX 5 ALT1.ASPMX.L.GOOGLE.COM.
    exmydo.com. IN MX 5 ALT2.ASPMX.L.GOOGLE.COM.
    exmydo.com. IN MX 10 ASPMX2.GOOGLEMAIL.COM.
    exmydo.com. IN MX 10 ASPMX3.GOOGLEMAIL.COM.
    exmydo.com. IN MX 10 ASPMX4.GOOGLEMAIL.COM.
    exmydo.com. IN MX 10 ASPMX5.GOOGLEMAIL.COM.

    뉴스로그



    2-3-2. 위에서 소개한 dnsever.com 을 이용하는 경우 아래와 같이 조치하면 된다.

    - dnsever.com 에 접속한다.
    - 해당 도메인을 선택한다(아직 추가하지 않았다면 사용할 도메인을 추가한다).
    - 메일서버(MX)관리 메뉴에 접속
    - [도메인(또는 호스트이름)] 항목은 그대로 두고 [메일서버] 와 [우선순위]에 아래와
    같이 차례로 추가한다.

    뉴스로그


    그러면 아래와 같은 방식이 된다.

    뉴스로그


    이상을 마치면 보통 늦어도 하루 정도가 지나면 정상적으로 적용된다.


    2-3-3. dnsever 에서 CNAME 레코드 추가

    - dnsever.com 에 접속한다.
    - 해당 도메인을 선택한다.(아직 추가 안했다면 사용할 도메인을 추가한다)
    - 고급기능 메뉴에서 도메인별명(CNAME)관리 선택
    - 도메인 소유권 확인을 위해
       [도메인별명]에 google8ffca4c5464de85f 입력후
       실제도메인은 [직접입력] 선택.
       별명(CNAME)추가.
       도메인은 google.com 입력
    - 메일서버 편리한 접속을 위해
       [도메인별명]에 mail 입력후 
       실제도메인은 [직접입력] 선택.
       별명(CNAME)추가.
       도메인은 ghs.google.com 입력

    뉴스로그



    모든 설정이 마무리 되었다.
    여기까지 정상적으로 진행했다면 이제 멋지게 이메일을 사용하는 일만 남았다.


    3. 구글 메일 사용하기

    이상과 같이 지정된 경우 mail.exmydo.com 으로 접속 가능하다.
    아니면 www.google.com/a/exmydo.com 으로 접속 한다.

    관리계정을 입력하고 접속 한다. 처음 만든 계정이 관리 계정으로 설정되어 있다.
    메일은 계정 생성 후 즉시 발송이 가능하다.
    수신은 메일 계정이 활성화된 후(zone 파일 수정이 적용된 후) 가능하다.
    * 수신과 발송 기능을 반드시 테스트해 보시기 바란다.

    모든 서비스가 정상이 되면 [운영중] 이라는 메세지가 나타난다.


    사용자 삽입 이미지




    위와 같은 화면이 나타났는가? 그렇다면 성공한 것이다.

    인터넷 즐겁게 사용하시고,
    가.끔.씩.(빵상 아줌마 버전으로 읽어주세요~ ^^) 뉴스로그에도 들러주시길.. ^^  



    P.S. 이상을 성공적으로 수행한 유저라면
    캘린더, 오피스를 비롯한 구글의 다른 어플리케이션들도 한번씩 관심을 가져봄직하겠다.


    Posted by 1010
    98..Etc/PHP2009. 1. 29. 16:54
    반응형
    Posted by 1010
    98..Etc/Tomcat2009. 1. 29. 13:13
    반응형
    ache Load balancing && Terracotta Sessions Clustering


    Apache 2.2.11 + (proxy_ajp, proxy_balancer) + Tomcat 5.5.27 + Terracotta 2.7.2

    어제 오늘 열라 삽질한 결과물 입니다.

    상용와스 사용하며 개발만 하다보니...

    아파치 톰켓 제대로 세팅할 일도 없었고...

    Load balancing 할 일은 더욱이 없었고..

    Sessions Clustering 할 일은 더더욱 없었는데...


    이번에 고객이 와스를 구입 하지 않는 데다..

    사이트 두개의 세션을 공유시켜 달라고 해서...

    이참에 한 번 세팅해보자 해서.. 시도해봤습니다...


    짧은 실력에 더 짧은 영어 실력까지 함께하다 보니...

    삽질의 연속.. -_-;;


    삽질 해서 돌아가게는 했는데...

    저도 이해하고 한게 아니라서... 뭐라 설명 드리긴 뭐 하구요...

    혹시 필요하신 분들 있으실까봐...

    올려 봅니다...

    나~ 중에 어느분이 더 나은 세팅법을 공유해 주시길 바라며.. 이만.. ^^;;



    =========================== 설치파일 ===========================
    jdk-1_5_0_17-windows-i586-p.exe
    apache_2.2.11-win32-x86-no_ssl.msi
    apache-tomcat-5.5.27.zip
    terracotta-generic-2.7.2.tar.gz



    =========================== 설치 디렉토리 ===========================
    C:\Program Files\Java\jdk1.5.0_17
    D:\test\Apache2.2
    D:\test\apache-tomcat-5.5.27
    D:\test\terracotta-2.7.2



    =========================== System Path 설정 ===========================
    JAVA_HOME=C:\Program Files\Java\jdk1.5.0_17
    TC_INSTALL_DIR=D:\test\terracotta-2.7.2
    CATALINA_HOME=D:\test\apache-tomcat-5.5.27



    =========================== 호스트파일에 추가 ===========================
    C:\WINDOWS\system32\drivers\etc\hosts

    127.0.0.1   server1.example.com
    127.0.0.1   server2.example.com



    =========================== 아파치 설정 ===========================
    D:\test\Apache2.2\conf\httpd.conf

    # LoadModule -- 주석을 푼다.
        LoadModule proxy_module modules/mod_proxy.so
        LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
        LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
        LoadModule rewrite_module modules/mod_rewrite.so

    # Virtual hosts -- 주석을 푼다.
        Include conf/extra/httpd-vhosts.conf


    =========================== 아파치 가상호스트 설정 ===========================
    D:\test\Apache2.2\conf\extra\httpd-vhosts.conf

    NameVirtualHost *:80

    <VirtualHost *:80>
        ServerAdmin server1@example.com

        ServerName server1.example.com
        ServerAlias server2.example.com

        ErrorLog "logs/server1.example.com-error.log"
        CustomLog "logs/server1.example.com-access.log" common

        DocumentRoot "D:/test/sample/WebContent"

        <Directory />
            Options FollowSymLinks
            AllowOverride None
        </Directory>

        <Location /*>
            ProxyPass balancer://tomcat_cluster stickysession=JSESSIONID
        </Location>

        ## mod_proxy_balancer
        ## 필요한 만큼 BalancerMember를 추가하면 자동으로 분산 요청
        ## 아래 주소는 단지 예시일 뿐
        ##
        <Proxy balancer://tomcat_cluster>
            BalancerMember ajp://127.0.0.1:9071 route=tomcat1 loadfactor=50
            BalancerMember ajp://127.0.0.1:9072 route=tomcat2 loadfactor=50
        </Proxy>

        <Directory "D:/test/sample/WebContent">
            Options Indexes FollowSymLinks
            AllowOverride None
            Order allow,deny
            Allow from all

            ## jsp 파일도 index 파일로 추가
            ##
            DirectoryIndex index.html index.jsp

            ## Rewrite를 이용해서 jsp 파일을 proxy_ajp로 Tomcat으로 넘기기
            ##
            RewriteEngine On
            RewriteCond %{REQUEST_URI} /servlet* [OR]
            RewriteCond %{REQUEST_FILENAME} .jsp
            RewriteRule (.*) balancer://tomcat_cluster/$1 [P]
        </Directory>

    </VirtualHost>



    =========================== 테라코타 설정파일 수정 ===========================

    D:\test\terracotta-2.7.2\tools\sessions\configurator-sandbox\tomcat5.5\tc-config.xml

    server host 에 테라코타 서버가 설치된 아이피 입력

    ...
      <servers>
        <server host="127.0.0.1" name="sample">
          <data>data/server-data</data>
          <logs>logs/server-logs</logs>
        </server>
        <update-check>
          <enabled>true</enabled>
        </update-check>
      </servers>
    ...

    ...
          <web-applications>
            <web-application>ROOT</web-application>
            <!--
            <web-application>Cart</web-application>
            <web-application>DepartmentTaskList</web-application>
            <web-application>Townsend</web-application>
            -->
          </web-applications>

    ...


    D:\test\terracotta-2.7.2\tools\sessions\configurator-sandbox\tomcat5.5\start.bat

    세션을 공유할 도메인 입력(server1.example.com 과 server2.example.com 이 세션을 공유해야 하는 경우에만 필요함)

    ...
    set OPTS=%TC_JAVA_OPTS% -Dwebserver.log.name=tomcat-%1
    set OPTS=%OPTS% -Dcom.sun.management.jmxremote
    set OPTS=%OPTS% -Dproject.name=Configurator
    set OPTS=%OPTS% -Dcom.tc.session.cookie.domain=.example.com
    set JAVA_OPTS=%OPTS% %JAVA_OPTS%
    ...


    =========================== 톰켓 server.xml 수정 ===========================

    D:\test\terracotta-2.7.2\tools\sessions\configurator-sandbox\tomcat5.5\9081\conf\server.xml

    <Server port="9051" shutdown="SHUTDOWN">
      <Service name="Catalina">

        <!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
        <Connector port="9081" maxHttpHeaderSize="8192"
                   maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
                   enableLookups="false" redirectPort="8443" acceptCount="100"
                   connectionTimeout="20000" disableUploadTimeout="true" />

        <!-- Define an AJP 1.3 Connector on port 8009 -->
        <Connector port="9071"
                   enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />

        <Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat1">
          <Host name="localhost" appBase="webapps"
                unpackWARs="true" autoDeploy="true"
                xmlValidation="false" xmlNamespaceAware="false">
            <Context path="/" reloadable="true" docBase="D:\test\sample\WebContent" workDir="work" />
          </Host>
        </Engine>
      </Service>
    </Server>


    D:\test\terracotta-2.7.2\tools\sessions\configurator-sandbox\tomcat5.5\9082\conf\server.xml

    <Server port="9052" shutdown="SHUTDOWN">
      <Service name="Catalina">

        <!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
        <Connector port="9082" maxHttpHeaderSize="8192"
                   maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
                   enableLookups="false" redirectPort="8443" acceptCount="100"
                   connectionTimeout="20000" disableUploadTimeout="true" />

        <!-- Define an AJP 1.3 Connector on port 8009 -->
        <Connector port="9072"
                   enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />

        <Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat2">
          <Host name="localhost" appBase="webapps"
                unpackWARs="true" autoDeploy="true"
                xmlValidation="false" xmlNamespaceAware="false">
            <Context path="/" reloadable="true" docBase="D:\test\sample\WebContent" workDir="work" />
          </Host>
        </Engine>
      </Service>
    </Server>


    =========================== 셈플소스 복사 ===========================

    D:\test\terracotta-2.7.2\tools\sessions\configurator-sandbox\tomcat5.5\9081\webapps\Cart

    하위의 소스를 아래 디렉토리로 복사

    D:\test\sample\WebContent


    =========================== 테라코타 서버 실행 ===========================
    D:\test\terracotta-2.7.2\bin>start-tc-server.bat

    =========================== 아파치 서버 실행 ===========================
    Apache Service Monitor [start] 버튼 클릭

    =========================== 톰켓 서버(테라코타 클라이언트) 실행 ===========================
    D:\test\terracotta-2.7.2\tools\sessions\configurator-sandbox\tomcat5.5>start.bat 9081
    D:\test\terracotta-2.7.2\tools\sessions\configurator-sandbox\tomcat5.5>start.bat 9082


    =========================== 잘 돌아가는가 확인 ===========================
    http://server1.example.com/carts.jsp
    http://server2.example.com/carts.jsp


    =========================== 끝!!! ===========================



    참고 사이트들....


    http://www.javaservice.net/~java/bbs/read.cgi?m=&b=qna2&c=r_p&n=1224247277&p=7&s=d

    http://okjsp.pe.kr/seq/127429

    http://www.ibm.com/developerworks/kr/library/opendw/20071231/

    http://www.terracotta.org/web/display/orgsite/Tomcat+Integration#TomcatIntegration-SessionContinuityAcrossServers

    http://www.terracotta.org/web/display/orgsite/Sessions+Quick+Start#SessionsQuickStart-UnclusteredWebApplications


    http://judy98.tistory.com/116

    http://wiki.kldp.org/wiki.php/Apache2Tomcat5Howto2

    http://openframework.or.kr/Wiki.jsp?page=Apache_tomcat_using_modproxy_on_windows#section-Apache_tomcat_using_modproxy_on_windows-_EB_AA_A8_EB_93_88_ED_99_95_EC_9D_B8

    http://www.okjsp.pe.kr/seq/130244

    http://www-128.ibm.com/developerworks/kr/library/opendw/20061017/#main

    http://www.javamania.pe.kr/zbxe/?sort_index=voted_count&order_type=desc&mid=qna&comment_srl=4920&listStyle=webzine&document_srl=2895

    http://sakuragis.egloos.com/4590029

    http://hmjkor.tistory.com/tag/Apache2

    http://theeye.pe.kr/entry/Proxt-AJP-mod_rewrite%B8%A6-%C0%CC%BF%EB%C7%CF%BF%A9-Apache-22-Tomcat-%BF%CF%BA%AE-%BF%AC%B5%BF%C7%CF%B1%E2

    http://www.superuser.co.kr/home/edu/offline/gnu3/?doc=bbs/gnuboard.php&bo_table=review_sw&mode=body&page=1&wr_id=33&mode=body

    http://leadingkorea.kr/62

    http://forcemax.tistory.com/69

    외 다수~~~~~~~~

    Posted by 1010
    98..Etc/shell script2009. 1. 28. 18:01
    반응형
    제1장 Bash Shell 들어가기

     

                        제1.1장 쉘 스크립트 파일을 만들기

     

                        제1.2장 기본 문법

     

                        제1.3장 디버깅

     

                제2장 기존 쉘 스크립트 파일의 분석

     

                        제2.1장 crond(/etc/rc.d/init.d/crond)

     

                        제2.2장 httpd(/etc/rc.d/init.d/httpd)

     

                제3장 로그인 과정에서의 쉘 스크립트

     

                       제3.1장 로그인 과정

     

                       제3.2장 ~/.bash_profile

     

                        제3.3장 ~/.bashrc

     

                        제3.4장 /etc/bashrc

     

                        제3.5장 /etc/profile

     

                제4장 FTP 접속 스크립트

     

                제5장 메일링리스트를 이용하여 메일 보내기

     

                제6장 파일 관리

     

                        제6.1장 파일이름을 한 번에 변경하기

     

                        제6.2장 원하는 부분의 내용만 변경하기

     

                        제6.3장 디렉토리별로 파일 목록 정리하기

     

                제7장 자동 백업 스크립트

     

                        제7.1장 단순 백업

     

                        제7.2장 백업 기능의 확장

     

                        제7.3장 MySQL 백업

     

                제8장 웹 호스팅 계정 자동 추가 스크립트

    Posted by 1010
    98..Etc/shell script2009. 1. 28. 17:59
    반응형

    고급 Bash 스크립팅 가이드

    Bash를 이용한 쉘 스크립팅 완전 가이드

    Mendel Cooper

    Brindlesoft

    thegrendel (at) theriver.com

    차현진

    terminus (at) kldp.org

    2001년 12월 16일

    본 튜토리얼은 여러분이 Bash에 대해서 어떠한 사전 지식도 없다고 가정을 합니다만, 금방 중/고급 수준의 명령어들을 소개합니다(...유닉스의 슬기롭고 교훈적인 부분들을 배워 나가면서). 이 문서는 교과서나, 혼자 공부할 때 볼 수 있는 메뉴얼, 쉘 스크립팅 기술에 대한 레퍼런스및 소스로 쓰일 수 있습니다. 스크립트를 배우는 유일한 방법은 스크립트를 직접 짜 보는 것이다라는 전제하에, 연습문제와 아주 자세하게 주석 처리된 예제들로 능동적인 독자들의 참여를 유도할 것입니다.

    이 문서의 최신 버전은 저자의 홈페이지에서 SGML 소스와 HTML을 "타르볼"형태로 얻을 수 있습니다. 고침 변경 사항은 change log를 참고하세요.

    고친 과정
    고침 0.1 2000년 6월 14일 고친이 mc
    초기 릴리스.
    고침 0.2 2000년 10월 30일 고친이 mc
    버그 수정, 내용및 예제 스크립트 추가.
    고침 0.3 2001년 2월 12일 고친이 mc
    메이저 업데이트.
    고침 0.4 2001년 7월 8일 고친이 mc
    버그 수정, 더 많은 내용및 예제 추가 - 완전한 책 형태의 개정판.
    고침 0.5 2001년 9월 3일 고친이 mc
    메이저 업데이트. 버그 수정, 내용 추가, 장과 절을 재편성.
    고침 1.0.11 2001년 12월 16일 고친이 mc
    버그 수정, 재편성, 내용 추가. Stable release.

    바치는 글

    모든 마법의 근원인 Anita에게 이 책을 바칩니다.

    차례
    Part 1. 소개
    1. 왜 쉘 프로그래밍을 해야 하죠?
    2. #! 으로 시작하기
    2.1. 스크립트 실행하기
    2.2. 몸풀기 연습문제(Preliminary Exercises)
    Part 2. 기초 단계
    3. 종료와 종료 상태(Exit and Exit Status)
    4. 특수 문자
    5. 변수와 매개변수 소개
    5.1. 변수 치환(Variable Substitution)
    5.2. 변수 할당(Variable Assignment)
    5.3. Bash 변수는 타입이 없다(untyped)
    5.4. 특수한 변수 타입
    6. 쿼우팅(quoting)
    7. 테스트
    7.1. 테스트(Test Constructs)
    7.2. 파일 테스트 연산자
    7.3. 비교 연산자(이진)
    7.4. 중첩된 if/then 조건 테스트
    7.5. 여러분이 테스트문을 얼마나 이해했는지 테스트 해보기
    8. 연산자 이야기(Operations and Related Topics)
    8.1. 연산자(Operators)
    8.2. 숫자 상수(Numerical Constants)
    Part 3. 중급 단계(Beyond the Basics)
    9. 변수 재검토(Variables Revisited)
    9.1. 내부 변수(Internal Variables)
    9.2. 문자열 조작
    9.3. 매개변수 치환(Parameter Substitution)
    9.4. 변수 타입 지정: declaretypeset
    9.5. 변수 간접 참조
    9.6. $RANDOM: 랜덤한 정수 만들기
    9.7. 이중소괄호(The Double Parentheses Construct)
    10. 루프와 분기(Loops and Branches)
    10.1. 루프
    10.2. 중첩된 루프
    10.3. 루프 제어
    10.4. 테스트와 분기(Testing and Branching)
    11. 내부 명령어(Internal Commands and Builtins)
    11.1. 작업 제어 명령어
    12. 외부 필터, 프로그램, 명령어
    12.1. 기본 명령어
    12.2. 복잡한 명령어
    12.3. 시간/날짜 명령어
    12.4. 텍스트 처리 명령어
    12.5. 파일, 아카이브(archive) 명령어
    12.6. 통신 명령어
    12.7. 터미널 제어 명령어
    12.8. 수학용 명령어
    12.9. 기타 명령어
    13. 시스템과 관리자용 명령어
    14. 명령어 치환(Command Substitution)
    15. 산술 확장(Arithmetic Expansion)
    16. I/O 재지향
    16.1. exec 쓰기
    16.2. 코드 블럭 재지향
    16.3. 응용
    17. Here Documents
    18. 쉬어가기
    Part 4. 고급 주제들(Advanced Topics)
    19. 정규 표현식(Regular Expressions)
    19.1. 정규 표현식의 간략한 소개
    19.2. Globbing
    20. 서브쉘(Subshells)
    21. 제한된 쉘(Restricted Shells)
    22. 프로세스 치환(Process Substitution)
    23. 함수
    23.1. 복잡 함수와 함수의 복잡성(Complex Functions and Function Complexities)
    23.2. 지역 변수와 재귀 함수(Local Variables and Recursion)
    24. 별칭(Aliases)
    25. 리스트(List Constructs)
    26. 배열
    27. 파일들
    28. /dev 와 /proc
    28.1. /dev
    28.2. /proc
    29. 제로와 널(Of Zeros and Nulls)
    30. 디버깅
    31. 옵션
    32. 몇 가지 지저분한 것들(Gotchas)
    33. 스타일 있게 스크립트 짜기
    33.1. 비공식 쉘 스크립팅 스타일시트
    34. 자질구레한 것들
    34.1. 대화(interactive)형 모드와 비대화(non-interactive)형 모드 쉘과 스크립트
    34.2. 쉘 래퍼(Shell Wrappers)
    34.3. 테스트와 비교: 다른 방법
    34.4. 최적화
    34.5. 팁 모음(Assorted Tips)
    34.6. 괴상한 것(Oddities)
    34.7. 이식성 문제(Portability Issues)
    34.8. 윈도우즈에서의 쉘 스크립팅
    35. Bash, 버전 2
    36. 후기(Endnotes)
    36.1. 저자 후기(Author's Note)
    36.2. 저자에 대해서
    36.3. 이 책을 만드는데 쓴 도구들
    36.3.1. 하드웨어
    36.3.2. 소프트웨어와 프린트웨어
    36.4. 크레딧
    서지사항
    A. 여러분들이 보내준 스크립트들(Contributed Scripts)
    B. Sed 와 Awk 에 대한 간단한 입문서
    B.1. Sed
    B.2. Awk
    C. 특별한 의미를 갖는 종료 코드
    D. I/O와 I/O 재지향에 대한 자세한 소개
    E. 지역화(Localization)
    F. 샘플 .bashrc 파일
    G. 도스(DOS) 배치 파일을 쉘 스크립트로 변환
    H. 연습문제
    I. Copyright
    예 목록
    2-1. cleanup: /var/log 에 있는 로그 파일들을 청소하는 스크립트
    2-2. cleanup: 위 스크립트의 향상되고 일반화된 버전.
    3-1. 종료/종료 상태
    3-2. !으로 조건을 부정하기
    4-1. 코드 블럭과 I/O 재지향
    4-2. 코드 블럭의 결과를 파일로 저장하기
    4-3. 최근 하루동안 변경된 파일들을 백업하기
    5-1. 변수 할당과 치환
    5-2. 평범한 변수 할당
    5-3. 평범하고 재미있는 변수 할당
    5-4. 정수? 문자열?
    5-5. 위치 매개변수
    5-6. wh, whois 도메인 네임 룩업
    5-7. shift 쓰기
    6-1. 이상한 변수를 에코하기
    6-2. 이스케이프된 문자들
    7-1. 무엇이 참인가?
    7-2. [ ]test 의 동일함
    7-3. (( ))로 산술식 테스트 하기
    7-4. 산술 비교와 문자열 비교
    7-5. 문자열이 인지 테스트 하기
    7-6. zmost
    8-1. 산술 연산자 쓰기
    8-2. && 와 || 를 쓴 복합 조건 테스트
    8-3. 숫자 상수 표기법:
    9-1. $IFS 와 빈 칸
    9-2. 타임 아웃 처리 입력
    9-3. 타임 아웃 처리 입력, 한 번 더
    9-4. 내가 루트인가?
    9-5. arglist: $* 과 $@ 로 인자를 나열하기
    9-6. 일관성 없는 $*$@의 동작
    9-7. $IFS 가 비어 있을 때 $*$@
    9-8. 밑줄 변수(underscore variable)
    9-9. 그래픽 파일을 다른 포맷 확장자로 이름을 바꾸면서 변환
    9-10. 매개변수 치환과 : 쓰기
    9-11. 변수의 길이
    9-12. 매개변수 치환에서의 패턴 매칭
    9-13. 파일 확장자 바꾸기:
    9-14. 임의의 문자열을 파싱하기 위해 패턴 매칭 사용하기
    9-15. 문자열의 접두, 접미어에서 일치하는 패턴 찾기
    9-16. declare를 써서 변수 타입 지정하기
    9-17. 간접 참조
    9-18. awk에게 간접 참조를 넘기기
    9-19. 랜덤한 숫자 만들기
    9-20. RANDOM 으로 주사위를 던지기
    9-21. RANDOM 에 seed를 다시 지정해 주기
    9-22. C 형태의 변수 조작
    10-1. 간단한 for 루프
    10-2. 각 [list] 항목이 인자를 두 개씩 갖는 for
    10-3. Fileinfo: 변수에 들어 있는 파일 목록에 대해 동작
    10-4. for 문에서 파일 조작하기
    10-5. in [list]가 빠진 for
    10-6. for 문의 [list]에 명령어 치환 쓰기
    10-7. 이진 파일에 grep 걸기
    10-8. 특정 디렉토리의 모든 바이너리 파일에 대해 원저작자(authorship)를 확인 하기
    10-9. 디렉토리에 들어 있는 심볼릭 링크들을 나열하기
    10-10. 디렉토리에 들어 있는 심볼릭 링크들을 파일로 저장하기
    10-11. C 형태의 for 루프
    10-12. 배치 모드로 efax 사용하기
    10-13. 간단한 while 루프
    10-14. 다른 while 루프
    10-15. 다중 조건 while 루프
    10-16. C 형태의 문법을 쓰는 while 루프
    10-17. until 루프
    10-18. 중첩된 루프
    10-19. 루프에서 breakcontinue의 영향
    10-20. 여러 단계의 루프에서 탈출하기
    10-21. 더 상위 루프 레벨에서 계속하기(continue)
    10-22. case 쓰기
    10-23. case로 메뉴 만들기
    10-24. case용 변수를 만들기 위해서 명령어 치환 쓰기
    10-25. 간단한 문자열 매칭
    10-26. 입력이 알파벳인지 확인하기
    10-27. select로 메뉴 만들기
    10-28. 함수에서 select를 써서 메뉴 만들기
    11-1. printf가 실제로 쓰이는 예제
    11-2. read로 변수 할당하기
    11-3. read로 여러줄의 입력 넣기
    11-4. read파일 재지향과 같이 쓰기
    11-5. 현재 작업 디렉토리 변경하기
    11-6. let으로 몇 가지 산술 연산을 하기.
    11-7. eval의 효과 보여주기
    11-8. 강제로 로그 아웃 시키기
    11-9. "rot13" 버전
    11-10. 위치 매개변수와 set 쓰기
    11-11. 변수를 "언셋"(unset) 하기
    11-12. export를 써서, 내장된 awk 스크립트에 변수를 전달하기
    11-13. getopts로 스크립트로 넘어온 옵션과 인자 읽기
    11-14. 데이타 파일 "포함하기"
    11-15. exec 효과
    11-16. 작업을 계속 해 나가기 전에 프로세스가 끝나길 기다리기
    12-1. CDR 디스크를 구울 때 ls로 목차 만들기
    12-2. Badname, 파일 이름에 일반적이지 않은 문자나 공백 문자를 포함하는 파일을 지우기.
    12-3. inode 로 파일을 지우기
    12-4. 시스템 로그 모니터링용 xargs 로그 파일
    12-5. copydir. xargs로 현재 디렉토리를 다른 곳으로 복사하기
    12-6. expr 쓰기
    12-7. date 쓰기
    12-8. 스크립트에서 두 파일을 비교하기 위해 cmp 쓰기.
    12-9. 낱말 빈도수 분석
    12-10. 10자리 랜덤한 숫자 만들기
    12-11. tail로 시스템 로그를 모니터하기
    12-12. 스크립트에서 "grep"을 에뮬레이트 하기
    12-13. 목록에 들어 있는 낱말들의 유효성 확인하기
    12-14. toupper: 파일 내용을 모두 대문자로 바꿈.
    12-15. lowercase: 현재 디렉토리의 모든 파일명을 소문자로 바꿈.
    12-16. du: 도스용 텍스트 파일을 UNIX용으로 변환.
    12-17. rot13: 초허접(ultra-weak) 암호화, rot13.
    12-18. "Crypto-Quote" 퍼즐 만들기
    12-19. 파일 목록 형식화.
    12-20. column 으로 디렉토리 목록을 형식화 하기
    12-21. nl: 자기 자신에게 번호를 붙이는 스크립트.
    12-22. cpio로 디렉토리 트리 옮기기
    12-23. rpm 아카이브 풀기
    12-24. C 소스에서 주석을 제거하기
    12-25. /usr/X11R6/bin 둘러보기
    12-26. basenamedirname
    12-27. 인코드된 파일을 uudecode하기
    12-28. 저당에 대한 월 상환액(Monthly Payment on a Mortgage)
    12-29. 진법 변환(Base Conversion)
    12-30. 다른 방법으로 bc 실행
    12-31. seq로 루프에 인자를 만들어 넣기
    12-32. 키보드 입력을 갈무리하기
    12-33. 파일을 안전하게 지우기
    12-34. m4 쓰기
    13-1. 지움 글자(erase character) 세팅하기
    13-2. 비밀스런 비밀번호: 터미널 에코 끄기
    13-3. 키누름 알아내기
    13-4. pidof 로 프로세스를 죽이기
    13-5. CD 이미지 확인하기
    13-6. 한 파일에서 한번에 파일 시스템 만들기
    13-7. 새 하드 드라이브 추가하기
    13-8. killall, /etc/rc .d/init.d 에서 인용
    16-1. exec으로 표준입력을 재지향 하기
    16-2. 재지향된 while 루프
    16-3. 다른 형태의 재지향된 while 루프
    16-4. 재지향된 until 루프
    16-5. 재지향된 for 루프
    16-6. 재지향된 for 루프(표준입력, 표준출력 모두 재지향됨)
    16-7. 재지향된 if/then 테스트
    16-8. 이벤트 로깅하기
    17-1. dummyfile: 두 줄짜리 더미 파일 만들기
    17-2. broadcast: 로그인 해 있는 모든 사람들에게 메세지 보내기
    17-3. cat으로 여러 줄의 메세지 만들기
    17-4. 탭이 지워진 여러 줄의 메세지
    17-5. Here document에서 매개변수 치환하기
    17-6. 매개변수 치환 끄기
    17-7. upload: "Sunsite" incoming 디렉토리에 파일 한 쌍을 업로드
    17-8. "아무개"(anonymous) Here Document
    20-1. 서브쉘에서 변수의 통용 범위(variable scope)
    20-2. 사용자 프로파일 보기
    20-3. 프로세스를 서브쉘에서 병렬로 돌리기
    21-1. 제한된 모드로 스크립트 돌리기
    23-1. 간단한 함수
    23-2. 매개변수를 받는 함수
    23-3. 두 숫자중 큰 수 찾기
    23-4. 숫자를 로마 숫자로 바꾸기
    23-5. 함수에서 큰 값을 리턴하는지 테스트하기
    23-6. 큰 두 정수 비교하기
    23-7. 사용자 계정 이름에서 실제 이름을 알아내기
    23-8. 지역 변수의 영역(Local variable visibility)
    23-9. 지역 변수를 쓴 재귀 함수
    24-1. 스크립트에서 쓰이는 별칭(alias)
    24-2. unalias: 별칭을 설정, 해제하기
    25-1. "and list"를 써서 명령어줄 인자 확인하기
    25-2. "and list"를 써서 명령어줄 인자를 확인하는 다른 방법
    25-3. "or lists""and list"를 같이 쓰기
    26-1. 간단한 배열 사용법
    26-2. 배열의 특별한 특성 몇 가지
    26-3. 빈 배열과 빈 원소
    26-4. 아주 오래된 친구: 버블 정렬(Bubble Sort)
    26-5. 복잡한 배열 어플리케이션: 에라토스테네스의 체(Sieve of Erastosthenes)
    26-6. 복잡한 배열 어플리케이션: 기묘한 수학 급수 탐색(Exploring a weird mathematical series)
    26-7. 2차원 배열을 흉내낸 다음, 기울이기(tilting it)
    28-1. 특정 PID와 관련있는 프로세스 찾기
    28-2. 온라인 연결 상태
    29-1. 쿠키 항아리를 숨기기
    29-2. /dev/zero로 스왑 파일 세팅하기
    29-3. 램디스크 만들기
    30-1. 버그 있는 스크립트
    30-2. test24, 버그가 있는 다른 스크립트
    30-3. "assert"로 조건을 테스트하기
    30-4. exit 잡아채기(Trapping at exit)
    30-5. Control-C 가 눌렸을 때 깨끗이 청소하기
    30-6. 변수 추적하기
    32-1. 서브쉘 함정(Subshell Pitfalls)
    34-1. 쉘 래퍼(shell wrapper)
    34-2. 조금 복잡한 쉘 래퍼(shell wapper)
    34-3. awk 스크립트 쉘 래퍼(shell wrapper)
    34-4. Bash 스크립트에 내장된 펄
    34-5. 하나로 묶인 Bash 스크립트와 펄 스크립트
    34-6. 자신을 재귀적으로 부르는 스크립트
    35-1. 문자열 확장
    35-2. 간접 변수 참조 - 새로운 방법
    35-3. 배열과 약간의 트릭을 써서 한 벌의 카드를 4명에게 랜덤하게 돌리기
    A-1. manview: 포맷된 맨 페이지를 보는 스크립트
    A-2. mailformat: 이메일 메세지를 포맷해서 보기
    A-3. rn: 간단한 파일이름 변경 유틸리티
    A-4. encryptedpw: 로컬에 암호화 되어 있는 비밀번호로 ftp 사이트에 파일을 업로드하는 스크립트
    A-5. copy-cd: 데이타 CD를 복사하는 스크립트
    A-6. days-between: 두 날짜 사이의 차이를 계산해 주는 스크립트
    A-7. behead: 메일과 뉴스 메세지 헤더를 제거해 주는 스크립트
    A-8. ftpget: ftp에서 파일을 다운로드 해 주는 스크립트
    A-9. password: 8 글자짜리 랜덤한 비밀번호 생성 스크립트
    A-10. fifo: 네임드 파이프를 써서 매일 백업해 주는 스크립트
    A-11. 나머지 연산자로 소수 생성하기
    A-12. tree: 디렉토리 구조를 트리 형태로 보여주는 스크립트
    A-13. 문자열 함수들: C 형태의 문자열 함수
    A-14. 객체 지향 데이타 베이스
    F-1. 샘플 .bashrc 파일
    G-1. VIEWDATA.BAT: 도스용 배치 파일
    G-2. viewdata.sh: VIEWDATA.BAT 의 스크립트 버전
    Posted by 1010
    98..Etc/weblogic2009. 1. 28. 16:27
    반응형
    웹로직에는 production mode와 development mode라는게 있다. 나도 잘 모르지만 대충 말하면 프로덕션 모드는 실제 서비스를 하는거고 development mode는 개발단계에서 쓰는거다. 개발단계에서 쓰므로 class파일을 교체해도 자동으로 리로드를 해주기 때문에 class파일을 재컴파일해도 바로 변경사항을 확인할 수 있다. production mode에서는 웹로직을 리스타트 해주어야 class 변경사항이 반영된다.

    개발할때는 당연히 development mode에서 해야겠지...

    C:\bea\user_projects\domains\mydomain\startWebLogic.cmd 파일을 보자.
    (물론 여기서 mydomain은 내가 정해준 domain이름이다. 전에 올린 웹로직 설치문서 참고....)

    set PRODUCTION_MODE=false

    로 설정을 해주면 development mode가 되고 class가 바로바로 적용된다.(이거 안해놓으면 개발할때 엄청 불편하다.)

    설정해주고 웹로직을 리스타해주면 된다. 물론 개발이 완료되고 서비스할때는 다시 true로...
    Posted by 1010
    98..Etc/weblogic2009. 1. 28. 16:26
    반응형
    JDBC를 이용해서 웹로직에서 제공하는 Data Source를 이용해서 DB 접속을 해보자. 웹로직에서 Data Source 설정을 해주어야 하는데 이건 웹로직 설치가이드 문서를 참고하기 바란다. 뒷부분에 보면 커넥션풀과 데이터소스를 설정하는 부분에 대해서 나와있다.

    사용자 삽입 이미지
    왼쪽 그림과 같이 설정이 되어야 한다.

    먼저 Connection Pools를 만들고 만들어진 Connection Pools(여기선 ibisPool)을 이용해서 Data Sources를 만든다.

    그리고 Java쪽에서는 만들어진 Data Sources(여기서는 ibisDS)를 사용하여 DB에 연결한다.





    디비 연결 클래스를 보자.

    1. // Weblogic DBConnection Class  
    2. import java.sql.Connection;  
    3. import javax.naming.Context;  
    4. import javax.naming.InitialContext;  
    5. import javax.naming.NamingException;  
    6. import javax.sql.DataSource;  
    7.  
    8. import java.sql.ResultSet;  
    9. import java.sql.PreparedStatement;  
    10. import java.sql.Statement;  
    11.  
    12. public class DBConnection {  
    13.  
    14.     public DBConnection() {  
    15.     }  
    16.  
    17.     public Connection getConnection() throws Exception {  
    18.         return getConnection("jdbc/ibisDS");  
    19.     }  
    20.  
    21.     public Connection getConnection(String dsName) throws Exception {  
    22.         Context ctx = null;  
    23.         DataSource ds = null;  
    24.         try {  
    25.             ctx = new InitialContext();  
    26.             ds = (DataSource) ctx.lookup(dsName);  
    27.         } catch (NamingException e) {  
    28.             e.printStackTrace();  
    29.             return null;  
    30.         } finally {  
    31.             try {  
    32.                 if (ctx != null)  
    33.                     ctx.close();  
    34.             } catch (NamingException ne) {  
    35.                 System.err.println("comm.util.conPoool : can't close context resource !!");  
    36.             }  
    37.         }  
    38.         return (Connection) ds.getConnection();  
    39.     }  
    40.  
    41.     public void disConnection(ResultSet rs, PreparedStatement pstmt, Statement cstmt, Connection conn) {  
    42.         try { if(rs   != null) rs.close()   ; rs    = null; } catch(Exception e) { rs    = null;}  
    43.         try { if(pstmt!= null) pstmt.close(); pstmt = null; } catch(Exception e) { pstmt = null;}  
    44.         try { if(cstmt!= null) cstmt.close(); cstmt = null; } catch(Exception e) { cstmt = null;}  
    45.         try { if(conn != null) conn.close() ; conn  = null; } catch(Exception e) { conn  = null;}  
    46.     }  
    47. }  

    기존의 JDBC 연결 클래스와 거의 동일하기 때문에 JDBC로 연결을 해본 사람이라면 웹로직에서도 크게 무리가 없으리라고 본다. (내가 그랬기 때문에.....)

    일단 생성자인 DBConnection()에서는 아무것도 안하고 있고 오버로딩된 메서드 getConnection()이 2개 정의 되어 있다. 데이터소스 이름을 던져주면 2번째것이 실행되어서 데이터소스에서 해당이름으로 된것이 있는지 검색해서 커넥션을 리턴하고 파라미터를 던지지 않으면 기본으로 설정된 ibisDS(위에서 만든 이름이다. 당연히 각자 웹로직에서 사용한 이름으로...)의 커넥션을 리턴해준다. disConnection메서드에서는 사용한 디비자원을 닫아준다.
    Posted by 1010
    98..Etc/Etc...2009. 1. 28. 16:20
    반응형
    리다이렉트는 현재페이지를 다른페이지로 보내는 것을 말한다. 포워드와는 다르게 리다이렉트는 클라이언트단에서(브라우저) 발생하게 되고 결과적으로 보면 새로운 URL로 요청이 다시 일어나도록 하는 것이다. 자바의 입장에서 보면 리다이렉트에는 3가지 방법이 있다.

    1. 메타태그 이용
      <meta http-equiv="refresh" content="0; url=http://www.google.co.kr">

    2. 자바스크립트 이용
      document.location.href= "http://www.google.co.kr";

    3. sendRedirect이용
      <%
          response.sendRedirect("http://www.google.co.kr");
      %>

    1,2번의 방법은 브라우저가 소스를 보고 판별해서 재요청을 하는것이고 3번째 방법은 전에 포스팅에 올렸던대로 header정보를 이용해서 브라우저가 리다이렉트를 하도록 서버쪽에서 코드를 심는 방법이다.(자바에선 이렇게 쓰고 헤더를 이용하는 방법은 다른 언어에도 있다.)

    나는 1번은 잘 사용안하고 보통 2번을 사용하거나 3번을 사용한다. 솔직히 그냥 그때 기분내키는대로?? ㅡ..ㅡ

    여러가지 용도가 있겠지만 가장 노말하고 일반적으로 쓰이는 곳이 게시판등의 글등록이 아닐까 싶다.

    등록폼 페이지 -> 등록 처리 페이지 -> 처리 후 이동할 페이지

    보통 이런 단계를 밟아서 페이지를 만든다. 이제 가장 노말한 형태이다. 등록폼에서 내용을 입력하고 submit을 누르면 등 등록처리 페이지에서 등록처리를 해서 DB에 넣고 alert() 메시지로 등록 성공 혹은 실패 메시지를 뿌려준 뒤에 상황에 맞는 페이지로 이동을 시킨다. 여기서 이동을 시킬때 리다이렉트를 할 필요가 있다. 이동자체야 큰 차이점은 없지만 사용자 입장에서 2번과 3번 방법에 큰 차이점이 있다.

    이 2가지 방법 사이에 가장 큰 차이점은 "뒤로가기"의 활성화 여부이다. 이건 UX적인 면에서 큰 차이점이라고 생각한다. 흔히들 많이 보았을 것이다. 처리후 이동한 페이지에서 뒤로가기 버튼을 누르면 등록처리페이지로 뒤로가기가 되서 다시 alert이 뜨고 처리후 이동페이지로 다시 오게되는 현상(또는 에러가 나거나...) 의도대로 하면 되겠지만 처리페이지는 DB저장등을 위해서 존재하는 페이지이기 때문에 뒤로가기과정에서는 나타나지 않는게 정상이 아닌가 싶다. 그래서 좀 정리를 해 봤다.

    자바스크립트 document.location.href= "http://www.google.co.kr";로 리다이렉트 했을 경우

    IE6 : 등록처리 페이지로 뒤로가기 된뒤 다시 alert뜨고 원래페이지로 다시 돌아옴
    IE7 : 등록처리 페이지로 뒤로가기 된뒤 다시 alert뜨고 원래페이지로 다시 돌아옴
    Firefox2 : 등록폼 페이지로 뒤로가기 됨
    Firefox3 : 등록폼 페이지로 뒤로가기 됨
    Opera 9 : 등록처리 페이지로 뒤로가기 되지만 스크립트는 실행되지 않음.
    Safari 3 : 등록처리 페이지로 뒤로가기 되지만 스크립트는 실행되지 않음.
    Chrome : 등록처리 페이지로 뒤로가기 되지만 Confirm Form Resubmission라는 에러나옴


    Http Header를 이용한 response.sendRedirect("http://www.google.co.kr");를 했을 경우

    IE6 : 등록폼 페이지로 뒤로가기 됨
    IE7 : 등록폼 페이지로 뒤로가기 됨
    Firefox2 : 등록폼 페이지로 뒤로가기 됨
    Firefox3 : 등록폼 페이지로 뒤로가기 됨
    Opera 9 : 등록폼 페이지로 뒤로가기 됨
    Safari 3 : 등록폼 페이지로 뒤로가기 됨
    Chrome : 등록폼 페이지로 뒤로가기 됨

    파이어폭스를 제외하고는 location.href를 사용하면 등록처리 페이지가 뒤로가기로 활성화가 된다. 사용자 편의성과 보안(?)면에서도 Http Header를 이용한 방식이 더 좋아보인다.

    참고삼아 메타태그를 이용해서도 테스트를 해보았다.  메타태그를 이용했을때도 등록처리 페이지는 뒤로가기에 해당되지 않는다...
    IE6 : 등록폼 페이지로 뒤로가기 됨
    IE7 : 등록폼 페이지로 뒤로가기 됨
    Firefox2 : 등록폼 페이지로 뒤로가기 됨
    Firefox3 : 등록폼 페이지로 뒤로가기 됨
    Opera 9 : 등록폼 페이지로 뒤로가기 됨
    Safari 3 : 등록폼 페이지로 뒤로가기 됨
    Chrome : 등록폼 페이지로 뒤로가기 됨


    덧) 테스트한 웹브라우저 버전
    IE6, IE 7.0, Firefox 2.0.0.14, Firefox 3.0.3, Opera 9.60 beta, Safari 3.1.2, Google Chrome 0.2.149.30
    Posted by 1010
    98..Etc/velocity2009. 1. 23. 15:06
    반응형

    <%
    int count;
    %>

    <h3>A sample <%= count %></h3>

    <% if ("foo".equals(request.getParameter("a"))) { %>
      <h3>Foo!</h3>
    <% } else { %>
      <h3>Bar!</h3>
    <% } %>

    접기

    velocity의 경우 :

    접기

    <jsp:directive.page velocity='true'/>
    #{
    int count;
    }#

    <h3>A sample ${count}</h3>

    #if ("foo" == params.a)
      <h3>Foo!</h3>
    #else
      <h3>Bar!</h3>
    #end

    Posted by 1010
    98..Etc/velocity2009. 1. 23. 15:05
    반응형

    Spring과 함께 사용

    전형적인 디렉토리 구조

    그림:VelocityDirectoryStructure.png

    • velocity와 velocity tool을 사용하기 위해 필요한 jar 파일을 lib에 넣어야 한다.
      • velocity-dep-*.jar : velocity 그리고 관련된 클래스 파일
      • velocity-tools-*.jar : velocity tool
      • commons-digester
      • commons-collections
      • commons-beanutils
    • /WEB-INF/velocity 를 velocity template 루트로 잡는다.
    • /WEB-INF/velocity/VM_global_library.vm 가 디폴트 매크로 파일이 된다.
    • /WEB-INF/toolbox.xml 은 velocity tool의 설정이다.
    • 각 설정파일의 위치를 변경하려면 *-servlet.xml에서 한다.

    *-servlet.xml

    • -servlet.xml 에 velocity 관련 설정을 넣어 사용할 수 있다.

    SpringMVC를 참고할 것.

    velocity properties

    velocity 관련 설정은 별도의 velocity.properties를 만들어 할 수도 있지만, *-servlet.xml에서 직접 할 수도 있다. 'velocityConfig' 부분의 'velocityProperties' 부분에 property를 추가하면 된다. velocity property의 전체 항목은 velocity jar 파일의 /org/apache/velocity/runtime/default/velocity.properties 에서 확인할 수 있다.

    VM_global_library.vm

    예를들어 다음과 같이 만들 수 있다.

    #macro (xhtml)
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html 
       PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    #end
    

    VTL (Velocity Template Language) 문법

    간단한 예제

    <html>
    <body>
    #set ($foo = "Velocity")
    Hello $foo World!
    </body>
    <html>
    

    코멘트

    ## 로 시작하면 한 줄 코멘트

    ## 한 줄 코멘트 single-line comment
    

    #* 로 시작하고 *#로 끝나면, 여러 줄 코멘트

    #*
     여러 줄 코멘트. 
     여기에 표시되는 내용은 
     Velocity Template Engine이 무시해버린다.
    *#
    

    #** 로 시작하고 *#로 끝나면, 블록 코멘트. 사실 여러 줄 코멘트와 다를 것은 별로 없다. 저자나 버전 등을 넣는데 주로 사용한다.

    #**
     This is a VTL comment block and
     may be used to store such information
     as the document author and versioning
     information:
     @author
     @version 5
    *#
    

    변수 Variable

    변수는 $로 시작하며, [a-zA-Z0-9-_] 문자가 변수에 사용될 수 있다.

    #set로 변수에 값을 세팅할 수 있다.

    #set ($foo = "bar")
    

    원래는 ${foo} 형태가 정식적인(formal) 표현이다. 텍스트 중간에 변수가 들어갈 때 잘못 파싱되는 것을 방지하기 위해, 반드시 이 형태를 사용해야 할 경우가 있다.

    Jack is a $vicemaniac.
    Jack is a ${vice}maniac.
    

    프라퍼티 Property

    변수 안의 프라퍼티에 접근할 수 있다.

    $customer.address
    $purchase.total
    

    Java Beans 표준의 property 규칙이 그대로 사용된다. (getX(), setX() 등)

    메소드 Method

    변수로부터 메소드를 곧바로 실행할 수도 있다.

    $customer.getAddress()
    $date.format("yyyy-MM-dd", $createTime)
    

    조용한 레퍼런스 Quiet Reference

    만약 $foo 라고 썼는데 foo 라는 이름의 객체가 존재하지 않는다면, $foo 라는 글자가 결과에 그대로 표현된다. 객체가 존재하지 않을 때 아무것도 표현되지 않게 하려면, $ 다음에 !를 붙인다.

    <input type="text" name="email" value="$email"/>
    <input type="text" name="email" value="$!email"/>
    

    물론 정식적인 표현도 가능하다.

    <input type="text" name="email" value="$!{email}"/>
    

    escaping

    '$' 를 표현하려면 \$ 로 한다. '\$' 는 '\\$' 로 표시한다.

    혹은 다음과 같이 할 수 있다.

    #set ($dollar = "$")
    $dollar
    

    지시자 Directive

    지시자는 #로 시작한다. ${..}와 같은 이유로, #{..} 표현도 가능하다.

    #if($a==1)true enough#elseno way!#end
    #if($a==1)true enough#{else}no way!#end
    

    #set

    변수에 값을 지정하기 위해 사용한다.

    #set ($primate = "monkey") ## literal
    #set ($monkey = $bill) ## variable reference
    #set ($monkey.Friend = "monica") ## string literal
    #set ($monkey.Blame = $whitehouse.Leak) ## property reference
    #set ($monkey.Plan = $spindoctor.weave($web)) ## method reference
    #set ($monkey.Number = 123) ## number literal
    #set ($monkey.Say = ["Not", $my, "fault"]) ## ArrayList
    #set ($monkey.Map = {"banana" : "good", "roast beef" : "bad"}) ## Map
    
    #set ($value = $foo + 1)
    #set ($value = $bar - 1)
    #set ($value = $foo * $bar)
    #set ($value = $foo / $bar)
    

    같은 변수에 다른 값을 넣으면, 마지막 넣은 값이 저장된다.

    값을 unset 하는 기능은 없다.

    Literal

    set 할때 문자열은 큰따옴표(") 로 감싸진다. 이 안에 변수가 있으면, 그것도 해석(parse)된다.

    #set( $directoryRoot = "www" )
    #set( $templateName = "index.vm" )
    #set( $template = "$directoryRoot/$templateName" )
    $template
    

    결과값은

    www/index.vm
    

    하지만 작은따옴표(')로 감싸면 해석되지 않는다.

    #set( $foo = "bar" )
    $foo
    #set( $blargh = '$foo' )
    $blargh
    

    결과는

    bar
    $foo
    

    조건문 if-else

    #if ($foo < 10)
       Go North
    #elseif ($foo == 10)
       Go East
    #elseif ($bar == 6)
       Go South
    #else
       Go West
    #end
    

    == 연산은 primitive, string, object를 비교하는데, object의 경우 toString()의 값이 비교된다.

    AND 연산 : &&

    #if ($foo && $bar)
       This AND that
    #end
    

    OR 연산 : ||

    #if ($foo || $bar)
       This OR That
    #end
    

    NOT 연산 : !

    #if (!$foo)
      NOT that
    #end
    

    $!foo 와 !$foo 를 혼동하지 말 것!

    반복문 Loops

    $allProducts가 List나 Array인 경우에는 이렇게 한다.

    #foreach( $product in $allProducts )
       $product
    #end
    

    $allProducts가 Map이나 Hashtable이라면, 이렇게 할 수 있다.

    #foreach( $key in $allProducts.keySet() )
       Key: $key -> Value: $allProducts.get($key)
    #end
    

    현재 루프 카운트는 $velocityCount로 알아올 수 있다.

    #foreach( $customer in $customerList )
       $velocityCount : $customer.Name
    #end
    

    $velocityCount 이름과 0부터 시작하는지 1부터 시작하는지 등은 설정 가능하다.

    include

    #include ("one.txt")
    #include ("one.gif","two.txt","three.htm")
    #include ("greetings.txt", $seasonalstock)
    

    파일의 내용을 그대로 include한다. 여러 파일을 한꺼번에 include할 수 있다. 파일 이름에 변수가 들어갈 수 있다.

    parse

    #parse ("me.vm")
    

    파일을 파싱해서 그 결과를 include한다. 한번에 하나의 파일만 가능하다.

    Count down.
    #set ($count = 8)
    #parse ("parsefoo.vm")
    All done with dofoo.vm!
    
    #set ($count = $count - 1)
    #if ($count > 0)
       #parse ("parsefoo.vm")
    #else
       All done with parsefoo.vm!
    #end
    

    재귀적으로 사용 가능한데, 깊이가 정해져있다. 깊이는 설정 가능하고, 디폴트로 10이다.

    stop

    #stop
    

    파싱을 멈춘다.

    매크로

    일종의 함수 같은 것이다.

    다음과 같이 정의하고,

    #macro (d)
       <tr><td></td></tr>
    #end
    

    다음과 같이 사용한다.

    #d()
    

    파라미터를 매크로 이름 뒤에 변수로 받을 수 있다.

    #macro (callme $a)
       $a $a $a
    #end
    

    이렇게 사용한다.

    #callme ($foo.bar())
    

    Velocity Tool

    Cookie Tool

    $cookie.foo.value
    $cookie.add("cookieName", "cookieValue")
    

    Import Tool

    $import.read("http://www.rolizen.com/import/url")
    

    Parameter Tool

    $params.foo
    $params.getString("foo")
    $params.getNumber("foo")
    $params.getInt("foo")
    

    Alternator Tool

    예를들어, 루프를 돌면서 table의 tr을 찍는데, 홀수줄은 흰색으로, 짝수줄은 회색으로 찍고 싶은 경우,

    #set ($color = $alternator.auto(["fff", "eee"))
    #foreach ($item in $listItems)
    <tr style="background-color:#$color">...</tr>
    #end
    

    Date Tool

    $date                                          -> 2007. 2. 5 오후 3:14:43 
    $date.get("yyyy-MM-dd HH:mm:ss")               -> 2007-02-05 15:14:43
    $date.format("yyyy-MM-dd HH:mm:ss", $myDate)   -> 2007-02-03 16:31:34
    

    Number Tool

    #set ($val = 1234567)
    $number.format("currency", $val)   -> ₩1,234,567
    $number.format("integer", $val)    -> 1,234,567
    $number.format("0,000", $val)      -> 1,234,567
    $number.format("0,0000", $val)     -> 123,4567
    $number.format("0", $val)          -> 1234567
    

    Escape Tool

    $html                        -> "bread" & "butter"
    $esc.html($html)             -> "bread" & "butter"
    
    $xml                         -> "bread" & "butter"
    $esc.xml($xml)               -> "bread" & "butter"
    
    $javascript                  -> He didn't say, "Stop!"
    $esc.javascript($javascript) -> He didn\'t say, \"Stop!\"
    
    $esc.dollar                  -> $
    $esc.d                       -> $
    
    $esc.hash                    -> #
    $esc.h                       -> #
    
    $esc.backslash               -> \
    $esc.b                       -> \
    
    $esc.quote                   -> "
    $esc.q                       -> "
    
    $esc.singleQuote             -> '
    $esc.s                       -> '
    
    $esc.exclamation             -> !
    $esc.e                       -> !
    

    Iterator Tool

    List Tool

    List나 Array에서 엘리먼트를 get / set 할 수 있다.

    $primes                    -> new int[] {2, 3, 5, 7}
    $list.size($primes)        -> 4
    $list.get($primes, 2)      -> 5
    $list.set($primes, 2, 1)   -> (primes[2] becomes 1)
    $list.get($primes, 2)      -> 1
    $list.isEmpty($primes)     -> false
    $list.contains($primes, 7) -> true
    

    Math Tool

    Sorter Tool

    Velocity Tool 만드는 법

    일반적인 Tool

    그냥 일반적인 class를 만들면 된다. public한 field와 method를 사용할 수 있다.

    context 를 갖는 Tool

    public class MemberUtil {
       private HttpServletRequest request;
       private HttpSession session;
       private MemInfoData meminfo;
    
       public void init(Object obj) {
          ChainedContext cc = (ChainedContext)obj;
          this.request = cc.getRequest();
          this.session = request.getSession(true);
          meminfo = (MemInfoData)session.getAttribute(MemInfoData.MEMINFO_SESSION_KEY);
          if (!validMemInfo(meminfo))
             meminfo = null;
       }
    
       private boolean validMemInfo(MemInfoData mid) {
          return (mid != null) && (mid.getMemNo() > 0) && (mid.getOpenid() != null);
       }
    
       public HttpServletRequest getRequest() {
          return request;
       }
    
       public HttpSession getSession() {
          return session;
       }
    
       public MemInfoData getMeminfo() {
          return meminfo;
       }
    
       public boolean isLogin() {
          return (meminfo != null);
       }
    }
    

    위와 같이 init() 메소드를 이용해 context를 받을 수 있다.

    참고사이트  : http://velocity.apache.org

    출처 :http://technet.ui2.co.kr/wiki/index.php/Velocity

    Posted by 1010
    98..Etc/velocity2009. 1. 23. 15:04
    반응형

    Velocity 무엇인가?

    Velocity 자바 기반의 템플릿 엔진이다.

    Velocity 페이지 디자이너들이 자바 코드안에서 정의된 메소들에 접근하는 것을 도와준다. 이것은 페이지 디자이너들이 자바 개발자들과 함께 Model-View-Controller(MVC) 아키텍쳐에 따른 사이트를 각자의 영역에서 최선의 결과를 가져오도록 도와준다는 것을 의미한다.

    Velocity 페이지로부터 자바 코드를 분리할 있고, 웹사이트를 계속 오랫동안 유지할 있으며, 자바 서버 페이지(JSP) 실용적인 대안을 제공한다.

    Velocity 무엇을 있나?

    당신이 진흙(Mud) 판매하는 "온라인 진흙 가게" 페이지 디자이너 이라고 가정해보자. 그리고 고객들은 다양한 종류와 많은 수량의 진흙을 주문하여 당신의 가게는 날로 번성하고 있다.

    고객들은 사용자 이름과 패스워드를 입력하고 당신의 사이트에 로그인하여 자신이 이전에 주문했던 주문목록을 조회하고, 다른 진흙을 수도 있다. 모든 고객에 관한 정보는 당신의 데이타 베이스안에 저장되고 있다.

    데이타 베이스에 따르면 특별히 설악산에서 만든 진흙이 매우 인기가 좋으며, '설악산 진흙'보다 인기가 일본산 빨간 진흙도 정기적으로 일본에서 수입하고 있다.

    그러던 어느날 당신은 '설악산 진흙' 흥미를 느끼는 수많은 고객들과의 특별한 거래를 찾는데 Velocity 사용하지 않는 지에 대한 의문을 갖게된다.

    Velocity 웹페이지를 통한 당신의 온라인 방문객들에게 진흙 판매를 쉽게 해준다. 진흙 가게의 웹사이트 디자이너인 당신은 고객이 사이트 로그인 후에 보게 특별한 페이지를 원하고 있다.

    명심하라. 당신은 개발자들이 데이터베이스에서 필요한 정보를 어떻게 추출하는지에 대해 걱정할 필요가 없다. 당신은 단지 그것이 올바르게 작동한다는 것만 기억하면 된다. 그렇게 되면 당신은 당신만의 페이지 디자인을 하게 되고, 개발자들은 그들만의 일을 하게 된다.

    이런 결과로, 당신은 로그인한 사용자에게 나타낼 동적인 정보를 아래와 같이 velocity Template Language(VTL) 문장을 사용해 웹페이지에 넣을 있게 된다.

     
    Hello, $customer.Name! <br>
    $flogger.getPromotion( $mud )

    $customer 현재 로그인한 사용자에 대한 정보를 가지고 있고, $promotion 로그인한 고객별로 데이타 베이스를 조회에 해당 고객에 맞는 추천 상품을 소개하는 일을 한다.

    그래서 '설악산 진흙' 오랫동안 구입해온 기록을 가진 고객이 로그인 했을 '설악산 진흙 현재 대폭 세일중!!' 이라는 메시지를 정면에서 보게 것이다.

    Velocity 힘과 유연함은 이렇게 VTL 레퍼런스와 함께 당신에게 제공된다.

    VTL (Velocity Template Language)

    VTL Velocity에서 템플릿 개발에 사용되는 언어로 레퍼런스(Reference), 디렉티브(Directive), 그리고 주석(Comment)으로 구성된다.

    레퍼런스

    ${variable}

    컨텍스트에서 제공되는 변수에 대한 레퍼런스

    ${variable.property}

    속성에 대한 레퍼런스

    ${variable.method(args)}

    메소드 대한 레퍼런스

    디렉티브

    #set

    레퍼런스의 값을 설정

    #if #elseif #else

    조건문 제어

    #foreach

    반복문 제어

    #include

    파싱되지 않는 로컬 파일 출력

    #parse

    파싱되는 로컬 템플릿 출력

    #stop

    템플릿 엔진의 동작 정지

    #macro

    반복적으로 사용될 매크로 정의

    주석

    ##

    줄짜리 주석

    #* .... *#

    여러 줄에 걸친 주석

    VTL 표에서 정리한 것처럼 너무나 단순하기 때문에 흔히 성냥갑 표지에 적을 있을 만큼 작은 API라고 불려진다.

    이는 작업을 개발자와 디자이너가 함께 진행해 나간다는 점을 감안하면 매우 바람직한 일이라고 있다.

    VTL 통해 작성된 벨로시티 템플릿(vm 파일) 다음과 같은 패턴을 통해 처리 된다.

    // 벨로시티 템플릿 엔진의 초기화
    //
    초기화 설정은 velocity.properties 파일을 사용함
    Velocity.init("velocity.properties");

    //
    자바 클래스와 템플릿간의 정보 전달에 사용할 컨텍스트 객체 생성
    //
    컨텍스트 객체는 해시 테이블을 상속받으므로 (, ) 순서쌍 형태로 값을 저장 
    //
    ) context.put("members", memberDAO.getMembers());
    //
    이렇게 해서 컨텍스트에 저장된 값들은 템플릿에서 레퍼런스를 이용해서 참조됨
    //
    컨텍스트에 담긴 값이 컬렉션일 경우 #foreach 디렉티브를 통해 하나씩 참조 가능 
    VelocityContext context = new VelocityContext();
    Template template = null;

    //
    로직과 연결되어 사용될 템플릿 파일을 선택
    template = Velocity.getTemplate("HelloWorld.vm");
    BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));

    //
    템플릿과 컨텍스트를 렌더링해서  결과를 출력 
    if ( template != null)
      template.merge(context, writer);

    writer.flush();
    writer.close();

    템플릿 엔진이 동작하는 방식을 정리해 보면, 개발자는 사용자에게 보여 디자인을 위해 VTL 이용한 템플릿 파일을 작성하고, 처리를 위한 코드를 개발한다.

    자바 코드와 템플릿 간의 필요한 정보 전달은 컨텍스트 객체를 통해 이루어진다.

    이러한 2개의 파일을 입력받아 벨로시티는 템플릿을 토대로 렌더링한 결과 페이지를 출력하게 되는 것이다.

    템플릿에 어떤 내용이 담겨 있느냐에 따라 결과 페이지는 일반 텍스트가 수도 있고, HTML이나 SQL, PostScript, XML 등도 있다.

     

     

    Velocticy 템플릿 언어 (VTL)

    Velocticy 템플릿 언어(velocity Template Language : VTL) 페이지에서 동적인 내용을 구체화하기 가장 쉽고, 가장 간결하고 가장 확실한 방법을 제공하는 수단이다.

    심지어 프로그래밍 해본 경험이 적거나 전혀 없는 페이지 개발자도 웹사이트에서 동적인 내용를 구체화 하는데 VTL 금방 사용할 있다.

    VTL 웹사이트에서 동적인 내용을 끼워넣는데 필요한 레퍼런스를 사용한다. 레퍼런스의 타입은 variable이다.

    Variables 자바 코드에서 정의된 것에 대해 언급할 있는 레퍼런스의 타입 이거나, 또는 웹페이지 자체의 VTL 에서 지원하는 타입일 있다.

    아래는 HTML 문서안에 삽입될 있는 VTL문의 예제다.

     
    #set ( $a = "velocity" ) 

    VTL문은 모든 VTL문처럼 #기호로 시작하고 set 명령어를 포함하고 있다. 온라인 고객이 당신의 페이지를 요청할 , Velocticy 템플릿 엔진은 당신의 페이지에 명시된 모든 #기호를 검색한다. VTL 시작할 #기호와 VTL에서 아무일도 않는 #기호들을 분리한다.

    예제에 표시된 set 명령어는 둥근괄호 안에서 사용하며 특정 변수에 값를 부여하는 일을 한다. 변수는 좌변에, 변수의 값는 우변에 나열되며 좌변과 우변은 = 기호로 구분되어 진다.

    위의 예에서, 변수는 '$a'이고 변수에 할당된 값은 'Velocity'이다. 변수는 다른 모든 레퍼런스들처럼 $기호로 시작한다. 값은 항상 인용부호 사이에 존재한다.

    Velocticy 문자열(String) 타입만 변수에 할당할 있기 때문에 다른 데이타 타입들과의 혼란은 없다.

    정리해보면 아래와 같다.

    *      레퍼런스 $ 시작하고 어떤 것을 얻는데 사용된다.

    *      명령어 # 시작하고 어떤 동작을 수행하는데 사용된다.

    예제에서 #set 변수에게 값을 할당하는데 사용되고 $a 변수는 템플릿에서 "velocity" 출력하는데 사용되었다.

    안녕 velocity

    변수에 값을 할당했으면, 당신의 HTML 문서내 어디서나 변수를 레퍼런스할 있다. 다음의 예에서 $foo 값이 할당되고 레퍼런스 되는 모습을 있다.

     
    #set ($ foo = "velocity" )
    Hello #foo World!

    문장은 결국 웹페이지에 "Hello Velocity World!" 출력할 것이다.

    VTL 명령어들을 포함한 문장들을 좀더 읽기 쉽게 만들기 위해, 굳이 그럴 필요는 없지만 가급적 VTL문장을 새로운 줄에서 시작하도록 권장한다.

    set 명령어는 나중에 매우 세부적으로 다시 살펴보게 것이다.

    주석 처리

    주석은 velocity 템플릿 엔진에 의해 해석되지 않는 설명문이다. 주석은 당신의 오래된 기억을 상기시키거나, 당신의 VTL문이 무엇을 하고 있는지, 또는 당신이 찾는 다른 다른 목적들을 설명하기에 유용한 방법이다.

    아래에 VTL 주석의 예가 있다.

     
    ##This is a single line Comment.

    한줄 주석문은 ## 시작하고 라인의 끝에서 끝난다. 당신이 여러 줄의 주석을 사용한다면, 다수의 한줄 주석을 여러 줄에 필요는 없다.

    문장이 #* 시작하고 *# 끝나는 Multi-line 주석이 이런 상황에 매우 유용하다.

     
    #*
    Thus begins a multi-line comment. Online visitors won't
    see this text because the velocity Templating Engine will
    ignore it.
    *#

    아래 나오는 번째 타입의 주석은 문서의 저자와 버전정보와 같은 메타정보를 저장하는데 사용될 있다.

     
    #**
    This is a VTL comment block and
    may be used to store such information
    as the document author and versioning
    information:
    @author
    @version 5
    *#

    참조 (References)

    VTL 에서 지원하는 세가지 타입의 레퍼런스가 있다.

    *      변수

    *      속성

    *      메소드

    개발자들은 디자이너가 VTL 이용하는 템플릿에서 개발자가 설정한 레퍼런스를 정확히 사용하기 위해 레퍼런스의 특별한 이름을 지어주어야 한다.

    레퍼런스로 오고 가는 모든 것은 문자열(String) 객체로 처리된다. 만약 $foo(Integer 타입이라 가정한다) 표현하는 객체가 있다면 Velocity 문자열 객체를 얻기위한 매소드로 .toString() 요청 것이다.

    변수 (Variables)

    변수의 표기법은 VTL 식별자로부터 불려온 '$'기호로 시작된다. VTL 식별자는 알파벳 (a...z, or A...Z)으로 시작해야 하며 나머지는 아래의 문자들로 제한된다.

    *      alphabetic (a .. z, A .. Z)

    *      numeric (0 .. 9)

    *      hyphen ("-")

    *      underscore ("_")

    여기 VTL안에서 유효한 변수 레퍼런스의 예가 나온다.

     
    $foo
    $mudSlinger
    $mud-slinger
    $mud_slinger
    $mudSlinger1

    VTL 변수가 $foo로써 레퍼런스 , 변수는 템플릿안의 set 명령어나 자바 코드로부터 값을 얻을 있다.

    예를 들어 자바 변수 $foo "value bar"라는 값을 가지고 있다면, "value bar" 웹페이지내에 정의된 모든 $foo 대체 하게 된다.

    만약 다음 문장이 웹페이지 내에 정의된다면....

     
    #set ( $foo = "bar" )

    결과는 명령어 하위에 나오는 모든 $foo "bar" 대체할 것이다.

    속성 (properties)

    VTL 레퍼런스의 두번째 특징은 속성이다.

    속성은 특유의 포맷을 가진다. 표기법은 기호(".") 다른 VTL 식별자가 뒤에 따르는 '$' 기호로 구성된다. 아래는 VTL안의 유효한 속성 레퍼런스의 예이다.

     
    $customer.Address
    $purchase.Total

    예제에서 $customer.Address 두가지 의미을 가질 있다.

    *      customer 객체의 멤버 변수 Address 레퍼런스 한다.

    *      customer 객체의 메소드 getAddress() 레퍼런스 한다.

    , $customer.getAddress() $customer.Address 생략해서 사용할 있다. 페이지가 요청될 , Velocity 이들 가능성을 이치에 맞는지 분별하여 적당한 값은 반환하게 된다.

    메소드 (Method)

    메소드는 자바코드 안에서 정의되며, 계산을 하거나 어떤 값을 얻는 것과 같이 유용한 무언가를 수행한다. 아래는 유효한 메소드 레퍼런스의 예이다.

     
    $customer.getAddress()
    $purchase.getTotal()
    $page.setTitle( "My Home page" )
    $person.setAttributes( ["Strange", "Weird", "Excited"] )

    예제에서 나온 $customer.getAddress() $purchase.getTotal() 앞선 예제에서 나온 $customer.Address $purchase.Total 레퍼런스의 결과와 정확히 일치한다.

    그러나 $page.setTitle( "My Home page" ) 같이 메소드에서는 인자를 넘길 있다는 점이 속성과 다르다. 참고로 $person.setAttributes( "Strange", "Weird", "Excited"? ) 인자로 문자열 배열을 넘기고 있다.

    형식적인 레퍼런스 표기법 (Formal Reference Notation)

    앞서 나온 것은 레퍼런스에 대한 속기 표기법이었다. 이제 형식적 표기법에 대해 살펴보자.

     
    ${mudSlinger}
    ${customer.Address}
    ${purchase.getTotal()}

    거의 모든 경우에 당신은 레퍼런스를 위하여 앞서 나온 속기 표기법을 사용할 것이지만, 어떤 경우에는 형식적 표기법이 정확한 프로세스를 위하여 필요할 수도 있다.

    만약 당신이 $vice라는 변수를 사용하는데 변수 바로 뒤에 "fly"라는 문장이 뒤따른다고 생각해보자. 속기 표기법을 사용할 경우의 다음 예제를 살펴보면....

     
    Jack is a $vicefly

    예제에 나온 $vicefly라는 변수는 우리가 희망한 변수가 아니다. 결과로 Velocity $vice 아닌 $vicefly 변수로 가정해서 처리하게 된다. 결국 화면에는 우리가 예상하지 못한 $vicefly 그대로 표시될 것이다.

    아래 형식적 표기법을 통해 문제를 해결할 있다.

     
    Jack is a ${vice}fly

    이제 Velocity $vicefly 아닌 $vice 변수라는 것을 알게 된다. 기억하자. 형식적 표기법은 레퍼런스들이 템플릿 안에서 텍스트에 직접 붙어 있을 유용하게 사용된다.

    숨겨진 레퍼런스 표기법 (Quiet Reference Notation)

    Velocity 사전에 정의되지 않은 변수를 만나게 되면, 변수값을 그대로 화면에 출력하게 된다.

    다음의 예제를 살펴보자.

     
    <input type="text" name="email" value="$email" />

    위에 나온 $email 사전에 정의되지 않았을 경우 화면에 나오는 텍스트필드의 초기값에는 $email이라는 값이 그대로 표시될 것이다. 이것은 우리가 원하는 결과가 아니다.

    이제 다음처럼 예제를 바꿔보자.

     
    <input type="text" name="email" value="$!email"/>

    이제 화면에는 텍스트필드의 값이 공백이 출력될 것이다. 형식적 표기법을 사용한 다음 예제도 같은 결과를 가져온다.

     
    <input type="text" name="email" value="$!{email}"/>

    값이 설정되지 않은 변수를 화면에 출력하지 않을 경우 숨겨진 레퍼런스 표기법은 아주 유용하다.

    Dollar($)표시의 경우는 어떻게 하는가?

    만약 당신이 페이지 내에서 "나는 농부의 가게에서 $2.50 주고 4파운드의 감자를 샀습니다.!" 라는 문자열을 표시해야 한다고 가정하자.

    VTL에서는 앞서 보았듯이 $ # 같은 특별한 캐릭터들을 사용하고 있어서 언뜻 보면 문자열이 제대로 표시가 안될 수도 있을 같다.

    그러나 VTL 식별자는 항상 대문자나 소문자의 영문자로 시작하기 때문에 문장은 아무런 문제가 없다.

    escape 캐릭터의 사용

    만약 당신이 화면에 $email 출력해야 한다고 가정하자. 그러나 이미 $email 값이 설정된 상태라고 하자. 그러면 화면에는 당신이 원하지 않는 $email 대한 설정값이 화면에 표시될 것이다.

    아래 예제가 있다.

     
    #set ( $email = "foo" )
    $email

    경우 화면에는 foo라는 문자열이 출력되어 당신이 원하는 $email이라는 문자는 출력할 없게 된다.

    이경우 다음과 같이 escape 캐릭터를 사용하면 된다.

     
    #set( $email = "foo" )
    $email
    \$email
     
    \\$email
    \\\$email

    결과는 아래와 같이 나올 것이다.

     
    foo
    $email
     
    \foo
    \$email

    만약 $email 사전에 정의되지 않았다고 가정해보면 어떻게 될까? 결과는 아래와 같을 것이다.

     
    $email
    \$email
    \\$email
    \\\$email

     

     

    Velocity 문법(지시어)

    앞서 배운 레퍼런스(변수) 디자이너들이 페이지에 동적인 내용을 생성할 있도록 도와준다.
    반면에 이번에 살펴볼 디렉티브(명령어) 디자이너들이 실제적으로 웹사이트의 뷰와 컨텐츠를 관리하도록 도와준다.

    #set

    명령어 #set 레퍼런스의 값을 설정할 사용된다. 값은 변수 레퍼런스나 속성 레퍼런스 모두에 할당될 있고, 이것은 아래에 보이는 것처럼 괄호 안에서 명명된다.

    #set( $primate = "monkey" )
    #set( $customer.Behavior = $primate )

    괄호안의 좌측에 위치하는 변수(이하 LHS 표기, 우측 변수는 RHS 표기) 아래에 나오는 레퍼런스 또는 속성 타입이어야 한다.

    *       Variable reference

    *       String literal

    *       Property reference

    *       Method reference

    *       Number literal

    *       ArrayList

    아래는 위의 타입들에 예제이다.

    #set( $monkey = $bill ) ## variable reference
    #set( $monkey.Friend = "monica" ) ## string literal
    #set( $monkey.Blame = $whitehouse.Leak ) ## property reference
     
    #set( $monkey.Plan = $spindoctor.weave($web) ) ## method reference
    #set( $monkey.Number = 123 ) ## number literal
    #set( $monkey.Say = ["Not", $my, "fault"] ) ## ArrayList

    마지막 줄에서 대괄호로 표시된 element ArrayList class 요소를 정의한다. 그래서 예를 들면, 당신은 $monkey.Say.get(0) 이용해서 첫번째 배열요소(여기서는 "Not") 접근할 있다.

    또한 간단한 수학적 표현도 가능하다.

    #set( $value = $foo + 1 )
    #set( $value = $bar - 1 )
    #set( $value = $foo * $bar )
    #set( $value = $foo / $bar )

    null 체크

    만약 RHS 속성 또는 값이 null 메소드 레퍼런스 라면, LHS 할당되지 않을 것이다. 문맥에서 현재의 레퍼런스를 매커니즘으로 제거하는 것은 불가능하다. 이런 점은 Velocity 초보자들이 흔히 혼동 하는 실수다.

    예를 들면....

    #set( $result = $query.criteria("name") )
    The result of the first query is $result
     
    #set( $result = $query.criteria("address") )
    The result of the second query is $result

    위에서 만약 $query.criteria("name") 문자열 "bill" return되고, $query.criteria("address") null return되면, VTL 결과는 아래와 같이 출력될 것이다.

    The result of the first query is bill
     
    The result of the second query is bill

    이것은 property 또는 매소드 레퍼런스를 거쳐 #set 레퍼런스를 시도한 ,

    1.    foreach 반복문을 만드는 초보자들을 혼동케하는 경향이 있다.

    이때는 아래와 같이 null 의심가는 레퍼런스를 #if 명령어를 가지고 시험한다.

    #set( $criteria = ["name", "address"] )
     
    #foreach( $criterion in $criteria )
     
        #set( $result = $query.criteria($criterion) )
     
        #if( $result )
            Query was successful
        #end
     
    #end

    위의 예에서, query 성공하였는지 결정하는데 있어 $result 결과값에 의존하는 것은 현명한 결정이 아니다. $result 위에서 처럼 조건절 이전에 #set 통해 설정 되어진 후에는 $result null 다시 되돌릴 없다. (#if #foreach 명령어의 세부사항들이 문서의 뒤에 다루어질 것이다.)

    이에대한 하나의 해결책은 $reult false 사전에 설정하는 방법이다. 그런 다음 $query.criteria( ) 호출이 실패하면, 당신은 $result null임을 체크할 있게 된다.

    #set( $criteria = ["name", "address"] )
     
    #foreach( $criterion in $criteria )
     
        #set( $result = false )
        #set( $result = $query.criteria($criterion) )
     
        #if( $result )
            Query was successful
        #end
     
    #end

    몇몇의 다른 Velocity 명령어들과 다르게, #set 디렉티브는 #end 문을 가지지 않는다는 점도 참고하라.

    문자열 (String literals)

    명령어 #set 사용할 따옴표로 지정된 문자열은 아래 예제처럼 파싱되어 출력된다.

    #set( $directoryRoot = "www" )
    #set( $templateName = "index.vm" )
    #set( $template = "$directoryRoot/$templateName" )
    $template

    당연하겠지만, 결과는 아래와 같다.

    www/index.vm

    그러나 문자열이 작은 따옴표일 때는 파싱되지 않는다.

    #set( $foo = "bar" )
    $foo
    #set( $blargh = '$foo' )
    $blargh

    결과는 아래와 같다.

    bar
    $foo

    Velocity에서 파싱되지 않은 텍스트를 출력하기 위해 위에서 처럼 작은 따옴표를 사용할 있다.
    설정은 velocity.properties 설정파일에서 stringliterals.interpolate=false 설정함에 따라 기본설정을 바꿀 수도 있다.

    조건절 (If / ElseIf / Else)

    Velocity에서 #if 명령어는 문장이 참인 조건에서 웹페이지가 생성될 포함될 문자열을 지정할 있다.

    #if( $foo )
       Velocity!
    #end

    위에서 #if 명령어는 변수 $foo 참인지 결정하기 위해 사용되며 아래 2가지 상황일 있다.

    *       $foo 참인 값을 갖는 boolean(true/false)이다.

    *       $foo null 아니다.

    Velocity 문맥은 항상 객체(Object)로써 유지된다는 것을 기억하라. 그래서 우리가 boolean이라고 말할 , 그것은 Boolean(class)으로 표현될 것이다.

    예제에서 #if #end 사이에 들어있는 content 참이면 결과가 나올 것이다. 여기서는 $foo 참이면, "Velocity!" 출력될 것이고, 반대로, $foo null값이거나 false이면 아무런 내용도 표시되지 않을 것이다.

    명령어 #elseif 또는 #else #if 요소와 함께 사용될 있다. 다음의 예제에서, $foo 15 값를 갖고 $bar 6 값을 갖는다고 가정해보자.

    #if( $foo > 10 )
        Go North
    #elseif( $foo == 10 )
        Go East
    #elseif( $bar == 6 )
        Go South
    #else
        Go West
    #end

    예제에서 $foo 10보다 크면 첫번째 비교들이 실패하게 된다. 다음 $bar 6 비교되어 참이 되고, 그래서 결과는 "Go South" 된다.

    참고 : '==' 비교되는 변수는 같은 Object 타입이어야 한다. 그렇지 않으면 결과는 항상 false 것이다.

    논리 연산

    Velocity 논리 연산자 AND, OR, NOT 지원한다. 아래 예제가 나온다.

    ## logical AND
     
    #if( $foo && $bar )
       This AND that
    #end

    위에서 #if() 명령은 단지 $foo $bar 참인지만 평가할 것이다. 만약 $foo false라면, 결과는 false 되며 $bar 평가되지 않을 것이다. 만약 $foo 참이라면, Velocity $bar 값을 체크하게 된다. 만약 $bar 참이면, 결과는 true 되고 화면에는 "This And that" 나타날 것이다. $bar false라면, 그때 결과는 false이므로 결과는 없을 것입니다.

    논리 연산자 OR 같은 방법으로 작동한다. 아래 예제가 나온다.

    ## logical OR
     
    #if( $foo || $bar )
        This OR that
    #end

    OR 연산에 대해 별도의 설명은 하지 않는다. 아래는 부정연산의 예제다.

    ##logical NOT
     
    #if( !$foo )
      NOT that
    #end

    여기서, $foo 참이라면, !$foo false 평가하고, 아무런 출력이 없게된다. 만약에 $foo false라면, !$foo 참으로 평가되어 화면에서 "NOT that" 출력될 것이다.

    주의 : 이것을 완전하게 앞서 배운 숨긴(quiet) 레퍼런스와 혼동하지 않도록 조심하라. 숨긴 레퍼런스의 형식은 $!foo 이다.

    반복문 (Loops)

    명령어 #foreach 반복문을 사용할 필요하다.

    <ul>
    #foreach( $product in $allProducts )
        <li>$product</li>
    #end
    </ul>

    예제에서 #foreach loop $allProducts 컬렉션(object) List 안의 전체 product 대해 반복문을 수행하도록 한다. loop 통해서 $allProducts 내에 담긴 Object $product 변수로써 레퍼런스하게 된다.

    위에 나온 $allProducts 변수에 사용되는 타입은 아래와 같다.

    *       Vector

    *       Hashtable

    *       Array

    이제 $allProduct Hashtable이라고 가정하자.
    만약 당신이 Hashtable 담긴 키값을 검색해야 한다면, 아래와 같은 코드를 사용하면 된다.

     
    <ul>
    #foreach( $key in $allProducts.keySet() )
        <li>Key : $key -> value : $allProducts.get($key)</li>
    #end
    </ul>

    또한 Velocity 당신이 반복문의 횟수(loop counter) 얻을 있는 간단한 방법을 제공한다.

    <table>
    #foreach( $customer in $customerList )
        <tr><td>$velocityCount</td><td>$customer.Name</td></tr>
    #end
    </table>

    velocity.properties 파일에 명시되어있는, loop counter 변수 레퍼런스를 위한 기본값은 $velocityCount이다. 기본값에 따라 카운터가 1에서 시작하지만, 이것은 velocity.properties 파일안에서 0 이나 1 모두로 설정할 있다. 아래는 velocity.properties 파일에 지정된 관련 설정 내용이다.

    # Default name of the loop counter
    # variable reference.
    directive.foreach.counter.name = velocityCount
     
    # Default starting value of the loop
    # counter variable reference.
    directive.foreach.counter.initial.value = 1

    인클루드 (Include)

    명령어 #include 템플릿에 local 파일을 끼워넣을 있도록 해준다. local file #include 명령이 정의된 위치에 정확히 삽입된다.

    아래는 #include 참고할 사항이다.

    *       파일의 내용은 템플릿 엔진을 통해 파싱되지 않는다.

    *       안전상의 이유로, 파일은 오직 TEMPLATE ROOT 아래에만 위치해야 한다.

    #include( "one.txt" )

    위에서 처럼 #include 명령이 요청한 파일은 따옴표로 지정된다. 만약 하나 이상의 파일이 포함된다면, 콤마(,) 구분되어야 한다.

    #include( "one.gif", "two.txt", "three.htm" )

    포함되는 파일은 파일 이름 대신에 변수를 사용할 수도 있다. 아래 파일이름과 변수 모두를 지정하는 에제가 나온다.

    #include( "greetings.txt", $seasonalstock )

    파싱 (Parse)

    명령어 #parse 템플릿 디자이너가 VTL 지정되어 있는 동적인 템플릿을 포함하는 local file 끼워넣도록 해준다. Velocity 파일에 명명된 VTL 분석하고 평가된 결과를 #parse 명령이 정의된 위치에 정확히 삽입한다.

    아래는 #parse 참고할 사항이다.

    *       파일의 내용은 템플릿 엔진을 통해 파싱된다.

    *       안전상의 이유로, 파일은 오직 TEMPLATE ROOT 아래에만 위치해야 한다.

    #parse( "me.vm" )

    앞서 나온 #include 명령처럼, #parse 역시 변수를 취할 있다. 주의해야 것은 #include 명령과 다르게, #parse 단지 하나의 파일만을 취할 있다는 점이다.

    Velocity 또한 #parse 문장을 포함하고 있는 템플릿을 #parse 인자로 가질 있다.
    파싱되는 파일의 제한을 위한 최적의 기본값은 10이며 velocity.properties 파일내에 directive.maxdepth=10 이라는 설정을 통해 이를 제어할 있다.

    아래 예제를 보자.
    1) default.vm

    Count down.
    #set( $count = 8 )
    #parse( "parsefoo.vm" )
    All done with dofoo.vm!

    2) parsefoo.vm

    #set( $count = $count - 1 )
    #if( $count > 0 )
        #parse( "parsefoo.vm" )
    #else
        All done with parsefoo.vm!
    #end

    예제에 따라 default.vm에서 $count 8부터 count down하면서 parsefoo.vm 파싱하게 된다.

    그리고 count 0 도달할 , Velocity "All done with parsefoo.vm!" 이라는 메세지를 표시하고, 시점에서, 제어권은 default.vm으로 돌아가 "All done with dofoo.vm!" 이라는 메시지를 출력할 것이다.

    중지 (Stop)

    명령어 #stop 템플릿 엔진의 실행과 return 강제로 멈추도록 하는데 사용한다.
    보통 디버깅(debugging) 목적으로 사용된다.

    #stop

    다음으로 Velocity 나머지 특징과 기타 살펴볼 내용들에 대해 설명을 계속한다.

    수학적인 기능 (Math)

    Velocity #set 명령어를 가지고 템플릿들에서 사용될 있는 수학적인 기능들을 제공한다. 다음의 식들은 각각 덧셈, 뺄셈, 곱샘 그리고 나눗셈에 대한 예제이다.

    #set( $foo = $bar + 3 )
    #set( $foo = $bar - 4 )
    #set( $foo = $bar * 6 )
    #set( $foo = $bar / 2 )
     
    #set( $foo = $bar % 5 )

    수학적인 기능은 오직 정수만 (.... -2, -1, 0, 1, 2 ....) 가능하다는 점에 주의하라.

    범위 연산 (Range Operator)

    범위 연산은 #set #foreach 구문 사이에서 이용될 있다. 범위연산자는 다음의 구조를 가진다.

    [n..m]

    예제에서 n m 모두 정수여야 한다. m 큰지 n 작은지는 문제가 되지 않는다. n m사이에서 반복문이 순환될 것이기 때문이다.

    다음은 범위연산의 사용 예제를 보여주고 있다.

    First example:
    #foreach( $foo in [1..5] )
    $foo
    #end
     
    Second example:
    #foreach( $bar in [2..-2] )
    $bar
    #end
     
    Third example:
    #set( $arr = [0..1] )
    #foreach( $i in $arr )
    $i
    #end
     
    Fourth example:
    [1..3]

    결과는 아래와 같다.

    First example:
    1 2 3 4 5
     
    Second example:
    2 1 0 -1 -2
     
    Third example:
    0 1
     
    Fourth example:
    [1..3]

     

     

    Velocity 문법(매크로)

    매크로

    명령어 #macro VTL 템플릿에서 반복되는 문장을 정의하는데 사용된다.

    매크로는 간단하고 복잡한 시나리오 모두에서 매우 유용하게 쓰인다. 매크로는 keystrokes 저장하고 typographic error 최소화할 목적으로 만들어졌다.

    #macro( d )
    <tr><td></td></tr>
    #end

    예제에서 정의되는 Velocimacro d 이다. 매크로는 아래와 같은 방법으로 호출된다.

    #d()

    템플릿이 불려질 , Velocity 아래와 같은 결과로 #d() 대체하게 된다.

    <tr><td></td></tr>

    또한 Velocimacro 인자의 수를 취할 수도 있다. 심지어 앞선 예제에서 보여진 zero argument 조차 하나의 옵션이다.

    그러나 Velocimacro 불려질 , 그것은 정의된 수만큼의 argument 함께 불려야 합니다. 많은 Velocimacros 위에서 정의된 하나보다 많이 관련됩니다. 여기 색과 array, 개의 argument 취한Velocimacro 있습니다.

    #macro( tablerows $color $somelist )
            #foreach( $something in $somelist )
                   <tr><td bgcolor=$color>$something</td></tr>
            #end
    #end

    예제에서 정의되는 매크로, #tablerow 개의 argument 취한다. 첫번째 argument $color 대체하고 두번째 argument $somelist 대체하게 된다.

    VTL 템플릿 안으로 넣어질 있는 것은 모두 매크로 안으로 지정될 있다. 위에서 #tablerows 매크로는 foreach 명령어를 사용했다. #tablerows 매크로 정의를 보면 두개의 #end 명령이 있다. 예상하겠지만 첫번째는 #foreach 속하고, 두번째는 매크로 정의를 마치는데 사용되는 것이다.

    아래에 위에서 정의한 #tablerow 매크로를 사용하는 예제가 나온다.

    #set( $greatlakes = ["Superior","Michigan","Huron","Erie","Ontario"] )
    #set( $color = "blue" )
    <table>
        #tablerows( $color $greatlakes )
    </table>

    변수 $greatlakes $somelist 대체함에 유의하면서 아래 결과를 살펴보자.

    <table>
            <tr><td bgcolor="blue">Superior</td></tr>
            <tr><td bgcolor="blue">Michigan</td></tr>
            <tr><td bgcolor="blue">Huron</td></tr>
            <tr><td bgcolor="blue">Erie</td></tr>
            <tr><td bgcolor="blue">Ontario</td></tr>
    </table>

    매크로는 하나의 Velocity 템플릿 안에서 inline으로 정의될 있으나 이렇게 정의한 매크로는 다른 템플릿에서는 사용할 없다. 매크로가 모든 템플릿들에 공유될 있도록 정의하기 위해서 velocity.properties 설정파일 내에 template library (velocimacro.library) 지정하도록 한다.

    공유되는 매크로의 이점은 많은 템플릿 들에서 매크로를 재정의할 필요를 줄여 작업량을 줄이고, 오류가 발생할 있는 기회를 줄인다는 점이다.

    매크로 인자 (Arguments)

    매크로에 정의되는 argument 다음의 VTL 요소들을 모두 취할 있다.

    Reference : anything that starts with '$' 
     
    String literal : something like "$foo" or 'hello' 
     
    Number literal : 1, 2 etc 
     
    IntegerRange : [ 1..2] or [$foo .. $bar] 
     
    ObjectArray : [ "a", "b", "c"] 
     
    boolean value true 
     
    boolean value false 

    velocity.properties에서의 매크로 관련 설정

    *       velocimacro.library - 콤마(,) 구분된 모든 템플릿 라이브러리 목록. VM_global_library.vm.설정된 template path Velocimacro library 찾는데 사용됩니다.

    *       velocimacro.permissions.allow.inline - true(기본값)/false. 속성은 매크로가 표준 템플릿 내에서 inline으로 정의될 있는지를 결정한다.

    *       velocimacro.permissions.allow.inline.to.replace.global - true/false(기본값). 만약 템플릿 내에서 inline으로 정의된 매크로가 velocimacro.library 설정된 라이브러리의 매크로를 대체할 지를 설정한다. 만약 false라면 템플릿에 inline으로 정의된 매크로가 컨테이너 구동시 로드된 라이브러리의 매크로를 교체하는 것을 막는다.

    *       velocimacro.permissions.allow.inline.local.scope - true/false(기본값). 속성은 inline으로 정의된 매크로가 정의하는 template 대해 'visible'인지 아닌지를 조절한다. 속성을 true 하면, 템플릿은 단지 정의되는 템플릿에 한해서만 유용한 inline VM 정의할 있게 된다.

    *       velocimacro.context.localscope - true/false(기본값). true라면 매크로를 통한 #set() 명령으로 문맥의 모든 modification 매크로에 대해 'local' 고려되며 영구적으로 영향을 끼치지 않게 된다.

    *       velocimacro.library.autoreload - true/false(기본값). 속성은 자동 로드되는 매크로를 조절한다. true 설정되면 요청된 매크로에 대한 원본 매크로 설정파일의 변화를 체크하여 필요시 해당 매크로를 리로드한다. 이것은 컨테이너 재기동 없이 매크로 라이브러리를 바꾸고 테스트 하도록 해준다. 모드는 오직 caching resource 안에서 off일때만 작동한다. ( : file.resource.loader.cache = false). 속성은 운영단계가 아닌 개발단계에서만 사용하도록 권장한다.

    매크로의 인자로서 다른 매크로나 디렉티브(명령어) 이용할 있나?

    다음 처럼 말이다.

    #center( #bold("hello") ) 

    그럴 없다. 명령은 타당하지 않다.

    그러나 당신은 아래 예제처럼 문제를 우회하여 해결할 있다.

    #set($stuff = "#bold('hello')" )
    #center( $stuff )
    #center( "#bold( 'hello' )" )

    결과는 동일하다.

    다른 예제를 살펴보자.

    #macro( inner $foo )
      inner : $foo
    #end
     
    #macro( outer $foo )
       #set($bar = "outerlala")
       outer : $foo
    #end
     
    #set($bar = 'calltimelala')
    #outer( "#inner($bar)" )

    결과는 아래와 같다.

    outer : inner : outerlala

    어떻게 문자열을 연결해야 하나?

    당신은 단순히 연결해야 문자열들을 같이 놓으면 된다. 아래 예제를 통해 살펴보라.

    #set( $size = "Big" )
    #set( $name = "Ben" )
     
    The clock is $size$name.
    #set( $size = "Big" )
    #set( $name = "Ben" )
     
    #set($clock = "$size$name" )
     
    The clock is $clock.
    #set( $size = "Big" )
    #set( $name = "Ben" )
     
    #set($clock = "${size}$name" )
     
    The clock is $clock.

    결과는 모두 동일하게 "The clock is BigBen' 된다.

     

    프레임워크 내장 객체의 사용

    TDF2에서 지원하는 Velocity 템플릿에서 사용가능한 내장 객체 레퍼런스를 소개한다.

    *      $actionInstanceVariable

    *      $req - 현재 HttpServletRequest

    *      $res - 현재 HttpServletResponse

    *      $stack - 현재 OgnlValueStack

    *      $ognl - OgnlTool

    *      $webwork - WebWorkUtil 인스탄스

    *      $action - 현재 WebWork action

    *      $taglib (또는 이와 유사한 ) - Velocity 매크로를 통한 JSP tag 라이브러리에 접근 가능

    $actionInstanceVariable

    당신이 만든 Action 클래스의 멤버변수들에 대해 $actionInstanceVariableName 으로써 Velocity 템플릿이 접근할 있도록 해준다.

    만약 당신의 Action 클래스에서 아래와 같은 멤버변수를 가진다고 하자.

    public class ProcessEditTableRowAction extends ActionSupport {
     
            private String fooString;
            ....
     
            public String getFooString() { 
                   return fooString; 
            }
            ....

    경우, Velocity 템플릿에서 아래와 같은 레퍼런스를 통해 멤버변수의 값을 꺼낼 있다.

    $fooString

    $req

    당신이 사용하는 서블릿 환경(Tomcat, Resin, etc....)에서 생성되어 관리되는 현재의 HttpServletRequest 인스탄스

    $res

    당신이 사용하는 서블릿 환경(Tomcat, Resin, etc....)에서 생성되어 관리되는 현재의 HttpServletResponse 인스탄스

    $stack

    com.opensymphony.xwork.util.OgnlValueStack 인스탄스

    $ognl

    com.opensymphony.webwork.views.jsp.ui.OgnlTool 인스탄스

    Jason/Patrick 의하면, OgnlTool static 클래스 멤버에 접근할 있는 아주 멋진 Tool이다. Velocity에서는 Context 설정되지 않은 클래스 변수나 메소드에 접근하는 기능을 제공하지 않는다. 그래서 당신은 템플릿 내에서 다음과 같은 메소드를 호출할 없다.

    $java.lang.Math.random()

    그러나 $ognl 이용하면 아래와 같은 구문이 가능해진다.

    $ognl.findValue("@java.lang.Math@random()")

    $webwork

    com.opensymphony.webwork.util.WebWorkUtil 인스탄스

    Mathew 따르면 $webwork 다른 객체를 인스탄스화(초기화) 있는 기능을 제공한다. Velocity에서는 Context 설정되지 않은 객체를 초기화하는 방법을 제공하지 않기 때문에 기능은 매우 유용하다.

    객체를 초기화하기 위해 당신은 템플릿 내에서 다음과 같은 문장을 사용할 있다.

    #set($object = $webwork.bean("com.foo.ClassName"))

    $action

    현재 템플릿을 호출한 Action 컨텍스트의 인스탄스

    $taglib

    TDF2에서는 디자이너와의 혼선을 피하기 위해 taglib 사용을 권장하지 않는다. 대부분의 지원 태그가 (form) 관련된 내용이고, 이것의 사용으로 많은 이점을 제공한다고 보기 어렵기 때문에 TDF2에서는 가급적 익숙한 HTML 표준 태그를 이용하기를 권장한다.

    $taglib 대한 자세한 정보를 알고 싶다면 http://wiki.opensymphony.com/display/WW/UI+Tags?showChildren=true#children 방문하라.

     

    아파치 벨로시티를 사용한 템플릿 기반의 자동 코드 생성 - 1

    05/05/2004

    상업적으로나 오픈소스로나 여러가지 형태로 제공되는 코드 생성기는 템플릿과 템플릿 엔진을 사용하고 있다. 기사에서 필자는 템플릿 기반의 코드 생성과 템플릿과 변환 방법, 그리고 그런 것들을 사용함으로써 얻게 막대한 이득에 대해 설명해보고자 한다. 그리고 벨로시티를 사용한 간단한 자바 코드 생성기를 만들어 것이다. 코드 생성기는 클래스를 XML 표현한 XML 파일을 입력으로 받아들여 XML 명시하고 있는 자바 코드를 생성하는 기능을 가지게 것이다. 생성과정은 결과물 코드로 뽑아낼 언어의 문법(신택스) 내부에 포함하고 있는 각각의 템플릿들에 의해 결정된다. 그리고 또한 다른 코드를 생성해내기 위하여 템플릿을 어떻게 사용하는지도 주목해서 보라.

    템플릿과 변환

    템플릿을 기반으로 변환을 소프트웨어 개발에 있어 엄청나게 광범위하게 사용된다. 많은 툴들이 문서의 포맷을 변환시키기 위하여 사용하기도 한다. XML 파일을 다른 특정 포맷으로 변환시키기 위하여 XSL 템플릿을 기반으로 하여 XSLT 사용하는 것이 예라고 있다. 그림1 템플릿 변환 과정에 있어 관계있는 4개의 컴포넌트를 보여주고 있다. 그것들은 다음과 같다:

    데이터 모델: 특정한 구조를 이루며 데이터를 포함하고 있다. 데이터는 변환되어야 것들이며 변환 과정 중에 이용된다.
    템플릿: 데이터 모델을 특정한 결과 코드로 포맷팅한다. 물론 그것을 위해서 템플릿은 내부에 데이터 모델의 레퍼런스를 가지고 사용하게 된다.
    템플릿 엔진: 변환 과정을 직접 수행하는 어플리케이션이다. 입력으로 데이터 모델과 템플릿을 받아들여 템플릿에 적힌 데이터 모델의 레퍼런스를 실제 데이터 모델의 값으로 치환하여 템플릿을 통한 변환 과정을 수행한다.
    결과물: 변환 과정을 거친 나오는 결과물

    그림 1.템플릿 기반 변환

    다음의 데이터 모델의 예를 한번 보자.:

    #person.txt
     
    $name=
    길동
    $surname=


    길동씨의 이름과 성을 포함하고 있는 텍스트 파일이다. 우리는 다음과 같은 형태의 템플릿을 통해 이것을 변환시키고 싶어졌다.:

    #person.template


    안녕하시오. $surname 가고 이름은 $name 이오. 템플릿또한 텍스트 파일이다. 두개의 데이터 모델에 대한 레퍼런스를 포함하고 있는데 $name $surname이란 레퍼런스가 그것이다.

    만약 템플릿 엔진 어플리케이션 이름이 transform이라면 다음과 같이 데이터 모델과 위의 템플릿을 넘겨주어 다음과 같이 변환을 수행할 수가 있다.:

    > transform person.txt person.template
    결과물은:

     

    안녕하시오. 가고 이름은 길동 이오. 템플릿 엔진은 데이터 모델로부터 얻어낸홍길동이라는 값을 $name $surname 레이블을 치환하였다.

    한마디: 템플릿 기반의 변환에서 가장 중요한 점은 어떠한 결과물을 뽑아내는 프로그램 자체를 건드리지 않고도 결과물의 포맷을 맘대로 바꿀 있다는 점이다. 결과물을 바꾸고 싶으면 단지 해야 일은 템플릿을 조금 수정하는 뿐이다. 여기 다음의 템플릿을 한번 보라.:

    #person2.template
     
    ***********************
    이름 = $name
     = $surname
    ***********************


    여기서는 위에서 사용했던 같은 데이터 모델과 새로운 템플릿 사용하여 변환 과정을 수행해 보겠다.:

    > transform person.txt person2.template


    결과로는:

    ***********************
    이름 = 길동
     =
    ***********************


    위에서 보았던 것과 같이 단지 템플릿만 수정함으로 결과를 조작할 수가 있다.

    템플릿 기반 코드 생성

    코드 생성과정또한 분명하게 위에서와 같은 변환 과정이다. 데이터 모델은 뽑아낼 코드의 중심이 되는 엔티티의 정보를 담고 있는 것이라고 수가 있고 템플릿을 뽑아낼 결과물 코드의 언어 문법을 표현한다고 수가 있다.

    또다른 작은 예로는 언어 독립적인 코드 생성을 보여준다. 여기 예를 보라.:

    #student.txt
     
    $name=Student
    $base=Person


    파일은 클래스 이름과 클래스의 베이스 클래스(부모 클래스) 명시하고 있다. 이것을 기반으로 자바 코드 Student 클래스를 뽑고 싶으면 다음과 같은 템플릿을 사용하면 된다.:

    #javaclass.template
     
    public class $name extends $base {
    }


    위의 데이터 모델과 템플릿을 입력받은 템플릿 엔진은 다음과 같은 변환 결과를 출력할 것이다.:

    public class Student extends Person {
    }


    Student
    클래스의 정의 코드다. 우리는 데이터 모델과 템플릿으로부터 코드 생성을 시작할 수가 있다.

    인터페이스를 만들려면 템플릿을 조금만 바꾸면 된다.:

    #javainterface.template
     
    public interface $name implements $base {
    }


    위의 템플릿을 템플릿 엔진에다 넣으면 다음과 같은 결과가 출력된다.

    public interface Student implements Person {
    }


    엔진은 Student 클래스가 아닌 인터페이스로도 뽑게 준다. 여기에서의 장점은 데이터 모델이나 템플릿 엔진 둘다 건드릴 필요 없이 작업을 했다는 것이다.

    그리고 언어 독립성을 보여주기 위해 C++코드를 만들 있게 템플릿을 작성해 보자.:

    #cpp.template
     
    class $name : public $base
    {
    }


    결과물은:

    class Student : public Person
    {
    }


    C++
    에서의 Student클래스 정의가 나왔다. 물론 데이터 모델이나 엔진을 고치지 않았다. 우리는 같은 것을 기반으로 템플릿만 바꿔서 다른 언어의 코드를 만들어 것이다! 이건 주목할만한 것인데 디자인되고 템플릿을 기반으로 하는 코드 생성기는 단지 템플릿만 바꿔도 다른 언어의 코드를 생성할 있도록 준다. 그래서 우리는 언어에 종속적이지 않고 디자인된 객체 모델을 만들어야 하는 것이다.

    아파치 벨로시티

    이전 예제에서 $ 시작되는 문자열을 데이터 모델로 치환시켜주는 가상의 간단한 템플릿 엔진을 가정하고 설명을 해왔다. 이제 진짜 코드를 생성하기 위해서 진짜 템플릿 엔진을 사용해 보도록 하자.

    아파치 벨로시티 템플릿 엔진은 자카르타 오픈 소스 툴이다. VTL(벨로시티 템플릿 랭귀지) 라고 불리는 간단한 템플릿 언어를 기반으로 동작한다. 벨로시티는 자바를 기반으로 동작하도록 제작되었으며 벨로시티 컨텍스트에 연결된 일반 자바 클래스를 데이터 모델로써 사용한다. 변환 과정은 템플릿과 컨텍스트를 입력으로 받아 템플릿에 명시된 포맷대로의 결과물을 내는 것으로 이루어진다. 변환 과정 중에 템플릿의 레이블들은 컨텍스트에 포함된 실제 데이터로 치환된다.

    나는 샘플 코드를 J2SE 1.4.2 벨로시티 1.4 기반으로 작성했고 테스트도 보았다. 이를 사용하기 위해서는 클래스패스에 개의 jar 파일 - velocity-1.4-rc1.jar and velocity-dep-1.4-rc1.jar. – 포함해야 한다.

    실전에서의 벨로시티

    다음 예제는 벨로시티를 사용한 간단한 코드 생성기인데 멤버 변수와 접근자 메소드(get/set 메소드) 포함한 간단한 자바 클래스를 생성하는 기능을 갖고 있다. 데이터 모델은 클래스들의 이름과 클래스들의 애트리뷰트 이름을 명시하고 있는 XML 파일로써 제공된다 여기 입력 데이터 모델 파일을 한번 보라.:

    <?xml version="1.0" encoding="UTF-8"?>
    <!-- order.xml --!>
    <Content>  
           
      <Class name="Customer">
        <Attribute name="code" type="int"/>
        <Attribute name="description" type="String"/>
      </Class>
       
      <Class name="Order">
        <Attribute name="number" type="int"/>
        <Attribute name="date" type="Date"/>        
        <Attribute name="customer" type="Customer"/>        
      </Class>    
     
    </Content>

     

    XML 파일 구조는 말할 것도 없이 쉽다. 엘레먼트는 클래스들 의미하며 요소는 클래스의 데이터 멤버를 의미한다. 예제는 Customer 클래스와 Order 클래스를 명시하고 있다. 코드 생성기는 문서를 읽어들여 Customer클래스와 Order클래스를 생성해낼 것이다.

    다음으로 생성기를 구현해 보자. 첫번째 일은 XML데이터 구조를 표현하기 위한 내부 구조를 만드는 것이다. 그러기 위해 두개의 자바 클래스를 만들 것인데 위의 요소를 표현하기 위한 것이다. 표현하기 위한 디스크립터 클래스는 다음과 같다.:

    // ClassDescriptor.java
    package com.codegenerator.example1;
     
    import java.util.*;
     
    public class ClassDescriptor {
      private String name;
      private ArrayList attributes = new ArrayList();
      public void setName(String name) {
        this.name = name;
      }
      public String getName() {
        return this.name;
      }
      public void addAttribute(AttributeDescriptor attribute) {
        attributes.add(attribute);
      }
      public ArrayList getAttributes() {
        return attributes;
      }
    }


    ClassDescriptor
    클래스는 요소에 명시된 데이터를 담기 위해 사용된다. Name 애트리뷰트는 클래스 이름을 담기 위해 사용하고 attributes 여러 개의 AttributeDescriptor 담기 위하여 사용되는데 AttributeDescriptor클래스는 ClassDescriptor 마찬가지로 요소의 내용을 담기 위해 사용되는 클래스이다. 다음을 보라:

    // AttributeDescriptor.java
     
    package com.codegenerator.example1;
     
    import java.util.*;
    public class AttributeDescriptor {
      private String name;
      private String type;
      public void setName(String name) {
        this.name = name;
      }
      public String getName() {
        return this.name;
      }
      public void setType(String type) {
        this.type = type;
      }
      public String getType() {
        return this.type;
      }
    }

    XML파일을 디스크립터 클래스들에 담기 위해 SAX파서를 사용하는데 다음과 같이 한다.:

    package com.codegenerator.example1;
     
    import java.util.*;
    import javax.xml.parsers.*;
    import org.xml.sax.*;
    import org.xml.sax.helpers.*;
     
    public class ClassDescriptorImporter extends DefaultHandler {
     
      private ArrayList classes = new ArrayList();
     
      public ArrayList getClasses() {
        return classes;
      }
     
      public void startElement(String uri, String name,
        String qName, Attributes attr) throws SAXException {
     
        // Imports <Class>  
        if (name.equals("Class")) {
          ClassDescriptor cl = new ClassDescriptor();
          cl.setName(attr.getValue("name"));
          classes.add(cl);
        }
     
        // Imports <Attribute>
        else if (name.equals("Attribute")) {
          AttributeDescriptor at = new AttributeDescriptor();
          at.setName(attr.getValue("name"));
          at.setType(attr.getValue("type"));
          ClassDescriptor parent = 
            (ClassDescriptor) classes.get(classes.size()-1);
          parent.addAttribute(at);
     
        }
     
        else if (name.equals("Content")) {
        }
     
        else throw new SAXException("Element " + name + " not valid");
      }  
    }

     

    ClassDescriptorImport 클래스가 하는 일은 SAX 기본 핸들러를 익스텐즈하여 XML로부터 디스크립터 클래스로 데이터를 변환하는 것이다. 위에서 있듯이, 요소가 한번씩 처리될 때마다 ClassDescriptor 클래스의 새로운 인스턴스를 만들어내고 핸들러의 ArrayList 삽입한다. 또한 파서는 요소를 처리할 때마다 새로운 ClassAttribute클래스를 생성해내고 부모 ClassDescriptor 인스턴스에 그것을 삽입한다. 파싱 작업의 마지막에 classes변수는 XML문서에 명시된 모든 클래스들의 디스크립터 클래스를 가지게 된다.getClasses 메소드는 ArrayList 반환한다.

    시점에서 벨로시티가 등장한다. 자바 클래스와 get/set메소드를 만들어내기 위해 작성된 VTL템플릿은 다음과 같다.:

    ## class.vm
     
    import java.util.*;
     
    public class $class.Name {
     
    #foreach($att in $class.Attributes)  
      // $att.Name
      private $att.Type $att.Name;
      public $att.Type get$utility.firstToUpperCase($att.Name)() {
        return this.$att.Name;
      }    
      public void set$utility.firstToUpperCase($att.Name)($att.Type $att.Name) {
        this.$att.Name = $att.Name;
      }
           
    #end
    }


    $class
    라는 레이블은 ClassDescriptor 인스턴스를 가리킨다. 따라서 $class.Name 결국 ClassDescriptor.getName 호출함으로 얻어내는 결과를 출력하는 것이다. ( 실제로 $class.Name $class.getName() 축약형인데 모든 get 으로 시작하는 메소드에 대하여 이런 축약형이 적용된다.). 해당 ClassDescriptor 속한 AttributeDescriptor들의 리스트를 참조하기 위해서는 $class.Attributes 라는 레이블을 사용하면 된다. #foreach 구문은 List $class.Attributes 포함된 모든 항목에 대해 루프를 실행한다. 루프 안쪽의 구문은 $att.Name $att.Type 따른 데이터 멤버와 get/set 메소를 정의하고 있다.

    $utility.firstToUpperCase 레이블은 사용자가 정의한 유틸리티 클래스를 호출하게 하는데 인자로 받은 문자열의 글자를 대문자로 바꿔주는 기능을 가지고 있따. 메소드는 매우 유용한데 예를 들면 number라는 데이터 멤버로부터 getNumber라는 메소드명을 얻어 사용하면 된다.

    코드 생성기

    이제 남은건 메인 어플리케이션이다. 그것은 XML파일을 읽어서 디스크립터 클래스에 값을 집어넣고 벨로시티를 호출해 템플릿을 통한 변환 작업을 수행하게 된다.

    기사에서 ClassGenerator라는 전체 어플리케이션의 소스를 얻어낼 수가 있다. 가장 중요한 메소드는 start() 메소드다. 여기에 구현체가 있으니 한번 보라.:

    public static void start(String modelFile, String templateFile)
      throws Exception {
     
      // Imports XML
      FileInputStream input = new FileInputStream(modelFile);
      xmlReader.parse(new InputSource(input));
      input.close();
      classes = cdImporter.getClasses(); // ClassDescriptor Array
     
      // Generates Java classes source code
      // by using Apache Velocity
      GeneratorUtility utility = new GeneratorUtility();
      for (int i = 0; i < classes.size(); i++) {
     
        VelocityContext context = new VelocityContext();
        ClassDescriptor cl = (ClassDescriptor) classes.get(i);
        context.put("class", cl);
        context.put("utility", utility);
     
        Template template = Velocity.getTemplate(templateFile);
     
        BufferedWriter writer =
          new BufferedWriter(new FileWriter(cl.getName()+".java"));
     
        template.merge(context, writer);
        writer.flush();
        writer.close();
     
        System.out.println("Class " + cl.getName() + " generated!");
      }
    }


    메소드는 입력으로 XML 템플릿 파일명을 받는다. 메소드 내에서는 이전에 설명된 ClassDescriptorImporter 클래스의 cdImporter 인스턴스와 관계지어진 xmlReader 사용하여 데이터를 읽어들이게 된다. 당신이 있듯이 getClasses메소드를 통하여 클래스로 뽑아내어질 클래스들의 디스크립터 클래스들을 얻어낼 수가 있다. 루핑 코드 안에서 생성되어지는 context객체는 특히 중요한데 왜냐하면 그것은 디스크립터 클래스 인스턴스와 템플릿간의 연결을 제공하기 때문이다. 사실 Context.put 메소드는 자바 객체를 템플릿 레이블과 매핑을 시키게 된다. 다음과 같은 구문을 실행하는 것이 그런 매핑을 수행한다.:

    context.put("class", cl);
    context.put("utility", utility);


    클래스 디스크립터의 인스턴스인 cl 객체는 템플릿에서 $class 레이블로 접근할 수가 있고 유틸리티 클래스는 $utility 레이블을 이용해서 접근할 수가 있다. 마지막의 유틸리티 클래스는 GeneratorUtility 클래스의 인스턴스로 filrstInUpperCase() 메소드를 사용하기 위하여 컨텍스트에 삽입한다.

    컨텍스트에 템플릿에서 처리할 데이터를 put 다음에는 start() 메소드에서 제공받은 대로 특정 템플릿 파일에 대한 Template 객체를 생성하고 merge 메소드를 호출한다. 그러면 템플릿 기반의 변환 작업이 수행된다. 컨텍스트의 데이터는 템플릿에 의해 처리되고 결과는 결과 witer 인스턴스의 스트림에 쓰여지게 된다.

    아래 예제에서 코드생성기를 데이터 모델로 ordedr.xml , 템플릿으로 class.vm 입력으로 사용하여 돌려보면 Customer.java 파일을 얻게 것이다. 실제 구현 코드를 한번 보자:

    import java.util.*;
     
    public class Customer {
     
      // code
      private int code;
      public int getCode() {
        return this.code;
      }    
      public void setCode(int code) {
        this.code = code;
      }
           
      // description
      private String description;
      public String getDescription() {
        return this.description;
      }    
      public void setDescription(String description) {
        this.description = description;
      }
     
    }

     

    import java.util.*;
     
    public class Order {
     
      // number
      private int number;
      public int getNumber() {
        return this.number;
      }    
      public void setNumber(int number) {
        this.number = number;
      }
           
      // date
      private Date date;
      public Date getDate() {
        return this.date;
      }    
      public void setDate(Date date) {
        this.date = date;
      }
     
      // customer
      private Customer customer;
      public Customer getCustomer() {
        return this.customer;
      }    
      public void setCustomer(Customer customer) {
        this.customer = customer;
      }
    }

     

    결론

    템플릿 기반의 코드 생성기를 개발하면 가지 경우에 그것을 사용할 수가 있다.:

    1.    다른 클래스의 생성을 위해 데이터 모델을 변경할 .

    2.    다른 프로그래밍 언어에 맞는 템플릿을 제공하여 다른 언어의 코드를 뽑아내고 싶을 .

    두가지 사용예는 코드 생성기 자체를 건드리지 않고 수행할 있다. 따라서 템플릿 기반의 코드 생성기는 특정 언어의 코드만 뽑아내게 설계된 생성기에 비해 훨씬 유연하다.

    기사의 2장에서는 훨씬 복잡한 상황에서의 템플릿 코드 생성을 알아 것이다. 특별히 필자는 Internal Model Object(아래 참고자료 7) 사용한 템플릿의 사용법에 대해 알아볼 것이며 특정 언어의 코드 생성에 종속적인 벨로시티 컨텍스트를 비종속적인 컨텍스트로 작성하는 방법에 대한 패턴을 알아볼 것이다.

     

    Posted by 1010
    98..Etc/velocity2009. 1. 23. 14:59
    반응형
    VTL (Velocity Template Language)에 대해서는 여지껏 접해본바 없는 상황인지라 문법 익히기에도 급급하다.
    대충 문법 정의 문서를 살펴보니 그리 어려운 언어는 아니라는 결론을 얻었다.

    HTML 사용 하는거야 그냥 똑같이 쓰면 되고, 그 안에 스크립트를 끼워 넣는 것인데...
    좀 더 쓰다 보면 익숙해지겠지... :-)

    자.. 이제 익숙해지는 단계 이전까지는 뭔가 도움이 될만한 것들을 찾아봐야 하는데, 역시나 이클립스를 무시할 수가 없다. Velocity 코드 작성을 위한 Plug-In이 분명 존재할 것이란걸 믿고 찾아봤더니...
    세상에나... 정말로 있다!!

    Eclipse 사이트의 Plug-In Central 화면 캡춰



    이제 설치를 해보자.

    Velocity WebEditor - Eclipse Plugin : 아래 다운로드 클릭
    상단에 링크된 파일을 다운받아서 압축을 해제하면 plugin 디렉토리가 생성되고 그 안에 실제로 설치에 필요한 디렉토리 및 파일들이 존재한다.


    com.hudson.velocityweb_1.0.8 디렉토리를 Eclipse 설치 디렉토리 아래 plugins 디렉토리 하위에 복사.

    Eclipse가 실행 중이었다면 재실행 해야 반영된다.


    VM 파일을 수정하는 화면이다. 가장 도움이 되는 기능이 Syntex Coloring 과 Code Assist 기능이 지원된다는 것.
    이제 눈을 부릅뜨고 코딩하는 일만 남았다.

    조금이라도 빨리 퇴근하길 바라는 마음에서... ㅠ_ㅠ
    Posted by 1010
    98..Etc/velocity2009. 1. 23. 14:50
    반응형

    JSTL과 Velocity를 활용한 UI 레이어 구현 방법

    Table of Contents

    JSTL

    소개

    • J2EE 소형 클라이언트 기술인 JSP(JavaServer Pages)가 지난 몇 년 동안 널리 일반화되면서 독립적인 개발자들은 많은 사용자 정
      의 JSP 태그 라이브러리를 만들었습니다. 이러한 태그 라이브러리는 대부분 서로 다른 목표를 달성하도록 작성되었지만 반복, 조건 등의 일
      반적인 작업을 위한 유사한 솔루션을 제공하는 경향이 있습니다.
      유사하고 일반적이 문제점을 해결하는 독립적인 태그 라이브러리에 대한 필요성을 줄이기 위해 Java Community Process(JSR 52)의 지
      원하에 JSTL(JavaServer Pages Standard Tag Library)이 개발되었습니다. JSTL은 이러한 일반 기능을 처리하는 하나의 표준 솔루션
      을 제공합니다. (말그대로 표준태그라이브러리)
    • JSTL의 주요 강점 중 하나는 서블릿 컨텍스트에 저장된 데이타 같은 애플리케이션 데이타를 액세스 및 조작하는 쉬운 방법을 제공하는 간
      단한 EL을 사용할 수 있다는 것입니다.

    EL 에 대하여

    설치 방법

    • http://cvs.apache.org/builds/jakarta-taglibs/nightly/ 에서 다운
      \jakarta-taglibs-20051024\jakarta-taglibs\standard\lib
      에서 jstl 과 standard 파일 을 이 두개의 jar 파일을 우리의 웹애플리케이션의 /WEB-INF/lib 폴더에 넣습니다
      그 다음 tld 폴더의 tld 파일을 /WEB-INF/lib/tld 폴더 아래 넣습니다.
    • web.xml 에
       
          <!-- jstl 1.2 taglig -->
           <taglib>
             <taglib-uri>jstl-c</taglib-uri>
             <taglib-location>/WEB-INF/tlds/jstl/c.tld</taglib-location>
          </taglib>
          <taglib>
             <taglib-uri>jstl-fmt</taglib-uri>
             <taglib-location>/WEB-INF/tlds/jstl/fmt.tld</taglib-location>
          </taglib>
          <taglib>
            <taglib-uri>jstl-fn</taglib-uri>
            <taglib-location>/WEB-INF/tlds/jstl/fn.tld</taglib-location>
          </taglib>
          

      를 추가한다.

    • jsp 에 추가
       
           <%@ taglib uri="jstl-c" prefix="c" %>
          <%@ taglib uri="jstl-fmt" prefix="fmt" %>
          <%@ taglib uri="jstl-fn" prefix="fn" %>
           

    사용 예(기본 문법)

    Area Subfunction Prefix Description
    Core Variable support c 변수지원
    Core Flow control c 흐름제어
    Core URL management c URL 처리
    Core Miscellaneous c  
    XML Core x XML 코어
    XML Flow control x 흐름 제어
    XML Transformation x XML 변환
    I18n Locale fmt 지역
    I18n Message formatting fmt 메시지 형식
    I18n Number and date formatting fmt 숫자 및 날짜 형식
    Database SQL sql SQL
    Functions Collection length fn 콜렉션 처리
    Functions String manipulation fn String 처리

    http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/index.html 참고

    • 변수지원태그
      set: <c:set var="varName" scope="session" value="someValue">
      var속성은 값을 지정할 변수의 이름
      <c:set t a r g e t ="" property="userName" value="someValue">
      target : 빈 프로퍼티나 맵 값을 설정한다.(Object)
      var와 target을 동시에 사용할 수 없다.
      scope속성은 변수가 위치하는 영역(page,request,session,application)
      value :저장하는 값
      remove :<c:remove var="varName" scope="session">
      var :삭제할 변수의 이름
      scope 속성은 삭제할 변수의 영역
      out : <c:out value="">
      value속성은 출력하려는 값
      catch : <c:catch var="">
      </c:catch>
      예외사항이 한번이라도 발생시 </c:catch>로 점프
      var에 정의 된 객체를 페이지 생존범위에 자동으로 묶어 나중에 var에 정의된 변수이름을 사용할 수 있다.
      예외 발생시
      : var 속성 사용시 exception 객체를 설정.
      <c:catch> 문 밖으로 제어가 떨어진다
     
        <c:set var="num1" value="${20}" />
    	<c:set var="num2">
    		10.5
    	</c:set>
    	
    	<c:set var="today" value="<%= new java.util.Date()%>" /><br>
    
    	변수 num1 = ${num1} <br>
    	변수 num2 = ${num2} <br>
    	num1 + num2 = ${num1+num2}<br>
    	오늘은 ${today}입니다.
    	
    	<c:remove var="num1" scope="page" />
    	
    	<p>
    	삭제한 후의  num1=${num1} <br>
    	삭제한 후의 num1 + num2 = ${num1 + num2}
       
     
           <c:catch var="myException">
         	It's catch
             <% int x = 10/0; %>
             실행안됨.
           </c:catch>
           <c:if test="${myException != null}">
               발생된 예외는 : ${myException.message} <br>
           </c:if>
         
    • URL 관련
      import : <c:import url=""/>
      url속성에 명기한 파일을 현재 컨텐츠에 포함
      param : <c:param name="" value=""/>
      <jsp:param />과 같은 역할
      url : <c:url value="" var=""/>
      value에 들어있는 상대 경로 뒤에 jsessionid를 추가한다.(쿠키를 사용 못하는 경우)
      var : 옵션 속성으로 url을 참조하기 위해쓴다.
      redirect :<c:redirect url="' context=""/>
      context : url경로의 이름
     
        <c:import url="Header.jsp" >
    	<c:param name="subTitle" value="This is subTitle"/>
        </c:import>
       
    • 흐름제어 태그
      if : <c:if test="조건"> </c:if>
      test속성의 값에는 "조건"이 오는데 이 조건문의 결과값이 true 면 처리
       
         <c:if test="true">
           무조건 수행<br>
          </c:if>
      
          <c:if test="${param.name == 'bk'}">
            name 파라미터의 값이 ${param.name}입니다 <br>
          </c:if>
      
          <c:if test="${param.name eq 'bk'}">
            name 파라미터의 값이 ${param.name}입니다 <br>
          </c:if>
      
          <c:if test="${18 < param.age}">
      	 당신의 나이는 18세 이상입니다.
          </c:if>   
         

      choose,when,otherwise : <c:choose>
      <c:when test="조건">
      </c:when>
      <c:otherwise>
      </c:otherwise>
      </c:choose>
      choose 태그는 자바의 switch 문과 if-else 의 혼합한 형태, 다수의 조건문을 하나의 블록에서 수행하고자 할때 사용
      -> switch문과의 차이점은 중간에 빠져 나가지 못한다는 것이다.
      -> when 의 어느 하나에도 실행되지 않을때 otherwise 실행
      -> otherswise 태그가 반드시 있어야 하는것은 아니다.

     
         <c:choose>
           <c:when test="${param.name == 'bk' }">
    	<li>당신의 이름은 ${param.name}입니다.
         </c:when>
         <c:when test="${param.age > 18 }">
    	<li>당신은 18세 이상입니다.
         </c:when>
    
         <c:otherwise>
    	<li> 당신은 'bk'가 아니고 18세 이상이 아닙니다.
         </c:otherwise>
         </c:choose> 
        

    forEach : <c:forEach var="변수" items="아이템" begin="시작값" end="끝값" step="증가값">
    </c:forEach>
    item 속성에 올수 있는 것들로는 Map,배열,Collection 이 있다.
    varStatus는 javax.servlet.jsp.jstl.core.LoopTagStatus 객체 인스턴스변수를 만들며 count라는 프로퍼티가 있어 몇번의 회전인지 알 수있다.

     
           <c:forEach var="i" begin="1" end="9">
    	<li>4 *${i} = ${4 *i}
           </c:forEach>
    
           <h4>int 형 배열</h4>
    
           <c:forEach var="i" items="${intArray}" begin="2" end="4">
    	[${i}]
           </c:forEach>
    
           <h4>Map</h4>
           <c:forEach var="i" items="${map}">
    	  ${i.key} = ${i.value}<br>
           </c:forEach>
    
           <c:forEach var="member" items="${memberList}" varStatus="memberLoopCount">
    	  회원 $(memberLoopCount.count} : ${member} <br>
           </c:forEach>
         

    forTokens : <c:forTockens var="token" items="문자열" delins="구분자">
    </c:forTockens>
    forTokens 태그는 StringTokenizer 와 같은 기능을 제공한다.

     
           <c:forTokens var="token" items="빨강색, 주황색, 노란색, 초록색, 파랑색, 남색, 보라색" delims=",">
         	${token}<br>
           </c:forTokens>
         
    • 숫자 및 날짜 지원 형식
      The JSTL formatting actions allow various data elements in a JSP page, such as numbers,dates and times
      to be formatted and parsed in a locale-sensitive or customized manner.

    formatNumber : 숫자 형식을 표현

     
     
          number  : <fmt:formatNumber value="9876543.61" type="number"/>
          currency: <fmt:formatNumber value="9876543.61" type="currency"/>
          percent : <fmt:formatNumber type="percent">9876543.61</fmt:formatNumber>
    
          pattern=".000"    :<fmt:formatNumber value="9876543.61" pattern=".000" />
          pattern="#,#00.0#":<fmt:formatNumber value="9876543.612345" pattern="#,#00.0#"/>
        

    parseNumber : 정해진 패턴을 문자열에서 수치를 파싱해내는 태그
    formatDate :날짜 형식을 표현

     
          <jsp:useBean id="now" class="java.util.Date"/>
    	
             <c:out value="${now}"/>
               date: <fmt:formatDate value="${now}" type="date"/>
               time: <fmt:formatDate value="${now}" type="time"/>
               both: <fmt:formatDate value="${now}" type="both"/>
    
               default:<fmt:formatDate value="${now}"
                            type="both" dateStyle="default" timeStyle="default"/>
               short  :<fmt:formatDate value="${now}"
                            type="both" dateStyle="short"   timeStyle="short"  />
               medium :<fmt:formatDate value="${now}"
                            type="both" dateStyle="medium"  timeStyle="medium" />
               long   :<fmt:formatDate value="${now}"
                            type="both" dateStyle="long"    timeStyle="long"   />
               full   :<fmt:formatDate value="${now}"
                            type="both" dateStyle="full"    timeStyle="full"   />
    
              pattern="yyyy년MM월dd일 HH시mm분ss초"
                 <fmt:formatDate value="${now}" type="both"
                                 pattern="yyyy년MM월dd일 HH시mm분ss초"/>
                
             <fmt:formatDate value="${now}" pattern="yyyy/MM/dd" />

    parseDate :정해진 패턴의 문자열에서 날짜를 파싱해내는 태그
    timeZone : <fmt:timeZone value=""/>

    setTimeZone : <fmt:timeZone value="" var="" scope=""/>

    • 국제화
      message <fmt:message
      setLocale <fmt:setLocale
      bundle <fmt:bundle
      setBundle <fmt:setBundle
      param <fmt:param
      requestEncoding <fmt:requestEncoding
    • SQL
      <sql:query sql="sqlQuery" var="varName" [scope="{page|request|session|application}"]
      [dataSource="dataSource"] [maxRows="maxRows"] [startRow="startRow"]>
      <sql:param>
      </sql:query>
           <sql:query var="customers" dataSource="${dataSource}">
            SELECT * FROM customers
            WHERE country ='China'
            ORDER BY lastname
           </sql:query>
           
           <table>
            <c:forEach var="row" items="">
               <tr>
                 <td><c:out value="${row.lastName}"/></td>
                 <td><c:out value="${row.firstName}"/></td>
                 <td><c:out value="${row.address}"/></td>
               </tr>
            </c:forEach>
           </table>
         

    <sql:update>
    <sql:setDataSource>
    <sql:param>
    <sql:dateParam>

    • XML 코어
      <x:parse>
      <x:out>
      <x:set>
    • 흐름제어
      <x:if>
      <x:choose>
      <x:when>
      <x:otherwise>
      <x:forEach>
    • XML 변환
      <x:transform>
      <x:param>
    • function
      contains
      containsIgnoreCase
      endsWith
      escapeXml
      indexOf
      join
      length
      replace
      split
      startsWith
      substring
      substringAfter
      substringBefore
      toLowerCase
      toUpperCase
      trim
           <c:if test="${fn:contains(name, searchString)}">
           <c:if test="${fn:containsIgnoreCase(name, searchString)}">
           <c:if test="${fn:endsWith(filename, ".txt")}">
           ${fn:escapeXml(param:info)}
           ${fn:indexOf(name, "-")}
           ${fn:join(array, ";")} 
           You have ${fn:length(shoppingCart.products)} in your shopping cart.
           ${fn:replace(text, "-", "•")}
           ${fn:split(customerNames, ";")}
           <c:if test="${fn:startsWith(product.id, "100-")}">
           P.O. Box: ${fn:substring(zip, 6, -1)}
           P.O. Box: ${fn:substringAfter(zip, "-")}
           Zip (without P.O. Box): ${fn:substringBefore(zip, "-")}
           Product name: ${fn.toLowerCase(product.name)}
           Product name: ${fn.UpperCase(product.name)}
           Name: ${fn.trim(name)}
         

    Velocity

    Velocity

    소개

    • 벨로시티란 자바 기반의 템플릿 엔진입니다.
      벨로시티를 활용하면 간단하면서도 강력한 템플릿 언어를 통하여 자바 코드에 정의된 객체를 액세스할 수 있습니다.
      벨로시티를 웹 개발에 사용하면, 웹 디자이너는 자바 프로그래머와 병렬로 작업을 할 수 있으며 MVC(모델-뷰-컨트롤러) 모델에 따라 웹 사이트를 개발할 수 있습니다. 더 자세히 설명하면 웹 페이지 디자이너의 경우 보기 좋은 사이트를 만드는 데만 집중하면 되고, 프로그래머는 잘 동작하는 코드를 만드는 데만 집중하면 된다는 뜻입니다.
      벨로시티는 웹 페이지와 자바 코드를 분리하여, 장기적인 측면에서 볼 때 웹 사이트를 손쉽게 유지보수할 수 있도록 하고, 자바 서버 페이지 (JSP) 또는 PHP를 대체할 수 있는 방안을 제시합니다. 벨로시티의 쓰임새는 웹 사이트에 국한되지 않습니다. 예를 들면, 템플릿으로부터 SQL이나 포스트스크립트, 또는 XML(XML 변환에 대해서는 벨로시티 툴 중 하나인 아나키아(Anakia)를 참조)문서를 생성하는 데 쓰일 수 있습니다. 벨로시티는 스탠드얼론 유틸리티처럼 사용하여 소스 코드나 리포트를 생성할 수도 있고, 다른 시스템의 컴포넌트로 통합할 수도 있습니다. 또한 벨로시티는 터빈 (또다른 자카르타 서브 프로젝트 중 하나) 웹 애플리케이션 프레임웍에 템플릿 서비스를 제공합니다. 벨로시티와 터빈을 조합하면 진정한 MVC 모델에 따라 웹 애플리케이션을 개발할 수 있습니다

    설치 방법

    • web.xml 수정
       
         <servlet>
           <servlet-name>velocity</servlet-name>
              <servlet-class>org.apache.velocity.tools.view.servlet.VelocityViewServlet
           </servlet-class>
           <init-param>
              <param-name>org.apache.velocity.toolbox</param-name>
              <param-value>/WEB-INF/velocity-toolbox.xml</param-value>
           </init-param>
           <init-param>
              <param-name>org.apache.velocity.properties</param-name>
              <param-value>/WEB-INF/velocity.properties</param-value>
             </init-param>
           <load-on-startup>10</load-on-startup>
         </servlet>
         <servlet-mapping>
            <servlet-name>velocity</servlet-name>
            <url-pattern>*.vm</url-pattern>
         </servlet-mapping>
       
    • 파일 생성
      velocity.properties 파일
      velocity-toolbox.xml 을 생성 한 후 web_inf/lib 아래 둡니다.
      velocity-toolbox.xml
      <tool>
         <key>date</key>
         <scope>application</scope>
         <class>org.apache.velocity.tools.generic.DateTool</class>
       </tool>
      
        <tool>
        <key>math</key>
        <scope>application</scope>
        <class>org.apache.velocity.tools.generic.MathTool</class>
      </tool>
       ...
      

    사용 예(기본 문법)

    Velocity Template Language(VTL) 은 Template 에서 사용되는 Velocity 고유의 언어를 의미합니다.

    • References(참조형)
      Variables(변수) - 다음과 같이 $를 먼저 쓰고 그 뒤에 식별자를 적어주는 방식으로 사용
      ex) $foo
      Property(특성) - $ 다음에 식별자를 쓰고, 마침표(.)후에 다시 식별자의 형태로 사용
      ex) $foo.name
      Method(메소드) - $다음에 식별자를 쓰고 마침표 후에 호출할 메소드의 이름을 적는다
      ex)$foo.getName()
    • Directive(지시형)
      #set - reference 의 값을 설정한다.
      #if/elseif/else - 조건문 제어
      #foreach ---- 제어
      #include - velocity 로 파싱되지 않는 파일의 출력
      #parse -velocity 로 파싱된 파일 출력
      #stop -template 엔진의 정지
      #macro - 반복적으로 사용할 vm정의
    • Comment (주석)
        ## - 한줄짜리 주석
        #* ... *# 여러줄 짜리 주석
        
         ##This is an example velocity template
         #set($this = "Velocity")
           $this is great! But It's so hard.
    
         #foreach($name in $list)
           $name is great!
         #end
    
         #set($condition = true)
         #if ($condition)
            The condition is true!
         #else
           The condition is false
         #end
      

    http://jakarta.apache.org/velocity/docs/vtl-reference-guide.html

    Tool box 에 대해

    VelocityTools is a collection of Velocity subprojects with a common goal of creating tools and infrastructure for building both web and non-web applications using the Velocity template engine.

    • Generic Tool (http://jakarta.apache.org/velocity/tools/generic/)
      *DateTool : A tool for manipulating and formatting dates
      *MathTool :A tool for performing floating point math.
      *NumberTool :A tool for formatting numbers
      *IteratorTool :A convenience tool to use with #foreach loops. It wraps a list to let the designer specify a
      condition to terminate the loop, and reuse the same list in different loops.
      *RenderTool:A tool to evaluate and render arbitrary strings of VTL (Velocity Template Language).
            Example uses:
        $date                         -> Oct 19, 2003 9:54:50 PM
        $date.long                    -> October 19, 2003 9:54:50 PM PDT
        $date.medium_time             -> 9:54:50 PM
        $date.full_date               -> Sunday, October 19, 2003
        $date.get('default','short')  -> Oct 19, 2003 9:54 PM
        $date.get('yyyy-M-d H:m:s')   -> 2003-10-19 21:54:50
       
        $myDate                        -> Tue Oct 07 03:14:50 PDT 2003
        $date.format('medium',$myDate) -> Oct 7, 2003 3:14:50 AM 
      
      
          
    • VelocityView (http://jakarta.apache.org/velocity/tools/view/)

    JSTL 과 Velocity

    같은 로직에 대해 두가지를 사용하여 각각 구현

    다양한 View Technology에 대한 실행 속도 비교.

    현재 개발중 우리들이 많이 사용하는 View 기술들을 이용하여 실행속도를 비교해 보면 다음 그래프와 같다.

    이 그래프는 100명의 동시 접속자에 대한 테스트를 진행한 결과이다. 이 그래프는 Expert One-on-One J2EE Design and Development 책의 Chapter 15의 Web-Tier Performance Issues에서 인용하였다.

    위와 같이 테스트를 진행한 결과 JSP는 초당 54페이지, Velocity는 초당 112페이지, XMLC는 초당 128 페이지, XSLT는 6,7페이지를 서비스하였다. 이 부분에서 눈여겨 볼 부분은 Velocity에 대한 결과라할 수 있다. 국내에서는 아직까지 많이 사용되지 않는 기술이지만 위의 실행 결과를 보면 사용할만한 가치가 있다는 것을 확인할 수 있다.

    참고문헌

    문서에 대하여

    최초작성자 : 박재성
    최초작성일 : 2005년 10월 15일
    버전 : 1.0
    문서이력 :

    • 2005년 10월 15일 박재성 문서 최초 생성 : 강좌 문서 템플릿 및 JSP와 Velocity에 대한 속도 비교문서 추가
    Posted by 1010
    98..Etc/velocity2009. 1. 23. 14:49
    반응형
    http://technet.ui2.co.kr/wiki/index.php/Velocity  velocity wiki 페이지

    velocity 를 기본적으로 사용하기 위한 jar  파일 목록이다.
    velocity-dep-*.jar : velocity 그리고 관련된 클래스 파일
    velocity-tools-*.jar : velocity tool
    commons-digester
    commons-collections
    commons-beanutils

    1. VTL(Velocity Template Language) 장점
    @ UI 디자이너와 개발자의 병렬 개발 가능
    @ 각각의 영역에 집중가능
    @ 유지보수 용의
    @ JSP,PHP 대체방안 제시

    2. VTL 문장은 # 으로 시작하며  변수명은 $ 로 표시한다.
    # set( $foo = "Velocity")

    3. 주석처리방법
    한줄 : ##
    여러줄 : #*  *#

    4. 자바객체사용해서 하위 객체 접근이 가능하다
    $ custom.Address
    $ custom.getAddress()

    5. 값을 불러오는 여러가지 방법
    $ customer.address 를 다음과 같이 표현할수 있다.
    $ getaddress()
    $ getAddress()
    $ get("address")
    $ isAddress()

    6. 중간에 변수가 들어가서 잘못 파싱되는것을 방지하기위해
    쓰는 방식인데
    기본적으로 이렇게 처리하는 버릇을 들이자.
    Jack is a $vicemaniac.
    Jack is a ${vice}maniac.

    7. 값이 없을 시에 공백처리를 원할때
    <input type="text" name="email" value="$!email>
    좀더 안전하기를 원하면 value="$!{email}"

    8. #set 지시자 사용시 큰따옴포("") 안의 내용은 파싱되어 그 결과물을 출력한다.
    #set( $template = "$directoryRoot / $templateName")

    9. '' 작은 따옴표는 파싱되지 않고 내용이 그대로 출력되지만
    velocity.properties 안의 Stringliterals.interpolote = false 값을 바꿈으로서 파싱이 되도록 설정한다.

    10. for 문으로 반복문을 처리하고 싶을때
    iterator 와 비슷한 형태의 구조이다.
    #foreach($page in $boardList)
    <!-- 처리하고자 하는 내용 -->
    #end

    11. if 문을 쓰고싶을때
    #if($velocityCount <= 3)
       $item
    #end
    Posted by 1010
    98..Etc/Etc...2009. 1. 19. 11:04
    반응형

    Phoenix/Tools

    From OWASP

    Jump to: navigation, search

    Please send comments or questions to the Phoenix-OWASP mailing-list.

    LiveCDs

    Monday, January 29, 2007 4:02 PM 828569600 AOC_Labrat-ALPHA-0010.iso - http://www.packetfocus.com/hackos/
    DVL (Damn Vulnerable Linux) - http://www.damnvulnerablelinux.org/

    Test sites / testing grounds

    SPI Dynamics (live) - http://zero.webappsecurity.com/
    Cenzic (live) - http://crackme.cenzic.com/
    Watchfire (live) - http://demo.testfire.net/
    Acunetix (live) - http://testphp.acunetix.com/ http://testasp.acunetix.com http://testaspnet.acunetix.com
    WebMaven / Buggy Bank (includes live testsite) - http://www.mavensecurity.com/webmaven
    Foundstone SASS tools - http://www.foundstone.com/index.htm?subnav=resources/navigation.htm&subcontent=/resources/s3i_tools.htm
    OWASP WebGoat - http://www.owasp.org/index.php/OWASP_WebGoat_Project
    OWASP SiteGenerator - http://www.owasp.org/index.php/Owasp_SiteGenerator
    Stanford SecuriBench - http://suif.stanford.edu/~livshits/securibench/
    SecuriBench Micro - http://suif.stanford.edu/~livshits/work/securibench-micro/

    HTTP proxying / editing

    WebScarab - http://www.owasp.org/index.php/Category:OWASP_WebScarab_Project
    Burp - http://www.portswigger.net/
    Paros - http://www.parosproxy.org/
    Fiddler - http://www.fiddlertool.com/
    Web Proxy Editor - http://www.microsoft.com/mspress/companion/0-7356-2187-X/
    Pantera - http://www.owasp.org/index.php/Category:OWASP_Pantera_Web_Assessment_Studio_Project
    Suru - http://www.sensepost.com/research/suru/
    httpedit (curses-based) - http://www.neutralbit.com/en/rd/httpedit/
    Charles - http://www.xk72.com/charles/
    Odysseus - http://www.bindshell.net/tools/odysseus
    Burp, Paros, and WebScarab for Mac OS X - http://www.corsaire.com/downloads/
    Web-application scanning tool from `Network Security Tools'/O'Reilly - http://examples.oreilly.com/networkst/
    JS Commander - http://jscmd.rubyforge.org/
    Ratproxy - http://code.google.com/p/ratproxy/

    RSnake's XSS cheat sheet based-tools, webapp fuzzing, and encoding tools

    Wfuzz - http://www.edge-security.com/wfuzz.php
    ProxMon - http://www.isecpartners.com/proxmon.html
    Wapiti - http://wapiti.sourceforge.net/
    Grabber - http://rgaucher.info/beta/grabber/
    XSSScan - http://darkcode.ath.cx/scanners/XSSscan.py
    CAL9000 - http://www.owasp.org/index.php/Category:OWASP_CAL9000_Project
    HTMangLe - http://www.fishnetsecurity.com/Tools/HTMangLe/publish.htm
    JBroFuzz - http://sourceforge.net/projects/jbrofuzz
    XSSFuzz - http://ha.ckers.org/blog/20060921/xssfuzz-released/
    WhiteAcid's XSS Assistant - http://www.whiteacid.org/greasemonkey/
    Overlong UTF - http://www.microsoft.com/mspress/companion/0-7356-2187-X/
    [TGZ] MielieTool (SensePost Research) - http://packetstormsecurity.org/UNIX/utilities/mielietools-v1.0.tgz
    RegFuzzer: test your regular expression filter - http://rgaucher.info/b/index.php/post/2007/05/26/RegFuzzer%3A-Test-your-regular-expression-filter
    screamingCobra - http://www.dachb0den.com/projects/screamingcobra.html
    SPIKE and SPIKE Proxy - http://immunitysec.com/resources-freesoftware.shtml
    RFuzz - http://rfuzz.rubyforge.org/
    WebFuzz - http://www.codebreakers-journal.com/index.php?option=com_content&task=view&id=112&Itemid=99999999
    TestMaker - http://www.pushtotest.com/Docs/downloads/features.html
    ASP Auditor - http://michaeldaw.org/projects/asp-auditor-v2/
    WSTool - http://wstool.sourceforge.net/
    Web Hack Control Center (WHCC) - http://ussysadmin.com/whcc/
    Web Text Converter - http://www.microsoft.com/mspress/companion/0-7356-2187-X/
    HackBar (Firefox Add-on) - https://addons.mozilla.org/firefox/3899/
    Net-Force Tools (NF-Tools, Firefox Add-on) - http://www.net-force.nl/library/downloads/
    PostIntercepter (Greasemonkey script) - http://userscripts.org/scripts/show/743

    HTTP general testing / fingerprinting

    Wbox: HTTP testing tool - http://hping.org/wbox/
    ht://Check - http://htcheck.sourceforge.net/
    Mumsie - http://www.lurhq.com/tools/mumsie.html
    WebInject - http://www.webinject.org/
    Torture.pl Home Page - http://stein.cshl.org/~lstein/torture/
    JoeDog's Seige - http://www.joedog.org/JoeDog/Siege/
    OPEN-LABS: metoscan (http method testing) - http://www.open-labs.org/
    Load-balancing detector - http://ge.mine.nu/lbd.html
    HMAP - http://ujeni.murkyroc.com/hmap/
    Net-Square: httprint - http://net-square.com/httprint/
    Wpoison: http stress testing - http://wpoison.sourceforge.net/
    Net-square: MSNPawn - http://net-square.com/msnpawn/index.shtml
    hcraft: HTTP Vuln Request Crafter - http://druid.caughq.org/projects/hcraft/
    rfp.labs: LibWhisker - http://www.wiretrip.net/rfp/lw.asp
    Nikto - http://www.cirt.net/code/nikto.shtml
    twill - http://twill.idyll.org/
    DirBuster - http://www.owasp.org/index.php/Category:OWASP_DirBuster_Project
    [ZIP] DFF Scanner - http://security-net.biz/files/dff/DFF.zip
    [ZIP] The Elza project - http://packetstormsecurity.org/web/elza-1.4.7-beta.zip http://www.stoev.org/elza.html
    HackerFox and Hacking Addons Bundled: Portable Firefox with web hacking addons bundled - http://sf.net/projects/hackfox

    Browser-based HTTP tampering / editing / replaying

    TamperIE - http://www.bayden.com/Other/
    isr-form - http://www.infobyte.com.ar/developments.html
    Modify Headers (Firefox Add-on) - http://modifyheaders.mozdev.org/
    Tamper Data (Firefox Add-on) - http://tamperdata.mozdev.org/
    UrlParams (Firefox Add-on) - https://addons.mozilla.org/en-US/firefox/addon/1290/
    TestGen4Web (Firefox Add-on) - https://addons.mozilla.org/en-US/firefox/addon/1385/
    DOM Inspector / Inspect This (Firefox Add-on) - https://addons.mozilla.org/en-US/firefox/addon/1806/ https://addons.mozilla.org/en-US/firefox/addon/1913/
    LiveHTTPHeaders / Header Monitor (Firefox Add-on) - http://livehttpheaders.mozdev.org/ https://addons.mozilla.org/en-US/firefox/addon/575/

    Cookie editing / poisoning

    [TGZ] stompy: session id tool - http://lcamtuf.coredump.cx/stompy.tgz
    Add'N Edit Cookies (AnEC, Firefox Add-on) - http://addneditcookies.mozdev.org/
    CookieCuller (Firefox Add-on) - http://cookieculler.mozdev.org/
    CookiePie (Firefox Add-on) - http://www.nektra.com/oss/firefox/extensions/cookiepie/
    CookieSpy - http://www.codeproject.com/shell/cookiespy.asp
    Cookies Explorer - http://www.dutchduck.com/Features/Cookies.aspx

    Ajax and XHR scanning

    Sahi - http://sahi.co.in/
    scRUBYt - http://scrubyt.org/
    jQuery - http://jquery.com/
    jquery-include - http://www.gnucitizen.org/projects/jquery-include
    Sprajax - http://www.denimgroup.com/sprajax.html
    Watir - http://wtr.rubyforge.org/
    Watij - http://watij.com/
    Watin - http://watin.sourceforge.net/
    RBNarcissus - http://idontsmoke.co.uk/2005/rbnarcissus/
    SpiderTest (Spider Fuzz plugin) - http://blog.caboo.se/articles/2007/2/21/the-fabulous-spider-fuzz-plugin
    Javascript Inline Debugger (jasildbg) - http://jasildbg.googlepages.com/
    Firebug Lite - http://www.getfirebug.com/lite.html
    firewaitr - http://code.google.com/p/firewatir/

    RSS extensions and caching

    LiveLines (Firefox Add-on) - https://addons.mozilla.org/en-US/firefox/addon/324/
    rss-cache - http://www.dubfire.net/chris/projects/rss-cache/

    SQL injection scanning

    0x90.org: home of Absinthe, Mezcal, etc - http://0x90.org/releases.php
    SQLiX - http://www.owasp.org/index.php/Category:OWASP_SQLiX_Project
    sqlninja: a SQL Server injection and takover tool - http://sqlninja.sourceforge.net/
    JustinClarke's SQL Brute - http://www.justinclarke.com/archives/2006/03/sqlbrute.html
    BobCat - http://www.northern-monkee.co.uk/projects/bobcat/bobcat.html
    sqlmap - http://sqlmap.sourceforge.net/
    Scully: SQL Server DB Front-End and Brute-Forcer - http://www.sensepost.com/research/scully/
    FG-Injector - http://www.flowgate.net/?lang=en&seccion=herramientas
    PRIAMOS - http://www.priamos-project.com/

    Web application security malware, backdoors, and evil code

    W3AF: Web Application Attack and Audit Framework - http://w3af.sourceforge.net/
    Jikto - http://busin3ss.name/jikto-in-the-wild/
    XSS Shell - http://ferruh.mavituna.com/article/?1338
    XSS-Proxy - http://xss-proxy.sourceforge.net
    AttackAPI - http://www.gnucitizen.org/projects/attackapi/
    FFsniFF - http://azurit.elbiahosting.sk/ffsniff/
    HoneyBlog's web-based junkyard - http://honeyblog.org/junkyard/web-based/
    BeEF - http://www.bindshell.net/tools/beef/
    Firefox Extension Scanner (FEX) - http://www.gnucitizen.org/projects/fex/
    What is my IP address? - http://reglos.de/myaddress/
    xRumer: blogspam automation tool - http://www.botmaster.net/movies/XFull.htm
    SpyJax - http://www.merchantos.com/makebeta/tools/spyjax/
    Greasecarnaval - http://www.gnucitizen.org/projects/greasecarnaval
    Technika - http://www.gnucitizen.org/projects/technika/
    Load-AttackAPI bookmarklet - http://www.gnucitizen.org/projects/load-attackapi-bookmarklet
    MD's Projects: JS port scanner, pinger, backdoors, etc - http://michaeldaw.org/my-projects/

    Web application services that aid in web application security assessment

    Netcraft - http://www.netcraft.net
    AboutURL - http://www.abouturl.com/
    The Scrutinizer - http://www.scrutinizethis.com/
    net.toolkit - http://clez.net/
    ServerSniff - http://www.serversniff.net/
    Online Microsoft script decoder - http://www.greymagic.com/security/tools/decoder/
    Webmaster-Toolkit - http://www.webmaster-toolkit.com/
    myIPNeighbbors, et al - http://digg.com/security/MyIPNeighbors_Find_Out_Who_Else_is_Hosted_on_Your_Site_s_IP_Address
    PHP charset encoding - http://h4k.in/encoding
    data: URL testcases - http://h4k.in/dataurl

    Browser-based security fuzzing / checking

    Zalewski's MangleMe - http://lcamtuf.coredump.cx/mangleme/mangle.cgi
    hdm's tools: Hamachi, CSSDIE, DOM-Hanoi, AxMan - http://metasploit.com/users/hdm/tools/
    Peach Fuzzer Framework - http://peachfuzz.sourceforge.net/
    TagBruteForcer - http://research.eeye.com/html/tools/RT20060801-3.html
    PROTOS Test-Suite: c05-http-reply - http://www.ee.oulu.fi/research/ouspg/protos/testing/c05/http-reply/index.html
    COMRaider - http://labs.idefense.com
    bcheck - http://bcheck.scanit.be/bcheck/
    Stop-Phishing: Projects page - http://www.indiana.edu/~phishing/?projects
    LinkScanner - http://linkscanner.explabs.com/linkscanner/default.asp
    BrowserCheck - http://www.heise-security.co.uk/services/browsercheck/
    Cross-browser Exploit Tests - http://www.jungsonnstudios.com/cool.php
    Stealing information using DNS pinning demo - http://www.jumperz.net/index.php?i=2&a=1&b=7
    Javascript Website Login Checker - http://ha.ckers.org/weird/javascript-website-login-checker.html
    Mozilla Activex - http://www.iol.ie/~locka/mozilla/mozilla.htm
    Jungsonn's Black Dragon Project - http://blackdragon.jungsonnstudios.com/
    Mr. T (Master Recon Tool, includes Read Firefox Settings PoC) - http://ha.ckers.org/mr-t/
    Vulnerable Adobe Plugin Detection For UXSS PoC - http://www.0x000000.com/?i=324
    About Flash: is your flash up-to-date? - http://www.macromedia.com/software/flash/about/
    Test your installation of Java software - http://java.com/en/download/installed.jsp?detect=jre&try=1
    WebPageFingerprint - Light-weight Greasemonkey Fuzzer - http://userscripts.org/scripts/show/30285

    PHP static analysis and file inclusion scanning

    PHP-SAT.org: Static analysis for PHP - http://www.program-transformation.org/PHP/
    Unl0ck Research Team: tool for searching in google for include bugs - http://unl0ck.net/tools.php
    FIS: File Inclusion Scanner - http://www.segfault.gr/index.php?cat_id=3&cont_id=25
    PHPSecAudit - http://developer.spikesource.com/projects/phpsecaudit

    PHP Defensive Tools

    PHPInfoSec - Check phpinfo configuration for security - http://phpsec.org/projects/phpsecinfo/

    A Greasemonkey Replacement can be found at http://yehg.net/lab/#tools.greasemonkey


    Php-Brute-Force-Attack Detector - Detect your web servers being scanned by brute force tools such as WFuzz, OWASP DirBuster and vulnerability scanners such as Nessus, Nikto, Acunetix ..etc. http://yehg.net/lab/pr0js/files.php/php_brute_force_detect.zip


    PHP-Login-Info-Checker - Strictly enforce admins/users to select stronger passwords. It tests cracking passwords against 4 rules. It has also built-in smoke test page via url loginfo_checker.php?testlic

    http://yehg.net/lab/pr0js/files.php/loginfo_checkerv0.1.zip

    http://yehg.net/lab/pr0js/files.php/phploginfo_checker_demo.zip


    php-DDOS-Shield - A tricky script to prevent idiot distributed bots which discontinue their flooding attacks by identifying HTTP 503 header code. http://code.google.com/p/ddos-shield/


    PHPMySpamFIGHTER - http://yehg.net/lab/pr0js/files.php/phpmyspamfighter.zip http://yehg.net/lab/pr0js/files.php/phpMySpamFighter_demo.rar

    Web Application Firewall (WAF) and Intrusion Detection (APIDS) rules and resources

    APIDS on Wikipedia - http://en.wikipedia.org/wiki/APIDS
    PHP Intrusion Detection System (PHP-IDS) - http://php-ids.org/ http://code.google.com/p/phpids/
    dotnetids - http://code.google.com/p/dotnetids/
    Secure Science InterScout - http://www.securescience.com/home/newsandevents/news/interscout1.0.html
    Remo: whitelist rule editor for mod_security - http://remo.netnea.com/
    GotRoot: ModSecuirty rules - http://www.gotroot.com/tiki-index.php?page=mod_security+rules
    The Web Security Gateway (WSGW) - http://wsgw.sourceforge.net/
    mod_security rules generator - http://noeljackson.com/tools/modsecurity/
    Mod_Anti_Tamper - http://www.wisec.it/projects.php?id=3
    [TGZ] Automatic Rules Generation for Mod_Security - http://www.wisec.it/rdr.php?fn=/Projects/Rule-o-matic.tgz
    AQTRONIX WebKnight - http://www.aqtronix.com/?PageID=99
    Akismet: blog spam defense - http://akismet.com/
    Samoa: Formal tools for securing web services - http://research.microsoft.com/projects/samoa/

    Web services enumeration / scanning / fuzzing

    WebServiceStudio2.0 - http://www.codeplex.com/WebserviceStudio
    Net-square: wsChess - http://net-square.com/wschess/index.shtml
    WSFuzzer - http://www.owasp.org/index.php/Category:OWASP_WSFuzzer_Project
    SIFT: web method search tool - http://www.sift.com.au/73/171/sift-web-method-search-tool.htm
    iSecPartners: WSMap, WSBang, etc - http://www.isecpartners.com/tools.html

    Web application non-specific static source-code analysis

    Pixy: a static analysis tool for detecting XSS vulnerabilities - http://www.seclab.tuwien.ac.at/projects/pixy/
    Brixoft.Net: Source Edit - http://www.brixoft.net/prodinfo.asp?id=1
    Security compass web application auditing tools (SWAAT) - http://www.owasp.org/index.php/Category:OWASP_SWAAT_Project
    An even more complete list here - http://www.cs.cmu.edu/~aldrich/courses/654/tools/
    A nice list that claims some demos available - http://www.cs.cmu.edu/~aldrich/courses/413/tools.html
    A smaller, but also good list - http://spinroot.com/static/

    Static analysis for C/C++ (CGI, ISAPI, etc) in web applications

    RATS - http://www.securesoftware.com/resources/download_rats.html
    ITS4 - http://www.cigital.com/its4/
    FlawFinder - http://www.dwheeler.com/flawfinder/
    Splint - http://www.splint.org/
    Uno - http://spinroot.com/uno/
    BOON (Buffer Overrun detectiON) - http://www.cs.berkeley.edu/~daw/boon/ http://boon.sourceforge.net
    Valgrind - http://www.valgrind.org/

    Java static analysis, security frameworks, and web application security tools

    LAPSE - http://suif.stanford.edu/~livshits/work/lapse/
    HDIV Struts - http://hdiv.org/
    Orizon - http://sourceforge.net/projects/orizon/
    FindBugs: Find bugs in Java programs - http://findbugs.sourceforge.net/
    PMD - http://pmd.sourceforge.net/
    CUTE: A Concolic Unit Testing Engine for C and Java - http://osl.cs.uiuc.edu/~ksen/cute/
    EMMA - http://emma.sourceforge.net/
    JLint - http://jlint.sourceforge.net/
    Java PathFinder - http://javapathfinder.sourceforge.net/
    Fujaba: Move between UML and Java source code - http://wwwcs.uni-paderborn.de/cs/fujaba/
    Checkstyle - http://checkstyle.sourceforge.net/
    Cookie Revolver Security Framework - http://sourceforge.net/projects/cookie-revolver
    tinapoc - http://sourceforge.net/projects/tinapoc
    jarsigner - http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/jarsigner.html
    Solex - http://solex.sourceforge.net/
    Java Explorer - http://metal.hurlant.com/jexplore/
    HTTPClient - http://www.innovation.ch/java/HTTPClient/
    another HttpClient - http://jakarta.apache.org/commons/httpclient/
    a list of code coverage and analysis tools for Java - http://mythinkpond.blogspot.com/2007/06/java-foss-freeopen-source-software.html

    Microsoft .NET static analysis and security framework tools, mostly for ASP.NET and ASP.NET AJAX, but also C# and VB.NET

    Threat modeling

    Microsoft Threat Analysis and Modeling Tool v2.1 (TAM) - http://www.microsoft.com/downloads/details.aspx?FamilyID=59888078-9daf-4e96-b7d1-944703479451&displaylang=en
    Amenaza: Attack Tree Modeling (SecurITree) - http://www.amenaza.com/software.php
    Octotrike - http://www.octotrike.org/

    Add-ons for Firefox that help with general web application security

    Web Developer Toolbar - https://addons.mozilla.org/firefox/60/
    Plain Old Webserver (POW) - https://addons.mozilla.org/firefox/3002/
    XML Developer Toolbar - https://addons.mozilla.org/firefox/2897/
    Public Fox - https://addons.mozilla.org/firefox/3911/
    XForms Buddy - http://beaufour.dk/index.php?sec=misc&pagename=xforms
    MR Tech Local Install - http://www.mrtech.com/extensions/local_install/
    Nightly Tester Tools - http://users.blueprintit.co.uk/~dave/web/firefox/buildid/index.html
    IE Tab - https://addons.mozilla.org/firefox/1419/
    User-Agent Switcher - https://addons.mozilla.org/firefox/59/
    ServerSwitcher - https://addons.mozilla.org/firefox/2409/
    HeaderMonitor - https://addons.mozilla.org/firefox/575/
    RefControl - https://addons.mozilla.org/firefox/953/
    refspoof - https://addons.mozilla.org/firefox/667/
    No-Referrer - https://addons.mozilla.org/firefox/1999/
    LocationBar^2 - https://addons.mozilla.org/firefox/4014/
    SpiderZilla - http://spiderzilla.mozdev.org/
    Slogger - https://addons.mozilla.org/en-US/firefox/addon/143
    Fire Encrypter - https://addons.mozilla.org/firefox/3208/

    Add-ons for Firefox that help with Javascript and Ajax web application security

    Selenium IDE - http://www.openqa.org/selenium-ide/
    Firebug - http://www.joehewitt.com/software/firebug/
    Venkman - http://www.mozilla.org/projects/venkman/
    Chickenfoot - http://groups.csail.mit.edu/uid/chickenfoot/
    Greasemonkey - http://www.greasespot.net/
    Greasemonkey compiler - http://www.letitblog.com/greasemonkey-compiler/
    User script compiler - http://arantius.com/misc/greasemonkey/script-compiler
    Extension Developer's Extension (Firefox Add-on) - http://ted.mielczarek.org/code/mozilla/extensiondev/
    Smart Middle Click (Firefox Add-on) - https://addons.mozilla.org/en-US/firefox/addon/3885/

    Bookmarklets that aid in web application security

    RSnake's security bookmarklets - http://ha.ckers.org/bookmarklets.html
    BMlets - http://optools.awardspace.com/bmlet.html
    Huge list of bookmarklets - http://www.squarefree.com/bookmarklets/
    Blummy: consists of small widgets, called blummlets, which make use of Javascript to provide rich functionality - http://www.blummy.com/
    Bookmarklets every blogger should have - http://www.micropersuasion.com/2005/10/bookmarklets_ev.html
    Flat Bookmark Editing (Firefox Add-on) - http://n01se.net/chouser/proj/mozhack/
    OpenBook and Update Bookmark (Firefox Add-ons) - http://www.chuonthis.com/extensions/

    SSL certificate checking / scanning

    [ZIP] THCSSLCheck - http://thc.org/root/tools/THCSSLCheck.zip
    [ZIP] Foundstone SSLDigger - http://www.foundstone.com/us/resources/termsofuse.asp?file=ssldigger.zip
    Cert Viewer Plus (Firefox Add-on) - https://addons.mozilla.org/firefox/1964/

    Honeyclients, Web Application, and Web Proxy honeypots

    Honeyclient Project: an open-source honeyclient - http://www.honeyclient.org/trac/
    HoneyC: the low-interaction honeyclient - http://honeyc.sourceforge.net/
    Capture: a high-interaction honeyclient - http://capture-hpc.sourceforge.net/
    Google Hack Honeypot - http://ghh.sourceforge.net/
    PHP.Hop - PHP Honeynet Project - http://www.rstack.org/phphop/
    SpyBye - http://www.monkey.org/~provos/spybye/
    Honeytokens - http://www.securityfocus.com/infocus/1713

    Blackhat SEO and maybe some whitehat SEO

    SearchStatus (Firefox Add-on) - http://www.quirk.biz/searchstatus/
    SEO for Firefox (Firefox Add-on) - http://tools.seobook.com/firefox/seo-for-firefox.html
    SEOQuake (Firefox Add-on) - http://www.seoquake.com/

    Footprinting for web application security

    Evolution - http://www.paterva.com/evolution-e.html
    GooSweep - http://www.mcgrewsecurity.com/projects/goosweep/
    Aura: Google API Utility Tools - http://www.sensepost.com/research/aura/
    Edge-Security tools - http://www.edge-security.com/soft.php
    Fierce Domain Scanner - http://ha.ckers.org/fierce/
    Googlegath - http://www.nothink.org/perl/googlegath/
    Advanced Dork (Firefox Add-on) - https://addons.mozilla.org/firefox/2144/
    Passive Cache (Firefox Add-on) - https://addons.mozilla.org/firefox/977/
    CacheOut! (Firefox Add-on) - https://addons.mozilla.org/en-US/firefox/addon/1453/
    BugMeNot Extension (Firefox Add-on) - http://roachfiend.com/archives/2005/02/07/bugmenot/
    TrashMail.net Extension (Firefox Add-on) - https://addons.mozilla.org/en-US/firefox/addon/1813/
    DiggiDig (Firefox Add-on) - https://addons.mozilla.org/en-US/firefox/addon/2819/
    Digger (Firefox Add-on) - https://addons.mozilla.org/en-US/firefox/addon/1467/

    Database security assessment

    Scuba by Imperva Database Vulnerability Scanner - http://www.imperva.com/scuba/

    Browser Defenses

    DieHard - http://www.diehard-software.org/
    LocalRodeo (Firefox Add-on) - http://databasement.net/labs/localrodeo/
    NoMoXSS - http://www.seclab.tuwien.ac.at/projects/jstaint/
    Request Rodeo - http://savannah.nongnu.org/projects/requestrodeo
    FlashBlock (Firefox Add-on) - http://flashblock.mozdev.org/
    CookieSafe (Firefox Add-on) - https://addons.mozilla.org/en-US/firefox/addon/2497
    NoScript (Firefox Add-on) - http://www.noscript.net/
    FormFox (Firefox Add-on) - https://addons.mozilla.org/en-US/firefox/addon/1579/
    Adblock (Firefox Add-on) - http://adblock.mozdev.org/
    httpOnly in Firefox (Firefox Add-on) - http://blog.php-security.org/archives/40-httpOnly-Cookies-in-Firefox-2.0.html
    SafeCache (Firefox Add-on) - http://www.safecache.com/
    SafeHistory (Firefox Add-on) - http://www.safehistory.com/
    PrefBar (Firefox Add-on) - http://prefbar.mozdev.org/
    All-in-One Sidebar (Firefox Add-on) - https://addons.mozilla.org/en-US/firefox/addon/1027/
    QArchive.org web file checker (Firefox Add-on) - https://addons.mozilla.org/firefox/4115/
    Update Notified (Firefox Add-on) - https://addons.mozilla.org/en-US/firefox/addon/2098/
    FireKeeper - http://firekeeper.mozdev.org/
    Greasemonkey: XSS Malware Script Detector - http://yehg.net/lab/#tools.greasemonkey

    Browser Privacy

    TrackMeNot (Firefox Add-on) - https://addons.mozilla.org/firefox/3173/
    Privacy Bird - http://www.privacybird.com/

    Application and protocol fuzzing (random instead of targeted)

    Sulley - http://fuzzing.org/
    taof: The Art of Fuzzing - http://sourceforge.net/projects/taof/
    zzuf: multipurpose fuzzer - http://sam.zoy.org/zzuf/
    autodafé: an act of software torture - http://autodafe.sourceforge.net/
    EFS and GPF: Evolutionary Fuzzing System - http://www.appliedsec.com/resources.html

    Posted by 1010
    98..Etc/cvs2009. 1. 15. 13:08
    반응형

    1.      CVS?

    소프트웨어를 개발하는 과정에서 프로그래머는 다양한 버전의 소스코드를 관리해야할 필요가 있다. 예를 들어 버전 1.1 나왔다고 하더라도 이전의 버전의 소스 코드를 가지고 있어야 한다.

    이유는 소프트웨어의 기능 향상을 위해 소스 코드를 변경하거나 추가하는 과정은 항상 버그가 끼어들 위험을 동반하여, 현재 버전과 이전의 버전들 간의 비교나 이전 버전들 사이의 비교가 버그를 잡는데 있어서 반드시 필요하기 때문이다.

    CVS 개발 소프트웨어에 대한 버전을 관리하는 툴이다.

     

    CVS 아래의 개발자가 요구하는 사항에 대해 정보를 제공한다.

    n    누가 코드를 수정했는가

    n    언제 수정되었는가

    n    동일시간에 벌어진 변화는 무엇인가

    n    수정되었는가(CVS 코멘트를 달수있는 기능을 가지고 있다)

     

    1.1. CVS 용어정리

    n    repository : 소스가 저장되는

    n    module : repository내에 존재하는 디렉토리 계층.

    n    import : 전체 디렉토리 구조를 전송함으로써 저장소에 새로운 모듈을 생성.

    n    export : repository에서 모듈을 가지고 오는 .

    ( export 모듈은 cvs 제어를 받지 않는다.)

    n    checkout : repository에서 모듈을 가지고 오며, cvs 버전관리를 받는다

    n    update : 저장소로부터 다른 개발자들의 수정사항을 얻는

    n    commit : add delete, 자신이 변경한 부분을 repository 반영하는 .

    n    conflict : Race Condition(동시수정) 발생하였을 때를 말한다.

    소스에 표시가 되므로 conflict 제거하고 테스트를 돌려 이상이

    없음을 확인한 다시 commit 해야 한다.

    n    tag : 개발상의 특정 시점을 나타내는 파일들의 집합에 주어지는 문자열(명칭).

    n    release : 전체 프로젝트 버전

    n    revision : 개의 파일에 대한 버전명칭

     

    1.2. CVS 기본컨셉

    n    revision number

    각각의 파일들은 자신의 revision 번호를 가지며, 번호들은 파일이 수정될때마다

    증가된 값을 가진다.

    프로그램을 개발하다 보면 하나의 중심되는 개발 흐름이 있고, 이와는 별도로 작은 부분에 대한 개발 흐름이 존재한다.

    n    main trunk : 중심되는 개발 흐름

    n    branch

    main trunk와는 다른 작은 부분에 대한 개발흐름

    뻗어나온 main trunk의 revision번호에 숫자를 두자리 덧붙여서 사용

    2.     CVS SERVER

    2.1. 설치전 요구사항

    n    하드디스크의 파일시스템이 NTFS인지 확인한다.

    (Windows NT, Windows  2000 Windows XP에서만 가능)

    n    CVSNT 설치할 PC Administrator 로그인 되어있어야 한다.

    n    최신의 cvsNT 서버 인스톨을 다운로드 받는다. (http://www.cvsnt.org/)

    n    프로젝트의 내용이 담길 디렉토리 (ex: c:\thursday)

    CVS서버내부적으로 사용하는 임시디렉토리(ex: c:\cvstemp)가진 디렉토리를 만든다.

     

    2.2.   설치 설정

    1. CVSNT설치후, CVS NT 실행시킨다.

    2. 서비스가 동작중인지 확인하고,동작중이면 stop 버튼을 눌러서 서비스를 멈춘다.

     

     

     

     

     

     

     

     

     

     


                

    3. Repositories" 탭에서 "prefix" 옵션을 선택한후,

    "..." 적혀있는 버튼을 눌러 내용을 앞서 생성시킨 "c:/thursday"으로 설정한다.

     

    Ø      주의사항: 모든 repository 지정한 하나의 디렉토리 하위에 생성되어야한다.

    (There is only one setting for Repository Prefix on CVSNT. )

     

     


                

                

     

    4. Add 버튼을 선택하여 저장소(repository) 추가한다.

    (같은 서버내에 여러개의 저장소를 생성할 있다.)

     

     

     

     

     

     

     

     

     

     

     

     

     


                

    5. Advanced 탭으로 가서 모든 채크박스를 채크상태로 설정한후,

    temp 디렉토리를 설정한다.

     

     

     

     

     

     

     


                

    6. 설정들을 저장한후, cvs service 시작한다.

     

     

     

     

     


    7.  설치 확인

    : path c:program files/cvsnt 확인한다.

                

    8. 서버에 사용자 추가하기

    Ø      cvs server에 접속하기 위한 초기설정

    Ø      set cvsroot=:ntserver:<computer name>:/<cvsroot name>

    Ø      set cvsroot=:sspi:<computer name>:/<cvsroot name>  -방화벽존재-

    Ø      NT 계정으로 사용자를 하나 추가

    Ø      cvs passwd -a <user>

    Ø      cvs passwd -a r <user> <id>

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       


    Ø     

    Ø     

    Ø     

    9. 사용자가 정상적으로 추가되었는지 테스트

    Ø      사용자정보보기( repository마다 존재)

    :  Path: \root\repository_name\CVSROOT\passwd file 확인

    ex) C:\Thursday\test\CVSROOT

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       


    Ø     

    Ø     

    Ø      CVS Client User Login

    ü        set cvsroot=:pserver:trickster@127.0.0.1:/test

    : server ip 프로토콜, repository, userID  CVS서버에 접속한다.

    ü        cvs login : cvs 로그인 명령어

    ü        cvs ls l R : repository내의 파일과 디렉토리를 보여주는 명령어

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       


                

     

    3.     CVS CLIENT (JB9)

     

    3.1.CVS CLIENT TOOL 용어정리

    n    Workspace : 개발자의 작업공간(JBuilder Project 단위)

    n    Checkout (pull): 저장소(repository)에서 모듈가지고오기

    n    Add : 모듈에 파일추가

    n    Remove : 저장소에 있는 파일삭제

    n    Update : 저장소에 있는 내용을 내작업공간에 반영

    n    Commit : 내작업공간의 내용을 저장소에 반영

    n    Merge : cvs 파일에 대한 lock기능이 없기 때문에,

    저장소에서의 변화된 부분과 자신의 작업공간에서의 변화된부분을 합병시킨다.

    3.2.CVS PROJECT 생성

    3.2.1.         Repository Project 생성 (저장소로 project올리기)

     

    1. Server Repository project 생성

    :Team/select Project VCS  à  Team/Place Project into CVS

     

     

     

     

     

     

     

     

     


    Ø      Connect type

    ü  A Local connection : 로그인필요없음

    ü  A PServer connection : 서버이름과 서버의 사용자아이디필요

    ü  An Ext : 서버이름과 서버의 사용자아이디, ssh 필요

     

    2. Local Repository project 생성

    :Team/Create Local Repository

     

    3.2.2.         WorkSpace Project 생성 (저장소에서project받기)

     

    Ø      방법1: Pull Project from CVS(File/New)

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       


    Ø      방법2: Pull Project in CVS(Team/)

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       


    Ø       (방법1 & 2 ) 공통 프레임

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       

    Ø       


    Ø      가지고 오는 방식

    Ø      Checkout : jbuilder cvs 버전관리를 받는다.

    Ø      Export : 버전관리를 받지않는다.(일반 다운로드와 같은 형태)

    3.3.Builder 9 CVS 기능

    3.3.1.            전체구조

     

     

     

    3.3.2.         기본기능

    n     SECTION 1

    l       Configure CVS : cvs server 접속한 기본설정 정보를 보여준다.

    l       Update “file” : repository 있는 file내용을 workspace 반영한다.

    l       Commint “file” : file내용을 repository 반영한다.

    l       Status for “file”: file 현재 상태를 보여준다

    l       Add…: workspace file 추가한다.

    l       Remove “file”: workspace file 삭제한다.

    l       Revert “file” : 가장최근에 commit file상태로 전환한다.

     

    n     SECTION 2

    l       Update Project  : repository내의 전체모듈(project) workspace 반영한다.

    l       Status Browser : workspace내의 모든 파일들의 상태를 보여줌

    l       Commit Browser : repository내의 모듈과 workspace 비교하여, 파일의

    변경 상황을 알려 변경된 파일을 CVS 서버에 올릴 것인지 CVS 서버로부터 받아올

    것인지 등을 결정한다

     

    3.3.3.         CVS ADMINISTRATION

     

    n    Jb9 추가된 기능이며, tag branch 버전관리를 돕는다.

    n    Cvs 버전관리는 revision, label(tag) branch 정보로 이루어진다.

    Ø      Revision :

    파일의 버전명칭: 각각의 파일들은 자신의 revision 번호를 가지며,

    번호들은 파일이 수정될 때마다 증가된 값을 가진다.

    Ø      Label(Tag) :

    파일의 현재 버전에 tag 붙여 표시해두어, 사용한다.

    책의 주요부분에 포스트 잇으로 표시해두는 개념과 흡사하다.

    Ø      Branch :

    중심되는 개발 흐름이외의 다른 작은 부분에 대한 개발흐름

     

    Ø      Example :

    ü        main revision : 1.3 -> 1.4 -> … -> 1.7

    ü        branch :

    revision 1.4에서 brch(브랜치태그)를 붙인다.

    Brch 버전흐름 1.4.2.1-> .. -> 1.4.2.5

    ü        label(tag) : prg5 , prg6

    ü        label 붙여줌으로써 좀더 편하게

    이전의 상태을 찾을수있게 해준다.

    ü        Branch main revision, 또다른 branch에서

    확장가능하며, 여러흐름의 개발을 하게 도와준다.

     

    Ø      JB 9기능

    ü        Create version label: 현재 revision(파일의 버전) 라벨 붙이기

     Workspace안의 모든 파일에 적용된다.

    ü        Delete version label : 붙여논 라벨 지우기

    ü        Move version label : file 내용을 선택한 라벨의 상태로 되돌림

    ü        Update special : 날짜, branch, main revision, label 선택하여

         workspace 내용을 선택한 상태로 되돌림

    ü        Merge : Update special 흡사하나, merge 경우

        선택된 버전의 상태와 현재의 내용과 합한다.

    ü        Create Branch : branch 생성

     

    3.3.4.         LABEL(TAG) 관리

     

    Ø      Revision 1.6까지 버전업되는 과정에 Label ap1, ap2, ap3 생성후,

    파일내용을 ap1 상태로 되돌림

     

     

     

     

     

     

     

     

     

     

     

     


    Ø      Untitled1.java 버전 history들과 label들의 정보

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     


    Ø      Update special(jb9 cvs tool) 통해 변화된 소스내용

    : 현재 파일내용(= revision 1.6 )에서 label ap1선택시

    :  Revision1.6 -> Revision1.2

     

     

     

     

     

     

     

     

     

     

     

     


    Ø      JB 9 admin tool 사용법

    : Label(tag) 생성 & Update special : LABEL scan하여 선택

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     


    3.3.5.         Branch 관리

    Label 같은 방식으로 update merge기능을 사용할 있다.

    Main Trunk 버전을 늘리지 않고, Branch 버전을 계속 늘리고 싶다면

    (ex) 1.4.1 -> 1.4.2 -> …), update special 통해 확장하고자 하는 branch 선택하여, 현재 workspace상태를 바꿔주어야 한다.

     

    3.3.6.         CVS WATCH

    많은 버전관리 시스템과 달리 CVS 파일 잠금을 지원하지 않기 때문에

    CVS 파일에 대해서 여러명이 연속적으로 편집하는 것을 막지 않는다.

    파일들이 감시되고 있으면, 개발자는 편집을 위해서 cvs edit 사용하고, 편집한 파일을 릴리스하기 위해서는 cvs unedit 사용해야한다.

    감시되지 않는 파일들은 CVS에게 알리지 않고 편집할 있다.

     

    1. CVS Edit(편집모드)

     

    감시되고있는 파일은 read-only permision 바뀌기 때문에, 파일내용을 편집할수 없다.

    따라서 read-write기능을 가지게 하려면, 다른 사람들에게 감시되고 있는 파일을 편집하겠다는 계획을 알려야 한다. cvs edit 통해 수행된다.

     

    2. CVS Unedit(편집불가 모드)

     

    Cvs edit 명령이 수행된 , 변화된 모든 부분을 없앤다.(CVS edit수행되기전 상태로 돌린다)

    Unedit상태가 되면, 수정할수없게 된다.(jbuilder에서는 키보드의 키액션 자체가 일어나지 않음)

     

     

     

     

    참조 싸이트 ----------------------------------------------------------------------------------------------------------------------

    http://www.cvshome.org/docs/blandy.html

    http://www.hta-bi.bfh.ch/Resources/Computing/SunGroup/Info/QuickRef/

    VersionControl/doc/cvs_toc.html

    http://kldp.org/KoreanDoc/html/CVS_Tutorial-KLDP/x45.html#AEN50

    http://www.cvsnt.org/wiki/InstallationTips#head-311175d88e243efa70a083a2089337a7b53ddd77

    http://www.redwiki.net/wiki/moin.cgi/WinCVS_20_2d_20Daily_20Use_20Guide

    http://turing.korea.ac.kr/~iamone/cvs/x28.html

    http://docs.kde.org/en/3.1/kdesdk/cervisia/watches.html

    http://durak.org/cvswebsites/doc/cvs_92.php#SEC92

    Posted by 1010
    98..Etc/Etc...2009. 1. 15. 11:42
    반응형
     

    Maintenance Build: 3.2.2
    February 12, 2007. These downloads are provided under the Eclipse Foundation Software User Agreement.

    Eclipse 3.2.2 readme

    To view the build notes for this build click here.
    To view the test results for this build click here.
    To view the map file entries for this build click here.

    Performance results now available

    You can also download builds via anonymous ftp at download.eclipse.org.

    Click here for instructions on how to verify the integrity of your downloads.

    Eclipse SDK

    The Eclipse SDK includes the Eclipse Platform, Java development tools, and Plug-in Development Environment, including source and both user and programmer documentation. If you aren't sure which download you want... then you probably want this one.
    Eclipse does not include a Java runtime environment (JRE). You will need a 1.4.2 level or higher Java runtime or Java development kit (JDK) installed on your machine in order to run Eclipse. Click here if you need help finding a Java runtime.

    Status
    Platform Download Size
    Windows (Supported Versions) 121 MB (md5)
    Linux (x86/GTK 2) (Supported Versions) 119 MB (md5)
    Linux (x86_64/GTK 2) (Supported Versions) 119 MB (md5)
    Linux (PPC/GTK 2) (Supported Versions) 118 MB (md5)
    Linux (x86/Motif) (Supported Versions) 120 MB (md5)
    Solaris 8 (SPARC/GTK 2) 121 MB (md5)
    AIX (PPC/Motif) 121 MB (md5)
    HP-UX (HP9000/Motif) 121 MB (md5)
    Mac OSX (Mac/Carbon) (Supported Versions) 118 MB (md5)
    Source Build (Source in .zip) (instructions) 78 MB (md5)
    Source Build (Source fetched via CVS) (instructions) 22 MB (md5)

    JUnit Plugin Tests and Automated Testing Framework

    These drops contain the framework and JUnit test plugins used to run JUnit plug-in tests from the command line. Click here for more information and installation instructions. Includes both source code and binary.

    Status
    Platform Download Size
    All 0 MB (md5)
    All 82 MB (md5)
     
    Example Plug-ins

    To install the examples, first make sure you have exited your Eclipse program. Then download the zip file containing the examples and extract the contents of the zip file to the same directory you used for your SDK installation. For example, if you installed the Eclipse Project SDK on d:\eclipse-sdk then extract the contents of the examples zip file to d:\eclipse-sdk. Start Eclipse. The example plug-ins will be installed. For information on what the examples do and how to run them, look in the "Examples Guide" section of the "Platform Plug-in Developer Guide", by selecting Help Contents from the Help menu, and choosing "Platform Plug-in Developer Guide" book from the combo box.

    Status
    Platform Download Size
    Windows (Supported Versions) 3 MB (md5)
    All Other Platforms 3 MB (md5)
     
    RCP Runtime Binary

    These drops contain the Eclipse Rich Client Platform base plug-ins and do not contain source or programmer documentation. These downloads are meant to be used as target platforms when developing RCP applications, and are not executable, stand-alone applications.

    Status
    Platform Download Size
    Windows (Supported Versions) 9 MB (md5)
    Linux (x86/GTK 2) (Supported Versions) 10 MB (md5)
    Linux (x86_64/GTK 2) (Supported Versions) 10 MB (md5)
    Linux (PPC/GTK 2) (Supported Versions) 9 MB (md5)
    Linux (x86/Motif) (Supported Versions) 11 MB (md5)
    Solaris 8 (SPARC/GTK 2) 9 MB (md5)
    Solaris 8 (SPARC/Motif) 9 MB (md5)
    AIX (PPC/Motif) 9 MB (md5)
    HP-UX (HP9000/Motif) 9 MB (md5)
    Mac OSX (Mac/Carbon) (Supported Versions) 9 MB (md5)
     
    RCP SDK

    These drops consist of the Eclipse Rich Client Platform base plug-ins and their source and the RCP delta pack. The delta pack contains all the platform specific resources from RCP and the platform and is used for cross-platform exports of RCP applications.

    Status
    Platform Download Size
    Windows (Supported Versions) 17 MB (md5)
    Linux (x86/GTK 2) (Supported Versions) 17 MB (md5)
    Linux (x86_64/GTK 2) (Supported Versions) 17 MB (md5)
    Linux (PPC/GTK 2) (Supported Versions) 16 MB (md5)
    Linux (x86/Motif) (Supported Versions) 18 MB (md5)
    Solaris 8 (SPARC/GTK 2) 17 MB (md5)
    Solaris 8 (SPARC/Motif) 16 MB (md5)
    AIX (PPC/Motif) 17 MB (md5)
    HP-UX (HP9000/Motif) 17 MB (md5)
    Mac OSX (Mac/Carbon) (Supported Versions) 16 MB (md5)
    RCP delta pack 28 MB (md5)
     
    com.ibm.icu.base binary and source Plug-ins

    This plugin is a replacement plugin for the com.ibm.icu plugin. If the size of your application overrides the need to adopt ICU4J, use this plugin *in place of* the ICU4J plugin (com.ibm.icu). To install and use this plugin:
    1. Extract the zip at the root of your Eclipse install directory
    2. In the \eclipse\plugins directory, delete com.ibm.icu_<version>.jar and the directory com.ibm.icu.source_<version>
    3. In \eclipse\features\org.eclipse.rcp_<version>\feature.xml, replace the id of the com.ibm.icu plugin entry with com.ibm.icu.base.

    Status
    Platform Download Size
    All 0 MB (md5)
     
    Platform Runtime Binary

    These drops contain only the Eclipse Platform with user documentation and no source and no programmer documentation. The Java development tools and Plug-in Development Environment are NOT included. You can use these drops to help you package your tool plug-ins for redistribution when you don't want to ship the entire SDK.

    Status
    Platform Download Size
    Windows (Supported Versions) 34 MB (md5)
    Linux (x86/GTK 2) (Supported Versions) 34 MB (md5)
    Linux (x86_64/GTK 2) (Supported Versions) 34 MB (md5)
    Linux (PPC/GTK 2) (Supported Versions) 34 MB (md5)
    Linux (x86/Motif) (Supported Versions) 36 MB (md5)
    Solaris 8 (SPARC/GTK 2) 34 MB (md5)
    AIX (PPC/Motif) 34 MB (md5)
    HP-UX (HP9000/Motif) 34 MB (md5)
    Mac OSX (Mac/Carbon) (Supported Versions) 34 MB (md5)
     
    Platform SDK

    These drops contain the Eclipse Platform Runtime binary with associated source and programmer documentation.

    Status
    Platform Download Size
    Windows (Supported Versions) 77 MB (md5)
    Linux (x86/GTK 2) (Supported Versions) 76 MB (md5)
    Linux (x86_64 64/GTK 2) (Supported Versions) 76 MB (md5)
    Linux (PPC/GTK 2) (Supported Versions) 75 MB (md5)
    Linux (x86/Motif) (Supported Versions) 77 MB (md5)
    Solaris 8 (SPARC/GTK 2) 77 MB (md5)
    AIX (PPC/Motif) 77 MB (md5)
    HP-UX (HP9000/Motif) 77 MB (md5)
    Mac OSX (Mac/Carbon) (Supported Versions) 75 MB (md5)
     
    JDT Runtime Binary

    These drops contain the Java development tools plug-ins only, with user documentation and no source and no programmer documentation. The Eclipse platform and Plug-in development environment are NOT included. You can combine this with the Platform Runtime Binary if your tools rely on the JDT being present.

    Status
    Platform Download Size
    All 20 MB (md5)
    Mac OSX (Mac/Carbon) 20 MB (md5)
     
    JDT SDK

    These drops contain the JDT Runtime binary with associated source and programmer documentation.

    Status
    Platform Download Size
    All 34 MB (md5)
    Mac OSX (Mac/Carbon) 34 MB (md5)
     
    JDT Core Batch Compiler

    These drops contain the standalone batch java compiler, Ant compiler adapter and associated source. The batch compiler and Ant adapter (ecj.jar) are extracted from the org.eclipse.jdt.core plug-in as a 1.2MB download. For examples of usage, please refer to this help section: JDT Plug-in Developer Guide>Programmer's Guide>JDT Core>Compiling Java code.

    Status
    Platform Download Size
    All 1 MB (md5)
    All 1 MB (md5)
     
    PDE Runtime Binary

    These drops contain the Plug-in Development Enviroment plug-ins only, with user documentation. The Eclipse platform and Java development tools are NOT included. You can combine this with the Platform and JDT Runtime Binary or SDK if your tools rely on the PDE being present.

    Status
    Platform Download Size
    All 6 MB (md5)
     
    PDE SDK
    These drops contain the PDE Runtime Binary with associated source.
    Status
    Platform Download Size
    All 8 MB (md5)
     
    FTP and WebDAV Support

    These drops contain the FTP and WebDAV target management support plug-ins. You can combine this with the Platform Runtime Binary or Eclipse SDK. Includes both source code and binary.

    Status
    Platform Download Size
    All 1 MB (md5)
     
    SWT Binary and Source

    These drops contain the SWT libraries and source for standalone SWT application development. For examples of standalone SWT applications refer to the snippets section of the SWT Component page.

    To run a standalone SWT application, add the swt jar(s) to the classpath and add the directory/folder for the SWT JNI library to the java.library.path. For example, if you extract the download below to C:\SWT you would launch the HelloWorld application with the following command:

     java -classpath C:\SWT\swt.jar;C:\MyApp\helloworld.jar -Djava.library.path=C:\SWT 
    HelloWorld 
    Status
    Platform Download Size
    Windows (Supported Versions) 2 MB (md5)
    Windows CE (ARM PocketPC) (Instructions) 1 MB (md5)
    Windows CE (ARM PocketPC, J2ME profile) (Instructions) 1 MB (md5)
    Linux (x86/GTK 2) (Supported Versions) 2 MB (md5)
    Linux (x86_64/GTK 2) (Instructions) 2 MB (md5)
    Linux (PPC/GTK 2) (Supported Versions) 2 MB (md5)
    Linux (x86/Motif) (Supported Versions) 3 MB (md5)
    Solaris 8 (SPARC/GTK 2) 2 MB (md5)
    Solaris 8 (SPARC/Motif) 2 MB (md5)
    QNX (x86/Photon) 2 MB (md5)
    AIX (PPC/Motif) 2 MB (md5)
    HP-UX (HP9000/Motif) 2 MB (md5)
    Mac OSX (Mac/Carbon) (Supported Versions) 2 MB (md5)
     
    org.eclipse.releng.tools plug-in

    This plug-in provides features that will help with the Eclipse development process. Installing the plug-in will add the following actions. To install simply unzip the file into your plugins directory and restart Eclipse. Please use the Release feature of this plug-in to do your build submissions.

    1. Release to the Team menu. This action will Tag selected projects with the specified version and update the appropriate loaded *.map files with the version. The user must have the *.map files loaded in their workspace and the use must commit the map file changes to the repository when done.
    2. Load Map Projects to the Team menu. Select one or more *.map file and this action will load the projects listed in the *.map file into your workspace. Naturally the versions specified in the *.map file will be loaded.
    3. Tag Map Projects to the Team menu. Select one or more *Map files and this action will tag the projects listed in the *Map files with a tag you specify.
    4. Compare with Released to the Compare menu. Compare the selected projects with the versions referenced in the currently loaded map files.
    5. Replace with Released to the Replace menu. Replace the selected projects with the versions referenced in the currently loaded map files.
    6. Fix Copyright to the Resource Perspective Projects context menu. Select one or more projects in the Resource Perspective. This action will sanity check the copyright notices in all the *.java and *.properties files. Copyrights will be updated automatically where the tool deems appropriate. A copyright.log file will be written to the workspace directory noting odd conflicts that need to be looked at. You need to commit the changes yourself. This is the tool that was used to do the 2.1 Copyright pass.
    Status
    Platform Download Size
    All 0 MB (md5)


    Posted by 1010
    98..Etc/Etc...2009. 1. 15. 02:10
    반응형

    원도우 미디어 센터..

    사용자 삽입 이미지

    dir / ls 도 같은 결과가 나온다.

    사용자 삽입 이미지

    원도우 미디어 플레이어 인터페이스 좋고,

    사용자 삽입 이미지
    사용자 삽입 이미지


    원도우 7 깔고 나면 인터넷익스플러 8이 설치된다. 역쉬 베타 버전이다. 음~ 크롬같다고 할까
    좀더 써보고 리뷰를 다시 써야 겠다.
    사용자 삽입 이미지
    원도우 7 설치시 자동으로 모든 하드웨어를 자동으로 잡아주고 인식해 준다.
    설치 시간도 매우 단축되었고, 설치시 나오던 이미지나 설명같은 문구는 찾아보기 힘들고
    단지 프로세스바를 통한 진행 상황정도만 나온다..

    사용자 삽입 이미지
    사용자 삽입 이미지
    사용자 삽입 이미지
    Posted by 1010
    98..Etc/ERP2009. 1. 8. 15:14
    반응형

    Thank you for choosing PostBooks, the free open source ERP, CRM and accounting package from xTuple.

    Download xTuple-PostBooks-Installer-Windows-3.1.0.exe Notes Mirror

    For Windows
    Select a different platform? Windows, Mac OS

    Not the file you are looking for? Browse all packages for this project.

    Download Instructions
    This file will install PostBooks version 3.1.0 for Windows.

    The PostBooks installer is designed to make it easy for users to evaluate PostBooks --including both the graphical PostBooks client and the PostBooks database. The database comes pre-loaded with a small set of demo data which you can use for evaluation purposes. The database runs on PostgreSQL, which is also installed locally by the installer.

    PLEASE NOTE: If you run the installer you will not need to do any other additional setup to evaluate the product. However, if you decide to adopt PostBooks in a production environment, we strongly recommend that you re-install PostgreSQL on a dedicated server machine. You may download PostgreSQL directly from http://www.postgresql.org, or contact xTuple sales for paid implementation support.

    Once you have finished the installation, the following steps will get you started:

    1. The database starts automatically
    2. Open the xTuple folder where you installed it, and click the xTuple program icon to start the client
    3. Enter username: admin, password: admin
    4. You are now connected to the demo database

    Once you have the application running you may want to visit http://wiki.xtuple.org/DemoGuide for a walk through of a sample business cycle in the PostBooks ERP environment.

    Posted by 1010
    98..Etc/ERP2009. 1. 8. 15:01
    반응형

    Customizing Openbravo ERP look and feel

    Rating :
    3.00/5
    (1 votes cast)
    You have to be registered to be able to vote

    This document describes how to customize different aspects of Openbravo ERP look and feel.

    Contents

    [hide]

    Skins

    Openbravo user interface supports skins that make it possible to create a new look and feel beyond the skin that is provided by default. Openbravo skins are groups of images and Cascading Style Sheets (CSS) that can define the look of Openbravo per installation.

    Directory layout

    Openbravo skins are located in the directory web/skins/. Inside every directory skin there are four subdirectories:

    • Login contains styles used by the login window.
    • Main contains styles used by the main application window.
    • Menu contains styles used by menu windows.
    • Popup contains styles used by popup windows.

    CSS element names describe the location of the objects named. For example, the label Login_ContentPane_ToolBar references the Toolbar object contained in the ContentPane for the Login Window.

    Installation

    • Put the skin inside the AppsOpenbravo/web/skins folder.
      • To design a new one, copy-paste Default one into a new one inside the folder above and give that folder a name (eg. BlackSkin)
      • To install an existing one, unzip the file (you can download from our sourceforge area) into the folder above.
    • Within the command line, move to AppsOpenbravo folder and execute the 'ant compile -Dtab=xxx' and then 'ant war' and 'ant deploy' commands to deploy the new skin into your Tomcat installation.

    To register a new skin you must:

    • Login as System Administrator.
    • Go to Application Dictionary || Reference
      • Look for the Skin_list reference.
      • Go to the List Reference tab and then click on the New record icon on the toolbar.
      • The name field contains the name of the skin and the search key field contains the name of the directory (eg. BlackSkin according to the folder name you used above) where the skin is located.

    Once the skin has been registered you need select (apply) it:

    • Go to General Setup || Application || Session Information and select the proper skin name within the Theme listbox and press the Save preferences button.
    • Clear your browser cache and you should see the new skin.

    Additional skins

    At SourceForge download area there is a an openbravo-add-on section that contain some additional samples.

    How to easily create a new skin

    It is possible to easily create a different skin in 5 minutes.

    Lets forget about changing icons and little images, this is a How-to change the main colours of the application as you can see in these screenshots.

    my.php?image=blueskincv3.png
    my.php?image=pinkskinxx0.png
    my.php?image=redskincz5.png

    The files that you must change are:

    \web\skins\Blue\Popup\Client\Workflow\button.rollover.png
    \web\skins\Blue\Popup\Client\Workflow\button.normal.png
    \web\skins\Blue\Popup\Client\Workflow\button.pressed.png
    \web\skins\Blue\Popup\NavBar\backgroundCenter.png
    \web\skins\Blue\Popup\NavBar\backgroundLeft.png
    \web\skins\Blue\Popup\NavBar\backgroundRight.png
    \web\skins\Blue\Popup\NavBar\logoLeft.png
    \web\skins\Blue\Popup\NavBar\logoRight.png
    \web\skins\Blue\Menu\NavBar\backgroundCenter.png
    \web\skins\Blue\Menu\NavBar\backgroundLeft.png
    \web\skins\Blue\Menu\NavBar\backgroundRight.png
    \web\skins\Blue\Menu\NavBar\logoLeft.png
    \web\skins\Blue\Menu\NavBar\logoRight.png
    \web\skins\Blue\Menu\ToolBar\backgroundCenter.png
    \web\skins\Blue\Menu\ToolBar\backgroundLeft.png
    \web\skins\Blue\Menu\ToolBar\backgroundRight.png
    \web\skins\Blue\Main\Client\Button\iconOk.png
    \web\skins\Blue\Main\Client\Button\buttonBody.disabled.png
    \web\skins\Blue\Main\Client\Button\buttonBody.normal.png
    \web\skins\Blue\Main\Client\Button\buttonBody.pressed.png
    \web\skins\Blue\Main\Client\Button\buttonBody.rollover.png
    \web\skins\Blue\Main\Client\Button\buttonLeft.disabled.png
    \web\skins\Blue\Main\Client\Button\buttonLeft.normal.png
    \web\skins\Blue\Main\Client\Button\buttonLeft.pressed.png
    \web\skins\Blue\Main\Client\Button\buttonLeft.rollover.png
    \web\skins\Blue\Main\Client\Button\buttonRight.disabled.png
    \web\skins\Blue\Main\Client\Button\buttonRight.normal.png
    \web\skins\Blue\Main\Client\Button\buttonRight.pressed.png
    \web\skins\Blue\Main\Client\Button\buttonRight.rollover.png
    \web\skins\Blue\Main\Client\FieldButton\fieldButton.normal.png
    \web\skins\Blue\Main\Client\FieldButton\fieldButton.pressed.png
    \web\skins\Blue\Main\Client\FieldButton\fieldButton.rollover.png
    \web\skins\Blue\Main\LeftTabsBar\rightbutton.pressed.png
    \web\skins\Blue\Main\LeftTabsBar\rightbutton.rollover.png
    \web\skins\Blue\Main\LeftTabsBar\background.png
    \web\skins\Blue\Main\LeftTabsBar\backgroundBody.png
    \web\skins\Blue\Main\LeftTabsBar\backgroundBorder.png
    \web\skins\Blue\Main\LeftTabsBar\backgroundTop.png
    \web\skins\Blue\Main\LeftTabsBar\iconEditView.normal.png
    \web\skins\Blue\Main\LeftTabsBar\iconEditView.rollover.png
    \web\skins\Blue\Main\LeftTabsBar\leftbutton.normal.png
    \web\skins\Blue\Main\LeftTabsBar\leftbutton.pressed.png
    \web\skins\Blue\Main\LeftTabsBar\leftbutton.rollover.png
    \web\skins\Blue\Main\LeftTabsBar\rightbutton.normal.png
    \web\skins\Blue\Main\NavBar\backgroundCenter.png
    \web\skins\Blue\Main\NavBar\backgroundLeft.png
    \web\skins\Blue\Main\NavBar\backgroundRight.png
    \web\skins\Blue\Main\NavBar\buttonRight.disabled.png
    \web\skins\Blue\Main\NavBar\buttonRight.normal.png
    \web\skins\Blue\Main\NavBar\buttonRight.pressed.png
    \web\skins\Blue\Main\NavBar\buttonRight.rollover.png
    \web\skins\Blue\Main\NavBar\iconAbout.disabled.png
    \web\skins\Blue\Main\NavBar\iconAbout.normal.png
    \web\skins\Blue\Main\NavBar\iconAbout.pressed.png
    \web\skins\Blue\Main\NavBar\iconAbout.rollover.png
    \web\skins\Blue\Main\NavBar\iconBack.disabled.png
    \web\skins\Blue\Main\NavBar\iconBack.normal.png
    \web\skins\Blue\Main\NavBar\iconBack.pressed.png
    \web\skins\Blue\Main\NavBar\iconBack.rollover.png
    \web\skins\Blue\Main\NavBar\iconHelp.disables.png
    \web\skins\Blue\Main\NavBar\iconHelp.normal.png
    \web\skins\Blue\Main\NavBar\iconHelp.pressed.png
    \web\skins\Blue\Main\NavBar\iconHelp.rollover.png
    \web\skins\Blue\Main\NavBar\iconRefresh.disabled.png
    \web\skins\Blue\Main\NavBar\iconRefresh.normal.png
    \web\skins\Blue\Main\NavBar\iconRefresh.pressed.png
    \web\skins\Blue\Main\NavBar\iconRefresh.rollover.png
    \web\skins\Blue\Main\NavBar\logoLeft.png
    \web\skins\Blue\Main\NavBar\logoRight.png
    \web\skins\Blue\Main\NavBar\popupSeparatorBar.png
    \web\skins\Blue\Main\ToolBar\backgroundRight.png
    \web\skins\Blue\Main\ToolBar\backgroundCenter.png
    \web\skins\Blue\Main\ToolBar\backgroundLeft.png


    The thing is that you have to apply a color effect (red/blue/green effect) to ALL of the files in that list.

    Image:effect.PNG

    The process is easy but long.

    But if you use a batch converter (like advanced batch converter www.batchconverter.com) you can do all the changes automatically. You choose all the images, make the effect, and run the process. In a couple of seconds you will have your images in the desired colour.

    Then make a copy of the /web/skin/Default folder and rename it to the name you want for the skin.

    Put the modified images on this folder and just add the skin to Openbravo as explained before, in this page.

    There are 3 colored skins ready for download at http://sourceforge.net/project/showfiles.php?group_id=162271&package_id=250125&release_id=549425

    Customizing the logo

    The instructions are only valid for the release 2.35 or higher. These instructions explain how to customize the "yourcompany", "yourit-service" and "sourceforge" logos which are in the login screen.

    In the Login Screen there are three customizable logos:

    • Company
    • Support
    • SourceForge

    Image:LoginLogos.png

    The CSS that permits the change of any of this logo is /web/images/Logos.css

    • Login_Logo_SourceForge_Field: It permits to hide the SourceForge whole box uncommenting the property "display: none"
    • Login_Logo_xxxxxxx_Container_Cell: It permits the customization of the red bordered TD
    • Login_Logo_xxxxxxx_Container: It permits the customization of the blue bordered DIV
    • Login_Logo_xxxxxxx: It permits the customization of the yellow bordered IMG

    Where xxxxxxx is Company, Support or Sourceforge

    By default:

    • The Company Logo in the Login Screen is obtained from /web/images/CompanyLogo_big.png. It is managed by "Login_Logo_Company" of Logos.css. You can replace it with any other by directly replacing the file CompanyLogo_big.png or changing the "background: url()" property, but you have to take into account that the properties "width" and "height" need to be modified according to the new image.
    • The small Company Logo in the top of the menu is obtained from /web/images/CompanyLogo_small.png. It is managed by "Menu_NavBar_logo" of Logos.css. You can replace it with any other by directly replacing the file CompanyLogo_small.png or changing the "background: url()" property, but you have to take into account that the properties "width" and "height" need to be modified according to the new image. Here it is highly recommended that the target image height be 34px because a higher value will create an undesired effect on the other elements of the navigation bar.
    • The Support Logo in the Login Screen is obtained from /web/images/SupportLogo_big.png. It is managed by "Login_Logo_Support" of Logos.css. You can replace it with any other by directly replacing the file SupportLogo_big.png or changing the "background: url()" property, but you have to take into account that the properties "width" and "height" need to be modified according to the new image.
    • The SourceForge Logo in the Login Screen is obtained from http://sflogo.sourceforge.net/sflogo.php?group_id=162271&type=5. It is managed by "Login_Logo_Support" of Logos.css. You can replace it changing the "background: url()" property, but you have to take into account that the properties "width" and "height" need to be modified according to the new image. If your client does not have an Internet connection, you can replace the property to "background: url(SFLogo.png) no-repeat center center;" because SFLogo.png also exist in the distribution

    There are two ways to change the logos.

    1. Modify the existing files keeping the original filename.
      • Save the existing logo files.
      • Modify the existing files without changing the dimensions. (However this can be a little restrictive)
      • Use the same file names as the original logos.
    2. Creating your own files and telling Openbravo to use them.
      • Look at the existing files to find out the height.
      • Create you own logo using the same height, but your own width. (Providing you use the same height the logo will fit into the existing layout)
      • Edit /web/images/Logos.css defining your filenames and adjust the dimensions.
    Note: In a standard installation this file is: /opt/OpenbravoERP/AppsOpenbravo/web/images/Logos.css
    

    Extract for Company logo on the login screen:


    .Login_Logo_Company {
     width: 273px;
     height: 55px;
     margin-top: 3px;
     margin-bottom: 3px;
     background: url(AshleyLogo273x55.png) no-repeat center center;
    }
    

    Extract for the support logo on the login screen:


    .Login_Logo_Support {
     width: 197px;
     height: 55px;
     margin-top: 3px;
     margin-bottom: 3px;
     background: url(ErinstarLogo197x55.png) no-repeat center center;
    }
    

    Extract for the nav bar logo that appears on every screen


    .Menu_NavBar_logo {
     width: 190px;
     height: 34px;
     background: url(AshleyLogo190x34.png) no-repeat center center;
    }
    

    For both methods:

      • Recompile Openbravo and re-start tomcat to see the changes.

    Customizing search and data entry windows

    Right To Left languages

    If a css line must be different when the language of the application is written from right to left (RTL languages), a tag like this must be added:

    background-position: center right; /*~RTL   background-position: center left;  */
    

    this way, the compilation process will write the line

    background-position: center right;
    

    in the ltr skin folder, and the line

    background-position: center left;
    

    in the rtl skin folder. This way, a fine tunning can be done in a skin to fit also the rtl languages.

    If there exists already a comment related to Sprites in a css line of the class, then both rtl and ltr values must be defined. For example, for the original class

    a.ButtonLink table.Button .Button_left, table.Button .Button_left {
     width: 35px;
     height: 26px;
     background-repeat: no-repeat;
     background-position: center right;
     background-image: url(Common/Button/buttonLeft.normal.png);  /** sprite-ref: xxspritexx_V; sprite-alignment: right; */
     text-align: right;
     vertical-align: top;
    }
    

    the rtl changes to apply will be:

    a.ButtonLink table.Button .Button_left, table.Button .Button_left {
     width: 35px;
     height: 26px;
     background-repeat: no-repeat;
     background-position: center right; /*~RTL   background-position: center left; */
     background-image: url(Common/Button/buttonLeft.normal.png);  /** sprite-ref: xxspritexx_V; sprite-alignment-ltr: right; sprite-alignment-rtl: left; */
     text-align: right; /*~RTL   text-align: left; */
     vertical-align: top;
    }
    


    Customizing the application menu

    Versions before 2.34

    Log in the application and set your role to System Admin. Then go to General Setup > Application > Menu. Once you arrive to that window, you need to click on the "tree" button, and a new window with all the menus will pop up. Once there, you will notice 2 sides on the window. On the top side you will see the all the menus in a "tree" mode. On the down side you should see some checkboxes.

    Image:menu3.png

    The first thing you should do is to click on "take element", on the down side of the window. Then click the menu you want to move (the application dictionary in the example). Then click in the "Assign to" checkbox in the down side, and after that select again another menu on the top side. The last thing you need to do is to specify if you want the first menu to be under the secondly selected menu (same level) or if you want it to be inside the secondly selected menu (inside) to become a son of the first menu. Click on OK to the changes to take effect.

    Image:menu4.png

    In order to see the changes you just made, just log out-log in and there you go. You don not need to compile anything.

    Image:Example.jpg

    Versions 2.34 and above

    Same as for previous versions, you must log in the application and set your role to System Admin. Then go to General Setup > Application > Menu. Once you arrive to that window, you need to click on the "tree" button, and a new window with all the menus will pop up.

    Once there, with the drag and drop utility, just drag the menu you want to move, and drop it anywhere. You will see instantly the new position of the menu in that window.

    Image:menu1.png

    In order to see the changes you just made, just log out-log in and there you go. You don not need to compile anything.

    Image:menu2.png

    Retrieved from "http://wiki.openbravo.com/wiki/Customizing_Openbravo_ERP_look_and_feel"

    This page has been accessed 24,024 times. This page was last modified 09:46, 27 November 2008. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.

    Posted by 1010