站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBOSS Portal 2.2 API 英文版文档

LayoutServiceImpl - JBOSS Portal 2.2 API 英文版文档


org.jboss.portal.theme.impl
Class LayoutServiceImpl

java.lang.Object
  extended byorg.jboss.portal.theme.impl.LayoutServiceImpl
All Implemented Interfaces:
LayoutService, org.jboss.system.Service

public class LayoutServiceImpl
extends java.lang.Object
implements LayoutService, org.jboss.system.Service

Implementaion of the layout server.

The layout server is a registry of all available layouts. The server also allows access to all available render sets and layout strategies. Render sets and layout strategies can be independent (named), or children of a layout. Accordingly, the layout server provides accessor methods to get strategies and render set by name, or by layout. Render sets and layout strategies can, and must, be defined for a specific media type (mime type).

See Also:
PortalLayout, PortalRenderSet, LayoutStrategy, MediaType

Constructor Summary
LayoutServiceImpl()
           
 
Method Summary
 void addLayout(LayoutRegistrationMetaData metaData)
          Add a layout.
 void addRenderSet(PortalRenderSet renderSet)
          Register a renderSet with this service
 void addStrategy(AbstractLayoutStrategy strategy)
          Register a a portal layout strategy with this service
 void create()
           
 void destroy()
           
 PortalLayout getLayout(ServerRegistrationID id, boolean defaultOnNull)
          Get the layout for the provided registration id.
 PortalLayout getLayout(java.lang.String name, boolean defaultOnNull)
          Get the layout for the provided name.
 java.util.Collection getLayouts()
          Get a Set of portal layouts
 PortalRenderSet getRenderSet(PortalLayout layout, MediaType mediaType)
          Get the render set for the provided layout.
 PortalRenderSet getRenderSet(java.lang.String renderSetName, MediaType mediaType)
          Get the render set for the provided layout.
 java.util.Collection getRenderSets()
          Get a Set of all available portal layout renderSets
 java.util.Collection getStrategies()
          Get a Set of all available portal layout strategies
 LayoutStrategy getStrategy(PortalLayout layout, MediaType mediaType)
          Get the layout strategy that was defined for the provided layout.
 LayoutStrategy getStrategy(java.lang.String strategyName, MediaType mediaType)
          Get the layout strategy that matches the provided name and media type
 void removeLayout(ServerRegistrationID id)
          Remove the layout identified by the provided registration id.
 void removeLayouts(java.lang.String appID)
          Remove all layouts that are hosted in the provided application.
 void removeRenderSets(java.lang.String appID)
          Remove all rendersets that are hosted in the provided application.
 void removeStrategies(java.lang.String appID)
          Remove all strategies that are hosted in the provided application.
 void setDefaultLayout(java.lang.String name)
          Set the default layout (on a global level).
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LayoutServiceImpl

public LayoutServiceImpl()
Method Detail

create

public void create()
            throws java.lang.Exception
Specified by:
create in interface org.jboss.system.Service
Throws:
java.lang.Exception
See Also:
Service.create()

destroy

public void destroy()
Specified by:
destroy in interface org.jboss.system.Service
See Also:
Service.destroy()

start

public void start()
           throws java.lang.Exception
Specified by:
start in interface org.jboss.system.Service
Throws:
java.lang.Exception
See Also:
Service.start()

stop

public void stop()
Specified by:
stop in interface org.jboss.system.Service
See Also:
Service.stop()

addLayout

public void addLayout(LayoutRegistrationMetaData metaData)
               throws LayoutException
Description copied from interface: LayoutService
Add a layout.

Specified by:
addLayout in interface LayoutService
Parameters:
metaData - the meta information about the layout
Throws:
LayoutException
See Also:
LayoutService.addLayout(LayoutRegistrationMetaData)

setDefaultLayout

public void setDefaultLayout(java.lang.String name)
                      throws LayoutException
Description copied from interface: LayoutService
Set the default layout (on a global level).

Specified by:
setDefaultLayout in interface LayoutService
Parameters:
name - the name of the layout to set as default
Throws:
LayoutException
See Also:
LayoutService.setDefaultLayout(String)

getLayout

public PortalLayout getLayout(ServerRegistrationID id,
                              boolean defaultOnNull)
Description copied from interface: LayoutService
Get the layout for the provided registration id.

Specified by:
getLayout in interface LayoutService
Parameters:
id - the registration id of the layout to get
defaultOnNull - true, if the default layout (if any is defined) should be returned in case the requested layout is not found
Returns:
the requested layout , of the default layout, or null
See Also:
LayoutService.getLayout(org.jboss.portal.theme.ServerRegistrationID, boolean)

getLayout

public PortalLayout getLayout(java.lang.String name,
                              boolean defaultOnNull)
Description copied from interface: LayoutService
Get the layout for the provided name.

Specified by:
getLayout in interface LayoutService
Parameters:
name - the name of the layout to request
defaultOnNull - true, if the default layout (if any is defined) should be returned in case the requested layout is not found
Returns:
the requested layout , of the default layout, or null
See Also:
LayoutService.getLayout(String, boolean)

removeLayout

public void removeLayout(ServerRegistrationID id)
                  throws LayoutException
