com.cc.framework.adapter
Class AdapterUtil

java.lang.Object
  extended bycom.cc.framework.adapter.AdapterUtil

public abstract class AdapterUtil
extends java.lang.Object

Helper class to create informations about the session, request object or the system environment.

Since:
1.0
Version:
$Revision: 1.2 $
Author:
Harald Schulz

Constructor Summary
private AdapterUtil()
          Constructor
 
Method Summary
static java.util.Locale localeFromName(HttpContext context, java.lang.String localeName)
          Gets the Locale Object from a Locale Name
static java.util.Locale localeFromSession(HttpContext context)
          Gets the Locale Object for the running session
static java.lang.String localize(HttpContext context, java.lang.String keyOrString)
          Localizes a string depending on the localization settings of the Painter context.
static java.lang.String localize(HttpContext context, java.lang.String keyOrString, java.util.Locale locale)
          Localizes a string depending on the localization settings of the Painter context.
static java.lang.String localize(HttpContext context, java.lang.String keyOrString, java.lang.Object[] arguments)
          Localizes a string depending on the localization settings of the Painter context.
static java.lang.String localize(HttpContext context, java.lang.String keyOrString, java.lang.Object[] arguments, java.util.Locale locale)
          Localizes a string depending on the localization settings of the Painter context.
static java.lang.String localize(HttpContext context, java.lang.String keyOrString, java.lang.Object[] arguments, java.util.Locale locale, boolean returnNull)
          Localizes a string depending on the localization settings of the Painter context.
static java.lang.String localizeKey(HttpContext context, java.lang.String resourceKey, java.lang.Object[] arguments, java.util.Locale locale, boolean returnNull)
          Localizes a string depending on the localization settings of the Painter context.
static java.lang.Object lookup(javax.servlet.jsp.PageContext pageContext, java.lang.String name, java.lang.String property, HttpScope scope)
          Locate and return the specified property of the specified bean, from an optionally specified scope, in the specified page context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AdapterUtil

private AdapterUtil()
Constructor

Method Detail

lookup

public static java.lang.Object lookup(javax.servlet.jsp.PageContext pageContext,
                                      java.lang.String name,
                                      java.lang.String property,
                                      HttpScope scope)
                               throws java.lang.Exception
Locate and return the specified property of the specified bean, from an optionally specified scope, in the specified page context. If an exception is thrown, it will have already been saved via a call to saveException().

Parameters:
pageContext - Page context to be searched
name - Name of the bean to be retrieved
property - Name of the property to be retrieved, or null to retrieve the bean itself
scope - Scope to be searched (page, request, session, application) or null to use findAttribute() instead
Returns:
property of specified JavaBean
Throws:
java.lang.Exception - if the bean could not be found or if accessing the beans property causes an IllegalAccessException, IllegalArgumentException, InvocationTargetException, or NoSuchMethodException

localize

public static java.lang.String localize(HttpContext context,
                                        java.lang.String keyOrString)
Localizes a string depending on the localization settings of the Painter context.

Parameters:
context - JSP Page Context
keyOrString - String Literal or Resource Key
Returns:
localized String

localize

public static java.lang.String localize(HttpContext context,
                                        java.lang.String keyOrString,
                                        java.util.Locale locale)
Localizes a string depending on the localization settings of the Painter context.

Parameters:
context - JSP Page Context
keyOrString - String Literal or Resource Key
locale - Locale or null
Returns:
localized String

localize

public static java.lang.String localize(HttpContext context,
                                        java.lang.String keyOrString,
                                        java.lang.Object[] arguments)
Localizes a string depending on the localization settings of the Painter context.

Parameters:
context - JSP Page Context
keyOrString - String Literal or Resource Key
arguments - MessageFormat arguments or null
Returns:
localized String

localize

public static java.lang.String localize(HttpContext context,
                                        java.lang.String keyOrString,
                                        java.lang.Object[] arguments,
                                        java.util.Locale locale)
Localizes a string depending on the localization settings of the Painter context.

Parameters:
context - JSP Page Context
keyOrString - String Literal or Resource Key
arguments - MessageFormat arguments or null
locale - Locale or null
Returns:
localized String

localize

public static java.lang.String localize(HttpContext context,
                                        java.lang.String keyOrString,
                                        java.lang.Object[] arguments,
                                        java.util.Locale locale,
                                        boolean returnNull)
Localizes a string depending on the localization settings of the Painter context. A key is searched in the following order:
  1. If no user defined resource bundle is used. The resource is searched under the STRUTS_MESSAGES_KEY.
  2. If an user defined resource bundle is used (key@bundle) the resource is searched in the specified resource bundle.
  3. If the key was not found before, the resource is searched in the framework resource bundle under the key Globals.MESSAGE.

Parameters:
context - JSP Page Context
keyOrString - The String literal or resource key.
arguments - MessageFormat arguments or null
locale - Locale or null
returnNull - controls whether to return null or a not present indicator
Returns:
localized String

localizeKey

public static java.lang.String localizeKey(HttpContext context,
                                           java.lang.String resourceKey,
                                           java.lang.Object[] arguments,
                                           java.util.Locale locale,
                                           boolean returnNull)
Localizes a string depending on the localization settings of the Painter context. A key is searched in the following order:
  1. If no user defined resource bundle is used. The resource is searched under the STRUTS_MESSAGES_KEY.
  2. If an user defined resource bundle is used (key@bundle) the resource is searched in the specified resource bundle.
  3. If the key was not found before, the resource is searched in the framework resource bundle under the key Globals.MESSAGE.

Parameters:
context - JSP Page Context
resourceKey - The resource key.
arguments - MessageFormat arguments or null
locale - Locale or null
returnNull - controls whether to return null or a not present indicator
Returns:
localized String

localeFromName

public static java.util.Locale localeFromName(HttpContext context,
                                              java.lang.String localeName)
Gets the Locale Object from a Locale Name

Parameters:
context - JSP Page Context
localeName - The Name
Returns:
Locale Object or null

localeFromSession

public static java.util.Locale localeFromSession(HttpContext context)
Gets the Locale Object for the running session

Parameters:
context - JSP Page Context
Returns:
Locale Object or null


Copyright © 2000-2005 SCC Informationssysteme GmbH. All Rights Reserved.