org.apache.jetspeed.decoration
Class DecorationFactoryImpl

java.lang.Object
  extended by org.apache.jetspeed.decoration.DecorationFactoryImpl
All Implemented Interfaces:
DecorationFactory, org.springframework.web.context.ServletContextAware

public class DecorationFactoryImpl
extends java.lang.Object
implements DecorationFactory, org.springframework.web.context.ServletContextAware

Author:
Scott T. Weaver, Steve Milek
See Also:
DecorationFactory

Field Summary
 
Fields inherited from interface org.apache.jetspeed.decoration.DecorationFactory
DEFAULT_NESTED_LAYOUT_PORTLET_DECORATOR
 
Constructor Summary
DecorationFactoryImpl(PortletRegistry registry, java.lang.String decorationsPath, ResourceValidator validator, JetspeedCache decorationConfigurationCache)
           
DecorationFactoryImpl(java.lang.String decorationsPath, ResourceValidator validator)
           
DecorationFactoryImpl(java.lang.String decorationsPath, ResourceValidator validator, JetspeedCache decorationConfigurationCache)
           
 
Method Summary
 void clearCache(RequestContext requestContext)
          Clears the lookup cache of all previous located pathes.
protected  Path createClientPath(java.lang.String name, RequestContext requestContext, java.lang.String decorationType)
          Creates a org.apache.jetspeed.util.Path object based off of the user's client browser and locale.
protected  Path getBasePath(java.lang.String decorationType)
           
protected  Path getBasePath(java.lang.String name, java.lang.String decorationType)
           
protected  java.util.Properties getCachedConfiguration(java.lang.String name, java.lang.String type)
           
protected  java.lang.String getCachedConfigurationKey(java.lang.String type, java.lang.String name)
           
 java.util.Properties getConfiguration(java.lang.String name, java.lang.String type)
          Gets the configuration (decorator.properties) object for the decoration.
 Decoration getDecoration(Page page, Fragment fragment, RequestContext requestContext)
          Returns a Decoration for a specific Fragment contained within the specified Page.
protected  JetspeedCache getDecorationConfigurationCache()
           
protected  java.lang.String getDefaultDecorationName(Fragment fragment, Page page)
          Returns a the default decoration name for the specific Fragment type.
 java.lang.String getDefaultDesktopLayoutDecoration()
          Get the default desktop layout decoration to be used when selected layout decoration does not support /desktop.
 java.lang.String getDefaultDesktopPortletDecoration()
          Get the default desktop portlet decoration to be used when selected portlet decoration does not support /desktop.
 java.util.Set getDesktopPageDecorations(RequestContext request)
          Get the portal-wide list of available desktop page decorations.
 java.util.Set getDesktopPortletDecorations(RequestContext request)
          Get the portal-wide list of desktop portlet decorations.
 LayoutDecoration getLayoutDecoration(java.lang.String name, RequestContext requestContext)
          Returns a named layout Decoration appropriate to the current request conetext.
protected  Path getLayoutDecorationBasePath(java.lang.String name)
           
 java.lang.String getLayoutDecorationsBasePath()
          Get the path to the layout decorations directory.
 java.util.List getLayouts(RequestContext request)
          Get the portal-wide list of available layouts.
protected  java.util.Set getListing(java.util.Set rawList, java.lang.String propsFile)
           
 java.util.Set getPageDecorations(RequestContext request)
          Get the portal-wide list of page decorations.
 PortletDecoration getPortletDecoration(java.lang.String name, RequestContext requestContext)
          Returns a names portlet Decoration appropriate to the current request conetext.
protected  Path getPortletDecorationBasePath(java.lang.String name)
           
 java.util.Set getPortletDecorations(RequestContext request)
          Get the portal-wide list of portlet decorations.
 java.lang.String getPortletDecorationsBasePath()
          Get the path to the portlet decorations directory.
 ResourceValidator getResourceValidator()
           
 Theme getTheme(Page page, RequestContext requestContext)
          Returns a theme containing all of the Decorations for all of the layouts on the current page.
 boolean isDesktopEnabled(RequestContext requestContext)
          Indicates whether /desktop is enabled for the current portal request.
protected  void setCachedConfiguration(java.lang.String name, java.lang.String type, java.util.Properties props)
           
 void setDefaultDesktopLayoutDecoration(java.lang.String newOne)
          Set the default desktop layout decoration to be used when selected layout decoration does not support /desktop.
 void setDefaultDesktopPortletDecoration(java.lang.String newOne)
          Set the default desktop portlet decoration to be used when selected portlet decoration does not support /desktop.
 void setServletContext(javax.servlet.ServletContext servletContext)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DecorationFactoryImpl

