Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.blojsom.plugin.admin
Class BaseAdminPlugin

    java.lang.Object
      org.blojsom.plugin.admin.BaseAdminPlugin

All Implemented Interfaces:
  PermissionedPlugin, Plugin

Direct Known Subclasses:
  BasicAuthenticationPlugin, BulkResponseManagement, EditBlogAuthorizationPlugin, EditBlogCategoriesPlugin, EditBlogEntriesPlugin, EditBlogFlavorsPlugin, EditBlogPermissionsPlugin, EditBlogPluginsPlugin, EditBlogPropertiesPlugin, EditBlogsPlugin, EditBlogTemplatesPlugin, FileUploadPlugin, ForgottenPasswordPlugin, ListWebAdminPluginsPlugin, WebAdminPlugin

public class BaseAdminPlugin
extends java.lang.Object
implements Plugin, PermissionedPlugin

BaseAdminPlugin

Since:
  blojsom 3.0
Version:
  $Id: BaseAdminPlugin.java,v 1.3 2006/04/17 16:04:12 czarneckid Exp $
Author:
  David Czarnecki

Field Summary
`protected AuthorizationProvider` | `_authorizationProvider`
`protected java.util.Map` | `_ignoreParams`
`protected static org.apache.commons.logging.Log` | `_logger`
`protected ResourceManager` | `_resourceManager`
`protected javax.servlet.ServletConfig` | `_servletConfig`
`protected static java.lang.String` | `ACTION_PARAM`
`protected static java.lang.String` | `ADMIN_ADMINISTRATION_PAGE`
`protected static java.lang.String` | `ADMIN_AJAX_RESPONSE`
`protected static java.lang.String` | `ADMIN_LOGIN_PAGE`
`protected static java.lang.String` | `BLOJSOM_ADMIN_MESSAGES_RESOURCE`
`protected static java.lang.String` | `BLOJSOM_ADMIN_PLUGIN_AUTHENTICATED_KEY`
`protected static java.lang.String` | `BLOJSOM_ADMIN_PLUGIN_OPERATION_RESULT`
`protected static java.lang.String` | `BLOJSOM_ADMIN_PLUGIN_PASSWORD_PARAM`
`protected static java.lang.String` | `BLOJSOM_ADMIN_PLUGIN_USERNAME`
`protected static java.lang.String` | `BLOJSOM_ADMIN_PLUGIN_USERNAME_KEY`
`protected static java.lang.String` | `BLOJSOM_ADMIN_PLUGIN_USERNAME_PARAM`
`protected static java.lang.String` | `BLOJSOM_PERMISSION_CHECKER`
`protected static java.lang.String` | `BLOJSOM_USER_AUTHENTICATED`
`protected static java.lang.String` | `LOGIN_ACTION`
`protected static java.lang.String` | `LOGIN_ERROR_TEXT_KEY`
`protected static java.lang.String` | `LOGOUT_ACTION`
`protected static java.lang.String` | `PAGE_ACTION`
`protected static java.lang.String` | `PLUGIN_ADMIN_INHERIT_APACHE_CREDENTIALS`
`protected static java.lang.String` | `SUBACTION_PARAM`

Constructor Summary
`BaseAdminPlugin()` Default constructor.

Method Summary
`protected void` | `addOperationResultMessage(java.util.Map context, java.lang.String message)` Adds a message to the context under the `BLOJSOM_ADMIN_PLUGIN_OPERATION_RESULT` key
`protected boolean` | `authenticateUser(javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse, java.util.Map context, Blog blog)` Authenticate the user if their authentication session variable is not present
`boolean` | `checkPermission(Blog blog, java.util.Map permissionContext, java.lang.String username, java.lang.String permission)` Check the permission for a given username and permission
`void` | `cleanup()` Perform any cleanup for the plugin.
`void` | `destroy()` Called when BlojsomServlet is taken out of service
`protected java.lang.String` | `formatAdminResource(java.lang.String resourceID, java.lang.String fallbackText, java.util.Locale locale, java.lang.Object[] arguments)` Retrieve a resource from the administration resource bundle and pass it through the `ResourceManager.format(String, Object[])` method
`protected java.lang.String` | `getAdminResource(java.lang.String resourceID, java.lang.String fallbackText, java.util.Locale locale)` Retrieve a resource from the administration resource bundle
`protected java.lang.String` | `getUsernameFromSession(javax.servlet.http.HttpServletRequest httpServletRequest, Blog blog)` Retrieve the current authorized username for this session
`void` | `init()` Initialize this plugin.
`Entry[]` | `process(javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse, Blog blog, java.util.Map context, Entry[] entries)` Process the blog entries
`void` | `setAuthorizationProvider(AuthorizationProvider authorizationProvider)` Set the authorization provider for use by this plugin
`void` | `setResourceManager(ResourceManager resourceManager)` Set the resource manager for use by this plugin
`void` | `setServletConfig(javax.servlet.ServletConfig servletConfig)` Set the `ServletConfig` for the fetcher to grab initialization parameters

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### _logger

    protected static final org.apache.commons.logging.Log _logger

