org.norther.tammi.spray.locale
Class DefaultPipeFilter

java.lang.Object
  extended by org.norther.tammi.core.base.Adaptee
      extended by org.norther.tammi.core.base.DefaultContainer
          extended by org.norther.tammi.core.security.DefaultSecureContainer
              extended by org.norther.tammi.spray.filter.AbstractSecureContainerFilter
                  extended by org.norther.tammi.spray.filter.AbstractSecureContainerKeyFilter
                      extended by org.norther.tammi.spray.filter.DefaultSecureContainerKeyFilter
                          extended by org.norther.tammi.spray.filter.DefaultBranchingFilter
                              extended by org.norther.tammi.spray.filter.DefaultLinkFilter
                                  extended by org.norther.tammi.spray.locale.DefaultPipeFilter
All Implemented Interfaces:
Serializable, NotificationBroadcaster, NotificationEmitter, Filter, Localizer, Container, Manageable, MBeanDelegate, Refreshable, CacheClient, FallbackMap, FallbackResources, ResourceMap, AccessController, SecureContainer, BranchingFilter, ContainerFilter, ContainerKeyFilter, KeyFilter, LinkFilter, SecureContainerFilter, SecureContainerKeyFilter, SecureFilter, PipeFilter, ResourceFilter
Direct Known Subclasses:
DefaultHostFilter, DefaultServiceFilter

public class DefaultPipeFilter
extends DefaultLinkFilter
implements PipeFilter

A default implementation of PipeFilter. By default, its linked key attribute is set to true.

Author:
Ilkka Priha
See Also:
Serialized Form

Field Summary
static String PIPE_KEY
          The pipe key.
 
Fields inherited from class org.norther.tammi.spray.filter.DefaultLinkFilter
LINK_KEY
 
Fields inherited from class org.norther.tammi.spray.filter.DefaultBranchingFilter
BRANCH_KEY
 
Fields inherited from class org.norther.tammi.core.base.Adaptee
ADAPTEE_NOTIF_DESCRIPTION, ADAPTEE_NOTIFICATIONS
 
Fields inherited from interface org.norther.tammi.acorn.locale.Localizer
ANY_NAME
 
Fields inherited from interface org.norther.tammi.core.base.MBeanDelegate
ARRAY_TYPE, OBJECT_TYPE, PRIMITIVE_TYPE, STRING_TYPE
 
Constructor Summary
DefaultPipeFilter()
          Constructs a new filter.
DefaultPipeFilter(String key)
          Constructs a new filter with a key.
 
