AnimalServiceDelegate.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.animal;

import java.util.Collection;
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.animal.AnimalServiceBean}.
 *
 * @see org.andromda.demo.ejb3.animal.AnimalServiceBean
 */
public class AnimalServiceDelegate
    extends ServiceDelegateBase
{
    /**
     * Default constructor
     */
    public AnimalServiceDelegate()
    {
        super();
    }

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

    /**
     * Gets an instance of {@link AnimalServiceRemote}
     */
    private AnimalServiceRemote getAnimalServiceRemote()
        throws NamingException
    {
        return ServiceLocator.getInstance().get_org_andromda_demo_ejb3_animal_AnimalServiceBean_Remote(getProperties());
    }

    /**
     * Call the session bean operation using appropriate view type
     * @see org.andromda.demo.ejb3.animal.AnimalServiceBean#addAnimal(Animal)
     *
     * @param animal
     * @throws AnimalCreateException
     */
    public void addAnimal(Animal animal)
        throws AnimalCreateException
    {
        try
        {
            getAnimalServiceRemote().addAnimal(animal);
        }
        catch (AnimalCreateException ex)
        {
            throw ex;
        }
        catch (NamingException ex)
        {
            throw new AnimalServiceException(
                "Error performing 'org.andromda.demo.ejb3.animal.AnimalService.addAnimal(Animal animal)' --> " + ex, ex);
        }
    }

    /**
     * Call the session bean operation using appropriate view type
     * @see org.andromda.demo.ejb3.animal.AnimalServiceBean#getAllAnimals()
     *
     * @return Collection
     */
    public Collection getAllAnimals()
    {
        try
        {
            return getAnimalServiceRemote().getAllAnimals();
        }
        catch (NamingException ex)
        {
            throw new AnimalServiceException(
                "Error performing 'org.andromda.demo.ejb3.animal.AnimalService.getAllAnimals()' --> " + ex, ex);
        }
    }

}