1 /**
2 * $Id: EchoComponent.java 54 2006-11-08 14:02:18Z maldito_orco $
3 * $Revision: 54 $
4 * $Date: 2006-11-08 11:02:18 -0300 (Wed, 08 Nov 2006) $
5 *
6 * =========================================================================
7 *
8 * Copyright 2005 Tubo
9 *
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
13 *
14 * http://www.apache.org/licenses/LICENSE-2.0
15 *
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
21 */
22 package org.tubo.resource.component.echo;
23
24
25 import org.apache.commons.logging.Log;
26 import org.apache.commons.logging.LogFactory;
27
28 import org.tubo.resource.component.BaseComponentImpl;
29 import org.tubo.resource.flow.FlowContext;
30 import org.tubo.exception.TuboException;
31 import org.tubo.item.Item;
32
33 /**
34 * <p>
35 * </p>
36 *
37 * <p>
38 * Created: Oct 21, 2006, 2:07:35 PM<br>
39 * Last Modification Date: $Date: 2006-11-08 11:02:18 -0300 (Wed, 08 Nov 2006) $
40 * </p>
41 *
42 * @author maldito_orco (maldito_orco@users.sourceforge.net)
43 * @version $Revision: 54 $
44 */
45 public class EchoComponent extends BaseComponentImpl {
46 public static final String RCS_ID = "$Id: EchoComponent.java 54 2006-11-08 14:02:18Z maldito_orco $";
47 private static Log log = LogFactory.getLog(EchoComponent.class);
48
49 public static final String ECHO_INPUT_PROPERTY = "ECHO_INPUT";
50 public static final String ECHO_OUTPUT_PROPERTY = "ECHO_OUTPUT";
51
52
53 public void sayHelo(FlowContext flowContext) throws TuboException {
54 flowContext.getItem().setProperty(ECHO_OUTPUT_PROPERTY,"helo");
55 }
56
57 public void sayGoodbye(FlowContext flowContext) throws TuboException {
58 flowContext.getItem().setProperty(ECHO_OUTPUT_PROPERTY,"goodbye");
59 }
60
61 public void execute(FlowContext flowContext) throws TuboException {
62
63
64 Item item = flowContext.getItem();
65
66
67 String input = (String)item.getProperty(ECHO_INPUT_PROPERTY);
68
69
70 item.setProperty(ECHO_OUTPUT_PROPERTY,input);
71 }
72 }