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