+ public static boolean isUserLoggedIn(String anId) {\r
+ synchronized (loggedInUserIds) {\r
+ return loggedInUserIds.containsKey(anId);\r
+ }\r
+ }\r
+\r
+ public static List getLoggedInUsers() {\r
+ List result = new Vector();\r
+\r
+ synchronized (loggedInUsers) {\r
+ Iterator i = loggedInUsers.entrySet().iterator();\r
+\r
+ while (i.hasNext()) {\r
+ Map.Entry entry = (Map.Entry) i.next();\r
+\r
+ Map item = new HashMap();\r
+ item.put("name", entry.getKey());\r
+ item.put("count", entry.getValue());\r
+ result.add(item);\r
+ }\r
+ }\r
+\r
+ return result;\r
+ }\r
+\r
+ public static BundleFactory getBundleFactory() {\r
+ return bundleFactory;\r
+ }\r
+\r
+ public static void registerLogin(String aName, String anId) {\r
+ modifyLoggedInCount(aName, anId, 1);\r
+ }\r
+\r
+ public static void registerLogout(String aName, String anId) {\r
+ modifyLoggedInCount(aName, anId, -1);\r
+ }\r
+\r
+ private static void modifyLoggedInCount(String aName, String anId, int aModifier) {\r
+ synchronized (loggedInUsers) {\r
+ Integer count = (Integer) loggedInUsers.get(aName);\r
+ if (count==null)\r
+ count = new Integer(0);\r
+\r
+ if (count.intValue()+aModifier<=0) {\r
+ loggedInUsers.remove(aName);\r
+ }\r
+ else {\r
+ loggedInUsers.put(aName, new Integer(count.intValue() + aModifier));\r
+ }\r
+ }\r
+\r
+ synchronized (loggedInUserIds) {\r
+ Integer count = (Integer) loggedInUserIds.get(anId);\r
+ if (count==null)\r
+ count = new Integer(0);\r
+\r
+ if (count.intValue()+aModifier<=0) {\r
+ loggedInUserIds.remove(anId);\r
+ }\r
+ else {\r
+ loggedInUserIds.put(anId, new Integer(count.intValue() + aModifier));\r
+ }\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Called whenever a modifying admin action occurs. Used to log\r
+ * the action, if admin activity logging is turned on,\r
+ */\r
+ public static void logAdminUsage(EntityUsers aUser, String anObject, String aDescription) {\r
+ try {\r
+ if (config().getString("Mir.Admin.LogAdminActivity", "0").equals("1")) {\r
+ String user = "unknown (" + aUser.toString() + ")";\r
+ if (aUser != null)\r
+ user = aUser.getFieldValue("login");\r
+ adminUsageLogger.info(user + " | " + anObject + " | " + aDescription);\r
+ }\r
+ }\r
+ catch (Throwable t) {\r
+ logger.error("Error while logging admin usage ("+\r
+ aUser.toString()+", "+aDescription+"): " +t.toString());\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Reloads all reloadable configurations, such as the producer subsystem.\r
+ */\r
+ public static void reloadConfigurations() throws MirGlobalExc, MirGlobalFailure {\r
+ getProducerEngine().reloadConfiguration();\r
+ try {\r
+ LoggerEngine.reload();\r
+ }\r
+ catch (Throwable e) {\r
+ throw new MirGlobalFailure(e);\r
+ }\r
+ getBundleFactory().reload();\r
+ }\r