Remove the layout identified by the provided registration id.

Parameters:
id - the id of the layout that needs to be removed
Throws:
LayoutException

removeLayouts

public void removeLayouts(java.lang.String appID)
                   throws LayoutException
Description copied from interface: LayoutService
Remove all layouts that are hosted in the provided application.

Specified by:
removeLayouts in interface LayoutService
Parameters:
appID - the name of the application that hosts the layout(s) to be removed
Throws:
LayoutException
See Also:
LayoutService.removeLayouts(String)

addStrategy

public void addStrategy(AbstractLayoutStrategy strategy)
Description copied from interface: LayoutService
Register a a portal layout strategy with this service

Specified by:
addStrategy in interface LayoutService
Parameters:
strategy - the strategy to register
See Also:
LayoutService.addStrategy(org.jboss.portal.theme.strategy.AbstractLayoutStrategy)

getStrategy

public LayoutStrategy getStrategy(PortalLayout layout,
                                  MediaType mediaType)
Description copied from interface: LayoutService
Get the layout strategy that was defined for the provided layout.

In the layout descriptor (portal-layouts.xml) a strategy can be defined to be used in conjunction with every layout that is defined in this file. The layout must be defined per media type. The portal provides a default implementation on a strategy which can be accessed by passing null as the layout.

Specified by:
getStrategy in interface LayoutService
Parameters:
layout - the layout to get the strategy for (or null for the default layout strategy)
mediaType - the media type (content type ; mime type) of the strategy
Returns:
an implementation of a LayoutStrategy or null if no strategy was found
See Also:
LayoutService.getStrategy(org.jboss.portal.theme.PortalLayout, org.jboss.portal.common.MediaType)

getStrategy

public LayoutStrategy getStrategy(java.lang.String strategyName,
                                  MediaType mediaType)
Description copied from interface: LayoutService
Get the layout strategy that matches the provided name and media type

Specified by:
getStrategy in interface LayoutService
Parameters:
strategyName - the name of the strategy to get
mediaType - the media type (content-type) to get the strategy for
Returns:
the layout strategy that matches the provided name and mediatype, or null if no such strategy is registered
See Also:
LayoutService.getStrategy(String, org.jboss.portal.common.MediaType)

removeStrategies

public void removeStrategies(java.lang.String appID)
                      throws LayoutException
Description copied from interface: LayoutService
Remove all strategies that are hosted in the provided application.

Specified by:
removeStrategies in interface LayoutService
Parameters:
appID - the name of the application that hosts the strategie(s) to be removed
Throws:
LayoutException
See Also:
LayoutService.removeStrategies(String)

addRenderSet

public void addRenderSet(PortalRenderSet renderSet)
Description copied from interface: LayoutService
Register a renderSet with this service

Specified by:
addRenderSet in interface LayoutService
Parameters:
renderSet - the renderSet to register
See Also:
LayoutService.addRenderSet(org.jboss.portal.theme.render.PortalRenderSet)

getRenderSet

public PortalRenderSet getRenderSet(PortalLayout layout,
                                    MediaType mediaType)
Description copied from interface: LayoutService
Get the render set for the provided layout.

Specified by:
getRenderSet in interface LayoutService
Parameters:
layout - the layout to query for an anonymous render set (defined only for this layout)
mediaType - the media type to get the render set for
Returns:
the anonymous render set for the provided layout and media type, or null
See Also:
LayoutService.getRenderSet(org.jboss.portal.theme.PortalLayout, org.jboss.portal.common.MediaType)

getRenderSet

public PortalRenderSet getRenderSet(java.lang.String renderSetName,
                                    MediaType mediaType)
Description copied from interface: LayoutService
Get the render set for the provided layout.

Specified by:
getRenderSet in interface LayoutService
Parameters:
renderSetName - the name of the renderSet to find
mediaType - the mediatype for which to find the renderSet
Returns:
the registered renderSet for the provided name and media type, or null if no such renderSet is registered
See Also:
LayoutService.getRenderSet(String, org.jboss.portal.common.MediaType)

removeRenderSets

public void removeRenderSets(java.lang.String appID)
                      throws LayoutException
Description copied from interface: LayoutService
Remove all rendersets that are hosted in the provided application.

Specified by:
removeRenderSets in interface LayoutService
Parameters:
appID - the name of the application that hosts the render set(s) to be removed
Throws:
LayoutException
See Also:
LayoutService.removeRenderSets(String)

getLayouts

public java.util.Collection getLayouts()
Description copied from interface: LayoutService
Get a Set of portal layouts

Specified by:
getLayouts in interface LayoutService
Returns:
a Set of portal layouts
See Also:
LayoutService.getLayouts()

getStrategies

public java.util.Collection getStrategies()
Description copied from interface: LayoutService
Get a Set of all available portal layout strategies

Specified by:
getStrategies in interface LayoutService
Returns:
a Set of portal layout strategies
See Also:
LayoutService.getStrategies()

getRenderSets

public java.util.Collection getRenderSets()
Description copied from interface: LayoutService
Get a Set of all available portal layout renderSets

Specified by:
getRenderSets in interface LayoutService
Returns:
a Set of portal layout renderSets
See Also:
LayoutService.getRenderSets()