Coverage Report - org.mule.module.atom.endpoint.AtomInboundEndpoint
 
Classes in this File Line Coverage Branch Coverage Complexity
AtomInboundEndpoint
0%
0/14
N/A
0
 
 1  
 /*
 2  
  * $Id: AtomInboundEndpoint.java 19358 2010-09-03 20:00:25Z rossmason $
 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  
 
 11  
 package org.mule.module.atom.endpoint;
 12  
 
 13  
 import org.mule.api.MuleException;
 14  
 import org.mule.api.MuleMessage;
 15  
 import org.mule.api.endpoint.InboundEndpoint;
 16  
 import org.mule.endpoint.DefaultInboundEndpoint;
 17  
 import org.mule.module.atom.transformers.ObjectToFeed;
 18  
 
 19  
 import java.util.Date;
 20  
 import java.util.HashSet;
 21  
 import java.util.Set;
 22  
 
 23  
 /**
 24  
  * An ATOM endpoint is used for polling an ATOM feed and processing the feed entries
 25  
  */
 26  
 public class AtomInboundEndpoint extends DefaultInboundEndpoint 
 27  
 {
 28  
     private boolean splitFeed;
 29  
 
 30  
     private Date lastUpdate;
 31  
 
 32  0
     private ObjectToFeed inTransform = new ObjectToFeed();
 33  
 
 34  0
     private Set<String> supportedProtocols = new HashSet<String>(2);
 35  
 
 36  
     public AtomInboundEndpoint(boolean splitFeed, Date lastUpdate, InboundEndpoint ie)
 37  
     {
 38  0
         super(ie.getConnector(), ie.getEndpointURI(), ie.getName(),
 39  
                 ie.getProperties(), ie.getTransactionConfig(), ie.isDeleteUnacceptedMessages(),
 40  
                 ie.getExchangePattern(), ie.getResponseTimeout(), ie.getInitialState(),
 41  
                 ie.getEncoding(), ie.getEndpointBuilderName(), ie.getMuleContext(), ie.getRetryPolicyTemplate(), 
 42  
                 ie.getMessageProcessorsFactory(), ie.getMessageProcessors(), ie.getResponseMessageProcessors(), ie.isDisableTransportTransformer(), ie.getMimeType());
 43  0
         this.splitFeed = splitFeed;
 44  0
         this.lastUpdate = lastUpdate;
 45  0
     }
 46  
 
 47  
     public boolean isSplitFeed()
 48  
     {
 49  0
         return splitFeed;
 50  
     }
 51  
 
 52  
     public Date getLastUpdate()
 53  
     {
 54  0
         return lastUpdate;
 55  
     }
 56  
 
 57  
     void registerSupportedProtocol(String protocol)
 58  
     {
 59  0
         supportedProtocols.add(protocol);
 60  0
     }
 61  
 
 62  
     boolean unregisterProtocol(String protocol)
 63  
     {
 64  0
         return supportedProtocols.remove(protocol);
 65  
     }
 66  
 
 67  
     @Override
 68  
     public boolean isProtocolSupported(String protocol)
 69  
     {
 70  0
         return supportedProtocols.contains(protocol);
 71  
     }
 72  
 
 73  
     public boolean onMessage(MuleMessage message) throws MuleException
 74  
     {
 75  0
         message.applyTransformers(null, inTransform);
 76  0
         return true;
 77  
     }
 78  
 }