View Javadoc

1   /*
2    * EL4J, the Extension Library for the J2EE, adds incremental enhancements to
3    * the spring framework, http://el4j.sf.net
4    * Copyright (C) 2005 by ELCA Informatique SA, Av. de la Harpe 22-24,
5    * 1000 Lausanne, Switzerland, http://www.elca.ch
6    *
7    * EL4J is published under the GNU Lesser General Public License (LGPL)
8    * Version 2.1. See http://www.gnu.org/licenses/
9    *
10   * This program is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13   * GNU Lesser General Public License for more details.
14   *
15   * For alternative licensing, please contact info@elca.ch
16   */
17  
18  package ch.elca.el4j.tests.remoting.service.soap.impl;
19  
20  import java.util.Calendar;
21  import java.util.GregorianCalendar;
22  
23  import ch.elca.el4j.tests.remoting.service.CalculatorValueObject;
24  import ch.elca.el4j.tests.remoting.service.soap.ExceptionThrower;
25  import ch.elca.el4j.tests.remoting.service.soap.RemoteExceptionWithData;
26  
27  /**
28   * Implementation of the Jax-Rpc 1.1 wsdl fault specification conform service.
29   *
30   * @svnLink $Revision: 3875 $;$Date: 2009-08-04 14:35:53 +0200 (Di, 04. Aug 2009) $;$Author: swismer $;$URL: https://el4j.svn.sourceforge.net/svnroot/el4j/branches/el4j_3_1/el4j/framework/tests/remoting/web/jar/src/main/java/ch/elca/el4j/tests/remoting/service/soap/impl/ExceptionThrowerImpl.java $
31   *
32   * @author Martin Zeltner (MZE)
33   */
34  public class ExceptionThrowerImpl implements ExceptionThrower {
35  	/**
36  	 * Any index used in exception.
37  	 */
38  	public static final int EXCEPTION_INDEX = 4892;
39  	
40  	/**
41  	 * Any message used in exception.
42  	 */
43  	public static final String EXCEPTION_MESSAGE
44  		= "Something went wrong. Always problems with special characters "
45  			+ "like ?, %, ç, ä, è and so on.";
46  	
47  	/**
48  	 * Any byte data used in exception.
49  	 */
50  	public static final byte[] EXCEPTION_DATA = EXCEPTION_MESSAGE.getBytes();
51  	
52  	/**
53  	 * Any calendar object used in exception.
54  	 */
55  	public static final Calendar EXCEPTION_CALENDAR
56  		= new GregorianCalendar(1979, Calendar.DECEMBER, 27, 14, 10);
57  	
58  	/**
59  	 * Double value used in first calculator value object.
60  	 */
61  	public static final double EXCEPTION_C1_MYDOUBLE = 2.3;
62  
63  	/**
64  	 * String used in second calculator value object.
65  	 */
66  	public static final String EXCEPTION_C2_MYSTRING = "This is my string.";
67  
68  	/**
69  	 * {@inheritDoc}
70  	 */
71  	public void throwExceptionWithData() throws RemoteExceptionWithData {
72  		RemoteExceptionWithData e = new RemoteExceptionWithData();
73  		e.setIndex(EXCEPTION_INDEX);
74  		e.setMessage(EXCEPTION_MESSAGE);
75  		e.setData(EXCEPTION_DATA);
76  		e.setCalendar(EXCEPTION_CALENDAR);
77  		
78  		CalculatorValueObject c1 = new CalculatorValueObject();
79  		c1.setMyDouble(EXCEPTION_C1_MYDOUBLE);
80  		CalculatorValueObject c2 = new CalculatorValueObject();
81  		c2.setMyString(EXCEPTION_C2_MYSTRING);
82  		e.setCalculatorValueObjects(new CalculatorValueObject[] {c1, c2});
83  		
84  		throw e;
85  	}
86  }