%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
net.sf.infrared.agent.transport.impl.SocketForwarder |
|
|
1 | /* |
|
2 | * Copyright 2005 Tavant Technologies and Contributors |
|
3 | * |
|
4 | * Licensed under the Apache License, Version 2.0 (the "License") |
|
5 | * you may not use this file except in compliance with the License. |
|
6 | * You may obtain a copy of the License at |
|
7 | * |
|
8 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
9 | * |
|
10 | * Unless required by applicable law or agreed to in writing, software |
|
11 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13 | * See the License for the specific language governing permissions and |
|
14 | * limitations under the License. |
|
15 | * |
|
16 | * |
|
17 | * |
|
18 | * Original Author: kaushal.kumar (Tavant Technologies) |
|
19 | * Contributor(s): binil.thomas; |
|
20 | * |
|
21 | */ |
|
22 | package net.sf.infrared.agent.transport.impl; |
|
23 | ||
24 | import net.sf.infrared.agent.transport.Forwarder; |
|
25 | import net.sf.infrared.base.model.ApplicationStatistics; |
|
26 | import net.sf.infrared.base.model.OperationStatistics; |
|
27 | import net.sf.infrared.base.util.LoggingFactory; |
|
28 | ||
29 | import org.apache.log4j.Logger; |
|
30 | ||
31 | /** |
|
32 | * Forwarder which uses a socket to send statistics to the remote infrared web |
|
33 | * application |
|
34 | * |
|
35 | * @author kaushal.kumar |
|
36 | * @author binil.thomas |
|
37 | */ |
|
38 | public class SocketForwarder implements Forwarder { |
|
39 | 0 | private SocketWriter writer = null; |
40 | ||
41 | 0 | private Logger logger = LoggingFactory.getLogger(SocketForwarder.class); |
42 | ||
43 | 0 | public SocketForwarder(String hostName, int portNo) { |
44 | 0 | writer = new SocketWriter(hostName, portNo); |
45 | 0 | } |
46 | ||
47 | public void init(boolean suspended) { |
|
48 | 0 | } |
49 | ||
50 | public void forward(ApplicationStatistics stats) { |
|
51 | 0 | if (stats.hasStatistics()) { |
52 | 0 | writer.write(stats); |
53 | } else { |
|
54 | 0 | logger.info("Ignoring forward as there is no stats to send"); |
55 | } |
|
56 | 0 | } |
57 | ||
58 | public void forward(OperationStatistics stats) { |
|
59 | 0 | writer.write(stats); |
60 | 0 | } |
61 | ||
62 | public void suspend() { |
|
63 | 0 | } |
64 | ||
65 | public void resume() { |
|
66 | 0 | } |
67 | ||
68 | public void destroy() { |
|
69 | 0 | writer.close(); |
70 | 0 | } |
71 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |