Skip to main content

Home/ SoftwareEngineering/ Group items tagged EJB3

Rss Feed Group items tagged

kuni katsuya

Chapter 7. Integration with EJB3 - 0 views

  • Integration with EJB3
  • important to note that identity caches the user access rights so only the first call to hasRole() will be remote
kuni katsuya

Improve your life Through Science and Art: JEE6: Interfaces on Demand with EE6 (CDI & e... - 0 views

  • JEE6: Interfaces on Demand with EE6 (CDI & ejb3.1)
  • JEE6: Interfaces on Demand with EE6 (CDI & ejb3.1)
  • Since Java Platform, Enterprise Edition 6 (Java EE 6),
  • ...9 more annotations...
  • interfaces are no longer required
  • by the container in order to realize common use cases
  • An interface becomes a vehicle for encapsulation or abstraction,
  • as it was originally intended to be:
  • “Interfaces are used to encode similarities which the classes of various types share, but do not necessarily constitute a class relationship. For instance, a human and a parrot can both whistle; however, it would not make sense to represent Humans and Parrots as subclasses of a Whistler class. Rather they would most likely be subclasses of an Animal class (likely with intermediate classes), but both would implement the Whistler interface.” [http://en.wikipedia.org/wiki/Java_interface]
  • Extensive use of interfaces derives from a
  • belief that they might be helpful in the future
  • Premature Extensibility Is the Root of Some Evil
  • The number of artifacts will double and you will have to introduce a configuration facility
kuni katsuya

Chapter 1. Getting Started - 0 views

  • Hello World, revisited with EJB3
  • history is persisted in the database by means of a JPA entity bean and those objects are serialized back to the Flex client each time you enter a new name.
kuni katsuya

Generic CRUD Service aka DAO - EJB 3.1/0 Code - Only If You Really Needed : Adam Bien's... - 0 views

  • Generic CRUD Service
  • The term Data Access Object (DAO)
  • is actually wrong
    • kuni katsuya
       
      this is one reason i hate using the term 'dao' in our ee6 project
  • ...7 more annotations...
  • easy with generics
  • create
  • find(
  • update(
  • delete(
  • CrudService
  • @TransactionAttribute(TransactionAttributeType.MANDATORY)
kuni katsuya

Data Source Configuration in AS 7 | JBoss AS 7 | JBoss Community - 0 views

  • Data Source Configuration in AS 7
  • Using @DataSourceDefinition to configure a DataSource
  • This annotation requires that a data source implementation class (generally from a JDBC driver JAR) be present on the class path (either by including it in your application, or deploying it as a top-level JAR and referring to it via MANIFEST.MF's Class-Path attribute) and be named explicitly.
  • ...21 more annotations...
  • this annotation bypasses the management layer and as such it is recommended only for development and testing purposes
  • Defining a Managed DataSource
  • Installing a JDBC driver as a deployment
  • Installing the JDBC Driver
  • deployment or as a core module
  • managed by the application server (and thus take advantage of the management and connection pooling facilities it provides), you must perform two tasks.  First, you must make the JDBC driver available to the application server; then you can configure the data source itself.  Once you have performed these tasks you can use the data source via standard JNDI injection.
  • recommended way to install a JDBC driver into the application server is to simply deploy it as a regular JAR deployment.  The reason for this is that when you run your application server in domain mode, deployments are automatically propagated to all servers to which the deployment applies; thus distribution of the driver JAR is one less thing for administrators to worry about.
  • Note on MySQL driver and JDBC Type 4 compliance: while the MySQL driver (at least up to 5.1.18) is designed to be a Type 4 driver, its jdbcCompliant() method always return false. The reason is that the driver does not pass SQL 92 full compliance tests, says MySQL. Thus, you will need to install the MySQL JDBC driver as a module (see below).
  • Installing a JDBC driver as a module
  • <module xmlns="urn:jboss:module:1.0" name="com.mysql">  <resources>    <resource-root path="mysql-connector-java-5.1.15.jar"/>  </resources>  <dependencies>    <module name="javax.api"/>  </dependencies></module>
  • jboss-7.0.0.<release>/modules/com/mysql/main
  • define your module with a module.xml file, and the actual jar file that contains your database driver
  • content of the module.xml file
  • Under the root directory of the application server, is a directory called modules
  • module name, which in this example is com.mysql
  • where the implementation is, which is the resource-root tag with the path element
  • define any dependencies you might have.  In this case, as the case with all JDBC data sources, we would be dependent on the Java JDBC API's, which in this case in defined in another module called javax.api, which you can find under modules/javax/api/main as you would expect.
  • Defining the DataSource itself
  •    <datasource jndi-name="java:jboss/datasources/MySqlDS" pool-name="MySqlDS">      <connection-url>jdbc:mysql://localhost:3306/EJB3</connection-url>         <driver>com.mysql</driver>
  •     <drivers>      <driver name="com.mysql" module="com.mysql">        <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>      </driver>    </drivers>
  • jboss-7.0.0.<release>/domain/configuration/domain.xml or jboss-7.0.0.<release>/standalone/configuration/standalone.xml
kuni katsuya

Enterprise JavaBeans 3.1 with Contexts and Dependency Injection: The Perfect Synergy - 0 views

  • stateless EJB 3.1 bean as boundary (Facade)
  • injected managed beans (controls)
  • @Inject
  • ...22 more annotations...
  • @Inject
  • CDI managed beans. The @EJB annotation is removed and @Inject is used instead
  • Annotating the boundary (Cart) with the @Named annotation makes the Cart immediately visible for expression language (EL) expressions in JSP and JSF
  • @Named annotation takes the simple name of the annotated class, puts the first character in lowercase, and exposes it directly to the JSF pages (or JSP). The Cart bean can be accessed directly, without any backed or managed beans, by the JSF pages: <h:commandButton value="Check out!" action="#{cart.checkout}" />
  • If there is a need for abstraction, the class can be turned into an interface (or abstract class)
  • local implementation (with CDI events
  • @Inject Event<String> event;
  • event.fire("Order proceeded!");
  • remote implementation:
  • javax.enterprise.event.Event belongs to the CDI-implementation
  • class Event can be considered to be a lightweight alternative to the java.beans.PropertyChangeSupport class
  • @Inject Event<String> event;
  • event.fire("Order proceeded!");
  • event can be received by any managed bean and also by EJB beans
  • provide a method with a single @Observes annotated parameter
  • @Observes String event
  • there is no real event, just the payload:
  • The during attribute in the @Observes annotation allows you to select in which transactional phase the event gets delivered. The default setting is IN_PROGRESS, which causes an immediate event delivery regardless of the transaction outcome. The AFTER_SUCCESS configuration causes the delivery to occur only after successful transaction completion
  • Although CDI events work only inside a single process (in the default case, CDI is extensible), they are perfectly suitable for decoupling packages from modules
  • The method checkout() starts a transaction that gets "reused" by the OrderSystem and CustomerNotification session beans
  • ordering.placeOrder(); notifier.sendNotification();
    • kuni katsuya
       
      both run within same transaction
  • EJB beans cannot be directly exposed to JSF or JSP without a little help from CDI
kuni katsuya

UML Profile Diagrams Examples - 0 views

  • Java EJB 3.0 UML Profile
  • [UML Profile for Java and EJB. Version 1.0]
  • Java 1.3, EJB 1.1 and most likely UML 1.4, so it could be only of some interest
    • kuni katsuya
       
      ancient java and ejb versions!
  • ...8 more annotations...
  • simplified and unofficial UML Profile for EJB 3.0 with support for
  • session
  • entity
  • message-driven
  • Enterprise JavaBeans
  • stateful
  • stateless
  • session beans
kuni katsuya

CDI With Or Without EJB 3.1 : Adam Bien's Weblog - 0 views

  • deploy a EJB 3.1
  • boundary
    • kuni katsuya
       
      see 'WHY SERVICE ISN'T A SERVICEFACADE, BUT SERVICEFACADE IS SOMETIMES A SERVICE...' @  http://www.adam-bien.com/roller/abien/entry/why_service_isn_t_a
  • and use e.g. CDI behinds behind.
kuni katsuya

Comparing JSF Beans, CDI Beans and EJBs | Andy Gibson - 0 views

  • differences between CDI beans and EJBs is that EJBs are : Transactional Remote or local Able to passivate stateful beans freeing up resources Able to make use of timers Can be asynchronous
  • Stateless EJBs can be thought of as thread safe single-use beans that don’t maintain any state between two web requests
  • Stateful EJBs do hold state and can be created and sit around for as long as they are needed until they are disposed of
  • ...15 more annotations...
  • Stateless beans must have a dependent scope while a stateful session bean can have any scope. By default they are transactional, but you can use the transaction attribute annotation.
  • CDI beans can be injected into EJBs and EJBs can be injected into CDI beans
  • When to use which bean How do you know when to use which bean? Simple.
  • In general, you should use CDI beans unless you need the advanced functionality available in the EJBs such as transactional functions. You can write your own interceptor to make CDI beans transactional, but for now, its simpler to use an EJB until CDI gets transactional CDI beans which is just around the corner
  • Comparing JSF Beans, CDI Beans and EJBs
  • JSF Managed Beans
  • In short, don’t use them if you are developing for Java EE 6 and using CDI. They provide a simple mechanism for dependency injection and defining backing beans for web pages, but they are far less powerful than CDI beans.
  • JSF beans cannot be mixed with other kinds of beans without some kind of manual coding.
  • CDI Beans
  • includes a complete, comprehensive managed bean facility
  • interceptors, conversation scope, Events, type safe injection, decorators, stereotypes and producer methods
  • JSF-like features, you can define the scope of the CDI bean using one of the scopes defined in the javax.enterprise.context package (namely, request, conversation, session and application scopes). If you want to use the CDI bean from a JSF page, you can give it a name using the javax.inject.Named annotation
  • Comparing JSF Beans, CDI Beans and EJBs
  • Comparing JSF Beans, CDI Beans and EJBs
  • JSF Managed Beans
kuni katsuya

Enterprise JavaBeans 3.1 with Contexts and Dependency Injection: The Perfect Synergy - 0 views

  • EJB beans cannot be directly exposed to JSF or JSP without a little help from CDI
  • CDI doesn't provide any transactional, monitoring, or concurrency aspect out of the box
  • stateless EJB 3.1 bean as boundary (Facade)
  • ...1 more annotation...
  • injected managed beans (controls) results in the simplest possible architecture
kuni katsuya

Why Service Isn't A ServiceFacade, But ServiceFacade Is Sometimes A Service... : Adam B... - 0 views

  • boundary, which main responsibilities are:Providing coarser granularityEnsuring consistencyProviding a defined entry point which can be easily decorated with aspects / interceptorsExposure of components (what components are we will cover later) functionality to remote clients via IIOP, REST, SOAP, JMS, Hessian etc...
  • ServiceFacade - the facade to Services. The Services just rely on a certain amount of cross cutting aspects and concentrate on the realization of business logic
  • only invokes Services in consistent way, mostly using transactions
  • ...2 more annotations...
  • Services can remain independent
  • ServiceFacade combines them
kuni katsuya

3. Configuration for EJB 3 - Confluence - 0 views

  • Configuration for EJB 3 In order to initialize GDS/Tide for EJB 3 and Hibernate, you must add granite.jar and granite-hibernate.jar to your WEB-INF/lib
1 - 18 of 18
Showing 20 items per page