public DecorationFactoryImpl(java.lang.String decorationsPath,
                             ResourceValidator validator)

DecorationFactoryImpl

public DecorationFactoryImpl(java.lang.String decorationsPath,
                             ResourceValidator validator,
                             JetspeedCache decorationConfigurationCache)

DecorationFactoryImpl

public DecorationFactoryImpl(PortletRegistry registry,
                             java.lang.String decorationsPath,
                             ResourceValidator validator,
                             JetspeedCache decorationConfigurationCache)
Method Detail

getResourceValidator

public ResourceValidator getResourceValidator()

getDecorationConfigurationCache

protected JetspeedCache getDecorationConfigurationCache()

getTheme

public Theme getTheme(Page page,
                      RequestContext requestContext)
Description copied from interface: DecorationFactory
Returns a theme containing all of the Decorations for all of the layouts on the current page.

Specified by:
getTheme in interface DecorationFactory
Parameters:
page - Page whose theme we are requesting
requestContext - Current portal request.
Returns:
Theme for this page based on the current portal request.
See Also:
Theme, RequestContext

getDecoration

public Decoration getDecoration(Page page,
                                Fragment fragment,
                                RequestContext requestContext)
Description copied from interface: DecorationFactory
Returns a Decoration for a specific Fragment contained within the specified Page.

Specified by:
getDecoration in interface DecorationFactory
Parameters:
page - Current page
fragment - Fragment whose decoration we require.
requestContext - Current portal request.
Returns:
Decoration requested. If the decoration does not exist, an empty Decoration will be created "in memory" and a message should be logged informing the admin that non-existent decoration has been requested.
See Also:
Page, Fragment, RequestContext

getPortletDecoration

public PortletDecoration getPortletDecoration(java.lang.String name,
                                              RequestContext requestContext)
Description copied from interface: DecorationFactory
Returns a names portlet Decoration appropriate to the current request conetext.

Specified by:
getPortletDecoration in interface DecorationFactory
Parameters:
name - Formal name of the decoration.
requestContext - Current portal request.
Returns:
Decoration requested. If the decoration does not exist, an empty Decoration will be created "in memory" and a message should be logged informing the admin that non-existent decoration has been requested.
See Also:
RequestContext, PortletDecoration

getLayoutDecoration

public LayoutDecoration getLayoutDecoration(java.lang.String name,
                                            RequestContext requestContext)
Description copied from interface: DecorationFactory
Returns a named layout Decoration appropriate to the current request conetext.

Specified by:
getLayoutDecoration in interface DecorationFactory
Parameters:
name - Formal name of the decoration.
requestContext - Current portal request.
Returns:
Decoration requested. If the decoration does not exist, an empty Decoration will be created "in memory" and a message should be logged informing the admin that non-existent decoration has been requested.
See Also:
LayoutDecoration, RequestContext

isDesktopEnabled

public boolean isDesktopEnabled(RequestContext requestContext)
Description copied from interface: DecorationFactory
Indicates whether /desktop is enabled for the current portal request. Located here due to range of jetspeed components which need this information and already have a DecorationFactory reference.

Specified by:
isDesktopEnabled in interface DecorationFactory
Parameters:
requestContext - current portal request.
Returns:
true if /desktop is enabled for the current portal request, otherwise false

setServletContext

public void setServletContext(javax.servlet.ServletContext servletContext)
Specified by:
setServletContext in interface org.springframework.web.context.ServletContextAware

getCachedConfiguration

protected java.util.Properties getCachedConfiguration(java.lang.String name,
                                                      java.lang.String type)

setCachedConfiguration

protected void setCachedConfiguration(java.lang.String name,
                                      java.lang.String type,
                                      java.util.Properties props)

getCachedConfigurationKey

protected java.lang.String getCachedConfigurationKey(java.lang.String type,
                                                     java.lang.String name)

getConfiguration

public java.util.Properties getConfiguration(java.lang.String name,
                                             java.lang.String type)
Gets the configuration (decorator.properties) object for the decoration.

Parameters:
name - Name of the Decoration.
Returns:
java.util.Properties representing the configuration object.

createClientPath

protected Path createClientPath(java.lang.String name,
                                RequestContext requestContext,
                                java.lang.String decorationType)
Creates a org.apache.jetspeed.util.Path object based off of the user's client browser and locale.

Parameters:
name - Decroator's name
requestContext - Current portal request.
decorationType - Type of decoration, either layout or portlet
Returns:
See Also:
Path, RequestContext

