Source Listing
Following is a full listing of all source code used in this runnable example.
Implementation Resources
CalculatorBeanBase.java
package org.jboss.ejb3.examples.ch04.firstejb; import org.jboss.logging.Logger; /** * Base for bean implementation classes of the CalculatorEJB, * provides business logic for required contracts * * @author <a href="mailto:andrew.rubinger@jboss.org">ALR</a> */ public class CalculatorBeanBase implements CalculatorCommonBusiness { // ---------------------------------------------------------------------------|| // Class Members -------------------------------------------------------------|| // ---------------------------------------------------------------------------|| /** * Logger */ private static final Logger log = Logger.getLogger(CalculatorBeanBase.class); // ---------------------------------------------------------------------------|| // Required Implementations --------------------------------------------------|| // ---------------------------------------------------------------------------|| /** * {@inheritDoc} * @see org.jboss.ejb3.examples.ch04.firstejb.CalculatorCommonBusiness#add(int []) */ @Override public int add(final int... arguments) { // Initialize final StringBuffer sb = new StringBuffer(); sb.append("Adding arguments: "); int result = 0; // Add all arguments for (final int arg : arguments) { result += arg; sb.append(arg); sb.append(" "); } // Return log.info(sb.toString()); log.info("Result: " + result); return result; } }
CalculatorCommonBusiness.java ...
Get Enterprise JavaBeans 3.1, 6th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.