Method Summary
 void clearCached()
          Clears all cached entries without notifying.
 void clearResourceBundleNames()
          Clears all resource bundle names.
 void expireCached(long timestamp)
          Expires all cached entries notifying them about expiration.
 void expireFraction(long timestamp, float fraction)
          Expires the specified fraction of cached entries notifying them about expiration.
 ConcurrentMap getCache(boolean create)
          Gets and optionally creates the cache.
 String getDefaultBaseName()
          Gets the default base name.
 String getFallbackBaseName()
          Gets the fallback base name.
 LookupResourceBundle getFallbackBundle(Locale locale)
          Gets the fallback bundle for the specified locale.
 LookupResourceBundle getFallbackBundle(String key, Locale locale)
          Gets the fallback bundle for the specified key and locale.
 ObjectName getFallbackResourcesName()
          Gets the fallback resources of this map.
 String getPlugInBaseName(String key)
          Gets the base name of the resource bundle class associated with the specified plug-in key.
 long getRefreshed()
          Gets the last refresh timestamp.
 LookupResourceBundle getResourceBundle(String baseName)
          Gets a resource bundle for the specified base name.
 LookupResourceBundle getResourceBundle(String baseName, Locale locale)
          Gets a resource bundle for the specified base name and locale.
 String getResourceBundleName(String qualifier)
          Gets the qualified resource bundle name.
 ObjectName getResourceFinderName()
          Gets the resource finder of this map.
 boolean isCachingDisabled()
          Checks whether the caching is disabled.
 Set qualifierSet()
          Returns a read-only set of resource qualifiers.
 void refresh()
          Refreshes the MBean.
 void removeCache()
          Removes the cache.
 void removeResourceBundleName(String qualifier)
          Removes the resource bundle name of the qualified name.
 LookupResourceBundle resolveFallbackBundle(String name, Locale locale)
          Resolves a fallback bundle for the qualified name and locale.
 LookupResourceBundle resolveFallbackBundle(String name, String key, Locale locale)
          Resolves a fallback bundle for the qualified name, key and locale.
 String resolveFallbackBundleName(String name)
          Resolves a fallback bundle name for the qualified name.
 Object resolveFallbackResource(String name, String key, Locale locale)
          Resolves a localized resource for the qualified name, key and locale.
 Object resolveLocalizedObject(String name, String key)
          Resolves a localized object for the qualified name and key.
 Object resolveLocalizedObject(String name, String key, Locale locale)
          Resolves a localized object for the qualified name, key and locale.
 Object resolveLocalizedResource(String name, String key)
          Resolves a localized resource for the qualified name and key.
 Object resolveLocalizedResource(String name, String key, Locale locale)
          Resolves a localized resource for the qualified name, key and locale.
 String resolveLocalizedString(String name, String key)
          Resolves a localized string for the qualified name and key.
 String resolveLocalizedString(String name, String key, Locale locale)
          Resolves a localized string for the qualified name, key and locale.
 String[] resolveLocalizedStrings(String name, String key)
          Resolves a localized string array for the qualified name and key.
 String[] resolveLocalizedStrings(String name, String key, Locale locale)
          Resolves a localized string array for the qualified name, key and locale.
 LookupResourceBundle resolveResourceBundle(String name)
          Resolves a resource bundle for the qualified name.
 LookupResourceBundle resolveResourceBundle(String name, Locale locale)
          Resolves a resource bundle for the qualified name and locale.
 String resolveResourceBundleName(String name)
          Resolves a resource bundle name for the qualified name.
 void setCachingDisabled(boolean flag)
          Sets the caching disabled flag.
 void setDefaultBaseName(String baseName)
          Sets the default base name.
 void setFallbackResourcesName(ObjectName finder)
          Sets the fallback resources of this map.
 void setResourceBundleName(String qualifier, String baseName)
          Sets the resource bundle name of the qualified name.
 void setResourceFinderName(ObjectName finder)
          Sets the resource finder of this map.
 
Methods inherited from class org.norther.tammi.spray.filter.DefaultLinkFilter
clear, clearLinkAnchors, containsLinkAnchor, getContainerKey, getLinkAnchor, getLinkAnchor, getLinkName, indexOfLinkAnchor, linkAnchorMap, linkAnchorMap, remove, removeLinkAnchor, removeLinkAnchor, setLinkAnchor, setLinkAnchor, setLinkName, setLinkName
 
Methods inherited from class org.norther.tammi.spray.filter.DefaultBranchingFilter
checkPermission, checkPermission, doFilter, getBranchKey, getDefaultKey, getFilter, setDefaultKey
 
Methods inherited from class org.norther.tammi.spray.filter.DefaultSecureContainerKeyFilter
getFilter
 
Methods inherited from class org.norther.tammi.spray.filter.AbstractSecureContainerKeyFilter
getKey, getKeyValue, getKeyValues, isLinkedKey, setKey, setLinkedKey
 
Methods inherited from class org.norther.tammi.spray.filter.AbstractSecureContainerFilter
checkPermission, checkPermission, checkPermission, destroy, getFilterConfig, getRequestMap, getSessionMap, init
 
Methods inherited from class org.norther.tammi.core.security.DefaultSecureContainer
addAllowedPermission, addDeniedPermission, allowedPermissions, allowedRoleSet, checkPermission, checkPermission, checkPermission, clearAllowedPermissions, clearDeniedPermissions, deniedPermissions, deniedRoleSet, getPermissibleRoles, getPermissibleRoles, getPermissibleRoles, isProtected, removeAllowedPermissions, removeDeniedPermissions, setAllowedPermissions, setDeniedPermissions
 
Methods inherited from class org.norther.tammi.core.base.DefaultContainer
containsKey, get, getContainerKey, getContainerKey, getMBean, getMBeanHandle, getMBeanHandles, getMBeanInterface, getMBeanInterface, getObjectName, getObjectNames, getQueryPattern, registryKeySet, registryKeySet, registryKeySet, registryKeySet, registryMap, registrySize, setMBeanInterface, setQueryPattern, setQueryPattern
 
