Browse Source

Initial commit.

Kledilson Ferreira 9 years ago
commit
43926cb16f
87 changed files with 5353 additions and 0 deletions
  1. 27 0
      .classpath
  2. 36 0
      .project
  3. 4 0
      .settings/org.eclipse.core.resources.prefs
  4. 12 0
      .settings/org.eclipse.jdt.core.prefs
  5. 4 0
      .settings/org.eclipse.m2e.core.prefs
  6. 5 0
      .settings/org.eclipse.wst.common.component
  7. 5 0
      .settings/org.eclipse.wst.common.project.facet.core.xml
  8. 1 0
      .svn/entries
  9. 1 0
      .svn/format
  10. 4 0
      .svn/pristine/07/0775ef37ef7251fb58b3a4c0ed7f8277e911cc42.svn-base
  11. 36 0
      .svn/pristine/09/097e5ec623a7a6e8d801f249084c1039b666cfea.svn-base
  12. 4 0
      .svn/pristine/0d/0d78a989c585aac6e6244dedcef06df92d4ea31b.svn-base
  13. 174 0
      .svn/pristine/1a/1a0ab60de0253ca6e3a1112669127ae163ab4bb5.svn-base
  14. 12 0
      .svn/pristine/1f/1f09e9c3304fb3e7e11077a5ded5b593e678282b.svn-base
  15. 49 0
      .svn/pristine/20/20ddbdef431abe323402f9bcddabff21a804e788.svn-base
  16. 63 0
      .svn/pristine/28/283b37a302815a5f7ff7f5b32372043e02a37062.svn-base
  17. 13 0
      .svn/pristine/29/299fb82ac9f8455c90b52d1fbdffee85a1eafa89.svn-base
  18. 69 0
      .svn/pristine/2a/2a45b32053f9325e9d7008df3f2b096ef330b0da.svn-base
  19. 15 0
      .svn/pristine/3c/3cd6d60b9977d63daf4bec2ad11c79b923e56360.svn-base
  20. 58 0
      .svn/pristine/3e/3eeee200045672e2ee0a5478cdc70ca5c659a991.svn-base
  21. 65 0
      .svn/pristine/45/457fb4f2d42321967c5e675cea3b9d0fd8676340.svn-base
  22. 62 0
      .svn/pristine/46/469eb4b2ae209a84ea58d81a21c264ff5e7e44c3.svn-base
  23. 148 0
      .svn/pristine/49/49465dbfd24d2fdc95c8c1e46ead16765076234e.svn-base
  24. 148 0
      .svn/pristine/4b/4b1188e49c0eb8a59795eaf3dac36b9dd23f1254.svn-base
  25. 130 0
      .svn/pristine/4c/4c53b24772456bbb3521b8907f5e8e1126100cf8.svn-base
  26. 106 0
      .svn/pristine/51/51c029aaec5e3ba21bd67da827d67f6e3fb9f218.svn-base
  27. 5 0
      .svn/pristine/51/51c4dfb689177324a5a9f682d95cb5bd34ac43cb.svn-base
  28. 38 0
      .svn/pristine/5c/5cbea5d29c6e46ad84c91f99f744bfa7bb791a85.svn-base
  29. 5 0
      .svn/pristine/63/636660329aa5fcbe3322e57960730368c8098214.svn-base
  30. 4 0
      .svn/pristine/70/70566e104eda0bf11a87c4d9a26183a9fa3a2ac0.svn-base
  31. 73 0
      .svn/pristine/75/757827c99b9f056791bba7cf5177c27f11ee03c9.svn-base
  32. 12 0
      .svn/pristine/7c/7cccc2ae6521b33e80d57afe222780e509cb4e5d.svn-base
  33. 149 0
      .svn/pristine/7e/7ef660942d5fb53428523f65f9f49a858fe9a8d2.svn-base
  34. 74 0
      .svn/pristine/8f/8f222af039b4d1b8ebe79ad502ce1b5dcb58df26.svn-base
  35. 37 0
      .svn/pristine/9a/9a54e474ac3094ab7489981fad4b48402a1e8a2f.svn-base
  36. 1 0
      .svn/pristine/a3/a3e38064e6709ef785d40fa0352ac3e4abcdbfdc.svn-base
  37. 23 0
      .svn/pristine/ab/aba13e6fe58cefbb25fae5d8dca92c627f3ee9e2.svn-base
  38. 62 0
      .svn/pristine/af/af044efa90a5d32ae6ec97139102ad88cbe9ec16.svn-base
  39. 45 0
      .svn/pristine/b1/b1cfcb08dc5b52a3c56fbdaf64b89527e4a76821.svn-base
  40. BIN
      .svn/pristine/b7/b76ec43187c26c4dfff7fb3c77bf0ff4097f4e11.svn-base
  41. 365 0
      .svn/pristine/b8/b8c15ef50b89dc966683ac941b43562d0c44384e.svn-base
  42. 116 0
      .svn/pristine/bc/bc4aa910d58829c6cad06ea58e7ce258dca2bd71.svn-base
  43. 27 0
      .svn/pristine/bf/bf1ebc9bf29fd3c4d7640c63431f45d4d35108d0.svn-base
  44. 74 0
      .svn/pristine/bf/bfbf215f17f41926c776823d369c2aeb194dd0b6.svn-base
  45. 100 0
      .svn/pristine/c8/c83651cc3980f95fa6829f07b246a9bb5f9e4b1d.svn-base
  46. 149 0
      .svn/pristine/cf/cfe5cbb67fd401f00ff48009d478481939997aee.svn-base
  47. 20 0
      .svn/pristine/d0/d0cbc8d6e435a5c47aba8ff39fb4def0b7d02c58.svn-base
  48. 0 0
      .svn/pristine/da/da39a3ee5e6b4b0d3255bfef95601890afd80709.svn-base
  49. 235 0
      .svn/pristine/e4/e4b7692987bc326bfa0a19d7b41ec6b8ee2616e9.svn-base
  50. 48 0
      .svn/pristine/f2/f2a902e8fb1802aacd230850873b163a8ad75a45.svn-base
  51. 5 0
      .svn/pristine/fd/fd33ecf60f928ee88dc51985355550e2bee35eb2.svn-base
  52. BIN
      .svn/wc.db
  53. 58 0
      pom.xml
  54. 13 0
      src/main/java/com/rdlze/radializebase/App.java
  55. 73 0
      src/main/java/com/rdlze/radializebase/interfaces/InterfaceCollector.java
  56. 74 0
      src/main/java/com/rdlze/radializebase/interfaces/InterfaceCrawlerMaster.java
  57. 69 0
      src/main/java/com/rdlze/radializebase/interfaces/InterfaceCrawlerSlave.java
  58. 130 0
      src/main/java/com/rdlze/radializebase/interfaces/InterfaceIdFinder.java
  59. 74 0
      src/main/java/com/rdlze/radializebase/interfaces/InterfaceMusicBrainzController.java
  60. 20 0
      src/main/java/com/rdlze/radializebase/interfaces/InterfaceNotifiable.java
  61. 45 0
      src/main/java/com/rdlze/radializebase/interfaces/InterfacePlayingNowServer.java
  62. 37 0
      src/main/java/com/rdlze/radializebase/interfaces/InterfaceSearchServer.java
  63. 49 0
      src/main/java/com/rdlze/radializebase/interfaces/MBSearchServerInterface.java
  64. 48 0
      src/main/java/com/rdlze/radializebase/interfaces/MusicBrainzControllerMock.java
  65. 116 0
      src/main/java/com/rdlze/radializebase/interfaces/RemoteRadializeBatchFacade.java
  66. 106 0
      src/main/java/com/rdlze/radializebase/interfaces/RemoteRadializeCacheFacade.java
  67. 174 0
      src/main/java/com/rdlze/radializebase/mocks/MockBroker.java
  68. 62 0
      src/main/java/com/rdlze/radializebase/mocks/MockNotifiable.java
  69. 148 0
      src/main/java/com/rdlze/radializebase/notification/Notifier.java
  70. 63 0
      src/main/java/com/rdlze/radializebase/notification/NotifierObject.java
  71. 15 0
      src/main/java/com/rdlze/radializebase/notification/SearchNotifiable.java
  72. 235 0
      src/main/java/com/rdlze/radializebase/utils/AIRecommendedItem.java
  73. 62 0
      src/main/java/com/rdlze/radializebase/utils/AllFilters.java
  74. 12 0
      src/main/java/com/rdlze/radializebase/utils/FilterBean.java
  75. 365 0
      src/main/java/com/rdlze/radializebase/utils/MathNervous.java
  76. 100 0
      src/main/java/com/rdlze/radializebase/utils/RdlzComponents.java
  77. 149 0
      src/main/java/com/rdlze/radializebase/utils/Utils.java
  78. 38 0
      src/test/java/com/rdlze/radializebase/AppTest.java
  79. 2 0
      target/.gitignore
  80. 5 0
      target/maven-archiver/pom.properties
  81. 0 0
      target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
  82. 24 0
      target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
  83. 0 0
      target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst
  84. 1 0
      target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
  85. BIN
      target/radializebase-0.0.1-SNAPSHOT.jar
  86. 64 0
      target/surefire-reports/TEST-com.rdlze.radializebase.AppTest.xml
  87. 4 0
      target/surefire-reports/com.rdlze.radializebase.AppTest.txt

+ 27 - 0
.classpath

@@ -0,0 +1,27 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<classpath>
3
+	<classpathentry kind="src" output="target/classes" path="src/main/java">
4
+		<attributes>
5
+			<attribute name="optional" value="true"/>
6
+			<attribute name="maven.pomderived" value="true"/>
7
+		</attributes>
8
+	</classpathentry>
9
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java">
10
+		<attributes>
11
+			<attribute name="optional" value="true"/>
12
+			<attribute name="maven.pomderived" value="true"/>
13
+		</attributes>
14
+	</classpathentry>
15
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
16
+		<attributes>
17
+			<attribute name="maven.pomderived" value="true"/>
18
+		</attributes>
19
+	</classpathentry>
20
+	<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
21
+		<attributes>
22
+			<attribute name="maven.pomderived" value="true"/>
23
+			<attribute name="org.eclipse.jst.component.nondependency" value=""/>
24
+		</attributes>
25
+	</classpathentry>
26
+	<classpathentry kind="output" path="target/classes"/>
27
+</classpath>

+ 36 - 0
.project

@@ -0,0 +1,36 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<projectDescription>
3
+	<name>radializebase</name>
4
+	<comment></comment>
5
+	<projects>
6
+	</projects>
7
+	<buildSpec>
8
+		<buildCommand>
9
+			<name>org.eclipse.wst.common.project.facet.core.builder</name>
10
+			<arguments>
11
+			</arguments>
12
+		</buildCommand>
13
+		<buildCommand>
14
+			<name>org.eclipse.jdt.core.javabuilder</name>
15
+			<arguments>
16
+			</arguments>
17
+		</buildCommand>
18
+		<buildCommand>
19
+			<name>org.eclipse.m2e.core.maven2Builder</name>
20
+			<arguments>
21
+			</arguments>
22
+		</buildCommand>
23
+		<buildCommand>
24
+			<name>org.eclipse.wst.validation.validationbuilder</name>
25
+			<arguments>
26
+			</arguments>
27
+		</buildCommand>
28
+	</buildSpec>
29
+	<natures>
30
+		<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
31
+		<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
32
+		<nature>org.eclipse.jdt.core.javanature</nature>
33
+		<nature>org.eclipse.m2e.core.maven2Nature</nature>
34
+		<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
35
+	</natures>
36
+</projectDescription>

+ 4 - 0
.settings/org.eclipse.core.resources.prefs

@@ -0,0 +1,4 @@
1
+eclipse.preferences.version=1
2
+encoding//src/main/java=UTF-8
3
+encoding//src/test/java=UTF-8
4
+encoding/<project>=UTF-8

+ 12 - 0
.settings/org.eclipse.jdt.core.prefs

@@ -0,0 +1,12 @@
1
+eclipse.preferences.version=1
2
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
4
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5
+org.eclipse.jdt.core.compiler.compliance=1.7
6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
8
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
12
+org.eclipse.jdt.core.compiler.source=1.7

+ 4 - 0
.settings/org.eclipse.m2e.core.prefs

@@ -0,0 +1,4 @@
1
+activeProfiles=
2
+eclipse.preferences.version=1
3
+resolveWorkspaceProjects=true
4
+version=1

+ 5 - 0
.settings/org.eclipse.wst.common.component

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
2
+    <wb-module deploy-name="radializebase">
3
+        <wb-resource deploy-path="/" source-path="/src/main/java"/>
4
+    </wb-module>
5
+</project-modules>

+ 5 - 0
.settings/org.eclipse.wst.common.project.facet.core.xml

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<faceted-project>
3
+  <installed facet="java" version="1.7"/>
4
+  <installed facet="jst.utility" version="1.0"/>
5
+</faceted-project>

+ 1 - 0
.svn/entries

@@ -0,0 +1 @@
1
+12

+ 1 - 0
.svn/format

@@ -0,0 +1 @@
1
+12

+ 4 - 0
.svn/pristine/07/0775ef37ef7251fb58b3a4c0ed7f8277e911cc42.svn-base

@@ -0,0 +1,4 @@
1
+activeProfiles=
2
+eclipse.preferences.version=1
3
+resolveWorkspaceProjects=true
4
+version=1

+ 36 - 0
.svn/pristine/09/097e5ec623a7a6e8d801f249084c1039b666cfea.svn-base

@@ -0,0 +1,36 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<projectDescription>
3
+	<name>radializebase</name>
4
+	<comment></comment>
5
+	<projects>
6
+	</projects>
7
+	<buildSpec>
8
+		<buildCommand>
9
+			<name>org.eclipse.wst.common.project.facet.core.builder</name>
10
+			<arguments>
11
+			</arguments>
12
+		</buildCommand>
13
+		<buildCommand>
14
+			<name>org.eclipse.jdt.core.javabuilder</name>
15
+			<arguments>
16
+			</arguments>
17
+		</buildCommand>
18
+		<buildCommand>
19
+			<name>org.eclipse.m2e.core.maven2Builder</name>
20
+			<arguments>
21
+			</arguments>
22
+		</buildCommand>
23
+		<buildCommand>
24
+			<name>org.eclipse.wst.validation.validationbuilder</name>
25
+			<arguments>
26
+			</arguments>
27
+		</buildCommand>
28
+	</buildSpec>
29
+	<natures>
30
+		<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
31
+		<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
32
+		<nature>org.eclipse.jdt.core.javanature</nature>
33
+		<nature>org.eclipse.m2e.core.maven2Nature</nature>
34
+		<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
35
+	</natures>
36
+</projectDescription>

+ 4 - 0
.svn/pristine/0d/0d78a989c585aac6e6244dedcef06df92d4ea31b.svn-base

@@ -0,0 +1,4 @@
1
+eclipse.preferences.version=1
2
+encoding//src/main/java=UTF-8
3
+encoding//src/test/java=UTF-8
4
+encoding/<project>=UTF-8

+ 174 - 0
.svn/pristine/1a/1a0ab60de0253ca6e3a1112669127ae163ab4bb5.svn-base

@@ -0,0 +1,174 @@
1
+package com.rdlze.radializebase.mocks;
2
+
3
+import java.rmi.NotBoundException;
4
+import java.rmi.RemoteException;
5
+import java.rmi.registry.LocateRegistry;
6
+import java.rmi.registry.Registry;
7
+import java.rmi.server.UnicastRemoteObject;
8
+import java.util.ArrayList;
9
+import java.util.List;
10
+import java.util.Queue;
11
+import java.util.concurrent.ConcurrentLinkedQueue;
12
+
13
+import com.rdlze.radializebase.interfaces.InterfaceNotifiable;
14
+import com.rdlze.radializeutils.notification.Notification;
15
+
16
+
17
+public class MockBroker implements InterfaceNotifiable {
18
+	/**
19
+	 * 
20
+	 */
21
+	private static final long serialVersionUID = 1L;
22
+	private static InterfaceNotifiable notifiable;
23
+	private List<InterfaceNotifiable> registeredNotifiables;
24
+	public Queue<Notification> queConc;
25
+	String name = "";
26
+	MockNotifiable mn = null;
27
+	public MockBroker(String name){
28
+		this.name=name;
29
+		queConc = new ConcurrentLinkedQueue<Notification>();
30
+		registeredNotifiables = new ArrayList<InterfaceNotifiable>();
31
+
32
+		NotifierThread not = new NotifierThread(this); // Thread "consumidor"
33
+		not.start();
34
+
35
+		try {
36
+			LocateRegistry.createRegistry(15000);
37
+		} catch (Exception e) {
38
+			System.out.println("createRegistryException....");
39
+		}
40
+
41
+		try {
42
+			InterfaceNotifiable stub = (InterfaceNotifiable) UnicastRemoteObject.exportObject(
43
+					this, 0);
44
+			Registry registry = LocateRegistry.getRegistry(15000);
45
+			registry.rebind(name, stub);
46
+			System.out.println("MockBroker - OnLine");
47
+		} catch (Exception e) {
48
+			e.printStackTrace();
49
+		}
50
+	}
51
+	@Override
52
+	public void notify(Notification notification) throws RemoteException {
53
+		System.out.println(this.getName()+" received notification "+notification.getRadioId());
54
+		queConc.add(notification);
55
+	}
56
+
57
+	@Override
58
+	public void notify(List list) throws RemoteException {
59
+		System.out.println("received list");
60
+		queConc.addAll(list);
61
+	}
62
+
63
+	@Override
64
+	public void registerNotifiable(String IP, String serviceName, int port)
65
+			throws RemoteException {
66
+		try {
67
+			System.out
68
+			.println("COMPONENTE TENTANDO SE REGISTRAR  NO BROKEN     IP = "
69
+					+ IP + "     NAME = " + serviceName);
70
+			Registry registry = LocateRegistry.getRegistry(IP, port);
71
+			notifiable = (InterfaceNotifiable) registry.lookup(serviceName);
72
+			registeredNotifiables.add(notifiable);
73
+			System.out.println("Conectou no  " + notifiable.getName()
74
+					+ " com sucesso");
75
+			System.out.println("COMPONENTE = " + notifiable.getName()
76
+					+ " SE CONECTOU NO BROKEN COM SUCESSO");
77
+		} catch (RemoteException e) {
78
+			e.printStackTrace();
79
+			System.out.println((new StringBuilder("RemoteException")).append(e)
80
+					.toString());
81
+		} catch (NotBoundException e) {
82
+			e.printStackTrace();
83
+			System.out.println((new StringBuilder("NotBoun1dException"))
84
+					.append(e).toString());
85
+		} catch (Exception e) {
86
+			e.printStackTrace();
87
+			System.out.println((new StringBuilder("Exception")).append(e)
88
+					.toString());
89
+		}
90
+	}
91
+
92
+	@Override
93
+	public String getName() throws RemoteException {
94
+		return this.name;
95
+	}
96
+
97
+	public static void main(String[] args){
98
+		new MockNotifiable("teste");
99
+	}
100
+
101
+	private Queue<Notification> getQuee() {
102
+		return this.queConc;
103
+	}
104
+
105
+	public List<InterfaceNotifiable> getRegistersNotifiable() {
106
+		return this.registeredNotifiables;
107
+	}
108
+
109
+	private final class NotifierThread extends Thread {
110
+		MockBroker noticationBroken;
111
+
112
+		public NotifierThread(MockBroker noticationBroken) {
113
+			this.noticationBroken = noticationBroken;
114
+			System.out.println("NotifierThread init...");
115
+		}
116
+
117
+		public void run() {
118
+
119
+			int indexerControllerExceptionCount = 0;
120
+			int streamCrawlerExceptionCount = 0;
121
+			while (true) {
122
+				try {
123
+					if (this.noticationBroken.getQuee().size() > 0) {
124
+						Notification value = null;
125
+						while ((value = (Notification) this.noticationBroken
126
+								.getQuee().poll()) != null) {
127
+							for (int i = this.noticationBroken
128
+									.getRegistersNotifiable().size(); --i >= 0;) {
129
+								try {
130
+									((InterfaceNotifiable) this.noticationBroken
131
+											.getRegistersNotifiable().get(i))
132
+											.notify(value);
133
+								} catch (RemoteException e) {
134
+									InterfaceNotifiable topNot = this.noticationBroken
135
+											.getRegistersNotifiable().get(i);
136
+									if (topNot.getName().equals(
137
+											"IndexerControler"))
138
+										;
139
+									{
140
+										indexerControllerExceptionCount++;
141
+										if (indexerControllerExceptionCount == 10)
142
+											this.noticationBroken
143
+											.getRegistersNotifiable()
144
+											.remove(i);
145
+									}
146
+									if (topNot.getName()
147
+											.equals("StreamCrawler"))
148
+										;
149
+									{
150
+										streamCrawlerExceptionCount++;
151
+										if (streamCrawlerExceptionCount == 10)
152
+											this.noticationBroken
153
+											.getRegistersNotifiable()
154
+											.remove(i);
155
+									}
156
+									System.out.println("Error: "
157
+											+ e.getMessage());
158
+									e.printStackTrace();
159
+								} catch (Exception e) {
160
+									System.out.println(e.getMessage());
161
+								}
162
+							}
163
+						}
164
+					} else
165
+						Thread.sleep(100);
166
+				} catch (Exception e) {
167
+					System.out.println("Error: " + e.getMessage());
168
+					e.printStackTrace();
169
+				}
170
+			}
171
+		}
172
+	}
173
+
174
+}

+ 12 - 0
.svn/pristine/1f/1f09e9c3304fb3e7e11077a5ded5b593e678282b.svn-base

@@ -0,0 +1,12 @@
1
+eclipse.preferences.version=1
2
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
4
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5
+org.eclipse.jdt.core.compiler.compliance=1.7
6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
8
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
12
+org.eclipse.jdt.core.compiler.source=1.7

+ 49 - 0
.svn/pristine/20/20ddbdef431abe323402f9bcddabff21a804e788.svn-base

@@ -0,0 +1,49 @@
1
+package com.rdlze.radializebase.interfaces;
2
+
3
+import java.io.IOException;
4
+import java.io.Serializable;
5
+import java.rmi.Remote;
6
+import java.rmi.RemoteException;
7
+
8
+import org.apache.lucene.queryparser.classic.ParseException;
9
+
10
+/**
11
+ * Class responsible for querying in musicbrainz lucene indexes
12
+ * @author kledilson
13
+ *
14
+ */
15
+public interface MBSearchServerInterface extends Remote, Serializable{
16
+	
17
+	/**
18
+	 * Searches artist and song on musicbrainz lucene indexes
19
+	 * @param search String to be searched
20
+	 * @param index 0 for artist and 1 for song
21
+	 * @param hitsPerPage number of results for the search
22
+	 * @return array of xml with the responses
23
+	 * @throws ParseException
24
+	 * @throws IOException
25
+	 */
26
+	public String[] search(String search, int index, int hitsPerPage) throws ParseException,
27
+	IOException, RemoteException;
28
+	
29
+	/**
30
+	 * Searches for artist and song given and string that may contains artist and song
31
+	 * @param bigTitle String containing artist and song ex: black sabbath paranoid live 1982
32
+	 * @param hitsPerPage number of results for the search
33
+	 * @return array of xml with the responses
34
+	 * @throws RemoteException
35
+	 * @throws ParseException
36
+	 * @throws IOException
37
+	 */
38
+	public String[] searchBigTitle(String bigTitle, int hitsPerPage) throws RemoteException, ParseException, IOException;
39
+	
40
+	/**
41
+	 * Method for registering remotes components
42
+	 * @param remoteObject
43
+	 * @param nameObject
44
+	 * @throws RemoteException
45
+	 */
46
+//	public void registerRemoteObject(Remote remoteObject,
47
+//			String nameObject) throws RemoteException;
48
+	
49
+}

+ 63 - 0
.svn/pristine/28/283b37a302815a5f7ff7f5b32372043e02a37062.svn-base

@@ -0,0 +1,63 @@
1
+package com.rdlze.radializebase.notification;
2
+
3
+
4
+import java.rmi.NotBoundException;
5
+import java.rmi.RemoteException;
6
+import java.rmi.registry.LocateRegistry;
7
+import java.rmi.registry.Registry;
8
+
9
+import com.rdlze.radializebase.interfaces.InterfaceNotifiable;
10
+import com.rdlze.radializebase.interfaces.InterfaceSearchServer;
11
+import com.rdlze.radializeutils.notification.Notification;
12
+
13
+
14
+public class NotifierObject
15
+{
16
+   private static InterfaceNotifiable notifiable;
17
+   private static InterfaceSearchServer interfaceSearcher;
18
+   //private static InterfaceMediaRefreshServer interfaceMediaRefreshServer;
19
+   Registry registry;
20
+	
21
+	public NotifierObject()
22
+	{
23
+	    try
24
+	    {	
25
+	    	//Conecta no Broken
26
+	 	    registry = LocateRegistry.getRegistry("200.239.133.6");
27
+            notifiable = (InterfaceNotifiable)registry.lookup("NotificationBroker");  
28
+            
29
+            //Conecta no SearchServer
30
+            registry = LocateRegistry.getRegistry("200.239.133.206");
31
+    		interfaceSearcher = (InterfaceSearchServer)registry.lookup("SearchServer");	 	
32
+    		 
33
+    		
34
+    		 //Conecta no MediaRefreshServer
35
+            // registry = LocateRegistry.getRegistry("200.239.133.25");
36
+            // interfaceMediaRefreshServer = (InterfaceMediaRefreshServer)registry.lookup("MediaRefreshServer");      
37
+              		
38
+	     }	
39
+         catch(RemoteException e)
40
+         {
41
+            e.printStackTrace();
42
+         }
43
+         catch(NotBoundException e)
44
+         {
45
+             e.printStackTrace();
46
+        }
47
+        catch(Exception e)
48
+        {
49
+    	    e.printStackTrace();
50
+        }	    
51
+   }	
52
+	
53
+	/*public void notifyNewRefreshMedia(int conf) throws RemoteException
54
+	{		
55
+		 interfaceMediaRefreshServer.notifyRefreshIndex(conf);		 
56
+	}	*/
57
+	
58
+	
59
+	public void brokenNotify(Notification  n) throws RemoteException
60
+	{	  		    	
61
+	    notifiable.notify(n);		 
62
+	}
63
+}

+ 13 - 0
.svn/pristine/29/299fb82ac9f8455c90b52d1fbdffee85a1eafa89.svn-base

@@ -0,0 +1,13 @@
1
+package com.rdlze.radializebase;
2
+
3
+/**
4
+ * Hello world!
5
+ *
6
+ */
7
+public class App 
8
+{
9
+    public static void main( String[] args )
10
+    {
11
+        System.out.println( "Hello World!" );
12
+    }
13
+}

+ 69 - 0
.svn/pristine/2a/2a45b32053f9325e9d7008df3f2b096ef330b0da.svn-base

