1 Reply Latest reply on Oct 21, 2012 7:41 AM by paul.robinson

    JBOSS 7.1 Quickstart - Missing JAR Files for org.jboss.narayana.txframework.api.annotation.service.ServiceRequest e Transactional Annotations

    marco.mendes

      Hello, there.

       

      I would like to report a problem with a specific quickstart for JBOSS 7.1 (JTABridge)

      I couldn't find the JAR files for the classes below. I have tried maven dependencies, Nexus repository and also the JBOSS TM 5.0 libraries.

       

       

      import org.jboss.narayana.txframework.api.annotation.service.ServiceRequest;

      import org.jboss.narayana.txframework.api.annotation.transaction.Transactional;

       

       

      Below I attach the quickstart code with the import problems.

      Is this code deprecated?

       

       

      Thanks in advance for your help


       

      */

      /*

      * RestaurantServiceAT.java

      *

      * Copyright (c) 2003, 2004 Arjuna Technologies Ltd

      *

      * $Id: RestaurantServiceAT.java,v 1.3 2004/12/01 16:26:44 kconner Exp $

      *

      */

      package org.jboss.narayana.quickstarts.wsat.jtabridge;

       

      import org.jboss.narayana.quickstarts.wsat.jtabridge.jaxws.RestaurantServiceAT;


      import org.jboss.narayana.txframework.api.annotation.service.ServiceRequest;

      import org.jboss.narayana.txframework.api.annotation.transaction.Transactional;

       

      import javax.ejb.Remote;

      import javax.ejb.Stateless;

      import javax.ejb.TransactionAttribute;

      import javax.ejb.TransactionAttributeType;

      import javax.jws.WebMethod;

      import javax.jws.WebService;

      import javax.jws.soap.SOAPBinding;

      import javax.persistence.EntityManager;

      import javax.persistence.PersistenceContext;

       

      /**

      * An adapter class that exposes the RestaurantManager business API as a transactional Web Service.

      *

      * @author paul.robinson@redhat.com, 2012-01-04

      */

      @Transactional //By default bridge from WS-AT to JTA

      @Stateless

      @Remote(RestaurantServiceAT.class)

      @WebService(serviceName = "RestaurantServiceATService", portName = "RestaurantServiceAT", name = "RestaurantServiceAT", targetNamespace = "http://www.jboss.org/narayana/quickstarts/wsat/simple/Restaurant")

      @SOAPBinding(style = SOAPBinding.Style.RPC)

      @TransactionAttribute(TransactionAttributeType.MANDATORY) // default is REQUIRED

      public class RestaurantServiceATImpl implements RestaurantServiceAT {

       

          private static final int ENTITY_ID = 1;

       

          @PersistenceContext

          protected EntityManager em;

       

          /**

      * Book a number of seats in the restaurant. This is done by updating the BookingCountEntity within a JTA transaction. The JTA transaction

      * was automatically bridged from the WS-AT transaction.

      */

          @WebMethod

          @ServiceRequest

          public void makeBooking(int numSeats) {

       

              System.out.println("[SERVICE] Restaurant service invoked to make a booking for '" + numSeats + "'");

       

              // invoke the backend business logic:

              System.out.println("[SERVICE] Using the JPA Entity Manager to update the BookingCountEntity within a JTA transaction");

       

              BookingCountEntity entity = lookupBookingCountEntity();

              entity.addBookings(1);

              em.merge(entity);

          }

       

          @WebMethod

          public int getBookingCount() {

              System.out.println("[SERVICE] getBookingCount() invoked");

              BookingCountEntity bookingCountEntity = lookupBookingCountEntity();

              if (bookingCountEntity == null) {

                  return -1;

              }

              return bookingCountEntity.getBookingCount();

          }

       

          @WebMethod

          public void resetBookingCount() {

              BookingCountEntity entity = lookupBookingCountEntity();

              entity.setBookingCount(0);

              em.merge(entity);

          }

       

          private BookingCountEntity lookupBookingCountEntity() {

              BookingCountEntity entity = em.find(BookingCountEntity.class, ENTITY_ID);

              if (entity == null) {

                  entity = new BookingCountEntity();

                  em.persist(entity);

              }

              return entity;

          }

       

      }