Methods inherited from class org.norther.tammi.core.base.Adaptee
addAdaptee, addNotificationListener, getAttributeSupport, getBroker, getCanonicalName, getDomain, getFactory, getLoader, getLog, getLog, getMBean, getMBeanServer, getNotificationInfo, getObjectName, getRegistrationTime, getSequenceNumber, hasListeners, isRegistered, postmanaged, premanaged, removeNotificationListener, removeNotificationListener, sendNotification, sendNotification, sendNotification, sendNotification, unmanaged, unregister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.norther.tammi.spray.filter.LinkFilter
clearLinkAnchors, containsLinkAnchor, getLinkAnchor, getLinkAnchor, getLinkName, indexOfLinkAnchor, linkAnchorMap, linkAnchorMap, removeLinkAnchor, removeLinkAnchor, setLinkAnchor, setLinkAnchor, setLinkName, setLinkName
 
Methods inherited from interface org.norther.tammi.spray.filter.BranchingFilter
checkPermission, checkPermission, getBranchKey, getDefaultKey, getFilter, setDefaultKey
 
Methods inherited from interface org.norther.tammi.core.base.Container
clear, containsKey, get, getContainerKey, getContainerKey, getContainerKey, getMBean, getMBeanInterface, getMBeanInterface, getObjectName, getObjectNames, getQueryPattern, registryKeySet, registryKeySet, registryKeySet, registryKeySet, registryMap, registrySize, remove, setMBeanInterface, setQueryPattern, setQueryPattern
 
Methods inherited from interface javax.servlet.Filter
destroy, doFilter, init
 
Methods inherited from interface org.norther.tammi.spray.filter.SecureFilter
checkPermission, checkPermission, checkPermission
 
Methods inherited from interface org.norther.tammi.core.security.AccessController
addAllowedPermission, addDeniedPermission, allowedPermissions, allowedRoleSet, checkPermission, checkPermission, checkPermission, clearAllowedPermissions, clearDeniedPermissions, deniedPermissions, deniedRoleSet, getPermissibleRoles, getPermissibleRoles, getPermissibleRoles, isProtected, removeAllowedPermissions, removeDeniedPermissions, setAllowedPermissions, setDeniedPermissions
 
Methods inherited from interface javax.servlet.Filter
destroy, doFilter, init
 
Methods inherited from interface org.norther.tammi.core.base.Container
clear, containsKey, get, getContainerKey, getContainerKey, getContainerKey, getMBean, getMBeanInterface, getMBeanInterface, getObjectName, getObjectNames, getQueryPattern, registryKeySet, registryKeySet, registryKeySet, registryKeySet, registryMap, registrySize, remove, setMBeanInterface, setQueryPattern, setQueryPattern
 
Methods inherited from interface javax.servlet.Filter
destroy, doFilter, init
 
Methods inherited from interface org.norther.tammi.spray.filter.KeyFilter
getKey, getKeyValue, getKeyValues, isLinkedKey, setKey, setLinkedKey
 
Methods inherited from interface javax.servlet.Filter
destroy, doFilter, init
 

Field Detail

PIPE_KEY

public static final String PIPE_KEY
The pipe key.

See Also:
Constant Field Values
Constructor Detail

DefaultPipeFilter

public DefaultPipeFilter()
Constructs a new filter.


DefaultPipeFilter

public DefaultPipeFilter(String key)
Constructs a new filter with a key.

Parameters:
key - the filter key.
Method Detail

isCachingDisabled

public boolean isCachingDisabled()
Description copied from interface: CacheClient
Checks whether the caching is disabled.

Specified by:
isCachingDisabled in interface CacheClient
Returns:
true if the caching is disabled, true otherwise.

setCachingDisabled

public void setCachingDisabled(boolean flag)
Description copied from interface: CacheClient
Sets the caching disabled flag.

Specified by:
setCachingDisabled in interface CacheClient
Parameters:
flag - the caching disabled flag.

expireCached

public void expireCached(long timestamp)
Description copied from interface: CacheClient
Expires all cached entries notifying them about expiration.

Specified by:
expireCached in interface CacheClient
Parameters:
timestamp - the timestamp of the expiration.

expireFraction

public void expireFraction(long timestamp,
                           float fraction)
Description copied from interface: CacheClient
Expires the specified fraction of cached entries notifying them about expiration.

Specified by:
expireFraction in interface CacheClient
Parameters:
timestamp - the timestamp of the expiration.
fraction - the fraction of entries to expire (0.0..1.0).

clearCached

public void clearCached()
Description copied from interface: CacheClient
Clears all cached entries without notifying.

Specified by:
clearCached in interface CacheClient

getCache

public ConcurrentMap getCache(boolean create)
Description copied from interface: CacheClient
Gets and optionally creates the cache.

Specified by:
getCache in interface CacheClient
Parameters:
create - true to create a missing cache.
Returns:
the cache or null if disabled.

