View Javadoc

1   /*
2    * $Id: UniqueIdNotSupportedException.java 7976 2007-08-21 14:26:13Z 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.umo.provider;
12  
13  import org.mule.MuleRuntimeException;
14  import org.mule.config.i18n.CoreMessages;
15  import org.mule.config.i18n.Message;
16  
17  /**
18   * <code>UniqueIdNotSupportedException</code> is thrown by
19   * UMOMessageAdapter.getUniqueId() if the underlying message does not support or have
20   * a unique identifier.
21   */
22  
23  public class UniqueIdNotSupportedException extends MuleRuntimeException
24  {
25      /**
26       * Serial version
27       */
28      private static final long serialVersionUID = -6719055482076081111L;
29  
30      public UniqueIdNotSupportedException(UMOMessageAdapter adapter)
31      {
32          super(CoreMessages.uniqueIdNotSupportedByAdapter(adapter.getClass().getName()));
33      }
34  
35      public UniqueIdNotSupportedException(UMOMessageAdapter adapter, Message message)
36      {
37          super(chainMessage(
38              CoreMessages.uniqueIdNotSupportedByAdapter(adapter.getClass().getName()), message));
39      }
40  
41      public UniqueIdNotSupportedException(UMOMessageAdapter adapter, Throwable cause)
42      {
43          super(CoreMessages.uniqueIdNotSupportedByAdapter(adapter.getClass().getName()), cause);
44      }
45  
46      protected static Message chainMessage(Message m1, Message m2)
47      {
48          m1.setNextMessage(m2);
49          return m1;
50      }
51  }