Package org.jivesoftware.admin
Class AdminConsole
- java.lang.Object
-
- org.jivesoftware.admin.AdminConsole
-
public class AdminConsole extends Object
A model for admin tab and sidebar info. This class loads in XML definitions of the data and produces an in-memory model.This class loads its data from the
admin-sidebar.xml
file which is assumed to be in the main application jar file. In addition, it will load files fromMETA-INF/admin-sidebar.xml
if they're found. This allows developers to extend the functionality of the admin console to provide more options. See the mainadmin-sidebar.xml
file for documentation of its format.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addModel(String name, InputStream in)
Adds XML stream to the tabs/sidebar model.static void
addModel(String name, org.dom4j.Element element)
Adds an <adminconsole> Element to the tabs/sidebar model.static String
getAdminText(String string, String pluginName)
Returns a text element for the admin console, applying the appropriate locale.static String
getAppName()
Returns the name of the application.static org.dom4j.Element
getElemnetByID(String id)
Convenience method to select an element from the model by its ID.static String
getGitSHAString()
Returns the git SHA of the commit at which this version was builtstatic String
getLoginLogoImage()
Returns the URL of the login image for the admin console.static String
getLogoImage()
Returns the URL of the main logo image for the admin console.static org.dom4j.Element
getModel()
Returns the model.static String
getVersionString()
Returns the version string displayed in the admin console.static void
removeModel(String name)
Removes an <adminconsole> Element from the tabs/sidebar model.
-
-
-
Method Detail
-
addModel
public static void addModel(String name, InputStream in) throws Exception
Adds XML stream to the tabs/sidebar model.- Parameters:
name
- the name.in
- the XML input stream.- Throws:
Exception
- if an error occurs when parsing the XML or adding it to the model.
-
addModel
public static void addModel(String name, org.dom4j.Element element) throws Exception
Adds an <adminconsole> Element to the tabs/sidebar model.- Parameters:
name
- the name.element
- the Element- Throws:
Exception
- if an error occurs.
-
removeModel
public static void removeModel(String name)
Removes an <adminconsole> Element from the tabs/sidebar model.- Parameters:
name
- the name.
-
getAppName
public static String getAppName()
Returns the name of the application.- Returns:
- the name of the application.
-
getLogoImage
public static String getLogoImage()
Returns the URL of the main logo image for the admin console.- Returns:
- the logo image.
-
getLoginLogoImage
public static String getLoginLogoImage()
Returns the URL of the login image for the admin console.- Returns:
- the login image.
-
getVersionString
public static String getVersionString()
Returns the version string displayed in the admin console.- Returns:
- the version string.
-
getGitSHAString
public static String getGitSHAString()
Returns the git SHA of the commit at which this version was built- Returns:
- the git SHA.
-
getModel
public static org.dom4j.Element getModel()
Returns the model. The model should be considered read-only.- Returns:
- the model.
-
getElemnetByID
public static org.dom4j.Element getElemnetByID(String id)
Convenience method to select an element from the model by its ID. If an element with a matching ID is not found,null
will be returned.- Parameters:
id
- the ID.- Returns:
- the element.
-
getAdminText
public static String getAdminText(String string, String pluginName)
Returns a text element for the admin console, applying the appropriate locale. Internationalization logic will only be applied if the String is specially encoded in the format "${key.name}". If it is, the String is pulled from the resource bundle. If the pluginName is notnull
, the plugin's resource bundle will be used to look up the key.- Parameters:
string
- the String.pluginName
- the name of the plugin that the i18n String can be found in, ornull
if the standard Openfire resource bundle should be used.- Returns:
- the string, or if the string is encoded as an i18n key, the value from the appropriate resource bundle.
-
-