001 /**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017 package org.apache.camel.component.atom;
018
019 import java.net.URI;
020 import java.util.Map;
021
022 import org.apache.camel.component.feed.FeedComponent;
023 import org.apache.camel.component.feed.FeedEndpoint;
024 import org.apache.camel.util.URISupport;
025
026 /**
027 * An <a href="http://camel.apache.org/atom.html">Atom Component</a>.
028 * <p/>
029 * Camel uses Apache Abdera as the Atom implementation.
030 *
031 * @version $Revision: 761536 $
032 */
033 public class AtomComponent extends FeedComponent {
034
035 @Override
036 protected FeedEndpoint createEndpoint(String uri, String remaining, Map parameters) throws Exception {
037
038 // Parameters should be kept in the remaining path, since they might be needed to get the actual ATOM feed
039 URI remainingUri = URISupport.createRemainingURI(new URI(remaining), parameters);
040
041 // if http or https then the uri should include the parameters as we can have URI parameters
042 // that need to be sent to the remote server when retrieving feeds
043 String scheme = remainingUri.getScheme();
044 if (scheme != null && (scheme.equals("http") || scheme.equals("https"))) {
045 return new AtomEndpoint(uri, this, remainingUri.toString());
046 }
047
048 return new AtomEndpoint(uri, this, remaining);
049 }
050
051 }