Skip to content

Commit

Permalink
Migrate mdx statistics generation out of generate configuration file …
Browse files Browse the repository at this point in the history
…into UK beans.

Create a stand-alone statistics generation very for the uk channel.
Convert statistics generation for production signing run over to mdx version.
Optimise statistics generation by passing a pre-parsed members document bean rather than parsing in xslt.  This is a wash if statistics generation is all we're doing, but will be beneficial later when the members document is also being used for other things.
  • Loading branch information
iay committed Jul 18, 2011
1 parent 20acbb8 commit abe2f6c
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 51 deletions.
12 changes: 4 additions & 8 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1236,16 +1236,12 @@
<!--
Statistics generation
Note that statistics are generated from the UK federation master file,
so that the statistics process has access to information that will not
Note that statistics are generated from the full registered fragment
data, so that the statistics process has access to information that will not
be included in published metadata.
-->
<target name="stats" depends="gen.uk.unsigned">
<echo>Generating UK Federation statistics</echo>
<XALAN.xmldir
i="${uk.master.file}"
o="ukfederation-stats.html"
x="statistics.xsl"/>
<target name="stats">
<CHANNEL.do channel="uk" verb="statistics"/>
<fixcrlf file="${xml.dir}/ukfederation-stats.html" eol="lf"/>
</target>

Expand Down
65 changes: 65 additions & 0 deletions mdx/uk/beans.xml
Original file line number Diff line number Diff line change
Expand Up @@ -285,4 +285,69 @@
</bean>


<!--
*********************************************
*** ***
*** S T A T I S T I C S O U T P U T ***
*** ***
*********************************************
-->

<!--
uk_serializeStatistics
Serialise the (assumed HTML) DomDocumentItem into the UK federation statistics
output file in the production XML directory.
-->
<bean id="uk_serializeStatistics" class="net.shibboleth.metadata.pipeline.SerializationStage"
init-method="initialize" lazy-init="true">
<property name="id" value="uk_serializeStatistics"/>
<property name="serializer" ref="serializer"/>
<property name="outputFile">
<bean class="java.io.File">
<constructor-arg value="#{ systemProperties['basedir'] }/xml/ukfederation-stats.html"/>
</bean>
</property>
</bean>

<!--
uk_generateStatistics
Input is an aggregate of all registered entities, output is the HTML statistics.
-->
<bean id="uk_generateStatistics" class="net.shibboleth.metadata.dom.XSLTransformationStage"
init-method="initialize" lazy-init="true">
<property name="id" value="uk_generateStatistics"/>
<property name="xslResource">
<bean class="org.opensaml.util.resource.FilesystemResource">
<constructor-arg value="#{ systemProperties['basedir'] }/mdx/uk/statistics.xsl"/>
</bean>
</property>
<property name="transformParameters">
<map>
<entry key="memberDocument" value-ref="uk_membersDocument"/>
</map>
</property>
</bean>

<!--
uk_statisticsPipeline
Pipeline to generate the registrar statistics for the UK federation's
registered entities. Input is assumed to be a collection of the entities in question;
resulting HTML output is written into the appropriate file in the production
XML directory.
-->
<bean id="uk_statisticsPipeline" class="net.shibboleth.metadata.pipeline.SimplePipeline"
init-method="initialize" lazy-init="true">
<property name="id" value="uk_statisticsPipeline"/>
<property name="stages">
<list>
<ref bean="assemble"/>
<ref bean="uk_generateStatistics"/>
<ref bean="uk_serializeStatistics"/>
</list>
</property>
</bean>

</beans>
41 changes: 0 additions & 41 deletions mdx/uk/generate.xml
Original file line number Diff line number Diff line change
Expand Up @@ -327,47 +327,6 @@
</property>
</bean>

<!--
*********************************************
*** ***
*** S T A T I S T I C S O U T P U T ***
*** ***
*********************************************
-->

<bean id="serializeStatistics" class="net.shibboleth.metadata.pipeline.SerializationStage"
init-method="initialize" lazy-init="true">
<property name="id" value="serializeStatistics"/>
<property name="serializer" ref="serializer"/>
<property name="outputFile">
<bean class="java.io.File">
<constructor-arg value="#{ systemProperties['basedir'] }/mdx/uk/ukfederation-stats.html"/>
</bean>
</property>
</bean>

<bean id="uk_generateStatistics" class="net.shibboleth.metadata.dom.XSLTransformationStage"
init-method="initialize" lazy-init="true">
<property name="id" value="uk_generateStatistics"/>
<property name="xslResource">
<bean class="org.opensaml.util.resource.FilesystemResource">
<constructor-arg value="#{ systemProperties['basedir'] }/build/statistics.xsl"/>
</bean>
</property>
</bean>

<bean id="uk_statisticsPipeline" class="net.shibboleth.metadata.pipeline.SimplePipeline"
init-method="initialize" lazy-init="true">
<property name="id" value="uk_statisticsPipeline"/>
<property name="stages">
<list>
<ref bean="assemble"/>
<ref bean="uk_generateStatistics"/>
<ref bean="serializeStatistics"/>
</list>
</property>
</bean>

<!--
*************************************
*** ***
Expand Down
10 changes: 8 additions & 2 deletions build/statistics.xsl → mdx/uk/statistics.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,21 @@

<xsl:output method="html" omit-xml-declaration="yes"/>

<!--
memberDocument
The members.xml file, as a DOM document, is passed as a parameter.
-->
<xsl:param name="memberDocument"/>

<xsl:template match="md:EntitiesDescriptor">

<xsl:variable name="now" select="date:date-time()"/>

<!--
Pick up and break down the "members" document, which despite its name
Break down the "members" document, which despite its name
describes all known entity owners, whether members or non-members.
-->
<xsl:variable name="memberDocument" select="document('../xml/members.xml')"/>
<!-- federation members -->
<xsl:variable name="members" select="$memberDocument//members:Member"/>
<xsl:variable name="memberCount" select="count($members)"/>
Expand Down
48 changes: 48 additions & 0 deletions mdx/uk/verbs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Verb to generate all UK aggregates.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">

<!--
Import commonly used beans.
-->
<import resource="../common-beans.xml"/>

<!--
Import channel-specific beans.
-->
<import resource="beans.xml"/>

<!--
***************************************
*** ***
*** V E R B P I P E L I N E S ***
*** ***
***************************************
-->

<!--
statistics
Stand-alone statistics generation.
-->
<bean id="statistics" class="net.shibboleth.metadata.pipeline.SimplePipeline"
init-method="initialize" lazy-init="true">
<property name="id" value="statistics"/>
<property name="stages">
<list>
<ref bean="uk_registeredEntities"/>
<ref bean="assemble"/>
<ref bean="uk_generateStatistics"/>
<ref bean="uk_serializeStatistics"/>
</list>
</property>
</bean>

</beans>

0 comments on commit abe2f6c

Please sign in to comment.