org.norther.tammi.spray.locale
Class DefaultPipeFilter<F extends Filter>

java.lang.Object
  extended by org.norther.tammi.core.base.Adaptee
      extended by org.norther.tammi.core.base.DefaultContainer<V>
          extended by org.norther.tammi.core.security.DefaultSecureContainer<V>
              extended by org.norther.tammi.spray.filter.DefaultSecureContainerFilter<V>
                  extended by org.norther.tammi.spray.filter.DefaultSecureContainerKeyFilter<F>
                      extended by org.norther.tammi.spray.filter.DefaultBranchFilter<F>
                          extended by org.norther.tammi.spray.filter.DefaultLinkFilter<F>
                              extended by org.norther.tammi.spray.locale.DefaultPipeFilter<F>
Type Parameters:
F - the registered filter type.
All Implemented Interfaces:
Serializable, NotificationBroadcaster, NotificationEmitter, Filter, Localizer, Container<F>, Manageable, MBeanDelegate, Refreshable, CacheClient<String,String>, FallbackMap, FallbackResources, ResourceMap, AccessController, SecureContainer<F>, BranchFilter<F>, ContainerFilter<F>, ContainerKeyFilter<F>, KeyFilter, LinkFilter<F>, SecureContainerFilter<F>, SecureContainerKeyFilter<F>, SecureFilter, PipeFilter<F>, ResourceFilter
Direct Known Subclasses:
DefaultHostFilter, DefaultServiceFilter

public class DefaultPipeFilter<F extends Filter>
extends DefaultLinkFilter<F>
implements PipeFilter<F>

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

Version:
$Id: DefaultPipeFilter.java,v 1.11 2010-06-22 17:50:20 cvsimp Exp $
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.DefaultBranchFilter
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
 
Constructor Summary
  DefaultPipeFilter()
          Constructs a new filter.
protected DefaultPipeFilter(KeyFilter filter)
          Constructs a new filter with a filter adaptee.
  DefaultPipeFilter(String key)
          Constructs a new filter with a key.
 
Method Summary
 void addResourceBundleName(String qualifier, String baseName)
          Adds a resource bundle name for the qualified name.
 void addResourceBundleNames(String qualifier, String[] baseNames)
          Adds resource bundle names for the qualified name.
 void clearCached()
          Clears all cached entries without notifying.
 void clearResourceBundleNames()
          Clears all resource bundle names.
 void clearResourceBundleNames(String qualifier)
          Clears all resource bundle names of the qualified name.
 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<String,String> 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.
 String[] getResourceBundleNames(String qualifier)
          Gets the qualified resource bundle names.
 ObjectName getResourceFinderName()
          Gets the resource finder of this map.
 ObjectName getSharedCacheName()
          Gets the the shared cache of this client.
 boolean isCachingDisabled()
          Checks whether the caching is disabled.
 Set<String> qualifierSet()
          Returns a read-only set of resource qualifiers.
 void refresh()
          Refreshes the MBean.
 void removeCache()
          Removes the cache.
 void removeResourceBundleName(String qualifier, String baseName)
          Removes a 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, Locale... locale)
          Resolves a localized object for the qualified name, key and locale.
 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, Locale... locale)
          Resolves a localized string for the qualified name, key and locale.
 String[] resolveLocalizedStrings(String name, String key, Locale... locale)
          Resolves a localized string array for the qualified name, key and locale.
 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 a resource bundle name for the qualified name.
 void setResourceBundleNames(String qualifier, String[] baseNames)
          Sets the resource bundle names of the qualified name.
 void setResourceFinderName(ObjectName finder)
          Sets the resource finder of this map.
 void setSharedCacheName(ObjectName cache)
          Sets the shared cache of this client.
 
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.DefaultBranchFilter
checkPermission, checkPermission, doFilter, getBranch, getDefaultBranch, getFilter, setDefaultBranch
 
Methods inherited from class org.norther.tammi.spray.filter.DefaultSecureContainerKeyFilter
getFilter, getKey, getKeyValue, getKeyValues, isLinkedKey, setKey, setLinkedKey
 
Methods inherited from class org.norther.tammi.spray.filter.DefaultSecureContainerFilter
checkPermission, destroy, getFilterConfig, getRequestMap, getSessionMap, init
 