removeCache

public void removeCache()
Description copied from interface: CacheClient
Removes the cache.

Specified by:
removeCache in interface CacheClient

refresh

public void refresh()
Description copied from interface: Refreshable
Refreshes the MBean.

Specified by:
refresh in interface Refreshable
Overrides:
refresh in class DefaultLinkFilter

getRefreshed

public long getRefreshed()
Description copied from interface: Refreshable
Gets the last refresh timestamp.

Specified by:
getRefreshed in interface Refreshable
Overrides:
getRefreshed in class DefaultLinkFilter
Returns:
the timestamp of the last refresh.

getResourceFinderName

public ObjectName getResourceFinderName()
Description copied from interface: ResourceMap
Gets the resource finder of this map.

Specified by:
getResourceFinderName in interface ResourceMap
Returns:
the object name of the resource finder or a query.

setResourceFinderName

public void setResourceFinderName(ObjectName finder)
Description copied from interface: ResourceMap
Sets the resource finder of this map. If it is not set, the default one will be used.

Specified by:
setResourceFinderName in interface ResourceMap
Parameters:
finder - the object name of the resource finder or a query.

getPlugInBaseName

public String getPlugInBaseName(String key)
Description copied from interface: ResourceMap
Gets the base name of the resource bundle class associated with the specified plug-in key.

Specified by:
getPlugInBaseName in interface ResourceMap
Parameters:
key - the plug-in key.
Returns:
the base name of the resource bundle class.

getFallbackResourcesName

public ObjectName getFallbackResourcesName()
Description copied from interface: ResourceMap
Gets the fallback resources of this map.

Specified by:
getFallbackResourcesName in interface ResourceMap
Returns:
the object name of the fallback resources or a query.

setFallbackResourcesName

public void setFallbackResourcesName(ObjectName finder)
Description copied from interface: ResourceMap
Sets the fallback resources of this map.

Specified by:
setFallbackResourcesName in interface ResourceMap
Parameters:
finder - the object name of the fallback resources or a query.

getDefaultBaseName

public String getDefaultBaseName()
Description copied from interface: ResourceMap
Gets the default base name.

Specified by:
getDefaultBaseName in interface ResourceMap
Returns:
the base name of the default bundle or null.

setDefaultBaseName

public void setDefaultBaseName(String baseName)
Description copied from interface: ResourceMap
Sets the default base name.

Specified by:
setDefaultBaseName in interface ResourceMap
Parameters:
baseName - the base name of the default bundle.

getResourceBundleName

public String getResourceBundleName(String qualifier)
Description copied from interface: ResourceMap
Gets the qualified resource bundle name.

Specified by:
getResourceBundleName in interface ResourceMap
Parameters:
qualifier - the resource qualifier.
Returns:
the base name of the resource bundle or null.

setResourceBundleName

public void setResourceBundleName(String qualifier,
                                  String baseName)
Description copied from interface: ResourceMap
Sets the resource bundle name of the qualified name.

Specified by:
setResourceBundleName in interface ResourceMap
Parameters:
qualifier - the resource qualifier.
baseName - the base name of the resource bundle.

removeResourceBundleName

public void removeResourceBundleName(String qualifier)
Description copied from interface: ResourceMap
Removes the resource bundle name of the qualified name.

Specified by:
removeResourceBundleName in interface ResourceMap
Parameters:
qualifier - the resource qualifier.

clearResourceBundleNames

public void clearResourceBundleNames()
Description copied from interface: ResourceMap
Clears all resource bundle names.

Specified by:
clearResourceBundleNames in interface ResourceMap

qualifierSet

public Set qualifierSet()
Description copied from interface: ResourceMap
Returns a read-only set of resource qualifiers.

Specified by:
qualifierSet in interface ResourceMap
Returns:
a set of qualifiers.

getResourceBundle

public LookupResourceBundle getResourceBundle(String baseName)
Description copied from interface: ResourceMap
Gets a resource bundle for the specified base name.

Specified by:
getResourceBundle in interface ResourceMap
Parameters:
baseName - the base name.
Returns:
the resource bundle or null.

getResourceBundle

public LookupResourceBundle getResourceBundle(String baseName,
                                              Locale locale)
Description copied from interface: ResourceMap
Gets a resource bundle for the specified base name and locale.

Specified by:
getResourceBundle in interface ResourceMap
Parameters:
baseName - the base name.
locale - the locale.
Returns:
the resource bundle or null.

