1 /*
2 * $Id: Greeter.java 8023 2007-08-23 07:40:46Z dirk.olmes $
3 * --------------------------------------------------------------------------------------
4 * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
5 *
6 * The software in this package is published under the terms of the CPAL v1.0
7 * license, a copy of which has been included with this distribution in the
8 * LICENSE.txt file.
9 */
10
11 package org.mule.samples.hello;
12
13 /**
14 * <code>Greeter</code> expects a valid <code>NameString</code> object. If invalid,
15 * an exception is created and returned. The outbound router will filter exceptions
16 * as user errors and return the messages to the original requester accordingly.
17 *
18 * @author <a href="mailto:ross.mason@symphonysoft.com">Ross Mason</a>
19 * @version $Revision: 8023 $
20 */
21 public class Greeter
22 {
23 private String greeting = "";
24
25 public Greeter()
26 {
27 greeting = LocaleMessage.getGreetingPart1();
28 }
29
30 public Object greet(NameString person)
31 {
32 Object payload = person;
33 if (person.isValid())
34 {
35 person.setGreeting(greeting);
36 }
37 else
38 {
39 payload = new Exception(LocaleMessage.getInvalidUserNameError());
40 }
41 return payload;
42 }
43 }