Project

General

Profile

1
package eu.dnetlib.usagestats.export;
2

    
3
import org.apache.log4j.Logger;
4

    
5
public class UsageStatsExporter {
6

    
7
    private String username;
8
    private String password;
9
    private String httpProtocol;
10
    private String piwikUrl;
11
    private String siteId;
12
    private String startDate;
13
    private String finalDate;
14
    private String logsPath;
15
    private String filterOffset;
16

    
17

    
18
    private String tokenAuth;
19
    private String irusBaseURL;
20
    private String irusReportType;
21
    private String irusRelease;
22
    private String irusRequestorID;
23
    private String irusRepositoryIdentifier;
24
    private String irusPeriodGranularity;
25
    private String irusPeriod;
26

    
27

    
28
    private String dbUrl;
29
    private String dbSchema;
30
    private String dbUsername;
31
    private String dbPassword;
32

    
33
    private Logger log = Logger.getLogger(this.getClass());
34

    
35
    public UsageStatsExporter() {}
36

    
37
    public void export() throws Exception {
38

    
39
        PiwikDownloadLogs piwd = new PiwikDownloadLogs(username, password, tokenAuth, httpProtocol, piwikUrl, startDate, logsPath, dbUrl, dbUsername, dbPassword);
40
        piwd.getPiwikLogs();
41

    
42
        /*
43
         *  Create DB tables, insert/update statistics
44
         */
45

    
46
        PiwikStatsDB piwikstats = new PiwikStatsDB(dbUrl, dbUsername, dbPassword, logsPath);
47
        piwikstats.processLogs();
48

    
49
        //Create Usage Stats tables from Downloaded Logs
50
        piwikstats.usageStats();
51

    
52

    
53
        IrusStats irusStats = new IrusStats(dbUrl, dbUsername, dbPassword);
54
        irusStats.processIrusRRReport();
55
        irusStats.irusStats();
56

    
57
        SarcStats sarcStats = new SarcStats(dbUrl, dbUsername, dbPassword);
58
        sarcStats.processSarc();
59
        sarcStats.sarcStats();
60

    
61

    
62
        //finalize stats
63
        piwikstats.finalizeStats();
64

    
65
    }
66

    
67
    public String getUsername() {
68
        return username;
69
    }
70

    
71
    public void setUsername(String username) {
72
        this.username = username;
73
    }
74

    
75
    public String getPassword() {
76
        return password;
77
    }
78

    
79
    public void setPassword(String password) {
80
        this.password = password;
81
    }
82

    
83
    public String getHttpProtocol() {
84
        return httpProtocol;
85
    }
86

    
87
    public void setHttpProtocol(String httpProtocol) {
88
        this.httpProtocol = httpProtocol;
89
    }
90

    
91
    public String getPiwikUrl() {
92
        return piwikUrl;
93
    }
94

    
95
    public void setPiwikUrl(String piwikUrl) {
96
        this.piwikUrl = piwikUrl;
97
    }
98

    
99
    public String getSiteId() {
100
        return siteId;
101
    }
102

    
103
    public void setSiteId(String siteId) {
104
        this.siteId = siteId;
105
    }
106

    
107
    public String getStartDate() {
108
        return startDate;
109
    }
110

    
111
    public void setStartDate(String startDate) {
112
        this.startDate = startDate;
113
    }
114

    
115
    public String getFinalDate() {
116
        return finalDate;
117
    }
118

    
119
    public void setFinalDate(String finalDate) {
120
        this.finalDate = finalDate;
121
    }
122

    
123
    public String getLogsPath() {
124
        return logsPath;
125
    }
126

    
127
    public void setLogsPath(String logsPath) {
128
        this.logsPath = logsPath;
129
    }
130

    
131
    public String getFilterOffset() {
132
        return filterOffset;
133
    }
134

    
135
    public void setFilterOffset(String filterOffset) {
136
        this.filterOffset = filterOffset;
137
    }
138

    
139
    public String getDbUrl() {
140
        return dbUrl;
141
    }
142

    
143
    public void setDbUrl(String dbUrl) {
144
        this.dbUrl = dbUrl;
145
    }
146

    
147
    public String getDbSchema() {
148
        return dbSchema;
149
    }
150

    
151
    public void setDbSchema(String dbSchema) {
152
        this.dbSchema = dbSchema;
153
    }
154

    
155

    
156
    public String getDbUsername() {
157
        return dbUsername;
158
    }
159

    
160
    public void setDbUsername(String dbUsername) {
161
        this.dbUsername = dbUsername;
162
    }
163

    
164
    public String getDbPassword() {
165
        return dbPassword;
166
    }
167

    
168
    public void setDbPassword(String dbPassword) {
169
        this.dbPassword = dbPassword;
170
    }
171

    
172
    public String getTokenAuth() {
173
        return tokenAuth;
174
    }
175

    
176
    public void setTokenAuth(String tokenAuth) {
177
        this.tokenAuth = tokenAuth;
178
    }
179

    
180
    public String getIrusBaseURL() {
181
        return irusBaseURL;
182
    }
183

    
184
    public void setIrusBaseURL(String irusBaseURL) {
185
        this.irusBaseURL = irusBaseURL;
186
    }
187

    
188
    public String getIrusReportType() {
189
        return irusReportType;
190
    }
191

    
192
    public void setIrusReportType(String irusReportType) {
193
        this.irusReportType = irusReportType;
194
    }
195

    
196
    public String getIrusRelease() {
197
        return irusRelease;
198
    }
199

    
200
    public void setIrusRelease(String irusRelease) {
201
        this.irusRelease = irusRelease;
202
    }
203

    
204
    public String getIrusRequestorID() {
205
        return irusRequestorID;
206
    }
207

    
208
    public void setIrusRequestorID(String irusRequestorID) {
209
        this.irusRequestorID = irusRequestorID;
210
    }
211

    
212
    public String getIrusRepositoryIdentifier() {
213
        return irusRepositoryIdentifier;
214
    }
215

    
216
    public void setIrusRepositoryIdentifier(String irusRepositoryIdentifier) {
217
        this.irusRepositoryIdentifier = irusRepositoryIdentifier;
218
    }
219

    
220
    public String getIrusPeriodGranularity() {
221
        return irusPeriodGranularity;
222
    }
223

    
224
    public void setIrusPeriodGranularity(String irusPeriodGranularity) {
225
        this.irusPeriodGranularity = irusPeriodGranularity;
226
    }
227

    
228
    public String getIrusPeriod() {
229
        return irusPeriod;
230
    }
231

    
232
    public void setIrusPeriod(String irusPeriod) {
233
        this.irusPeriod = irusPeriod;
234
    }
235
}
(5-5/5)