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.gae.mail;
018
019 import com.google.appengine.api.mail.MailService;
020 import com.google.appengine.api.mail.MailService.Message;
021
022 import org.apache.camel.Consumer;
023 import org.apache.camel.Processor;
024 import org.apache.camel.Producer;
025 import org.apache.camel.component.gae.bind.OutboundBinding;
026 import org.apache.camel.component.gae.bind.OutboundBindingSupport;
027 import org.apache.camel.impl.DefaultEndpoint;
028
029 /**
030 * Represents a <a href="http://camel.apache.org/todo.html">Google App Engine Mail endpoint</a>.
031 */
032 public class GMailEndpoint extends DefaultEndpoint implements OutboundBindingSupport<GMailEndpoint, Message, Void> {
033
034 private OutboundBinding<GMailEndpoint, Message, Void> outboundBinding;
035
036 private MailService mailService;
037
038 private String sender;
039
040 private String subject;
041
042 private String to;
043
044 public GMailEndpoint(String endpointUri, String sender) {
045 super(endpointUri);
046 this.sender = sender;
047 }
048
049 public OutboundBinding<GMailEndpoint, Message, Void> getOutboundBinding() {
050 return outboundBinding;
051 }
052
053 public void setOutboundBinding(OutboundBinding<GMailEndpoint, Message, Void> outboundBinding) {
054 this.outboundBinding = outboundBinding;
055 }
056
057 public String getSender() {
058 return sender;
059 }
060
061 public MailService getMailService() {
062 return mailService;
063 }
064
065 public void setMailService(MailService mailService) {
066 this.mailService = mailService;
067 }
068
069 public String getSubject() {
070 return subject;
071 }
072
073 public void setSubject(String subject) {
074 this.subject = subject;
075 }
076
077 public String getTo() {
078 return to;
079 }
080
081 public void setTo(String to) {
082 this.to = to;
083 }
084
085 public Consumer createConsumer(Processor processor) throws Exception {
086 throw new UnsupportedOperationException("consumption from gmail endpoint not supported");
087 }
088
089 public Producer createProducer() throws Exception {
090 return new GMailProducer(this);
091 }
092
093 public boolean isSingleton() {
094 return true;
095 }
096
097 }