2011년 5월 23일 월요일

Apache OpenEJB 3.0 - 2


Deploy Tool
명령어 : openejb deploy options <file> [<file>...]
Options
-d, --debug
Increases the level of detail on validation errors and deployment summary.
--dir
Sets the destination directory where the app will be deployed. The default is <OPENEJB_HOME>/apps/ directory. Note when changing this setting make sure the directory is listed in the openejb.xml via a <Deployments dir=""/> tag or the app will not be picked up again on restart.
-conf file
Sets the OpenEJB configuration to the specified file.
-h, --help
Lists these options and exit.
-o, --offline
Deploys the app to an offline server by copying the archive into the server's apps/ directory. The app will be deployed when the server is started. The default is online.
-q, --quiet
Decreases the level of detail on validation and skips the deployment summary.
-s, --server-url <url>
Sets the url of the OpenEJB server to which the app will be deployed. The value should be the same as the JNDI Provider URL used to lookup EJBs. The default is 'ejbd://localhost:4201'.
-v, --version
Prints the OpenEJB version and exits.


Clients
1. Local Client
Properties p = new Properties();
p.put("java.naming.factory.initial", "org.openejb.client.LocalInitialContextFactory");
InitialContext ctx = new InitialContext(p);
MyBean myBean = (MyBean) ctx.lookup("MyBeanRemote");


2. Remote Client
Properties p = new Properties();
p.put("java.naming.factory.initial", "org.openejb.client.RemoteInitialContextFactory");
p.put("java.naming.provider.url", "ejbd://localhost:4201");
// user and pass optional
p.put("java.naming.security.principal", "myuser");
p.put("java.naming.security.credentials", "mypass");
InitialContext ctx = new InitialContext(p);
MyBean myBean = (MyBean) ctx.lookup("MyBeanRemote");


3. Remote Client With Http(Standalone)
Properties p = new Properties();
p.put("java.naming.factory.initial", "org.openejb.client.RemoteInitialContextFactory");
p.put("java.naming.provider.url", "http://localhost:4204");
// user and pass optional
p.put("java.naming.security.principal", "myuser");
p.put("java.naming.security.credentials", "mypass");
InitialContext ctx = new InitialContext(p);
MyBean myBean = (MyBean) ctx.lookup("MyBeanRemote");


4. Remote Client With Http(in tomcat)
Properties p = new Properties();
p.put("java.naming.factory.initial", "org.openejb.client.RemoteInitialContextFactory");
p.put("java.naming.provider.url", "http://127.0.0.1:8080/openejb/ejb");
// user and pass optional
p.put("java.naming.security.principal", "myuser");
p.put("java.naming.security.credentials", "mypass");
InitialContext ctx = new InitialContext(p);
MyBean myBean = (MyBean) ctx.lookup("MyBeanRemote");


JNDI Name
Default JNDI Name
{deploymentId}{interfaceType.annotationName}
Ex) CalculatorImplRemote

Custom Setting JNDI Name
1. Server 시작 설정
$ ./bin/openejb start "-Dopenejb.jndiname.format={ejbName}/{interfaceClass}"
2. META-INF/openejb-jar.xml 파일에 설정
<openejb-jar>
<properties>
openejb.deploymentId.format = {ejbName}
openejb.jndiname.format = {deploymentId}{interfaceType.annotationName}
</properties>
</openejb-jar>


JNDI Name Format Variable
variable
description
moduleId
Typically the name of the ejb-jar file or the <ejb-jar id=""> id value if specified
ejbType
STATEFUL, STATELESS, BMP_ENTITY, CMP_ENTITY, or MESSAGE_DRIVEN
ejbClass
for a class named org.acme.superfun.WidgetBean results in org.acme.superfun.WidgetBean
ejbClass.simpleName
for a class named org.acme.superfun.WidgetBean results in WidgetBean
ejbClass.packageName
for a class named org.acme.superfun.WidgetBean results in org.acme.superfun
ejbName
The ejb-name as specified in xml or via the 'name' attribute in an @Stateful, @Stateless, or @MessageDriven annotation
deploymentId
The unique system id for the ejb. Typically the ejbName unless specified in the openejb-jar.xml or via changing the OPENEJB:openejb.deploymentId.format
interfaceType
see interfaceType.annotationName
interfaceType.annotationName
Following the EJB 3 annotations @RemoteHome, @LocalHome, @Remote and @Local
  • RemoteHome (EJB 2 EJBHome)
  • LocalHome (EJB 2 EJBLocalHome)
  • Remote (EJB 3 Business Remote)
  • Local (EJB 3 Business Local)
  • Endpoint (EJB webservice endpoint)
interfaceType.xmlName
Following the ejb-jar.xml descriptor elements <home>, <local-home>, <business-remote>, <business-local>, and <service-endpoint>:
  • home (EJB 2 EJBHome)
  • local-home (EJB 2 EJBLocalHome)
  • business-remote (EJB 3 Business Remote)
  • business-local (EJB 3 Business Local)
  • service-endpoint (EJB webservice endpoint)
interfaceType.xmlNameCc
Camel-case version of interfaceType.xmlName:
  • Home (EJB 2 EJBHome)
  • LocalHome (EJB 2 EJBLocalHome)
  • BusinessRemote (EJB 3 Business Remote)
  • BusinessLocal (EJB 3 Business Local)
  • ServiceEndpoint (EJB webservice endpoint)
interfaceType.openejbLegacyName
Following the OpenEJB 1.0 hard-coded format:
  • (empty string) (EJB 2 EJBHome)
  • Local (EJB 2 EJBLocalHome)
  • BusinessRemote (EJB 3 Business Remote)
  • BusinessLocal (EJB 3 Business Local)
  • ServiceEndpoint (EJB webservice endpoint)
interfaceClass
  • (business) for a class named org.acme.superfun.WidgetRemote results in org.acme.superfun.WidgetRemote
  • (home) for a class named org.acme.superfun.WidgetHome results in org.acme.superfun.WidgetHome
interfaceClass.simpleName
  • (business) for a class named org.acme.superfun.WidgetRemote results in WidgetRemote
  • (home) for a class named org.acme.superfun.WidgetHome results in WidgetHome
interfaceClass.packageName
for a class named org.acme.superfun.WidgetRemote results in org.acme.superfun


Security
Properties props = new Properties();
props.setProperty(Context.SECURITY_PRINCIPAL, "someuser");
props.setProperty(Context.SECURITY_CREDENTIALS, "thepass");
InitialContext ctx = new InitialContext(props);
ctx.lookup(...);


위와 같이Client에서 Context 접근하기 위한 사용자 보안은 아래의 3개의 파일에서 지정한다.
${openejb.base}/conf/login.config
Security Properties 정의
기본적으로 “users.properties”, “group.properties” 지정
${openejb.base}/conf/users.properties
사용자 ID, PASSWORD 지정
${openejb.base}/conf/groups.properties
사용자 Group 지정

댓글 없음:

댓글 쓰기

ETL 솔루션 환경

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