2011년 5월 23일 월요일

Apache OpenEJB 3.0 - 1


OpenEJB 3.0
주요 기능
l EJB 3.0, 2.1, 2.0, 1.1 지원
l JAX-WS 지원
l JMS 지원
l J2EE Connector 지원
l Tomcat 5 또는 6 버전에 설치 지원
l 유연한 JNDI name Formatting
지원 기능
l JAX-PRC
l CORBA
Installation
1. http://openejb.apache.org/download.html에서OpenEJB Standlone Server” 다운로드
2. 적당한 위치에 다운로드 파일 압축풀기 – ex : D:/openejb30
3. System 환경 변수에 “OPENEJB_HOME”을 설정 하거나 “bin/openejb.bat” 파일에 아래 내용 추가
#OPENEJB_HOME 환경 변수에 설정
#Openejb.bat 다음 추가
cd..
set OPENEJB_HOME=%CD%
cd bin


4. “~/bin/openejb start” 명령어로 실행
Openejb Start Option
-D<name>=<value>
Specifies a system property passed into OpenEJB at startup.
--admin-bind <host>
Sets the host to which the admin service should be bound.
--admin-port <int>
Sets the port to which the admin service should be bound.
--conf <file>
Sets the OpenEJB configuration to the specified file.
--ejbd-bind <host>
Sets the host to which the ejbd service should be bound.
--ejbd-port <int>
Sets the port to which the ejbd service should be bound.
--examples
Show examples of how to use the options.
-h, --help
Print this help message.
--hsql-bind <host>
Sets the host to which the hsql service should be bound.
--hsql-port <int>
Sets the port to which the hsql service should be bound.
--httpejbd-bind <host>
Sets the host to which the httpejbd service should be bound.
--httpejbd-port <int>
Sets the port to which the httpejbd service should be bound.
--local-copy <boolean>
Instructs the container system to marshal (ie, copy) all calls between beans.
--telnet-bind <host>
Sets the host to which the telnet service should be bound.
--telnet-port <int>
Sets the port to which the telnet service should be bound.
-v, --version
Print the version.


EX : openejb start --ejbd-bind 192.168.14.83 --ejbd-port 7203
-D Option 사용법
l -D<service>.bind=<address>
- EX) openejb start -Dejbd.bind=10.45.67.8
- EX) openejb start -Dejbd.bind=myhost.foo.com
- EX) openejb start -Dtelnet.bind=myhost.foo.com
l -D<service>.port=<port>
- EX) openejb start -Dejbd.port=8765
- EX) openejb start -Dhttpejbd.port=8888
l -D<service>.only_from=<addresses>
- EX) openejb start -Dadmin.only_from=192.168.1.12
- EX) openejb start -Dadmin.only_from=192.168.1.12,joe.foo.com,Robert
l -D<service>.threads=<max>
- EX) openejb start -Dejbd.threads=200
l -D<service>.disabled=<true/false>
- EX) openejb start -Dtelnet.disabled=true
Understanding the Directory Layout
openejb-3.0/
openejb-3.0/logs/
openejb-3.0/apps/
openejb-3.0/lib/
openejb-3.0/lib/<several jars>
openejb-3.0/LICENSE.txt
openejb-3.0/NOTICE.txt
openejb-3.0/README.txt
openejb-3.0/bin/
openejb-3.0/bin/openejb.bat
openejb-3.0/bin/openejb
openejb-3.0/conf/
openejb-3.0/conf/README.txt


Directories
l bin/
OpenEJB 서버를 Start/Stop 시킬 있는 명령어가 포함되어 있다.
l lib/
OpenEJB 서버 실행에 필요한 jar 라이브러리가 포함되어 있다.
l apps/
개발된 EJB jar 파일 위치 디렉토리에 포함된 EJB jar 파일은 OpenEJB 서버가 시작될 자동으로 디플로이 된다.
l logs/
OpenEJB 서버 로그파일
l conf/
openejb.xml
main config file
logging.properties
log levels and files
login.config
jaas config file
users.properties
users that can log in
groups.properties
groups in which users belong
admin.properties
network socket for administration
ejbd.properties
network socket for ejb invocations
hsql.properties
network socket for hsql client access
httpejbd.properties
network socket for ejb invocations over http
telnet.properties
network socket for telnet "server"


DataBases 설정
“openejb.xml” 파일에 DataSource 설정
l HSQLDB
<Resource id="HSQLDB Database" type="DataSource">
JdbcDriver org.hsqldb.jdbcDriver
JdbcUrl jdbc:hsqldb:file:hsqldb
UserName sa
Password
</Resource>


JNDI Name : java:openejb/Resource/HSQLDB Database
l Derby (Embedded)
<Resource id="Derby Database" type="DataSource">
#Embedded Derby example
JdbcDriver org.apache.derby.jdbc.EmbeddedDriver
JdbcUrl jdbc:derby:derbyDB;create=true
UserName admin
Password pass
</Resource>


JNDI Name : java:openejb/Resource/Derby Database
l MySQL
<Resource id="MySQL Database" type="DataSource">
# MySQL example
#
# This connector will not work until you download the driver at:
# http://www.mysql.com/downloads/api-jdbc-stable.html
JdbcDriver com.mysql.jdbc.Driver
JdbcUrl jdbc:mysql://localhost/test
UserName test
</Resource>


JNDI Name : java:openejb/Resource/MySQL Database
l Oracle
<Resource id="Oracle Database" type="DataSource">
# Oracle example
#
# This connector will not work until you download the driver at:
# http://otn.oracle.com/software/tech/java/sqlj_jdbc/content.html
JdbcDriver com.mysql.jdbc.Driver
JdbcUrl jdbc:oracle:thin:@localhost:1521:orcl
UserName scott
Password tiger
</Resource>


JNDI Name : java:openejb/Resource/Oracle Database
l PosgreSQL
<Resource id="PostgreSQL Database" type="DataSource">
# PostgreSQL example
#
# This connector will not work until you download the driver at:
# http://jdbc.postgresql.org/download.html
JdbcDriver org.postgresql.Driver
JdbcUrl jdbc:postgresql://localhost/test
UserName postgres
Password pass
</Resource>


JNDI Name : java:openejb/Resource/PostgreSQL Database
l InstantDB
<Resource id="InstantDB Database" type="DataSource">
# InstantDB example
#
JdbcDriver org.enhydra.instantdb.jdbc.idbDriver
JdbcUrl jdbc:idb:conf/instantdb.properties
UserName Admin
Password pass
</Resource>


JNDI Name : java:openejb/Resource/InstantDB Database
DataSource 사용
다음과 같이 DataSource openejb.xml 파일에 정의 되어있다면
<Resource id="myDerbyDatabase" type="DataSource">
. . . . .
</Resource>


l Case 1
@Stateless
public class FooBean {
@Resource DataSource myDerbyDatase;
}


l Case 2
@Stateless
public class FooBean {
@Resource(name="myDerbyDatabase")
DataSource dataSource;
}


l Case 3
@Resource(name="myDerbyDatabase", type="javax.sql.DataSource")
@Stateless
public class FooBean {
public void setSessionContext(SessionContext sessionContext) {
DataSource dataSource = (DataSource) sessionContext.lookup("myDerbyDatabase");
}
public void someOtherMethod() throws Exception {
InitialContext initialContext = new InitialContext();
DataSource dataSource =
(DataSource) initialContext.lookup("java:comp/env/myDerbyDatabase");
}
}


Deployments
Openejb.xm 파일에 지정
l EJB jar 파일 단위로 지정
<openejb>
...
<Deployments jar="c:\my\app\superEjbs.jar" />
<Deployments jar="c:\someplace\purchasing.jar" />
<Deployments jar="timeTrack.jar" />
</openejb>


l Directory 단위로 지정
<openejb>
...
<Deployments dir="c:\my\app\beans\" />
<Deployments dir="c:\crimestopper\lib" />
<Deployments dir="ejbs" />
<Deployments dir="beans" />
</openejb>

댓글 없음:

댓글 쓰기

ETL 솔루션 환경

ETL 솔루션 환경 하둡은 대용량 데이터를 값싸고 빠르게 분석할 수 있는 길을 만들어줬다. 통계분석 엔진인 “R”역시 하둡 못지 않게 관심을 받고 있다. 빅데이터 역시 데이터라는 점을 볼때 분산처리와 분석 그 이전에 데이터 품질 등 데이...