@@ -0,0 +1,69 @@
1
+package com.rdlze.radializebase.interfaces;
2
+
3
+import java.io.Serializable;
4
+import java.rmi.Remote;
5
+import java.rmi.RemoteException;
6
+import java.util.HashSet;
7
+import java.util.List;
8
+
9
+import com.rdlze.radializeutils.objects.Radio;
10
+
11
+public interface InterfaceCrawlerSlave extends Remote, Serializable {
12
+
13
+	public static final int TYPE_MD_CRAWLER = 0;
14
+	public static final int TYPE_MD_BY_STREAM_CRAWLER = 1;
15
+	public static final int TYPE_MD_WITH_JAVA_BY_STREAM_CRAWLER = 2;
16
+	public static final int TYPE_MD_WITH_MPLAYER_BY_STREAM_CRAWLER = 3;
17
+	
18
+	/**
19
+	 * Delivers a radio for the slave to crawl.
20
+	 * @param radio
21
+	 * @throws RemoteException
22
+	 */
23
+	public void notify(Radio radio) throws RemoteException;
24
+
25
+	/**
26
+	 * @return Name of the slave. In most case name is equals to IP.
27
+	 * @throws RemoteException
28
+	 */
29
+	public String getName() throws RemoteException;
30
+
31
+	/**
32
+	 * To check if slave is alive.
33
+	 * @return list of radios being crawled.
34
+	 * @throws RemoteException
35
+	 */
36
+	public List<Integer> ping() throws RemoteException;
37
+
38
+	/** 
39
+	 * @return Actually the max radios the slave is able to crawl.
40
+	 * @throws RemoteException
41
+	 */
42
+	public int getNumCores() throws RemoteException;
43
+	
44
+	/**
45
+	 * Most useful for streamslave, when the master is gonna distribute
46
+	 * radios, and the slave is reconnecting to master, 
47
+	 * having radios already being crawled. So the master will check if more radios are needed
48
+	 * instead of send more.
49
+	 * @return The number of radios being crawled at the moment. 
50
+	 * @throws RemoteException
51
+	 */
52
+	public HashSet<Integer> getCrawlingNow() throws RemoteException;
53
+
54
+	/**
55
+	 * Delivers a list of radios for the slave to crawl.
56
+	 * @param toNotify
57
+	 * @throws RemoteException
58
+	 */
59
+	public void notify(List<Radio> toNotify) throws RemoteException;
60
+
61
+	/**
62
+	 * Defines if the slaves connect only to metadata pages 
63
+	 * or monitor streams to get metadata as soon as they change 
64
+	 * @return
65
+	 * @throws RemoteException
66
+	 */
67
+	public int getCrawlerType() throws RemoteException;
68
+	
69
+}

+ 15 - 0
.svn/pristine/3c/3cd6d60b9977d63daf4bec2ad11c79b923e56360.svn-base

@@ -0,0 +1,15 @@
1
+package com.rdlze.radializebase.notification;
2
+
3
+import java.io.Serializable;
4
+import java.rmi.Remote;
5
+import java.rmi.RemoteException;
6
+
7
+import com.rdlze.radializeutils.objects.RadioStreamingMetadata;
8
+
9
+
10
+public interface SearchNotifiable extends Remote, Serializable
11
+{
12
+    public abstract void searchNotify(RadioStreamingMetadata data, int config) throws RemoteException;
13
+}
14
+
15
+

+ 58 - 0
.svn/pristine/3e/3eeee200045672e2ee0a5478cdc70ca5c659a991.svn-base

@@ -0,0 +1,58 @@
1
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3
+	<modelVersion>4.0.0</modelVersion>
4
+
5
+	<groupId>com.rdlze</groupId>
6
+	<artifactId>radializebase</artifactId>
7
+	<version>0.0.1-SNAPSHOT</version>
8
+	<packaging>jar</packaging>
9
+
10
+	<name>radializebase</name>
11
+	<url></url>
12
+
13
+	<properties>
14
+		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15
+	</properties>
16
+
17
+	<build>
18
+		<plugins>
19
+			<plugin>
20
+				<groupId>org.apache.maven.plugins</groupId>
21
+				<artifactId>maven-compiler-plugin</artifactId>
22
+				<version>3.1</version>
23
+				<configuration>
24
+					<source>1.7</source>
25
+					<target>1.7</target>
26
+				</configuration>
27
+			</plugin>
28
+		</plugins>
29
+	</build>
30
+
31
+	<dependencies>
32
+		<dependency>
33
+			<groupId>junit</groupId>
34
+			<artifactId>junit</artifactId>
35
+			<version>4.11</version>
36
+		</dependency>
37
+		<dependency>
38
+			<groupId>org.apache.lucene</groupId>
39
+			<artifactId>lucene-queryparser</artifactId>
40
+			<version>4.4.0</version>
41
+		</dependency>
42
+		<dependency>
43
+			<groupId>org.apache.mahout</groupId>
44
+			<artifactId>mahout-core</artifactId>
45
+			<version>0.9</version>
46
+		</dependency>
47
+		<dependency>
48
+			<groupId>com.rdlze</groupId>
49
+			<artifactId>radializeutils</artifactId>
50
+			<version>0.0.1-SNAPSHOT</version>
51
+		</dependency>
52
+		<dependency>
53
+			<groupId>com.idealizeframework.irf</groupId>
54
+			<artifactId>irf</artifactId>
55
+			<version>0.0.1-SNAPSHOT</version>
56
+		</dependency>
57
+	</dependencies>
58
+</project>

File diff suppressed because it is too large
+ 65 - 0
.svn/pristine/45/457fb4f2d42321967c5e675cea3b9d0fd8676340.svn-base


+ 62 - 0
.svn/pristine/46/469eb4b2ae209a84ea58d81a21c264ff5e7e44c3.svn-base

@@ -0,0 +1,62 @@
1
+package com.rdlze.radializebase.mocks;
2
+
3
+import java.rmi.RemoteException;
4
+import java.rmi.registry.LocateRegistry;
5
+import java.rmi.registry.Registry;
6
+import java.rmi.server.UnicastRemoteObject;
7
+import java.util.List;
8
+
9
+import com.rdlze.radializebase.interfaces.InterfaceNotifiable;
10
+import com.rdlze.radializeutils.notification.Notification;
11
+
12
+
13
+public class MockNotifiable implements InterfaceNotifiable {
14
+	/**
15
+	 * 
16
+	 */
17
+	private static final long serialVersionUID = 1L;
18
+	String name = "";
19
+	MockNotifiable mn = null;
20
+	public MockNotifiable(String name){
21
+		this.name=name;
22
+		
23
+		try {
24
+			LocateRegistry.createRegistry(1099);
25
+		} catch (Exception e) {
26
+			System.out.println("createRegistryException....");
27
+		}
28
+
29
+		try {
30
+			InterfaceNotifiable stub = (InterfaceNotifiable) UnicastRemoteObject.exportObject(
31
+					this, 0);
32
+			Registry registry = LocateRegistry.getRegistry(1099);
33
+			registry.rebind(name, stub);
34
+			System.out.println("MockNotifiable - OnLine");
35
+		} catch (Exception e) {
36
+			e.printStackTrace();
37
+		}
38
+	}
39
+	@Override
40
+	public void notify(Notification notification) throws RemoteException {
41
+		System.out.println(this.getName()+" received notification "+notification.getRadioId());
42
+	}
43
+
44
+	@Override
45
+	public void notify(List list) throws RemoteException {
46
+		System.out.println("received list");
47
+	}
48
+
49
+	@Override
50
+	public void registerNotifiable(String IP, String serviceName, int port)
51
+			throws RemoteException {
52
+	}
53
+
54
+	@Override
55
+	public String getName() throws RemoteException {
56
+		return this.name;
57
+	}
58
+
59
+	public static void main(String[] args){
60
+		new MockNotifiable("teste");
61
+	}
62
+}

+ 148 - 0
.svn/pristine/49/49465dbfd24d2fdc95c8c1e46ead16765076234e.svn-base

@@ -0,0 +1,148 @@
1
+package com.rdlze.radializebase.notification;
2
+
3
+import java.rmi.NotBoundException;
4
+import java.rmi.RemoteException;
5
+import java.rmi.registry.LocateRegistry;
6
+import java.rmi.registry.Registry;
7
+
8
+import com.rdlze.radializebase.interfaces.InterfaceNotifiable;
9
+import com.rdlze.radializeutils.notification.Notification;
10
+
11
+public final class Notifier {
12
+	private static InterfaceNotifiable notifiable;
13
+	private static InterfaceNotifiable[] notifiables;
14
+	private static boolean[] needReconnect;
15
+	private static boolean severalBrokers = false;
16
+	private static String componentsName;
17
+	private static String[] ips;
18
+	private static NeedForReconnectChecker reconnecter = null;
19
+
20
+	int config;
21
+
22
+	public Notifier() {
23
+	}
24
+
25
+	public static final boolean init(String notificationSubjectIPAddress,
26
+			String notificationSubjectServiceName, int port) {
27
+		try {
28
+
29
+			// Se Registra no BrokenServer
30
+			Registry registry = LocateRegistry
31
+					.getRegistry(notificationSubjectIPAddress, port);
32
+			System.out.println("buggable " + notificationSubjectServiceName
33
+					+ " " + notificationSubjectIPAddress);
34
+			notifiable = (InterfaceNotifiable) registry
35
+					.lookup(notificationSubjectServiceName);
36
+		} catch (RemoteException e) {
37
+			e.printStackTrace();
38
+		} catch (NotBoundException e) {
39
+			e.printStackTrace();
40
+		} catch (Exception e) {
41
+			e.printStackTrace();
42
+		}
43
+		return true;
44
+	}
45
+
46
+	public static final synchronized void notify(Notification n)
47
+			throws RemoteException {
48
+		if(severalBrokers)
49
+			for(int i = 0; i < notifiables.length; i++){
50
+				InterfaceNotifiable iN = notifiables[i];
51
+				try{
52
+					iN.notify(n);
53
+				}catch(Exception e){
54
+					needReconnect[i] = true;
55
+					e.printStackTrace();
56
+				}
57
+			}
58
+		else
59
+			notifiable.notify(n);
60
+	}
61
+
62
+	public static final synchronized void register(String IP, String name, int port)
63
+			throws RemoteException {
64
+		notifiable.registerNotifiable(IP, name, port);
65
+	}
66
+
67
+	/**
68
+	 * Method to connect to several broker to notify.
69
+	 * @param brokerIp Ips separated by comma
70
+	 * @param notificationSubjectServiceName Name of the component which you are connecting to.
71
+	 * @param shallSplitIps True if is connecting to several brokers.
72
+	 */
73
+	public static void init(String brokerIp, String notificationSubjectServiceName, int port,
74
+			boolean shallSplitIps) {
75
+		severalBrokers=true;
76
+		System.out.println("init broker");
77
+		ips = brokerIp.split(",");
78
+		System.out.println("creating notifiables");
79
+		notifiables = new InterfaceNotifiable[ips.length];
80
+
81
+		System.out.println("enter for; split length: "+ ips.length);
82
+		needReconnect = new boolean[ips.length];
83
+		componentsName = notificationSubjectServiceName;
84
+		for(int i = 0 ; i < ips.length; i++){
85
+
86
+			try {
87
+				Thread.sleep(1000);
88
+			} catch (InterruptedException e1) {
89
+				e1.printStackTrace();
90
+			}
91
+			connectTo(notificationSubjectServiceName, i);
92
+		}
93
+
94
+		if(severalBrokers&&reconnecter==null){
95
+			reconnecter = new NeedForReconnectChecker();
96
+			reconnecter.start();
97
+		}
98
+
99
+	}
100
+
101
+	private static void connectTo(String notificationSubjectServiceName, int i) {
102
+		String ip = ips[i].trim();
103
+		try {
104
+			System.out.println("getting broker registry 2 connect" + notificationSubjectServiceName
105
+					+ " " + ip);
106
+			// Se Registra no BrokenServer
107
+			Registry registry = LocateRegistry
108
+					.getRegistry(ip);
109
+
110
+			notifiables[i] = (InterfaceNotifiable) registry
111
+					.lookup(notificationSubjectServiceName);
112
+
113
+			needReconnect[i] = false;
114
+			System.out.println("buggable " + notificationSubjectServiceName
115
+					+ " " + ip);
116
+		} catch (RemoteException e) {
117
+			e.printStackTrace();
118
+		} catch (NotBoundException e) {
119
+			e.printStackTrace();
120
+		} catch (Exception e) {
121
+			e.printStackTrace();
122
+		}
123
+	}
124
+
125
+	private static class NeedForReconnectChecker extends Thread{
126
+
127
+		public NeedForReconnectChecker(){}
128
+
129
+		public void run(){
130
+			while(true){
131
+				try {
132
+					if(needReconnect!=null)
133
+						System.out.println("Checking need for reconnecting...");
134
+					for(int i = 0; i < needReconnect.length; i++){
135
+						if(needReconnect[i]){
136
+							connectTo(componentsName, i);
137
+						}
138
+					}
139
+
140
+					sleep(60000);
141
+				} catch (InterruptedException e) {
142
+					// TODO Auto-generated catch block
143
+					e.printStackTrace();
144
+				}
145
+			}
146
+		}
147
+	}
148
+}

+ 148 - 0
.svn/pristine/4b/4b1188e49c0eb8a59795eaf3dac36b9dd23f1254.svn-base

@@ -0,0 +1,148 @@
1
+package com.rdlze.radializebase.notification;
2
+
3
+import java.rmi.NotBoundException;
4
+import java.rmi.RemoteException;
5
+import java.rmi.registry.LocateRegistry;
6
+import java.rmi.registry.Registry;
7
+
8
+import com.rdlze.radializebase.interfaces.InterfaceNotifiable;
9
+import com.rdlze.radializeutils.notification.Notification;
10
+
11
+public final class Notifier {
12
+	private static InterfaceNotifiable notifiable;
13
+	private static InterfaceNotifiable[] notifiables;
14
+	private static boolean[] needReconnect;
15
+	private static boolean severalBrokers = false;
16
+	private static String componentsName;
17
+	private static String[] ips;
18
+	private static NeedForReconnectChecker reconnecter = null;
19
+
20
+	int config;
21
+
22
+	public Notifier() {
23
+	}
24
+
25
+	public static final boolean init(String notificationSubjectIPAddress,
26
+			String notificationSubjectServiceName, int port) {
27
+		try {
28
+
29
+			// Se Registra no BrokenServer
30
+			Registry registry = LocateRegistry
31
+					.getRegistry(notificationSubjectIPAddress);
32
+			System.out.println("buggable " + notificationSubjectServiceName
33
+					+ " " + notificationSubjectIPAddress);
34
+			notifiable = (InterfaceNotifiable) registry
35
+					.lookup(notificationSubjectServiceName);
36
+		} catch (RemoteException e) {
37
+			e.printStackTrace();
38
+		} catch (NotBoundException e) {
39
+			e.printStackTrace();
40
+		} catch (Exception e) {
41
+			e.printStackTrace();
42
+		}
43
+		return true;
44
+	}
45
+
46
+	public static final synchronized void notify(Notification n)
47
+			throws RemoteException {
48
+		if(severalBrokers)
49
+			for(int i = 0; i < notifiables.length; i++){
50
+				InterfaceNotifiable iN = notifiables[i];
51
+				try{
52
+					iN.notify(n);
53
+				}catch(Exception e){
54
+					needReconnect[i] = true;
55
+					e.printStackTrace();
56
+				}
57
+			}
58
+		else
59
+			notifiable.notify(n);
60
+	}
61
+
62
+	public static final synchronized void register(String IP, String name, int port)
63
+			throws RemoteException {
64
+		notifiable.registerNotifiable(IP, name, port);
65
+	}
66
+
67
+	/**
68
+	 * Method to connect to several broker to notify.
69
+	 * @param brokerIp Ips separated by comma
70
+	 * @param notificationSubjectServiceName Name of the component which you are connecting to.
71
+	 * @param shallSplitIps True if is connecting to several brokers.
72
+	 */
73
+	public static void init(String brokerIp, String notificationSubjectServiceName, int port,
74
+			boolean shallSplitIps) {
75
+		severalBrokers=true;
76
+		System.out.println("init broker");
77
+		ips = brokerIp.split(",");
78
+		System.out.println("creating notifiables");
79
+		notifiables = new InterfaceNotifiable[ips.length];
80
+
81
+		System.out.println("enter for; split length: "+ ips.length);
82
+		needReconnect = new boolean[ips.length];
83
+		componentsName = notificationSubjectServiceName;
84
+		for(int i = 0 ; i < ips.length; i++){
85
+
86
+			try {
87
+				Thread.sleep(1000);
88
+			} catch (InterruptedException e1) {
89
+				e1.printStackTrace();
90
+			}
91
+			connectTo(notificationSubjectServiceName, i);
92
+		}
93
+
94
+		if(severalBrokers&&reconnecter==null){
95
+			reconnecter = new NeedForReconnectChecker();
96
+			reconnecter.start();
97
+		}
98
+
99
+	}
100
+
101
+	private static void connectTo(String notificationSubjectServiceName, int i) {
102
+		String ip = ips[i].trim();
103
+		try {
104
+			System.out.println("getting broker registry 2 connect" + notificationSubjectServiceName
105
+					+ " " + ip);
106
+			// Se Registra no BrokenServer
107
+			Registry registry = LocateRegistry
108
+					.getRegistry(ip);
109
+
110
+			notifiables[i] = (InterfaceNotifiable) registry
111
+					.lookup(notificationSubjectServiceName);
112
+
113
+			needReconnect[i] = false;
114
+			System.out.println("buggable " + notificationSubjectServiceName
115
+					+ " " + ip);
116
+		} catch (RemoteException e) {
117
+			e.printStackTrace();
118
+		} catch (NotBoundException e) {
119
+			e.printStackTrace();
120
+		} catch (Exception e) {
121
+			e.printStackTrace();
122
+		}
123
+	}
124
+
125
+	private static class NeedForReconnectChecker extends Thread{
126
+
127
+		public NeedForReconnectChecker(){}
128
+
129
+		public void run(){
130
+			while(true){
131
+				try {
132
+					if(needReconnect!=null)
133
+						System.out.println("Checking need for reconnecting...");
134
+					for(int i = 0; i < needReconnect.length; i++){
135
+						if(needReconnect[i]){
136
+							connectTo(componentsName, i);
137
+						}
138
+					}
139
+
140
+					sleep(60000);
141
+				} catch (InterruptedException e) {
142
+					// TODO Auto-generated catch block
143
+					e.printStackTrace();
144
+				}
145
+			}
146
+		}
147
+	}
148
+}

+ 130 - 0
.svn/pristine/4c/4c53b24772456bbb3521b8907f5e8e1126100cf8.svn-base

@@ -0,0 +1,130 @@
1
+package com.rdlze.radializebase.interfaces;
2
+
3
+import java.io.Serializable;
4
+import java.rmi.Remote;
5
+import java.rmi.RemoteException;
6
+
7
+import com.rdlze.radializeutils.objects.BigTitleResp;
8
+import com.rdlze.radializeutils.objects.IndexResponse;
9
+
10
+
11
+/**
12
+ * Remote Interface
13
+ * @author stiilpen
14
+ *
15
+ */
16
+public interface InterfaceIdFinder extends Remote, Serializable {
17
+	/**
18
+	 * Colector search method
19
+	 * @param artist name
20
+	 * @param music name
21
+	 * @return IndexResponse with idMedia,idArtist, idMusic. if one of these ids doesn't exists, returns -1, respectively.
22
+	 */
23
+	public IndexResponse search(String artist, String music) throws RemoteException;
24
+	
25
+	/**
26
+	 * MBHttp makes search slow, so it parameter useMBHttp shall be false for
27
+	 * search server and update server.
28
+	 * @param artist
29
+	 * @param music
30
+	 * @param useMBHTTP
31
+	 * @return
32
+	 * @throws RemoteException
33
+	 */
34
+	public IndexResponse search(String artist, String music, boolean useMBHTTP) throws RemoteException;
35
+	
36
+	/**
37
+	 * User search for music id
38
+	 * @param music
39
+	 * @return musicId if found, -1 if not.
40
+	 */
41
+	public int searchMusic(String music) throws RemoteException;
42
+	
43
+	
44
+	/**
45
+	 * User search for artist id
46
+	 * @param artist
47
+	 * @return artistId if found, -1 if not.
48
+	 */
49
+	public int searchArtist(String artist) throws RemoteException;
50
+	
51
+	/**
52
+	 * User search for artist id by artist alias
53
+	 * @param artist
54
+	 * @return artistId if found, -1 if not.
55
+	 */
56
+	public int searchArtistAlias(String artist) throws RemoteException;
57
+	
58
+	/**
59
+	 * User search for genre id by genre name
60
+	 * @param artist
61
+	 * @return artistId if found, -1 if not.
62
+	 */
63
+	public int searchGenres(String genre) throws RemoteException;
64
+	
65
+	/**
66
+	 * Method to search radio and return the most compatible id
67
+	 * @param radio
68
+	 * @return
69
+	 */
70
+	public int searchRadio(String radio) throws RemoteException;
71
+	
72
+	/**
73
+	 * Method to search tag and return the most compatible id
74
+	 * @param tag name
75
+	 * @return
76
+	 */
77
+	public int searchTags(String tags) throws RemoteException;
78
+	
79
+	/**
80
+	 * UPDATE INSTANCE: Insert Media Index
81
+	 * @param name
82
+	 * @param idMedia
83
+	 * @param idArtist
84
+	 * @param idMusic
85
+	 * @return true if enqueued, false if not.
86
+	 */
87
+	public boolean insertMedia(String name, int idMedia, int idArtist, int idMusic, String mbidArtist, String mbidMusic) throws RemoteException;
88
+	/**
89
+	 * UPDATE INSTANCE: Insert Artist Index
90
+	 * @param name
91
+	 * @param idArtist
92
+	 * @return true if enqueued, false if not.
93
+	 */
94
+	public boolean insertArtist(String name, int idArtist, String mbidArtist) throws RemoteException;
95
+	/**
96
+	 * UPDATE INSTANCE: Insert Music Index
97
+	 * @param name
98
+	 * @param idMusic
99
+	 * @return true if enqueued, false if not.
100
+	 */
101
+	public boolean insertMusic(String name, int idMusic, int artistId, String mbidMusic) throws RemoteException;
102
+	
103
+	/**
104
+	 * Searches artist and song contained in a single String
105
+	 * @param bigTitle
106
+	 * @param numResultsToBeAnalysed
107
+	 * @param shallContainResp the entry bigtitle MUST contain artist and song found on mb search. 
108
+	 * @return 
109
+	 * @throws RemoteException
110
+	 */
111
+	public BigTitleResp searchBigTitle(String bigTitle, int numResultsToBeAnalysed, boolean shallContainResp) throws RemoteException;
112
+
113
+	/**
114
+	 * Checks if the id finder is checking the differences between indexes and tables, so is shall not notified, and index the differences. 
115
+	 * if any new content is inserted, the update server can do the defensive search and assure it will not insert any duplicates.
116
+	 * @return
117
+	 * @throws RemoteException
118
+	 * @throws Exception
119
+	 */
120
+	public Boolean isSynching() throws RemoteException, Exception;
121
+
122
+	/**
123
+	 * Allows the update server to request the idfinder to check differences between indexes and tables
124
+	 * @throws RemoteException
125
+	 */
126
+	public void SynchonizeTableAndIndexes() throws RemoteException;
127
+	
128
+	public int getUpdaterQueueSize() throws RemoteException;
129
+	
130
+}

+ 106 - 0
.svn/pristine/51/51c029aaec5e3ba21bd67da827d67f6e3fb9f218.svn-base

@@ -0,0 +1,106 @@
1
+package com.rdlze.radializebase.interfaces;
2
+
3
+import java.rmi.RemoteException;
4
+import java.util.List;
5
+
6
+import com.idealizeframework.irf.base.facade.RemoteFacade;
7
+import com.rdlze.radializebase.utils.AIRecommendedItem;
8
+import com.rdlze.radializebase.utils.FilterBean;
9
+
10
+/**
11
+ * 
12
+ * @author Alex Amorim Dutra
13
+ * 
14
+ */
15
+public interface RemoteRadializeCacheFacade extends RemoteFacade {
16
+
17
+	// search by artist
18
+	// 1
19
+	public List<AIRecommendedItem> searchByArtistReturnArtists(long userId,
20
+			List<Integer> artistsIds, int howMany, FilterBean filters) throws RemoteException;
21
+
22
+	// 2
23
+	public List<AIRecommendedItem> searchByArtistReturnSongs(long userId,
24
+			List<Integer> artistsIds, int howMany, FilterBean filters) throws RemoteException;
25
+
26
+	// 3
27
+	public List<AIRecommendedItem> searchByArtistReturnRadios(long userId,
28
+			List<Integer> artistsIds, int howMany, FilterBean filters) throws RemoteException;
29
+
30
+	// 4
31
+	public List<AIRecommendedItem> searchByArtistReturnTags(long userId,
32
+			List<Integer> artistsIds, int howMany, FilterBean filters) throws RemoteException;
33
+
34
+	// search by song
35
+	// 5
36
+	public List<AIRecommendedItem> searchBySongReturnArtists(long userId,
37
+			List<Integer> songsIds, int howMany, FilterBean filters) throws RemoteException;
38
+
39
+	// 6
40
+	public List<AIRecommendedItem> searchBySongReturnSongs(long userId,
41
+			List<Integer> songsIds, int howMany, FilterBean filters) throws RemoteException;
42
+
43
+	// 7
44
+	public List<AIRecommendedItem> searchBySongReturnRadios(long userId,
45
+			List<Integer> songsIds, int howMany, FilterBean filters) throws RemoteException;
46
+
47
+	// 8
48
+	public List<AIRecommendedItem> searchBySongReturnTags(long userId,
49
+			List<Integer> songsIds, int howMany, FilterBean filters) throws RemoteException;
50
+
51
+	// search by radio
52
+	// 9
53
+	public List<AIRecommendedItem> searchByRadioReturnArtists(long userId,
54
+			List<Integer> radiosIds, int howMany, FilterBean filters) throws RemoteException;
55
+
56
+	// 10
57
+	public List<AIRecommendedItem> searchByRadioReturnSongs(long userId,
58
+			List<Integer> radiosIds, int howMany, FilterBean filters) throws RemoteException;
59
+
60
+	// 11
61
+	public List<AIRecommendedItem> searchByRadioReturnRadios(long userId,
62
+			List<Integer> radiosIds, int howMany, FilterBean filters) throws RemoteException;
63
+
64
+	// 12
65
+	public List<AIRecommendedItem> searchByRadioReturnTags(long userId,
66
+			List<Integer> radiosIds, int howMany, FilterBean filters) throws RemoteException;
67
+
68
+	// search by tag
69
+	// 13
70
+	public List<AIRecommendedItem> searchByTagReturnArtists(long userId,
71
+			List<Integer> tagsIds, int howMany, FilterBean filters) throws RemoteException;
72
+
73
+	// 14
74
+	public List<AIRecommendedItem> searchByTagReturnSongs(long userId,
75
+			List<Integer> tagsIds, int howMany, FilterBean filters) throws RemoteException;
76
+
77
+	// 15
78
+	public List<AIRecommendedItem> searchByTagReturnRadios(long userId,
79
+			List<Integer> tagsIds, int howMany, FilterBean filters) throws RemoteException;
80
+
81
+	// 16
82
+	public List<AIRecommendedItem> searchByTagReturnTags(long userId,
83
+			List<Integer> tagsIds, int howMany,FilterBean filters) throws RemoteException;
84
+
85
+	// get recommendations
86
+	// 17
87
+	public List<AIRecommendedItem> getRecommendationsArtists(long userId,
88
+			int howMany, List<Integer> momentsIds, FilterBean filters) throws RemoteException;
89
+
90
+	// 18
91
+	public List<AIRecommendedItem> getRecommendationsSongs(long userId,
92
+			int howMany, List<Integer> momentsIds, FilterBean filters) throws RemoteException;
93
+
94
+	// 19
95
+	public List<AIRecommendedItem> getRecommendationsRadios(long userId,
96
+			int howMany, List<Integer> momentsIds, FilterBean filters) throws RemoteException;
97
+
98
+	// 20
99
+	public List<AIRecommendedItem> getRecommendationsTags(long userId,
100
+			int howMany, List<Integer> momentsIds, FilterBean filters) throws RemoteException;
101
+
102
+	// 21
103
+	public List<AIRecommendedItem> getRecommendationsFriends(long userId,
104
+			int howMany, List<Integer> momentsIds, FilterBean filters) throws RemoteException;
105
+
106
+}

