Thursday, March 01, 2007

JAVA 認證心得 -- SCBCD (1)

Enterprise Bean Environment
##CONTINUE##

  • The java:comp/env JNDI naming context refers to enterprise bean's private namespace. it is not shared with other enterprise beans
  • Within a single EJB 2.0 container, an EJB can have multiple sets of environment entries. Environment entry values may only Strings and Wrappers.
  • The bean provider must declare all the resource manager connection factory references in the deployment descriptor using the <resource-ref> element
  • The bean provider uses the <res-auth> DD element to indicate which authentication approach is to be used for resource manager access.
  • The <ejb-ref> DD element is used for the declaration of a reference to an enterprise bean’s home
  • EJB reference's scope is within the enterprise bean that container the <ejb-ref> or <ejb-local-ref> deployment descriptor element. So the EJB reference cannot be shared among enterprise beans and there is no name conflict even if other enterprise beans define <ejb-ref> or <ejb-local-ref> with the same <ejb-ref-name> element.
  • The resource manager connection factory references are scoped to the enterprise bean that contains the <resource-ref> element. The resource manager connection factory references can't be shared between enterprise beans but the connections obtained from the resource manager connection factory can be shared among enterprise beans.
  • [Scope] Enterprise bean that contains the deployment descriptor element<env-entry><ejb-ref><resource-ref><resource-env-ref><security-role-ref>
  • [Scope] EJB-JAR file i.e all the enterprise beans in the same EJB-JAR file <security-role>
  • The <ejb-link> element must not refer to the enterprise beans in a different EAR file i.e the <ejb-link> can refer to enterprise beans only in the same EAR file, which may reside in a different ejb-jar file.
  • <! ELEMENT resource-ref (description?, res-ref-name, res-type, res-auth, res-sharing-scope?) >
  • An EJB container must support propagation the caller's principal from one component to another
  • EJB defines "Local interfaces" which can be used by local clients. As opposed to Remote interfaces, local interfaces provide a lightweight access to enterprise javabeans.
  • EJBs have only a read-only access to their environment. It will throw a javax.naming.OperationNotSupported exception. Eg.ctx.rebind("java:comp/env/locale", actuallocale);
  • The ejb-jar file producer can create an ejb-client JAR file for the ejb-jar file. The ejb-client JAR file contains all the class files that a client program needs to use the client view of the enterprise beans that are contained in the ejb-jar file. If this option is used, it is the responsibility of the Application Assembler to include all the classes necessary to comprise the client view of an enterprise bean in the ejb-client JAR file. The ejb-client JAR file is specified in the deployment descriptor of the ejb-jar file using the optional ejb-client-jar element. The value of the ejb-client-jar element is the path name specifying the location of the ejb-client JAR file in the containing J2EE Enterprise Application Archive (.ear) file. The path name is relative to the location of the referencing ejb-jar file.
  • An EJB container must support the following APIs:
    1. Java 2 Platform, Standard Edition v1.3 (J2SE) APIs
    2. EJB 2.0 APIs
    3. JNDI 1.2
    4. JTA 1.0.1, the UserTransaction interface only
    5. JDBC 2.0
    6. JMS 1.0.2
    7. JavaMail 1.1, sending mail only
    8. JAXP 1.0. includes SAX and DOM parsers. Parse XML.
  • No enterprise bean needs to be prepared to handle simultaneous client requests. The container ensures that only one request is being processed by a bean instance at a time.
  • Java:comp/UserTransaction
  • <env-entry-type>Wappers and java.lang.String

Read more!

No comments: