Coverage Report - org.apache.camel.component.irc.IrcEndpoint
 
Classes in this File Line Coverage Branch Coverage Complexity
IrcEndpoint
0% 
0% 
0
 
 1  
 /**
 2  
  *
 3  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 4  
  * contributor license agreements.  See the NOTICE file distributed with
 5  
  * this work for additional information regarding copyright ownership.
 6  
  * The ASF licenses this file to You under the Apache License, Version 2.0
 7  
  * (the "License"); you may not use this file except in compliance with
 8  
  * the License.  You may obtain a copy of the License at
 9  
  *
 10  
  * http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing, software
 13  
  * distributed under the License is distributed on an "AS IS" BASIS,
 14  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 15  
  * See the License for the specific language governing permissions and
 16  
  * limitations under the License.
 17  
  */
 18  
 package org.apache.camel.component.irc;
 19  
 
 20  
 import org.apache.camel.Processor;
 21  
 import org.apache.camel.impl.DefaultEndpoint;
 22  
 import org.schwering.irc.lib.IRCModeParser;
 23  
 import org.schwering.irc.lib.IRCUser;
 24  
 
 25  
 /**
 26  
  * Defines the <a href="http://activemq.apache.org/camel/irc.html">IRC Endpoint</a>
 27  
  *
 28  
  * @version $Revision:$
 29  
  */
 30  0
 public class IrcEndpoint extends DefaultEndpoint<IrcExchange> {
 31  
     private IrcBinding binding;
 32  
     private IrcConfiguration configuration;
 33  
     private IrcComponent component;
 34  
 
 35  
     public IrcEndpoint(String endpointUri, IrcComponent component, IrcConfiguration configuration) {
 36  0
         super(endpointUri, component);
 37  0
         this.component = component;
 38  0
         this.configuration = configuration;
 39  0
     }
 40  
 
 41  
     public boolean isSingleton() {
 42  0
         return true;
 43  
     }
 44  
 
 45  
     public IrcExchange createExchange() {
 46  0
         return new IrcExchange(getContext(), getBinding());
 47  
     }
 48  
 
 49  
     public IrcExchange createOnPrivmsgExchange(String target, IRCUser user, String msg) {
 50  0
         return new IrcExchange(getContext(), getBinding(), new IrcMessage("PRIVMSG", target, user, msg));
 51  
     }
 52  
 
 53  
     public IrcExchange createOnNickExchange(IRCUser user, String newNick) {
 54  0
         return new IrcExchange(getContext(), getBinding(), new IrcMessage("NICK", user, newNick));
 55  
     }
 56  
 
 57  
     public IrcExchange createOnQuitExchange(IRCUser user, String msg) {
 58  0
         return new IrcExchange(getContext(), getBinding(), new IrcMessage("QUIT", user, msg));
 59  
     }
 60  
 
 61  
     public IrcExchange createOnJoinExchange(String channel, IRCUser user) {
 62  0
         return new IrcExchange(getContext(), getBinding(), new IrcMessage("JOIN", channel, user));
 63  
     }
 64  
 
 65  
     public IrcExchange createOnKickExchange(String channel, IRCUser user, String whoWasKickedNick, String msg) {
 66  0
         return new IrcExchange(getContext(), getBinding(), new IrcMessage("KICK", channel, user, whoWasKickedNick, msg));
 67  
     }
 68  
 
 69  
     public IrcExchange createOnModeExchange(String channel, IRCUser user, IRCModeParser modeParser) {
 70  0
         return new IrcExchange(getContext(), getBinding(), new IrcMessage("MODE", channel, user, modeParser.getLine()));
 71  
     }
 72  
 
 73  
     public IrcExchange createOnPartExchange(String channel, IRCUser user, String msg) {
 74  0
         return new IrcExchange(getContext(), getBinding(), new IrcMessage("PART", channel, user, msg));
 75  
     }
 76  
 
 77  
     public IrcExchange createOnTopicExchange(String channel, IRCUser user, String topic) {
 78  0
         return new IrcExchange(getContext(), getBinding(), new IrcMessage("TOPIC", channel, user, topic));
 79  
     }
 80  
 
 81  
     public IrcProducer createProducer() throws Exception {
 82  0
         return new IrcProducer(this, component.getIRCConnection(configuration));
 83  
     }
 84  
 
 85  
     public IrcConsumer createConsumer(Processor processor) throws Exception {
 86  0
         return new IrcConsumer(this, processor, component.getIRCConnection(configuration));
 87  
     }
 88  
 
 89  
     public IrcComponent getComponent() {
 90  0
         return component;
 91  
     }
 92  
 
 93  
     public void setComponent(IrcComponent component) {
 94  0
         this.component = component;
 95  0
     }
 96  
 
 97  
     public IrcBinding getBinding() {
 98  0
         if (binding == null) {
 99  0
             binding = new IrcBinding();
 100  
         }
 101  0
         return binding;
 102  
     }
 103  
 
 104  
     public void setBinding(IrcBinding binding) {
 105  0
         this.binding = binding;
 106  0
     }
 107  
 
 108  
     public IrcConfiguration getConfiguration() {
 109  0
         return configuration;
 110  
     }
 111  
 
 112  
     public void setConfiguration(IrcConfiguration configuration) {
 113  0
         this.configuration = configuration;
 114  0
     }
 115  
 }
 116