+ 5 - 0
.svn/pristine/51/51c4dfb689177324a5a9f682d95cb5bd34ac43cb.svn-base

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<faceted-project>
3
+  <installed facet="java" version="1.7"/>
4
+  <installed facet="jst.utility" version="1.0"/>
5
+</faceted-project>

+ 38 - 0
.svn/pristine/5c/5cbea5d29c6e46ad84c91f99f744bfa7bb791a85.svn-base

@@ -0,0 +1,38 @@
1
+package com.rdlze.radializebase;
2
+
3
+import junit.framework.Test;
4
+import junit.framework.TestCase;
5
+import junit.framework.TestSuite;
6
+
7
+/**
8
+ * Unit test for simple App.
9
+ */
10
+public class AppTest 
11
+    extends TestCase
12
+{
13
+    /**
14
+     * Create the test case
15
+     *
16
+     * @param testName name of the test case
17
+     */
18
+    public AppTest( String testName )
19
+    {
20
+        super( testName );
21
+    }
22
+
23
+    /**
24
+     * @return the suite of tests being tested
25
+     */
26
+    public static Test suite()
27
+    {
28
+        return new TestSuite( AppTest.class );
29
+    }
30
+
31
+    /**
32
+     * Rigourous Test :-)
33
+     */
34
+    public void testApp()
35
+    {
36
+        assertTrue( true );
37
+    }
38
+}

+ 5 - 0
.svn/pristine/63/636660329aa5fcbe3322e57960730368c8098214.svn-base

@@ -0,0 +1,5 @@
1
+#Generated by Maven
2
+#Fri May 09 14:51:20 BRT 2014
3
+version=0.0.1-SNAPSHOT
4
+groupId=com.rdlze
5
+artifactId=radializebase

+ 4 - 0
.svn/pristine/70/70566e104eda0bf11a87c4d9a26183a9fa3a2ac0.svn-base

@@ -0,0 +1,4 @@
1
+-------------------------------------------------------------------------------
2
+Test set: com.rdlze.radializebase.AppTest
3
+-------------------------------------------------------------------------------
4
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.064 sec

+ 73 - 0
.svn/pristine/75/757827c99b9f056791bba7cf5177c27f11ee03c9.svn-base

@@ -0,0 +1,73 @@
1
+package com.rdlze.radializebase.interfaces;
2
+
3
+import java.sql.SQLException;
4
+import java.sql.Timestamp;
5
+import java.text.ParseException;
6
+import java.util.concurrent.ConcurrentLinkedQueue;
7
+
8
+import com.rdlze.radializeutils.objects.MusicInfo;
9
+import com.rdlze.radializeutils.objects.RadioStreamingMetadata;
10
+import com.rdlze.radializeutils.objects.UpdateThreadBean;
11
+
12
+public interface InterfaceCollector {
13
+
14
+	public int returnRadioIdFromRadioList10(int radioIdList10)
15
+			throws SQLException;
16
+
17
+	public String returnArtistName(int artistId) throws SQLException;
18
+
19
+	public abstract int checkArtist(String artistName) throws SQLException;
20
+
21
+	public MusicInfo returnSongInfoFromList10(int songIdList10)
22
+			throws SQLException;
23
+
24
+	public abstract int checkSong(String songName, int artistId)
25
+			throws SQLException;
26
+
27
+	public abstract int checkMedia(String media, int artistId, int songId)
28
+			throws SQLException;
29
+
30
+	public abstract int insertArtist(String artistName,
31
+			String artistMusicBrainzId) throws SQLException;
32
+
33
+	public abstract int insertSong(int i, String s, String musicBrainzSongId)
34
+			throws SQLException;
35
+
36
+	public abstract int insertMedia(String name, int artistId, int songId,
37
+			String musicBrainzArtistId, String musicBrainzSongId)
38
+			throws Exception;
39
+
40
+	public abstract void rejectMedia(UpdateThreadBean b) throws SQLException;
41
+
42
+	// public abstract boolean checkPlayNow(int i, int j, int k) throws
43
+	// SQLException;
44
+	// public abstract boolean checkRadioPlayNow(int i) throws SQLException;
45
+	// public abstract void updatePlayNow(int i, int j, int k, String s, String
46
+	// s1)throws SQLException;
47
+	// public abstract void insertPlayNow(int i, int j, int k, String s, String
48
+	// s1) throws SQLException;
49
+
50
+	public abstract void saveCollect(
51
+			RadioStreamingMetadata radiostreamingmetadata) throws SQLException,
52
+			ParseException;
53
+
54
+	// public abstract void deletePlayNow(int idRadio) throws SQLException;
55
+	public abstract boolean insertMediaFile(int songId, int mediaSource,
56
+			int providerId, String name, String path) throws SQLException;
57
+
58
+	public abstract boolean recommendSongForEvent(int songId, int eventId,
59
+			int momentId, int userId, Timestamp timeToPlay) throws SQLException;
60
+
61
+	public abstract boolean checkIfMediaFileHasBeenAlreadyInserted(int songId,
62
+			int mediaSource, int providerId) throws SQLException;
63
+
64
+	public abstract Integer[] insertSongAndMedia(int artistId, String songName,
65
+			String musicBrainzSongId, String media, String musicBrainzArtistId,
66
+			boolean production) throws SQLException;
67
+
68
+	public abstract Integer[] insertArtistSongAndMedia(String artistName,
69
+			String songName, String musicBrainzSongId, String mediaName,
70
+			String artistIdMusicBrainz, boolean production) throws SQLException;
71
+
72
+	public void saveCollect(ConcurrentLinkedQueue<RadioStreamingMetadata> rsms) throws SQLException, ClassNotFoundException;
73
+}

+ 12 - 0
.svn/pristine/7c/7cccc2ae6521b33e80d57afe222780e509cb4e5d.svn-base

@@ -0,0 +1,12 @@
1
+package com.rdlze.radializebase.utils;
2
+
3
+import java.io.Serializable;
4
+
5
+public abstract class FilterBean implements Serializable{
6
+
7
+	/**
8
+	 * Default serial version.
9
+	 */
10
+	private static final long serialVersionUID = 1L;
11
+
12
+}

+ 149 - 0
.svn/pristine/7e/7ef660942d5fb53428523f65f9f49a858fe9a8d2.svn-base

@@ -0,0 +1,149 @@
1
+package com.rdlze.radializebase.utils;
2
+
3
+import java.rmi.Remote;
4
+import java.rmi.RemoteException;
5
+import java.rmi.registry.LocateRegistry;
6
+import java.rmi.registry.Registry;
7
+import java.rmi.server.UnicastRemoteObject;
8
+import java.sql.Timestamp;
9
+
10
+import com.idealizeframework.irf.base.exceptions.IdealizeUnavailableResourceException;
11
+
12
+public class Utils {
13
+
14
+	public static Timestamp getNowDate() {
15
+		return new Timestamp(System.currentTimeMillis());
16
+	}
17
+
18
+	/**
19
+	 * Makes the object remotely available.
20
+	 * 
21
+	 * @param remoteObject
22
+	 * @param nameObject
23
+	 * @throws IdealizeUnavailableResourceException
24
+	 */
25
+	public static Remote registerRemoteObject(Remote remoteObject,
26
+			String nameObject, int port) {
27
+
28
+		try {
29
+			try {
30
+				LocateRegistry.createRegistry(port);
31
+				// System.out.println("Criou o RMI............................................................................................");
32
+			} catch (Exception e) {
33
+				System.out.println("A porta do RMI ja esta sendo utilizada?!");
34
+			}
35
+			Remote stub;
36
+			Registry registry = LocateRegistry.getRegistry(port);
37
+
38
+			stub = UnicastRemoteObject.exportObject(remoteObject, port);
39
+			System.out.println("Name Obj " + nameObject);
40
+			registry.rebind(nameObject, stub);
41
+			System.out.println("REGISTROU OBJETO " + nameObject
42
+					+ " REMOTAMENTE NA PORTA "+port);
43
+
44
+			return stub;
45
+		} catch (RemoteException e) {
46
+			e.printStackTrace();
47
+		}
48
+		return remoteObject;
49
+	}
50
+
51
+	/**
52
+	 * Makes the object remotely available.
53
+	 * 
54
+	 * @param remoteObject
55
+	 * @param nameObject
56
+	 * @throws IdealizeUnavailableResourceException
57
+	 */
58
+	public static Remote registerRemoteObjectUseRandom(Remote remoteObject,
59
+			String nameObject, int port) {
60
+
61
+		try {
62
+			try {
63
+				LocateRegistry.createRegistry(port);
64
+				// System.out.println("Criou o RMI............................................................................................");
65
+			} catch (Exception e) {
66
+				System.out.println("A porta do RMI ja esta sendo utilizada?!");
67
+			}
68
+			Remote stub;
69
+			Registry registry = LocateRegistry.getRegistry(port);
70
+
71
+			stub = UnicastRemoteObject.exportObject(remoteObject, 0);
72
+			System.out.println("Name Obj " + nameObject);
73
+			registry.rebind(nameObject, stub);
74
+			System.out.println("REGISTROU OBJETO " + nameObject
75
+					+ " REMOTAMENTE.");
76
+
77
+			return stub;
78
+		} catch (RemoteException e) {
79
+			e.printStackTrace();
80
+		}
81
+		return remoteObject;
82
+	}
83
+
84
+	public static Remote getRemoteObject(String ipObject, String nameObject,
85
+			int port) {
86
+
87
+		Remote remote = null;
88
+		try {
89
+			Registry registry = LocateRegistry.getRegistry(ipObject, port);
90
+			remote = registry.lookup(nameObject);
91
+			if (remote == null) {
92
+				System.out.println("NÃO PEGOU O OBJETO " + nameObject
93
+						+ " REMOTAMENTE. O OBJETO ESTÁ NULO. IP: " + ipObject
94
+						+ " NAME: " + nameObject + " PORTA: " + port);
95
+
96
+			} else {
97
+				System.out.println("PEGOU O OBJETO " + nameObject
98
+						+ " REMOTAMENTE.");
99
+			}
100
+		} catch (Exception e) {
101
+			e.printStackTrace();
102
+			System.err
103
+					.println("Could not possible get remote object: nameObject: "
104
+							+ nameObject + " IP Object: " + ipObject);
105
+			remote = null;
106
+		}
107
+		return remote;
108
+	}
109
+
110
+	/**
111
+	 * Makes the object remotely available.
112
+	 * 
113
+	 * @param remoteObject
114
+	 * @param nameObject
115
+	 * @param host
116
+	 * @throws IdealizeUnavailableResourceException
117
+	 */
118
+	public static Remote registerRemoteObject(Remote remoteObject,
119
+			String nameObject, String host, int port) {
120
+
121
+		try {
122
+			try {
123
+				LocateRegistry.createRegistry(port);
124
+				// System.out.println("Criou o RMI............................................................................................");
125
+			} catch (Exception e) {
126
+				System.out.println("A porta do RMI ja esta sendo utilizada?!");
127
+			}
128
+			Remote stub;
129
+			Registry registry = LocateRegistry.getRegistry(host, port);
130
+
131
+			stub = UnicastRemoteObject.exportObject(remoteObject, port);
132
+			System.out.println("Name Obj " + nameObject);
133
+			registry.rebind(nameObject, stub);
134
+			System.out.println("REGISTROU OBJETO " + nameObject
135
+					+ " REMOTAMENTE.");
136
+
137
+			return stub;
138
+		} catch (RemoteException e) {
139
+			e.printStackTrace();
140
+		}
141
+		return remoteObject;
142
+	}
143
+
144
+	public String escapeUnicode(String name) {
145
+		name = name.replaceAll("'", "''");
146
+		name = name.replaceAll("\\", "'\\");
147
+		return name;
148
+	}
149
+}

+ 74 - 0
.svn/pristine/8f/8f222af039b4d1b8ebe79ad502ce1b5dcb58df26.svn-base

@@ -0,0 +1,74 @@
1
+package com.rdlze.radializebase.interfaces;
2
+
3
+import java.io.IOException;
4
+
5
+import javax.xml.parsers.ParserConfigurationException;
6
+
7
+import org.apache.lucene.queryparser.classic.ParseException;
8
+import org.xml.sax.SAXException;
9
+
10
+import com.rdlze.radializeutils.objects.BigTitleResp;
11
+import com.rdlze.radializeutils.objects.MBResp;
12
+
13
+
14
+
15
+public interface InterfaceMusicBrainzController {
16
+
17
+	/**
18
+	 * This method searches in music brainz server RMI using the bigTitle
19
+	 * @param bigTitle 
20
+	 * @param nGramSize 
21
+	 * @param mbssi . The Music Brainz Interface RMI
22
+	 * @param numResults
23
+	 * @return
24
+	 * @throws IOException
25
+	 * @throws ParseException
26
+	 * @see BigTitleResp
27
+	 * 
28
+	 */
29
+	public BigTitleResp searchBigTitle(String bigTitle, int nGramSize,  int numResults, boolean shallContainResp) throws  IOException, ParseException;
30
+	
31
+	/**
32
+	 * 
33
+	 * @param bigTitle
34
+	 * @param nGramSize
35
+	 * @return
36
+	 * @throws IOException
37
+	 * @throws ParserConfigurationException
38
+	 * @throws SAXException
39
+	 * @throws InterruptedException
40
+	 */
41
+	
42
+	public MBResp searchBigTitle(String bigTitle, int nGramSize) throws IOException, ParserConfigurationException, SAXException, InterruptedException;
43
+	
44
+	/**This Function searches in music brainz http server the artist and song
45
+
46
+	 * @param artist The artist name to be search
47
+	 * @param song The song name to be search
48
+	 * @param proximitySearch Defines the algorithm to be used, if this value is true, It's acceptable not exactly words
49
+	 * .if this value is false, searches by exactly word 
50
+	 * @param limit The limit of results in music brainz query
51
+	 * @param offset 
52
+	 * @param hostMB  The music brainz host. Default www.radialize.com.br:5000
53
+	 * @return
54
+	 * @throws ParserConfigurationException
55
+	 * @throws SAXException
56
+	 * @throws IOException
57
+	 * @throws InterruptedException
58
+	 * @see MBResp
59
+	 */
60
+	public MBResp searchArtSong(String artist, String song, boolean proximitySearch, int limit, int offset, String hostMB) throws ParserConfigurationException, SAXException, IOException, InterruptedException;
61
+	
62
+	/***
63
+	 * 
64
+	 * @param artist
65
+	 * @param song
66
+	 * @param proximitySearch
67
+	 * @param limit
68
+	 * @param mbssi
69
+	 * @return
70
+	 * @throws ParseException
71
+	 * @throws IOException
72
+	 */
73
+	public MBResp searchArtSong(String artist, String song, boolean proximitySearch, int limit) throws ParseException, IOException;
74
+}

+ 37 - 0
.svn/pristine/9a/9a54e474ac3094ab7489981fad4b48402a1e8a2f.svn-base

@@ -0,0 +1,37 @@
1
+package com.rdlze.radializebase.interfaces;
2
+
3
+import java.io.Serializable;
4
+import java.rmi.Remote;
5
+import java.rmi.RemoteException;
6
+import java.util.List;
7
+
8
+import com.rdlze.radializeutils.objects.IndexResponse;
9
+import com.rdlze.radializeutils.objects.SearchBean;
10
+
11
+public interface InterfaceSearchServer extends Remote, Serializable
12
+{
13
+	
14
+	/***
15
+	 * This is the user search. You can search song, artist, genre or radio in database.
16
+	 * @param bean. The bean contains the information about what will search. 
17
+	 * There are two standard parameters, text and type.
18
+	 * Text is the word will search, type is the kind of search{ 0 - All, 1 - Artist, 2 - Song, 3 - Genre, 4 - Radio}
19
+	 * @return IndexResponse
20
+	 * @throws RemoteException
21
+	 * @see {@link SearchBean, IndexResponse}
22
+	 */
23
+	public IndexResponse search(SearchBean bean)throws RemoteException;
24
+	
25
+	
26
+	
27
+	/**
28
+	 * This method get The auto complete set for user.
29
+	 * @param text. Partial text to get auto complete, this text has to have the size bigger than 2
30
+	 * @param quantity. The size of return.
31
+	 * @return List<IndexResponse>
32
+	 * @throws RemoteException 
33
+	 * @see {@link IndexResponse}
34
+	 */
35
+	public List<IndexResponse> autocomplete(String text , int quantity)throws RemoteException;
36
+}
37
+

+ 1 - 0
.svn/pristine/a3/a3e38064e6709ef785d40fa0352ac3e4abcdbfdc.svn-base

@@ -0,0 +1 @@
1
+D:\Workspaces\WokspaceRadialize\radializebase\src\test\java\com\rdlze\radializebase\AppTest.java

+ 23 - 0
.svn/pristine/ab/aba13e6fe58cefbb25fae5d8dca92c627f3ee9e2.svn-base

@@ -0,0 +1,23 @@
1
+D:\Workspaces\WokspaceRadialize\radializebase\src\main\java\com\rdlze\radializebase\notification\SearchNotifiable.java
2
+D:\Workspaces\WokspaceRadialize\radializebase\src\main\java\com\rdlze\radializebase\interfaces\RemoteRadializeBatchFacade.java
3
+D:\Workspaces\WokspaceRadialize\radializebase\src\main\java\com\rdlze\radializebase\interfaces\MusicBrainzControllerMock.java
4
+D:\Workspaces\WokspaceRadialize\radializebase\src\main\java\com\rdlze\radializebase\interfaces\MBSearchServerInterface.java
5
+D:\Workspaces\WokspaceRadialize\radializebase\src\main\java\com\rdlze\radializebase\interfaces\InterfaceNotifiable.java
6
+D:\Workspaces\WokspaceRadialize\radializebase\src\main\java\com\rdlze\radializebase\utils\RdlzComponents.java
7
+D:\Workspaces\WokspaceRadialize\radializebase\src\main\java\com\rdlze\radializebase\interfaces\InterfaceMusicBrainzController.java
8
+D:\Workspaces\WokspaceRadialize\radializebase\src\main\java\com\rdlze\radializebase\interfaces\InterfaceSearchServer.java
9
+D:\Workspaces\WokspaceRadialize\radializebase\src\main\java\com\rdlze\radializebase\interfaces\InterfaceCrawlerMaster.java
10
+D:\Workspaces\WokspaceRadialize\radializebase\src\main\java\com\rdlze\radializebase\App.java
11
+D:\Workspaces\WokspaceRadialize\radializebase\src\main\java\com\rdlze\radializebase\mocks\MockNotifiable.java
12
+D:\Workspaces\WokspaceRadialize\radializebase\src\main\java\com\rdlze\radializebase\interfaces\InterfaceCollector.java
13
+D:\Workspaces\WokspaceRadialize\radializebase\src\main\java\com\rdlze\radializebase\utils\AIRecommendedItem.java
14
+D:\Workspaces\WokspaceRadialize\radializebase\src\main\java\com\rdlze\radializebase\interfaces\InterfaceCrawlerSlave.java
15
+D:\Workspaces\WokspaceRadialize\radializebase\src\main\java\com\rdlze\radializebase\interfaces\RemoteRadializeCacheFacade.java
16
+D:\Workspaces\WokspaceRadialize\radializebase\src\main\java\com\rdlze\radializebase\notification\NotifierObject.java
17
+D:\Workspaces\WokspaceRadialize\radializebase\src\main\java\com\rdlze\radializebase\utils\FilterBean.java
18
+D:\Workspaces\WokspaceRadialize\radializebase\src\main\java\com\rdlze\radializebase\interfaces\InterfaceIdFinder.java
19
+D:\Workspaces\WokspaceRadialize\radializebase\src\main\java\com\rdlze\radializebase\utils\MathNervous.java
20
+D:\Workspaces\WokspaceRadialize\radializebase\src\main\java\com\rdlze\radializebase\mocks\MockBroker.java
21
+D:\Workspaces\WokspaceRadialize\radializebase\src\main\java\com\rdlze\radializebase\notification\Notifier.java
22
+D:\Workspaces\WokspaceRadialize\radializebase\src\main\java\com\rdlze\radializebase\interfaces\InterfacePlayingNowServer.java
23
+D:\Workspaces\WokspaceRadialize\radializebase\src\main\java\com\rdlze\radializebase\utils\AllFilters.java

+ 62 - 0
.svn/pristine/af/af044efa90a5d32ae6ec97139102ad88cbe9ec16.svn-base

@@ -0,0 +1,62 @@
1
+package com.rdlze.radializebase.utils;
2
+
3
+public class AllFilters extends FilterBean {
4
+
5
+	/**
6
+	 * Default serial version
7
+	 */
8
+	private static final long serialVersionUID = 1L;
9
+
10
+	private int useNovelty = 0;
11
+
12
+	private int usePopularity = 0;
13
+
14
+	public AllFilters() {
15
+
16
+	}
17
+
18
+	public AllFilters(int useNovelty) {
19
+		this.useNovelty = useNovelty;
20
+	}
21
+
22
+	public AllFilters(int useNovelty, int usePopularity) {
23
+		this.useNovelty = useNovelty;
24
+		this.usePopularity = usePopularity;
25
+	}
26
+
27
+	/**
28
+	 * Indica se devera ser retornado somente itens desconhecidos, itens
29
+	 * conhecidos ou tanto faz. O valor -1 indica o retorno de itens conhecidos.
30
+	 * O valor 1 indica o retorno de itens desconhecidos, isto se houver itens
31
+	 * desconhecidos para completar a lista de recomendacao. O valor 0 tanto faz
32
+	 * os itens de retorno serem conhecidos ou nao conhecidos.
33
+	 * 
34
+	 * @return inteiro indicando se deve ou nao retornar itens desconhecidos.
35
+	 */
36
+	public int getUseNovelty() {
37
+		return useNovelty;
38
+	}
39
+
40
+	public void setUseNovelty(int useNovelty) {
41
+		this.useNovelty = useNovelty;
42
+	}
43
+
44
+	/**
45
+	 * Indica se devera ser retornado itens populares, itens raros ou tanto faz.
46
+	 * O valor -1 indica o retorno de itens raros. O valor 1 indica o retorno de
47
+	 * itens populares. O valor 0 e a lista de retorno original.
48
+	 * 
49
+	 * @return
50
+	 */
51
+	public int getUsePopularity() {
52
+		return usePopularity;
53
+	}
54
+
55
+	public void setUsePopularity(int usePopularity) {
56
+		this.usePopularity = usePopularity;
57
+	}
58
+
59
+	public String toString() {
60
+		return "NOVIDADE: " + useNovelty + " POPULARIDADE: " + usePopularity;
61
+	}
62
+}

+ 45 - 0
.svn/pristine/b1/b1cfcb08dc5b52a3c56fbdaf64b89527e4a76821.svn-base

@@ -0,0 +1,45 @@
1
+package com.rdlze.radializebase.interfaces;
2
+
3
+import java.io.Serializable;
4
+import java.rmi.Remote;
5
+import java.rmi.RemoteException;
6
+import java.util.List;
7
+import java.util.Map;
8
+
9
+import com.rdlze.radializeutils.objects.ArtistIdAndTimestamp;
10
+import com.rdlze.radializeutils.objects.Radio;
11
+import com.rdlze.radializeutils.objects.RadioStreamingMetadata;
12
+
13
+
14
+public interface InterfacePlayingNowServer extends Remote, Serializable
15
+{	
16
+	/**
17
+	 * @return List of Radios playing the given artist
18
+	 */
19
+     public  List<Radio> artistPlayingNow(int artistID)throws RemoteException;
20
+     
21
+     /**
22
+      * @return List of Radios playing the given song
23
+      */
24
+	 public  List<Radio> musicPlayingNow(int musicID)throws RemoteException;
25
+	 
26
+	 /**
27
+      * Gets playing media of the given radio
28
+      */
29
+     public  RadioStreamingMetadata getRadioPlayNow(int radioId)throws RemoteException;
30
+     
31
+     /**
32
+      * Gets map of artists playing at the moment
33
+      */
34
+     public  Map<Integer, ArtistIdAndTimestamp> getRadioArtistMap() throws RemoteException;
35
+     
36
+     /**
37
+      * Gets map of songs playing at the moment
38
+      */
39
+     public  Map<Integer, Integer> getRadioSongMap() throws RemoteException;
40
+     
41
+     /**
42
+      * Gets what is playing in a given radio
43
+      */
44
+     public  RadioStreamingMetadata getPlayingMedia(int radioId) throws RemoteException;
45
+}

BIN
.svn/pristine/b7/b76ec43187c26c4dfff7fb3c77bf0ff4097f4e11.svn-base


+ 365 - 0
.svn/pristine/b8/b8c15ef50b89dc966683ac941b43562d0c44384e.svn-base