getDefaultDecorationName

protected java.lang.String getDefaultDecorationName(Fragment fragment,
                                                    Page page)
Returns a the default decoration name for the specific Fragment type.

Parameters:
fragment - Fragment whose default decroation has been requested
page - Page this fragment belongs to.
Returns:
Default decorator name.
See Also:
Page, Fragment

clearCache

public void clearCache(RequestContext requestContext)
Description copied from interface: DecorationFactory
Clears the lookup cache of all previous located pathes. This only clears the cache the RequestContext's current user. This will generally delegate the cache operation to the PathResolverCache currently in use.

Specified by:
clearCache in interface DecorationFactory
Parameters:
requestContext - Current portal request.
See Also:
RequestContext, PathResolverCache

getBasePath

protected Path getBasePath(java.lang.String decorationType)

getBasePath

protected Path getBasePath(java.lang.String name,
                           java.lang.String decorationType)

getLayoutDecorationBasePath

protected Path getLayoutDecorationBasePath(java.lang.String name)

getPortletDecorationBasePath

protected Path getPortletDecorationBasePath(java.lang.String name)

getLayoutDecorationsBasePath

public java.lang.String getLayoutDecorationsBasePath()
Description copied from interface: DecorationFactory
Get the path to the layout decorations directory.

Specified by:
getLayoutDecorationsBasePath in interface DecorationFactory
Returns:
path to layout decorations directory

getPortletDecorationsBasePath

public java.lang.String getPortletDecorationsBasePath()
Description copied from interface: DecorationFactory
Get the path to the portlet decorations directory.

Specified by:
getPortletDecorationsBasePath in interface DecorationFactory
Returns:
path to portlet decorations directory

getPageDecorations

public java.util.Set getPageDecorations(RequestContext request)
Get the portal-wide list of page decorations.

Specified by:
getPageDecorations in interface DecorationFactory
Returns:
A list of page decorations of type Decoration

getDesktopPageDecorations

public java.util.Set getDesktopPageDecorations(RequestContext request)
Get the portal-wide list of available desktop page decorations.

Specified by:
getDesktopPageDecorations in interface DecorationFactory
Returns:
A list of desktop skins of type String

getPortletDecorations

public java.util.Set getPortletDecorations(RequestContext request)
Get the portal-wide list of portlet decorations.

Specified by:
getPortletDecorations in interface DecorationFactory
Returns:
A list of portlet decorations of type String

getDesktopPortletDecorations

public java.util.Set getDesktopPortletDecorations(RequestContext request)
Get the portal-wide list of desktop portlet decorations.

Specified by:
getDesktopPortletDecorations in interface DecorationFactory
Returns:
A list of portlet decorations of type String

getLayouts

public java.util.List getLayouts(RequestContext request)
Get the portal-wide list of available layouts.

Specified by:
getLayouts in interface DecorationFactory
Returns:
A list of layout portlets of type PortletDefinitionComposite

getListing

protected java.util.Set getListing(java.util.Set rawList,
                                   java.lang.String propsFile)

getDefaultDesktopLayoutDecoration

public java.lang.String getDefaultDesktopLayoutDecoration()
Description copied from interface: DecorationFactory
Get the default desktop layout decoration to be used when selected layout decoration does not support /desktop.

Specified by:
getDefaultDesktopLayoutDecoration in interface DecorationFactory
Returns:
default desktop layout decoration.

setDefaultDesktopLayoutDecoration

public void setDefaultDesktopLayoutDecoration(java.lang.String newOne)
Description copied from interface: DecorationFactory
Set the default desktop layout decoration to be used when selected layout decoration does not support /desktop.

Specified by:
setDefaultDesktopLayoutDecoration in interface DecorationFactory

getDefaultDesktopPortletDecoration

public java.lang.String getDefaultDesktopPortletDecoration()
Description copied from interface: DecorationFactory
Get the default desktop portlet decoration to be used when selected portlet decoration does not support /desktop.

Specified by:
getDefaultDesktopPortletDecoration in interface DecorationFactory
Returns:
default desktop portlet decoration.

setDefaultDesktopPortletDecoration

public void setDefaultDesktopPortletDecoration(java.lang.String newOne)
Description copied from interface: DecorationFactory
Set the default desktop portlet decoration to be used when selected portlet decoration does not support /desktop.

Specified by:
setDefaultDesktopPortletDecoration in interface DecorationFactory


Copyright © 1999-2010 Apache Software Foundation. All Rights Reserved.