Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

fragment audience resolution

the dlm.xml allows you create conditions used to resolve the target audience of a fragment. in other words, when to display the "tab". there are a number of factors to consider when creating these conditions, but one that came up during our implmentation required us to reconfigure uportal to reference an additional jndi datasource outside the typical ldap or rdbm default.

below are the steps that we took to create this configuration.

  1. added jndi datasource to uPortal55.xml
    <Resource name="jdbc/ournewAudResolutionDb" auth="Container" type="javax.sql.DataSource"
        username="<at:var at:name="ourNewAud001jdbcUser" />" password="<at:var at:name="ourNewAud001jdbcPassword" />"
        driverClassName="<at:var at:name="ourNewAud001jdbcDriver" />" url="<at:var at:name="ourNewAud001jdbcUrl" />"
        maxActive="100" maxIdle="30" maxWait="10000"
        poolPreparedStatements="<at:var at:name="poolPreparedStatements" />"
    
        removeAbandoned="true"
        removeAbandonedTimeout="300"
        logAbandoned="true"
      />
    
  2. added jndi attribute mappings to rdbm.properties
    ourNewAud001jdbcDriver=oracle.jdbc.driver.OracleDriver
    ourNewAud001jdbcUrl=jdbc:oracle:thin:@ourNewHostDb:1521:ourNewHostSid
    ourNewAud001jdbcUser=ourNewDbUid
    ourNewAud001jdbcPassword=ourNewDbPsw
    
  3. changed personDirectory.xml to support merged attributes
    <bean id="personAttributeDao" class="org.jasig.portal.services.persondir.support.CachingPersonAttributeDaoImpl">
      <property name="cachedPersonAttributesDao">
       <ref bean="mergedAttributes"/>
      </property>
     </bean>
    
     <bean id="mergedAttributes" class="org.jasig.portal.services.persondir.support.MergingPersonAttributeDaoImpl">
      <property name="personAttributeDaos">
       <list>
        <ref bean="uPortalLdapAttributeSource"/>
        <ref bean="ourNewAudJdbcAttributeSource"/>
       </list>
      </property>
     </bean>
    
  4. added our new audience datasource bean details to personDirectory.xml
    <bean id="ourNewAudJdbcAttributeSource" class="org.jasig.portal.services.persondir.support.JdbcPersonAttributeDaoImpl">
      <constructor-arg>
       <bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
        <property name="staticMethod">
         <value>org.jasig.portal.RDBMServices.getDataSource</value>
        </property>
        <property name="arguments">
         <list><value>ourNewAudResolutionDb</value></list>
        </property>
       </bean>
      </constructor-arg>
      <constructor-arg>
       <list>
        <value>username</value>
       </list>
      </constructor-arg>
      <constructor-arg>
       <value>select count(uid) as is_new_aud_user from ourNewAudTable where uid=?</value>
      </constructor-arg>
      <property name="columnsToAttributes">
       <map>
        <entry key="is_new_aud_user">
         <value>isNewAudUser</value>
        </entry>
       </map>
      </property>
     </bean>
    
  5. added audience resolution condition to dlm.xml (referencing the person attribute created above)
    <dlm:fragment name='frg-our-new-fragment' ownerID='our-new-fragment-lo' precedence='10'>
        <dlm:audience evaluatorFactory='org.jasig.portal.layout.dlm.providers.PersonEvaluatorFactory'>
          <paren mode="AND">
            <paren mode="NOT">
              <attribute name="username" mode='equals' value='guest-usr'/>
            </paren>
            <paren mode="NOT">
              <attribute name="isNewAudUser" mode='equals' value='0'/>
            </paren>
          </paren>
        </dlm:audience>
      </dlm:fragment>
    
  • No labels