1 /*
2 * Created on Oct 6, 2003
3 * Copyright (c) 2003. All rights reserved.
4 */
5 package portaview;
6
7 import portaview.server.PortaViewClient;
8 import portaview.server.PortaViewServer;
9
10 /***
11 * Registry that contains the static content that everyone else needs.
12 * This is an organized way to store shared services that one do not
13 * want to pass around as function arguments.
14 *
15 * @author <a href="mailto:wwlee1@uiuc.edu">William Lee</a>
16 * @version $Id: Registry.java,v 1.4 2003/12/10 06:18:57 wlee Exp $
17 */
18 public class Registry
19 {
20 private static PortaViewServer server = null;
21 private static PortaViewClient client = null;
22 private static PortaViewMain mainApplication = null;
23 private static boolean master = false;
24
25 /***
26 * Initializes the registry.
27 *
28 */
29 public static synchronized void reset()
30 {
31 master = false;
32 server = null;
33 client = null;
34 mainApplication = null;
35 }
36
37 /***
38 * @return the PortaView client that can be used to talk to remote PortaViews
39 */
40 public static synchronized PortaViewClient getClient()
41 {
42 return client;
43 }
44
45 /***
46 * Sets the PortaView client.
47 * @param client PortaView client.
48 */
49 public static synchronized void setClient(PortaViewClient client)
50 {
51 Registry.client = client;
52 }
53
54 /***
55 * @return the PortaView server.
56 */
57 public static synchronized PortaViewServer getServer()
58 {
59 return server;
60 }
61
62 /***
63 * Sets the PortaView server.
64 * @param server PortaView server.
65 */
66 public static synchronized void setServer(PortaViewServer server)
67 {
68 Registry.server = server;
69 }
70
71 /***
72 * @return true if this PortaView is a master PortaView.
73 */
74 public static synchronized boolean isMaster()
75 {
76 return master;
77 }
78
79 /***
80 * Sets the master state for this PortaView.
81 * @param master true if you want to make this PortaView a master PortaView,
82 * false otherwise.
83 */
84 public static synchronized void setMaster(boolean master)
85 {
86 Registry.master = master;
87 }
88
89 /***
90 * @return the main PortaView application
91 */
92 public static PortaViewMain getMainApplication()
93 {
94 return mainApplication;
95 }
96
97 /***
98 * Sets the main application.
99 * @param main the main application.
100 */
101 public static void setMainApplication(PortaViewMain main)
102 {
103 mainApplication = main;
104 }
105
106 }
This page was automatically generated by Maven