/*
 * JBoss, Home of Professional Open Source
 * Copyright 2005, JBoss Inc., and individual contributors as indicated
 * by the @authors tag. See the copyright.txt in the distribution for a
 * full listing of individual contributors.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.jboss.test.jbossnet.ejbsimple.server;

import javax.ejb.EJBException;

import org.jboss.test.util.ejb.SessionSupport;

import org.jboss.test.jbossnet.ejbsimple.HelloData;
import org.w3c.dom.Element;

/**
 * The typical Hello Session Bean this time
 * as a web-service.
 * @author jung
 * @version $Revision: 1.1.1.1.4.2 $
 * @ejb.bean name="HelloRemote"
 *           display-name="Hello World Bean Remote"
 *           type="Stateless"
 *           view-type="remote"
 *           jndi-name="hello/HelloRemote"
 * @ejb.transaction type="Required"
 * @jboss-net.web-service urn="HelloRemote"
 * @ejb.interface remote-class="org.jboss.test.jbossnet.ejbsimple.HelloRemote" extends="javax.ejb.EJBObject"
 * @ejb.home remote-class="org.jboss.test.jbossnet.ejbsimple.HelloRemoteHome" extends="javax.ejb.EJBHome"
 */

public class HelloRemoteBean
   extends SessionSupport
   implements javax.ejb.SessionBean {
   /**
    * @jboss-net.web-method
    * @ejb.interface-method view-type="remote"
    */

   public String hello(String name) {
      return "Hello " + name + "!";
   }

   /**
    * @jboss-net.web-method
    * @ejb.interface-method view-type="remote"
    */

   public String howdy(HelloData name) {
      return "Howdy " + name.getName() + "!";
   }

   /**
    * @jboss-net.web-method
    * @ejb.interface-method view-type="remote"
    */

   public void throwException() {
      throw new EJBException("Something went wrong");
   }

   /**
    * @jboss-net:web-method
    * @ejb:interface-method view-type="remote"
    */
   public Object[] arrays(Object[] values) {
      return values;
   }

   /**
    * @jboss-net:web-method
    * @ejb:interface-method view-type="remote"
    */
   public Object[] reverse(Object[] values) {
      Object[] result = new Object[values.length];
      for (int i = 0; i < values.length; ++i)
         result[i] = values[values.length - i - 1];
      return result;
   }

   /**
    * @jboss-net:web-method
    * @ejb:interface-method view-type="both"
    */
   public HelloData[] typedArrays(HelloData[] values) {
      return values;
   }
   
   /**
    * @jboss-net.web-method
    * @ejb.interface-method view-type="both"
    */

   public Element element(Element in) {
      return in;
   }
   
}
