Skip to content

Commit

Permalink
Bugzilla 902: move import transform inside the aggregator
Browse files Browse the repository at this point in the history
Bugzilla 903: import transform should check for schema validity before anything else
Also a fair amount of cleanup related to these changes.
  • Loading branch information
iay committed Apr 17, 2012
1 parent b0bbdcc commit 611105f
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 27 deletions.
13 changes: 2 additions & 11 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -762,18 +762,9 @@

<target name="import.metadata">
<echo>Importing metadata from ${entities.dir}/import.xml</echo>

<!-- Step 1: perform real processing into temporary file -->
<XALAN x="${build.dir}/import.xsl"
i="${entities.dir}/import.xml" o="${temp.xml}"/>

<!-- Step 2: normalise namespaces into result file -->
<XALAN x="${build.dir}/ns_norm_fragment.xsl"
i="${temp.xml}" o="${entities.dir}/imported.xml"/>

<delete file="${entities.dir}/imported.xml" quiet="true" verbose="false"/>
<CHANNEL.do channel="uk" verb="import"/>
<echo>Imported metadata to ${entities.dir}/imported.xml</echo>
<CHANNEL.do channel="uk" verb="validateImportedMetadata"/>
<echo>Checked.</echo>
</target>

<!--
Expand Down
4 changes: 1 addition & 3 deletions mdx/uk/beans.xml
Original file line number Diff line number Diff line change
Expand Up @@ -398,10 +398,8 @@
Serialise the (assumed HTML) DomDocumentItem into the UK federation statistics
output file in the production XML directory.
-->
<bean id="uk_serializeStatistics" parent="stage_parent"
class="net.shibboleth.metadata.pipeline.SerializationStage"
<bean id="uk_serializeStatistics" parent="serialize_parent"
p:id="uk_serializeStatistics">
<property name="serializer" ref="serializer"/>
<property name="outputFile">
<bean class="java.io.File">
<constructor-arg value="#{ systemProperties['basedir'] }/xml/ukfederation-stats.html"/>
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions build/ns_norm_fragment.xsl → mdx/uk/ns_norm_fragment.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@


<!--
Import templates for basic normalisation.
-->
<xsl:import href="ns_norm.xsl"/>
Import templates for basic normalisation.
-->
<xsl:import href="../../build/ns_norm.xsl"/>


<!--
Expand Down
82 changes: 72 additions & 10 deletions mdx/uk/verbs.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Verb to generate all UK aggregates.
Miscellaneous UK channel verbs.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
default-lazy-init="true"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand Down Expand Up @@ -150,13 +151,28 @@
-->

<!--
importedMetadata
fetchImportMetadata
Fetches the contents of the file used to hold metadata to be imported
into a UK federation fragment file.
-->
<bean id="fetchImportMetadata" parent="domFileStage_parent"
p:id="fetchImportMetadata">
<property name="source">
<bean class="java.io.File">
<constructor-arg value="#{ systemProperties['basedir'] }/entities/import.xml"/>
</bean>
</property>
</bean>

<!--
fetchImportedMetadata
Fetches the contents of the file used to hold metadata just imported
by the federation's import transform.
-->
<bean id="importedMetadata" parent="domFileStage_parent"
p:id="importedMetadata">
<bean id="fetchImportedMetadata" parent="domFileStage_parent"
p:id="fetchImportedMetadata">
<property name="source">
<bean class="java.io.File">
<constructor-arg value="#{ systemProperties['basedir'] }/entities/imported.xml"/>
Expand All @@ -165,21 +181,67 @@
</bean>

<!--
validateImportedMetadata
serializeImportedMetadata
Serialise the fragment file just imported.
-->
<bean id="serializeImportedMetadata" parent="serialize_parent"
p:id="serializeImportedMetadata">
<property name="outputFile">
<bean class="java.io.File">
<constructor-arg value="#{ systemProperties['basedir'] }/entities/imported.xml"/>
</bean>
</property>
</bean>

<!--
import
Perform custom validation on metadata just imported by the
federation's import transform.
Pipeline to import a metadata fragment file.
For now, just the head of that pipeline.
-->
<bean id="validateImportedMetadata" parent="pipeline_parent"
p:id="validateImportedMetadata">
<bean id="import" parent="pipeline_parent"
p:id="import">
<property name="stages">
<list>
<ref bean="importedMetadata"/>
<!-- fetch the input file -->
<ref bean="fetchImportMetadata"/>
<ref bean="populateItemIds"/>

<!-- perform schema validation and stop immediately if this fails -->
<ref bean="checkSchemas"/>
<ref bean="errorTerminatingFilter"/>

<!-- transform into a fragment using our local conventions -->
<bean id="importTransform" parent="xslt_parent"
p:id="importTransform">
<property name="xslResource">
<bean parent="file_parent">
<constructor-arg value="#{ systemProperties['basedir'] }/mdx/uk/import.xsl"/>
</bean>
</property>
</bean>

<!-- normalise namespaces in a specific way -->
<bean id="normalizeFragment" parent="xslt_parent"
p:id="normalizeFragment">
<property name="xslResource">
<bean parent="file_parent">
<constructor-arg value="#{ systemProperties['basedir'] }/mdx/uk/ns_norm_fragment.xsl"/>
</bean>
</property>
</bean>

<!-- check the transformed input -->
<ref bean="CHECK_std"/>
<ref bean="check_future"/>
<ref bean="check_imported"/>
<ref bean="check_vhosts"/>
<ref bean="errorTerminatingFilter"/>

<!-- write output file -->
<ref bean="serializeImportedMetadata"/>
</list>
</property>
</bean>
Expand Down

0 comments on commit 611105f

Please sign in to comment.