EMMA Coverage Report (generated Tue Dec 18 20:38:46 CET 2007)
[all classes][cz.vutbr.feec.session.rtprtcp]

COVERAGE SUMMARY FOR SOURCE FILE [ReadIni.java]

nameclass, %method, %block, %line, %
ReadIni.java0%   (0/1)0%   (0/6)0%   (0/209)0%   (0/52)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ReadIni0%   (0/1)0%   (0/6)0%   (0/209)0%   (0/52)
ReadIni (): void 0%   (0/1)0%   (0/3)0%   (0/1)
getConfig (): Config 0%   (0/1)0%   (0/3)0%   (0/1)
getConfig (Config): Config 0%   (0/1)0%   (0/4)0%   (0/1)
getConfig (Config, String): Config 0%   (0/1)0%   (0/160)0%   (0/35)
getConfig (String): Config 0%   (0/1)0%   (0/8)0%   (0/2)
setOsSpecificParams (Config): void 0%   (0/1)0%   (0/31)0%   (0/12)

1package cz.vutbr.feec.session.rtprtcp;
2 
3import java.io.FileInputStream;
4import java.io.FileNotFoundException;
5import java.io.IOException;
6import java.util.Properties;
7 
8import cz.vutbr.feec.session.common.NetUtils;
9import cz.vutbr.feec.session.rtprtcp.internal.SessionType;
10 
11/**
12 * The Class ReadIni.
13 * 
14 * @brief Read config for audio/video Session from *.ini file.
15 * @author burgetrm
16 */
17 
18public class ReadIni {
19 
20        /**
21         * Gets the config.
22         * 
23         * @return the config
24         */
25        public static Config getConfig() {
26                return getConfig("rtprtcp.ini");
27        }
28        
29        /**
30         * Gets the config.
31         * 
32         * @param cfg the cfg
33         * 
34         * @return the config
35         */
36        public static Config getConfig(Config cfg) {
37                return getConfig(cfg, "rtprtcp.ini");
38        }
39 
40        /**
41         * Gets the config.
42         * 
43         * @param initFileName the init file name
44         * 
45         * @return the config
46         */
47        public static Config getConfig(String initFileName) {
48                Config cfg = new Config();
49                return getConfig(cfg, initFileName);
50        }
51        
52        /**
53         * Gets the config.
54         * 
55         * @param cfg the cfg
56         * @param initFileName the init file name
57         * 
58         * @return the config
59         */
60        public static Config getConfig(Config cfg, String initFileName) {
61                Properties p = new Properties();
62                FileInputStream in;
63                try {
64                        in = new FileInputStream(initFileName);
65                        p.load(in);
66                        in.close();
67                } catch (FileNotFoundException ex) {
68                        // ex.printStackTrace();
69                        return null;
70                } catch (IOException ex) {
71                        ex.printStackTrace();
72                        return null;
73                }
74                setOsSpecificParams(cfg);
75                
76                cfg.setCNAME(p.getProperty("CNAME"));
77                cfg.setSSMSourceIpAddress(p.getProperty("SSM_SOURCE"));
78                cfg.setSSMGroupIpAddress(p.getProperty("SSM_GROUP"));
79                cfg.setSSMPortAudio(Integer.parseInt(p.getProperty("SSM_PORT_AUDIO")));
80                cfg.setSSMPortVideo(Integer.parseInt(p.getProperty("SSM_PORT_VIDEO")));
81 
82                cfg.setFeedbackIpAddress(p.getProperty("FEEDBACK_ADDR"));
83                cfg.setFeedbackInPortAudio(Integer.parseInt(p.getProperty("FEEDBACK_IN_PORT_AUDIO")));
84                cfg.setFeedbackOutPortAudio(Integer.parseInt(p.getProperty("FEEDBACK_OUT_PORT_AUDIO")));
85                cfg.setFeedbackInPortVideo(Integer.parseInt(p.getProperty("FEEDBACK_IN_PORT_VIDEO")));
86                cfg.setFeedbackOutPortVideo(Integer.parseInt(p.getProperty("FEEDBACK_OUT_PORT_VIDEO")));
87 
88                if(p.getProperty("MEMBER_TYPE").equalsIgnoreCase("SENDER")) {
89                        cfg.setMemberType(SessionType.SENDER);
90                } if(p.getProperty("MEMBER_TYPE").equalsIgnoreCase("RECEIVER")) {
91                        cfg.setMemberType(SessionType.RECEIVER);
92                } if(p.getProperty("MEMBER_TYPE").equalsIgnoreCase("FEEDBACK_TARGET")) {
93                        cfg.setMemberType(SessionType.FEEDBACK_TARGET);
94                }
95 
96                cfg.setMemberScale(Integer.parseInt(p.getProperty("SCALE_MEMBER")));
97                cfg.setTimeScale(Integer.parseInt(p.getProperty("SCALE_TIME")));
98 
99                cfg.setPayloadTypeAudio(Integer.parseInt(p.getProperty("PAYLOADTYPE_AUDIO")));
100                cfg.setPayloadTypeVideo(Integer.parseInt(p.getProperty("PAYLOADTYPE_VIDEO")));
101                
102 
103                cfg.setBandwidthAudio(Integer.parseInt(p.getProperty("BANDWIDTH_AUDIO")));
104                cfg.setBandwidthVideo(Integer.parseInt(p.getProperty("BANDWIDTH_VIDEO")));
105                int pozition = 2;
106                cfg.setLocalIpAddress(NetUtils.getLocalAddressString(pozition));
107 
108                return cfg;
109        }
110        
111        /**
112         * Sets the os specific params.
113         * 
114         * @param cfg the os specific params
115         */
116        public static void setOsSpecificParams(Config cfg) {
117                Properties p = new Properties();
118                FileInputStream in;
119                try {
120                        in = new FileInputStream("osspecific.ini");
121                        p.load(in);
122                        in.close();
123                } catch (FileNotFoundException ex) {
124                        ex.printStackTrace();
125                        return;
126                } catch (IOException ex) {
127                        ex.printStackTrace();
128                        return;
129                }
130                cfg.setIfNumber(Integer.parseInt(p.getProperty("LOCAL_IF_NUMBER")));
131        }
132}

[all classes][cz.vutbr.feec.session.rtprtcp]
EMMA 2.0.5312 EclEmma Fix 1 (C) Vladimir Roubtsov