1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 package org.wever.jradiodj.services;
27
28 import org.wever.jradiodj.services.collection.CollectionManager;
29 import org.wever.jradiodj.services.collection.CollectionManagerImpl;
30 import org.wever.jradiodj.services.playlist.IceCastPlaylistGeneratorImpl;
31 import org.wever.jradiodj.services.playlist.PlaylistGenerator;
32
33
34 /*** Simple Factory that returns hardcoded implementations.
35 * The factory exists to make plugging in new implementations simple.
36 * Services must be multi-threaded friendly as only a single instance of any service
37 * will be created in the current jvm.
38 *
39 * @author mick
40 * @version $Id$
41 */
42 public final class ServiceFactory {
43
44 private static CollectionManager collectionManager;
45
46 private static PlaylistGenerator playlistGenerator;
47
48 /*** Creates a new instance of ServiceFactory. */
49 private ServiceFactory() {
50 }
51
52 /***
53 *
54 * @return
55 */
56 public static CollectionManager getCollectionManager() {
57 if( collectionManager == null ) {
58 collectionManager = new CollectionManagerImpl();
59 }
60 return collectionManager;
61 }
62
63 /***
64 *
65 * @return
66 */
67 public static PlaylistGenerator getPlaylistGenerator() {
68 if( playlistGenerator == null ) {
69 playlistGenerator = new IceCastPlaylistGeneratorImpl();
70 }
71 return playlistGenerator;
72 }
73 }