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

LayoutServiceImpl - JBOSS Portal 2.6 API 英文版文档


org.jboss.portal.theme.impl
Class LayoutServiceImpl

java.lang.Object
  extended byorg.jboss.mx.util.JBossNotificationBroadcasterSupport
      extended byorg.jboss.system.ServiceMBeanSupport
          extended byorg.jboss.portal.jems.as.system.AbstractJBossService
              extended byorg.jboss.portal.theme.impl.LayoutServiceImpl
All Implemented Interfaces:
LayoutService, LayoutServiceInfo, javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, org.jboss.system.Service, org.jboss.system.ServiceMBean

public class LayoutServiceImpl
extends AbstractJBossService
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).

Version:
$Revision: 5448 $
Author:
Martin Holzner.
See Also:
PortalLayout, PortalRenderSet, LayoutStrategy, MediaType

Field Summary
private  ServerRegistrationID defaultID
           
private  java.util.Map exactLayoutNames
           
private  java.util.Map exactRenderSetNames
           
private  java.util.Map exactStrategyNames
           
private  java.util.Map layoutNames
           
private  java.util.Map layouts
           
private static org.apache.log4j.Logger log
           
private  java.util.Map renderSetNames
           
private  java.util.Map renderSets
           
private  java.util.Map strategies
           
private  java.util.Map strategyNames
           
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport
server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport
 
Fields inherited from interface org.jboss.system.ServiceMBean
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Constructor Summary
LayoutServiceImpl()
           
 
Method Summary
 void addLayout(RuntimeContext runtimeContext, PortalLayoutMetaData layoutMD)
          Add a layout.
 void addRenderSet(RuntimeContext runtimeContext, RenderSetMetaData renderSetMD)
          Register a renderSet with this service
 void addStrategy(RuntimeContext runtimeContext, LayoutStrategyMetaData strategyMD)
          Register a a portal layout strategy with this service
protected  void createService()
           
protected  void destroyService()
           
 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(LayoutInfo info, HTTPStreamInfo streamInfo, MarkupResult result)
          Get the PortalRenderSet to use for the provided layout, page and media type.
 PortalRenderSet getRenderSet(ServerRegistrationID id, MediaType mediaType)
          Retrieves the render set for this Layout.
 PortalRenderSet getRenderSet(java.lang.String renderSetName, MediaType mediaType)
          Get the render set for the provided layout.
private  PortalRenderSet getRenderSetFromProperties(MediaType contentType, java.util.Map properties)
          Get the render set property from the provided properties (if one is present), and then get the render set for that property and media type from the layout service.
 java.util.Collection getRenderSets()
          Retrieves the set of the ServerRegistrationID for registred render set
 java.util.Collection getStrategies()
          Get a Set of all available portal layout strategies
 LayoutStrategy getStrategy(ServerRegistrationID id, MediaType mediaType)
          Retrieves the strategy for this 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).
protected  void startService()
           
protected  void stopService()
           
 
Methods inherited from class org.jboss.portal.jems.as.system.AbstractJBossService
create, destroy, getState, getStateString, start, stop
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport
getDeploymentInfo, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, nextNotificationSequenceNumber, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.system.Service
create, destroy, start, stop
 

Field Detail

log

private static org.apache.log4j.Logger log

layouts

private java.util.Map layouts

layoutNames

private java.util.Map layoutNames

exactLayoutNames

private java.util.Map exactLayoutNames

strategies

private java.util.Map strategies

strategyNames

private java.util.Map strategyNames

exactStrategyNames

private java.util.Map exactStrategyNames

renderSets

private java.util.Map renderSets

renderSetNames

private java.util.Map renderSetNames

exactRenderSetNames

private java.util.Map exactRenderSetNames

defaultID

private ServerRegistrationID defaultID
Constructor Detail

LayoutServiceImpl

public LayoutServiceImpl()
Method Detail

createService

protected void createService()
                      throws java.lang.Exception
Throws:
java.lang.Exception
See Also:
Service.create()

destroyService

protected void destroyService()
See Also:
Service.destroy()

startService

protected void startService()
                     throws java.lang.Exception
Throws:
java.lang.Exception
See Also:
Service.start()

