-
Notifications
You must be signed in to change notification settings - Fork 33
/
Globals.java
133 lines (110 loc) · 4.4 KB
/
Globals.java
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*
* Copyright (c) 2000, 2017 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022 Contributors to Eclipse Foundation. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
package com.sun.messaging.jmq.admin.util;
import java.io.File;
import java.util.Locale;
import com.sun.messaging.jmq.admin.resources.AdminResources;
import com.sun.messaging.jmq.admin.resources.AdminConsoleResources;
/**
* Singleton class which contains any Globals for the system.
* <P>
*
* Other singleton classes which can be considered static once they are retrieved (they do not need to be retrieved from
* the static method each time they are used) should also be defined here
* <P>
*/
public class Globals extends CommonGlobals {
private static final Object lock = Globals.class;
private static AdminResources ar = null;
private static AdminConsoleResources acr = null;
private static Globals globals = null;
// ------------------------------------------------------------------------
// -- static brokerConfig objects --
// ------------------------------------------------------------------------
private Globals() {
}
public static Globals getGlobals() {
if (globals == null) {
synchronized (lock) {
if (globals == null) {
globals = new Globals();
}
}
}
return globals;
}
public static AdminResources getAdminResources() {
if (ar == null) {
synchronized (lock) {
if (ar == null) {
ar = AdminResources.getResources(Locale.getDefault());
}
}
}
return ar;
}
public static AdminConsoleResources getAdminConsoleResources() {
if (acr == null) {
synchronized (lock) {
if (acr == null) {
acr = AdminConsoleResources.getResources(Locale.getDefault());
}
}
}
return acr;
}
/*---------------------------------------------
* global static variables
*---------------------------------------------*/
public static final String IMQ = "imq";
/**
* system property name for the non-editable JMQ home location
*/
public static final String JMQ_HOME_PROPERTY = "imq.home";
/**
* system property name for the editable JMQ home location
*/
public static final String JMQ_VAR_HOME_PROPERTY = "imq.varhome";
/**
* system property name for the /usr/share/lib location
*/
public static final String JMQ_LIB_HOME_PROPERTY = "imq.libhome";
/**
* default value for the non-editable JMQ home location (used if the system property is not set)
*/
public static final String JMQ_HOME_default = ".";
/**
* default value for the non-editable JMQ home location (used if the system property is not set)
*/
public static final String JMQ_VAR_HOME_default = "var";
/**
* location the configuration is using for the non-editable home location
*/
public static final String JMQ_HOME = System.getProperty(JMQ_HOME_PROPERTY, JMQ_HOME_default);
/**
* location the configuration is using for the editable home location
*/
public static final String JMQ_VAR_HOME = System.getProperty(JMQ_VAR_HOME_PROPERTY, JMQ_HOME + File.separator + JMQ_VAR_HOME_default);
/**
* location the configuration is using for the share lib home location
*/
public static final String JMQ_LIB_HOME = System.getProperty(JMQ_LIB_HOME_PROPERTY, JMQ_HOME + File.separator + "lib");
/**
* subdirectory under either the editable or non-editable location where the configuration files are location
*/
public static final String JMQ_ADMIN_PROP_LOC = "props" + File.separator + "admin" + File.separator;
}