[jboss-cvs] jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/xml ...
Marshall Culpepper
mculpepper at jboss.com
Mon Nov 6 16:35:28 EST 2006
User: mculpepper
Date: 06/11/06 16:35:28
Added: core/plugins/org.jboss.ide.eclipse.packages.core/xml
packages.xsd packages2ant.xsl
Log:
initial commit of the new "packages" tooling core plugin
Revision Changes Path
1.1 date: 2006/11/06 21:35:28; author: mculpepper; state: Exp;jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/xml/packages.xsd
Index: packages.xsd
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<!--
JBoss, Home of Professional Open Source
Copyright 2006, JBoss Inc., and individual contributors as indicated
by the @authors tag. See the copyright.txt in the distribution for a
full listing of individual contributors.
This is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
This software is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this software; if not, write to the Free
Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->
<xsd:schema xmlns:jbxb="http://www.jboss.org/xml/ns/jbxb" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="packages" type="packages-type"/>
<xsd:complexType name="packages-type">
<xsd:annotation>
<xsd:appinfo>
<jbxb:class impl="org.jboss.ide.eclipse.packages.core.model.internal.xb.XbPackages"/>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="package" type="package-type"/>
<xsd:element maxOccurs="1" minOccurs="0" name="properties" type="properties-type"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="package-type">
<xsd:annotation>
<xsd:appinfo>
<jbxb:class
impl="org.jboss.ide.eclipse.packages.core.model.internal.xb.XbPackage" />
<jbxb:addMethod name="addChild" />
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0"
name="package" type="package-type" />
<xsd:element maxOccurs="unbounded" minOccurs="0"
name="fileset" type="fileset-type" />
<xsd:element maxOccurs="unbounded" minOccurs="0"
name="folder" type="folder-type" />
<xsd:element maxOccurs="1" minOccurs="0" name="properties"
type="properties-type" />
</xsd:sequence>
<xsd:attribute name="ref" type="xsd:string" use="optional" />
<xsd:attribute name="name" type="xsd:string" use="optional" />
<xsd:attribute name="type" type="xsd:string" use="optional">
<xsd:annotation>
<xsd:appinfo>
<jbxb:property name="packageType" />
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="todir" type="xsd:string" use="optional">
<xsd:annotation>
<xsd:appinfo>
<jbxb:property name="toDir" />
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute default="false" name="exploded"
type="xsd:boolean" use="optional" />
<xsd:attribute name="manifest" type="xsd:string" use="optional" />
<xsd:attribute name="inWorkspace" type="xsd:boolean" use="optional"></xsd:attribute>
</xsd:complexType>
<xsd:complexType name="properties-type">
<xsd:annotation>
<xsd:appinfo>
<jbxb:class impl="org.jboss.ide.eclipse.packages.core.model.internal.xb.XbProperties"/>
<jbxb:addMethod name="setProperties"/>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="1" name="property" type="property-type"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="property-type">
<xsd:annotation>
<xsd:appinfo>
<jbxb:class impl="org.jboss.ide.eclipse.packages.core.model.internal.xb.XbProperty"/>
<jbxb:addMethod name="addProperty"/>
</xsd:appinfo>
</xsd:annotation>
<xsd:attribute name="name" type="xsd:string" use="required"/>
<xsd:attribute name="value" type="xsd:string" use="required"/>
</xsd:complexType>
<xsd:complexType name="folder-type">
<xsd:annotation>
<xsd:appinfo>
<jbxb:class impl="org.jboss.ide.eclipse.packages.core.model.internal.xb.XbFolder"/>
<jbxb:addMethod name="addChild"/>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="package" type="package-type"/>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="fileset" type="fileset-type"/>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="folder" type="folder-type"/>
<xsd:element maxOccurs="1" minOccurs="0" name="properties" type="properties-type"/>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required"/>
</xsd:complexType>
<xsd:complexType name="fileset-type">
<xsd:annotation>
<xsd:appinfo>
<jbxb:class impl="org.jboss.ide.eclipse.packages.core.model.internal.xb.XbFileSet"/>
<jbxb:addMethod name="addChild"/>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="0" name="properties" type="properties-type"/>
</xsd:sequence>
<xsd:attribute name="dir" type="xsd:string" use="optional"/>
<xsd:attribute name="file" type="xsd:string" use="optional"/>
<xsd:attribute name="tofile" type="xsd:string" use="optional">
<xsd:annotation>
<xsd:appinfo>
<jbxb:property name="toFile"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="includes" type="xsd:string" use="optional"/>
<xsd:attribute name="excludes" type="xsd:string" use="optional"/>
<xsd:attribute name="project" type="xsd:string" use="optional"/>
<xsd:attribute name="inWorkspace" type="xsd:boolean" use="optional"/>
</xsd:complexType>
</xsd:schema>
1.1 date: 2006/11/06 21:35:28; author: mculpepper; state: Exp;jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/xml/packages2ant.xsl
Index: packages2ant.xsl
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="packages">
<project default="generatePackages">
<xsl:for-each select="//property[contains(@name, 'project-root')]">
<property name="{@name}" value="{@value}"/>
</xsl:for-each>
<target name="generatePackages">
<xsl:attribute name="depends">
<xsl:for-each select="package">
<xsl:value-of select="@name"/>
<xsl:if test="position() != last()">,</xsl:if>
</xsl:for-each>
</xsl:attribute>
</target>
<xsl:apply-templates select="package"/>
</project>
</xsl:template>
<xsl:template match="package">
<xsl:param name="prefix" select="''"/>
<xsl:variable name="id" select="generate-id()"/>
<xsl:variable name="target-name" select="concat($prefix, @name)"/>
<xsl:variable name="sub-package-prefix" select="concat($prefix, @name, '/')"/>
<xsl:variable name="filename"><xsl:if test="count(@todir) > 0 and @todir != ''"><xsl:value-of select="@todir"/>/</xsl:if><xsl:value-of select="@name"/></xsl:variable>
<target>
<xsl:attribute name="name"><xsl:value-of select="$target-name"/></xsl:attribute>
<xsl:attribute name="depends">
<xsl:for-each select="descendant::package[generate-id(ancestor::package[1]) = $id]">
<xsl:value-of select="concat($sub-package-prefix, @name)"/>
<xsl:if test="position() != last()">,</xsl:if>
</xsl:for-each>
</xsl:attribute>
<jar>
<xsl:attribute name="destfile"><xsl:value-of select="$filename"/></xsl:attribute>
<xsl:if test="count(@manifest) > 0 and @manifest != ''">
<xsl:attribute name="manifest"><xsl:value-of select="@manifest"/></xsl:attribute>
</xsl:if>
<xsl:apply-templates select="descendant::fileset[generate-id(ancestor::package[1]) = $id]"/>
<xsl:for-each select="descendant::package[generate-id(ancestor::package[1]) = $id]">
<zipfileset dir="." file="{@name}">
<xsl:if test="count(parent::folder) > 0"><xsl:attribute name="prefix"><xsl:apply-templates select="parent::folder"/></xsl:attribute></xsl:if>
</zipfileset>
</xsl:for-each>
</jar>
<xsl:for-each select="descendant::package[generate-id(ancestor::package[1]) = $id]">
<delete>
<xsl:attribute name="file">
<xsl:if test="count(parent::folder) > 0"><xsl:attribute name="prefix"><xsl:apply-templates select="parent::folder"/></xsl:attribute></xsl:if>
<xsl:value-of select="@name"/>
</xsl:attribute>
</delete>
</xsl:for-each>
</target>
<xsl:apply-templates select="descendant::package[generate-id(ancestor::package[1]) = $id]">
<xsl:with-param name="prefix" select="$sub-package-prefix"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="folder">
<xsl:if test="count(parent::folder) > 0"><xsl:apply-templates select="parent::folder"/>/</xsl:if><xsl:value-of select="@name"/>
</xsl:template>
<xsl:template name="get-filename">
<xsl:param name="path"/>
<xsl:variable name="newpath" select="substring-after($path, '/')"/>
<xsl:choose>
<xsl:when test="$newpath = ''"><xsl:value-of select="$path"/></xsl:when>
<xsl:otherwise><xsl:call-template name="get-filename"><xsl:with-param name="path" select="$newpath"/></xsl:call-template></xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="fileset">
<xsl:variable name="project-var">
<xsl:choose>
<xsl:when test="count(@project) = 0 or @project = ''">
${project-root}
</xsl:when>
<xsl:otherwise>
${project-root-<xsl:value-of select="@project"/>}
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="project-sub-dir">
<xsl:choose>
<xsl:when test="count(@dir) > 0 and @dir != ''">
<xsl:value-of select="concat(normalize-space($project-var), '/', @dir)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="normalize-space($project-var)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<zipfileset>
<xsl:choose>
<xsl:when test="count(@file) > 0 and @file != ''">
<xsl:variable name="filename">
<xsl:call-template name="get-filename">
<xsl:with-param name="path" select="@file"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="count(@tofile) > 0 and @tofile != ''">
<xsl:variable name="fullpath">
<xsl:if test="count(parent::folder) > 0"><xsl:apply-templates select="parent::folder"/>/</xsl:if>
<xsl:value-of select="@tofile"/>
</xsl:variable>
<xsl:attribute name="fullpath" ><xsl:value-of select="normalize-space($fullpath)"/></xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:if test="count(parent::folder) > 0"><xsl:attribute name="prefix"><xsl:apply-templates select="parent::folder"/></xsl:attribute></xsl:if>
</xsl:otherwise>
</xsl:choose>
<xsl:attribute name="file"><xsl:value-of select="normalize-space($project-sub-dir)"/>/<xsl:value-of select="@file"/></xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="dir"><xsl:value-of select="normalize-space($project-sub-dir)"/></xsl:attribute>
<xsl:if test="count(parent::folder) > 0">
<xsl:variable name="prefix"><xsl:apply-templates select="parent::folder"/></xsl:variable>
<xsl:attribute name="prefix"><xsl:value-of select="normalize-space($prefix)"/></xsl:attribute>
</xsl:if>
<xsl:if test="count(@includes) > 0 and @includes != ''">
<xsl:attribute name="includes"><xsl:value-of select="@includes"/></xsl:attribute>
</xsl:if>
<xsl:if test="count(@excludes) > 0 and @excludes != ''">
<xsl:attribute name="excludes"><xsl:value-of select="@excludes"/></xsl:attribute>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</zipfileset>
</xsl:template>
</xsl:stylesheet>
More information about the jboss-cvs-commits
mailing list