BookServiceDelegate.java

// license-header java merge-point
//
// Attention: Generated code! Do not modify by hand!
// Generated by ServiceDelegate.vsl in andromda-ejb3-cartridge on 08/08/2014 12:21:05.
//
package org.andromda.demo.ejb3.book;

import java.util.Properties;
import javax.naming.NamingException;
import org.andromda.demo.ejb3.ServiceDelegateBase;
import org.andromda.demo.ejb3.ServiceLocator;

/**
 * Web service delegator for {@link org.andromda.demo.ejb3.book.BookServiceBean}.
 *
 * @see org.andromda.demo.ejb3.book.BookServiceBean
 */
public class BookServiceDelegate
    extends ServiceDelegateBase
{
    /**
     * Default constructor
     */
    public BookServiceDelegate()
    {
        super();
    }

    /**
     * Constructor setting the environment properties.
     *
     * @param properties
     */
    public BookServiceDelegate(Properties properties)
    {
        super(properties);
    }

    /**
     * Gets an instance of {@link BookServiceRemote}
     */
    private BookServiceRemote getBookServiceRemote()
        throws NamingException
    {
        return ServiceLocator.getInstance().get_org_andromda_demo_ejb3_book_BookServiceBean_Remote(getProperties());
    }

    /**
     * Gets an instance of {@link BookServiceLocal}
     */
    private BookServiceLocal getBookServiceLocal()
        throws NamingException
    {
        return ServiceLocator.getInstance().get_org_andromda_demo_ejb3_book_BookServiceBean_Local(getProperties());
    }

    /**
     * Call the session bean operation using appropriate view type
     * @see org.andromda.demo.ejb3.book.BookServiceBean#addBook(Book)
     *
     * @param book
     * @throws BookException
     */
    public void addBook(Book book)
        throws BookException
    {
        try
        {
            getBookServiceRemote().addBook(book);
        }
        catch (BookException ex)
        {
            throw ex;
        }
        catch (NamingException ex)
        {
            throw new BookServiceException(
                "Error performing 'org.andromda.demo.ejb3.book.BookService.addBook(Book book)' --> " + ex, ex);
        }
    }

    /**
     * Call the session bean operation using appropriate view type
     * @see org.andromda.demo.ejb3.book.BookServiceBean#deleteBook(long)
     *
     * @param id
     * @throws BookException
     */
    public void deleteBook(long id)
        throws BookException
    {
        try
        {
            getBookServiceLocal().deleteBook(id);
        }
        catch (BookException ex)
        {
            throw ex;
        }
        catch (NamingException ex)
        {
            throw new BookServiceException(
                "Error performing 'org.andromda.demo.ejb3.book.BookService.deleteBook(long id)' --> " + ex, ex);
        }
    }

}