I have a requirement wherein I have to make sure that installed package should only overwrite content of English translations (i.e. en.xml) not for other translations
I have got following filter
<workspaceFilter version="1.0">
<filter root="/apps/project">
<exclude pattern="/apps/project/i18n/(.*)?" />
<include pattern="/apps/project/i18n/*en(.?xml)" />
</filter>
</workspaceFilter>
But somehow I am not able to avoid en_gb getting overwritten. I tried following filters:
/apps/uag-vrm-portal/i18n/*en(.?xml)
/apps/uag-vrm-portal/i18n/en(.xml*)
I think the problem here is the wide filter "/apps/project". What it is trying to do is, on installing the package, it is just adding a node named "apps" and then adding a node named "apps/project" and then it is replacing everything that is under "/apps/project". So, you need to make your filter more specific. For example, the following should work in your case -
<workspaceFilter version="1.0">
<filter root="/apps/project/i18n">
<exclude pattern="/apps/project/i18n(/.*)?"/>
<include pattern="/apps/project/i18n/en(/.*)?"/>
</filter>
</workspaceFilter>
I recommend avoiding a mix of include & exclude rules inside a single filter. You could break it up into multiple filters:
<workspaceFilter version="1.0">
<filter root="/apps/project/components" />
<filter root="/apps/project/core" />
<filter root="/apps/project/i18n/en/(.*)" />
</workspaceFilter>
or try to write with only exclude patterns:
<workspaceFilter version="1.0">
<filter root="/apps/project">
<exclude pattern="/apps/project/i18n/es(.*)?" />
<exclude pattern="/apps/project/i18n/en_gb(.*)?" />
</filter>
</workspaceFilter>
or write multiple include patterns (an exercise I leave to you).
But the combination of include and exclude patterns are fighting each other - with no way to determine which pattern takes precedence.
Maybe I miss something, but why can't you set the filter to the en node only and exclude the other english language nodes?
<workspaceFilter version="1.0">
<filter root="/apps/project/i18n/en">
<exclude pattern="/apps/project/i18n/en_.*"/>
</filter>
</workspaceFilter>
If you need all the other languages, except en_gb you could exclude this explicitly.
Related
Our project structure regarding the logback.xmls looks like this:
src\main\resources\logback.xml
src\main\resources\config\dev\logback.xml
src\main\resources\config\sjngm\dev\logback.xml
src\main\resources\config\int\logback.xml
src\main\resources\config\local\logback.xml
src\main\resources\config\prod\logback.xml
where the first one references to the environment specific one:
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="30 seconds">
<contextName>sjngm</contextName>
<jmxConfigurator />
<include resource="config/${extra}${env:-local}/logback.xml" />
</configuration>
Note that extra is not defined most of the times, which is why used this for a while:
<include resource="config/${extra:-}${env:-local}/logback.xml" />
This stopped working at one point, can't remember which version of logback. So we changed it to
<include resource="config/${extra:-./}${env:-local}/logback.xml" />
which also worked for quite a while.
Now we switched to Spring Boot 1.5.4 (contains logback-classic 1.1.11 and logback-core 1.1.11) and it stopped working again. The latest error message is:
11:08:15,020 |-WARN in ch.qos.logback.core.joran.action.IncludeAction - Could not find resource corresponding to [config/./local/logback.xml]
If I go back to
<include resource="config/${extra:-}${env:-local}/logback.xml" />
the message is
11:19:28,778 |-WARN in ch.qos.logback.core.joran.action.IncludeAction - Could not find resource corresponding to [config/extra_IS_UNDEFINEDlocal/logback.xml]
Note that logback still uses "local" as a default string for env, so not all is broken.
What do I do now? Basically I want to tell logback that I want an empty string where extra would be.
This also doesn't work:
<property name="defaultExtra" value="" />
<include resource="config/${extra:-${defaultExtra}}${env:-local}/logback.xml" />
as an empty string seems to always result in an undefined property.
The only working thing I can come up with is this:
<if condition='isDefined("extra")'>
<then>
<include resource="config/${extra}${env:-local}/logback.xml" />
</then>
<else>
<include resource="config/${env:-local}/logback.xml" />
</else>
</if>
plus this into the pom.xml:
<dependency>
<groupId>org.codehaus.janino</groupId>
<artifactId>janino</artifactId>
</dependency>
Isn't this nice?! So why did they have to break what was working nicely???
This worked for me:
<property name="extra" value="${logback.myApp.extra:- }" />
Logback seems to trim Whitespace out of the value. So the default value of Space did the trick.
Embedded Whitespace is preserved, which may lead to a FileNotFoundException if Tabs were embedded, but embedded Spaces were ok.
Setting a Property in a Java Initialiser had the desired effect:
System.setProperty("logback.myApp.extra", "\t \tEXTRA_EXTRA_EXTRA\t \t");
The Tabs & Spaces were removed from the Property, which was assigned the value EXTRA_EXTRA_EXTRA
(the Java Initialiser must be invoked before any Logging has taken place & may contain no Logging itself)
You could of course set the Property on the Java Command line.
P.S. if the Property is undefined & you omit the Space (${logback.myApp.extra:-}), it is assigned the value:
logback.myApp.extra_IS_UNDEFINED
...so it may be wise to add a suitable comment:
<property name="extra" value="${logback.myApp.extra:- }" /><!-- N.B. Empty Default value must contain # least 1 Space!! -->
I know to check for a parameter, we have to do something like this
use boolean xpath function to verify if your property exist :
<filter xpath="boolean(get-property('ModifiedOn'))">
<then>
...
</then>
<else>
...
</else>
</filter>
can you please tell me how can i check if more than one parameter is there. I mean we need to check 3 parameters. how can we do this ?
Specify all of your criteria that must be true and evaluate as a boolean:
<filter xpath="boolean(boolean(get-property('ModifiedOn') and
boolean(get-property('prop2')) and
boolean(get-property('prop3'))">
<then>
...
</then>
<else>
...
</else>
</filter>
As a solution you can set the parameters as below:
<filter xpath="fn:number(get-property('SIMPLE_SER_AMT')) > fn:number(get-property('SECURE_SER_AMT'))">
For more information you can refer Sample 156: Service Integration with specifying the receiving sequence available on [1]
Hope this information will help you.
For my case none of the listed solutions worked. I am using WSO2 version: 6.5
I was able to make multiple conditions as follows:
<filter regex="true" source="boolean(get-property('VALUE1')) and boolean(get-property('VALUE2')) and boolean(get-property('VALUE3'))">
<then> ...
This expression will make sure that value 1 and 2 and 3 are filled before running the code in the 'then' clause.
I am trying to apply a different html (theme) to my front-page (index.html) while all my other pages will have the same theme (index_in.html). I am trying it this way and was wondering why it is not working:
excerpted from my rules.xml:
...
<theme href="index_in.html" css:if-content="#visual-portal-wrapper" />
<rules css:if-content="#visual-portal-wrapper">
<theme href="index.html" if-path="front-page"/>
<theme href="index_in.html" />
...
Thank You
Try...
<rules css:if-content="#visual-portal-wrapper">
<theme href="index.html" if-path="front-page" />
<theme href="index_in.html" />
...
</rules>
If the front page has #visual-portal-wrapper, then the first will match that too and be used. Conditional themes are tried in the order they appear and the first one to match is used.
I am trying to get the XPath "/deployment/service". Tested on this site:
http://www.xmlme.com/XpathTool.aspx
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org /axis/wsdd/providers/java">
<service name="kontowebservice" provider="java:RPC" style="rpc" use="literal">
<parameter name="wsdlTargetNamespace" value="http://strategies.spine"/>
<parameter name="wsdlServiceElement" value="ExposerService"/>
<parameter name="wsdlServicePort" value="kontowebservice"/>
<parameter name="className" value="some.package.internal.KontoWebServiceImpl_WS"/>
<parameter name="wsdlPortType" value="Exposer"/>
<parameter name="typeMappingVersion" value="1.2"/>
<operation xmlns:operNS="http://strategies.spine" xmlns:rtns="http://www.w3.org/2001/XMLSchema" name="expose" qname="operNS:expose" returnQName="exposeReturn" returnType="rtns:anyType" soapAction="">
<parameter xmlns:tns="http://www.w3.org/2001/XMLSchema" qname="in0" type="tns:anyType"/>
</operation>
<parameter name="allowedMethods" value="expose"/>
<parameter name="scope" value="Request"/>
</service>
</deployment>
I absolutely can't find out why it always tells me that my xpath does not match...
This may be stupid, but am I missing something?
EDIT
Thanks to the answer from Dimitre Novatchev I was able to find a workaround:
<xmltask failwithoutmatch="true" report="false">
<fileset dir="${src.gen}/" includes="**/*-deploy.wsdd" />
<copy path="//*[local-name()='service']" buffer="tmpServiceBuf" append="true" />
</xmltask>
<xmltask failwithoutmatch="true" report="false" source="${basedir}/env/axis/WEB-INF/server-config.wsdd" dest="${build.stage}/resources/WEB-INF/server-config.wsdd">
<insert path="//*[local-name()='transport'][last()]" buffer="tmpServiceBuf" position="after" />
</xmltask>
Binding namespaces with xmltask (which is the tool that gave me the headaches) seems not to be possible. The code above did the trick.
The Problem: This XML document has a default namespace. XPath considers any unprefixed names to be in "no-namespace". It tries to select /deployment/service where the elements deployment and service are in no-namespace and doesn't select any node, because in the provided XML documents there are no such elements that are in "no- namespace (they all are in the "http://xml.apache.org/axis/wsdd/" namespace)
The solution: Using the language which hosts XPath (such as C#, Jave, XSLT, or any other language that you may be using) bind a prefix (say x:) to the namespace "http://xml.apache.org/axis/wsdd/".
Then, change:
/deployment/service
to
/x:deployment/x:service
Now the last XPath expression correctly selects the desired node.
I use CruiseControl.NET to automatically build my .NET 3.5 web applications, which works a treat. However, is there any way to automatically create a ZIP file of these builds, and put the ZIP's into a separate directory?
I have seen this is possible using NAnt but cannot find an example of how to get this working.
Can anyone offer help/examples?
I've just added such a Nant task to our CC machine.
See http://nant.sourceforge.net/release/latest/help/tasks/zip.html
Note when initially viewing the zip archive, it may appear as if all the files are at the same level, i.e no folders, but actually they folders are preserved.
Notice how you can exclude file types or folders.
You could take the approach of only including the file types you want and excluding the rest.
First define properties for where the source files are allcode.dir and the name and location of the zip file sourcebackup.zip
Now here is the nant task
<zip zipfile="${sourcebackup.zip}" includeemptydirs="true" verbose="true">
<fileset basedir="${allcode.dir}">
<include name="**/*" />
<exclude name="**/_resharper*/**" />
<exclude name="**/build/**" />
<exclude name="**/obj/**" />
<exclude name="**/bin/**" />
<exclude name="**/*.dll" />
<exclude name="**/*.scc" />
<exclude name="**/*.log" />
<exclude name="**/*.vssscc" />
<exclude name="**/*.suo" />
<exclude name="**/*.user" />
<exclude name="**/*.pdb" />
<exclude name="**/*.cache" />
<exclude name="**/*.vspscc" />
<exclude name="**/*.msi" />
<exclude name="**/*.irs" />
<exclude name="**/*.exe" />
</fileset>
<echo message="########## Zipped##########" />
Call this from your cc build like any other nant task.
We find it best if each CC project calls a single task if possible, then you only have to change the nant script, and you can run the nant script on your local machine.
Eg in the project block, we have the single target "build", which as part of its work calls ZipSource
<targetList>
<target>Build</target>
</targetList>
We use the above for a BizTalk project.
Enjoy.
If you're using Nant, then doesn't the Zip task work for you?
We are zipping the sources of a CruiseControl.NET project
but we are using ant
<target name="zipProject">
<mkdir dir="output"/>
<zip destfile="output\sources.zip" basedir="C:\project\src" />
</target>
i don't know about nant but i would expect it to be similar
#David: The NAnt Zip task is what I'm after, yes, but I'm asking how to integrate it as part of an automatic CruiseControl.NET build. If you take a look at the NAnt documentation for the cruise control config it doesn't make it clear if I can run an NAnt task from inside the <tasks> XML node in my CruiseControl config - it only says that it can be part of a <schedule>.
I have found a few examples of setting up your CruiseControl config and a few examples of NAnt tasks but nothing that integrates the two: specifically, zipping up a CruiseControl build.
If anyone has some sample XML of their CruiseControl config, hooking up to an NAnt zip task, post samples here.
Cheers.