2009/05/20 - Apache Shale has been retired.

For more information, please explore the Attic.

Coverage Report - org.apache.shale.examples.test.dialog.basic.ContextListener
 
Classes in this File Line Coverage Branch Coverage Complexity
ContextListener
0%
0/14
N/A
1
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 3  
  * contributor license agreements.  See the NOTICE file distributed with
 4  
  * this work for additional information regarding copyright ownership.
 5  
  * The ASF licenses this file to you under the Apache License, Version 2.0
 6  
  * (the "License"); you may not use this file except in compliance with
 7  
  * the License.  You may obtain a copy of the License at
 8  
  *
 9  
  *      http://www.apache.org/licenses/LICENSE-2.0
 10  
  *
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  */
 17  
 
 18  
 package org.apache.shale.examples.test.dialog.basic;
 19  
 
 20  
 import java.io.Serializable;
 21  
 import org.apache.shale.dialog.base.AbstractDialogContextListener;
 22  
 
 23  
 /**
 24  
  * <p>Test implementation of DialogContextListener.</p>
 25  
  */
 26  0
 public class ContextListener extends AbstractDialogContextListener
 27  
  implements Serializable {
 28  
 
 29  
 
 30  
     public void onStart() {
 31  
 
 32  
         // Log the fact that we are processing this event
 33  0
         System.out.println("ContextListener.onStart(name="
 34  
           + getDialogContext().getName() + ", id="
 35  
           + getDialogContext().getId() + ")");
 36  
 
 37  0
     }
 38  
 
 39  
 
 40  
     public void onStop() {
 41  
 
 42  
         // Log the fact that we are processing this event
 43  0
         System.out.println("ContextListener.onStop(name="
 44  
           + getDialogContext().getName() + ", id="
 45  
           + getDialogContext().getId() + ")");
 46  
 
 47  0
     }
 48  
 
 49  
 
 50  
     public void onException(Exception e) {
 51  
 
 52  
         // Log the fact that we are processing this event
 53  0
         System.out.println("ContextListener.onException(name="
 54  
           + getDialogContext().getName() + ", id="
 55  
           + getDialogContext().getId() + ")");
 56  0
         e.printStackTrace(System.out);
 57  
 
 58  
         // In a real application, you might also want to modify some
 59  
         // state in your "data" property to reflect the fact that an
 60  
         // exception occurred
 61  
 
 62  0
     }
 63  
 
 64  
 
 65  
     public void onEntry(String stateId) {
 66  
 
 67  
         // Log the fact that we are processing this event
 68  0
         System.out.println("ContextListener.onEntry(name="
 69  
           + getDialogContext().getName() + ", id="
 70  
           + getDialogContext().getId() + ", stateId="
 71  
           + stateId + ")");
 72  
 
 73  
         // In a real application, you might also want to record the
 74  
         // fact that this state was just entered
 75  
 
 76  0
     }
 77  
 
 78  
 
 79  
     public void onExit(String stateId) {
 80  
 
 81  
         // Log the fact that we are processing this event
 82  0
         System.out.println("ContextListener.onExit(name="
 83  
           + getDialogContext().getName() + ", id="
 84  
           + getDialogContext().getId() + ", stateId="
 85  
           + stateId + ")");
 86  
 
 87  0
     }
 88  
 
 89  
 
 90  
     public void onTransition(String fromStateId, String toStateId) {
 91  
 
 92  
         // Log the fact that we are processing this event
 93  0
         System.out.println("ContextListener.onEntry(name="
 94  
           + getDialogContext().getName() + ", id="
 95  
           + getDialogContext().getId() + ", fromStateId="
 96  
           + fromStateId + ", toStateId=" + toStateId + ")");
 97  
 
 98  0
     }
 99  
 
 100  
 
 101  
 }