### BLOJSOM_ADMIN_PLUGIN_AUTHENTICATED_KEY

    protected static final java.lang.String BLOJSOM_ADMIN_PLUGIN_AUTHENTICATED_KEY

See Also:
  Constant Field Values

### BLOJSOM_ADMIN_PLUGIN_USERNAME_KEY

    protected static final java.lang.String BLOJSOM_ADMIN_PLUGIN_USERNAME_KEY

See Also:
  Constant Field Values

### BLOJSOM_ADMIN_PLUGIN_USERNAME

    protected static final java.lang.String BLOJSOM_ADMIN_PLUGIN_USERNAME

See Also:
  Constant Field Values

### BLOJSOM_ADMIN_PLUGIN_USERNAME_PARAM

    protected static final java.lang.String BLOJSOM_ADMIN_PLUGIN_USERNAME_PARAM

See Also:
  Constant Field Values

### BLOJSOM_ADMIN_PLUGIN_PASSWORD_PARAM

    protected static final java.lang.String BLOJSOM_ADMIN_PLUGIN_PASSWORD_PARAM

See Also:
  Constant Field Values

### ACTION_PARAM

    protected static final java.lang.String ACTION_PARAM

See Also:
  Constant Field Values

### SUBACTION_PARAM

    protected static final java.lang.String SUBACTION_PARAM

See Also:
  Constant Field Values

### BLOJSOM_ADMIN_PLUGIN_OPERATION_RESULT

    protected static final java.lang.String BLOJSOM_ADMIN_PLUGIN_OPERATION_RESULT

See Also:
  Constant Field Values

### BLOJSOM_USER_AUTHENTICATED

    protected static final java.lang.String BLOJSOM_USER_AUTHENTICATED

See Also:
  Constant Field Values

### BLOJSOM_ADMIN_MESSAGES_RESOURCE

    protected static final java.lang.String BLOJSOM_ADMIN_MESSAGES_RESOURCE

See Also:
  Constant Field Values

### BLOJSOM_PERMISSION_CHECKER

    protected static final java.lang.String BLOJSOM_PERMISSION_CHECKER

See Also:
  Constant Field Values

### PLUGIN_ADMIN_INHERIT_APACHE_CREDENTIALS

    protected static final java.lang.String PLUGIN_ADMIN_INHERIT_APACHE_CREDENTIALS

See Also:
  Constant Field Values

### LOGIN_ERROR_TEXT_KEY

    protected static final java.lang.String LOGIN_ERROR_TEXT_KEY

See Also:
  Constant Field Values

### ADMIN_ADMINISTRATION_PAGE

    protected static final java.lang.String ADMIN_ADMINISTRATION_PAGE

See Also:
  Constant Field Values

### ADMIN_LOGIN_PAGE

    protected static final java.lang.String ADMIN_LOGIN_PAGE

See Also:
  Constant Field Values

### ADMIN_AJAX_RESPONSE

    protected static final java.lang.String ADMIN_AJAX_RESPONSE

See Also:
  Constant Field Values

### LOGIN_ACTION

    protected static final java.lang.String LOGIN_ACTION

See Also:
  Constant Field Values

### LOGOUT_ACTION

    protected static final java.lang.String LOGOUT_ACTION

See Also:
  Constant Field Values

### PAGE_ACTION

    protected static final java.lang.String PAGE_ACTION

See Also:
  Constant Field Values

### _servletConfig

    protected javax.servlet.ServletConfig _servletConfig

### _authorizationProvider

    protected AuthorizationProvider _authorizationProvider

### _resourceManager

    protected ResourceManager _resourceManager

### _ignoreParams

    protected java.util.Map _ignoreParams

Constructor Detail

### BaseAdminPlugin

    public BaseAdminPlugin()

  Default constructor.

Method Detail

### setServletConfig

    public void setServletConfig(javax.servlet.ServletConfig servletConfig)

  Set the `ServletConfig` for the fetcher to grab initialization parameters

  Parameters:
    `servletConfig` - `ServletConfig`

### setAuthorizationProvider

    public void setAuthorizationProvider(AuthorizationProvider authorizationProvider)

  Set the authorization provider for use by this plugin

  Parameters:
    `authorizationProvider` - `AuthorizationProvider`

### setResourceManager

    public void setResourceManager(ResourceManager resourceManager)

  Set the resource manager for use by this plugin

  Parameters:
    `resourceManager` - `ResourceManager`

### init

    public void init()
              throws PluginException

  Initialize this plugin. This method only called when the plugin is instantiated.

  Specified by:
    `init` in interface `Plugin`
  Throws:
    `PluginException` - If there is an error initializing the plugin

### authenticateUser

    protected boolean authenticateUser(javax.servlet.http.HttpServletRequest httpServletRequest,
                                       javax.servlet.http.HttpServletResponse httpServletResponse,
                                       java.util.Map context,
                                       Blog blog)

  Authenticate the user if their authentication session variable is not present

  Parameters:
    `httpServletRequest` - Request
    `httpServletResponse` - Response
    `context` - Context
    `blog` - `Blog` information
  Returns:
    `true` if the user is authenticated, `false` otherwise

### getUsernameFromSession

    protected java.lang.String getUsernameFromSession(javax.servlet.http.HttpServletRequest httpServletRequest,
                                                      Blog blog)

  Retrieve the current authorized username for this session

  Parameters:
    `httpServletRequest` - Request
    `blog` - `Blog`
  Returns:
    Authorized username for this session or `null` if no user is currently authorized

### checkPermission

    public boolean checkPermission(Blog blog,
                                   java.util.Map permissionContext,
                                   java.lang.String username,
                                   java.lang.String permission)

  Check the permission for a given username and permission

  Specified by:
    `checkPermission` in interface `PermissionedPlugin`
  Parameters:
    `blog` - `Blog` information
    `permissionContext` - `Map` containing context information for checking permission
    `username` - Username
    `permission` - Permission
  Returns:
    `true` if the username has the required permission, `false` otherwise

### addOperationResultMessage

    protected void addOperationResultMessage(java.util.Map context,
                                             java.lang.String message)

  Adds a message to the context under the `BLOJSOM_ADMIN_PLUGIN_OPERATION_RESULT` key

  Parameters:
    `context` - Context
    `message` - Message to add

### getAdminResource

    protected java.lang.String getAdminResource(java.lang.String resourceID,
                                                java.lang.String fallbackText,
                                                java.util.Locale locale)

  Retrieve a resource from the administration resource bundle

  Parameters:
    `resourceID` - ID of resource to retrieve
    `fallbackText` - Text to use as fallback if resource ID is not found
    `locale` - `Locale` to use when retrieving resource
  Returns:
    Text from administration resource bundle given by `resourceID` or `fallbackText` if the resource ID is not found

### formatAdminResource

    protected java.lang.String formatAdminResource(java.lang.String resourceID,
                                                   java.lang.String fallbackText,
                                                   java.util.Locale locale,
                                                   java.lang.Object[] arguments)

  Retrieve a resource from the administration resource bundle and pass it through the `ResourceManager.format(String, Object[])` method

  Parameters:
    `resourceID` - ID of resource to retrieve
    `fallbackText` - Text to use as fallback if resource ID is not found
    `locale` - `Locale` to use when retrieving resource
    `arguments` - Arguments for `ResourceManager.format(String, Object[])`
  Returns:
    Text from administration resource bundle given by `resourceID` formatted appropriately or `fallbackText` if the resource ID could not be formatted

### process

    public Entry[] process(javax.servlet.http.HttpServletRequest httpServletRequest,
                           javax.servlet.http.HttpServletResponse httpServletResponse,
                           Blog blog,
                           java.util.Map context,
                           Entry[] entries)
                    throws PluginException

  Process the blog entries

  Specified by:
    `process` in interface `Plugin`
  Parameters:
    `httpServletRequest` - Request
    `httpServletResponse` - Response
    `blog` - `Blog` instance
    `context` - Context
    `entries` - Blog entries retrieved for the particular request
  Returns:
    Modified set of blog entries
  Throws:
    `PluginException` - If there is an error processing the blog entries

### cleanup

    public void cleanup()
                 throws PluginException

  Perform any cleanup for the plugin. Called after `process(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.blojsom.blog.Blog, java.util.Map, org.blojsom.blog.Entry[])`.

  Specified by:
    `cleanup` in interface `Plugin`
  Throws:
    `PluginException` - If there is an error performing cleanup for this plugin

### destroy

    public void destroy()
                 throws PluginException

  Called when BlojsomServlet is taken out of service

  Specified by:
    `destroy` in interface `Plugin`
  Throws:
    `PluginException` - If there is an error in finalizing this plugin

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD