RentalServiceBean.java
// license-header java merge-point
//
// Generated by SessionBeanImpl.vsl in andromda-ejb3-cartridge on 08/06/2014 10:56:22.
// Modify as necessary. If deleted it will be regenerated.
//
package org.andromda.demo.ejb3.rental;
import java.util.List;
import javax.jms.JMSException;
import javax.jms.ObjectMessage;
import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.QueueSender;
import javax.jms.QueueSession;
/**
* @see RentalServiceBase
*
* Remember to manually configure the local business interface this bean implements if originally you only
* defined the remote business interface. However, this change is automatically reflected in the ejb-jar.xml.
*
* Do not specify the javax.ejb.Stateless annotation
* Instead, the session bean is defined in the ejb-jar.xml descriptor.
*/
// Uncomment to enable webservices for RentalServiceBean
// @javax.jws.WebService(endpointInterface = "org.andromda.demo.ejb3.rental.RentalServiceWSInterface", serviceName = "RentalService")
public class RentalServiceBean
extends RentalServiceBase
implements RentalServiceRemote
{
// --------------- Constructors ---------------
/**
* Default constructor extending base class default constructor
*/
public RentalServiceBean()
{
super();
}
// -------- Business Methods Impl --------------
/**
* @see RentalServiceBase#addCar(RentalCar)
*/
@Override
protected void handleAddCar(RentalCar car)
throws Exception
{
//TODO: put your implementation here.
throw new UnsupportedOperationException("org.andromda.demo.ejb3.rental.RentalServiceBean.handleAddCar(RentalCar car) Not implemented!");
}
/**
* @see RentalServiceBase#getAllCars()
*/
@Override
protected List handleGetAllCars()
throws Exception
{
//TODO: put your implementation here.
// Dummy return value, just that the file compiles
return null;
}
/**
* @see RentalServiceBase#getCustomersByName(String)
*/
@Override
protected List handleGetCustomersByName(String name)
throws Exception
{
//TODO: put your implementation here.
// Dummy return value, just that the file compiles
return null;
}
/**
* @see RentalServiceBase#processRental(RentalCar, int)
*/
@Override
protected void handleProcessRental(RentalCar car, int leasePeriod)
throws Exception
{
QueueConnection connection = null;
QueueSession session = null;
QueueSender sender = null;
try
{
connection = queueFactory.createQueueConnection();
session = connection.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
sender = session.createSender((Queue)paymentProcessor);
ObjectMessage message = session.createObjectMessage(car);
sender.send(message);
}
catch (JMSException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
finally
{
if (sender != null) {
try
{
sender.close();
}
catch (JMSException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
if (session != null) {
try
{
session.close();
}
catch (JMSException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
if (connection != null) {
try
{
connection.close();
}
catch (JMSException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
// -------- Lifecycle Callback Implementation --------------
}