Coverage Report - org.mule.module.spring.events.MuleApplicationEvent
 
Classes in this File Line Coverage Branch Coverage Complexity
MuleApplicationEvent
83%
15/18
N/A
1
 
 1  
 /*
 2  
  * $Id: MuleApplicationEvent.java 10789 2008-02-12 20:04:43Z dfeist $
 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.module.spring.events;
 12  
 
 13  
 import org.mule.api.MuleEventContext;
 14  
 import org.mule.api.endpoint.MalformedEndpointException;
 15  
 
 16  
 import java.util.Collections;
 17  
 import java.util.HashMap;
 18  
 import java.util.Map;
 19  
 
 20  
 import org.springframework.context.ApplicationContext;
 21  
 import org.springframework.context.ApplicationEvent;
 22  
 
 23  
 /**
 24  
  * <code>MuleApplicationEvent</code> is an Spring ApplicationEvent used to wrap a
 25  
  * DefaultMuleEvent
 26  
  */
 27  
 
 28  
 public class MuleApplicationEvent extends ApplicationEvent
 29  
 {
 30  
     /**
 31  
      * Serial version
 32  
      */
 33  
     private static final long serialVersionUID = 5297176859050194632L;
 34  
 
 35  
     private final MuleEventContext context;
 36  
     private final String endpoint;
 37  
     private final ApplicationContext applicationContext;
 38  194
     private final Map properties = Collections.synchronizedMap(new HashMap());
 39  
 
 40  
     public MuleApplicationEvent(Object message, String endpoint)
 41  
     {
 42  48
         super(message);
 43  48
         this.endpoint = endpoint;
 44  48
         this.applicationContext = null;
 45  48
         this.context = null;
 46  48
     }
 47  
 
 48  
     MuleApplicationEvent(Object message, MuleEventContext context, ApplicationContext appContext)
 49  
         throws MalformedEndpointException
 50  
     {
 51  146
         super(message);
 52  146
         this.context = context;
 53  146
         this.endpoint = context.getEndpointURI().toString();
 54  146
         this.applicationContext = appContext;
 55  146
     }
 56  
 
 57  
     public MuleEventContext getMuleEventContext()
 58  
     {
 59  450
         return context;
 60  
     }
 61  
 
 62  
     public String getEndpoint()
 63  
     {
 64  644
         return endpoint;
 65  
     }
 66  
 
 67  
     public ApplicationContext getApplicationContext()
 68  
     {
 69  40
         return applicationContext;
 70  
     }
 71  
 
 72  
     public Map getProperties()
 73  
     {
 74  168
         return properties;
 75  
     }
 76  
 
 77  
     public void setProperty(Object key, Object value)
 78  
     {
 79  0
         this.properties.put(key, value);
 80  0
     }
 81  
 
 82  
     public Object getProperty(Object key)
 83  
     {
 84  0
         return properties.get(key);
 85  
     }
 86  
 
 87  
 }