@@ -0,0 +1,365 @@
1
+package com.rdlze.radializebase.utils;
2
+
3
+import java.util.ArrayList;
4
+import java.util.Iterator;
5
+import java.util.List;
6
+
7
+import org.apache.mahout.cf.taste.impl.common.FastByIDMap;
8
+
9
+/**
10
+ * 
11
+ * @author Alex Amorim Dutra
12
+ * 
13
+ */
14
+public class MathNervous {
15
+
16
+	/**
17
+	 * Normaliza os valores do Map entre 0 e 1.
18
+	 * 
19
+	 * @param idsValues
20
+	 * @return
21
+	 */
22
+	public FastByIDMap<Float> normalizingValues(FastByIDMap<Float> idsValues) {
23
+
24
+		float maxValue = -99999999;
25
+		float minValue = 99999999;
26
+		Iterator<Long> iteratorValues = idsValues.keySetIterator();
27
+		while (iteratorValues.hasNext()) {
28
+			long id = iteratorValues.next();
29
+			float value = idsValues.get(id);
30
+			if (maxValue < value)
31
+				maxValue = value;
32
+			if (minValue > value)
33
+				minValue = value;
34
+			idsValues.put(id, value);
35
+		}
36
+
37
+		FastByIDMap<Float> mapToReturn = new FastByIDMap<Float>();
38
+		iteratorValues = idsValues.keySetIterator();
39
+		while (iteratorValues.hasNext()) {
40
+
41
+			long id = iteratorValues.next();
42
+			float value = idsValues.get(id);
43
+			float newValue = 0;
44
+			if ((maxValue - minValue) == 0) {
45
+				newValue = 0.0f;
46
+			} else {
47
+				newValue = (value - minValue) / (maxValue - minValue);
48
+			}
49
+			mapToReturn.put(id, newValue);
50
+		}
51
+		return mapToReturn;
52
+	}
53
+
54
+	/**
55
+	 * Normaliza os valores do Map entre o menor valor desejado e o maior valor
56
+	 * desejado.
57
+	 * 
58
+	 * @param idsValues
59
+	 * @return
60
+	 */
61
+	public FastByIDMap<Float> normalizingValues(FastByIDMap<Float> idsValues,
62
+			float minValueDesired, float maxValueDesired) {
63
+
64
+		float realMaxValue = -99999999;
65
+		float realMinValue = 99999999;
66
+		Iterator<Long> iteratorValues = idsValues.keySetIterator();
67
+		while (iteratorValues.hasNext()) {
68
+			long id = iteratorValues.next();
69
+			float value = idsValues.get(id);
70
+			if (realMaxValue < value)
71
+				realMaxValue = value;
72
+			if (realMinValue > value)
73
+				realMinValue = value;
74
+			idsValues.put(id, value);
75
+		}
76
+
77
+		FastByIDMap<Float> mapToReturn = new FastByIDMap<Float>();
78
+		iteratorValues = idsValues.keySetIterator();
79
+		while (iteratorValues.hasNext()) {
80
+			long id = iteratorValues.next();
81
+			float value = idsValues.get(id);
82
+			float newValue = 0;
83
+			if ((realMaxValue - realMinValue) == 0) {
84
+				newValue = maxValueDesired;
85
+			} else {
86
+				newValue = minValueDesired
87
+						+ ((value - realMinValue) * (maxValueDesired - minValueDesired))
88
+						/ (realMaxValue - realMinValue);
89
+			}
90
+			mapToReturn.put(id, newValue);
91
+		}
92
+		return mapToReturn;
93
+	}
94
+
95
+	public FastByIDMap<Float> normalizingSortedList(
96
+			List<AIRecommendedItem> listToNormalize) {
97
+
98
+		float maxValue = 100;
99
+		FastByIDMap<Float> mapToReturn = new FastByIDMap<Float>();
100
+		for (AIRecommendedItem item : listToNormalize) {
101
+			mapToReturn.put(item.getItemID(), maxValue);
102
+			// evita que os valores ficam abaixo de 20, pois isto atrapalha para
103
+			// mostrar no front-end.
104
+			if (maxValue > 80)
105
+				maxValue -= 4;
106
+			else if (maxValue > 60)
107
+				maxValue -= 3;
108
+			else if (maxValue > 50)
109
+				maxValue -= 2;
110
+			else if (maxValue > 30)
111
+				maxValue -= 1;
112
+			else if (maxValue > 20)
113
+				maxValue -= 0.5;
114
+		}
115
+		return mapToReturn;
116
+	}
117
+
118
+	public FastByIDMap<Float> normalizingSortedListRadio(
119
+			List<AIRecommendedItem> listToNormalize) {
120
+		// Pelo fato dos nomes das rádios serem maiores então é feita uma
121
+		// normalização mais agressiva quanto as diferenças de valores.
122
+		float maxValue = 100;
123
+		FastByIDMap<Float> mapToReturn = new FastByIDMap<Float>();
124
+		for (AIRecommendedItem item : listToNormalize) {
125
+			mapToReturn.put(item.getItemID(), maxValue);
126
+			if (maxValue > 89)
127
+				maxValue -= 5;
128
+			else if (maxValue > 60)
129
+				maxValue -= 4;
130
+			else if (maxValue > 40)
131
+				maxValue -= 3;
132
+			else if (maxValue > 30)
133
+				maxValue -= 1.5;
134
+			else if (maxValue > 20)
135
+				maxValue -= 0.5;
136
+		}
137
+		return mapToReturn;
138
+	}
139
+
140
+	/**
141
+	 * Normaliza os valores utilizando ZScore.
142
+	 * 
143
+	 * @param idValue
144
+	 * @return
145
+	 */
146
+	public FastByIDMap<Float> normalizingValuesZScore(FastByIDMap<Float> idValue) {
147
+
148
+		List<Float> values = new ArrayList<Float>();
149
+		Iterator<Long> iteratorValues = idValue.keySetIterator();
150
+		while (iteratorValues.hasNext()) {
151
+			long id = iteratorValues.next();
152
+			float value = idValue.get(id);
153
+			values.add(value);
154
+			idValue.put(id, value);
155
+		}
156
+		float mean = getMean(values);
157
+		float desvPad = getStandardDeviation(values);
158
+
159
+		FastByIDMap<Float> mapReturn = new FastByIDMap<Float>();
160
+		iteratorValues = idValue.keySetIterator();
161
+		while (iteratorValues.hasNext()) {
162
+			long id = iteratorValues.next();
163
+			float value = idValue.get(id);
164
+			float newValue = (value - mean) / desvPad;
165
+			mapReturn.put(id, newValue);
166
+			if (Float.isNaN(value))
167
+				value = 0.f;
168
+			idValue.put(id, value);
169
+		}
170
+
171
+		return mapReturn;
172
+	}
173
+
174
+	/**
175
+	 * Calcula a media dos valores.
176
+	 * 
177
+	 * @param values
178
+	 * @return
179
+	 */
180
+	public float getMean(List<Float> values) {
181
+		float totalValue = 0;
182
+		for (Float value : values)
183
+			totalValue += value;
184
+		if (totalValue == 0)
185
+			return 0;
186
+		return totalValue / values.size();
187
+	}
188
+
189
+	/**
190
+	 * Calcula o desvio padrao dos valores.
191
+	 * 
192
+	 * @param values
193
+	 * @return
194
+	 */
195
+	public float getStandardDeviation(List<Float> values) {
196
+
197
+		float mean = getMean(values);
198
+
199
+		float totalValue = 0;
200
+		for (Float value : values) {
201
+			totalValue += Math.pow((value - mean), 2);
202
+		}
203
+
204
+		float desvPad = (float) Math.sqrt(totalValue / (values.size() - 1));
205
+		return desvPad;
206
+	}
207
+
208
+	/**
209
+	 * Cada item contem uma lista de valores de Features.
210
+	 * 
211
+	 * @param idValuesFeatures
212
+	 * @return
213
+	 */
214
+	public FastByIDMap<List<Float>> normalizingValuesMap(
215
+			FastByIDMap<List<Float>> idValuesFeatures) {
216
+
217
+		FastByIDMap<List<Float>> valuesNormalized = new FastByIDMap<List<Float>>();
218
+		// normaliza feature por feature de cada item.
219
+		// primeira feature itera sobre todos itens.
220
+		int size = 1;
221
+		for (int i = 0; i < size; i++) {
222
+			FastByIDMap<Float> idValue = new FastByIDMap<Float>();
223
+			Iterator<Long> iteratorIds = idValuesFeatures.keySetIterator();
224
+			while (iteratorIds.hasNext()) {
225
+				long id = iteratorIds.next();
226
+				List<Float> features = idValuesFeatures.get(id);
227
+				size = features.size();
228
+				float value = features.get(i);
229
+				idValue.put(id, value);
230
+			}
231
+
232
+			FastByIDMap<Float> mapReturn = normalizingValues(idValue);
233
+			iteratorIds = mapReturn.keySetIterator();
234
+			while (iteratorIds.hasNext()) {
235
+				long id = iteratorIds.next();
236
+				float value = mapReturn.get(id);
237
+				List<Float> features = idValuesFeatures.get(id);
238
+				// setando o valor normalizado
239
+				features.set(i, value);
240
+				valuesNormalized.put(id, features);
241
+			}
242
+		}
243
+		return valuesNormalized;
244
+	}
245
+
246
+	/**
247
+	 * Cada item contem uma lista de valores de Features.
248
+	 * 
249
+	 * @param idValuesFeatures
250
+	 * @return
251
+	 */
252
+	public FastByIDMap<List<Float>> normalizingValuesZScoreMap(
253
+			FastByIDMap<List<Float>> idValuesFeatures) {
254
+
255
+		FastByIDMap<List<Float>> valuesNormalized = new FastByIDMap<List<Float>>();
256
+		// normaliza feature por feature de cada item.
257
+		// primeira feature itera sobre todos itens.
258
+		int size = 1;
259
+		for (int i = 0; i < size; i++) {
260
+			FastByIDMap<Float> idValue = new FastByIDMap<Float>();
261
+			Iterator<Long> iteratorIds = idValuesFeatures.keySetIterator();
262
+			while (iteratorIds.hasNext()) {
263
+				long id = iteratorIds.next();
264
+				List<Float> features = idValuesFeatures.get(id);
265
+				size = features.size();
266
+				float value = features.get(i);
267
+				if (Float.isNaN(value))
268
+					value = 0.0f;
269
+				idValue.put(id, value);
270
+			}
271
+
272
+			FastByIDMap<Float> mapReturn = normalizingValuesZScore(idValue);
273
+			iteratorIds = mapReturn.keySetIterator();
274
+			while (iteratorIds.hasNext()) {
275
+				long id = iteratorIds.next();
276
+				float value = mapReturn.get(id);
277
+				List<Float> features = idValuesFeatures.get(id);
278
+				// setando o valor normalizado
279
+				if (Float.isNaN(value))
280
+					value = 0.0f;
281
+				features.set(i, value);
282
+				valuesNormalized.put(id, features);
283
+			}
284
+		}
285
+		return valuesNormalized;
286
+	}
287
+
288
+	public float getMax(List<Float> values) {
289
+		float max = -99999999999999999999999999999999999999.f;
290
+		for (float value : values) {
291
+			if (max < value)
292
+				max = value;
293
+		}
294
+		return max;
295
+	}
296
+
297
+	public float getMin(List<Float> values) {
298
+		float min = 99999999999999999999999999999999999999.f;
299
+		for (float value : values) {
300
+			if (min > value)
301
+				min = value;
302
+		}
303
+		return min;
304
+	}
305
+
306
+	public float getCoefficientVariation(List<Float> values) {
307
+		float mean = getMean(values);
308
+
309
+		float totalValue = 0;
310
+		for (Float value : values)
311
+			totalValue += Math.pow((value - mean), 2);
312
+
313
+		float desvPad = (float) Math.sqrt(totalValue / (values.size() - 1));
314
+		float cv = desvPad / mean;
315
+
316
+		return cv;
317
+	}
318
+
319
+	public double normalizingValues(double value, double realMinValue,
320
+			double realMaxValue, double minValueDesired, double maxValueDesired) {
321
+		double newValue = 0;
322
+		if ((realMaxValue - realMinValue) == 0) {
323
+			newValue = minValueDesired;
324
+		} else {
325
+			newValue = minValueDesired
326
+					+ ((value - realMinValue) * (maxValueDesired - minValueDesired))
327
+					/ (realMaxValue - realMinValue);
328
+		}
329
+
330
+		// if (newValue < value)
331
+		// System.out.println("MINVALUEDESIRED " + minValueDesired
332
+		// + " VALUE " + value + " MAXVALUEDESIRED "
333
+		// + maxValueDesired + " REALMINVALUE " + realMinValue
334
+		// + " REALMAXVALUE " + realMaxValue+" NEWVALUE "+newValue);
335
+		return newValue;
336
+	}
337
+
338
+	public static void main(String[] args) {
339
+		List<Float> values = new ArrayList<Float>();
340
+		values.add(2.f);
341
+		values.add(2.f);
342
+		values.add(2.f);
343
+		values.add(120.f);
344
+		MathNervous normalizing = new MathNervous();
345
+		double realMinValue = 0.2;
346
+		System.out.println("OKK "
347
+				+ normalizing.normalizingValues(0.27, realMinValue, 0.27,
348
+						realMinValue, 40));
349
+		System.out.println("Mean " + normalizing.getMean(values));
350
+		System.out.println("DesvPad "
351
+				+ normalizing.getStandardDeviation(values));
352
+		FastByIDMap<Float> idValue = new FastByIDMap<Float>();
353
+		idValue.put(1, 0.f);
354
+		idValue.put(2, 2.f);
355
+		idValue.put(3, 500.f);
356
+		idValue.put(4, 1000.f);
357
+		System.out.println("Normalizing "
358
+				+ normalizing.normalizingValues(idValue));
359
+		System.out.println("Normalizing Min and Max "
360
+				+ normalizing.normalizingValues(idValue, 1, 80));
361
+
362
+		System.out.println("ZScore "
363
+				+ normalizing.normalizingValuesZScore(idValue));
364
+	}
365
+}

+ 116 - 0
.svn/pristine/bc/bc4aa910d58829c6cad06ea58e7ce258dca2bd71.svn-base

@@ -0,0 +1,116 @@
1
+package com.rdlze.radializebase.interfaces;
2
+
3
+import java.rmi.RemoteException;
4
+import java.util.List;
5
+
6
+import com.idealizeframework.irf.base.facade.RemoteFacade;
7
+import com.rdlze.radializebase.utils.AIRecommendedItem;
8
+
9
+/**
10
+ * 
11
+ * @author Alex Amorim Dutra
12
+ * 
13
+ */
14
+public interface RemoteRadializeBatchFacade extends RemoteFacade {
15
+
16
+	/**
17
+	 * Process the recommendations request
18
+	 * 
19
+	 * @param input
20
+	 *            String with input from client
21
+	 * @return String with the recommendations
22
+	 * @throws RemoteException
23
+	 *             thrown when this object cannot be accessed remotely
24
+	 */
25
+	public String getRecommendations(String input) throws RemoteException;
26
+	
27
+	// search by artist
28
+	// 1
29
+	public List<AIRecommendedItem> searchByArtistReturnArtists(long userId,
30
+			List<Integer> artistsIds, int howMany) throws RemoteException;
31
+
32
+	// 2
33
+	public List<AIRecommendedItem> searchByArtistReturnSongs(long userId,
34
+			List<Integer> artistsIds, int howMany) throws RemoteException;
35
+
36
+	// 3
37
+	public List<AIRecommendedItem> searchByArtistReturnRadios(long userId,
38
+			List<Integer> artistsIds, int howMany) throws RemoteException;
39
+
40
+	// 4
41
+	public List<AIRecommendedItem> searchByArtistReturnTags(long userId,
42
+			List<Integer> artistsIds, int howMany) throws RemoteException;
43
+
44
+	// search by song
45
+	// 5
46
+	public List<AIRecommendedItem> searchBySongReturnArtists(long userId,
47
+			List<Integer> songsIds, int howMany) throws RemoteException;
48
+
49
+	// 6
50
+	public List<AIRecommendedItem> searchBySongReturnSongs(long userId,
51
+			List<Integer> songsIds, int howMany) throws RemoteException;
52
+
53
+	// 7
54
+	public List<AIRecommendedItem> searchBySongReturnRadios(long userId,
55
+			List<Integer> songsIds, int howMany) throws RemoteException;
56
+
57
+	// 8
58
+	public List<AIRecommendedItem> searchBySongReturnTags(long userId,
59
+			List<Integer> songsIds, int howMany) throws RemoteException;
60
+
61
+	// search by radio
62
+	// 9
63
+	public List<AIRecommendedItem> searchByRadioReturnArtists(long userId,
64
+			List<Integer> radiosIds, int howMany) throws RemoteException;
65
+
66
+	// 10
67
+	public List<AIRecommendedItem> searchByRadioReturnSongs(long userId,
68
+			List<Integer> radiosIds, int howMany) throws RemoteException;
69
+
70
+	// 11
71
+	public List<AIRecommendedItem> searchByRadioReturnRadios(long userId,
72
+			List<Integer> radiosIds, int howMany) throws RemoteException;
73
+
74
+	// 12
75
+	public List<AIRecommendedItem> searchByRadioReturnTags(long userId,
76
+			List<Integer> radiosIds, int howMany) throws RemoteException;
77
+
78
+	// search by tag
79
+	// 13
80
+	public List<AIRecommendedItem> searchByTagReturnArtists(long userId,
81
+			List<Integer> tagsIds, int howMany) throws RemoteException;
82
+
83
+	// 14
84
+	public List<AIRecommendedItem> searchByTagReturnSongs(long userId,
85
+			List<Integer> tagsIds, int howMany) throws RemoteException;
86
+
87
+	// 15
88
+	public List<AIRecommendedItem> searchByTagReturnRadios(long userId,
89
+			List<Integer> tagsIds, int howMany) throws RemoteException;
90
+
91
+	// 16
92
+	public List<AIRecommendedItem> searchByTagReturnTags(long userId,
93
+			List<Integer> tagsIds, int howMany) throws RemoteException;
94
+
95
+	// get recommendations
96
+	// 17
97
+	public List<AIRecommendedItem> getRecommendationsArtists(long userId,
98
+			int howMany, List<Integer> momentsIds) throws RemoteException;
99
+
100
+	// 18
101
+	public List<AIRecommendedItem> getRecommendationsSongs(long userId,
102
+			int howMany, List<Integer> momentsIds) throws RemoteException;
103
+
104
+	// 19
105
+	public List<AIRecommendedItem> getRecommendationsRadios(long userId,
106
+			int howMany, List<Integer> momentsIds) throws RemoteException;
107
+
108
+	// 20
109
+	public List<AIRecommendedItem> getRecommendationsTags(long userId,
110
+			int howMany, List<Integer> momentsIds) throws RemoteException;
111
+
112
+	// 21
113
+	public List<AIRecommendedItem> getRecommendationsFriends(long userId,
114
+			int howMany, List<Integer> momentsIds) throws RemoteException;
115
+
116
+}

+ 27 - 0
.svn/pristine/bf/bf1ebc9bf29fd3c4d7640c63431f45d4d35108d0.svn-base

@@ -0,0 +1,27 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<classpath>
3
+	<classpathentry kind="src" output="target/classes" path="src/main/java">
4
+		<attributes>
5
+			<attribute name="optional" value="true"/>
6
+			<attribute name="maven.pomderived" value="true"/>
7
+		</attributes>
8
+	</classpathentry>
9
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java">
10
+		<attributes>
11
+			<attribute name="optional" value="true"/>
12
+			<attribute name="maven.pomderived" value="true"/>
13
+		</attributes>
14
+	</classpathentry>
15
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
16
+		<attributes>
17
+			<attribute name="maven.pomderived" value="true"/>
18
+		</attributes>
19
+	</classpathentry>
20
+	<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
21
+		<attributes>
22
+			<attribute name="maven.pomderived" value="true"/>
23
+			<attribute name="org.eclipse.jst.component.nondependency" value=""/>
24
+		</attributes>
25
+	</classpathentry>
26
+	<classpathentry kind="output" path="target/classes"/>
27
+</classpath>

+ 74 - 0
.svn/pristine/bf/bfbf215f17f41926c776823d369c2aeb194dd0b6.svn-base

@@ -0,0 +1,74 @@
1
+package com.rdlze.radializebase.interfaces;
2
+
3
+import java.io.Serializable;
4
+import java.rmi.Remote;
5
+import java.rmi.RemoteException;
6
+import java.sql.SQLException;
7
+import java.util.List;
8
+
9
+import com.rdlze.radializeutils.objects.Radio;
10
+
11
+public interface InterfaceCrawlerMaster extends Remote, Serializable {
12
+
13
+	/**
14
+	 * Adds a slave node for the list of available slaves for crawling.
15
+	 * 
16
+	 * @param slave
17
+	 * @throws RemoteException
18
+	 */
19
+	public void addSlave(String slaveIP, String slaveName, int port)
20
+			throws RemoteException;
21
+
22
+	/**
23
+	 * Check if metadata has changed for the given radio. If so, new media is
24
+	 * mapped on the master for that radioId.
25
+	 * 
26
+	 * @param radioId
27
+	 * @param media
28
+	 * @return
29
+	 */
30
+	public boolean hasChanged(int radioId, String media) throws RemoteException;
31
+
32
+	/**
33
+	 * Adds to the crawling queue radios os the given companies.
34
+	 * 
35
+	 * @param commaSeparatedCompanyIds
36
+	 *            ex: "4,6,61"
37
+	 * @throws SQLException
38
+	 */
39
+	public boolean loadCompaniesRadios(String commaSeparatedCompanyIds)
40
+			throws SQLException, RemoteException;
41
+
42
+	/**
43
+	 * Adds to the crawling queue a list of radios
44
+	 * 
45
+	 * @param radios
46
+	 *            list of radios
47
+	 */
48
+	public boolean addRadiosToCrawl(List<Radio> radios) throws RemoteException;
49
+
50
+	/**
51
+	 * Only tester if was connected.
52
+	 *  
53
+	 * @throws RemoteException
54
+	 */
55
+	public void connected() throws RemoteException;
56
+
57
+	/**
58
+	 * Tells the master a radio's metadata is not able to be crawled by stream
59
+	 * so the master can send it to be collected by metadata pages(traditional crawling).
60
+	 * @param idRadio
61
+	 * @throws RemoteException
62
+	 */
63
+	public void fail2CollectByStream(int idRadio) throws RemoteException;
64
+
65
+	/**
66
+	 * Allows the external program to ask for a list of 
67
+	 * radios to be crawled.
68
+	 * @param numRadios is how many radios should be sent on response
69
+	 * @param slaveName to identify which slave is asking and how to populate the response
70
+	 * @throws RemoteException
71
+	 */
72
+	public void getRadios2Crawl(int numRadios, String slaveName) throws RemoteException;
73
+	
74
+}

+ 100 - 0
.svn/pristine/c8/c83651cc3980f95fa6829f07b246a9bb5f9e4b1d.svn-base

@@ -0,0 +1,100 @@
1
+package com.rdlze.radializebase.utils;
2
+
3
+import java.rmi.NotBoundException;
4
+import java.rmi.RemoteException;
5
+import java.rmi.registry.LocateRegistry;
6
+import java.rmi.registry.Registry;
7
+import java.sql.Timestamp;
8
+
9
+import com.rdlze.radializebase.interfaces.InterfaceSearchServer;
10
+import com.rdlze.radializebase.notification.Notifier;
11
+import com.rdlze.radializeutils.notification.Notification;
12
+import com.rdlze.radializeutils.objects.IndexResponse;
13
+
14
+/**
15
+ * Utils for rdlz backend tasks
16
+ * 
17
+ * @author kledilson
18
+ * 
19
+ */
20
+public class RdlzComponents {
21
+
22
+	/**
23
+	 * Connects to Rdlz broker
24
+	 * 
25
+	 * @param ip
26
+	 * @param serviceName
27
+	 */
28
+	public static void connectToBroker(String ip, String serviceName, int port) {
29
+		Notifier.init(ip, serviceName, port);
30
+		System.out.println("Conectou ao broker do Radialize");
31
+	}
32
+
33
+	/**
34
+	 * Connects to Rdlz SearchServer
35
+	 * 
36
+	 * @param ip
37
+	 * @param serviceName
38
+	 * @return
39
+	 * @throws RemoteException
40
+	 * @throws NotBoundException
41
+	 */
42
+	public static InterfaceSearchServer getSearchServerFacade(String ip,
43
+			String serviceName) throws RemoteException, NotBoundException {
44
+		Registry registry = LocateRegistry.getRegistry(ip);
45
+		InterfaceSearchServer iSS = (InterfaceSearchServer) registry
46
+				.lookup(serviceName);
47
+		System.out.println("Pegou fachada do SearchServer");
48
+		return iSS;
49
+	}
50
+
51
+	/**
52
+	 * Send notification to radialize's broker with new content
53
+	 * 
54
+	 * @param artist
55
+	 * @param song
56
+	 * @param response
57
+	 * @throws RemoteException
58
+	 */
59
+	public static void sendNotification(String artist, String song,
60
+			IndexResponse response) throws RemoteException {
61
+		Notification notification = new Notification(0);
62
+		notification.setRadioId(-1);
63
+
64
+		if (response.getMBResp() != null) {
65
+			notification.setMusicBrainzResponse(response.getMBResp());
66
+		}
67
+
68
+		if (response.getMBResp() != null
69
+				&& response.getMBResp().getArtist() != null
70
+				&& response.getMBResp().getArtist().getName() != null
71
+				&& !response.getMusicBrainzArtistId().equals("-1")
72
+				&& (!(response.getMBResp().getArtist().getName()).equals("") || !(response
73
+						.getMBResp().getArtist().getName()).equals("-1"))) {
74
+			artist = response.getMBResp().getArtist().getName();
75
+		}
76
+		if (response.getMBResp() != null
77
+				&& response.getMBResp().getSong() != null
78
+				&& !response.getMBResp().getIdSongMB().equals("-1")
79
+				&& (!(response.getMBResp().getSong()).equals("") || !(response
80
+						.getMBResp().getSong()).equals("-1"))) {
81
+			song = response.getMBResp().getSong();
82
+		}
83
+
84
+		notification.setArtistName(artist);
85
+		notification.setSongName(song);
86
+		notification.setArtistId(response.getArtistId());
87
+		notification.setSongId(response.getMusicId());
88
+		notification.setMediaId(response.getMediaId());
89
+		notification.setMedia(artist + song);
90
+		notification.setTrack(true);
91
+		notification.setNotDisplayable();
92
+		notification.setStartTime(new Timestamp(0));
93
+		notification.setEndTime(new Timestamp(0));
94
+		notification.setPath("");
95
+		notification.setMusicBrainzArtistId(response.getMusicBrainzArtistId());
96
+		notification.setMusicBrainzSongId(response.getMusicBrainzMusicId());
97
+		notification.setNotificationType(0);
98
+		Notifier.notify(notification);
99
+	}
100
+}

+ 149 - 0
.svn/pristine/cf/cfe5cbb67fd401f00ff48009d478481939997aee.svn-base

@@ -0,0 +1,149 @@
1
+package com.rdlze.radializebase.utils;
2
+
3
+import java.rmi.Remote;
4
+import java.rmi.RemoteException;
5
+import java.rmi.registry.LocateRegistry;
6
+import java.rmi.registry.Registry;
7
+import java.rmi.server.UnicastRemoteObject;
8
+import java.sql.Timestamp;
9
+
10
+import com.idealizeframework.irf.base.exceptions.IdealizeUnavailableResourceException;
11
+
12
+public class Utils {
13
+
14
+	public static Timestamp getNowDate() {
15
+		return new Timestamp(System.currentTimeMillis());
16
+	}
17
+
18
+	/**
19
+	 * Makes the object remotely available.
20
+	 * 
21
+	 * @param remoteObject
22
+	 * @param nameObject
23
+	 * @throws IdealizeUnavailableResourceException
24
+	 */
25
+	public static Remote registerRemoteObject(Remote remoteObject,
26
+			String nameObject, int port) {
27
+
28
+		try {
29
+			try {
30
+				LocateRegistry.createRegistry(port);
31
+				// System.out.println("Criou o RMI............................................................................................");
32
+			} catch (Exception e) {
33
+				System.out.println("A porta do RMI ja esta sendo utilizada?!");
34
+			}
35
+			Remote stub;
36
+			Registry registry = LocateRegistry.getRegistry(port);
37
+
38
+			stub = UnicastRemoteObject.exportObject(remoteObject, port);
39
+			System.out.println("Name Obj " + nameObject);
40
+			registry.rebind(nameObject, stub);
41
+			System.out.println("REGISTROU OBJETO " + nameObject
42
+					+ " REMOTAMENTE.");
43
+
44
+			return stub;
45
+		} catch (RemoteException e) {
46
+			e.printStackTrace();
47
+		}
48
+		return remoteObject;
49
+	}
50
+
51
+	/**
52
+	 * Makes the object remotely available.
53
+	 * 
54
+	 * @param remoteObject
55
+	 * @param nameObject
56
+	 * @throws IdealizeUnavailableResourceException
57
+	 */
58
+	public static Remote registerRemoteObjectUseRandom(Remote remoteObject,
59
+			String nameObject, int port) {
60
+
61
+		try {
62
+			try {
63
+				LocateRegistry.createRegistry(port);
64
+				// System.out.println("Criou o RMI............................................................................................");
65
+			} catch (Exception e) {
66
+				System.out.println("A porta do RMI ja esta sendo utilizada?!");
67
+			}
68
+			Remote stub;
69
+			Registry registry = LocateRegistry.getRegistry(port);
70
+
71
+			stub = UnicastRemoteObject.exportObject(remoteObject, 0);
72
+			System.out.println("Name Obj " + nameObject);
73
+			registry.rebind(nameObject, stub);
74
+			System.out.println("REGISTROU OBJETO " + nameObject
75
+					+ " REMOTAMENTE.");
76
+
77
+			return stub;
78
+		} catch (RemoteException e) {
79
+			e.printStackTrace();
80
+		}
81
+		return remoteObject;
82
+	}
83
+
84
+	public static Remote getRemoteObject(String ipObject, String nameObject,
85
+			int port) {
86
+
87
+		Remote remote = null;
88
+		try {
89
+			Registry registry = LocateRegistry.getRegistry(ipObject, port);
90
+			remote = registry.lookup(nameObject);
91
+			if (remote == null) {
92
+				System.out.println("NÃO PEGOU O OBJETO " + nameObject
93
+						+ " REMOTAMENTE. O OBJETO ESTÁ NULO. IP: " + ipObject
94
+						+ " NAME: " + nameObject + " PORTA: " + port);
95
+
96
+			} else {
97
+				System.out.println("PEGOU O OBJETO " + nameObject
98
+						+ " REMOTAMENTE.");
99
+			}
100
+		} catch (Exception e) {
101
+			e.printStackTrace();
102
+			System.err
103
+					.println("Could not possible get remote object: nameObject: "
104
+							+ nameObject + " IP Object: " + ipObject);
105
+			remote = null;
106
+		}
107
+		return remote;
108
+	}
109
+
110
+	/**
111
+	 * Makes the object remotely available.
112
+	 * 
113
+	 * @param remoteObject
114
+	 * @param nameObject
115
+	 * @param host
116
+	 * @throws IdealizeUnavailableResourceException
117
+	 */
118
+	public static Remote registerRemoteObject(Remote remoteObject,
119
+			String nameObject, String host, int port) {
120
+
121
+		try {
122
+			try {
123
+				LocateRegistry.createRegistry(port);
124
+				// System.out.println("Criou o RMI............................................................................................");
125
+			} catch (Exception e) {
126
+				System.out.println("A porta do RMI ja esta sendo utilizada?!");
127
+			}
128
+			Remote stub;
129
+			Registry registry = LocateRegistry.getRegistry(host, port);
130
+
131
+			stub = UnicastRemoteObject.exportObject(remoteObject, port);
132
+			System.out.println("Name Obj " + nameObject);
133
+			registry.rebind(nameObject, stub);
134
+			System.out.println("REGISTROU OBJETO " + nameObject
135
+					+ " REMOTAMENTE.");
136
+
137
+			return stub;
138
+		} catch (RemoteException e) {
139
+			e.printStackTrace();
140
+		}
141
+		return remoteObject;
142
+	}
143
+
144
+	public String escapeUnicode(String name) {
145
+		name = name.replaceAll("'", "''");
146
+		name = name.replaceAll("\\", "'\\");
147
+		return name;
148
+	}
149
+}

+ 20 - 0
.svn/pristine/d0/d0cbc8d6e435a5c47aba8ff39fb4def0b7d02c58.svn-base

@@ -0,0 +1,20 @@
1
+package com.rdlze.radializebase.interfaces;
2
+
3
+import java.io.Serializable;
4
+import java.rmi.Remote;
5
+import java.rmi.RemoteException;
6
+import java.util.List;
7
+
8
+import com.rdlze.radializeutils.notification.Notification;
9
+
10
+public interface InterfaceNotifiable extends Remote, Serializable {
11
+	
12
+	public void notify(Notification notification) throws RemoteException;
13
+
14
+	public void notify(List list) throws RemoteException;
15
+
16
+	public void registerNotifiable(String IP, String serviceName, int port)
17
+			throws RemoteException;
18
+
19
+	public String getName() throws RemoteException;
20
+}

+ 0 - 0
.svn/pristine/da/da39a3ee5e6b4b0d3255bfef95601890afd80709.svn-base


+ 235 - 0
.svn/pristine/e4/e4b7692987bc326bfa0a19d7b41ec6b8ee2616e9.svn-base

@@ -0,0 +1,235 @@
1
+package com.rdlze.radializebase.utils;
2
+
3
+import java.io.Serializable;
4
+
5
+/**
6
+ * This class represents a item id and value, this value may be compared if
7
+ * required to do the sorting.
8
+ * 
9
+ * @author Alex Amorim Dutra
10
+ * 
11
+ */
12
+public class AIRecommendedItem implements Comparable<AIRecommendedItem>,
13
+		Serializable {
14
+
15
+	/**
16
+	 * Default Serial version
17
+	 */
18
+	private static final long serialVersionUID = 1L;
19
+
20
+	private long itemId;
21
+
22
+	private float value;
23
+
24
+	private float popularity;
25
+
26
+	private float unknown = 1;
27
+
28
+	private float age;
29
+
30
+	private String locality;
31
+
32
+	private boolean answeredAllFilters;
33
+
34
+	private String sortBy;
35
+
36
+	private int intSortBy;
37
+
38
+	private int searchFeedBack;
39
+
40
+	/**
41
+	 * Class constructor.
42
+	 * 
43
+	 * @param itemId
44
+	 *            integer with item id.
45
+	 * @param value
46
+	 *            float with value of ranking to item.
47
+	 * @param popularity
48
+	 *            float with popularity of item.
49
+	 * @param unknown
50
+	 *            float with the value of unknown items by user.
51
+	 * @param age
52
+	 *            float with age of item.
53
+	 * @param locality
54
+	 *            String with locality of item.
55
+	 * @param sortBy
56
+	 *            String indicating sort by popularity or unknown or age or
57
+	 *            locality.
58
+	 */
59
+	public AIRecommendedItem(long itemId, float value, float popularity,
60
+			float unknown, float age, String locality, String sortBy) {
61
+		this.itemId = itemId;
62
+		this.value = value;
63
+		this.age = age;
64
+		this.popularity = popularity;
65
+		this.unknown = unknown;
66
+		this.locality = locality;
67
+		this.sortBy = sortBy.toLowerCase();
68
+		if (sortBy.equals("popularity")) {
69
+			intSortBy = 1;
70
+		} else if (sortBy.equals("unknow")) {
71
+			intSortBy = 2;
72
+		} else if (sortBy.equals("age")) {
73
+			intSortBy = 3;
74
+		} else if (sortBy.equals("locality")) {
75
+			intSortBy = 4;
76
+		} else {
77
+			intSortBy = 5;
78
+		}
79
+	}
80
+
81
+	public long getItemID() {
82
+		return itemId;
83
+	}
84
+
85
+	/**
86
+	 * set doc ID.
87
+	 * 
88
+	 * @param itemId
89
+	 *            item id to be set
90
+	 */
91
+	public void setItemID(int itemId) {
92
+		this.itemId = itemId;
93
+	}
94
+
95
+	/**
96
+	 * Get value times.
97
+	 * 
98
+	 * @return float value times
99
+	 */
100
+	public float getValue() {
101
+		return value;
102
+	}
103
+
104
+	/**
105
+	 * set value times.
106
+	 * 
107
+	 * @param newValue
108
+	 *            times that the item will appear
109
+	 */
110
+	public void setValue(float newValue) {
111
+		this.value = newValue;
112
+	}
113
+
114
+	public float getAge() {
115
+		return age;
116
+	}
117
+
118
+	public void setAge(float age) {
119
+		this.age = age;
120
+	}
121
+
122
+	public float getUnknown() {
123
+		return unknown;
124
+	}
125
+
126
+	public void setUnknown(float unknown) {
127
+		this.unknown = unknown;
128
+	}
129
+
130
+	public float getPopularity() {
131
+		return popularity;
132
+	}
133
+
134
+	public void setPopularity(float popularity) {
135
+		this.popularity = popularity;
136
+	}
137
+
138
+	public String getLocality() {
139
+		return locality;
140
+	}
141
+
142
+	public void setLocality(String locality) {
143
+		this.locality = locality;
144
+	}
145
+
146
+	public String getSortBy() {
147
+		return sortBy;
148
+	}
149
+
150
+	public boolean isAnsweredAllFilters() {
151
+		return answeredAllFilters;
152
+	}
153
+
154
+	public void setAnsweredAllFilters(boolean answeredAllFilters) {
155
+		this.answeredAllFilters = answeredAllFilters;
156
+	}
157
+	
158
+	public int getSearchFeedBack() {
159
+		return searchFeedBack;
160
+	}
161
+
162
+	public void setSearchFeedBack(int searchFeedBack) {
163
+		this.searchFeedBack = searchFeedBack;
164
+	}
165
+
166
+	/**
167
+	 * Indicates which feature is used to sorted the list.
168
+	 * 
169
+	 * @param sortBy
170
+	 *            String with feature to sort by.
171
+	 */
172
+	public void setSortBy(String sortBy) {
173
+		this.sortBy = sortBy.toLowerCase();
174
+		if (sortBy.equals("popularity")) {
175
+			intSortBy = 1;
176
+		} else if (sortBy.equals("unknow")) {
177
+			intSortBy = 2;
178
+		} else if (sortBy.equals("age")) {
179
+			intSortBy = 3;
180
+		} else if (sortBy.equals("locality")) {
181
+			intSortBy = 4;
182
+		} else {
183
+			intSortBy = 5;
184
+		}
185
+	}
186
+
187
+	public int compareTo(AIRecommendedItem item) {
188
+		float value1;
189
+		float value2;
190
+		switch (this.intSortBy) {
191
+		case 1:
192
+			value1 = item.getPopularity();
193
+			value2 = this.getPopularity();
194
+			break;
195
+		case 2:
196
+			value1 = item.getUnknown();
197
+			value2 = this.getUnknown();
198
+			break;
199
+		case 3:
200
+			value1 = item.getAge();
201
+			value2 = this.getAge();
202
+			break;
203
+		case 4:
204
+			value1 = Integer.parseInt(item.getLocality());
205
+			value2 = Integer.parseInt(this.getLocality());
206
+			break;
207
+		default:
208
+			value1 = item.getValue();
209
+			value2 = this.getValue();
210
+			break;
211
+		}
212
+
213
+		if (value1 > value2)
214
+			return 1;
215
+		else if (value1 < value2)
216
+			return -1;
217
+		else
218
+			return 0;
219
+	}
220
+
221
+	public String toString() {
222
+		return "ID: " + itemId + ", VALUE.: " + value + " NOVELTY: " + unknown
223
+				+ " ISPLAYING: " + searchFeedBack;
224
+		// return "ITEM ID: " + itemId + " VALUE: " + value + " NOVELTY: "
225
+		// + unknown + " POPULARITY: " + popularity
226
+		// + " ANSWERED ALL FILTERS: " + answeredAllFilters+"...... ";
227
+	}
228
+
229
+	public boolean equals(AIRecommendedItem recItem) {
230
+		if (this.itemId == recItem.itemId)
231
+			return true;
232
+
233
+		return false;
234
+	}
235
+}

+ 48 - 0
.svn/pristine/f2/f2a902e8fb1802aacd230850873b163a8ad75a45.svn-base

@@ -0,0 +1,48 @@
1
+package com.rdlze.radializebase.interfaces;
2
+
3
+import java.io.IOException;
4
+
5
+import javax.xml.parsers.ParserConfigurationException;
6
+
7
+import org.xml.sax.SAXException;
8
+
9
+import com.rdlze.radializeutils.objects.BigTitleResp;
10
+import com.rdlze.radializeutils.objects.MBResp;
11
+
12
+
13
+public class MusicBrainzControllerMock implements
14
+		InterfaceMusicBrainzController {
15
+
16
+	@Override
17
+	public BigTitleResp searchBigTitle(String bigTitle, int nGramSize,
18
+			int numResults, boolean shallContainResp) throws IOException {
19
+		if(bigTitle!=null && bigTitle.toLowerCase().equals("black sabbath paranoid"))
20
+			return new BigTitleResp("Black Sabbath", "Paranoid");
21
+		return new BigTitleResp("", "");
22
+	}
23
+
24
+	@Override
25
+	public MBResp searchBigTitle(String bigTitle, int nGramSize)
26
+			throws IOException, ParserConfigurationException, SAXException,
27
+			InterruptedException {
28
+		// TODO Auto-generated method stub
29
+		return null;
30
+	}
31
+
32
+	@Override
33
+	public MBResp searchArtSong(String artist, String song,
34
+			boolean proximitySearch, int limit, int offset, String hostMB)
35
+			throws ParserConfigurationException, SAXException, IOException,
36
+			InterruptedException {
37
+		// TODO Auto-generated method stub
38
+		return null;
39
+	}
40
+
41
+	@Override
42
+	public MBResp searchArtSong(String artist, String song,
43
+			boolean proximitySearch, int limit) throws IOException {
44
+		// TODO Auto-generated method stub
45
+		return null;
46
+	}
47
+
48
+}

+ 5 - 0
.svn/pristine/fd/fd33ecf60f928ee88dc51985355550e2bee35eb2.svn-base

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
2
+    <wb-module deploy-name="radializebase">
3
+        <wb-resource deploy-path="/" source-path="/src/main/java"/>
4
+    </wb-module>
5
+</project-modules>

BIN
.svn/wc.db


+ 58 - 0
pom.xml

@@ -0,0 +1,58 @@
1
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3
+	<modelVersion>4.0.0</modelVersion>
4
+
5
+	<groupId>com.rdlze</groupId>
6
+	<artifactId>radializebase</artifactId>
7
+	<version>0.0.1-SNAPSHOT</version>
8
+	<packaging>jar</packaging>
9
+
10
+	<name>radializebase</name>
11
+	<url></url>
12
+
13
+	<properties>
14
+		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15
+	</properties>
16
+
17
+	<build>
18
+		<plugins>
19
+			<plugin>
20
+				<groupId>org.apache.maven.plugins</groupId>
21
+				<artifactId>maven-compiler-plugin</artifactId>
22
+				<version>3.1</version>
23
+				<configuration>
24
+					<source>1.7</source>
25
+					<target>1.7</target>
26
+				</configuration>
27
+			</plugin>
28
+		</plugins>
29
+	</build>
30
+
31
+	<dependencies>
32
+		<dependency>
33
+			<groupId>junit</groupId>
34
+			<artifactId>junit</artifactId>
35
+			<version>4.11</version>
36
+		</dependency>
37
+		<dependency>
38
+			<groupId>org.apache.lucene</groupId>
39
+			<artifactId>lucene-queryparser</artifactId>
40
+			<version>4.4.0</version>
41
+		</dependency>
42
+		<dependency>
43
+			<groupId>org.apache.mahout</groupId>
44
+			<artifactId>mahout-core</artifactId>
45
+			<version>0.9</version>
46
+		</dependency>
47
+		<dependency>
48
+			<groupId>com.rdlze</groupId>
49
+			<artifactId>radializeutils</artifactId>
50
+			<version>0.0.1-SNAPSHOT</version>
51
+		</dependency>
52
+		<dependency>
53
+			<groupId>com.idealizeframework.irf</groupId>
54
+			<artifactId>irf</artifactId>
55
+			<version>0.0.1-SNAPSHOT</version>
56
+		</dependency>
57
+	</dependencies>
58
+</project>

+ 13 - 0
src/main/java/com/rdlze/radializebase/App.java

@@ -0,0 +1,13 @@
1
+package com.rdlze.radializebase;
2
+
3
+/**
4
+ * Hello world!
5
+ *
6
+ */
7
+public class App 
8
+{
9
+    public static void main( String[] args )
10
+    {
11
+        System.out.println( "Hello World!" );
12
+    }
13
+}

+ 73 - 0
src/main/java/com/rdlze/radializebase/interfaces/InterfaceCollector.java

@@ -0,0 +1,73 @@
1
+package com.rdlze.radializebase.interfaces;
2
+
3
+import java.sql.SQLException;
4
+import java.sql.Timestamp;
5
+import java.text.ParseException;
6
+import java.util.concurrent.ConcurrentLinkedQueue;
7
+
8
+import com.rdlze.radializeutils.objects.MusicInfo;
9
+import com.rdlze.radializeutils.objects.RadioStreamingMetadata;
10
+import com.rdlze.radializeutils.objects.UpdateThreadBean;
11
+
12
+public interface InterfaceCollector {
13
+
14
+	public int returnRadioIdFromRadioList10(int radioIdList10)
15
+			throws SQLException;
16
+
17
+	public String returnArtistName(int artistId) throws SQLException;
18
+
19
+	public abstract int checkArtist(String artistName) throws SQLException;
20
+
21
+	public MusicInfo returnSongInfoFromList10(int songIdList10)
22
+			throws SQLException;
23
+
24
+	public abstract int checkSong(String songName, int artistId)
25
+			throws SQLException;
26
+
27
+	public abstract int checkMedia(String media, int artistId, int songId)
28
+			throws SQLException;
29
+
30
+	public abstract int insertArtist(String artistName,
31
+			String artistMusicBrainzId) throws SQLException;
32
+
33
+	public abstract int insertSong(int i, String s, String musicBrainzSongId)
34
+			throws SQLException;
35
+
36
+	public abstract int insertMedia(String name, int artistId, int songId,
37
+			String musicBrainzArtistId, String musicBrainzSongId)
38
+			throws Exception;
39
+
40
+	public abstract void rejectMedia(UpdateThreadBean b) throws SQLException;
41
+
42
+	// public abstract boolean checkPlayNow(int i, int j, int k) throws
43
+	// SQLException;
44
+	// public abstract boolean checkRadioPlayNow(int i) throws SQLException;
45
+	// public abstract void updatePlayNow(int i, int j, int k, String s, String
46
+	// s1)throws SQLException;
47
+	// public abstract void insertPlayNow(int i, int j, int k, String s, String
48
+	// s1) throws SQLException;
49
+
50
+	public abstract void saveCollect(
51
+			RadioStreamingMetadata radiostreamingmetadata) throws SQLException,
52
+			ParseException;
53
+
54
+	// public abstract void deletePlayNow(int idRadio) throws SQLException;
55
+	public abstract boolean insertMediaFile(int songId, int mediaSource,
56
+			int providerId, String name, String path) throws SQLException;
57
+
58
+	public abstract boolean recommendSongForEvent(int songId, int eventId,
59
+			int momentId, int userId, Timestamp timeToPlay) throws SQLException;
60
+
61
+	public abstract boolean checkIfMediaFileHasBeenAlreadyInserted(int songId,
62
+			int mediaSource, int providerId) throws SQLException;
63
+
64
+	public abstract Integer[] insertSongAndMedia(int artistId, String songName,
65
+			String musicBrainzSongId, String media, String musicBrainzArtistId,
66
+			boolean production) throws SQLException;
67
+
68
+	public abstract Integer[] insertArtistSongAndMedia(String artistName,
69
+			String songName, String musicBrainzSongId, String mediaName,
70
+			String artistIdMusicBrainz, boolean production) throws SQLException;
71
+
72
+	public void saveCollect(ConcurrentLinkedQueue<RadioStreamingMetadata> rsms) throws SQLException, ClassNotFoundException;
73
+}

+ 74 - 0
src/main/java/com/rdlze/radializebase/interfaces/InterfaceCrawlerMaster.java

@@ -0,0 +1,74 @@
1
+package com.rdlze.radializebase.interfaces;
2
+
3
+import java.io.Serializable;
4
+import java.rmi.Remote;
5
+import java.rmi.RemoteException;
6
+import java.sql.SQLException;
7
+import java.util.List;
8
+
9
+import com.rdlze.radializeutils.objects.Radio;
10
+
11
+public interface InterfaceCrawlerMaster extends Remote, Serializable {
12
+
13
+	/**
14
+	 * Adds a slave node for the list of available slaves for crawling.
15
+	 * 
16
+	 * @param slave
17
+	 * @throws RemoteException
18
+	 */
19
+	public void addSlave(String slaveIP, String slaveName, int port)
20
+			throws RemoteException;
21
+
22
+	/**
23
+	 * Check if metadata has changed for the given radio. If so, new media is
24
+	 * mapped on the master for that radioId.
25
+	 * 
26
+	 * @param radioId
27
+	 * @param media
28
+	 * @return
29
+	 */
30
+	public boolean hasChanged(int radioId, String media) throws RemoteException;
31
+
32
+	/**
33
+	 * Adds to the crawling queue radios os the given companies.
34
+	 * 
35
+	 * @param commaSeparatedCompanyIds
36
+	 *            ex: "4,6,61"
37
+	 * @throws SQLException
38
+	 */
39
+	public boolean loadCompaniesRadios(String commaSeparatedCompanyIds)
40
+			throws SQLException, RemoteException;
41
+
42
+	/**
43
+	 * Adds to the crawling queue a list of radios
44
+	 * 
45
+	 * @param radios
46
+	 *            list of radios
47
+	 */
48
+	public boolean addRadiosToCrawl(List<Radio> radios) throws RemoteException;
49
+
50
+	/**
51
+	 * Only tester if was connected.
52
+	 *  
53
+	 * @throws RemoteException
54
+	 */
55
+	public void connected() throws RemoteException;
56
+
57
+	/**
58
+	 * Tells the master a radio's metadata is not able to be crawled by stream
59
+	 * so the master can send it to be collected by metadata pages(traditional crawling).
60
+	 * @param idRadio
61
+	 * @throws RemoteException
62
+	 */
63
+	public void fail2CollectByStream(int idRadio) throws RemoteException;
64
+
65
+	/**
66
+	 * Allows the external program to ask for a list of 
67
+	 * radios to be crawled.
68
+	 * @param numRadios is how many radios should be sent on response
69
+	 * @param slaveName to identify which slave is asking and how to populate the response
70
+	 * @throws RemoteException
71
+	 */
72
+	public void getRadios2Crawl(int numRadios, String slaveName) throws RemoteException;
73
+	
74
+}

+ 69 - 0
src/main/java/com/rdlze/radializebase/interfaces/InterfaceCrawlerSlave.java

@@ -0,0 +1,69 @@
1
+package com.rdlze.radializebase.interfaces;
2
+
3
+import java.io.Serializable;
4
+import java.rmi.Remote;
5
+import java.rmi.RemoteException;
6
+import java.util.HashSet;
7
+import java.util.List;
8
+
9
+import com.rdlze.radializeutils.objects.Radio;
10
+
11
+public interface InterfaceCrawlerSlave extends Remote, Serializable {
12
+
13
+	public static final int TYPE_MD_CRAWLER = 0;
14
+	public static final int TYPE_MD_BY_STREAM_CRAWLER = 1;
15
+	public static final int TYPE_MD_WITH_JAVA_BY_STREAM_CRAWLER = 2;
16
+	public static final int TYPE_MD_WITH_MPLAYER_BY_STREAM_CRAWLER = 3;
17
+	
18
+	/**
19
+	 * Delivers a radio for the slave to crawl.
20
+	 * @param radio
21
+	 * @throws RemoteException
22
+	 */
23
+	public void notify(Radio radio) throws RemoteException;
24
+
25
+	/**
26
+	 * @return Name of the slave. In most case name is equals to IP.
27
+	 * @throws RemoteException
28
+	 */
29
+	public String getName() throws RemoteException;
30
+
31
+	/**
32
+	 * To check if slave is alive.
33
+	 * @return list of radios being crawled.
34
+	 * @throws RemoteException
35
+	 */
36
+	public List<Integer> ping() throws RemoteException;
37
+
38
+	/** 
39
+	 * @return Actually the max radios the slave is able to crawl.
40
+	 * @throws RemoteException
41
+	 */
42
+	public int getNumCores() throws RemoteException;
43
+	
44
+	/**
45
+	 * Most useful for streamslave, when the master is gonna distribute
46
+	 * radios, and the slave is reconnecting to master, 
47
+	 * having radios already being crawled. So the master will check if more radios are needed
48
+	 * instead of send more.
49
+	 * @return The number of radios being crawled at the moment. 
50
+	 * @throws RemoteException
51
+	 */
52
+	public HashSet<Integer> getCrawlingNow() throws RemoteException;
53
+
54
+	/**
55
+	 * Delivers a list of radios for the slave to crawl.
56
+	 * @param toNotify
57
+	 * @throws RemoteException
58
+	 */
59
+	public void notify(List<Radio> toNotify) throws RemoteException;
60
+
61
+	/**
62
+	 * Defines if the slaves connect only to metadata pages 
63
+	 * or monitor streams to get metadata as soon as they change 
64
+	 * @return
65
+	 * @throws RemoteException
66
+	 */
67
+	public int getCrawlerType() throws RemoteException;
68
+	
69
+}

+ 130 - 0
src/main/java/com/rdlze/radializebase/interfaces/InterfaceIdFinder.java

@@ -0,0 +1,130 @@
1
+package com.rdlze.radializebase.interfaces;
2
+
3
+import java.io.Serializable;
4
+import java.rmi.Remote;
5
+import java.rmi.RemoteException;
6
+
7
+import com.rdlze.radializeutils.objects.BigTitleResp;
8
+import com.rdlze.radializeutils.objects.IndexResponse;
9
+
10
+
11
+/**
12
+ * Remote Interface
13
+ * @author stiilpen
14
+ *
15
+ */
16
+public interface InterfaceIdFinder extends Remote, Serializable {
17
+	/**
18
+	 * Colector search method
19
+	 * @param artist name
20
+	 * @param music name
21
+	 * @return IndexResponse with idMedia,idArtist, idMusic. if one of these ids doesn't exists, returns -1, respectively.
22
+	 */
23
+	public IndexResponse search(String artist, String music) throws RemoteException;
24
+	
25
+	/**
26
+	 * MBHttp makes search slow, so it parameter useMBHttp shall be false for
27
+	 * search server and update server.
28
+	 * @param artist
29
+	 * @param music
30
+	 * @param useMBHTTP
31
+	 * @return
32
+	 * @throws RemoteException
33
+	 */
34
+	public IndexResponse search(String artist, String music, boolean useMBHTTP) throws RemoteException;
35
+	
36
+	/**
37
+	 * User search for music id
38
+	 * @param music
39
+	 * @return musicId if found, -1 if not.
40
+	 */
41
+	public int searchMusic(String music) throws RemoteException;
42
+	
43
+	
44
+	/**
45
+	 * User search for artist id
46
+	 * @param artist
47
+	 * @return artistId if found, -1 if not.
48
+	 */
49
+	public int searchArtist(String artist) throws RemoteException;
50
+	
51
+	/**
52
+	 * User search for artist id by artist alias
53
+	 * @param artist
54
+	 * @return artistId if found, -1 if not.
55
+	 */
56
+	public int searchArtistAlias(String artist) throws RemoteException;
57
+	
58
+	/**
59
+	 * User search for genre id by genre name
60
+	 * @param artist
61
+	 * @return artistId if found, -1 if not.
62
+	 */
63
+	public int searchGenres(String genre) throws RemoteException;
64
+	
65
+	/**
66
+	 * Method to search radio and return the most compatible id
67
+	 * @param radio
68
+	 * @return
69
+	 */
70
+	public int searchRadio(String radio) throws RemoteException;
71
+	
72
+	/**
73
+	 * Method to search tag and return the most compatible id
74
+	 * @param tag name
75
+	 * @return
76
+	 */
77
+	public int searchTags(String tags) throws RemoteException;
78
+	
79
+	/**
80
+	 * UPDATE INSTANCE: Insert Media Index
81
+	 * @param name
82
+	 * @param idMedia
83
+	 * @param idArtist
84
+	 * @param idMusic
85
+	 * @return true if enqueued, false if not.
86
+	 */
87
+	public boolean insertMedia(String name, int idMedia, int idArtist, int idMusic, String mbidArtist, String mbidMusic) throws RemoteException;
88
+	/**
89
+	 * UPDATE INSTANCE: Insert Artist Index
90
+	 * @param name
91
+	 * @param idArtist
92
+	 * @return true if enqueued, false if not.
93
+	 */
94
+	public boolean insertArtist(String name, int idArtist, String mbidArtist) throws RemoteException;
95
+	/**
96
+	 * UPDATE INSTANCE: Insert Music Index
97
+	 * @param name
98
+	 * @param idMusic
99
+	 * @return true if enqueued, false if not.
100
+	 */
101
+	public boolean insertMusic(String name, int idMusic, int artistId, String mbidMusic) throws RemoteException;
102
+	
103
+	/**
104
+	 * Searches artist and song contained in a single String
105
+	 * @param bigTitle
106
+	 * @param numResultsToBeAnalysed
107
+	 * @param shallContainResp the entry bigtitle MUST contain artist and song found on mb search. 
108
+	 * @return 
109
+	 * @throws RemoteException
110
+	 */
111
+	public BigTitleResp searchBigTitle(String bigTitle, int numResultsToBeAnalysed, boolean shallContainResp) throws RemoteException;
112
+
113
+	/**
114
+	 * Checks if the id finder is checking the differences between indexes and tables, so is shall not notified, and index the differences. 
115
+	 * if any new content is inserted, the update server can do the defensive search and assure it will not insert any duplicates.
116
+	 * @return
117
+	 * @throws RemoteException
118
+	 * @throws Exception
119
+	 */
120
+	public Boolean isSynching() throws RemoteException, Exception;
121
+
122
+	/**
123
+	 * Allows the update server to request the idfinder to check differences between indexes and tables
124
+	 * @throws RemoteException
125
+	 */
126
+	public void SynchonizeTableAndIndexes() throws RemoteException;
127
+	
128
+	public int getUpdaterQueueSize() throws RemoteException;
129
+	
130
+}

