3 | https://coherent-receiver.com/google-analytics-and-icecast - for more details
4 | https://github.com/ned-kelly/docker-icecast-google-analytics - dockerised version
5 | https://coherent-receiver.com/multi-channel-receivers-for-radio-station-monitoring - hardware platform for broadcasting monitoring, transcoding or hybrid radio
6 |
7 | Please don't hesitate to contact us if you have additional requirements, wishes or ideas
8 |
9 |
21 | Admin route is configured from the configuration file (transparent Icecast Server access possible using Spring Security)
22 |
23 | zuul.routes.admin.path=/icecast/admin/**
24 | zuul.routes.streaming.path=/icecast/streaming/**
25 | zuul.routes.streaming.url=http://A.B.C.D:PORT/
26 |
Tracking Pixel
27 | Tracking Pixel is configured under .../pixel/.
28 |
29 |
HLS Distribution
30 |
31 | For HLS distribution
32 | HLS: ffmpeg -i http:/... -c:a aac -b:a 128k -ac 2 -f hls -hls_time 4 -hls_playlist_type event stream.m3u8cd /var/
33 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 |
8 |
9 |
10 | org.apache.maven.plugins
11 | maven-compiler-plugin
12 |
13 | 1.8
14 | 1.8
15 |
16 |
17 |
18 | maven-assembly-plugin
19 | 3.1.0
20 |
21 |
22 | jar-with-dependencies
23 |
24 |
25 |
26 | com.coherentreceiver.analytics.demo.DemoSynchronous
27 |
28 |
29 |
30 |
31 |
32 | make-assembly
33 | package
34 |
35 | single
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | com.coherentreceiver
45 | icecast2googleanalytics
46 | jar
47 | 1.0-SNAPSHOT
48 |
49 |
50 |
51 | com.brsanthu
52 | google-analytics-java
53 | 1.1.2
54 |
55 |
56 |
57 | ch.qos.logback
58 | logback-classic
59 | 1.2.3
60 |
61 |
62 |
63 |
64 | org.jsoup
65 | jsoup
66 | 1.11.2
67 |
68 |
69 |
70 | javax.xml.bind
71 | jaxb-api
72 | 2.3.0
73 |
74 |
75 | com.sun.xml.bind
76 | jaxb-core
77 | 2.3.0
78 |
79 |
80 | com.sun.xml.bind
81 | jaxb-impl
82 | 2.3.0
83 |
84 |
85 | javax.activation
86 | activation
87 | 1.1.1
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/configuration/Configuration.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 | package com.coherentreceiver.analytics.configuration;
16 |
17 | import javax.xml.bind.annotation.XmlAccessType;
18 | import javax.xml.bind.annotation.XmlAccessorType;
19 | import javax.xml.bind.annotation.XmlElement;
20 | import javax.xml.bind.annotation.XmlRootElement;
21 | import java.util.List;
22 |
23 |
24 | /**
25 | * Basis configuration binding class
26 | */
27 | @XmlAccessorType(XmlAccessType.FIELD)
28 | @XmlRootElement(name="root")
29 | public class Configuration {
30 |
31 | //how often the data will be transferred to the google analytics; value in sec
32 | @XmlElement(name="analytics-update-frequency")
33 | int analyticsUpdateFrequency;
34 |
35 | //how often the icecast server will be polled, value in sec
36 | @XmlElement(name="icecast-update-frequency")
37 | int icecastUpdateFrequency;
38 |
39 |
40 |
41 | //Server element for configuration
42 | @XmlElement(name="server")
43 | List servers;
44 |
45 | public int getAnalyticsUpdateFrequency() {
46 | return analyticsUpdateFrequency;
47 | }
48 |
49 | public void setAnalyticsUpdateFrequency(int analyticsUpdateFrequency) {
50 | this.analyticsUpdateFrequency = analyticsUpdateFrequency;
51 | }
52 |
53 | public int getIcecastUpdateFrequency() {
54 | return icecastUpdateFrequency;
55 | }
56 |
57 | public void setIcecastUpdateFrequency(int icecastUpdateFrequency) {
58 | this.icecastUpdateFrequency = icecastUpdateFrequency;
59 | }
60 |
61 | public List getServers() {
62 | return servers;
63 | }
64 | public void setServers(List servers) {
65 | this.servers = servers;
66 | }
67 |
68 | @Override
69 | public String toString() {
70 | return "Configuration{" +
71 | "servers=" + servers +
72 | '}';
73 | }
74 | }
75 |
76 |
77 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/configuration/Configurator.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 | package com.coherentreceiver.analytics.configuration;
16 |
17 | import org.slf4j.LoggerFactory;
18 |
19 | import javax.xml.bind.JAXBContext;
20 | import javax.xml.bind.Unmarshaller;
21 | import java.io.File;
22 |
23 | /**
24 | *
25 | */
26 | public class Configurator {
27 | private String configurationPath = "";
28 | private static final org.slf4j.Logger logger = LoggerFactory.getLogger(Configurator.class);
29 |
30 | public Configurator(String configurationPath) {
31 | this.configurationPath = configurationPath;
32 |
33 | }
34 |
35 | public Configuration getConfiguration() {
36 |
37 | Configuration configuration = null;
38 |
39 | try {
40 |
41 |
42 | JAXBContext jc = JAXBContext.newInstance(Configuration.class);
43 |
44 | Unmarshaller unmarshaller = jc.createUnmarshaller();
45 | File xml = new File(configurationPath);
46 | configuration = (Configuration) unmarshaller.unmarshal(xml);
47 |
48 | } catch (Exception e) {
49 | logger.error(e.toString());
50 | }
51 |
52 | return configuration;
53 |
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/configuration/MountpointsGAAccount.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.coherentreceiver.analytics.configuration;
17 |
18 | import javax.xml.bind.annotation.XmlAccessType;
19 | import javax.xml.bind.annotation.XmlAccessorType;
20 | import javax.xml.bind.annotation.XmlElement;
21 |
22 | /**
23 | *
24 | */
25 |
26 | @XmlAccessorType(XmlAccessType.FIELD)
27 | public class MountpointsGAAccount {
28 |
29 | @XmlElement(name="mountpoint")
30 | String mountPoint;
31 |
32 | @XmlElement(name="gaaccount")
33 | String gaAccount;
34 |
35 | @XmlElement(name="user_id_algorithm")
36 | String userIdAlgorithm;
37 |
38 | @XmlElement(name="character-decoding")
39 | String characterDecoding;
40 |
41 |
42 | public String getMountPoint() {
43 | return mountPoint;
44 | }
45 |
46 | public void setMountPoint(String mountPoint) {
47 | this.mountPoint = mountPoint;
48 | }
49 |
50 | public String getGaAccount() {
51 | return gaAccount;
52 | }
53 |
54 | public void setGaAccount(String gaAccount) {
55 | this.gaAccount = gaAccount;
56 | }
57 |
58 | public String getUserIdAlgorithm() {
59 | return userIdAlgorithm;
60 | }
61 |
62 | public void setUserIdAlgorithm(String userIdAlgorithm) {
63 | this.userIdAlgorithm = userIdAlgorithm;
64 | }
65 |
66 | public String getCharacterDecoding() {
67 | return characterDecoding;
68 | }
69 |
70 | public void setCharacterDecoding(String characterDecoding) {
71 | this.characterDecoding = characterDecoding;
72 | }
73 |
74 | @Override
75 | public String toString() {
76 | return "MountpointsGAAccount{" +
77 | "mountPoint='" + mountPoint + '\'' +
78 | ", gaAccount='" + gaAccount + '\'' +
79 | ", userId='" + userIdAlgorithm + '\'' +
80 | '}';
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/configuration/Server.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.coherentreceiver.analytics.configuration;
17 |
18 | import javax.xml.bind.annotation.XmlAccessType;
19 | import javax.xml.bind.annotation.XmlAccessorType;
20 | import javax.xml.bind.annotation.XmlElement;
21 | import java.util.List;
22 |
23 | /**
24 | *
25 | */
26 | @XmlAccessorType(XmlAccessType.FIELD)
27 | public class Server {
28 |
29 | //Server element for configuration
30 | @XmlElement(name="id")
31 | int serverId;
32 |
33 | @XmlElement(name="statsurl")
34 | String statsURL;
35 |
36 | @XmlElement(name="listenerurl")
37 | String listenerURL;
38 |
39 | @XmlElement(name="login")
40 | String login;
41 |
42 | @XmlElement(name="password")
43 | String password;
44 |
45 | @XmlElement(name="mountpointsgaaccounts")
46 | List mountpointsGAAccounts;
47 |
48 | public int getServerId() {
49 | return serverId;
50 | }
51 |
52 | public void setServerId(int serverId) {
53 | this.serverId = serverId;
54 | }
55 |
56 | public String getStatsURL() {
57 | return statsURL;
58 | }
59 |
60 | public void setStatsURL(String statsURL) {
61 | this.statsURL = statsURL;
62 | }
63 |
64 | public String getListenerURL() {
65 | return listenerURL;
66 | }
67 |
68 | public void setListenerURL(String listenerURL) {
69 | this.listenerURL = listenerURL;
70 | }
71 |
72 | public String getLogin() {
73 | return login;
74 | }
75 |
76 | public void setLogin(String login) {
77 | this.login = login;
78 | }
79 |
80 | public String getPassword() {
81 | return password;
82 | }
83 |
84 | public void setPassword(String password) {
85 | this.password = password;
86 | }
87 |
88 | public List getMountpointsGAAccounts() {
89 | return mountpointsGAAccounts;
90 | }
91 |
92 | public void setMountpointsGAAccounts(List mountpointsGAAccounts) {
93 | this.mountpointsGAAccounts = mountpointsGAAccounts;
94 | }
95 |
96 | @Override
97 | public String toString() {
98 | return "Server{" +
99 | "serverId=" + serverId +
100 | ", statsURL='" + statsURL + '\'' +
101 | ", listenerURL='" + listenerURL + '\'' +
102 | ", login='" + login + '\'' +
103 | ", password='" + password + '\'' +
104 | ", mountpointsGAAccounts=" + mountpointsGAAccounts +
105 | '}';
106 | }
107 | }
108 |
109 |
110 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/controller/TaskType.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 | package com.coherentreceiver.analytics.controller;
16 |
17 | /**
18 | *
19 | */
20 | public enum TaskType {
21 |
22 | ICECAST_LOG_PARSER,
23 | ICECAST_XML_PARSER,
24 | GAUPDATE
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/controller/ThreadPoolManager.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.coherentreceiver.analytics.controller;
17 |
18 | /**
19 | *
20 | */
21 |
22 | import org.slf4j.LoggerFactory;
23 |
24 | import java.util.HashMap;
25 | import java.util.concurrent.*;
26 |
27 | public class ThreadPoolManager
28 | {
29 | private static final org.slf4j.Logger logger = LoggerFactory.getLogger(ThreadPoolManager.class);
30 |
31 | private int THREAD_POOL_SIZE = 10;
32 |
33 | private HashMap,TaskType> tasks = new HashMap,TaskType>();
34 |
35 | private ScheduledExecutorService executor = Executors.newScheduledThreadPool(THREAD_POOL_SIZE);
36 |
37 | public ThreadPoolManager()
38 | {
39 | }
40 |
41 |
42 |
43 | public ScheduledFuture> scheduleFixedRate( TaskType tasktype,
44 | Runnable command,
45 | long period,
46 | TimeUnit unit )
47 | throws RejectedExecutionException
48 | {
49 |
50 | ScheduledFuture> task =
51 | executor.scheduleAtFixedRate(command, 0, period, unit);
52 |
53 |
54 | tasks.put(task, tasktype);
55 |
56 | return task;
57 | }
58 |
59 | public void scheduleOnce( Runnable command, long delay, TimeUnit unit )
60 | throws RejectedExecutionException
61 | {
62 |
63 | executor.schedule( command, delay, unit );
64 | }
65 |
66 | public boolean cancel ( ScheduledFuture> task )
67 | {
68 | boolean success = task.cancel( true );
69 |
70 | tasks.remove( task );
71 |
72 | return success;
73 | }
74 |
75 | public void shutdown (){
76 | executor.shutdown();
77 | }
78 |
79 |
80 | public int getTaskCount(TaskType type )
81 | {
82 | int count = 0;
83 |
84 | for( TaskType current: tasks.values() )
85 | {
86 | if( current == type )
87 | {
88 | count++;
89 | }
90 | }
91 |
92 | return count;
93 | }
94 |
95 |
96 | }
97 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/demo/DemoSynchronous.java:
--------------------------------------------------------------------------------
1 | package com.coherentreceiver.analytics.demo;
2 |
3 | import com.coherentreceiver.analytics.configuration.Configuration;
4 | import com.coherentreceiver.analytics.configuration.Configurator;
5 | import com.coherentreceiver.analytics.task.Init;
6 | import com.coherentreceiver.analytics.task.InitSynchronous;
7 | import org.slf4j.Logger;
8 | import org.slf4j.LoggerFactory;
9 |
10 | /**
11 | *
12 | */
13 |
14 | public class DemoSynchronous {
15 |
16 | public static void main (String[] args){
17 |
18 | final Logger logger = LoggerFactory.getLogger(DemoSynchronous.class);
19 |
20 | logger.info("error {}", logger.isErrorEnabled());
21 | logger.info("info {}", logger.isInfoEnabled());
22 | logger.info("debug {}", logger.isDebugEnabled());
23 |
24 |
25 | String configurationPath="";
26 |
27 | if (args.length == 0) {
28 |
29 | configurationPath = "./resources/config.xml";
30 |
31 | }else {
32 | configurationPath = args[0];
33 | }
34 |
35 | Configurator configurator = new Configurator(configurationPath);
36 |
37 | Configuration configuration = configurator.getConfiguration();
38 |
39 | InitSynchronous init = new InitSynchronous(configuration);
40 |
41 | logger.debug("done");
42 |
43 | }
44 | }
45 |
46 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/fetcher/HTTPFetcher.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.coherentreceiver.analytics.fetcher;
17 |
18 | import java.io.InputStream;
19 |
20 | /**
21 | *
22 | */
23 | public interface HTTPFetcher {
24 |
25 | InputStream fetch(String URL, String login, String password);
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/fetcher/ListenersFetcher.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.coherentreceiver.analytics.fetcher;
17 |
18 | import com.coherentreceiver.analytics.icecastmodel.listclients.Listeners;
19 |
20 | import javax.xml.bind.JAXBContext;
21 | import javax.xml.bind.Unmarshaller;
22 |
23 | /**
24 | *
25 | */
26 | public class ListenersFetcher {
27 |
28 | public Listeners getListeners(String url, String login, String password){
29 |
30 | Listeners listeners=null;
31 |
32 | try{
33 | SecureGetFetcher fetcher = new SecureGetFetcher();
34 | JAXBContext jaxbContext = JAXBContext.newInstance(Listeners.class);
35 | Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
36 | listeners = (Listeners) jaxbUnmarshaller.unmarshal(fetcher.fetch(url, login, password));
37 | }catch (Exception e){System.out.println (e);}
38 |
39 | return listeners;
40 |
41 | }
42 | }
43 |
44 |
45 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/fetcher/SecureGetFetcher.java:
--------------------------------------------------------------------------------
1 |
2 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
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 | package com.coherentreceiver.analytics.fetcher;
18 |
19 | /**
20 | *
21 | */
22 | import org.apache.http.HttpEntity;
23 | import org.apache.http.HttpResponse;
24 | import org.apache.http.auth.UsernamePasswordCredentials;
25 | import org.apache.http.client.HttpClient;
26 | import org.apache.http.client.methods.HttpGet;
27 | import org.apache.http.impl.auth.BasicScheme;
28 | import org.apache.http.impl.client.DefaultHttpClient;
29 |
30 | import java.io.IOException;
31 | import java.io.InputStream;
32 |
33 | /**
34 | *
35 | */
36 | public class SecureGetFetcher implements HTTPFetcher {
37 |
38 | public InputStream fetch (String URL, String login, String password){
39 |
40 | //todo: simple copy paste from older project; refactoring is needed
41 | HttpClient httpClient = new DefaultHttpClient();
42 | HttpGet httpGet = new HttpGet(URL);
43 | httpGet.addHeader(BasicScheme.authenticate(
44 | new UsernamePasswordCredentials(login, password),
45 | "UTF-8", false));
46 |
47 | HttpResponse httpResponse = null;
48 | try {
49 | httpResponse = httpClient.execute(httpGet);
50 | } catch (IOException e) {
51 | e.printStackTrace();
52 | }
53 | HttpEntity responseEntity = httpResponse.getEntity();
54 |
55 | try {
56 | return responseEntity.getContent();
57 | } catch (IOException e) {
58 | e.printStackTrace();
59 | return null;
60 | }
61 |
62 |
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/fetcher/ServerStatsFetcher.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 |
17 | package com.coherentreceiver.analytics.fetcher;
18 |
19 | import javax.xml.bind.JAXBContext;
20 | import javax.xml.bind.Unmarshaller;
21 | import com.coherentreceiver.analytics.icecastmodel.stats.ServerStats;
22 |
23 | /**
24 | *
25 | */
26 | public class ServerStatsFetcher {
27 |
28 | public ServerStats getServerStats(String url, String login, String password){
29 |
30 | ServerStats serverStats=null;
31 |
32 | try{
33 | SecureGetFetcher fetcher = new SecureGetFetcher();
34 | JAXBContext jaxbContext = JAXBContext.newInstance(ServerStats.class);
35 | Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
36 | serverStats = (ServerStats) jaxbUnmarshaller.unmarshal(fetcher.fetch(url, login, password));
37 | }catch (Exception e){System.out.println (e);}
38 |
39 | return serverStats;
40 |
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/ga/GAObject.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.coherentreceiver.analytics.ga;
17 |
18 | import java.time.LocalDateTime;
19 |
20 | /**
21 | * Created by igor on 26.04.17.
22 | */
23 | public class GAObject {
24 |
25 | //google client id
26 | private String googleID;
27 |
28 | //server Address
29 | private String serverAddress;
30 |
31 | //mountPoint name
32 | private String mountPoint;
33 |
34 | //current title on the stream
35 | private String title;
36 |
37 | //GA-Account number for the client
38 | private String gaAccount;
39 |
40 | //ip address of the listener for google analytics
41 | private String ip;
42 |
43 | //userAgent
44 | private String userAgent;
45 |
46 | //listener connection time
47 | private long connected;
48 |
49 | //listener icecast id
50 | private String icecastid;
51 |
52 | private LocalDateTime timeStamp;
53 |
54 |
55 | public String getGoogleID() {
56 | return googleID;
57 | }
58 |
59 | public void setGoogleID(String googleID) {
60 | this.googleID = googleID;
61 | }
62 |
63 | public String getServerAddress() {
64 | return serverAddress;
65 | }
66 |
67 | public void setServerAddress(String serverAddress) {
68 | this.serverAddress = serverAddress;
69 | }
70 |
71 | public String getMountPoint() {
72 | return mountPoint;
73 | }
74 |
75 | public void setMountPoint(String mountPoint) {
76 | this.mountPoint = mountPoint;
77 | }
78 |
79 | public String getTitle() {
80 | return title;
81 | }
82 |
83 | public void setTitle(String title) {
84 | this.title = title;
85 | }
86 |
87 | public String getGaAccount() {
88 | return gaAccount;
89 | }
90 |
91 | public void setGaAccount(String gaAccount) {
92 | this.gaAccount = gaAccount;
93 | }
94 |
95 | public String getIp() {
96 | return ip;
97 | }
98 |
99 | public void setIp(String ip) {
100 | this.ip = ip;
101 | }
102 |
103 | public String getUserAgent() {
104 | return userAgent;
105 | }
106 |
107 | public void setUserAgent(String userAgent) {
108 | this.userAgent = userAgent;
109 | }
110 |
111 | public long getConnected() {
112 | return connected;
113 | }
114 |
115 | public void setConnected(long connected) {
116 | this.connected = connected;
117 | }
118 |
119 | public String getIcecastid() {
120 | return icecastid;
121 | }
122 |
123 | public void setIcecastid(String icecastid) {
124 | this.icecastid = icecastid;
125 | }
126 |
127 | public LocalDateTime getTimeStamp() {
128 | return timeStamp;
129 | }
130 |
131 | public void setTimeStamp(LocalDateTime timeStamp) {
132 | this.timeStamp = timeStamp;
133 | }
134 |
135 | @Override
136 | public boolean equals(Object o) {
137 | if (this == o) return true;
138 | if (o == null || getClass() != o.getClass()) return false;
139 |
140 | GAObject gaObject = (GAObject) o;
141 |
142 | if (googleID != null ? !googleID.equals(gaObject.googleID) : gaObject.googleID != null) return false;
143 | if (serverAddress != null ? !serverAddress.equals(gaObject.serverAddress) : gaObject.serverAddress != null)
144 | return false;
145 | if (mountPoint != null ? !mountPoint.equals(gaObject.mountPoint) : gaObject.mountPoint != null) return false;
146 | if (gaAccount != null ? !gaAccount.equals(gaObject.gaAccount) : gaObject.gaAccount != null) return false;
147 | if (ip != null ? !ip.equals(gaObject.ip) : gaObject.ip != null) return false;
148 | if (userAgent != null ? !userAgent.equals(gaObject.userAgent) : gaObject.userAgent != null) return false;
149 | return icecastid != null ? icecastid.equals(gaObject.icecastid) : gaObject.icecastid == null;
150 |
151 | }
152 |
153 | @Override
154 | public int hashCode() {
155 | int result = googleID != null ? googleID.hashCode() : 0;
156 | result = 31 * result + (serverAddress != null ? serverAddress.hashCode() : 0);
157 | result = 31 * result + (mountPoint != null ? mountPoint.hashCode() : 0);
158 | result = 31 * result + (gaAccount != null ? gaAccount.hashCode() : 0);
159 | result = 31 * result + (ip != null ? ip.hashCode() : 0);
160 | result = 31 * result + (userAgent != null ? userAgent.hashCode() : 0);
161 | result = 31 * result + (icecastid != null ? icecastid.hashCode() : 0);
162 | return result;
163 | }
164 |
165 | @Override
166 | public String toString() {
167 | return "GAObject{" +
168 | "googleID='" + googleID + '\'' +
169 | ", serverAddress='" + serverAddress + '\'' +
170 | ", mountPoint='" + mountPoint + '\'' +
171 | ", title='" + title + '\'' +
172 | ", gaAccount='" + gaAccount + '\'' +
173 | ", ip='" + ip + '\'' +
174 | ", userAgent='" + userAgent + '\'' +
175 | ", connected=" + connected +
176 | ", icecastid='" + icecastid + '\'' +
177 | '}';
178 | }
179 | }
180 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/helper/decoding/Decoder.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.coherentreceiver.analytics.helper.decoding;
17 |
18 | /**
19 | *
20 | */
21 | public interface Decoder {
22 |
23 | public String decode(String str);
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/helper/decoding/DecoderFactory.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 |
17 | package com.coherentreceiver.analytics.helper.decoding;
18 |
19 | /**
20 | *
21 | */
22 | public class DecoderFactory {
23 |
24 | public static Decoder getDecoder (String algorithm) throws Exception{
25 | if (algorithm.compareTo("no") ==0) return new NoDecoder();
26 | if (algorithm.compareTo("win1251UTF8") ==0) return new Win1251UTF8();
27 |
28 | throw new Exception("unsupported Decoder method: available options are: no decoder; win1251UTF-8");
29 |
30 | }
31 | }
32 |
33 |
34 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/helper/decoding/NoDecoder.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.coherentreceiver.analytics.helper.decoding;
17 |
18 | /**
19 | *
20 | */
21 | public class NoDecoder implements Decoder {
22 |
23 | public String decode (String str){
24 | return str;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/helper/decoding/Win1251UTF8.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.coherentreceiver.analytics.helper.decoding;
17 |
18 | import org.slf4j.LoggerFactory;
19 |
20 | /**
21 | *
22 | */
23 | public class Win1251UTF8 implements Decoder {
24 |
25 | private static final org.slf4j.Logger logger = LoggerFactory.getLogger(Win1251UTF8.class);
26 |
27 | public String decode(String str) {
28 |
29 | String stringResult="";
30 |
31 | //todo:
32 | //this must be re-written
33 | try {
34 | byte ptext[] = str.getBytes("UTF-8");
35 | byte result[] = new byte[ptext.length];
36 |
37 | int j = 0;
38 | for (int i = 0; i < ptext.length; i++) {
39 | if ((byte) ptext[i] == (byte) 0xC3
40 | && ((byte) ptext[i + 1] == (byte) 0x90 || ptext[i + 1] == (byte) 0x91)
41 | && (byte) ptext[i + 2] == (byte) 0xC2) {
42 | result[j] = (byte) (ptext[i + 1] + 0x40);
43 | j++;
44 | result[j] = (byte) ptext[i + 3];
45 | j++;
46 | i = i + 3;
47 | } else {
48 | result[j] = ptext[i];
49 | j++;
50 | }
51 |
52 | }
53 |
54 | stringResult = new String(result, "UTF-8");
55 |
56 | } catch (Exception e) {
57 | logger.error(e.toString());
58 | }
59 |
60 |
61 | return stringResult;
62 | }
63 |
64 | }
65 |
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/helper/idgenerator/IDGenerator.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.coherentreceiver.analytics.helper.idgenerator;
17 |
18 | import com.coherentreceiver.analytics.icecastmodel.listclients.SingleListenerElement;
19 |
20 | /**
21 | *
22 | */
23 | public interface IDGenerator {
24 |
25 | public String getId(SingleListenerElement listener);
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/helper/idgenerator/IDGeneratorAnonymizedIP.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.coherentreceiver.analytics.helper.idgenerator;
17 |
18 | import com.coherentreceiver.analytics.icecastmodel.listclients.SingleListenerElement;
19 |
20 | /**
21 | *
22 | */
23 | public class IDGeneratorAnonymizedIP implements IDGenerator {
24 |
25 | public String getId (SingleListenerElement listener){
26 |
27 | String ip = listener.getIp();
28 |
29 | if (ip.lastIndexOf(".") != -1) {
30 | //ipv4
31 | String truncatedIP = ip.substring(0, ip.lastIndexOf("."));
32 | return truncatedIP + "." + "0" + "-" + listener.getId();
33 | }
34 |
35 | if (ip.lastIndexOf(":") != -1){
36 | //ipv6
37 | String truncatedIP = ip.substring(0, ip.lastIndexOf(":"));
38 | return truncatedIP + ":" + "0"+ "-" + listener.getId();
39 | }
40 |
41 | return ip+"-"+listener.getId();
42 |
43 |
44 |
45 |
46 | }
47 |
48 | public static void main (String[] args){
49 |
50 | IDGeneratorAnonymizedIP test = new IDGeneratorAnonymizedIP();
51 | SingleListenerElement listener = new SingleListenerElement();
52 | listener.setIp("0.0.0.0");
53 | System.out.println (test.getId(listener));
54 |
55 | listener.setIp("0:0:0:0:12:25");
56 | System.out.println (test.getId(listener));
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/helper/idgenerator/IDGeneratorFactory.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.coherentreceiver.analytics.helper.idgenerator;
17 |
18 | /**
19 | *
20 | */
21 | public class IDGeneratorFactory {
22 |
23 | public static IDGenerator getIDGenerator (String algorithm) throws Exception{
24 | if (algorithm.compareTo("icecast_id") ==0) return new IDGeneratorIcecastID();
25 | if (algorithm.compareTo("anonymized_ip") ==0) return new IDGeneratorAnonymizedIP();
26 | if (algorithm.compareTo("ip")==0) return new IDGeneratorIP();
27 |
28 | throw new Exception("unsupported ID generation method: available options are: anonymizedIP, IcecastId, ip");
29 |
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/helper/idgenerator/IDGeneratorIP.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.coherentreceiver.analytics.helper.idgenerator;
17 |
18 | import com.coherentreceiver.analytics.icecastmodel.listclients.SingleListenerElement;
19 |
20 | /**
21 | *
22 | */
23 | public class IDGeneratorIP implements IDGenerator {
24 |
25 | public String getId (SingleListenerElement listener){
26 |
27 | return listener.getIp();
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/helper/idgenerator/IDGeneratorIcecastID.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.coherentreceiver.analytics.helper.idgenerator;
17 |
18 | import com.coherentreceiver.analytics.icecastmodel.listclients.SingleListenerElement;
19 |
20 | /**
21 | *
22 | */
23 | public class IDGeneratorIcecastID implements IDGenerator {
24 |
25 | public String getId (SingleListenerElement listener){
26 |
27 | return listener.getId();
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/icecastmodel/buffer/RtData.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.coherentreceiver.analytics.icecastmodel.buffer;
17 |
18 | import com.coherentreceiver.analytics.icecastmodel.listclients.SingleListenerElement;
19 | import com.coherentreceiver.analytics.icecastmodel.listclients.SingleListenerState;
20 | import com.coherentreceiver.analytics.icecastmodel.stats.StreamProperty;
21 | import org.slf4j.LoggerFactory;
22 |
23 | import java.util.*;
24 | import java.util.concurrent.ConcurrentHashMap;
25 | import java.util.concurrent.ConcurrentMap;
26 | import java.util.concurrent.Semaphore;
27 | import java.util.stream.Collectors;
28 |
29 | /**
30 | *
31 | */
32 | public class RtData {
33 |
34 | private ConcurrentMap rtData = new ConcurrentHashMap<>();
35 | private Semaphore sem = new Semaphore (1);
36 | private static final org.slf4j.Logger logger = LoggerFactory.getLogger(RtData.class);
37 |
38 |
39 | public ConcurrentMap getRtData() throws Exception {
40 |
41 | return rtData;
42 | }
43 |
44 | public void lock() throws Exception{
45 |
46 | sem.acquire();
47 |
48 | }
49 |
50 | public void unlock() throws Exception{
51 |
52 | sem.release();
53 |
54 | }
55 |
56 | public void setRtData(ConcurrentMap rtData) {this.rtData=rtData;}
57 |
58 | public void removeAll () throws Exception {
59 |
60 | rtData.clear();
61 | }
62 |
63 | public boolean contain (T newData){
64 |
65 | return (rtData.containsKey(newData)) ? true : false;
66 | }
67 |
68 | public void add (T newData) throws Exception {
69 | //add
70 |
71 |
72 | }
73 |
74 | public void mergeOne (T newData) throws Exception{
75 |
76 | //merge one
77 |
78 |
79 | }
80 |
81 |
82 | public void mergeAll (Map newData) throws Exception{
83 |
84 | /*
85 | merge section
86 | */
87 |
88 | }
89 |
90 | public T mergeListeners (T oldData, T newData) {
91 |
92 |
93 | //merge section
94 | T t = null;
95 | return t;
96 |
97 | }
98 |
99 | }
100 |
101 |
102 |
103 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/icecastmodel/listclients/Listeners.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 |
17 | package com.coherentreceiver.analytics.icecastmodel.listclients;
18 |
19 | import javax.xml.bind.annotation.XmlAccessType;
20 | import javax.xml.bind.annotation.XmlAccessorType;
21 | import javax.xml.bind.annotation.XmlElement;
22 | import javax.xml.bind.annotation.XmlRootElement;
23 |
24 | /**
25 | *
26 | * http://.../admin/listclients
27 | *
28 | */
29 |
30 | @XmlAccessorType(XmlAccessType.FIELD)
31 | @XmlRootElement (name="icestats")
32 |
33 | public class Listeners {
34 |
35 | @XmlElement (name="source")
36 | SourceStreamElement source;
37 |
38 | public SourceStreamElement getSource() {
39 | return source;
40 | }
41 |
42 | public void setSource(SourceStreamElement source) {
43 | this.source = source;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/icecastmodel/listclients/ServerMountpointListener.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 |
17 | package com.coherentreceiver.analytics.icecastmodel.listclients;
18 |
19 | /**
20 | *
21 | */
22 | public class ServerMountpointListener {
23 |
24 | private int serverID;
25 | private String mountpoint;
26 | private Listeners listenersPrevious;
27 | private Listeners listenersCurrent;
28 |
29 | public int getServerID() {
30 | return serverID;
31 | }
32 |
33 | public void setServerID(int serverID) {
34 | this.serverID = serverID;
35 | }
36 |
37 | public String getMountpoint() {
38 | return mountpoint;
39 | }
40 |
41 | public void setMountpoint(String mountpoint) {
42 | this.mountpoint = mountpoint;
43 | }
44 |
45 | public Listeners getListenersPrevious() {
46 | return listenersPrevious;
47 | }
48 |
49 | public void setListenersPrevious(Listeners listenersPrevious) {
50 | this.listenersPrevious = listenersPrevious;
51 | }
52 |
53 | public Listeners getListenersCurrent() {
54 | return listenersCurrent;
55 | }
56 |
57 | public void setListenersCurrent(Listeners listenersCurrent) {
58 | this.listenersCurrent = listenersCurrent;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/icecastmodel/listclients/SingleListenerElement.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.coherentreceiver.analytics.icecastmodel.listclients;
17 |
18 |
19 | import javax.xml.bind.annotation.XmlAccessType;
20 | import javax.xml.bind.annotation.XmlAccessorType;
21 | import javax.xml.bind.annotation.XmlElement;
22 |
23 | /**
24 | *
25 | */
26 |
27 | @XmlAccessorType(XmlAccessType.FIELD)
28 | public class SingleListenerElement {
29 |
30 | //listener ip address
31 | @XmlElement (name="IP")
32 | private String ip;
33 |
34 | //listener user agent
35 | @XmlElement (name="UserAgent")
36 | private String userAgent ;
37 |
38 | //listener connection time
39 | @XmlElement (name="Connected")
40 | private long connected;
41 |
42 | @XmlElement (name="Referer")
43 | private String referer;
44 |
45 | //listener icecast id
46 | @XmlElement (name="ID")
47 | private String id;
48 |
49 | private SingleListenerState listenerState = SingleListenerState.NOSTATE;
50 |
51 |
52 |
53 | public String getIp() {
54 | return ip;
55 | }
56 |
57 | public void setIp(String ip) {
58 | this.ip = ip;
59 | }
60 |
61 | public String getUserAgent() {
62 | return userAgent;
63 | }
64 |
65 | public void setUserAgent(String userAgent) {
66 | this.userAgent = userAgent;
67 | }
68 |
69 | public long getConnected() {
70 | return connected;
71 | }
72 |
73 | public void setConnected(long connected) {
74 | this.connected = connected;
75 | }
76 |
77 | public String getReferer() {
78 | return referer;
79 | }
80 |
81 | public void setReferer(String referer) {
82 | this.referer = referer;
83 | }
84 |
85 | public String getId() {
86 | return id;
87 | }
88 |
89 | public void setId(String id) {
90 | this.id = id;
91 | }
92 |
93 |
94 | public SingleListenerState getListenerState() {
95 | return listenerState;
96 | }
97 |
98 | public void setListenerState(SingleListenerState listenerState) {
99 | this.listenerState = listenerState;
100 | }
101 |
102 | public static SingleListenerElement getDefaultListner (){
103 | SingleListenerElement singleListenerElement = new SingleListenerElement();
104 | singleListenerElement.setId("0");
105 | singleListenerElement.setIp("0.0.0.0");
106 | singleListenerElement.setUserAgent("default");
107 | singleListenerElement.setConnected(0);
108 | return singleListenerElement;
109 | }
110 |
111 | @Override
112 | public boolean equals(Object o) {
113 | if (this == o) return true;
114 | if (o == null || getClass() != o.getClass()) return false;
115 |
116 | SingleListenerElement that = (SingleListenerElement) o;
117 |
118 | if (ip != null ? !ip.equals(that.ip) : that.ip != null) return false;
119 | if (userAgent != null ? !userAgent.equals(that.userAgent) : that.userAgent != null) return false;
120 | return id != null ? id.equals(that.id) : that.id == null;
121 |
122 | }
123 |
124 | @Override
125 | public int hashCode() {
126 | int result = ip != null ? ip.hashCode() : 0;
127 | result = 31 * result + (userAgent != null ? userAgent.hashCode() : 0);
128 | result = 31 * result + (id != null ? id.hashCode() : 0);
129 | return result;
130 | }
131 |
132 | @Override
133 | public String toString() {
134 | return "SingleListenerElement{" +
135 | "ip='" + ip + '\'' +
136 | ", userAgent='" + userAgent + '\'' +
137 | ", connected=" + connected +
138 | ", id='" + id + '\'' +
139 | '}';
140 | }
141 | }
142 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/icecastmodel/listclients/SingleListenerState.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.coherentreceiver.analytics.icecastmodel.listclients;
17 |
18 | /**
19 | *
20 | */
21 | public enum SingleListenerState {
22 | NOSTATE,
23 | CONNECTED,
24 | REGISTERED,
25 | DISCONNECTED
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/icecastmodel/listclients/SourceStreamElement.java:
--------------------------------------------------------------------------------
1 | /* Copyright2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 |
17 | package com.coherentreceiver.analytics.icecastmodel.listclients;
18 |
19 |
20 | import javax.xml.bind.annotation.XmlAccessType;
21 | import javax.xml.bind.annotation.XmlAccessorType;
22 | import javax.xml.bind.annotation.XmlAttribute;
23 | import javax.xml.bind.annotation.XmlElement;
24 | import java.util.Set;
25 |
26 | /**
27 | *
28 | */
29 |
30 | @XmlAccessorType(XmlAccessType.FIELD)
31 | public class SourceStreamElement {
32 |
33 | //Number of listners that listen this mount point as a number
34 | @XmlElement(name="Listeners")
35 | int numListeners;
36 |
37 | //List of the Listner elements
38 | @XmlElement (name="listener")
39 | Set listeners;
40 |
41 | @XmlAttribute(name="mount")
42 | String mountPoint;
43 |
44 | public int getNumListeners() {
45 | return numListeners;
46 | }
47 |
48 | public void setNumListeners(int numListeners) {
49 | this.numListeners = numListeners;
50 | }
51 |
52 | public Set getListeners() {
53 | return listeners;
54 | }
55 |
56 | public void setListeners(Set listeners) {
57 | this.listeners = listeners;
58 | }
59 |
60 | public String getMountPoint() {
61 | return mountPoint;
62 | }
63 |
64 | public void setMountPoint(String mountPoint) {
65 | this.mountPoint = mountPoint;
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/icecastmodel/listclients/Stream.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.coherentreceiver.analytics.icecastmodel.listclients;
17 |
18 |
19 | import javax.xml.bind.annotation.XmlAccessType;
20 | import javax.xml.bind.annotation.XmlAccessorType;
21 | import javax.xml.bind.annotation.XmlRootElement;
22 | import java.util.Date;
23 |
24 | @XmlAccessorType(XmlAccessType.FIELD)
25 | @XmlRootElement (name="")
26 |
27 | public class Stream
28 | {
29 |
30 |
31 | private String mountPoint;
32 | private String uri;
33 |
34 | private String title;
35 |
36 | private String description;
37 |
38 |
39 | private Integer currentListenerCount = -1;
40 |
41 |
42 | private Integer maxListenerCount = -1;
43 |
44 |
45 | private Integer peakListenerCount = -1;
46 |
47 |
48 | private String bitRate;
49 |
50 |
51 | private String currentSong;
52 |
53 |
54 | private String contentType;
55 |
56 |
57 | private String genre;
58 |
59 | private Date timeStamp;
60 |
61 | public Stream()
62 | {
63 | }
64 |
65 | public void clear()
66 | {
67 | title = null;
68 | description = null;
69 | uri = null;
70 | currentListenerCount = -1;
71 | maxListenerCount = -1;
72 | peakListenerCount = -1;
73 | bitRate = null;
74 | currentSong = null;
75 | contentType = null;
76 | genre = null;
77 | }
78 |
79 | public void merge(Stream another)
80 | {
81 | if (title == null) {
82 | title = another.getTitle();
83 | }
84 | if (description == null) {
85 | description = another.getDescription();
86 | }
87 | if (uri == null) {
88 | uri = another.getUri();
89 | }
90 | if (currentListenerCount < 0) {
91 | currentListenerCount = another.getCurrentListenerCount();
92 | }
93 | if (maxListenerCount < 0) {
94 | maxListenerCount = another.getMaxListenerCount();
95 | }
96 | if (peakListenerCount < 0) {
97 | peakListenerCount = another.getPeakListenerCount();
98 | }
99 | if (bitRate == null) {
100 | bitRate = another.getBitRate();
101 | }
102 | if (currentSong == null) {
103 | currentSong = another.getCurrentSong();
104 | }
105 | if (contentType == null) {
106 | contentType = another.getContentType();
107 | }
108 | if (genre == null) {
109 | genre = another.getGenre();
110 | }
111 | }
112 |
113 | public String getTimeStamp()
114 | {
115 | java.text.SimpleDateFormat sdf =
116 | new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
117 |
118 | return sdf.format(timeStamp);
119 | }
120 |
121 | public void setTimeStamp(Date timeStamp){
122 | this.timeStamp=timeStamp;
123 | }
124 |
125 | public String getMountPoint() {
126 | return mountPoint;
127 | }
128 |
129 | public void setMountPoint(String mountPoint) {
130 | this.mountPoint = mountPoint;
131 | }
132 |
133 | public String getTitle()
134 | {
135 | return title;
136 | }
137 |
138 | public void setTitle(String title)
139 | {
140 | this.title = title;
141 | }
142 |
143 | public String getDescription()
144 | {
145 | return description;
146 | }
147 |
148 | public void setDescription(String description)
149 | {
150 | this.description = description;
151 | }
152 |
153 | public String getUri()
154 | {
155 | return uri;
156 | }
157 |
158 | public void setUri(String uri)
159 | {
160 | this.uri = uri;
161 | }
162 |
163 | public Integer getCurrentListenerCount()
164 | {
165 | return currentListenerCount;
166 | }
167 |
168 | public void setCurrentListenerCount(int currentListenerCount)
169 | {
170 | this.currentListenerCount = currentListenerCount;
171 | }
172 |
173 | public Integer getMaxListenerCount()
174 | {
175 | return maxListenerCount;
176 | }
177 |
178 | public void setMaxListenerCount(int maxListenerCount)
179 | {
180 | this.maxListenerCount = maxListenerCount;
181 | }
182 |
183 | public Integer getPeakListenerCount()
184 | {
185 | return peakListenerCount;
186 | }
187 |
188 | public void setPeakListenerCount(int peakListenerCount)
189 | {
190 | this.peakListenerCount = peakListenerCount;
191 | }
192 |
193 | public String getBitRate()
194 | {
195 | return bitRate;
196 | }
197 |
198 | public void setBitRate(String bitRate)
199 | {
200 | this.bitRate = bitRate;
201 | }
202 |
203 | public String getCurrentSong()
204 | {
205 | return currentSong;
206 | }
207 |
208 | public void setCurrentSong(String currentSong)
209 | {
210 | this.currentSong = currentSong;
211 | }
212 |
213 | public String getContentType()
214 | {
215 | return contentType;
216 | }
217 |
218 | public void setContentType(String contentType)
219 | {
220 | this.contentType = contentType;
221 | }
222 |
223 | public String getGenre()
224 | {
225 | return genre;
226 | }
227 |
228 | public void setGenre(String genre)
229 | {
230 | this.genre = genre;
231 | }
232 |
233 | @Override
234 | public String toString() {
235 | return "Stream{" +
236 | "mountPoint='" + mountPoint + '\'' +
237 | ", uri='" + uri + '\'' +
238 | ", title='" + title + '\'' +
239 | ", description='" + description + '\'' +
240 | ", currentListenerCount=" + currentListenerCount +
241 | ", maxListenerCount=" + maxListenerCount +
242 | ", peakListenerCount=" + peakListenerCount +
243 | ", bitRate='" + bitRate + '\'' +
244 | ", currentSong='" + currentSong + '\'' +
245 | ", contentType='" + contentType + '\'' +
246 | ", genre='" + genre + '\'' +
247 | ", timeStamp=" + timeStamp +
248 | '}';
249 | }
250 | }
251 |
252 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/icecastmodel/logs/AccessLogParser.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.coherentreceiver.analytics.icecastmodel.logs;
17 |
18 | /**
19 | *
20 | */
21 | public interface AccessLogParser {
22 | }
23 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/icecastmodel/logs/IcecastAccessLogObject.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.coherentreceiver.analytics.icecastmodel.logs;
17 |
18 | import java.time.LocalDateTime;
19 |
20 | /**
21 | *
22 | * https://www.npmjs.com/package/icecast-log-parser
23 | */
24 | public class IcecastAccessLogObject {
25 |
26 | private String ip; //client ip address
27 | private String client; //client?
28 | private String user; //user for authenicated users
29 | private LocalDateTime datetime; //time stamp from log
30 | private String method; //HTTP method
31 | private String url; //requested URL path
32 | private String protocol; //used protocol
33 | private int status; //http status response code
34 | private long bytesSent; //the size in bytes of the stream data returned to the client
35 | private String refer; //Referrer url
36 | private String agent; //User-agent
37 | private int duration; //connection duration
38 |
39 | public IcecastAccessLogObject(String ip, String client, String user, LocalDateTime datetime, String method, String url, String protocol, int status, long bytesSent, String refer, String agent, int duration) {
40 | this.ip = ip;
41 | this.client = client;
42 | this.user = user;
43 | this.datetime = datetime;
44 | this.method = method;
45 | this.url = url;
46 | this.protocol = protocol;
47 | this.status = status;
48 | this.bytesSent = bytesSent;
49 | this.refer = refer;
50 | this.agent = agent;
51 | this.duration = duration;
52 | }
53 |
54 | public String getIp() {
55 | return ip;
56 | }
57 |
58 | public void setIp(String ip) {
59 | this.ip = ip;
60 | }
61 |
62 | public String getClient() {
63 | return client;
64 | }
65 |
66 | public void setClient(String client) {
67 | this.client = client;
68 | }
69 |
70 | public String getUser() {
71 | return user;
72 | }
73 |
74 | public void setUser(String user) {
75 | this.user = user;
76 | }
77 |
78 | public LocalDateTime getDate() {
79 | return datetime;
80 | }
81 |
82 | public void setDateTime(LocalDateTime datetime) {
83 | this.datetime = datetime;
84 | }
85 |
86 | public String getMethod() {
87 | return method;
88 | }
89 |
90 | public void setMethod(String method) {
91 | this.method = method;
92 | }
93 |
94 | public String getUrl() {
95 | return url;
96 | }
97 |
98 | public void setUrl(String url) {
99 | this.url = url;
100 | }
101 |
102 | public String getProtocol() {
103 | return protocol;
104 | }
105 |
106 | public void setProtocol(String protocol) {
107 | this.protocol = protocol;
108 | }
109 |
110 | public int getStatus() {
111 | return status;
112 | }
113 |
114 | public void setStatus(int status) {
115 | this.status = status;
116 | }
117 |
118 | public long getBytesSent() {
119 | return bytesSent;
120 | }
121 |
122 | public void setBytesSent(long bytesSent) {
123 | this.bytesSent = bytesSent;
124 | }
125 |
126 | public String getRefer() {
127 | return refer;
128 | }
129 |
130 | public void setRefer(String refer) {
131 | this.refer = refer;
132 | }
133 |
134 | public String getAgent() {
135 | return agent;
136 | }
137 |
138 | public void setAgent(String agent) {
139 | this.agent = agent;
140 | }
141 |
142 | public int getDuration() {
143 | return duration;
144 | }
145 |
146 | public void setDuration(int duration) {
147 | this.duration = duration;
148 | }
149 |
150 | @Override
151 | public String toString() {
152 | return "IcecastAccessLogObject{" +
153 | "ip='" + ip + '\'' +
154 | ", client='" + client + '\'' +
155 | ", user='" + user + '\'' +
156 | ", timestamp='" + datetime + '\'' +
157 | ", method='" + method + '\'' +
158 | ", url='" + url + '\'' +
159 | ", protocol='" + protocol + '\'' +
160 | ", status='" + status + '\'' +
161 | ", bytesSent='" + bytesSent + '\'' +
162 | ", refer='" + refer + '\'' +
163 | ", agent='" + agent + '\'' +
164 | ", duration='" + duration + '\'' +
165 | '}';
166 | }
167 | }
168 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/icecastmodel/logs/IcecastAccessLogParser.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.coherentreceiver.analytics.icecastmodel.logs;
17 |
18 | import com.coherentreceiver.analytics.fetcher.SecureGetFetcher;
19 | import org.slf4j.LoggerFactory;
20 |
21 | import java.io.BufferedReader;
22 | import java.io.InputStream;
23 | import java.io.InputStreamReader;
24 | import java.time.LocalDateTime;
25 | import java.time.format.DateTimeFormatter;
26 | import java.util.ArrayList;
27 | import java.util.List;
28 | import java.util.regex.Matcher;
29 | import java.util.regex.Pattern;
30 |
31 | /**
32 | *
33 | */
34 | public class IcecastAccessLogParser implements AccessLogParser {
35 |
36 | private static final org.slf4j.Logger logger = LoggerFactory.getLogger(IcecastAccessLogParser.class);
37 | private static final String LOG_ENTRY_PATTERN =
38 | // 1:IP
39 | // 2:client
40 | // 3:user
41 | // 4:time stamp
42 | // 5:method (e.g. GET)
43 | // 6:req url (relevant for mountpoint)
44 | // 7:protocol
45 | // 8:response status code
46 | // 9:bytes sent (the number of bytes that was sent by this request)
47 | //10: ???
48 | //11: user-agent
49 | //12: listened seconds
50 | ////127.0.0.1[1] -[2] steve[3] [05/Apr/2017:13:01:48 +0300][4] "GET[5] /admin/listclients?mount=/radio1[6] HTTP/1.1[7]" 200[8] 6570[9] "-"[10] "Apache-HttpClient/4.5.3 (Java/1.8.0_91)"[11] 0[12]
51 |
52 | "^([\\d.]+) (\\S+) (\\S+) \\[([\\w:/]+\\s[+\\-]\\d{4})\\] \"(\\S+) (\\S+) (\\S+)\" (\\S+) (\\S+) (\\S+) \"(.+)\" (\\d+)";
53 | // 1 2 3 4 5 6 7 8 9 10 11 12
54 | private static final Pattern PATTERN = Pattern.compile(LOG_ENTRY_PATTERN);
55 |
56 | private static final String LOG_DATE_FORMAT = "dd/LLL/yyyy:kk:mm:ss Z"; //07/Apr/2017:11:34:06 +0300
57 | private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern(LOG_DATE_FORMAT);
58 |
59 |
60 | public IcecastAccessLogObject parseLine (String logline){
61 |
62 |
63 | Matcher m = PATTERN.matcher(logline);
64 | if (!m.find()) {
65 | logger.debug("Cannot parse logline" + logline);
66 | throw new RuntimeException("Error parsing logline");
67 | }
68 |
69 |
70 | try {
71 |
72 | LocalDateTime localDateTime = LocalDateTime.parse(m.group(4), formatter); //:11:18:40 +0300");
73 | int respCode = Integer.parseInt(m.group(8));
74 | long bytesSent = Long.parseLong(m.group(9));
75 | int duration = Integer.parseInt(m.group(12));
76 |
77 | IcecastAccessLogObject obj = new IcecastAccessLogObject (m.group(1), m.group(2), m.group(3), localDateTime,
78 | m.group(5), m.group(6), m.group(7), respCode, bytesSent , m.group(10), m.group(11), duration);
79 | return obj;
80 |
81 | }
82 | catch (Exception e){
83 | logger.error("Error parsing the logline during the values decoding:" + logline);
84 | logger.error(e.toString());
85 | throw new RuntimeException("Error parsing logline");
86 | }
87 |
88 | }
89 |
90 | public List parseAccessLog (InputStream logLines){
91 |
92 | List logObjects = new ArrayList<>();
93 | String line = null;
94 | BufferedReader in = new BufferedReader(new InputStreamReader(logLines));
95 |
96 |
97 | try {
98 | while ((line = in.readLine()) != null) {
99 |
100 | IcecastAccessLogObject icecastAccessLogObject=null;
101 | try {
102 | logger.debug("Line to parse: " + line);
103 | icecastAccessLogObject = parseLine(line);
104 | }catch (Exception e){
105 | logger.error(e.toString());
106 | continue;}
107 |
108 | logObjects.add(icecastAccessLogObject);
109 | logger.debug ("icecast object " + icecastAccessLogObject);
110 |
111 |
112 | }
113 |
114 |
115 | }catch (Exception e){logger.error(e.toString());
116 |
117 | }
118 |
119 | return logObjects;
120 |
121 | }
122 |
123 | public static void main (String[] args){
124 | logger.debug ("TEST");
125 | IcecastAccessLogParser icecastAccessLogParser = new IcecastAccessLogParser();
126 |
127 | SecureGetFetcher fetcher = new SecureGetFetcher();
128 |
129 | InputStream in = fetcher.fetch("http://...../admin/showlog.txt?log=accesslog", "login", "password");
130 |
131 | List icecastObjects = icecastAccessLogParser.parseAccessLog(in);
132 |
133 | for (IcecastAccessLogObject icecastObject : icecastObjects) {
134 | logger.debug (icecastObject.toString());
135 |
136 | }
137 |
138 | }
139 | }
140 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/icecastmodel/stats/RadioStream.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.coherentreceiver.analytics.icecastmodel.stats;
17 |
18 | import javax.xml.bind.annotation.XmlAccessType;
19 | import javax.xml.bind.annotation.XmlAccessorType;
20 | import javax.xml.bind.annotation.XmlAttribute;
21 | import javax.xml.bind.annotation.XmlElement;
22 |
23 | /**
24 | *
25 | */
26 | @XmlAccessorType(XmlAccessType.FIELD)
27 | public class RadioStream {
28 |
29 |
30 | @XmlAttribute(name="mount")
31 | String mountPoint;
32 |
33 | @XmlElement(name="audio_channels")
34 | String audioChanels;
35 |
36 |
37 | @XmlElement(name="audio_info")
38 | String audioInfo;
39 |
40 | @XmlElement(name="audio_samplerate")
41 | String audioSamplerate;
42 |
43 | @XmlElement(name="channels")
44 | int channels;
45 |
46 | @XmlElement(name="genre")
47 | String genre;
48 |
49 | @XmlElement(name="ice-bitrate")
50 | String iceBitrate;
51 |
52 |
53 | @XmlElement(name="listener_peak")
54 | int listenerPeak;
55 |
56 |
57 | @XmlElement(name="listeners")
58 | int listeners;
59 |
60 | @XmlElement(name="listenurl")
61 | String listenurl;
62 |
63 | @XmlElement(name="max_listeners")
64 | String maxListeners;
65 |
66 | @XmlElement(name="public")
67 | int publicStream;
68 |
69 | @XmlElement(name="quality")
70 | int quality;
71 |
72 |
73 | @XmlElement(name="samplerate")
74 | int samplerate;
75 |
76 | @XmlElement(name="server_description")
77 | String serverDescritpion;
78 |
79 | @XmlElement(name="server_name")
80 | String serverName;
81 |
82 | @XmlElement(name="server_type")
83 | String serverType;
84 |
85 | @XmlElement(name="server_url")
86 | String serverURL;
87 |
88 | @XmlElement(name="slow_listeners")
89 | int slowListeners;
90 |
91 |
92 | @XmlElement(name="source_ip")
93 | String sourceIP;
94 |
95 | @XmlElement(name="stream_start")
96 | String streamStart;
97 |
98 | @XmlElement(name="stream_start_iso8601")
99 | String streamStartISO8601;
100 |
101 | @XmlElement(name="total_bytes_read")
102 | long totalBytesRead;
103 |
104 | @XmlElement(name="total_bytes_sent")
105 | long totalBytesSent;
106 |
107 | @XmlElement(name="user_agent")
108 | long userAgent;
109 |
110 |
111 | @XmlElement(name="title")
112 | String title;
113 |
114 | @XmlElement(name="artist")
115 | String artist;
116 |
117 |
118 | public String getMountPoint() {
119 | return mountPoint;
120 | }
121 |
122 | public void setMountPoint(String mountPoint) {
123 | this.mountPoint = mountPoint;
124 | }
125 |
126 | public String getAudioChanels() {
127 | return audioChanels;
128 | }
129 |
130 | public void setAudioChanels(String audioChanels) {
131 | this.audioChanels = audioChanels;
132 | }
133 |
134 | public String getAudioInfo() {
135 | return audioInfo;
136 | }
137 |
138 | public void setAudioInfo(String audioInfo) {
139 | this.audioInfo = audioInfo;
140 | }
141 |
142 | public String getAudioSamplerate() {
143 | return audioSamplerate;
144 | }
145 |
146 | public void setAudioSamplerate(String audioSamplerate) {
147 | this.audioSamplerate = audioSamplerate;
148 | }
149 |
150 | public int getChannels() {
151 | return channels;
152 | }
153 |
154 | public void setChannels(int channels) {
155 | this.channels = channels;
156 | }
157 |
158 | public String getGenre() {
159 | return genre;
160 | }
161 |
162 | public void setGenre(String genre) {
163 | this.genre = genre;
164 | }
165 |
166 | public String getIceBitrate() {
167 | return iceBitrate;
168 | }
169 |
170 | public void setIceBitrate(String iceBitrate) {
171 | this.iceBitrate = iceBitrate;
172 | }
173 |
174 | public int getListenerPeak() {
175 | return listenerPeak;
176 | }
177 |
178 | public void setListenerPeak(int listenerPeak) {
179 | this.listenerPeak = listenerPeak;
180 | }
181 |
182 | public int getListeners() {
183 | return listeners;
184 | }
185 |
186 | public void setListeners(int listeners) {
187 | this.listeners = listeners;
188 | }
189 |
190 | public String getListenurl() {
191 | return listenurl;
192 | }
193 |
194 | public void setListenurl(String listenurl) {
195 | this.listenurl = listenurl;
196 | }
197 |
198 | public String getMaxListeners() {
199 | return maxListeners;
200 | }
201 |
202 | public void setMaxListeners(String maxListeners) {
203 | this.maxListeners = maxListeners;
204 | }
205 |
206 | public int getPublicStream() {
207 | return publicStream;
208 | }
209 |
210 | public void setPublicStream(int publicStream) {
211 | this.publicStream = publicStream;
212 | }
213 |
214 | public int getQuality() {
215 | return quality;
216 | }
217 |
218 | public void setQuality(int quality) {
219 | this.quality = quality;
220 | }
221 |
222 | public int getSamplerate() {
223 | return samplerate;
224 | }
225 |
226 | public void setSamplerate(int samplerate) {
227 | this.samplerate = samplerate;
228 | }
229 |
230 | public String getServerDescritpion() {
231 | return serverDescritpion;
232 | }
233 |
234 | public void setServerDescritpion(String serverDescritpion) {
235 | this.serverDescritpion = serverDescritpion;
236 | }
237 |
238 | public String getServerName() {
239 | return serverName;
240 | }
241 |
242 | public void setServerName(String serverName) {
243 | this.serverName = serverName;
244 | }
245 |
246 | public String getServerType() {
247 | return serverType;
248 | }
249 |
250 | public void setServerType(String serverType) {
251 | this.serverType = serverType;
252 | }
253 |
254 | public String getServerURL() {
255 | return serverURL;
256 | }
257 |
258 | public void setServerURL(String serverURL) {
259 | this.serverURL = serverURL;
260 | }
261 |
262 | public int getSlowListeners() {
263 | return slowListeners;
264 | }
265 |
266 | public void setSlowListeners(int slowListeners) {
267 | this.slowListeners = slowListeners;
268 | }
269 |
270 | public String getSourceIP() {
271 | return sourceIP;
272 | }
273 |
274 | public void setSourceIP(String sourceIP) {
275 | this.sourceIP = sourceIP;
276 | }
277 |
278 | public String getStreamStart() {
279 | return streamStart;
280 | }
281 |
282 | public void setStreamStart(String streamStart) {
283 | this.streamStart = streamStart;
284 | }
285 |
286 | public String getStreamStartISO8601() {
287 | return streamStartISO8601;
288 | }
289 |
290 | public void setStreamStartISO8601(String streamStartISO8601) {
291 | this.streamStartISO8601 = streamStartISO8601;
292 | }
293 |
294 | public long getTotalBytesRead() {
295 | return totalBytesRead;
296 | }
297 |
298 | public void setTotalBytesRead(long totalBytesRead) {
299 | this.totalBytesRead = totalBytesRead;
300 | }
301 |
302 | public long getTotalBytesSent() {
303 | return totalBytesSent;
304 | }
305 |
306 | public void setTotalBytesSent(long totalBytesSent) {
307 | this.totalBytesSent = totalBytesSent;
308 | }
309 |
310 | public long getUserAgent() {
311 | return userAgent;
312 | }
313 |
314 | public void setUserAgent(long userAgent) {
315 | this.userAgent = userAgent;
316 | }
317 |
318 | public String getTitle() {
319 | return title;
320 | }
321 |
322 | public void setTitle(String title) {
323 | this.title = title;
324 | }
325 |
326 | public String getArtist() {
327 | return artist;
328 | }
329 |
330 | public void setArtist(String artist) {
331 | this.artist = artist;
332 | }
333 |
334 | @Override
335 | public String toString() {
336 | return "RadioStream{" +
337 | "mountPoint='" + mountPoint + '\'' +
338 | ", audioChanels='" + audioChanels + '\'' +
339 | ", audioInfo='" + audioInfo + '\'' +
340 | ", audioSamplerate='" + audioSamplerate + '\'' +
341 | ", channels=" + channels +
342 | ", genre='" + genre + '\'' +
343 | ", iceBitrate='" + iceBitrate + '\'' +
344 | ", listenerPeak=" + listenerPeak +
345 | ", listeners=" + listeners +
346 | ", listenurl='" + listenurl + '\'' +
347 | ", maxListeners='" + maxListeners + '\'' +
348 | ", publicStream=" + publicStream +
349 | ", quality=" + quality +
350 | ", samplerate=" + samplerate +
351 | ", serverDescritpion='" + serverDescritpion + '\'' +
352 | ", serverName='" + serverName + '\'' +
353 | ", serverType='" + serverType + '\'' +
354 | ", serverURL='" + serverURL + '\'' +
355 | ", slowListeners=" + slowListeners +
356 | ", sourceIP='" + sourceIP + '\'' +
357 | ", streamStart='" + streamStart + '\'' +
358 | ", streamStartISO8601='" + streamStartISO8601 + '\'' +
359 | ", totalBytesRead=" + totalBytesRead +
360 | ", totalBytesSent=" + totalBytesSent +
361 | ", userAgent=" + userAgent +
362 | ", title='" + title + '\'' +
363 | ", artist='" + artist + '\'' +
364 | '}';
365 | }
366 | }
367 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/icecastmodel/stats/ServerStats.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.coherentreceiver.analytics.icecastmodel.stats;
17 |
18 | import javax.xml.bind.annotation.XmlAccessType;
19 | import javax.xml.bind.annotation.XmlAccessorType;
20 | import javax.xml.bind.annotation.XmlElement;
21 | import javax.xml.bind.annotation.XmlRootElement;
22 | import java.util.List;
23 |
24 | /**
25 | *
26 | */
27 |
28 |
29 | @XmlAccessorType(XmlAccessType.FIELD)
30 | @XmlRootElement(name="icestats")
31 |
32 | public class ServerStats {
33 |
34 | @XmlElement(name="admin")
35 | String admin;
36 |
37 | @XmlElement(name="client_connections")
38 | int clientConnections;
39 |
40 | @XmlElement(name="clients")
41 | int clients;
42 |
43 | @XmlElement(name="connections")
44 | int connections;
45 |
46 | @XmlElement(name="file_connections")
47 | int fileConnections;
48 |
49 | @XmlElement(name="host")
50 | String host;
51 |
52 | @XmlElement(name="listener_connections")
53 | int listenerConnections;
54 |
55 | @XmlElement(name="listeners")
56 | int listeners;
57 |
58 | @XmlElement(name="location")
59 | String location;
60 |
61 | @XmlElement(name="server_id")
62 | String serverId;
63 |
64 | @XmlElement(name="server_start")
65 | String serverStart;
66 |
67 | @XmlElement(name="server_start_iso8601")
68 | String serverStartISO8601;
69 |
70 | @XmlElement(name="source_client_connections")
71 | int sourceClientConnections;
72 |
73 | @XmlElement(name="source_relay_connections")
74 | int sourceRelayConnections;
75 |
76 | @XmlElement(name="source_total_connections")
77 | int sourceTotalConnections;
78 |
79 | @XmlElement(name="sources")
80 | int sources;
81 |
82 | @XmlElement(name="stats")
83 | int stats;
84 |
85 | @XmlElement(name="stats_connections")
86 | int statsConnections;
87 |
88 |
89 | @XmlElement (name="source")
90 | List radioStreams;
91 |
92 |
93 | public String getAdmin() {
94 | return admin;
95 | }
96 |
97 | public void setAdmin(String admin) {
98 | this.admin = admin;
99 | }
100 |
101 | public int getClientConnections() {
102 | return clientConnections;
103 | }
104 |
105 | public void setClientConnections(int clientConnections) {
106 | this.clientConnections = clientConnections;
107 | }
108 |
109 | public int getClients() {
110 | return clients;
111 | }
112 |
113 | public void setClients(int clients) {
114 | this.clients = clients;
115 | }
116 |
117 | public int getConnections() {
118 | return connections;
119 | }
120 |
121 | public void setConnections(int connections) {
122 | this.connections = connections;
123 | }
124 |
125 | public int getFileConnections() {
126 | return fileConnections;
127 | }
128 |
129 | public void setFileConnections(int fileConnections) {
130 | this.fileConnections = fileConnections;
131 | }
132 |
133 | public String getHost() {
134 | return host;
135 | }
136 |
137 | public void setHost(String host) {
138 | this.host = host;
139 | }
140 |
141 | public int getListenerConnections() {
142 | return listenerConnections;
143 | }
144 |
145 | public void setListenerConnections(int listenerConnections) {
146 | this.listenerConnections = listenerConnections;
147 | }
148 |
149 | public int getListeners() {
150 | return listeners;
151 | }
152 |
153 | public void setListeners(int listeners) {
154 | this.listeners = listeners;
155 | }
156 |
157 | public String getLocation() {
158 | return location;
159 | }
160 |
161 | public void setLocation(String location) {
162 | this.location = location;
163 | }
164 |
165 | public String getServerId() {
166 | return serverId;
167 | }
168 |
169 | public void setServerId(String serverId) {
170 | this.serverId = serverId;
171 | }
172 |
173 | public String getServerStart() {
174 | return serverStart;
175 | }
176 |
177 | public void setServerStart(String serverStart) {
178 | this.serverStart = serverStart;
179 | }
180 |
181 | public String getServerStartISO8601() {
182 | return serverStartISO8601;
183 | }
184 |
185 | public void setServerStartISO8601(String serverStartISO8601) {
186 | this.serverStartISO8601 = serverStartISO8601;
187 | }
188 |
189 | public int getSourceClientConnections() {
190 | return sourceClientConnections;
191 | }
192 |
193 | public void setSourceClientConnections(int sourceClientConnections) {
194 | this.sourceClientConnections = sourceClientConnections;
195 | }
196 |
197 | public int getSourceRelayConnections() {
198 | return sourceRelayConnections;
199 | }
200 |
201 | public void setSourceRelayConnections(int sourceRelayConnections) {
202 | this.sourceRelayConnections = sourceRelayConnections;
203 | }
204 |
205 | public int getSourceTotalConnections() {
206 | return sourceTotalConnections;
207 | }
208 |
209 | public void setSourceTotalConnections(int sourceTotalConnections) {
210 | this.sourceTotalConnections = sourceTotalConnections;
211 | }
212 |
213 | public int getSources() {
214 | return sources;
215 | }
216 |
217 | public void setSources(int sources) {
218 | this.sources = sources;
219 | }
220 |
221 | public int getStats() {
222 | return stats;
223 | }
224 |
225 | public void setStats(int stats) {
226 | this.stats = stats;
227 | }
228 |
229 | public int getStatsConnections() {
230 | return statsConnections;
231 | }
232 |
233 | public void setStatsConnections(int statsConnections) {
234 | this.statsConnections = statsConnections;
235 | }
236 |
237 | public List getRadioStreams() {
238 | return radioStreams;
239 | }
240 |
241 | public void setRadioStreams(List radioStreams) {
242 | this.radioStreams = radioStreams;
243 | }
244 |
245 |
246 | @Override
247 | public String toString() {
248 | return "ServerStats{" +
249 | "admin='" + admin + '\'' +
250 | ", clientConnections=" + clientConnections +
251 | ", clients=" + clients +
252 | ", connections=" + connections +
253 | ", fileConnections=" + fileConnections +
254 | ", host='" + host + '\'' +
255 | ", listenerConnections=" + listenerConnections +
256 | ", listeners=" + listeners +
257 | ", location='" + location + '\'' +
258 | ", serverId='" + serverId + '\'' +
259 | ", serverStart='" + serverStart + '\'' +
260 | ", serverStartISO8601='" + serverStartISO8601 + '\'' +
261 | ", sourceClientConnections=" + sourceClientConnections +
262 | ", sourceRelayConnections=" + sourceRelayConnections +
263 | ", sourceTotalConnections=" + sourceTotalConnections +
264 | ", sources=" + sources +
265 | ", stats=" + stats +
266 | ", statsConnections=" + statsConnections +
267 | ", radioStreams=" + radioStreams +
268 | '}';
269 | }
270 | }
271 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/icecastmodel/stats/StreamProperty.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.coherentreceiver.analytics.icecastmodel.stats;
17 |
18 | import com.coherentreceiver.analytics.configuration.Server;
19 | import com.coherentreceiver.analytics.helper.idgenerator.IDGenerator;
20 | import com.coherentreceiver.analytics.helper.decoding.Decoder;
21 | import com.coherentreceiver.analytics.icecastmodel.listclients.Listeners;
22 |
23 | import java.time.LocalDateTime;
24 |
25 | /**
26 | *
27 | */
28 | public class StreamProperty {
29 |
30 | private String mountPoint;
31 | private String title;
32 | private String gaAccount;
33 | private int serverId;
34 |
35 | private Server server;
36 | private IDGenerator idGenerator;
37 | private Decoder characterDecoder;
38 | private Listeners listeners;
39 | private LocalDateTime timeStamp;
40 | public StreamProperty(){
41 |
42 | }
43 |
44 | public String getMountPoint() {
45 | return mountPoint;
46 | }
47 |
48 | public void setMountPoint(String mountPoint) {
49 | this.mountPoint = mountPoint;
50 | }
51 |
52 | public String getTitle() {
53 | return title;
54 | }
55 |
56 | public void setTitle(String title) {
57 | this.title = title;
58 | }
59 |
60 | public String getGaAccount() {
61 | return gaAccount;
62 | }
63 |
64 | public void setGaAccount(String gaAccount) {
65 | this.gaAccount = gaAccount;
66 | }
67 |
68 | public Server getServer() {
69 | return server;
70 | }
71 |
72 | public void setServer(Server server) {
73 | this.server = server;
74 | }
75 |
76 | public Listeners getListeners() {
77 | return listeners;
78 | }
79 |
80 | public void setListeners(Listeners listeners) {
81 | this.listeners = listeners;
82 | }
83 |
84 | public IDGenerator getIdGenerator() {
85 | return idGenerator;
86 | }
87 |
88 | public void setIdGenerator(IDGenerator idGenerator) {
89 | this.idGenerator = idGenerator;
90 | }
91 |
92 | public int getServerId() {
93 | return server.getServerId();
94 | }
95 |
96 | public LocalDateTime getTimeStamp() {
97 | return timeStamp;
98 | }
99 |
100 | public void setTimeStamp(LocalDateTime timeStamp) {
101 | this.timeStamp = timeStamp;
102 | }
103 |
104 | public Decoder getCharacterDecoder() {
105 | return characterDecoder;
106 | }
107 |
108 | public void setCharacterDecoder(Decoder characterDecoder) {
109 | this.characterDecoder = characterDecoder;
110 | }
111 |
112 | @Override
113 | public boolean equals(Object o) {
114 | if (this == o) return true;
115 | if (o == null || getClass() != o.getClass()) return false;
116 |
117 | StreamProperty that = (StreamProperty) o;
118 |
119 | if (serverId != that.serverId) return false;
120 | if (!mountPoint.equals(that.mountPoint)) return false;
121 | if (!title.equals(that.title)) return false;
122 | return gaAccount.equals(that.gaAccount);
123 |
124 | }
125 |
126 | @Override
127 | public int hashCode() {
128 | int result = mountPoint.hashCode();
129 | result = 31 * result + title.hashCode();
130 | result = 31 * result + gaAccount.hashCode();
131 | result = 31 * result + serverId;
132 | return result;
133 | }
134 | }
135 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/parser/IcecastHTTPParser.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.coherentreceiver.analytics.parser;
17 |
18 | import com.coherentreceiver.analytics.icecastmodel.listclients.Stream;
19 | import org.jsoup.Jsoup;
20 | import org.jsoup.nodes.Document;
21 | import org.jsoup.nodes.Element;
22 | import org.jsoup.select.Elements;
23 |
24 | import java.net.URI;
25 | import java.util.LinkedList;
26 | import java.util.List;
27 |
28 |
29 | /**
30 | * parser of the HTML icecast/shoutcast standard form
31 | */
32 | public class IcecastHTTPParser implements Parser {
33 |
34 | private String roundbox;
35 | private String mounthead;
36 | private String mountcont;
37 |
38 | public IcecastHTTPParser(String streamType) {
39 |
40 | switch (streamType) {
41 | case "mounthead": {
42 | roundbox = "roundbox";
43 | mounthead = "mounthead";
44 | mountcont = "mountcont";
45 | break;
46 |
47 | }
48 | case "roundtop": {
49 | roundbox = "roundcont";
50 | mounthead = "roundtop";
51 | mountcont = "newscontent";
52 | break;
53 | }
54 |
55 |
56 | }
57 |
58 | }
59 |
60 | public List parse(URI uri) throws ParseException
61 | {
62 | List streams = new LinkedList();
63 |
64 | try{
65 |
66 | Document doc = Jsoup.connect(uri.toString()).get();
67 |
68 |
69 | String title=doc.title();
70 |
71 | Elements roundboxes = doc.getElementsByClass (roundbox);
72 |
73 | for (Element roundbox: roundboxes){
74 |
75 | Elements tdr=null;
76 |
77 | Stream stream = new Stream();
78 |
79 |
80 | Elements mountHead = roundbox.getElementsByClass(mounthead);
81 |
82 | String mountPoint = mountHead.first().getElementsByClass("mount").text();
83 | stream.setMountPoint(mountPoint);
84 |
85 | Elements mountcontent = roundbox.getElementsByClass(mountcont);
86 |
87 | if (mountcontent.hasClass(mountcont)) {
88 | Element child = mountcontent.first();
89 | tdr=child.getElementsByTag("tr");
90 |
91 | };
92 |
93 | try {
94 | if (tdr.size() == 0) {
95 | continue;
96 | }
97 | }catch (Exception e){
98 | System.out.println (e);
99 | continue;
100 | }
101 |
102 |
103 | streams.add (parseParameter(tdr));
104 |
105 | }
106 |
107 |
108 | }catch (Exception e){
109 | System.out.println(e);
110 | throw new ParseException("Error in parse", e);
111 | }
112 |
113 | return streams;
114 | }
115 |
116 |
117 |
118 | public Stream parseParameter (Elements tdr){
119 |
120 | Stream stream = new Stream();
121 |
122 | for (int i=0; i parse(URI uri) throws ParseException;
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/task/AbstractTask.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.coherentreceiver.analytics.task;
17 |
18 | import com.coherentreceiver.analytics.icecastmodel.buffer.RtData;
19 | import com.coherentreceiver.analytics.icecastmodel.stats.StreamProperty;
20 | import org.slf4j.LoggerFactory;
21 |
22 | /**
23 | *
24 | */
25 | public abstract class AbstractTask implements Runnable {
26 |
27 | private static final org.slf4j.Logger logger = LoggerFactory.getLogger(AbstractTask.class);
28 |
29 | protected RtData rtData;
30 |
31 | public RtData getRtData() {
32 | return rtData;
33 | }
34 |
35 | public void setRtData(RtData rtData) {
36 | this.rtData = rtData;
37 | }
38 |
39 |
40 |
41 |
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/task/GAUpdateTask.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 |
17 | package com.coherentreceiver.analytics.task;
18 |
19 | import com.brsanthu.googleanalytics.EventHit;
20 | import com.brsanthu.googleanalytics.GoogleAnalytics;
21 | import com.brsanthu.googleanalytics.PageViewHit;
22 | import com.coherentreceiver.analytics.configuration.Server;
23 | import com.coherentreceiver.analytics.fetcher.ListenersFetcher;
24 | import com.coherentreceiver.analytics.helper.idgenerator.IDGenerator;
25 | import com.coherentreceiver.analytics.icecastmodel.listclients.Listeners;
26 | import com.coherentreceiver.analytics.icecastmodel.listclients.SingleListenerElement;
27 | import com.coherentreceiver.analytics.icecastmodel.stats.StreamProperty;
28 | import org.slf4j.LoggerFactory;
29 |
30 | /**
31 | *
32 | */
33 | public class GAUpdateTask extends AbstractTask implements Runnable {
34 |
35 | private static final org.slf4j.Logger logger = LoggerFactory.getLogger(GAUpdateTask.class);
36 |
37 | public void run() {
38 |
39 | //asynchronous multithreaded version
40 | logger.debug ("GAUpdate task Begin; transfer listeners to the GAServer");
41 |
42 | }
43 |
44 | public void updateSynchronous (StreamProperty streamProperty){
45 |
46 | Listeners listeners = getListeners (streamProperty);
47 |
48 | //there are no listeners anymore
49 | if (listeners==null) {
50 | return;
51 |
52 | }
53 |
54 | for (SingleListenerElement singleListener : listeners.getSource().getListeners()){
55 | makePageHit (streamProperty, singleListener);
56 | }
57 |
58 | }
59 |
60 |
61 | public Listeners getListeners (StreamProperty streamProperty) {
62 |
63 | Listeners listeners=null;
64 |
65 | try {
66 |
67 | Server server = streamProperty.getServer();
68 |
69 | ListenersFetcher listenersFetcher = new ListenersFetcher();
70 | listeners = listenersFetcher.getListeners(server.getListenerURL() + streamProperty.getMountPoint(), server.getLogin(), server.getPassword());
71 |
72 |
73 | if (listeners.getSource().getListeners() == null) {
74 |
75 | return null; //there are no listeners on this mount point
76 |
77 | }
78 | }catch (Exception e) {
79 | logger.error(e.toString(), e);
80 | }
81 |
82 | return listeners;
83 |
84 |
85 | }
86 |
87 |
88 | public void makePageHit (StreamProperty streamProperty, SingleListenerElement singleListener) {
89 |
90 |
91 | try {
92 | if (streamProperty.getTitle() == null) streamProperty.setTitle("undefined");
93 |
94 | String undecodedTitle = streamProperty.getTitle();
95 | String decodedTitle = streamProperty.getCharacterDecoder().decode(undecodedTitle);
96 |
97 | PageViewHit pageViewHit = new PageViewHit(decodedTitle, streamProperty.getMountPoint() + "/" + decodedTitle);
98 |
99 | pageViewHit.userIp(singleListener.getIp());
100 | GoogleAnalytics ga = new GoogleAnalytics(streamProperty.getGaAccount());
101 | IDGenerator idGenerator = streamProperty.getIdGenerator();
102 | pageViewHit.clientId(idGenerator.getId(singleListener));
103 | if (singleListener.getReferer()!=null){
104 | pageViewHit.documentReferrer(singleListener.getReferer());
105 | }
106 | if (singleListener.getUserAgent()!=null){
107 | pageViewHit.userAgent(singleListener.getUserAgent());
108 | }
109 |
110 | ga.post(pageViewHit);
111 |
112 | } catch (Exception e) {
113 | logger.error(e.toString(), e);
114 | }
115 | }
116 |
117 | public void makeEvent (StreamProperty streamProperty, SingleListenerElement listener, String eventCategory, String eventAction, String eventLabel, int eventValue){
118 |
119 | GoogleAnalytics ga = new GoogleAnalytics(streamProperty.getGaAccount());
120 | EventHit eventHit = new EventHit(eventCategory, eventAction, eventLabel, eventValue);
121 |
122 | IDGenerator idGenerator = streamProperty.getIdGenerator();
123 |
124 | eventHit.clientId(idGenerator.getId(listener));
125 | eventHit.userIp(listener.getIp());
126 | logger.debug (eventCategory + "- " + eventAction + " - " + eventLabel + " - " + eventValue + " for " + listener);
127 | ga.post(eventHit);
128 |
129 | }
130 |
131 |
132 |
133 | }
134 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/task/IcecastLogParserTask.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.coherentreceiver.analytics.task;
17 |
18 | import com.coherentreceiver.analytics.icecastmodel.logs.IcecastAccessLogParser;
19 | import com.coherentreceiver.analytics.icecastmodel.stats.StreamProperty;
20 | import org.slf4j.LoggerFactory;
21 |
22 | /**
23 | *
24 | */
25 | public class IcecastLogParserTask extends AbstractTask implements Runnable {
26 |
27 | public IcecastLogParserTask (){}
28 |
29 | private static final org.slf4j.Logger logger = LoggerFactory.getLogger(IcecastAccessLogParser.class);
30 |
31 | public void run() {
32 | logger.debug ("Log parser; connected to the server");
33 | try {
34 |
35 | //TODO: logging is not included in this version
36 | logger.debug("Log parsing complete; transfer data to the memory list");
37 |
38 | }catch (Exception e) {}
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/task/IcecastXMLParserTask.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.coherentreceiver.analytics.task;
17 |
18 | import com.coherentreceiver.analytics.configuration.MountpointsGAAccount;
19 | import com.coherentreceiver.analytics.configuration.Server;
20 | import com.coherentreceiver.analytics.fetcher.ListenersFetcher;
21 | import com.coherentreceiver.analytics.fetcher.ServerStatsFetcher;
22 | import com.coherentreceiver.analytics.helper.idgenerator.IDGeneratorFactory;
23 | import com.coherentreceiver.analytics.helper.decoding.DecoderFactory;
24 | import com.coherentreceiver.analytics.icecastmodel.listclients.Listeners;
25 | import com.coherentreceiver.analytics.icecastmodel.stats.RadioStream;
26 | import com.coherentreceiver.analytics.icecastmodel.stats.ServerStats;
27 | import com.coherentreceiver.analytics.icecastmodel.stats.StreamProperty;
28 | import org.slf4j.LoggerFactory;
29 |
30 | import java.time.LocalDateTime;
31 | import java.util.ArrayList;
32 | import java.util.List;
33 | import java.util.Optional;
34 |
35 | /**
36 | *
37 | */
38 | public class IcecastXMLParserTask extends AbstractTask implements Runnable {
39 |
40 | private static final org.slf4j.Logger logger = LoggerFactory.getLogger(IcecastXMLParserTask.class);
41 | protected Server server;
42 | protected String UNKNOWNTITLE = "NO_TITLE";
43 |
44 |
45 |
46 | public IcecastXMLParserTask (){}
47 |
48 |
49 | public void run() {
50 |
51 | //multithreaded version
52 |
53 | }
54 |
55 | public Server getServer() {
56 | return server;
57 | }
58 |
59 | public void setServer(Server server) {
60 | this.server = server;
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/task/Init.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.coherentreceiver.analytics.task;
17 |
18 | import com.coherentreceiver.analytics.configuration.Configuration;
19 | import com.coherentreceiver.analytics.configuration.Server;
20 | import com.coherentreceiver.analytics.controller.TaskType;
21 | import com.coherentreceiver.analytics.controller.ThreadPoolManager;
22 | import com.coherentreceiver.analytics.icecastmodel.buffer.RtData;
23 | import com.coherentreceiver.analytics.icecastmodel.stats.StreamProperty;
24 |
25 | import java.io.IOException;
26 | import java.util.List;
27 | import java.util.concurrent.ScheduledFuture;
28 | import java.util.concurrent.TimeUnit;
29 |
30 | /**
31 | *
32 | */
33 | public class Init {
34 |
35 |
36 | public Init(Configuration configuration) {
37 |
38 |
39 | //Multithreaded asynchronous version
40 | }
41 |
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/task/InitSynchronous.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.coherentreceiver.analytics.task;
17 |
18 | import com.coherentreceiver.analytics.configuration.Configuration;
19 | import com.coherentreceiver.analytics.configuration.MountpointsGAAccount;
20 | import com.coherentreceiver.analytics.configuration.Server;
21 | import com.coherentreceiver.analytics.controller.TaskType;
22 | import com.coherentreceiver.analytics.fetcher.ListenersFetcher;
23 | import com.coherentreceiver.analytics.fetcher.ServerStatsFetcher;
24 | import com.coherentreceiver.analytics.helper.decoding.DecoderFactory;
25 | import com.coherentreceiver.analytics.helper.idgenerator.IDGeneratorFactory;
26 | import com.coherentreceiver.analytics.icecastmodel.listclients.Listeners;
27 | import com.coherentreceiver.analytics.icecastmodel.stats.RadioStream;
28 | import com.coherentreceiver.analytics.icecastmodel.stats.ServerStats;
29 | import com.coherentreceiver.analytics.icecastmodel.stats.StreamProperty;
30 | import org.slf4j.LoggerFactory;
31 |
32 | import java.time.LocalDateTime;
33 | import java.util.ArrayList;
34 | import java.util.List;
35 | import java.util.Optional;
36 | import java.util.concurrent.ScheduledFuture;
37 | import java.util.concurrent.TimeUnit;
38 |
39 | /**
40 | *
41 | */
42 | public class InitSynchronous {
43 |
44 | private static final org.slf4j.Logger logger = LoggerFactory.getLogger(InitSynchronous.class);
45 | protected String UNKNOWNTITLE = "NO_TITLE";
46 |
47 | public InitSynchronous (Configuration configuration) {
48 |
49 | GAUpdateTask gaUpdateTask = new GAUpdateTask();
50 |
51 | List servers = configuration.getServers();
52 |
53 | for (Server server : servers) {
54 |
55 | List streamProperties = getStreamProperties(server);
56 |
57 | for (StreamProperty streamProperty : streamProperties) {
58 |
59 |
60 | gaUpdateTask.updateSynchronous(streamProperty);
61 |
62 |
63 | }
64 |
65 |
66 | }
67 |
68 | }
69 |
70 | public List getStreamProperties (Server server) {
71 |
72 | List streamProperties = new ArrayList<>();
73 |
74 | try {
75 |
76 | List mountpointsGAAccounts = server.getMountpointsGAAccounts();
77 | ServerStatsFetcher serverStatsFetcher = new ServerStatsFetcher();
78 |
79 | //get server stats from the server
80 | ServerStats serverStats = serverStatsFetcher.getServerStats(server.getStatsURL(), server.getLogin(), server.getPassword());
81 |
82 | //StreamProperty contains information about the stream, title, gaacccount and number of listeners
83 |
84 |
85 | for (RadioStream radioStream : serverStats.getRadioStreams()) {
86 |
87 | //get the assignment between mountpoints and gaaccounts on this server
88 | String mountPoint = radioStream.getMountPoint(); //get current mountpoint
89 | Optional gaAccount = null; //gaAccount
90 | gaAccount = mountpointsGAAccounts.stream()
91 | .filter(d -> d.getMountPoint().compareTo(mountPoint) == 0)
92 | .findFirst();
93 |
94 | if (gaAccount.isPresent()) {
95 | MountpointsGAAccount mountpointGAAccount = gaAccount.get();
96 | StreamProperty streamProperty = new StreamProperty();
97 | streamProperty.setGaAccount(mountpointGAAccount.getGaAccount());
98 | if (radioStream.getTitle() != null){
99 | streamProperty.setTitle(radioStream.getTitle());}
100 | else streamProperty.setTitle(UNKNOWNTITLE);
101 |
102 | streamProperty.setMountPoint(radioStream.getMountPoint());
103 | streamProperty.setServer(server);
104 | streamProperty.setIdGenerator(IDGeneratorFactory.getIDGenerator(mountpointGAAccount.getUserIdAlgorithm()));
105 | streamProperty.setCharacterDecoder(DecoderFactory.getDecoder(mountpointGAAccount.getCharacterDecoding()));
106 |
107 | streamProperty.setTimeStamp(LocalDateTime.now());
108 |
109 | streamProperties.add(streamProperty);
110 |
111 | } else {
112 | continue;
113 | }
114 |
115 |
116 | }
117 |
118 | } catch (Exception e) {
119 | logger.error(e.getMessage(), e);
120 |
121 | }
122 |
123 | return streamProperties;
124 |
125 | }
126 |
127 |
128 | }
129 |
--------------------------------------------------------------------------------
/src/main/java/com/coherentreceiver/analytics/task/LogListeners.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2017 SWI Kommunikations- und Computer GmbH
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.coherentreceiver.analytics.task;
17 |
18 | import com.coherentreceiver.analytics.configuration.Configuration;
19 | import com.coherentreceiver.analytics.configuration.Configurator;
20 | import org.slf4j.LoggerFactory;
21 |
22 | /**
23 | *
24 | */
25 | public class LogListeners /*extends GAJob*/ implements Runnable {
26 |
27 | private static final org.slf4j.Logger logger = LoggerFactory.getLogger(Configurator.class);
28 |
29 |
30 |
31 | public LogListeners (Configuration configuration){
32 |
33 | //log configuration analysis, how often the logs have to be called
34 |
35 |
36 |
37 | }
38 |
39 | @Override
40 | public void run() {
41 |
42 | //TODO: add log support
43 | logger.debug ("Update Listeners from Log");
44 |
45 |
46 |
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/resources/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 60
4 |
5 | 60
6 |
7 |
8 |
9 |
10 | 1
11 |
12 | http://path_to_your_server:8000/admin/stats
13 |
14 | http://path_to_your_server:8000/admin/listclients?mount=
15 |
16 | login
17 |
18 | password
19 |
20 |
21 |
22 |
23 | /live
24 |
25 | UA-1234-1
26 |
27 | ip
28 |
29 | no
30 |
31 |
32 |
33 |
42 |
43 |
44 |
45 |
61 |
62 |
--------------------------------------------------------------------------------
/src/main/resources/logback-test.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------