Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
Greeter |
|
| 1.5;1.5 |
1 | /* | |
2 | * $Id: Greeter.java 8022 2007-08-23 01:32:14Z aguenther $ | |
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 | public class Greeter | |
19 | { | |
20 | 2 | private String greeting = ""; |
21 | ||
22 | public Greeter() | |
23 | 2 | { |
24 | 2 | greeting = LocaleMessage.getGreetingPart1(); |
25 | 2 | } |
26 | ||
27 | public Object greet(NameString person) | |
28 | { | |
29 | 2 | Object payload = person; |
30 | 2 | if (person.isValid()) |
31 | { | |
32 | 2 | person.setGreeting(greeting); |
33 | } | |
34 | else | |
35 | { | |
36 | 0 | payload = new Exception(LocaleMessage.getInvalidUserNameError()); |
37 | } | |
38 | 2 | return payload; |
39 | } | |
40 | } |