+ 74 - 0
src/main/java/com/rdlze/radializebase/interfaces/InterfaceMusicBrainzController.java

@@ -0,0 +1,74 @@
1
+package com.rdlze.radializebase.interfaces;
2
+
3
+import java.io.IOException;
4
+
5
+import javax.xml.parsers.ParserConfigurationException;
6
+
7
+import org.apache.lucene.queryparser.classic.ParseException;
8
+import org.xml.sax.SAXException;
9
+
10
+import com.rdlze.radializeutils.objects.BigTitleResp;
11
+import com.rdlze.radializeutils.objects.MBResp;
12
+
13
+
14
+
15
+public interface InterfaceMusicBrainzController {
16
+
17
+	/**
18
+	 * This method searches in music brainz server RMI using the bigTitle
19
+	 * @param bigTitle 
20
+	 * @param nGramSize 
21
+	 * @param mbssi . The Music Brainz Interface RMI
22
+	 * @param numResults
23
+	 * @return
24
+	 * @throws IOException
25
+	 * @throws ParseException
26
+	 * @see BigTitleResp
27
+	 * 
28
+	 */
29
+	public BigTitleResp searchBigTitle(String bigTitle, int nGramSize,  int numResults, boolean shallContainResp) throws  IOException, ParseException;
30
+	
31
+	/**
32
+	 * 
33
+	 * @param bigTitle
34
+	 * @param nGramSize
35
+	 * @return
36
+	 * @throws IOException
37
+	 * @throws ParserConfigurationException
38
+	 * @throws SAXException
39
+	 * @throws InterruptedException
40
+	 */
41
+	
42
+	public MBResp searchBigTitle(String bigTitle, int nGramSize) throws IOException, ParserConfigurationException, SAXException, InterruptedException;
43
+	
44
+	/**This Function searches in music brainz http server the artist and song
45
+
46
+	 * @param artist The artist name to be search
47
+	 * @param song The song name to be search
48
+	 * @param proximitySearch Defines the algorithm to be used, if this value is true, It's acceptable not exactly words
49
+	 * .if this value is false, searches by exactly word 
50
+	 * @param limit The limit of results in music brainz query
51
+	 * @param offset 
52
+	 * @param hostMB  The music brainz host. Default www.radialize.com.br:5000
53
+	 * @return
54
+	 * @throws ParserConfigurationException
55
+	 * @throws SAXException
56
+	 * @throws IOException
57
+	 * @throws InterruptedException
58
+	 * @see MBResp
59
+	 */
60
+	public MBResp searchArtSong(String artist, String song, boolean proximitySearch, int limit, int offset, String hostMB) throws ParserConfigurationException, SAXException, IOException, InterruptedException;
61
+	
62
+	/***
63
+	 * 
64
+	 * @param artist
65
+	 * @param song
66
+	 * @param proximitySearch
67
+	 * @param limit
68
+	 * @param mbssi
69
+	 * @return
70
+	 * @throws ParseException
71
+	 * @throws IOException
72
+	 */
73
+	public MBResp searchArtSong(String artist, String song, boolean proximitySearch, int limit) throws ParseException, IOException;
74
+}

+ 20 - 0
src/main/java/com/rdlze/radializebase/interfaces/InterfaceNotifiable.java

@@ -0,0 +1,20 @@
1
+package com.rdlze.radializebase.interfaces;
2
+
3
+import java.io.Serializable;
4
+import java.rmi.Remote;
5
+import java.rmi.RemoteException;
6
+import java.util.List;
7
+
8
+import com.rdlze.radializeutils.notification.Notification;
9
+
10
+public interface InterfaceNotifiable extends Remote, Serializable {
11
+	
12
+	public void notify(Notification notification) throws RemoteException;
13
+
14
+	public void notify(List list) throws RemoteException;
15
+
16
+	public void registerNotifiable(String IP, String serviceName, int port)
17
+			throws RemoteException;
18
+
19
+	public String getName() throws RemoteException;
20
+}

+ 45 - 0
src/main/java/com/rdlze/radializebase/interfaces/InterfacePlayingNowServer.java

@@ -0,0 +1,45 @@
1
+package com.rdlze.radializebase.interfaces;
2
+
3
+import java.io.Serializable;
4
+import java.rmi.Remote;
5
+import java.rmi.RemoteException;
6
+import java.util.List;
7
+import java.util.Map;
8
+
9
+import com.rdlze.radializeutils.objects.ArtistIdAndTimestamp;
10
+import com.rdlze.radializeutils.objects.Radio;
11
+import com.rdlze.radializeutils.objects.RadioStreamingMetadata;
12
+
13
+
14
+public interface InterfacePlayingNowServer extends Remote, Serializable
15
+{	
16
+	/**
17
+	 * @return List of Radios playing the given artist
18
+	 */
19
+     public  List<Radio> artistPlayingNow(int artistID)throws RemoteException;
20
+     
21
+     /**
22
+      * @return List of Radios playing the given song
23
+      */
24
+	 public  List<Radio> musicPlayingNow(int musicID)throws RemoteException;
25
+	 
26
+	 /**
27
+      * Gets playing media of the given radio
28
+      */
29
+     public  RadioStreamingMetadata getRadioPlayNow(int radioId)throws RemoteException;
30
+     
31
+     /**
32
+      * Gets map of artists playing at the moment
33
+      */
34
+     public  Map<Integer, ArtistIdAndTimestamp> getRadioArtistMap() throws RemoteException;
35
+     
36
+     /**
37
+      * Gets map of songs playing at the moment
38
+      */
39
+     public  Map<Integer, Integer> getRadioSongMap() throws RemoteException;
40
+     
41
+     /**
42
+      * Gets what is playing in a given radio
43
+      */
44
+     public  RadioStreamingMetadata getPlayingMedia(int radioId) throws RemoteException;
45
+}

+ 37 - 0
src/main/java/com/rdlze/radializebase/interfaces/InterfaceSearchServer.java

@@ -0,0 +1,37 @@
1
+package com.rdlze.radializebase.interfaces;
2
+
3
+import java.io.Serializable;
4
+import java.rmi.Remote;
5
+import java.rmi.RemoteException;
6
+import java.util.List;
7
+
8
+import com.rdlze.radializeutils.objects.IndexResponse;
9
+import com.rdlze.radializeutils.objects.SearchBean;
10
+
11
+public interface InterfaceSearchServer extends Remote, Serializable
12
+{
13
+	
14
+	/***
15
+	 * This is the user search. You can search song, artist, genre or radio in database.
16
+	 * @param bean. The bean contains the information about what will search. 
17
+	 * There are two standard parameters, text and type.
18
+	 * Text is the word will search, type is the kind of search{ 0 - All, 1 - Artist, 2 - Song, 3 - Genre, 4 - Radio}
19
+	 * @return IndexResponse
20
+	 * @throws RemoteException
21
+	 * @see {@link SearchBean, IndexResponse}
22
+	 */
23
+	public IndexResponse search(SearchBean bean)throws RemoteException;
24
+	
25
+	
26
+	
27
+	/**
28
+	 * This method get The auto complete set for user.
29
+	 * @param text. Partial text to get auto complete, this text has to have the size bigger than 2
30
+	 * @param quantity. The size of return.
31
+	 * @return List<IndexResponse>
32
+	 * @throws RemoteException 
33
+	 * @see {@link IndexResponse}
34
+	 */
35
+	public List<IndexResponse> autocomplete(String text , int quantity)throws RemoteException;
36
+}
37
+

+ 49 - 0
src/main/java/com/rdlze/radializebase/interfaces/MBSearchServerInterface.java

@@ -0,0 +1,49 @@
1
+package com.rdlze.radializebase.interfaces;
2
+
3
+import java.io.IOException;
4
+import java.io.Serializable;
5
+import java.rmi.Remote;
6
+import java.rmi.RemoteException;
7
+
8
+import org.apache.lucene.queryparser.classic.ParseException;
9
+
10
+/**
11
+ * Class responsible for querying in musicbrainz lucene indexes
12
+ * @author kledilson
13
+ *
14
+ */
15
+public interface MBSearchServerInterface extends Remote, Serializable{
16
+	
17
+	/**
18
+	 * Searches artist and song on musicbrainz lucene indexes
19
+	 * @param search String to be searched
20
+	 * @param index 0 for artist and 1 for song
21
+	 * @param hitsPerPage number of results for the search
22
+	 * @return array of xml with the responses
23
+	 * @throws ParseException
24
+	 * @throws IOException
25
+	 */
26
+	public String[] search(String search, int index, int hitsPerPage) throws ParseException,
27
+	IOException, RemoteException;
28
+	
29
+	/**
30
+	 * Searches for artist and song given and string that may contains artist and song
31
+	 * @param bigTitle String containing artist and song ex: black sabbath paranoid live 1982
32
+	 * @param hitsPerPage number of results for the search
33
+	 * @return array of xml with the responses
34
+	 * @throws RemoteException
35
+	 * @throws ParseException
36
+	 * @throws IOException
37
+	 */
38
+	public String[] searchBigTitle(String bigTitle, int hitsPerPage) throws RemoteException, ParseException, IOException;
39
+	
40
+	/**
41
+	 * Method for registering remotes components
42
+	 * @param remoteObject
43
+	 * @param nameObject
44
+	 * @throws RemoteException
45
+	 */
46
+//	public void registerRemoteObject(Remote remoteObject,
47
+//			String nameObject) throws RemoteException;
48
+	
49
+}

+ 48 - 0
src/main/java/com/rdlze/radializebase/interfaces/MusicBrainzControllerMock.java

@@ -0,0 +1,48 @@
1
+package com.rdlze.radializebase.interfaces;
2
+
3
+import java.io.IOException;
4
+
5
+import javax.xml.parsers.ParserConfigurationException;
6
+
7
+import org.xml.sax.SAXException;
8
+
9
+import com.rdlze.radializeutils.objects.BigTitleResp;
10
+import com.rdlze.radializeutils.objects.MBResp;
11
+
12
+
13
+public class MusicBrainzControllerMock implements
14
+		InterfaceMusicBrainzController {
15
+
16
+	@Override
17
+	public BigTitleResp searchBigTitle(String bigTitle, int nGramSize,
18
+			int numResults, boolean shallContainResp) throws IOException {
19
+		if(bigTitle!=null && bigTitle.toLowerCase().equals("black sabbath paranoid"))
20
+			return new BigTitleResp("Black Sabbath", "Paranoid");
21
+		return new BigTitleResp("", "");
22
+	}
23
+
24
+	@Override
25
+	public MBResp searchBigTitle(String bigTitle, int nGramSize)
26
+			throws IOException, ParserConfigurationException, SAXException,
27
+			InterruptedException {
28
+		// TODO Auto-generated method stub
29
+		return null;
30
+	}
31
+
32
+	@Override
33
+	public MBResp searchArtSong(String artist, String song,
34
+			boolean proximitySearch, int limit, int offset, String hostMB)
35
+			throws ParserConfigurationException, SAXException, IOException,
36
+			InterruptedException {
37
+		// TODO Auto-generated method stub
38
+		return null;
39
+	}
40
+
41
+	@Override
42
+	public MBResp searchArtSong(String artist, String song,
43
+			boolean proximitySearch, int limit) throws IOException {
44
+		// TODO Auto-generated method stub
45
+		return null;
46
+	}
47
+
48
+}

+ 116 - 0
src/main/java/com/rdlze/radializebase/interfaces/RemoteRadializeBatchFacade.java

@@ -0,0 +1,116 @@
1
+package com.rdlze.radializebase.interfaces;
2
+
3
+import java.rmi.RemoteException;
4
+import java.util.List;
5
+
6
+import com.idealizeframework.irf.base.facade.RemoteFacade;
7
+import com.rdlze.radializebase.utils.AIRecommendedItem;
8
+
9
+/**
10
+ * 
11
+ * @author Alex Amorim Dutra
12
+ * 
13
+ */
14
+public interface RemoteRadializeBatchFacade extends RemoteFacade {
15
+
16
+	/**
17
+	 * Process the recommendations request
18
+	 * 
19
+	 * @param input
20
+	 *            String with input from client
21
+	 * @return String with the recommendations
22
+	 * @throws RemoteException
23
+	 *             thrown when this object cannot be accessed remotely
24
+	 */
25
+	public String getRecommendations(String input) throws RemoteException;
26
+	
27
+	// search by artist
28
+	// 1
29
+	public List<AIRecommendedItem> searchByArtistReturnArtists(long userId,
30
+			List<Integer> artistsIds, int howMany) throws RemoteException;
31
+
32
+	// 2
33
+	public List<AIRecommendedItem> searchByArtistReturnSongs(long userId,
34
+			List<Integer> artistsIds, int howMany) throws RemoteException;
35
+
36
+	// 3
37
+	public List<AIRecommendedItem> searchByArtistReturnRadios(long userId,
38
+			List<Integer> artistsIds, int howMany) throws RemoteException;
39
+
40
+	// 4
41
+	public List<AIRecommendedItem> searchByArtistReturnTags(long userId,
42
+			List<Integer> artistsIds, int howMany) throws RemoteException;
43
+
44
+	// search by song
45
+	// 5
46
+	public List<AIRecommendedItem> searchBySongReturnArtists(long userId,
47
+			List<Integer> songsIds, int howMany) throws RemoteException;
48
+
49
+	// 6
50
+	public List<AIRecommendedItem> searchBySongReturnSongs(long userId,
51
+			List<Integer> songsIds, int howMany) throws RemoteException;
52
+
53
+	// 7
54
+	public List<AIRecommendedItem> searchBySongReturnRadios(long userId,
55
+			List<Integer> songsIds, int howMany) throws RemoteException;
56
+
57
+	// 8
58
+	public List<AIRecommendedItem> searchBySongReturnTags(long userId,
59
+			List<Integer> songsIds, int howMany) throws RemoteException;
60
+
61
+	// search by radio
62
+	// 9
63
+	public List<AIRecommendedItem> searchByRadioReturnArtists(long userId,
64
+			List<Integer> radiosIds, int howMany) throws RemoteException;
65
+
66
+	// 10
67
+	public List<AIRecommendedItem> searchByRadioReturnSongs(long userId,
68
+			List<Integer> radiosIds, int howMany) throws RemoteException;
69
+
70
+	// 11
71
+	public List<AIRecommendedItem> searchByRadioReturnRadios(long userId,
72
+			List<Integer> radiosIds, int howMany) throws RemoteException;
73
+
74
+	// 12
75
+	public List<AIRecommendedItem> searchByRadioReturnTags(long userId,
76
+			List<Integer> radiosIds, int howMany) throws RemoteException;
77
+
78
+	// search by tag
79
+	// 13
80
+	public List<AIRecommendedItem> searchByTagReturnArtists(long userId,
81
+			List<Integer> tagsIds, int howMany) throws RemoteException;
82
+
83
+	// 14
84
+	public List<AIRecommendedItem> searchByTagReturnSongs(long userId,
85
+			List<Integer> tagsIds, int howMany) throws RemoteException;
86
+
87
+	// 15
88
+	public List<AIRecommendedItem> searchByTagReturnRadios(long userId,
89
+			List<Integer> tagsIds, int howMany) throws RemoteException;
90
+
91
+	// 16
92
+	public List<AIRecommendedItem> searchByTagReturnTags(long userId,
93
+			List<Integer> tagsIds, int howMany) throws RemoteException;
94
+
95
+	// get recommendations
96
+	// 17
97
+	public List<AIRecommendedItem> getRecommendationsArtists(long userId,
98
+			int howMany, List<Integer> momentsIds) throws RemoteException;
99
+
100
+	// 18
101
+	public List<AIRecommendedItem> getRecommendationsSongs(long userId,
102
+			int howMany, List<Integer> momentsIds) throws RemoteException;
103
+
104
+	// 19
105
+	public List<AIRecommendedItem> getRecommendationsRadios(long userId,
106
+			int howMany, List<Integer> momentsIds) throws RemoteException;
107
+
108
+	// 20
109
+	public List<AIRecommendedItem> getRecommendationsTags(long userId,
110
+			int howMany, List<Integer> momentsIds) throws RemoteException;
111
+
112
+	// 21
113
+	public List<AIRecommendedItem> getRecommendationsFriends(long userId,
114
+			int howMany, List<Integer> momentsIds) throws RemoteException;
115
+
116
+}

+ 106 - 0
src/main/java/com/rdlze/radializebase/interfaces/RemoteRadializeCacheFacade.java

@@ -0,0 +1,106 @@
1
+package com.rdlze.radializebase.interfaces;
2
+
3
+import java.rmi.RemoteException;
4
+import java.util.List;
5
+
6
+import com.idealizeframework.irf.base.facade.RemoteFacade;
7
+import com.rdlze.radializebase.utils.AIRecommendedItem;
8
+import com.rdlze.radializebase.utils.FilterBean;
9
+
10
+/**
11
+ * 
12
+ * @author Alex Amorim Dutra
13
+ * 
14
+ */
15
+public interface RemoteRadializeCacheFacade extends RemoteFacade {
16
+
17
+	// search by artist
18
+	// 1
19
+	public List<AIRecommendedItem> searchByArtistReturnArtists(long userId,
20
+			List<Integer> artistsIds, int howMany, FilterBean filters) throws RemoteException;
21
+
22
+	// 2
23
+	public List<AIRecommendedItem> searchByArtistReturnSongs(long userId,
24
+			List<Integer> artistsIds, int howMany, FilterBean filters) throws RemoteException;
25
+
26
+	// 3
27
+	public List<AIRecommendedItem> searchByArtistReturnRadios(long userId,
28
+			List<Integer> artistsIds, int howMany, FilterBean filters) throws RemoteException;
29
+
30
+	// 4
31
+	public List<AIRecommendedItem> searchByArtistReturnTags(long userId,
32
+			List<Integer> artistsIds, int howMany, FilterBean filters) throws RemoteException;
33
+
34
+	// search by song
35
+	// 5
36
+	public List<AIRecommendedItem> searchBySongReturnArtists(long userId,
37
+			List<Integer> songsIds, int howMany, FilterBean filters) throws RemoteException;
38
+
39
+	// 6
40
+	public List<AIRecommendedItem> searchBySongReturnSongs(long userId,
41
+			List<Integer> songsIds, int howMany, FilterBean filters) throws RemoteException;
42
+
43
+	// 7
44
+	public List<AIRecommendedItem> searchBySongReturnRadios(long userId,
45
+			List<Integer> songsIds, int howMany, FilterBean filters) throws RemoteException;
46
+
47
+	// 8
48
+	public List<AIRecommendedItem> searchBySongReturnTags(long userId,
49
+			List<Integer> songsIds, int howMany, FilterBean filters) throws RemoteException;
50
+
51
+	// search by radio
52
+	// 9
53
+	public List<AIRecommendedItem> searchByRadioReturnArtists(long userId,
54
+			List<Integer> radiosIds, int howMany, FilterBean filters) throws RemoteException;
55
+
56
+	// 10
57
+	public List<AIRecommendedItem> searchByRadioReturnSongs(long userId,
58
+			List<Integer> radiosIds, int howMany, FilterBean filters) throws RemoteException;
59
+
60
+	// 11
61
+	public List<AIRecommendedItem> searchByRadioReturnRadios(long userId,
62
+			List<Integer> radiosIds, int howMany, FilterBean filters) throws RemoteException;
63
+
64
+	// 12
65
+	public List<AIRecommendedItem> searchByRadioReturnTags(long userId,
66
+			List<Integer> radiosIds, int howMany, FilterBean filters) throws RemoteException;
67
+
68
+	// search by tag
69
+	// 13
70
+	public List<AIRecommendedItem> searchByTagReturnArtists(long userId,
71
+			List<Integer> tagsIds, int howMany, FilterBean filters) throws RemoteException;
72
+
73
+	// 14
74
+	public List<AIRecommendedItem> searchByTagReturnSongs(long userId,
75
+			List<Integer> tagsIds, int howMany, FilterBean filters) throws RemoteException;
76
+
77
+	// 15
78
+	public List<AIRecommendedItem> searchByTagReturnRadios(long userId,
79
+			List<Integer> tagsIds, int howMany, FilterBean filters) throws RemoteException;
80
+
81
+	// 16
82
+	public List<AIRecommendedItem> searchByTagReturnTags(long userId,
83
+			List<Integer> tagsIds, int howMany,FilterBean filters) throws RemoteException;
84
+
85
+	// get recommendations
86
+	// 17
87
+	public List<AIRecommendedItem> getRecommendationsArtists(long userId,
88
+			int howMany, List<Integer> momentsIds, FilterBean filters) throws RemoteException;
89
+
90
+	// 18
91
+	public List<AIRecommendedItem> getRecommendationsSongs(long userId,
92
+			int howMany, List<Integer> momentsIds, FilterBean filters) throws RemoteException;
93
+
94
+	// 19
95
+	public List<AIRecommendedItem> getRecommendationsRadios(long userId,
96
+			int howMany, List<Integer> momentsIds, FilterBean filters) throws RemoteException;
97
+
98
+	// 20
99
+	public List<AIRecommendedItem> getRecommendationsTags(long userId,
100
+			int howMany, List<Integer> momentsIds, FilterBean filters) throws RemoteException;
101
+
102
+	// 21
103
+	public List<AIRecommendedItem> getRecommendationsFriends(long userId,
104
+			int howMany, List<Integer> momentsIds, FilterBean filters) throws RemoteException;
105
+
106
+}

+ 174 - 0
src/main/java/com/rdlze/radializebase/mocks/MockBroker.java

@@ -0,0 +1,174 @@
1
+package com.rdlze.radializebase.mocks;
2
+
3
+import java.rmi.NotBoundException;
4
+import java.rmi.RemoteException;
5
+import java.rmi.registry.LocateRegistry;
6
+import java.rmi.registry.Registry;
7
+import java.rmi.server.UnicastRemoteObject;
8
+import java.util.ArrayList;
9
+import java.util.List;
10
+import java.util.Queue;
11
+import java.util.concurrent.ConcurrentLinkedQueue;
12
+
13
+import com.rdlze.radializebase.interfaces.InterfaceNotifiable;
14
+import com.rdlze.radializeutils.notification.Notification;
15
+
16
+
17
+public class MockBroker implements InterfaceNotifiable {
18
+	/**
19
+	 * 
20
+	 */
21
+	private static final long serialVersionUID = 1L;
22
+	private static InterfaceNotifiable notifiable;
23
+	private List<InterfaceNotifiable> registeredNotifiables;
24
+	public Queue<Notification> queConc;
25
+	String name = "";
26
+	MockNotifiable mn = null;
27
+	public MockBroker(String name){
28
+		this.name=name;
29
+		queConc = new ConcurrentLinkedQueue<Notification>();
30
+		registeredNotifiables = new ArrayList<InterfaceNotifiable>();
31
+
32
+		NotifierThread not = new NotifierThread(this); // Thread "consumidor"
33
+		not.start();
34
+
35
+		try {
36
+			LocateRegistry.createRegistry(15000);
37
+		} catch (Exception e) {
38
+			System.out.println("createRegistryException....");
39
+		}
40
+
41
+		try {
42
+			InterfaceNotifiable stub = (InterfaceNotifiable) UnicastRemoteObject.exportObject(
43
+					this, 0);
44
+			Registry registry = LocateRegistry.getRegistry(15000);
45
+			registry.rebind(name, stub);
46
+			System.out.println("MockBroker - OnLine");
47
+		} catch (Exception e) {
48
+			e.printStackTrace();
49
+		}
50
+	}
51
+	@Override
52
+	public void notify(Notification notification) throws RemoteException {
53
+		System.out.println(this.getName()+" received notification "+notification.getRadioId());
54
+		queConc.add(notification);
55
+	}
56
+
57
+	@Override
58
+	public void notify(List list) throws RemoteException {
59
+		System.out.println("received list");
60
+		queConc.addAll(list);
61
+	}
62
+
63
+	@Override
64
+	public void registerNotifiable(String IP, String serviceName, int port)
65
+			throws RemoteException {
66
+		try {
67
+			System.out
68
+			.println("COMPONENTE TENTANDO SE REGISTRAR  NO BROKEN     IP = "
69
+					+ IP + "     NAME = " + serviceName);
70
+			Registry registry = LocateRegistry.getRegistry(IP, port);
71
+			notifiable = (InterfaceNotifiable) registry.lookup(serviceName);
72
+			registeredNotifiables.add(notifiable);
73
+			System.out.println("Conectou no  " + notifiable.getName()
74
+					+ " com sucesso");
75
+			System.out.println("COMPONENTE = " + notifiable.getName()
76
+					+ " SE CONECTOU NO BROKEN COM SUCESSO");
77
+		} catch (RemoteException e) {
78
+			e.printStackTrace();
79
+			System.out.println((new StringBuilder("RemoteException")).append(e)
80
+					.toString());
81
+		} catch (NotBoundException e) {
82
+			e.printStackTrace();
83
+			System.out.println((new StringBuilder("NotBoun1dException"))
84
+					.append(e).toString());
85
+		} catch (Exception e) {
86
+			e.printStackTrace();
87
+			System.out.println((new StringBuilder("Exception")).append(e)
88
+					.toString());
89
+		}
90
+	}
91
+
92
+	@Override
93
+	public String getName() throws RemoteException {
94
+		return this.name;
95
+	}
96
+
97
+	public static void main(String[] args){
98
+		new MockNotifiable("teste");
99
+	}
100
+
101
+	private Queue<Notification> getQuee() {
102
+		return this.queConc;
103
+	}
104
+
105
+	public List<InterfaceNotifiable> getRegistersNotifiable() {
106
+		return this.registeredNotifiables;
107
+	}
108
+
109
+	private final class NotifierThread extends Thread {
110
+		MockBroker noticationBroken;
111
+
112
+		public NotifierThread(MockBroker noticationBroken) {
113
+			this.noticationBroken = noticationBroken;
114
+			System.out.println("NotifierThread init...");
115
+		}
116
+
117
+		public void run() {
118
+
119
+			int indexerControllerExceptionCount = 0;
120
+			int streamCrawlerExceptionCount = 0;
121
+			while (true) {
122
+				try {
123
+					if (this.noticationBroken.getQuee().size() > 0) {
124
+						Notification value = null;
125
+						while ((value = (Notification) this.noticationBroken
126
+								.getQuee().poll()) != null) {
127
+							for (int i = this.noticationBroken
128
+									.getRegistersNotifiable().size(); --i >= 0;) {
129
+								try {
130
+									((InterfaceNotifiable) this.noticationBroken
131
+											.getRegistersNotifiable().get(i))
132
+											.notify(value);
133
+								} catch (RemoteException e) {
134
+									InterfaceNotifiable topNot = this.noticationBroken
135
+											.getRegistersNotifiable().get(i);
136
+									if (topNot.getName().equals(
137
+											"IndexerControler"))
138
+										;
139
+									{
140
+										indexerControllerExceptionCount++;
141
+										if (indexerControllerExceptionCount == 10)
142
+											this.noticationBroken
143
+											.getRegistersNotifiable()
144
+											.remove(i);
145
+									}
146
+									if (topNot.getName()
147
+											.equals("StreamCrawler"))
148
+										;
149
+									{
150
+										streamCrawlerExceptionCount++;
151
+										if (streamCrawlerExceptionCount == 10)
152
+											this.noticationBroken
153
+											.getRegistersNotifiable()
154
+											.remove(i);
155
+									}
156
+									System.out.println("Error: "
157
+											+ e.getMessage());
158
+									e.printStackTrace();
159
+								} catch (Exception e) {
160
+									System.out.println(e.getMessage());
161
+								}
162
+							}
163
+						}
164
+					} else
165
+						Thread.sleep(100);
166
+				} catch (Exception e) {
167
+					System.out.println("Error: " + e.getMessage());
168
+					e.printStackTrace();
169
+				}
170
+			}
171
+		}
172
+	}
173
+
174
+}