Methods inherited from class org.norther.tammi.core.security.DefaultSecureContainer
addAllowedPermission, addDeniedPermission, allowedPermissions, allowedRoleSet, checkPermission, clearAllowedPermissions, clearDeniedPermissions, deniedPermissions, deniedRoleSet, 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.BranchFilter
checkPermission, checkPermission, getBranch, getDefaultBranch, getFilter, setDefaultBranch
 
Methods inherited from interface org.norther.tammi.spray.filter.SecureFilter
checkPermission
 
Methods inherited from interface org.norther.tammi.core.security.AccessController
addAllowedPermission, addDeniedPermission, allowedPermissions, allowedRoleSet, checkPermission, clearAllowedPermissions, clearDeniedPermissions, deniedPermissions, deniedRoleSet, getPermissibleRoles, isProtected, removeAllowedPermissions, removeDeniedPermissions, setAllowedPermissions, setDeniedPermissions
 
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 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.

DefaultPipeFilter

protected DefaultPipeFilter(KeyFilter filter)
Constructs a new filter with a filter adaptee.

Parameters:
filter - the filter adaptee.
Method Detail

isCachingDisabled

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

Specified by:
isCachingDisabled in interface CacheClient<String,String>
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<String,String>
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<String,String>
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<String,String>
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<String,String>

getCache

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

Specified by:
getCache in interface CacheClient<String,String>
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<String,String>

getSharedCacheName

public ObjectName getSharedCacheName()
Description copied from interface: CacheClient
Gets the the shared cache of this client.

Specified by:
getSharedCacheName in interface CacheClient<String,String>
Returns:
the object name of the shared cache or a query.

setSharedCacheName

public void setSharedCacheName(ObjectName cache)
Description copied from interface: CacheClient
Sets the shared cache of this client. If it is not set, the default one will be used.

Specified by:
setSharedCacheName in interface CacheClient<String,String>
Parameters:
cache - the object name of the shared cache or a query.

refresh

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

Specified by:
refresh in interface Refreshable
Overrides:
refresh in class DefaultLinkFilter<F extends Filter>

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<F extends Filter>
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.

getResourceBundleNames

public String[] getResourceBundleNames(String qualifier)
Description copied from interface: ResourceMap
Gets the qualified resource bundle names.

Specified by:
getResourceBundleNames in interface ResourceMap
Parameters:
qualifier - the resource qualifier.
Returns:
the base names of the resource bundles or null.

setResourceBundleNames

public void setResourceBundleNames(String qualifier,
                                   String[] baseNames)
Description copied from interface: ResourceMap
Sets the resource bundle names of the qualified name.

Specified by:
setResourceBundleNames in interface ResourceMap
Parameters:
qualifier - the resource qualifier.
baseNames - the base names of the resource bundles.

setResourceBundleName

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

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

addResourceBundleNames

public void addResourceBundleNames(String qualifier,
                                   String[] baseNames)
Description copied from interface: ResourceMap
Adds resource bundle names for the qualified name.

Specified by:
addResourceBundleNames in interface ResourceMap
Parameters:
qualifier - the resource qualifier.
baseNames - the base names of the resource bundles.

addResourceBundleName

public void addResourceBundleName(String qualifier,
                                  String baseName)
Description copied from interface: ResourceMap
Adds a resource bundle name for the qualified name.

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

removeResourceBundleName

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

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

clearResourceBundleNames

public void clearResourceBundleNames(String qualifier)
Description copied from interface: ResourceMap
Clears all resource bundle names of the qualified name.

Specified by:
clearResourceBundleNames 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<String> 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.

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,
                                                  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,
                                       Locale... locale)
Description copied from interface: Localizer
Resolves a localized resource for the qualified name, key and locale. 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.
locale - the locale.
Returns:
the localized resource or the key if not found.

resolveLocalizedObject

public Object resolveLocalizedObject(String name,
                                     String key,
                                     Locale... locale)
Description copied from interface: Localizer
Resolves a localized object for the qualified name, key and locale.

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

resolveLocalizedString

public String resolveLocalizedString(String name,
                                     String key,
                                     Locale... locale)
Description copied from interface: Localizer
Resolves a localized string for the qualified name, key and locale.

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

resolveLocalizedStrings

public String[] resolveLocalizedStrings(String name,
                                        String key,
                                        Locale... locale)
Description copied from interface: Localizer
Resolves a localized string array for the qualified name, key and locale.

Specified by:
resolveLocalizedStrings in interface Localizer
Parameters:
name - the qualified name.
key - the resource key.
locale - the locale.
Returns:
the localized string array or the key in an array if not found.


Copyright © 2004 The Norther Organization. All rights reserved.