stopService

protected void stopService()
See Also:
Service.stop()

addLayout

public void addLayout(RuntimeContext runtimeContext,
                      PortalLayoutMetaData layoutMD)
               throws LayoutException
Description copied from interface: LayoutService
Add a layout.

Specified by:
addLayout in interface LayoutService
Throws:
LayoutException

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: LayoutServiceInfo
Get the layout for the provided registration id.

Specified by:
getLayout in interface LayoutServiceInfo
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:
LayoutServiceInfo.getLayout(org.jboss.portal.theme.ServerRegistrationID,boolean)

getLayout

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

Specified by:
getLayout in interface LayoutServiceInfo
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:
LayoutServiceInfo.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(RuntimeContext runtimeContext,
                        LayoutStrategyMetaData strategyMD)
                 throws LayoutException
Description copied from interface: LayoutService
Register a a portal layout strategy with this service

Specified by:
addStrategy in interface LayoutService
Throws:
LayoutException

getStrategy

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

Specified by:
getStrategy in interface LayoutServiceInfo
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:
LayoutServiceInfo.getStrategy(String,org.jboss.portal.common.MediaType)

getStrategy

public LayoutStrategy getStrategy(ServerRegistrationID id,
                                  MediaType mediaType)
Description copied from interface: LayoutServiceInfo
Retrieves the strategy for this Layout.

Specified by:
getStrategy in interface LayoutServiceInfo
Parameters:
id - the registration id of the strategy to retrieve.
mediaType - the media type that must be supported by the strategy to be retrieved
Returns:
the registered strategy identified by the specified id and media type, null otherwise.

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(RuntimeContext runtimeContext,
                         RenderSetMetaData renderSetMD)
                  throws LayoutException
Description copied from interface: LayoutService
Register a renderSet with this service

Specified by:
addRenderSet in interface LayoutService
Throws:
LayoutException

getRenderSet

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

Specified by:
getRenderSet in interface LayoutServiceInfo
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:
LayoutServiceInfo.getRenderSet(String,org.jboss.portal.common.MediaType)

getRenderSet

public PortalRenderSet getRenderSet(ServerRegistrationID id,
                                    MediaType mediaType)
Description copied from interface: LayoutServiceInfo
Retrieves the render set for this Layout.

Specified by:
getRenderSet in interface LayoutServiceInfo
Parameters:
id - the registration id of the RenderSet to retrieve.
mediaType - the media type that must be supported by the RenderSet to be retrieved
Returns:
the registered RenderSet identified by the specified id and media type, null otherwise.

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: LayoutServiceInfo
Get a Set of portal layouts

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

getStrategies

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

Specified by:
getStrategies in interface LayoutServiceInfo
Returns:
the set of the ServerRegistrationID for registred layout strategies
See Also:
LayoutServiceInfo.getStrategies()

getRenderSets

public java.util.Collection getRenderSets()
Description copied from interface: LayoutServiceInfo
Retrieves the set of the ServerRegistrationID for registred render set

Specified by:
getRenderSets in interface LayoutServiceInfo
Returns:
the set of the ServerRegistrationID for registred render set
See Also:
LayoutServiceInfo.getRenderSets()

getRenderSet

public PortalRenderSet getRenderSet(LayoutInfo info,
                                    HTTPStreamInfo streamInfo,
                                    MarkupResult result)
Get the PortalRenderSet to use for the provided layout, page and media type.

The render set can be defined specifically for a layout, a page, or a portal. The one defined for the layout overwrites the one defined for the page, which in turn overwrites the one defined for the portal. The render set is defined for a specific content type (media type), which will be determined from the provided HttpStreamInfo.

Specified by:
getRenderSet in interface LayoutServiceInfo
Parameters:
info -
result -
Returns:
a renderSet to decorate the markup fragments on the page with

getRenderSetFromProperties

private PortalRenderSet getRenderSetFromProperties(MediaType contentType,
                                                   java.util.Map properties)
Get the render set property from the provided properties (if one is present), and then get the render set for that property and media type from the layout service.

Parameters:
contentType -
properties -
Returns:
the PortalRenderSet that was defined for the provided params