+ 62 - 0
src/main/java/com/rdlze/radializebase/mocks/MockNotifiable.java

@@ -0,0 +1,62 @@
1
+package com.rdlze.radializebase.mocks;
2
+
3
+import java.rmi.RemoteException;
4
+import java.rmi.registry.LocateRegistry;
5
+import java.rmi.registry.Registry;
6
+import java.rmi.server.UnicastRemoteObject;
7
+import java.util.List;
8
+
9
+import com.rdlze.radializebase.interfaces.InterfaceNotifiable;
10
+import com.rdlze.radializeutils.notification.Notification;
11
+
12
+
13
+public class MockNotifiable implements InterfaceNotifiable {
14
+	/**
15
+	 * 
16
+	 */
17
+	private static final long serialVersionUID = 1L;
18
+	String name = "";
19
+	MockNotifiable mn = null;
20
+	public MockNotifiable(String name){
21
+		this.name=name;
22
+		
23
+		try {
24
+			LocateRegistry.createRegistry(1099);
25
+		} catch (Exception e) {
26
+			System.out.println("createRegistryException....");
27
+		}
28
+
29
+		try {
30
+			InterfaceNotifiable stub = (InterfaceNotifiable) UnicastRemoteObject.exportObject(
31
+					this, 0);
32
+			Registry registry = LocateRegistry.getRegistry(1099);
33
+			registry.rebind(name, stub);
34
+			System.out.println("MockNotifiable - OnLine");
35
+		} catch (Exception e) {
36
+			e.printStackTrace();
37
+		}
38
+	}
39
+	@Override
40
+	public void notify(Notification notification) throws RemoteException {
41
+		System.out.println(this.getName()+" received notification "+notification.getRadioId());
42
+	}
43
+
44
+	@Override
45
+	public void notify(List list) throws RemoteException {
46
+		System.out.println("received list");
47
+	}
48
+
49
+	@Override
50
+	public void registerNotifiable(String IP, String serviceName, int port)
51
+			throws RemoteException {
52
+	}
53
+
54
+	@Override
55
+	public String getName() throws RemoteException {
56
+		return this.name;
57
+	}
58
+
59
+	public static void main(String[] args){
60
+		new MockNotifiable("teste");
61
+	}
62
+}

+ 148 - 0
src/main/java/com/rdlze/radializebase/notification/Notifier.java

@@ -0,0 +1,148 @@
1
+package com.rdlze.radializebase.notification;
2
+
3
+import java.rmi.NotBoundException;
4
+import java.rmi.RemoteException;
5
+import java.rmi.registry.LocateRegistry;
6
+import java.rmi.registry.Registry;
7
+
8
+import com.rdlze.radializebase.interfaces.InterfaceNotifiable;
9
+import com.rdlze.radializeutils.notification.Notification;
10
+
11
+public final class Notifier {
12
+	private static InterfaceNotifiable notifiable;
13
+	private static InterfaceNotifiable[] notifiables;
14
+	private static boolean[] needReconnect;
15
+	private static boolean severalBrokers = false;
16
+	private static String componentsName;
17
+	private static String[] ips;
18
+	private static NeedForReconnectChecker reconnecter = null;
19
+
20
+	int config;
21
+
22
+	public Notifier() {
23
+	}
24
+
25
+	public static final boolean init(String notificationSubjectIPAddress,
26
+			String notificationSubjectServiceName, int port) {
27
+		try {
28
+
29
+			// Se Registra no BrokenServer
30
+			Registry registry = LocateRegistry
31
+					.getRegistry(notificationSubjectIPAddress, port);
32
+			System.out.println("buggable " + notificationSubjectServiceName
33
+					+ " " + notificationSubjectIPAddress);
34
+			notifiable = (InterfaceNotifiable) registry
35
+					.lookup(notificationSubjectServiceName);
36
+		} catch (RemoteException e) {
37
+			e.printStackTrace();
38
+		} catch (NotBoundException e) {
39
+			e.printStackTrace();
40
+		} catch (Exception e) {
41
+			e.printStackTrace();
42
+		}
43
+		return true;
44
+	}
45
+
46
+	public static final synchronized void notify(Notification n)
47
+			throws RemoteException {
48
+		if(severalBrokers)
49
+			for(int i = 0; i < notifiables.length; i++){
50
+				InterfaceNotifiable iN = notifiables[i];
51
+				try{
52
+					iN.notify(n);
53
+				}catch(Exception e){
54
+					needReconnect[i] = true;
55
+					e.printStackTrace();
56
+				}
57
+			}
58
+		else
59
+			notifiable.notify(n);
60
+	}
61
+
62
+	public static final synchronized void register(String IP, String name, int port)
63
+			throws RemoteException {
64
+		notifiable.registerNotifiable(IP, name, port);
65
+	}
66
+
67
+	/**
68
+	 * Method to connect to several broker to notify.
69
+	 * @param brokerIp Ips separated by comma
70
+	 * @param notificationSubjectServiceName Name of the component which you are connecting to.
71
+	 * @param shallSplitIps True if is connecting to several brokers.
72
+	 */
73
+	public static void init(String brokerIp, String notificationSubjectServiceName, int port,
74
+			boolean shallSplitIps) {
75
+		severalBrokers=true;
76
+		System.out.println("init broker");
77
+		ips = brokerIp.split(",");
78
+		System.out.println("creating notifiables");
79
+		notifiables = new InterfaceNotifiable[ips.length];
80
+
81
+		System.out.println("enter for; split length: "+ ips.length);
82
+		needReconnect = new boolean[ips.length];
83
+		componentsName = notificationSubjectServiceName;
84
+		for(int i = 0 ; i < ips.length; i++){
85
+
86
+			try {
87
+				Thread.sleep(1000);
88
+			} catch (InterruptedException e1) {
89
+				e1.printStackTrace();
90
+			}
91
+			connectTo(notificationSubjectServiceName, i);
92
+		}
93
+
94
+		if(severalBrokers&&reconnecter==null){
95
+			reconnecter = new NeedForReconnectChecker();
96
+			reconnecter.start();
97
+		}
98
+
99
+	}
100
+
101
+	private static void connectTo(String notificationSubjectServiceName, int i) {
102
+		String ip = ips[i].trim();
103
+		try {
104
+			System.out.println("getting broker registry 2 connect" + notificationSubjectServiceName
105
+					+ " " + ip);
106
+			// Se Registra no BrokenServer
107
+			Registry registry = LocateRegistry
108
+					.getRegistry(ip);
109
+
110
+			notifiables[i] = (InterfaceNotifiable) registry
111
+					.lookup(notificationSubjectServiceName);
112
+
113
+			needReconnect[i] = false;
114
+			System.out.println("buggable " + notificationSubjectServiceName
115
+					+ " " + ip);
116
+		} catch (RemoteException e) {
117
+			e.printStackTrace();
118
+		} catch (NotBoundException e) {
119
+			e.printStackTrace();
120
+		} catch (Exception e) {
121
+			e.printStackTrace();
122
+		}
123
+	}
124
+
125
+	private static class NeedForReconnectChecker extends Thread{
126
+
127
+		public NeedForReconnectChecker(){}
128
+
129
+		public void run(){
130
+			while(true){
131
+				try {
132
+					if(needReconnect!=null)
133
+						System.out.println("Checking need for reconnecting...");
134
+					for(int i = 0; i < needReconnect.length; i++){
135
+						if(needReconnect[i]){
136
+							connectTo(componentsName, i);
137
+						}
138
+					}
139
+
140
+					sleep(60000);
141
+				} catch (InterruptedException e) {
142
+					// TODO Auto-generated catch block
143
+					e.printStackTrace();
144
+				}
145
+			}
146
+		}
147
+	}
148
+}

+ 63 - 0
src/main/java/com/rdlze/radializebase/notification/NotifierObject.java

@@ -0,0 +1,63 @@
1
+package com.rdlze.radializebase.notification;
2
+
3
+
4
+import java.rmi.NotBoundException;
5
+import java.rmi.RemoteException;
6
+import java.rmi.registry.LocateRegistry;
7
+import java.rmi.registry.Registry;
8
+
9
+import com.rdlze.radializebase.interfaces.InterfaceNotifiable;
10
+import com.rdlze.radializebase.interfaces.InterfaceSearchServer;
11
+import com.rdlze.radializeutils.notification.Notification;
12
+
13
+
14
+public class NotifierObject
15
+{
16
+   private static InterfaceNotifiable notifiable;
17
+   private static InterfaceSearchServer interfaceSearcher;
18
+   //private static InterfaceMediaRefreshServer interfaceMediaRefreshServer;
19
+   Registry registry;
20
+	
21
+	public NotifierObject()
22
+	{
23
+	    try
24
+	    {	
25
+	    	//Conecta no Broken
26
+	 	    registry = LocateRegistry.getRegistry("200.239.133.6");
27
+            notifiable = (InterfaceNotifiable)registry.lookup("NotificationBroker");  
28
+            
29
+            //Conecta no SearchServer
30
+            registry = LocateRegistry.getRegistry("200.239.133.206");
31
+    		interfaceSearcher = (InterfaceSearchServer)registry.lookup("SearchServer");	 	
32
+    		 
33
+    		
34
+    		 //Conecta no MediaRefreshServer
35
+            // registry = LocateRegistry.getRegistry("200.239.133.25");
36
+            // interfaceMediaRefreshServer = (InterfaceMediaRefreshServer)registry.lookup("MediaRefreshServer");      
37
+              		
38
+	     }	
39
+         catch(RemoteException e)
40
+         {
41
+            e.printStackTrace();
42
+         }
43
+         catch(NotBoundException e)
44
+         {
45
+             e.printStackTrace();
46
+        }
47
+        catch(Exception e)
48
+        {
49
+    	    e.printStackTrace();
50
+        }	    
51
+   }	
52
+	
53
+	/*public void notifyNewRefreshMedia(int conf) throws RemoteException
54
+	{		
55
+		 interfaceMediaRefreshServer.notifyRefreshIndex(conf);		 
56
+	}	*/
57
+	
58
+	
59
+	public void brokenNotify(Notification  n) throws RemoteException
60
+	{	  		    	
61
+	    notifiable.notify(n);		 
62
+	}
63
+}

+ 15 - 0
src/main/java/com/rdlze/radializebase/notification/SearchNotifiable.java

@@ -0,0 +1,15 @@
1
+package com.rdlze.radializebase.notification;
2
+
3
+import java.io.Serializable;
4
+import java.rmi.Remote;
5
+import java.rmi.RemoteException;
6
+
7
+import com.rdlze.radializeutils.objects.RadioStreamingMetadata;
8
+
9
+
10
+public interface SearchNotifiable extends Remote, Serializable
11
+{
12
+    public abstract void searchNotify(RadioStreamingMetadata data, int config) throws RemoteException;
13
+}
14
+
15
+

+ 235 - 0
src/main/java/com/rdlze/radializebase/utils/AIRecommendedItem.java

@@ -0,0 +1,235 @@
1
+package com.rdlze.radializebase.utils;
2
+
3
+import java.io.Serializable;
4
+
5
+/**
6
+ * This class represents a item id and value, this value may be compared if
7
+ * required to do the sorting.
8
+ * 
9
+ * @author Alex Amorim Dutra
10
+ * 
11
+ */
12
+public class AIRecommendedItem implements Comparable<AIRecommendedItem>,
13
+		Serializable {
14
+
15
+	/**
16
+	 * Default Serial version
17
+	 */
18
+	private static final long serialVersionUID = 1L;
19
+
20
+	private long itemId;
21
+
22
+	private float value;
23
+
24
+	private float popularity;
25
+
26
+	private float unknown = 1;
27
+
28
+	private float age;
29
+
30
+	private String locality;
31
+
32
+	private boolean answeredAllFilters;
33
+
34
+	private String sortBy;
35
+
36
+	private int intSortBy;
37
+
38
+	private int searchFeedBack;
39
+
40
+	/**
41
+	 * Class constructor.
42
+	 * 
43
+	 * @param itemId
44
+	 *            integer with item id.
45
+	 * @param value
46
+	 *            float with value of ranking to item.
47
+	 * @param popularity
48
+	 *            float with popularity of item.
49
+	 * @param unknown
50
+	 *            float with the value of unknown items by user.
51
+	 * @param age
52
+	 *            float with age of item.
53
+	 * @param locality
54
+	 *            String with locality of item.
55
+	 * @param sortBy
56
+	 *            String indicating sort by popularity or unknown or age or
57
+	 *            locality.
58
+	 */
59
+	public AIRecommendedItem(long itemId, float value, float popularity,
60
+			float unknown, float age, String locality, String sortBy) {
61
+		this.itemId = itemId;
62
+		this.value = value;
63
+		this.age = age;
64
+		this.popularity = popularity;
65
+		this.unknown = unknown;
66
+		this.locality = locality;
67
+		this.sortBy = sortBy.toLowerCase();
68
+		if (sortBy.equals("popularity")) {
69
+			intSortBy = 1;
70
+		} else if (sortBy.equals("unknow")) {
71
+			intSortBy = 2;
72
+		} else if (sortBy.equals("age")) {
73
+			intSortBy = 3;
74
+		} else if (sortBy.equals("locality")) {
75
+			intSortBy = 4;
76
+		} else {
77
+			intSortBy = 5;
78
+		}
79
+	}
80
+
81
+	public long getItemID() {
82
+		return itemId;
83
+	}
84
+
85
+	/**
86
+	 * set doc ID.
87
+	 * 
88
+	 * @param itemId
89
+	 *            item id to be set
90
+	 */
91
+	public void setItemID(int itemId) {
92
+		this.itemId = itemId;
93
+	}
94
+
95
+	/**
96
+	 * Get value times.
97
+	 * 
98
+	 * @return float value times
99
+	 */
100
+	public float getValue() {
101
+		return value;
102
+	}
103
+
104
+	/**
105
+	 * set value times.
106
+	 * 
107
+	 * @param newValue
108
+	 *            times that the item will appear
109
+	 */
110
+	public void setValue(float newValue) {
111
+		this.value = newValue;
112
+	}
113
+
114
+	public float getAge() {
115
+		return age;
116
+	}
117
+
118
+	public void setAge(float age) {
119
+		this.age = age;
120
+	}
121
+
122
+	public float getUnknown() {
123
+		return unknown;
124
+	}
125
+
126
+	public void setUnknown(float unknown) {
127
+		this.unknown = unknown;
128
+	}
129
+
130
+	public float getPopularity() {
131
+		return popularity;
132
+	}
133
+
134
+	public void setPopularity(float popularity) {
135
+		this.popularity = popularity;
136
+	}
137
+
138
+	public String getLocality() {
139
+		return locality;
140
+	}
141
+
142
+	public void setLocality(String locality) {
143
+		this.locality = locality;
144
+	}
145
+
146
+	public String getSortBy() {
147
+		return sortBy;
148
+	}
149
+
150
+	public boolean isAnsweredAllFilters() {
151
+		return answeredAllFilters;
152
+	}
153
+
154
+	public void setAnsweredAllFilters(boolean answeredAllFilters) {
155
+		this.answeredAllFilters = answeredAllFilters;
156
+	}
157
+	
158
+	public int getSearchFeedBack() {
159
+		return searchFeedBack;
160
+	}
161
+
162
+	public void setSearchFeedBack(int searchFeedBack) {
163
+		this.searchFeedBack = searchFeedBack;
164
+	}
165
+
166
+	/**
167
+	 * Indicates which feature is used to sorted the list.
168
+	 * 
169
+	 * @param sortBy
170
+	 *            String with feature to sort by.
171
+	 */
172
+	public void setSortBy(String sortBy) {
173
+		this.sortBy = sortBy.toLowerCase();
174
+		if (sortBy.equals("popularity")) {
175
+			intSortBy = 1;
176
+		} else if (sortBy.equals("unknow")) {
177
+			intSortBy = 2;
178
+		} else if (sortBy.equals("age")) {
179
+			intSortBy = 3;
180
+		} else if (sortBy.equals("locality")) {
181
+			intSortBy = 4;
182
+		} else {
183
+			intSortBy = 5;
184
+		}
185
+	}
186
+
187
+	public int compareTo(AIRecommendedItem item) {
188
+		float value1;
189
+		float value2;
190
+		switch (this.intSortBy) {
191
+		case 1:
192
+			value1 = item.getPopularity();
193
+			value2 = this.getPopularity();
194
+			break;
195
+		case 2:
196
+			value1 = item.getUnknown();
197
+			value2 = this.getUnknown();
198
+			break;
199
+		case 3:
200
+			value1 = item.getAge();
201
+			value2 = this.getAge();
202
+			break;
203
+		case 4:
204
+			value1 = Integer.parseInt(item.getLocality());
205
+			value2 = Integer.parseInt(this.getLocality());
206
+			break;
207
+		default:
208
+			value1 = item.getValue();
209
+			value2 = this.getValue();
210
+			break;
211
+		}
212
+
213
+		if (value1 > value2)
214
+			return 1;
215
+		else if (value1 < value2)
216
+			return -1;
217
+		else
218
+			return 0;
219
+	}
220
+
221
+	public String toString() {
222
+		return "ID: " + itemId + ", VALUE.: " + value + " NOVELTY: " + unknown
223
+				+ " ISPLAYING: " + searchFeedBack;
224
+		// return "ITEM ID: " + itemId + " VALUE: " + value + " NOVELTY: "
225
+		// + unknown + " POPULARITY: " + popularity
226
+		// + " ANSWERED ALL FILTERS: " + answeredAllFilters+"...... ";
227
+	}
228
+
229
+	public boolean equals(AIRecommendedItem recItem) {
230
+		if (this.itemId == recItem.itemId)
231
+			return true;
232
+
233
+		return false;
234
+	}
235
+}

+ 62 - 0
src/main/java/com/rdlze/radializebase/utils/AllFilters.java

@@ -0,0 +1,62 @@
1
+package com.rdlze.radializebase.utils;
2
+
3
+public class AllFilters extends FilterBean {
4
+
5
+	/**
6
+	 * Default serial version
7
+	 */
8
+	private static final long serialVersionUID = 1L;
9
+
10
+	private int useNovelty = 0;
11
+
12
+	private int usePopularity = 0;
13
+
14
+	public AllFilters() {
15
+
16
+	}
17
+
18
+	public AllFilters(int useNovelty) {
19
+		this.useNovelty = useNovelty;
20
+	}
21
+
22
+	public AllFilters(int useNovelty, int usePopularity) {
23
+		this.useNovelty = useNovelty;
24
+		this.usePopularity = usePopularity;
25
+	}
26
+
27
+	/**
28
+	 * Indica se devera ser retornado somente itens desconhecidos, itens
29
+	 * conhecidos ou tanto faz. O valor -1 indica o retorno de itens conhecidos.
30
+	 * O valor 1 indica o retorno de itens desconhecidos, isto se houver itens
31
+	 * desconhecidos para completar a lista de recomendacao. O valor 0 tanto faz
32
+	 * os itens de retorno serem conhecidos ou nao conhecidos.
33
+	 * 
34
+	 * @return inteiro indicando se deve ou nao retornar itens desconhecidos.
35
+	 */
36
+	public int getUseNovelty() {
37
+		return useNovelty;
38
+	}
39
+
40
+	public void setUseNovelty(int useNovelty) {
41
+		this.useNovelty = useNovelty;
42
+	}
43
+
44
+	/**
45
+	 * Indica se devera ser retornado itens populares, itens raros ou tanto faz.
46
+	 * O valor -1 indica o retorno de itens raros. O valor 1 indica o retorno de
47
+	 * itens populares. O valor 0 e a lista de retorno original.
48
+	 * 
49
+	 * @return
50
+	 */
51
+	public int getUsePopularity() {
52
+		return usePopularity;
53
+	}
54
+
55
+	public void setUsePopularity(int usePopularity) {
56
+		this.usePopularity = usePopularity;
57
+	}
58
+
59
+	public String toString() {
60
+		return "NOVIDADE: " + useNovelty + " POPULARIDADE: " + usePopularity;
61
+	}
62
+}

+ 12 - 0
src/main/java/com/rdlze/radializebase/utils/FilterBean.java

@@ -0,0 +1,12 @@
1
+package com.rdlze.radializebase.utils;
2
+
3
+import java.io.Serializable;
4
+
5
+public abstract class FilterBean implements Serializable{
6
+
7
+	/**
8
+	 * Default serial version.
9
+	 */
10
+	private static final long serialVersionUID = 1L;
11
+
12
+}

+ 365 - 0
src/main/java/com/rdlze/radializebase/utils/MathNervous.java

@@ -0,0 +1,365 @@
1
+package com.rdlze.radializebase.utils;
2
+
3
+import java.util.ArrayList;
4
+import java.util.Iterator;
5
+import java.util.List;
6
+
7
+import org.apache.mahout.cf.taste.impl.common.FastByIDMap;
8
+
9
+/**
10
+ * 
11
+ * @author Alex Amorim Dutra
12
+ * 
13
+ */
14
+public class MathNervous {
15
+
16
+	/**
17
+	 * Normaliza os valores do Map entre 0 e 1.
18
+	 * 
19
+	 * @param idsValues
20
+	 * @return
21
+	 */
22
+	public FastByIDMap<Float> normalizingValues(FastByIDMap<Float> idsValues) {
23
+
24
+		float maxValue = -99999999;
25
+		float minValue = 99999999;
26
+		Iterator<Long> iteratorValues = idsValues.keySetIterator();
27
+		while (iteratorValues.hasNext()) {
28
+			long id = iteratorValues.next();
29
+			float value = idsValues.get(id);
30
+			if (maxValue < value)
31
+				maxValue = value;
32
+			if (minValue > value)
33
+				minValue = value;
34
+			idsValues.put(id, value);
35
+		}
36
+
37
+		FastByIDMap<Float> mapToReturn = new FastByIDMap<Float>();
38
+		iteratorValues = idsValues.keySetIterator();
39
+		while (iteratorValues.hasNext()) {
40
+
41
+			long id = iteratorValues.next();
42
+			float value = idsValues.get(id);
43
+			float newValue = 0;
44
+			if ((maxValue - minValue) == 0) {
45
+				newValue = 0.0f;
46
+			} else {
47
+				newValue = (value - minValue) / (maxValue - minValue);
48
+			}
49
+			mapToReturn.put(id, newValue);
50
+		}
51
+		return mapToReturn;
52
+	}
53
+
54
+	/**
55
+	 * Normaliza os valores do Map entre o menor valor desejado e o maior valor
56
+	 * desejado.
57
+	 * 
58
+	 * @param idsValues
59
+	 * @return
60
+	 */
61
+	public FastByIDMap<Float> normalizingValues(FastByIDMap<Float> idsValues,
62
+			float minValueDesired, float maxValueDesired) {
63
+
64
+		float realMaxValue = -99999999;
65
+		float realMinValue = 99999999;
66
+		Iterator<Long> iteratorValues = idsValues.keySetIterator();
67
+		while (iteratorValues.hasNext()) {
68
+			long id = iteratorValues.next();
69
+			float value = idsValues.get(id);
70
+			if (realMaxValue < value)
71
+				realMaxValue = value;
72
+			if (realMinValue > value)
73
+				realMinValue = value;
74
+			idsValues.put(id, value);
75
+		}
76
+
77
+		FastByIDMap<Float> mapToReturn = new FastByIDMap<Float>();
78
+		iteratorValues = idsValues.keySetIterator();
79
+		while (iteratorValues.hasNext()) {
80
+			long id = iteratorValues.next();
81
+			float value = idsValues.get(id);
82
+			float newValue = 0;
83
+			if ((realMaxValue - realMinValue) == 0) {
84
+				newValue = maxValueDesired;
85
+			} else {
86
+				newValue = minValueDesired
87
+						+ ((value - realMinValue) * (maxValueDesired - minValueDesired))
88
+						/ (realMaxValue - realMinValue);
89
+			}
90
+			mapToReturn.put(id, newValue);
91
+		}
92
+		return mapToReturn;
93
+	}
94
+
95
+	public FastByIDMap<Float> normalizingSortedList(
96
+			List<AIRecommendedItem> listToNormalize) {
97
+
98
+		float maxValue = 100;
99
+		FastByIDMap<Float> mapToReturn = new FastByIDMap<Float>();
100
+		for (AIRecommendedItem item : listToNormalize) {
101
+			mapToReturn.put(item.getItemID(), maxValue);
102
+			// evita que os valores ficam abaixo de 20, pois isto atrapalha para
103
+			// mostrar no front-end.
104
+			if (maxValue > 80)
105
+				maxValue -= 4;
106
+			else if (maxValue > 60)
107
+				maxValue -= 3;
108
+			else if (maxValue > 50)
109
+				maxValue -= 2;
110
+			else if (maxValue > 30)
111
+				maxValue -= 1;
112
+			else if (maxValue > 20)
113
+				maxValue -= 0.5;
114
+		}
115
+		return mapToReturn;
116
+	}
117
+
118
+	public FastByIDMap<Float> normalizingSortedListRadio(
119
+			List<AIRecommendedItem> listToNormalize) {
120
+		// Pelo fato dos nomes das rádios serem maiores então é feita uma
121
+		// normalização mais agressiva quanto as diferenças de valores.
122
+		float maxValue = 100;
123
+		FastByIDMap<Float> mapToReturn = new FastByIDMap<Float>();
124
+		for (AIRecommendedItem item : listToNormalize) {
125
+			mapToReturn.put(item.getItemID(), maxValue);
126
+			if (maxValue > 89)
127
+				maxValue -= 5;
128
+			else if (maxValue > 60)
129
+				maxValue -= 4;
130
+			else if (maxValue > 40)
131
+				maxValue -= 3;
132
+			else if (maxValue > 30)
133
+				maxValue -= 1.5;
134
+			else if (maxValue > 20)
135
+				maxValue -= 0.5;
136
+		}
137
+		return mapToReturn;
138
+	}
139
+
140
+	/**
141
+	 * Normaliza os valores utilizando ZScore.
142
+	 * 
143
+	 * @param idValue
144
+	 * @return
145
+	 */
146
+	public FastByIDMap<Float> normalizingValuesZScore(FastByIDMap<Float> idValue) {
147
+
148
+		List<Float> values = new ArrayList<Float>();
149
+		Iterator<Long> iteratorValues = idValue.keySetIterator();
150
+		while (iteratorValues.hasNext()) {
151
+			long id = iteratorValues.next();
152
+			float value = idValue.get(id);
153
+			values.add(value);
154
+			idValue.put(id, value);
155
+		}
156
+		float mean = getMean(values);
157
+		float desvPad = getStandardDeviation(values);
158
+
159
+		FastByIDMap<Float> mapReturn = new FastByIDMap<Float>();
160
+		iteratorValues = idValue.keySetIterator();
161
+		while (iteratorValues.hasNext()) {
162
+			long id = iteratorValues.next();
163
+			float value = idValue.get(id);
164
+			float newValue = (value - mean) / desvPad;
165
+			mapReturn.put(id, newValue);
166
+			if (Float.isNaN(value))
167
+				value = 0.f;
168
+			idValue.put(id, value);
169
+		}
170
+
171
+		return mapReturn;
172
+	}
173
+
174
+	/**
175
+	 * Calcula a media dos valores.
176
+	 * 
177
+	 * @param values
178
+	 * @return
179
+	 */
180
+	public float getMean(List<Float> values) {
181
+		float totalValue = 0;
182
+		for (Float value : values)
183
+			totalValue += value;
184
+		if (totalValue == 0)
185
+			return 0;
186
+		return totalValue / values.size();
187
+	}
188
+
189
+	/**
190
+	 * Calcula o desvio padrao dos valores.
191
+	 * 
192
+	 * @param values
193
+	 * @return
194
+	 */
195
+	public float getStandardDeviation(List<Float> values) {
196
+
197
+		float mean = getMean(values);
198
+
199
+		float totalValue = 0;
200
+		for (Float value : values) {
201
+			totalValue += Math.pow((value - mean), 2);
202
+		}
203
+
204
+		float desvPad = (float) Math.sqrt(totalValue / (values.size() - 1));
205
+		return desvPad;
206
+	}
207
+
208
+	/**
209
+	 * Cada item contem uma lista de valores de Features.
210
+	 * 
211
+	 * @param idValuesFeatures
212
+	 * @return
213
+	 */
214
+	public FastByIDMap<List<Float>> normalizingValuesMap(
215
+			FastByIDMap<List<Float>> idValuesFeatures) {
216
+
217
+		FastByIDMap<List<Float>> valuesNormalized = new FastByIDMap<List<Float>>();
218
+		// normaliza feature por feature de cada item.
219
+		// primeira feature itera sobre todos itens.
220
+		int size = 1;
221
+		for (int i = 0; i < size; i++) {
222
+			FastByIDMap<Float> idValue = new FastByIDMap<Float>();
223
+			Iterator<Long> iteratorIds = idValuesFeatures.keySetIterator();
224
+			while (iteratorIds.hasNext()) {
225
+				long id = iteratorIds.next();
226
+				List<Float> features = idValuesFeatures.get(id);
227
+				size = features.size();
228
+				float value = features.get(i);
229
+				idValue.put(id, value);
230
+			}
231
+
232
+			FastByIDMap<Float> mapReturn = normalizingValues(idValue);
233
+			iteratorIds = mapReturn.keySetIterator();
234
+			while (iteratorIds.hasNext()) {
235
+				long id = iteratorIds.next();
236
+				float value = mapReturn.get(id);
237
+				List<Float> features = idValuesFeatures.get(id);
238
+				// setando o valor normalizado
239
+				features.set(i, value);
240
+				valuesNormalized.put(id, features);
241
+			}
242
+		}
243
+		return valuesNormalized;
244
+	}
245
+
246
+	/**
247
+	 * Cada item contem uma lista de valores de Features.
248
+	 * 
249
+	 * @param idValuesFeatures
250
+	 * @return
251
+	 */
252
+	public FastByIDMap<List<Float>> normalizingValuesZScoreMap(
253
+			FastByIDMap<List<Float>> idValuesFeatures) {
254
+
255
+		FastByIDMap<List<Float>> valuesNormalized = new FastByIDMap<List<Float>>();
256
+		// normaliza feature por feature de cada item.
257
+		// primeira feature itera sobre todos itens.
258
+		int size = 1;
259
+		for (int i = 0; i < size; i++) {
260
+			FastByIDMap<Float> idValue = new FastByIDMap<Float>();
261
+			Iterator<Long> iteratorIds = idValuesFeatures.keySetIterator();
262
+			while (iteratorIds.hasNext()) {
263
+				long id = iteratorIds.next();
264
+				List<Float> features = idValuesFeatures.get(id);
265
+				size = features.size();
266
+				float value = features.get(i);
267
+				if (Float.isNaN(value))
268
+					value = 0.0f;
269
+				idValue.put(id, value);
270
+			}
271
+
272
+			FastByIDMap<Float> mapReturn = normalizingValuesZScore(idValue);
273
+			iteratorIds = mapReturn.keySetIterator();
274
+			while (iteratorIds.hasNext()) {
275
+				long id = iteratorIds.next();
276
+				float value = mapReturn.get(id);
277
+				List<Float> features = idValuesFeatures.get(id);
278
+				// setando o valor normalizado
279
+				if (Float.isNaN(value))
280
+					value = 0.0f;
281
+				features.set(i, value);
282
+				valuesNormalized.put(id, features);
283
+			}
284
+		}
285
+		return valuesNormalized;
286
+	}
287
+
288
+	public float getMax(List<Float> values) {
289
+		float max = -99999999999999999999999999999999999999.f;
290
+		for (float value : values) {
291
+			if (max < value)
292
+				max = value;
293
+		}
294
+		return max;
295
+	}
296
+
297
+	public float getMin(List<Float> values) {
298
+		float min = 99999999999999999999999999999999999999.f;
299
+		for (float value : values) {
300
+			if (min > value)
301
+				min = value;
302
+		}
303
+		return min;
304
+	}
305
+
306
+	public float getCoefficientVariation(List<Float> values) {
307
+		float mean = getMean(values);
308
+
309
+		float totalValue = 0;
310
+		for (Float value : values)
311
+			totalValue += Math.pow((value - mean), 2);
312
+
313
+		float desvPad = (float) Math.sqrt(totalValue / (values.size() - 1));
314
+		float cv = desvPad / mean;
315
+
316
+		return cv;
317
+	}
318
+
319
+	public double normalizingValues(double value, double realMinValue,
320
+			double realMaxValue, double minValueDesired, double maxValueDesired) {
321
+		double newValue = 0;
322
+		if ((realMaxValue - realMinValue) == 0) {
323
+			newValue = minValueDesired;
324
+		} else {
325
+			newValue = minValueDesired
326
+					+ ((value - realMinValue) * (maxValueDesired - minValueDesired))
327
+					/ (realMaxValue - realMinValue);
328
+		}
329
+
330
+		// if (newValue < value)
331
+		// System.out.println("MINVALUEDESIRED " + minValueDesired
332
+		// + " VALUE " + value + " MAXVALUEDESIRED "
333
+		// + maxValueDesired + " REALMINVALUE " + realMinValue
334
+		// + " REALMAXVALUE " + realMaxValue+" NEWVALUE "+newValue);
335
+		return newValue;
336
+	}
337
+
338
+	public static void main(String[] args) {
339
+		List<Float> values = new ArrayList<Float>();
340
+		values.add(2.f);
341
+		values.add(2.f);
342
+		values.add(2.f);
343
+		values.add(120.f);
344
+		MathNervous normalizing = new MathNervous();
345
+		double realMinValue = 0.2;
346
+		System.out.println("OKK "
347
+				+ normalizing.normalizingValues(0.27, realMinValue, 0.27,
348
+						realMinValue, 40));
349
+		System.out.println("Mean " + normalizing.getMean(values));
350
+		System.out.println("DesvPad "
351
+				+ normalizing.getStandardDeviation(values));
352
+		FastByIDMap<Float> idValue = new FastByIDMap<Float>();
353
+		idValue.put(1, 0.f);
354
+		idValue.put(2, 2.f);
355
+		idValue.put(3, 500.f);
356
+		idValue.put(4, 1000.f);
357
+		System.out.println("Normalizing "
358
+				+ normalizing.normalizingValues(idValue));
359
+		System.out.println("Normalizing Min and Max "
360
+				+ normalizing.normalizingValues(idValue, 1, 80));
361
+
362
+		System.out.println("ZScore "
363
+				+ normalizing.normalizingValuesZScore(idValue));
364
+	}
365
+}

