I have to call 2 different XSL depending on some basis set in the input XML .
I don't want to write 2 separate transformer for this task. The current Code has been written like this
<int:router input-channel="inputchannel"
default-output-channel="outputChannel" expression="headers.get('someValue')">
<int:mapping value="x" channel="xChannel" />
<int:mapping value="y" channel="yChannel" />
</int:router>
<int-xml:xslt-transformer inputChannel="xChannel" output-channel= "output"
xsl-resource="xRelated.xsl" />
<int-xml:xslt-transformer inputChannel="yChannel" output-channel="output"
xsl-resource="yRelated.xsl" />
However , this seems to be a dirty solution as this is just a sample . I will be having 14 different type of XSLs. Does anyone have an idea,how can I re factor this.
The Spring Integration XsltPayloadTransformer relies on TransformerFactory abstraction which preduces Templates based on Source from underlying XSTL.
So, looks like there is no choice to have just only one component who can handle several XSLT at once.
It would be great, if know other XSLT engine which can provide desired solution, but it hasn't to be based on standard TransformerFactory.
Related
Lets say that a task needs to be done and there are no data model changes needed(i.e items.xml does not need to be touched).
For example a new Interceptor is needed for an existing Item Type. In this case I just need a new spring bean and a new Java class.
After I do the changes, If I run an "ant build" it takes approximately 1:30(one minute and a half), sometimes even more than that.
From what I noticed Hybris tries to check every extension that is included in localExtension.xml with their required extensions as well, and that is taking a lot of time.
How can I perform a faster build ? It should not take that much time since the only thing that is needed in my Interceptor case is to compile the new Interceptor class, and that's it.
I understand that when data model is changed the models.jar needs to be deleted, the new sources need to be generated and compiled in a new models.jar and that requires time. But in the more simple scenario it should work a lot faster.
PS: I know about JRebel but this question addresses the cases in which the developer does not have JRebel.
In platform/build.xml add below ant target:
<target name="compileExtensions" description="Compiles only the provided extensions">
<compile_only_specified_extensions/>
</target>
In platform/resources/ant/compiling.xml add the macro definition:
<macrodef name="compile_only_specified_extensions">
<sequential>
<foreachextprovidedincli>
<do>
<if>
<not>
<isset property="ext.#{extname}.warextension" />
</not>
<then>
<extension_compile extname="#{extname}" />
</then>
<else>
<external_extension_build extname="#{extname}"/>
</else>
</if>
</do>
</foreachextprovidedincli>
</sequential>
</macrodef>
Define foreachextprovidedincli in platform/resources/ant/util.xml
<macrodef name="foreachextprovidedincli">
<element name="do" optional="false" />
<attribute name="param" default="extname" />
<sequential>
<for list="${extensions.to.compile}" param="#{param}" delimiter=";">
<sequential>
<do />
</sequential>
</for>
</sequential>
</macrodef>
Now what I simply have to do to compile my classes is run the following command:
ant compileExtensions -Dextensions.to.compile="extensionName1;extensionName2;extensionName3"
With above command the build was reduced to 4 seconds.
I would like to retrieve one line at a time from the file, then convert that line to a POJO, then retrieve the next line...
For each line, two web services should be called.
I believe , I should work like this:
<int-file:inbound-channel-adapter directory="/tmp/test"
id="filesIn" channel="toSplitter">
<int:poller fixed-delay="5000" />
</int-file:inbound-channel-adapter>
<int:splitter input-channel="toSplitter" output-channel="logger"
ref="fileSplitter" method="split" />
<int:logging-channel-adapter id="logger" level="WARN"/>
<bean id="fileSplitter" class="foo.FileSplitter" />
But according to the sample Splitter return a list of messages but I would like to process one only line. Should I use spring batch for this?
Not sure what issue you have, but since version 4.1.2 the Spring Integration provides FileSplitter as an out-of-the-box component. Since 4.2 it can be specified as an top-level <int-file:splitter> component.
And exactly this one addresses your requirements.
Plus don't forget that you can specify output-channel of that as an ExecutorChannel to process the lines from file in parallel.
>But according to the sample
According to which sample?
You are mistaken, the splitter emits a separate message for each split.
I'm trying to leverage Import/Export module to import taxonomies and taxonomy terms like so
<Orchard>
<Data>
<Taxonomy Id="/Identifier=Product-Categories" Status="Published">
<AutoroutePart Alias="eshop/categories" UseCustomPattern="false" />
<IdentityPart Identifier="Product-Categories" />
<TitlePart Title="Product Categories" />
<TaxonomyPart TermTypeName="ProductCategoriesTerm" />
</Taxonomy>
<ProductCategoriesTerm Id="/Identifier=Category-1" Status="Published">
<AutoroutePart UseCustomPattern="false" />
<IdentityPart Identifier="Category-1" />
<TitlePart Title="Test category" />
<TermPart Count="0" Selectable="true" Weight="1" TaxonomyId="/Identifier=Product-Categories" Path="" />
</ProductCategoriesTerm>
</Data>
</Orchard>
ProductCategoriesTerm when created through dashboard has default pattern
{Content.Container.Path}/{Content.Slug} ### my-taxonomy/my-term/sub-term
but importing terms makes them to use just {Content.Slug} ... How do I instruct AutoroutePart to use the default pattern? Tried UseCustomPattern="false" or exclude AutoroutePart with no effect it's just test-category instead of eshop/categories/test-category and won't regenerate even if if I set AutouroutePart to automatically regenerate when editing content and disable custom patterns and it won't revert to default pattern even if I try to publish it through dashboard.
Also it's mandatory to include "Count" for the TermPart when importing, does it affect anything? Sounds like something that should be dynamic and relevant only with export.
When importing taxonomy terms (and I guess any other part that has a container) it's necessary to specify Container for the common part. Without it Container for the part is null and therefore can't resolve {Content.Container.Path} in the alias pattern.
<CommonPart Container="/Identifier=Product-Categories" />
Or if it's nested term then Container is the parent term.
I have two questions
How do I achieve the following, I have a domain class called 'Property' - Property has two properties 'Type' and 'Value' it is currently being serialized as the following:
<Property Type="TestType"><Value>TestValue<Value><Property>
I need it to format as
<Property Type="TestType">TestValue</Property>
but I am not sure how? I have set Value to represent an Element, which does explain why it gets it's own tags but I don't want them.
I have another class - Parameter - it has a property of IsCollection ( a bool ) , I would like the IsCollection attribute to be serialized only when it is set to true, is this possible?
i.e
<Parameter Name="Foo" IsCollection="true" />
otherwise
<Parameter Name="Foo" />
Thanks Phill
I'm not sure if this will work or not, but in the DSL explorer, find the classes Serializer and you can mark it as custom. If you transform and compile you'll get a bunch of errors that indicate you need to provide your own custom serializer. I believe that you can put these customizations and other in there, though it may be more work than you are looking for.
Info: C# , VS2010 Beta 2 , DSL ToolKit Beta 2
I am trying to create the following generated XML in my DSL Diagram when used
<Method>
...
<FilterDescriptors>
<FilterDescriptor Type="Comparison" Name="EmployeeKey" />
</FilterDescriptors>
...
</Method>
This is how the Method and Filter Descriptor Domain Classes look
I believe I have set the multiplicity correct:
Method should only have 1 Filter Descriptor
A Filter Descriptor can have many Filter Descriptors i.e
<FilterDescriptors>
<FilterDescriptor Type="Comparison" Name="EmployeeKey" />
<FilterDescriptor Type="Wildcard" Name="EmployeeName" />
</FilterDescriptors>
The issue is that the output XML is like this:
<FilterDescriptors>
<FilterDescriptor>
<FilterDescriptors>
<FilterDescriptor Type="Comparison" Name="EmployeeKey" />
</FilterDescriptors>
</FilterDescriptor>
</FilterDescriptors>
We have this same pattern is several locations in our DSL Diagram and was hoping there is a something simple to resolve this rather than overriding the ReadElements and WriteElements of each domain class
Have you posted this in the DSL Tools forum at http://social.msdn.microsoft.com/Forums/en-US/dslvsarchx/threads? I don't see a thread there for it.