KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mule > routing > LoggingCatchAllStrategy


1 /*
2  * $Id: LoggingCatchAllStrategy.java 4259 2006-12-14 03:12:07Z aperepel $
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 MuleSource MPL
7  * license, a copy of which has been included with this distribution in the
8  * LICENSE.txt file.
9  */

10
11 package org.mule.routing;
12
13 import org.apache.commons.logging.Log;
14 import org.apache.commons.logging.LogFactory;
15 import org.mule.impl.MuleEvent;
16 import org.mule.umo.UMOMessage;
17 import org.mule.umo.UMOSession;
18 import org.mule.umo.endpoint.UMOEndpoint;
19 import org.mule.umo.routing.RoutingException;
20
21 /**
22  * <code>LoggingCatchAllStrategy</code> is a simple strategy that only logs any
23  * events not caught by the router associated with this strategy. This should <b>not</b>
24  * be used in production unless it is acceptible for events to be disposing.
25  */

26
27 public class LoggingCatchAllStrategy extends AbstractCatchAllStrategy
28 {
29     private static final Log logger = LogFactory.getLog(MuleEvent.class);
30
31     public void setEndpoint(UMOEndpoint endpoint)
32     {
33         throw new UnsupportedOperationException JavaDoc("An endpoint cannot be set on this Catch All strategy");
34     }
35
36     public void setEndpoint(String JavaDoc endpoint)
37     {
38         throw new UnsupportedOperationException JavaDoc("An endpoint cannot be set on this Catch All strategy");
39     }
40
41     public UMOEndpoint getEndpoint()
42     {
43         return null;
44     }
45
46     public UMOMessage catchMessage(UMOMessage message, UMOSession session, boolean synchronous)
47         throws RoutingException
48     {
49         logger.warn("Message: " + message + " was not dispatched on session: " + session
50                     + ". No routing path was defined for it.");
51         return null;
52     }
53 }
54
Popular Tags