resolveResourceBundleName

public String resolveResourceBundleName(String name)
Description copied from interface: ResourceMap
Resolves a resource bundle name for the qualified name. The fully qualified name is checked first. If it fails, the plain base name is tried. If it fails too, the packages of the qualified name are applied to defined base names by starting from the most specific one. If also the packages fail, fallback resources are applied. Finally, the default base name is applied if nothing else matches.

Specified by:
resolveResourceBundleName in interface ResourceMap
Parameters:
name - the qualified name.
Returns:
the base name of the resource bundle or null.

resolveResourceBundle

public LookupResourceBundle resolveResourceBundle(String name)
Description copied from interface: ResourceMap
Resolves a resource bundle for the qualified name.

Specified by:
resolveResourceBundle in interface ResourceMap
Parameters:
name - the qualified name.
Returns:
the resource bundle or null.

resolveResourceBundle

public LookupResourceBundle resolveResourceBundle(String name,
                                                  Locale locale)
Description copied from interface: ResourceMap
Resolves a resource bundle for the qualified name and locale. The fully qualified name is checked first. If it fails, the plain base name is tried. If it fails too, the packages of the qualified name are applied to defined base names by starting from the most specific one. If also the packages fail, fallback resources are applied. Finally, the default base name is applied if nothing else matches.

Specified by:
resolveResourceBundle in interface ResourceMap
Parameters:
name - the qualified name.
locale - the locale.
Returns:
the resource bundle or null.

getFallbackBaseName

public String getFallbackBaseName()
Description copied from interface: FallbackResources
Gets the fallback base name.

Specified by:
getFallbackBaseName in interface FallbackResources
Returns:
the base name of the fallback bundle or null.

getFallbackBundle

public LookupResourceBundle getFallbackBundle(Locale locale)
Description copied from interface: FallbackResources
Gets the fallback bundle for the specified locale.

Specified by:
getFallbackBundle in interface FallbackResources
Parameters:
locale - the locale.
Returns:
the fallback bundle or null.

getFallbackBundle

public LookupResourceBundle getFallbackBundle(String key,
                                              Locale locale)
Description copied from interface: FallbackResources
Gets the fallback bundle for the specified key and locale.

Specified by:
getFallbackBundle in interface FallbackResources
Parameters:
key - the resource key.
locale - the locale.
Returns:
the fallback bundle or null.

resolveFallbackBundleName

public String resolveFallbackBundleName(String name)
Description copied from interface: FallbackResources
Resolves a fallback bundle name for the qualified name.

Specified by:
resolveFallbackBundleName in interface FallbackResources
Parameters:
name - the qualified name.
Returns:
the base name of the fallback bundle or null.

resolveFallbackBundle

public LookupResourceBundle resolveFallbackBundle(String name,
                                                  Locale locale)
Description copied from interface: FallbackResources
Resolves a fallback bundle for the qualified name and locale.

Specified by:
resolveFallbackBundle in interface FallbackResources
Parameters:
name - the qualified name.
locale - the locale.
Returns:
the fallback bundle or null.

resolveFallbackBundle

public LookupResourceBundle resolveFallbackBundle(String name,
                                                  String key,
                                                  Locale locale)
Description copied from interface: FallbackResources
Resolves a fallback bundle for the qualified name, key and locale.

Specified by:
resolveFallbackBundle in interface FallbackResources
Parameters:
name - the qualified name.
key - the resource key.
locale - the locale.
Returns:
the fallback bundle or null.

resolveFallbackResource

public Object resolveFallbackResource(String name,
                                      String key,
                                      Locale locale)
Description copied from interface: FallbackResources
Resolves a localized resource for the qualified name, key and locale.

Specified by:
resolveFallbackResource in interface FallbackResources
Parameters:
name - the qualified name.
key - the resource key.
locale - the locale.
Returns:
the localized resource or the key if not found.

resolveLocalizedResource

public Object resolveLocalizedResource(String name,
                                       String key)
Description copied from interface: Localizer
Resolves a localized resource for the qualified name and key. A localized resource mapped to the key and defined for the most specific package of the qualified name is returned. If no qualified resource is available, the key is returned unmodified.

If the qualified name is a wildcard "*", the first mapped resource regardless of its package is returned.

Specified by:
resolveLocalizedResource in interface Localizer
Parameters:
name - the qualified name.
key - the resource key.
Returns:
the localized resource or the key if not found.

resolveLocalizedResource

public Object resolveLocalizedResource(String name,