Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.base.admin
Class AdminConsole

java.lang.Object
  extended by com.jivesoftware.base.admin.AdminConsole

public class AdminConsole
extends java.lang.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 from META-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 main admin-sidebar.xml file for documentation of its format.


Field Summary
static java.lang.String ADMIN_SESSION_AUTHORIZATION
           
 
Method Summary
static void addModel(java.lang.String name, org.dom4j.Element element)
          Adds an <adminconsole> Element to the tabs/sidebar model.
static void addModel(java.lang.String name, java.io.InputStream in)
          Adds XML stream to the tabs/sidebar model.
protected static java.lang.String findAccessibleURL(org.dom4j.Element tab, java.lang.String role)
          Searches the sidebar items for the first url it has access to view.
static java.lang.String findFirstAccessibleURL(java.lang.String role)
          Searches for the first tab that allows it's role and then returns the first page it has access to view.
static java.lang.String getAdminText(java.lang.String string, java.lang.String pluginName)
          Returns a text element for the admin console, applying the appropriate locale.
static java.lang.String getAppName()
          Returns the name of the application.
static org.dom4j.Element getElementByID(java.lang.String id)
          Convenience method to select an element from the model by its ID.
static org.dom4j.Element getElementByID(java.lang.String product, java.lang.String id)
          Convenience method to select an element from the model by its ID within a specified product.
static java.lang.String getLoginLogoImage()
          Returns the URL of the login image for the admin console.
static java.lang.String getLogoImage()
          Returns the URL of the main logo image for the admin console.
static org.dom4j.Element getModel()
          Returns the model.
static java.lang.String getVersionString()
          Returns the version string displayed in the admin console.
static boolean isAllowedEdition(org.dom4j.Element element)
          Used to check to see if the element's required product and element information matches the systems product information.
static boolean isAllowedProduct(java.lang.String prod, org.dom4j.Element element)
          Used to check to see if the element's required product matches the passed in product.
static boolean isAllowedRole(java.lang.String role, org.dom4j.Element element)
          Returns true if the specified role is allowed.
static void removeModel(java.lang.String name)
          Removes an <adminconsole> Element from the tabs/sidebar model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ADMIN_SESSION_AUTHORIZATION

public static final java.lang.String ADMIN_SESSION_AUTHORIZATION
See Also:
Constant Field Values
Method Detail

addModel

public static void addModel(java.lang.String name,
                            java.io.InputStream in)
                     throws java.lang.Exception
Adds XML stream to the tabs/sidebar model.

Parameters:
name - the name.
in - the XML input stream.
Throws:
java.lang.Exception - if an error occurs when parsing the XML or adding it to the model.

addModel

public static void addModel(java.lang.String name,
                            org.dom4j.Element element)
                     throws java.lang.Exception
Adds an <adminconsole> Element to the tabs/sidebar model.

Parameters:
name - the name.
element - the Element
Throws:
java.lang.Exception - if an error occurs.

removeModel

public static void removeModel(java.lang.String name)
Removes an <adminconsole> Element from the tabs/sidebar model.

Parameters:
name - the name.

getAppName

public static java.lang.String getAppName()
Returns the name of the application.


getLogoImage

public static java.lang.String getLogoImage()
Returns the URL of the main logo image for the admin console.

Returns:
the logo image.

getLoginLogoImage

public static java.lang.String getLoginLogoImage()
Returns the URL of the login image for the admin console.

Returns:
the login image.

getVersionString

public static java.lang.String getVersionString()
Returns the version string displayed in the admin console.

Returns:
the version string.

getModel

public static org.dom4j.Element getModel()
Returns the model. The model should be considered read-only.

Returns:
the model.

getElementByID

public static org.dom4j.Element getElementByID(java.lang.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.

getElementByID

public static org.dom4j.Element getElementByID(java.lang.String product,
                                               java.lang.String id)
Convenience method to select an element from the model by its ID within a specified product. If an element with a matching ID is not found, null will be returned.

Parameters:
product - the product string
id - the ID.
Returns:
the element.

isAllowedEdition

public static boolean isAllowedEdition(org.dom4j.Element element)
Used to check to see if the element's required product and element information matches the systems product information.

Parameters:
element - element to check
Returns:
true if it is an allowed edition, or if the element does not have a edition requirement. If one of the two conditions is not met false is returned

isAllowedProduct

public static boolean isAllowedProduct(java.lang.String prod,
                                       org.dom4j.Element element)
Used to check to see if the element's required product matches the passed in product. If the passed in product is null and the element does not have a product requirement this method will return true. Otherwise, the passed in product must match the product requirement for this method to return true.

Parameters:
element - element to check
prod - the product string to validate against
Returns:
true if it is an allowed product, or if the element does not have a product requirement.

isAllowedRole

public static boolean isAllowedRole(java.lang.String role,
                                    org.dom4j.Element element)
Returns true if the specified role is allowed.

Parameters:
role - the role to check.
Returns:
true if the specified roll is allowed, false otherwise.

getAdminText

public static java.lang.String getAdminText(java.lang.String string,
                                            java.lang.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 not null, 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, or null if the standard Wildfire 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.

findAccessibleURL

protected static java.lang.String findAccessibleURL(org.dom4j.Element tab,
                                                    java.lang.String role)
Searches the sidebar items for the first url it has access to view.


findFirstAccessibleURL

public static java.lang.String findFirstAccessibleURL(java.lang.String role)
Searches for the first tab that allows it's role and then returns the first page it has access to view.


Jive Forums Project Page

Copyright © 1999-2006 Jive Software.