View Javadoc

1   /*
2    * $Id: OutboundAttachmentsExpressionEvaluator.java 20321 2010-11-24 15:21:24Z dfeist $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.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  package org.mule.expression;
11  
12  import org.mule.api.MuleMessage;
13  import org.mule.api.expression.ExpressionEvaluator;
14  
15  import org.apache.commons.logging.Log;
16  import org.apache.commons.logging.LogFactory;
17  
18  /**
19   * Creates a Map facade around a {@link org.mule.api.MuleMessage} instance to allow access to outbound
20   * attachments from within components and transformers without the these objects needing access to the Mule Message
21   */
22  public class OutboundAttachmentsExpressionEvaluator implements ExpressionEvaluator
23  {
24      public static final String NAME = "outboundAttachments";
25  
26      /**
27       * logger used by this class
28       */
29      protected transient final Log logger = LogFactory.getLog(OutboundAttachmentsExpressionEvaluator.class);
30  
31  
32      public Object evaluate(String expression, MuleMessage message)
33      {
34          if (message == null)
35          {
36              return null;
37          }
38          return new OutboundAttachmentsMap(message);
39      }
40  
41      /**
42       * {@inheritDoc}
43       */
44      public String getName()
45      {
46          return NAME;
47      }
48  
49      /**
50       * {@inheritDoc}
51       */
52      public void setName(String name)
53      {
54          throw new UnsupportedOperationException("name");
55      }
56  }