org.jboss.portal.theme.impl
Class LayoutServiceImpl

java.lang.Object
  extended by org.jboss.mx.util.JBossNotificationBroadcasterSupport
      extended by org.jboss.system.ServiceMBeanSupport
          extended by org.jboss.portal.jems.as.system.AbstractJBossService
              extended by org.jboss.portal.theme.impl.LayoutServiceImpl
All Implemented Interfaces:
javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, LayoutService, LayoutServiceInfo, 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. Render sets can be independent (named), or children of a layout. Accordingly, the layout server provides accessor methods to get render set by name, or by layout. Render sets can, and must, be defined for a specific media type (mime type).

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

Field Summary
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport
server, SERVICE_CONTROLLER_SIG, serviceName
 
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
protected  void createService()
           
protected  void destroyService()
           
 PortalLayout getDefaultLayout()
           
 java.lang.String getDefaultRenderSetName()
           
 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.
 PortalLayout getLayoutById(java.lang.String layoutIdString)
           
 java.util.Collection getLayouts()
          Get a Set of portal layouts
 PortalRenderSet getRenderSet(LayoutInfo info, ContentInfo streamInfo, java.lang.String renderSetName)
          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.
 java.util.Collection getRenderSets()
          Retrieves the set of the ServerRegistrationID for registred render set
 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 setDefaultLayoutName(java.lang.String name)
          Set the default layout (on a global level).
 void setDefaultRenderSetName(java.lang.String name)
           
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
 

Constructor Detail

LayoutServiceImpl

public LayoutServiceImpl()
Method Detail

createService

protected void createService()
                      throws java.lang.Exception
Overrides:
createService in class org.jboss.system.ServiceMBeanSupport
Throws:
java.lang.Exception
See Also:
Service.create()

destroyService

protected void destroyService()
Overrides:
destroyService in class org.jboss.system.ServiceMBeanSupport
See Also:
Service.destroy()

startService

protected void startService()
                     throws java.lang.Exception
Overrides:
startService in class org.jboss.system.ServiceMBeanSupport
Throws:
java.lang.Exception
See Also:
Service.start()

stopService

protected void stopService()
Overrides:
stopService in class org.jboss.system.ServiceMBeanSupport
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

setDefaultLayoutName

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

Specified by:
setDefaultLayoutName in interface LayoutService
Parameters:
name - the name of the layout to set as default

getDefaultLayout

public PortalLayout getDefaultLayout()
Specified by:
getDefaultLayout in interface LayoutService
See Also:
LayoutService.getDefaultLayout()

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)

getLayoutById

public PortalLayout getLayoutById(java.lang.String layoutIdString)
Specified by:
getLayoutById in interface LayoutServiceInfo

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)

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.util.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()

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()

setDefaultRenderSetName

public void setDefaultRenderSetName(java.lang.String name)
Specified by:
setDefaultRenderSetName in interface LayoutService

getDefaultRenderSetName

public java.lang.String getDefaultRenderSetName()
Specified by:
getDefaultRenderSetName in interface LayoutService

getRenderSet

public PortalRenderSet getRenderSet(LayoutInfo info,
                                    ContentInfo streamInfo,
                                    java.lang.String renderSetName)
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