+ 100 - 0
src/main/java/com/rdlze/radializebase/utils/RdlzComponents.java

@@ -0,0 +1,100 @@
1
+package com.rdlze.radializebase.utils;
2
+
3
+import java.rmi.NotBoundException;
4
+import java.rmi.RemoteException;
5
+import java.rmi.registry.LocateRegistry;
6
+import java.rmi.registry.Registry;
7
+import java.sql.Timestamp;
8
+
9
+import com.rdlze.radializebase.interfaces.InterfaceSearchServer;
10
+import com.rdlze.radializebase.notification.Notifier;
11
+import com.rdlze.radializeutils.notification.Notification;
12
+import com.rdlze.radializeutils.objects.IndexResponse;
13
+
14
+/**
15
+ * Utils for rdlz backend tasks
16
+ * 
17
+ * @author kledilson
18
+ * 
19
+ */
20
+public class RdlzComponents {
21
+
22
+	/**
23
+	 * Connects to Rdlz broker
24
+	 * 
25
+	 * @param ip
26
+	 * @param serviceName
27
+	 */
28
+	public static void connectToBroker(String ip, String serviceName, int port) {
29
+		Notifier.init(ip, serviceName, port);
30
+		System.out.println("Conectou ao broker do Radialize");
31
+	}
32
+
33
+	/**
34
+	 * Connects to Rdlz SearchServer
35
+	 * 
36
+	 * @param ip
37
+	 * @param serviceName
38
+	 * @return
39
+	 * @throws RemoteException
40
+	 * @throws NotBoundException
41
+	 */
42
+	public static InterfaceSearchServer getSearchServerFacade(String ip,
43
+			String serviceName) throws RemoteException, NotBoundException {
44
+		Registry registry = LocateRegistry.getRegistry(ip);
45
+		InterfaceSearchServer iSS = (InterfaceSearchServer) registry
46
+				.lookup(serviceName);
47
+		System.out.println("Pegou fachada do SearchServer");
48
+		return iSS;
49
+	}
50
+
51
+	/**
52
+	 * Send notification to radialize's broker with new content
53
+	 * 
54
+	 * @param artist
55
+	 * @param song
56
+	 * @param response
57
+	 * @throws RemoteException
58
+	 */
59
+	public static void sendNotification(String artist, String song,
60
+			IndexResponse response) throws RemoteException {
61
+		Notification notification = new Notification(0);
62
+		notification.setRadioId(-1);
63
+
64
+		if (response.getMBResp() != null) {
65
+			notification.setMusicBrainzResponse(response.getMBResp());
66
+		}
67
+
68
+		if (response.getMBResp() != null
69
+				&& response.getMBResp().getArtist() != null
70
+				&& response.getMBResp().getArtist().getName() != null
71
+				&& !response.getMusicBrainzArtistId().equals("-1")
72
+				&& (!(response.getMBResp().getArtist().getName()).equals("") || !(response
73
+						.getMBResp().getArtist().getName()).equals("-1"))) {
74
+			artist = response.getMBResp().getArtist().getName();
75
+		}
76
+		if (response.getMBResp() != null
77
+				&& response.getMBResp().getSong() != null
78
+				&& !response.getMBResp().getIdSongMB().equals("-1")
79
+				&& (!(response.getMBResp().getSong()).equals("") || !(response
80
+						.getMBResp().getSong()).equals("-1"))) {
81
+			song = response.getMBResp().getSong();
82
+		}
83
+
84
+		notification.setArtistName(artist);
85
+		notification.setSongName(song);
86
+		notification.setArtistId(response.getArtistId());
87
+		notification.setSongId(response.getMusicId());
88
+		notification.setMediaId(response.getMediaId());
89
+		notification.setMedia(artist + song);
90
+		notification.setTrack(true);
91
+		notification.setNotDisplayable();
92
+		notification.setStartTime(new Timestamp(0));
93
+		notification.setEndTime(new Timestamp(0));
94
+		notification.setPath("");
95
+		notification.setMusicBrainzArtistId(response.getMusicBrainzArtistId());
96
+		notification.setMusicBrainzSongId(response.getMusicBrainzMusicId());
97
+		notification.setNotificationType(0);
98
+		Notifier.notify(notification);
99
+	}
100
+}

+ 149 - 0
src/main/java/com/rdlze/radializebase/utils/Utils.java

@@ -0,0 +1,149 @@
1
+package com.rdlze.radializebase.utils;
2
+
3
+import java.rmi.Remote;
4
+import java.rmi.RemoteException;
5
+import java.rmi.registry.LocateRegistry;
6
+import java.rmi.registry.Registry;
7
+import java.rmi.server.UnicastRemoteObject;
8
+import java.sql.Timestamp;
9
+
10
+import com.idealizeframework.irf.base.exceptions.IdealizeUnavailableResourceException;
11
+
12
+public class Utils {
13
+
14
+	public static Timestamp getNowDate() {
15
+		return new Timestamp(System.currentTimeMillis());
16
+	}
17
+
18
+	/**
19
+	 * Makes the object remotely available.
20
+	 * 
21
+	 * @param remoteObject
22
+	 * @param nameObject
23
+	 * @throws IdealizeUnavailableResourceException
24
+	 */
25
+	public static Remote registerRemoteObject(Remote remoteObject,
26
+			String nameObject, int port) {
27
+
28
+		try {
29
+			try {
30
+				LocateRegistry.createRegistry(port);
31
+				// System.out.println("Criou o RMI............................................................................................");
32
+			} catch (Exception e) {
33
+				System.out.println("A porta do RMI ja esta sendo utilizada?!");
34
+			}
35
+			Remote stub;
36
+			Registry registry = LocateRegistry.getRegistry(port);
37
+
38
+			stub = UnicastRemoteObject.exportObject(remoteObject, port);
39
+			System.out.println("Name Obj " + nameObject);
40
+			registry.rebind(nameObject, stub);
41
+			System.out.println("REGISTROU OBJETO " + nameObject
42
+					+ " REMOTAMENTE NA PORTA "+port);
43
+
44
+			return stub;
45
+		} catch (RemoteException e) {
46
+			e.printStackTrace();
47
+		}
48
+		return remoteObject;
49
+	}
50
+
51
+	/**
52
+	 * Makes the object remotely available.
53
+	 * 
54
+	 * @param remoteObject
55
+	 * @param nameObject
56
+	 * @throws IdealizeUnavailableResourceException
57
+	 */
58
+	public static Remote registerRemoteObjectUseRandom(Remote remoteObject,
59
+			String nameObject, int port) {
60
+
61
+		try {
62
+			try {
63
+				LocateRegistry.createRegistry(port);
64
+				// System.out.println("Criou o RMI............................................................................................");
65
+			} catch (Exception e) {
66
+				System.out.println("A porta do RMI ja esta sendo utilizada?!");
67
+			}
68
+			Remote stub;
69
+			Registry registry = LocateRegistry.getRegistry(port);
70
+
71
+			stub = UnicastRemoteObject.exportObject(remoteObject, 0);
72
+			System.out.println("Name Obj " + nameObject);
73
+			registry.rebind(nameObject, stub);
74
+			System.out.println("REGISTROU OBJETO " + nameObject
75
+					+ " REMOTAMENTE.");
76
+
77
+			return stub;
78
+		} catch (RemoteException e) {
79
+			e.printStackTrace();
80
+		}
81
+		return remoteObject;
82
+	}
83
+
84
+	public static Remote getRemoteObject(String ipObject, String nameObject,
85
+			int port) {
86
+
87
+		Remote remote = null;
88
+		try {
89
+			Registry registry = LocateRegistry.getRegistry(ipObject, port);
90
+			remote = registry.lookup(nameObject);
91
+			if (remote == null) {
92
+				System.out.println("NÃO PEGOU O OBJETO " + nameObject
93
+						+ " REMOTAMENTE. O OBJETO ESTÁ NULO. IP: " + ipObject
94
+						+ " NAME: " + nameObject + " PORTA: " + port);
95
+
96
+			} else {
97
+				System.out.println("PEGOU O OBJETO " + nameObject
98
+						+ " REMOTAMENTE.");
99
+			}
100
+		} catch (Exception e) {
101
+			e.printStackTrace();
102
+			System.err
103
+					.println("Could not possible get remote object: nameObject: "
104
+							+ nameObject + " IP Object: " + ipObject);
105
+			remote = null;
106
+		}
107
+		return remote;
108
+	}
109
+
110
+	/**
111
+	 * Makes the object remotely available.
112
+	 * 
113
+	 * @param remoteObject
114
+	 * @param nameObject
115
+	 * @param host
116
+	 * @throws IdealizeUnavailableResourceException
117
+	 */
118
+	public static Remote registerRemoteObject(Remote remoteObject,
119
+			String nameObject, String host, int port) {
120
+
121
+		try {
122
+			try {
123
+				LocateRegistry.createRegistry(port);
124
+				// System.out.println("Criou o RMI............................................................................................");
125
+			} catch (Exception e) {
126
+				System.out.println("A porta do RMI ja esta sendo utilizada?!");
127
+			}
128
+			Remote stub;
129
+			Registry registry = LocateRegistry.getRegistry(host, port);
130
+
131
+			stub = UnicastRemoteObject.exportObject(remoteObject, port);
132
+			System.out.println("Name Obj " + nameObject);
133
+			registry.rebind(nameObject, stub);
134
+			System.out.println("REGISTROU OBJETO " + nameObject
135
+					+ " REMOTAMENTE.");
136
+
137
+			return stub;
138
+		} catch (RemoteException e) {
139
+			e.printStackTrace();
140
+		}
141
+		return remoteObject;
142
+	}
143
+
144
+	public String escapeUnicode(String name) {
145
+		name = name.replaceAll("'", "''");
146
+		name = name.replaceAll("\\", "'\\");
147
+		return name;
148
+	}
149
+}

+ 38 - 0
src/test/java/com/rdlze/radializebase/AppTest.java

@@ -0,0 +1,38 @@
1
+package com.rdlze.radializebase;
2
+
3
+import junit.framework.Test;
4
+import junit.framework.TestCase;
5
+import junit.framework.TestSuite;
6
+
7
+/**
8
+ * Unit test for simple App.
9
+ */
10
+public class AppTest 
11
+    extends TestCase
12
+{
13
+    /**
14
+     * Create the test case
15
+     *
16
+     * @param testName name of the test case
17
+     */
18
+    public AppTest( String testName )
19
+    {
20
+        super( testName );
21
+    }
22
+
23
+    /**
24
+     * @return the suite of tests being tested
25
+     */
26
+    public static Test suite()
27
+    {
28
+        return new TestSuite( AppTest.class );
29
+    }
30
+
31
+    /**
32
+     * Rigourous Test :-)
33
+     */
34
+    public void testApp()
35
+    {
36
+        assertTrue( true );
37
+    }
38
+}

+ 2 - 0
target/.gitignore

@@ -0,0 +1,2 @@
1
+/classes/
2
+/test-classes/

+ 5 - 0
target/maven-archiver/pom.properties

@@ -0,0 +1,5 @@
1
+#Generated by Maven
2
+#Fri May 09 14:51:20 BRT 2014
3
+version=0.0.1-SNAPSHOT
4
+groupId=com.rdlze
5
+artifactId=radializebase

+ 0 - 0
target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst


+ 24 - 0
target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst

@@ -0,0 +1,24 @@
1
+/home/kledilson/workspaces/Radialize/radializebase/src/main/java/com/rdlze/radializebase/interfaces/MusicBrainzControllerMock.java
2
+/home/kledilson/workspaces/Radialize/radializebase/src/main/java/com/rdlze/radializebase/utils/MathNervous.java
3
+/home/kledilson/workspaces/Radialize/radializebase/src/main/java/com/rdlze/radializebase/App.java
4
+/home/kledilson/workspaces/Radialize/radializebase/src/main/java/com/rdlze/radializebase/interfaces/InterfacePlayingNowServer.java
5
+/home/kledilson/workspaces/Radialize/radializebase/src/main/java/com/rdlze/radializebase/utils/AIRecommendedItem.java
6
+/home/kledilson/workspaces/Radialize/radializebase/src/main/java/com/rdlze/radializebase/utils/Utils.java
7
+/home/kledilson/workspaces/Radialize/radializebase/src/main/java/com/rdlze/radializebase/utils/AllFilters.java
8
+/home/kledilson/workspaces/Radialize/radializebase/src/main/java/com/rdlze/radializebase/notification/SearchNotifiable.java
9
+/home/kledilson/workspaces/Radialize/radializebase/src/main/java/com/rdlze/radializebase/notification/NotifierObject.java
10
+/home/kledilson/workspaces/Radialize/radializebase/src/main/java/com/rdlze/radializebase/interfaces/InterfaceIdFinder.java
11
+/home/kledilson/workspaces/Radialize/radializebase/src/main/java/com/rdlze/radializebase/interfaces/InterfaceMusicBrainzController.java
12
+/home/kledilson/workspaces/Radialize/radializebase/src/main/java/com/rdlze/radializebase/utils/FilterBean.java
13
+/home/kledilson/workspaces/Radialize/radializebase/src/main/java/com/rdlze/radializebase/interfaces/InterfaceCrawlerMaster.java
14
+/home/kledilson/workspaces/Radialize/radializebase/src/main/java/com/rdlze/radializebase/interfaces/InterfaceSearchServer.java
15
+/home/kledilson/workspaces/Radialize/radializebase/src/main/java/com/rdlze/radializebase/interfaces/RemoteRadializeBatchFacade.java
16
+/home/kledilson/workspaces/Radialize/radializebase/src/main/java/com/rdlze/radializebase/interfaces/InterfaceNotifiable.java
17
+/home/kledilson/workspaces/Radialize/radializebase/src/main/java/com/rdlze/radializebase/mocks/MockBroker.java
18
+/home/kledilson/workspaces/Radialize/radializebase/src/main/java/com/rdlze/radializebase/interfaces/InterfaceCollector.java
19
+/home/kledilson/workspaces/Radialize/radializebase/src/main/java/com/rdlze/radializebase/interfaces/MBSearchServerInterface.java
20
+/home/kledilson/workspaces/Radialize/radializebase/src/main/java/com/rdlze/radializebase/interfaces/RemoteRadializeCacheFacade.java
21
+/home/kledilson/workspaces/Radialize/radializebase/src/main/java/com/rdlze/radializebase/notification/Notifier.java
22
+/home/kledilson/workspaces/Radialize/radializebase/src/main/java/com/rdlze/radializebase/utils/RdlzComponents.java
23
+/home/kledilson/workspaces/Radialize/radializebase/src/main/java/com/rdlze/radializebase/interfaces/InterfaceCrawlerSlave.java
24
+/home/kledilson/workspaces/Radialize/radializebase/src/main/java/com/rdlze/radializebase/mocks/MockNotifiable.java

+ 0 - 0
target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst


+ 1 - 0
target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst

@@ -0,0 +1 @@
1
+/home/kledilson/workspaces/Radialize/radializebase/src/test/java/com/rdlze/radializebase/AppTest.java

BIN
target/radializebase-0.0.1-SNAPSHOT.jar


+ 64 - 0
target/surefire-reports/TEST-com.rdlze.radializebase.AppTest.xml

@@ -0,0 +1,64 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<testsuite tests="1" failures="0" name="com.rdlze.radializebase.AppTest" time="0.007" errors="0" skipped="0">
3
+  <properties>
4
+    <property name="java.runtime.name" value="Java(TM) SE Runtime Environment"/>
5
+    <property name="sun.boot.library.path" value="/usr/lib/jvm/java-8-oracle/jre/lib/amd64"/>
6
+    <property name="java.vm.version" value="25.45-b02"/>
7
+    <property name="java.vm.vendor" value="Oracle Corporation"/>
8
+    <property name="java.vendor.url" value="http://java.oracle.com/"/>
9
+    <property name="path.separator" value=":"/>
10
+    <property name="guice.disable.misplaced.annotation.check" value="true"/>
11
+    <property name="java.vm.name" value="Java HotSpot(TM) 64-Bit Server VM"/>
12
+    <property name="file.encoding.pkg" value="sun.io"/>
13
+    <property name="user.country" value="US"/>
14
+    <property name="sun.java.launcher" value="SUN_STANDARD"/>
15
+    <property name="sun.os.patch.level" value="unknown"/>
16
+    <property name="java.vm.specification.name" value="Java Virtual Machine Specification"/>
17
+    <property name="user.dir" value="/home/kledilson/workspaces/Radialize/radializebase"/>
18
+    <property name="java.runtime.version" value="1.8.0_45-b14"/>
19
+    <property name="java.awt.graphicsenv" value="sun.awt.X11GraphicsEnvironment"/>
20
+    <property name="java.endorsed.dirs" value="/usr/lib/jvm/java-8-oracle/jre/lib/endorsed"/>
21
+    <property name="os.arch" value="amd64"/>
22
+    <property name="java.io.tmpdir" value="/tmp"/>
23
+    <property name="line.separator" value="
24
+"/>
25
+    <property name="java.vm.specification.vendor" value="Oracle Corporation"/>
26
+    <property name="os.name" value="Linux"/>
27
+    <property name="classworlds.conf" value="/home/kledilson/workspaces/Radialize/.metadata/.plugins/org.eclipse.m2e.launching/launches/m2conf4157580678593687569.tmp"/>
28
+    <property name="sun.jnu.encoding" value="UTF-8"/>
29
+    <property name="java.library.path" value="/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib"/>
30
+    <property name="java.specification.name" value="Java Platform API Specification"/>
31
+    <property name="java.class.version" value="52.0"/>
32
+    <property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/>
33
+    <property name="os.version" value="3.13.0-49-generic"/>
34
+    <property name="user.home" value="/home/kledilson"/>
35
+    <property name="user.timezone" value="America/Sao_Paulo"/>
36
+    <property name="java.awt.printerjob" value="sun.print.PSPrinterJob"/>
37
+    <property name="file.encoding" value="UTF-8"/>
38
+    <property name="java.specification.version" value="1.8"/>
39
+    <property name="user.name" value="kledilson"/>
40
+    <property name="java.class.path" value="/home/kledilson/Installations/eclipse/plugins/org.eclipse.m2e.maven.runtime_1.5.2.20150413-2214/jars/plexus-classworlds-2.5.1.jar"/>
41
+    <property name="org.slf4j.simpleLogger.defaultLogLevel" value="info"/>
42
+    <property name="java.vm.specification.version" value="1.8"/>
43
+    <property name="sun.arch.data.model" value="64"/>
44
+    <property name="java.home" value="/usr/lib/jvm/java-8-oracle/jre"/>
45
+    <property name="sun.java.command" value="org.codehaus.plexus.classworlds.launcher.Launcher -B install"/>
46
+    <property name="java.specification.vendor" value="Oracle Corporation"/>
47
+    <property name="user.language" value="en"/>
48
+    <property name="awt.toolkit" value="sun.awt.X11.XToolkit"/>
49
+    <property name="java.vm.info" value="mixed mode"/>
50
+    <property name="java.version" value="1.8.0_45"/>
51
+    <property name="java.ext.dirs" value="/usr/lib/jvm/java-8-oracle/jre/lib/ext:/usr/java/packages/lib/ext"/>
52
+    <property name="securerandom.source" value="file:/dev/./urandom"/>
53
+    <property name="sun.boot.class.path" value="/usr/lib/jvm/java-8-oracle/jre/lib/resources.jar:/usr/lib/jvm/java-8-oracle/jre/lib/rt.jar:/usr/lib/jvm/java-8-oracle/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-8-oracle/jre/lib/jsse.jar:/usr/lib/jvm/java-8-oracle/jre/lib/jce.jar:/usr/lib/jvm/java-8-oracle/jre/lib/charsets.jar:/usr/lib/jvm/java-8-oracle/jre/lib/jfr.jar:/usr/lib/jvm/java-8-oracle/jre/classes"/>
54
+    <property name="java.vendor" value="Oracle Corporation"/>
55
+    <property name="maven.home" value="/home/kledilson/workspaces/Radialize/radializebase/EMBEDDED"/>
56
+    <property name="file.separator" value="/"/>
57
+    <property name="java.vendor.url.bug" value="http://bugreport.sun.com/bugreport/"/>
58
+    <property name="sun.cpu.endian" value="little"/>
59
+    <property name="sun.io.unicode.encoding" value="UnicodeLittle"/>
60
+    <property name="sun.desktop" value="gnome"/>
61
+    <property name="sun.cpu.isalist" value=""/>
62
+  </properties>
63
+  <testcase classname="com.rdlze.radializebase.AppTest" name="testApp" time="0.007"/>
64
+</testsuite>

+ 4 - 0
target/surefire-reports/com.rdlze.radializebase.AppTest.txt

@@ -0,0 +1,4 @@
1
+-------------------------------------------------------------------------------
2
+Test set: com.rdlze.radializebase.AppTest
3
+-------------------------------------------------------------------------------
4
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.112 sec