Skip to content

Instantly share code, notes, and snippets.

@ivv-private
Created October 30, 2012 09:30
Show Gist options
  • Save ivv-private/3979238 to your computer and use it in GitHub Desktop.
Save ivv-private/3979238 to your computer and use it in GitHub Desktop.
blog-maven-features
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:f="http://foo.bar/features">
<xsl:strip-space elements="*"/>
<xsl:output method="xml" indent="yes"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
<xsl:template match="f:feature[@enabled = 'on']">
<xsl:apply-templates select="node()" />
</xsl:template>
<xsl:template match="f:feature[@enabled != 'on']"/>
</xsl:stylesheet>
<properties>
<!-- Off Debug Mode -->
<prodMode>
<context-param>
<description>Production mode</description>
<param-name>productionMode</param-name>
<param-value>true</param-value>
</context-param>
</prodMode>
<!-- Secure -->
<securityConstraint>
<security-role>
<role-name>USER</role-name>
</security-role>
<security-constraint>
<web-resource-collection>
<web-resource-name>Restricted Area</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>USER</role-name>
</auth-constraint>
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>Public Area</web-resource-name>
<url-pattern>/public/*</url-pattern>
</web-resource-collection>
</security-constraint>
</securityConstraint>
<!-- Web Service Entry -->
<wsServlet/>
<wsServletMapping/>
<!-- Administrating users -->
<uatAdminDS/>
</properties>
<profiles>
<!-- Production Environment -->
<profile>
<id>prod-env</id>
<properties>
<securityConstraint>
<security-role>
<role-name>USER</role-name>
</security-role>
<security-constraint>
<web-resource-collection>
<web-resource-name>Restricted Area</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>USER</role-name>
</auth-constraint>
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>Public Area</web-resource-name>
<url-pattern>/public/*</url-pattern>
</web-resource-collection>
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>Public Web Service</web-resource-name>
<url-pattern>/ws/*</url-pattern>
</web-resource-collection>
</security-constraint>
</securityConstraint>
<wsServlet>
<servlet>
<servlet-name>ws-servlet</servlet-name>
<servlet-class>foo.bar.WsServlet</servlet-class>
</servlet>
</wsServlet>
<wsServletMapping>
<servlet-mapping>
<servlet-name>ws-servlet</servlet-name>
<url-pattern>/ws/*</url-pattern>
</servlet-mapping>
</wsServletMapping>
</properties>
</profile>
<!-- UAT Environment -->
<profile>
<id>uat-env</id>
<properties>
<prodMode/>
<uatAdminDS>
<resource-ref>
<description>Data source</description>
<res-ref-name>jdbc/Admin</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</uatAdminDS>
</properties>
</profile>
<!-- Development Local -->
<profile>
<id>dev-env</id>
<properties>
<prodMode/>
<securityConstraint/>
</properties>
</profile>
</profiles>
<web-app>
...
${prodMode}
<servlet>
<servlet-name>app</servlet-name>
<servlet-class>foo.bar.AppServlet</servlet-class>
</servlet>
${wsServlet}
<servlet-mapping>
<servlet-name>app</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
${wsServletMapping}
<resource-ref>
<description>Data source</description>
<res-ref-name>jdbc/Main</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
${uatAdminDS}
${securityConstraint}
...
<uatAdminDS/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment