Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Distributed Layout Manager (DLM) allows portal administrators to define Layout Fragments. Each fragment containes one or more tabs of portal content (portlets and channels) and defines an audience.

Anchor
dlmxml
dlmxml

Defining Fragments in dlm.xml

DLM functionality and fragments are currently most commonly defined in a file called, dlm.xml. It , which is located in the properties directory. The default dlm.xml file for 2.5.0 is shown below. Although no DTD or schema is currently used two top level elements are supported by the DLM code: dlm:property and dlm:fragment. As of uPortal 3.1.0, it is also possible to define DLM fragments in the portal database (see below).

Code Block
xml
xml
borderStylesolid
titledlm.xml
borderStylesolid
<managedLayoutFragments xmlns:dlm="http://org.jasig.portal.layout.dlm.config">

  <dlm:property name='defaultLayoutOwner' value='fragmentTemplate'/>
  <!--  <dlm:property name='layoutDecorator' value='someClass'/> -->
  
  <!-- Controls clearing of dlm fragment cache.  This allows changes  made to layout
  owners to be reflected once the cache has been updated.  Specified in minutes. -->
  
  <dlm:property name='org.jasig.portal.layout.dlm.RDBMDistributedLayoutStore.fragment_cache_refresh' value="5"/>

  <dlm:fragment name='Entertainment' ownerID='ent-lo' precedence='100'>
	 <dlm:audience evaluatorFactory='org.jasig.portal.layout.dlm.providers.PersonEvaluatorFactory'>
	  <paren mode="NOT">
       <attribute name="username" mode='equals' value='guest'/>
 	  </paren>
	 </dlm:audience>
  </dlm:fragment>

  <dlm:fragment name='News' ownerID='news-lo' precedence='80'>
   <!--  <dlm:role>Students</dlm:role> -->
   <dlm:audience evaluatorFactory='org.jasig.portal.layout.dlm.providers.GroupMembershipEvaluatorFactory'>
     <paren mode="AND">     
       <attribute mode='memberOf' name='Students'/>
       <paren mode="NOT">
	       <attribute mode='memberOf' name='Faculty'/>
       </paren>
     </paren>
   </dlm:audience>
 </dlm:fragment>
  
</managedLayoutFragments>

...

New features slated to be added would have rendered this declaration unnecessary. The goal is for the fragment editing UI to indicate which channels added to the fragment may not be available to all users of the fragment as defined by the set of users to whom the fragment is published for pushed fragments or the users who can subscribe to the fragment for pulled fragments.

Anchor
jpa
jpa

Defining Fragments as Database Entities

As an alternative to defining DLM fragments in dlm.xml, portal administrators may elect to enable the RDBMConfigurationLoader, which loads fragment definitions from the database via Hibernate and JPA. The major advantage of this approach is that it allows fragments to be added, removed, or change their audiences without a portal restart.

RDBMConfigurationLoader can be turned on by modifying persistenceContext.xml and layoutContext.xml

Warning
titleWarning

Once you make this change, DLM will no longer read fragments from dlm.xml; you must define all your fragments in the database.

persistenceContext.xml

Uncomment fragmentDefinitionDao bean:

Code Block
xml
xml

<bean id="fragmentDefinitionDao" class="org.jasig.portal.layout.dlm.FragmentDefinitionDao">
</bean>
layoutContext.xml

Modify dlmConfigurationLoader bean:

Code Block
xml
xml

<bean id="dlmConfigurationLoader" class="org.jasig.portal.layout.dlm.RDBMConfigurationLoader">
    <property name="configurationFile" value="classpath:/properties/dlm.xml" />
    <property name="fragmentDao" ref="fragmentDefinitionDao" />
</bean>
Importing Fragment Definitions

Now that you've enabled the RDBMConfigurationLoader, you'll need a way to get fragment definitions into the database. Import/Export provides support for these entities.

Use the following command to import a directory that contains .fragment-definition files:

>ant crn-import -Ddir<path.to.frag-def.dir>

The .fragment-definition files support the same XML syntax as dlm.xml

Example fragment-definition File
Code Block
xml
xml

<fragment-definition xmlns:dlm="http://org.jasig.portal.layout.dlm.config" script="classpath://org/jasig/portal/io/import-fragment-definition_v3-1.crn">
  <dlm:fragment name='Guests' ownerID='guest-lo' precedence='20'>
   <dlm:audience evaluatorFactory='org.jasig.portal.layout.dlm.providers.GuestUserEvaluatorFactory'/>
  </dlm:fragment>
</fragment-definition>